ymq 1c04efe1be feat(agent): 会话agent四项Hermes能力对齐(记忆写入/技能管理/后台进程/并行委派)
1. memory 工具(add/list/remove): 多租户写入门禁——org_id/user_id强制注入、
   scope白名单user/project/pipeline(global/org种子域禁写)、无身份拒写、
   remove仅本人条目; 记忆注入改可见性过滤版(修跨机构泄漏)
2. manage_skill(create/patch/write_file/remove_file/delete): skill_live扩展,
   只落本租户orgs/users目录, global原版fork-on-write(校验通过才fork,失败零残留),
   org+user双副本同步改, 产线层拒改, delete只删本租户副本+审计留痕
3. run_command background=true + process工具(poll/log/wait/kill): bg_jobs.py
   状态文件化(workspace/.bg/,跨worker可见), 沙箱档位与前台一致(generic强制
   strict+无bwrap拒绝), 超时SIGTERM进程组+stale心跳判活
4. delegate_subtask background + subagent工具(list/steer/stop/result):
   subagents.py 并行上限3/workspace, 深度限制1(子agent禁再委派),
   子会话session_isolation=none(不读父历史不写会话表), steer/stop文件传递
   每轮tool-loop边界消费, 结果流式落盘(stop即部分结果)
2026-09-10 17:09:45 +08:00
2026-08-08 11:43:26 +08:00

pipeline_service

产线执行引擎 —— 任务调度、步骤执行、人工任务交互、LLM 桥接。

功能

  • 任务执行DAG 步骤调度与状态机
  • 人工任务:审批/输入等待与交互
  • LLM 桥接:统一 LLM 调用接口
  • Agent LoopAI Agent 多轮任务执行
  • 意图分类:自然语言意图识别
  • 产物管理:步骤输入输出存储

数据表

说明
pipeline_tasks 任务实例
pipeline_task_steps 步骤执行记录
pipeline_artifacts 步骤产物
pipeline_human_tasks 人工任务
pipeline_step_types 步骤类型注册
pipeline_session_settings 会话设置(多 tab 项目上下文)
pipeline_conversations 平台会话消息回放缓存2026-09-10 归籍本模块——唯一写入方 agent_loop_v2._save_turn此前是无 models 定义的孤儿表)

安装

cd pkgs/pipeline-service && pip install .

核心模块

文件 职责
executor.py 任务/步骤调度引擎
storage.py 数据库读写
llm_bridge.py LLM API 调用
agent_loop.py AI Agent 多轮执行
human.py 人工任务处理
intent_classifier.py 意图识别
state.py 状态机
step_registry.py 步骤类型注册表
agent_loop_v2.py Agent Executor v2会话 agent 执行引擎)
workspace.py 项目/通用会话工作空间目录管理
sdlc_ability.py SDLC 产线能力包(工具定义 + handler

通用会话产线隔离2026-09-057 层纵深防御)

规范通用会话generic=Trueagent_chat_generic.dspy= 纯通用 agent 不挂任何产线工具/技能/角色/记忆,不得看到或操作任何产线的项目。

隔离层(缺一层即泄漏,详见技能 cockpit-agent-patterns

  1. 工具注册表ToolRegistry 每 executor 独立实例(禁全局单例,防跨会话残留)
  2. 默认产线回退generic 会话 pipeline_id 空不回退 DEFAULT_ABILITY_ID
  3. 产线能力包_execute_ability_tool 对 generic 直接拒绝
  4. 工具 schemaload_agent_configpipeline-coregeneric 时剔除 project/shell 类工具
  5. 执行层兜底_dispatch_sdlc_tool 对 generic 拒绝项目管理工具(别名归一后拦截)
  6. 工作空间generic 会话文件根 = _general/{user_id} 专属目录generic_workspace_dir _resolve_ws_path 越界保护圈死run_command 剔除shell 无法圈禁); resolve_upload_dirpipeline-coregeneric=True 上传落同一专属目录
  7. 历史回放_load_history / _t_session_search 对 generic 只读写 pipeline_id='' OR IS NULL 的自身历史(与存库端 store_pl='' 对称), 禁止按 created_by 全量回放(会带出用户各产线对话中的项目信息)
Description
No description provided
Readme 1.4 MiB
Languages
Python 99.5%
Shell 0.5%