89 lines
4.9 KiB
Markdown
89 lines
4.9 KiB
Markdown
# pipeline_core
|
||
|
||
产线核心模块 —— 管理产线定义、步骤编排、版本控制、发布流程。
|
||
|
||
## 功能
|
||
|
||
- **产线管理**:产线 CRUD,定义产线名称与描述
|
||
- **步骤编排**:产线步骤的增删改查,支持依赖关系(DAG)
|
||
- **版本控制**:产线版本发布与回滚
|
||
- **编辑器**:可视化产线步骤编排界面
|
||
|
||
## 数据表
|
||
|
||
| 表 | 说明 |
|
||
|---|------|
|
||
| pipelines | 产线定义 |
|
||
| pipeline_steps | 产线步骤(含 deps 依赖) |
|
||
| pipeline_versions | 产线版本快照 |
|
||
| llm | 大模型配置 |
|
||
| sd_projects | 软件项目定义(2026-09-10 自 pipeline-sdlc 迁入,跨产线共享) |
|
||
| sd_project_role_models | 项目角色模型配置(同上迁入;下拉 codes 指 sd_role 字典 + llm_model(status=active)) |
|
||
| pipeline_deliverables | 产线交付物(同上迁入;主要写入方 pipeline-bidding) |
|
||
| pipeline_user_memory | 跨会话持久记忆(2026-09-10 多租户:加 org_id/user_id 归属列,key 掺租户维度,迁移 m0023) |
|
||
|
||
## 跨产线共享资源(wwwroot/api/)
|
||
|
||
三张迁入表配套 15 个 api dspy 与手写角色模型页(`wwwroot/sd_project_role_models/`,
|
||
git 跟踪、勿被 xls2ui 覆盖)。sdlc 侧页面消费 `get_project_options.dspy` 用绝对路径
|
||
`/pipeline_core/api/**` 引用;反向本模块页面消费 sdlc 子表也用绝对路径。
|
||
|
||
### 已知表治理清单(2026-09-10 审计)
|
||
|
||
- `pipeline_conversations`:孤儿表——有真实读写(pipeline-service agent_loop_v2 的 sor.C
|
||
落盘、驾驶舱 v2 历史加载),但**全平台无 models JSON 定义**,建表靠历史残留,
|
||
新库部署会缺表。待补 models 定义(归属 pipeline-service 或 core 待定)。
|
||
- `sd_conversations`:死表——pipeline-sdlc 有 models 定义,但 2026-08-01 后全平台零写,
|
||
仅存 SELECT/DELETE/孤儿巡检引用。驾驶舱 v2 已改用 pipeline_conversations。待删除决议。
|
||
|
||
## 安装
|
||
|
||
```bash
|
||
cd pkgs/pipeline_core && pip install .
|
||
```
|
||
|
||
## 集成
|
||
|
||
伞仓 (pipeline-app) 通过 wwwroot symlink 加载本模块:
|
||
```
|
||
wwwroot/pipeline_core -> ../pkgs/pipeline_core/wwwroot
|
||
```
|
||
|
||
## 通用会话产线隔离(2026-09-05)
|
||
|
||
配合 pipeline-service 的 7 层隔离(详见其 README),本模块承担:
|
||
|
||
- `agent_config.load_agent_config(generic=True)`:不挂产线能力包,
|
||
并剔除 GENERAL_TOOLS 中 category=project/shell 的工具(schema 层防线,
|
||
LLM 根本看不见项目管理/命令执行工具)
|
||
- `upload_tools.resolve_upload_dir(generic=True)`:通用会话上传文件落
|
||
`_general/{uid}` 专属目录,与 AgentExecutor 的文件根一致
|
||
(_resolve_ws_path 越界保护只认该目录)
|
||
- `wwwroot/api/agent_chat_generic.dspy`:纯通用会话入口(generic=True)
|
||
|
||
## agent 通用能力对齐 Hermes(2026-09-10)
|
||
|
||
把 Hermes Agent 的「写入侧/运行时侧」能力补齐给产线会话 agent,GENERAL_TOOLS
|
||
从 25 个扩到 29 个,新增四工具(定义在本模块 `agent_config.py`,handler 在
|
||
pipeline-service `agent_loop_v2.py`):
|
||
|
||
| 工具 | 能力 | 隔离/门禁 |
|
||
|---|---|---|
|
||
| `memory` | add/list/remove 持久记忆(对齐 Hermes memory) | 多租户写入门禁在 handler:只能写 user/project/pipeline 域(global/org 种子域禁写),org_id/user_id 强制注入会话真实身份(忽略 LLM 传值),无身份拒写,remove 仅本人条目 |
|
||
| `manage_skill` | create/patch/write_file/remove_file/delete 技能(对齐 skill_manage) | 只落本租户 orgs/{org} 或 org 0 降级 users/{uid};改 global 原版走 fork-on-write 继承副本;产线层拒改;子文件限 references/scripts/templates/assets |
|
||
| `process` | poll/log/wait/kill 后台任务(配套 run_command background) | 状态文件化在 workspace/.bg/,跨 worker 可见;只解析发起者 workspace |
|
||
| `subagent` | list/steer/stop/result 后台子 agent(配套 delegate_subtask background) | 同 workspace 并行上限 3、深度限制 1、子会话历史隔离 |
|
||
|
||
`run_command` 加 `background`/`timeout` 参数;`delegate_subtask` 加 `background`。
|
||
|
||
**记忆多租户(memory_store.py)**:每条记忆带 org_id/user_id 归属列;
|
||
`visible_to()` 是唯一可见性权威(平台种子 org_id='' 全员只读 + org 归属本机构共享 +
|
||
user 归属仅本人 + pipeline/project 域带机构匹配);`memory_key` = hash(content+org+
|
||
user+scope+scope_id),同内容跨租户 key 不同、唯一索引永不碰撞;`_evict_partition`
|
||
按 org+user 分区淘汰,agent 写入绝不删种子或他租户记忆;写后失效缓存保多 worker
|
||
一致。`get()` 是无过滤底层查询(管理用),agent 读取一律走 `get_visible()`。
|
||
|
||
**ToolDefinition.required 字段(2026-09-10)**:None=旧行为(全参数必填),含可选
|
||
参数的工具须显式声明 required 列表,否则 `to_openai_schema()` 把可选参数标成
|
||
required、LLM 被迫为每个参数编值。GENERAL_TOOLS 全部带可选参数的工具已补 required。
|