docs: add plugin system analysis artifacts

This commit is contained in:
lambert.li
2026-08-14 15:37:39 +08:00
parent 740c3208c5
commit f4a283734f
34 changed files with 44980 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
# CodeGraph data files — local to each machine, not for committing.
# Ignore everything in .codegraph/ except this file itself, so transient
# files (the database, daemon.pid, sockets, logs) never show up in git.
*
!.gitignore
@@ -0,0 +1,11 @@
{
"reviewed": true,
"issues": [],
"notes": [
"Merge 'Fixed' section sane: 92 low->simple, 91 medium->moderate, 41 high->complex (systemic LLM complexity vocabulary, expected).",
"3 'interface' node types mapped to 'class' (schema 'class' covers class/interface/type); id prefix interface: -> class:.",
"10 unknown complexity values (very-high/medium-high) already defaulted to 'moderate' by merge script - confirmed acceptable.",
"No missing-id nodes; no recoverable dangling edges (cross-package imports resolve to nodes in other dsh packages outside this scoped analysis).",
"tested_by linker: 17 production nodes tagged 'tested'."
]
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,123 @@
{
"nodes": [
{
"id": "config:agent/README.i18n.yaml",
"type": "config",
"name": "README.i18n.yaml",
"filePath": "agent/README.i18n.yaml",
"summary": "agent 包的双语 README 配对一致性记录,保存 README.md 与 README.zh.md 的 git blob 哈希用于翻译门禁。",
"tags": [
"configuration",
"i18n",
"bilingual"
],
"complexity": "simple"
},
{
"id": "document:agent/README.md",
"type": "document",
"name": "README.md",
"filePath": "agent/README.md",
"summary": "dsh-agent 包的英文 README,描述 AgentRegistry 服务(ctx 键 agents),涵盖公开 API、发起方 Agent 作用域、工厂 API、实时事件、Agent 接口(types.ts)、扩展点,以及用户/steering/注入消息与 Agent 作用域请求组合的模型体验。",
"tags": [
"documentation",
"readme",
"agent",
"agent-registry"
],
"complexity": "simple"
},
{
"id": "document:agent/README.zh.md",
"type": "document",
"name": "README.zh.md",
"filePath": "agent/README.zh.md",
"summary": "dsh-agent 包的中文 README,描述 AgentRegistry 服务(ctx 键 agents),涵盖公开 API、发起方 Agent 作用域、工厂 API、实时事件、Agent 接口(types.ts)、扩展点,以及用户/steering/注入消息与 Agent 作用域请求组合的模型体验。",
"tags": [
"documentation",
"readme",
"i18n",
"agent",
"agent-registry"
],
"complexity": "simple"
},
{
"id": "config:agent/package.json",
"type": "config",
"name": "package.json",
"filePath": "agent/package.json",
"summary": "npm 包 @deepseek-ai/dsh-agent 的清单文件,声明入口(lib/index.js)、types、exports、依赖与 peer 依赖。",
"tags": [
"configuration",
"npm",
"manifest"
],
"complexity": "simple"
},
{
"id": "config:agent/tsconfig.json",
"type": "config",
"name": "tsconfig.json",
"filePath": "agent/tsconfig.json",
"summary": "agent 子包的 TypeScript 编译配置,继承 tsconfig.base.jsonrootDir=src、outDir=lib/types,并声明对 vendored cordis/cosmokit/schemastery 及相关 workspace 包的 project references。",
"tags": [
"configuration",
"typescript",
"build-system"
],
"complexity": "simple"
}
],
"edges": [
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:agent/README.i18n.yaml",
"target": "document:agent/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:agent/README.i18n.yaml",
"target": "document:agent/README.zh.md"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:agent/README.md",
"target": "file:agent/src/index.ts"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:agent/README.zh.md",
"target": "file:agent/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:agent/tsconfig.json",
"target": "file:agent/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:agent/package.json",
"target": "file:agent/src/index.ts"
},
{
"type": "depends_on",
"direction": "forward",
"weight": 0.6,
"source": "config:agent/package.json",
"target": "file:agent/src/index.ts"
}
]
}
@@ -0,0 +1,123 @@
{
"nodes": [
{
"id": "config:scope/README.i18n.yaml",
"type": "config",
"name": "README.i18n.yaml",
"filePath": "scope/README.i18n.yaml",
"summary": "scope 包的双语 README 配对一致性记录,保存 README.md 与 README.zh.md 的 git blob 哈希用于翻译门禁。",
"tags": [
"configuration",
"i18n",
"bilingual"
],
"complexity": "simple"
},
{
"id": "document:scope/README.md",
"type": "document",
"name": "README.md",
"filePath": "scope/README.md",
"summary": "dsh-scope 包的英文 README,描述作用域上下文注册原语的公开 API、设计约定与已知限制。",
"tags": [
"documentation",
"readme",
"scope",
"scoping-primitive"
],
"complexity": "simple"
},
{
"id": "document:scope/README.zh.md",
"type": "document",
"name": "README.zh.md",
"filePath": "scope/README.zh.md",
"summary": "dsh-scope 包的中文 README,描述作用域上下文注册原语的公开 API、设计约定与已知限制。",
"tags": [
"documentation",
"readme",
"i18n",
"scope",
"scoping-primitive"
],
"complexity": "simple"
},
{
"id": "config:scope/package.json",
"type": "config",
"name": "package.json",
"filePath": "scope/package.json",
"summary": "npm 包 @deepseek-ai/dsh-scope 的清单文件,声明入口(lib/index.js)、types、exports、依赖与 peer 依赖。",
"tags": [
"configuration",
"npm",
"manifest"
],
"complexity": "simple"
},
{
"id": "config:scope/tsconfig.json",
"type": "config",
"name": "tsconfig.json",
"filePath": "scope/tsconfig.json",
"summary": "scope 子包的 TypeScript 编译配置,继承 tsconfig.base.jsonrootDir=src、outDir=lib/types,并声明对 vendored cordis/cosmokit/schemastery 及相关 workspace 包的 project references。",
"tags": [
"configuration",
"typescript",
"build-system"
],
"complexity": "simple"
}
],
"edges": [
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:scope/README.i18n.yaml",
"target": "document:scope/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:scope/README.i18n.yaml",
"target": "document:scope/README.zh.md"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:scope/README.md",
"target": "file:scope/src/index.ts"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:scope/README.zh.md",
"target": "file:scope/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:scope/tsconfig.json",
"target": "file:scope/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:scope/package.json",
"target": "file:scope/src/index.ts"
},
{
"type": "depends_on",
"direction": "forward",
"weight": 0.6,
"source": "config:scope/package.json",
"target": "file:scope/src/index.ts"
}
]
}
@@ -0,0 +1,125 @@
{
"nodes": [
{
"id": "config:session/README.i18n.yaml",
"type": "config",
"name": "README.i18n.yaml",
"filePath": "session/README.i18n.yaml",
"summary": "session 包的双语 README 配对一致性记录,保存 README.md 与 README.zh.md 的 git blob 哈希用于翻译门禁。",
"tags": [
"configuration",
"i18n",
"bilingual"
],
"complexity": "simple"
},
{
"id": "document:session/README.md",
"type": "document",
"name": "README.md",
"filePath": "session/README.md",
"summary": "dsh-session 包的英文 README,描述 SessionStore 服务(ctx 键 sessions),涵盖公开 API、有序清理生命周期原语、实时服务事件、Session 类、无损 JSON 工具、分片行存储编解码器、Surface 类型、请求头重建、会话事件词汇、元数据类型、扩展点,以及派生消息历史、崩溃修复结果、已记录请求头等场景的模型体验。",
"tags": [
"documentation",
"readme",
"session",
"session-store",
"event-sourced"
],
"complexity": "simple"
},
{
"id": "document:session/README.zh.md",
"type": "document",
"name": "README.zh.md",
"filePath": "session/README.zh.md",
"summary": "dsh-session 包的中文 README,描述 SessionStore 服务(ctx 键 sessions),涵盖公开 API、有序清理生命周期原语、实时服务事件、Session 类、无损 JSON 工具、分片行存储编解码器、Surface 类型、请求头重建、会话事件词汇、元数据类型、扩展点,以及派生消息历史、崩溃修复结果、已记录请求头等场景的模型体验。",
"tags": [
"documentation",
"readme",
"i18n",
"session",
"session-store",
"event-sourced"
],
"complexity": "simple"
},
{
"id": "config:session/package.json",
"type": "config",
"name": "package.json",
"filePath": "session/package.json",
"summary": "npm 包 @deepseek-ai/dsh-session 的清单文件,声明入口(lib/index.js)、types、exports、依赖与 peer 依赖。",
"tags": [
"configuration",
"npm",
"manifest"
],
"complexity": "simple"
},
{
"id": "config:session/tsconfig.json",
"type": "config",
"name": "tsconfig.json",
"filePath": "session/tsconfig.json",
"summary": "session 子包的 TypeScript 编译配置,继承 tsconfig.base.jsonrootDir=src、outDir=lib/types,并声明对 vendored cordis/cosmokit/schemastery 及相关 workspace 包的 project references。",
"tags": [
"configuration",
"typescript",
"build-system"
],
"complexity": "simple"
}
],
"edges": [
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:session/README.i18n.yaml",
"target": "document:session/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:session/README.i18n.yaml",
"target": "document:session/README.zh.md"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:session/README.md",
"target": "file:session/src/index.ts"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:session/README.zh.md",
"target": "file:session/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:session/tsconfig.json",
"target": "file:session/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:session/package.json",
"target": "file:session/src/index.ts"
},
{
"type": "depends_on",
"direction": "forward",
"weight": 0.6,
"source": "config:session/package.json",
"target": "file:session/src/index.ts"
}
]
}
@@ -0,0 +1,123 @@
{
"nodes": [
{
"id": "config:system-prompt/README.i18n.yaml",
"type": "config",
"name": "README.i18n.yaml",
"filePath": "system-prompt/README.i18n.yaml",
"summary": "system-prompt 包的双语 README 配对一致性记录,保存 README.md 与 README.zh.md 的 git blob 哈希用于翻译门禁。",
"tags": [
"configuration",
"i18n",
"bilingual"
],
"complexity": "simple"
},
{
"id": "document:system-prompt/README.md",
"type": "document",
"name": "README.md",
"filePath": "system-prompt/README.md",
"summary": "dsh-system-prompt 包的英文 README,描述 SystemPrompt 服务(ctx 键 systemPrompt),涵盖配置、公开 API、实时事件、关键类型、扩展点,以及系统提示词(harness 身份)与工具 schema 的模型体验。",
"tags": [
"documentation",
"readme",
"system-prompt",
"prompt-assembly"
],
"complexity": "simple"
},
{
"id": "document:system-prompt/README.zh.md",
"type": "document",
"name": "README.zh.md",
"filePath": "system-prompt/README.zh.md",
"summary": "dsh-system-prompt 包的中文 README,描述 SystemPrompt 服务(ctx 键 systemPrompt),涵盖配置、公开 API、实时事件、关键类型、扩展点,以及系统提示词(harness 身份)与工具 schema 的模型体验。",
"tags": [
"documentation",
"readme",
"i18n",
"system-prompt",
"prompt-assembly"
],
"complexity": "simple"
},
{
"id": "config:system-prompt/package.json",
"type": "config",
"name": "package.json",
"filePath": "system-prompt/package.json",
"summary": "npm 包 @deepseek-ai/dsh-system-prompt 的清单文件,声明入口(lib/index.js)、types、exports、依赖与 peer 依赖。",
"tags": [
"configuration",
"npm",
"manifest"
],
"complexity": "simple"
},
{
"id": "config:system-prompt/tsconfig.json",
"type": "config",
"name": "tsconfig.json",
"filePath": "system-prompt/tsconfig.json",
"summary": "system-prompt 子包的 TypeScript 编译配置,继承 tsconfig.base.jsonrootDir=src、outDir=lib/types,并声明对 vendored cordis/cosmokit/schemastery 及相关 workspace 包的 project references。",
"tags": [
"configuration",
"typescript",
"build-system"
],
"complexity": "simple"
}
],
"edges": [
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:system-prompt/README.i18n.yaml",
"target": "document:system-prompt/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:system-prompt/README.i18n.yaml",
"target": "document:system-prompt/README.zh.md"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:system-prompt/README.md",
"target": "file:system-prompt/src/index.ts"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:system-prompt/README.zh.md",
"target": "file:system-prompt/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:system-prompt/tsconfig.json",
"target": "file:system-prompt/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:system-prompt/package.json",
"target": "file:system-prompt/src/index.ts"
},
{
"type": "depends_on",
"direction": "forward",
"weight": 0.6,
"source": "config:system-prompt/package.json",
"target": "file:system-prompt/src/index.ts"
}
]
}
@@ -0,0 +1,125 @@
{
"nodes": [
{
"id": "config:tools/README.i18n.yaml",
"type": "config",
"name": "README.i18n.yaml",
"filePath": "tools/README.i18n.yaml",
"summary": "tools 包的双语 README 配对一致性记录,保存 README.md 与 README.zh.md 的 git blob 哈希用于翻译门禁。",
"tags": [
"configuration",
"i18n",
"bilingual"
],
"complexity": "simple"
},
{
"id": "document:tools/README.md",
"type": "document",
"name": "README.md",
"filePath": "tools/README.md",
"summary": "dsh-tools 包的英文 README,描述 ToolRuntime 服务(ctx 键 tools),涵盖配置、公开 API、注入服务、取消、实时事件、关键类型、扩展点、类型化工具参数 schema、强制原始 JSON Schema 子集、工具自有 UI 呈现、Code Mode、并行执行,以及普通工具 schema、Code Mode schema/系统提示词、工具调用历史与结果的模型体验。",
"tags": [
"documentation",
"readme",
"tools",
"tool-runtime",
"tool-registry"
],
"complexity": "simple"
},
{
"id": "document:tools/README.zh.md",
"type": "document",
"name": "README.zh.md",
"filePath": "tools/README.zh.md",
"summary": "dsh-tools 包的中文 README,描述 ToolRuntime 服务(ctx 键 tools),涵盖配置、公开 API、注入服务、取消、实时事件、关键类型、扩展点、类型化工具参数 schema、强制原始 JSON Schema 子集、工具自有 UI 呈现、Code Mode、并行执行,以及普通工具 schema、Code Mode schema/系统提示词、工具调用历史与结果的模型体验。",
"tags": [
"documentation",
"readme",
"i18n",
"tools",
"tool-runtime",
"tool-registry"
],
"complexity": "simple"
},
{
"id": "config:tools/package.json",
"type": "config",
"name": "package.json",
"filePath": "tools/package.json",
"summary": "npm 包 @deepseek-ai/dsh-tools 的清单文件,声明入口(lib/index.js)、types、exports、依赖与 peer 依赖。",
"tags": [
"configuration",
"npm",
"manifest"
],
"complexity": "simple"
},
{
"id": "config:tools/tsconfig.json",
"type": "config",
"name": "tsconfig.json",
"filePath": "tools/tsconfig.json",
"summary": "tools 子包的 TypeScript 编译配置,继承 tsconfig.base.jsonrootDir=src、outDir=lib/types,并声明对 vendored cordis/cosmokit/schemastery 及相关 workspace 包的 project references。",
"tags": [
"configuration",
"typescript",
"build-system"
],
"complexity": "simple"
}
],
"edges": [
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:tools/README.i18n.yaml",
"target": "document:tools/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:tools/README.i18n.yaml",
"target": "document:tools/README.zh.md"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:tools/README.md",
"target": "file:tools/src/index.ts"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:tools/README.zh.md",
"target": "file:tools/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:tools/tsconfig.json",
"target": "file:tools/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:tools/package.json",
"target": "file:tools/src/index.ts"
},
{
"type": "depends_on",
"direction": "forward",
"weight": 0.6,
"source": "config:tools/package.json",
"target": "file:tools/src/index.ts"
}
]
}
@@ -0,0 +1,599 @@
{
"nodes": [
{
"id": "file:agent-default-model/src/index.ts",
"type": "file",
"name": "index.ts",
"filePath": "agent-default-model/src/index.ts",
"summary": "agent-default-model 插件入口 barrel,导出默认模型 settings schema 与 AgentDefaultModelConfig Service Provider 类。",
"tags": [
"entry-point",
"barrel",
"plugin",
"settings",
"model-config"
],
"complexity": "medium"
},
{
"id": "class:agent-default-model/src/index.ts:AgentDefaultModelConfig",
"type": "class",
"name": "AgentDefaultModelConfig",
"filePath": "agent-default-model/src/index.ts",
"lineRange": "64-105",
"summary": "默认模型配置 Service Provider 类,构造时注册 settings section 并提供 currentSelection 读取与 saveSelection 持久化。",
"tags": [
"class",
"settings",
"model-config",
"service-provider"
],
"complexity": "medium"
},
{
"id": "file:agent-default-model/src/invariant.ts",
"type": "file",
"name": "invariant.ts",
"filePath": "agent-default-model/src/invariant.ts",
"summary": "agent-default-model 的 invariant 伴随文件,apply 时向 ctx.invariants 注册运行时不变量。",
"tags": [
"invariant",
"plugin",
"runtime-check"
],
"complexity": "low"
},
{
"id": "function:agent-default-model/src/invariant.ts:apply",
"type": "function",
"name": "apply",
"filePath": "agent-default-model/src/invariant.ts",
"lineRange": "29-30",
"summary": "invariant 插件 apply 入口,向 ctx.invariants 注册检查并 resolve。",
"tags": [
"invariant",
"plugin-entry",
"apply"
],
"complexity": "low"
},
{
"id": "file:agent-default-model/tests/agent-default-model.spec.ts",
"type": "file",
"name": "agent-default-model.spec.ts",
"filePath": "agent-default-model/tests/agent-default-model.spec.ts",
"summary": "agent-default-model 单元测试,使用内存 MemorySettings provider 验证默认模型选择与持久化。",
"tags": [
"test",
"vitest",
"settings",
"model-config"
],
"complexity": "low"
},
{
"id": "function:agent-default-model/tests/agent-default-model.spec.ts:boot",
"type": "function",
"name": "boot",
"filePath": "agent-default-model/tests/agent-default-model.spec.ts",
"lineRange": "28-41",
"summary": "测试 boot:装载 settings 与 agent-default-model 插件并 await settingsFiber。",
"tags": [
"test-helper",
"boot",
"settings"
],
"complexity": "low"
},
{
"id": "class:agent-default-model/tests/agent-default-model.spec.ts:MemorySettings",
"type": "class",
"name": "MemorySettings",
"filePath": "agent-default-model/tests/agent-default-model.spec.ts",
"lineRange": "11-26",
"summary": "测试用内存 settings providerload/persist 通过 structuredClone 快照隔离文档。",
"tags": [
"test-fixture",
"settings",
"memory"
],
"complexity": "low"
},
{
"id": "file:agent-default-model/tsdown.config.ts",
"type": "file",
"name": "tsdown.config.ts",
"filePath": "agent-default-model/tsdown.config.ts",
"summary": "agent-default-model 的 tsdown 打包构建配置。",
"tags": [
"build-system",
"configuration",
"tsdown"
],
"complexity": "low"
},
{
"id": "file:agent-loop/src/invariant.ts",
"type": "file",
"name": "invariant.ts",
"filePath": "agent-loop/src/invariant.ts",
"summary": "agent-loop 的 invariant 伴随文件,apply 时注册循环运行时不变量。",
"tags": [
"invariant",
"plugin",
"runtime-check",
"agent-loop"
],
"complexity": "low"
},
{
"id": "function:agent-loop/src/invariant.ts:apply",
"type": "function",
"name": "apply",
"filePath": "agent-loop/src/invariant.ts",
"lineRange": "62-63",
"summary": "agent-loop invariant 插件 apply 入口,注册循环不变量检查。",
"tags": [
"invariant",
"plugin-entry",
"apply"
],
"complexity": "low"
},
{
"id": "file:agent-loop/tests/invariant.spec.ts",
"type": "file",
"name": "invariant.spec.ts",
"filePath": "agent-loop/tests/invariant.spec.ts",
"summary": "agent-loop invariant 测试,构造 session 与 loop 请求上下文验证不变量。",
"tags": [
"test",
"vitest",
"invariant",
"agent-loop"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/tests/invariant.spec.ts:requestSetup",
"type": "function",
"name": "requestSetup",
"filePath": "agent-loop/tests/invariant.spec.ts",
"lineRange": "25-36",
"summary": "测试辅助:装配 session、追加用户消息并 deriveMessages 以构造 loop 请求上下文。",
"tags": [
"test-helper",
"session",
"request-setup"
],
"complexity": "medium"
},
{
"id": "file:agent-loop/tests/properties.spec.ts",
"type": "file",
"name": "properties.spec.ts",
"filePath": "agent-loop/tests/properties.spec.ts",
"summary": "agent-loop 状态轨迹属性测试,验证 idle/running 合法状态序列与回合计数。",
"tags": [
"test",
"vitest",
"properties",
"agent-loop",
"state-trace"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/tests/properties.spec.ts:harness",
"type": "function",
"name": "harness",
"filePath": "agent-loop/tests/properties.spec.ts",
"lineRange": "38-48",
"summary": "测试 harness:装载一组 agent-loop 插件并向 llm 注册 EchoAdapter。",
"tags": [
"test-helper",
"harness",
"agent-loop"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/tests/properties.spec.ts:nextIdle",
"type": "function",
"name": "nextIdle",
"filePath": "agent-loop/tests/properties.spec.ts",
"lineRange": "51-60",
"summary": "注册 agent idle 事件监听,返回在 idle 时 resolve 的 promise。",
"tags": [
"test-helper",
"idle",
"lifecycle"
],
"complexity": "low"
},
{
"id": "class:agent-loop/tests/properties.spec.ts:EchoAdapter",
"type": "class",
"name": "EchoAdapter",
"filePath": "agent-loop/tests/properties.spec.ts",
"lineRange": "26-36",
"summary": "测试用 LLM echo adapterstream 时回显输入。",
"tags": [
"test-fixture",
"llm-adapter",
"echo"
],
"complexity": "low"
},
{
"id": "file:agent-loop/tests/request-cache.e2e.ts",
"type": "file",
"name": "request-cache.e2e.ts",
"filePath": "agent-loop/tests/request-cache.e2e.ts",
"summary": "agent-loop 请求缓存端到端测试,装配 loop harness 与内容工具 fixture 并等待 idle。",
"tags": [
"test",
"e2e",
"request-cache",
"agent-loop"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/tests/request-cache.e2e.ts:loopHarness",
"type": "function",
"name": "loopHarness",
"filePath": "agent-loop/tests/request-cache.e2e.ts",
"lineRange": "40-58",
"summary": "e2e harness:装配一组插件并注册 defineContentToolFixture 工具。",
"tags": [
"test-helper",
"harness",
"e2e"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/tests/request-cache.e2e.ts:waitForIdle",
"type": "function",
"name": "waitForIdle",
"filePath": "agent-loop/tests/request-cache.e2e.ts",
"lineRange": "60-69",
"summary": "等待 agent idle 的事件监听 helperdispose 后 resolve。",
"tags": [
"test-helper",
"idle",
"lifecycle"
],
"complexity": "low"
},
{
"id": "file:agent-loop/tests/settings.spec.ts",
"type": "file",
"name": "settings.spec.ts",
"filePath": "agent-loop/tests/settings.spec.ts",
"summary": "agent-loop settings 集成测试,使用内存 settings 验证循环配置装载。",
"tags": [
"test",
"vitest",
"settings",
"agent-loop"
],
"complexity": "low"
},
{
"id": "function:agent-loop/tests/settings.spec.ts:boot",
"type": "function",
"name": "boot",
"filePath": "agent-loop/tests/settings.spec.ts",
"lineRange": "33-45",
"summary": "测试 boot:装载 settings 与 loop 插件并 await settingsFiber/loopFiber。",
"tags": [
"test-helper",
"boot",
"settings"
],
"complexity": "low"
},
{
"id": "class:agent-loop/tests/settings.spec.ts:MemorySettings",
"type": "class",
"name": "MemorySettings",
"filePath": "agent-loop/tests/settings.spec.ts",
"lineRange": "16-31",
"summary": "测试用内存 settings providerload/persist 通过 structuredClone 快照隔离。",
"tags": [
"test-fixture",
"settings",
"memory"
],
"complexity": "low"
},
{
"id": "file:agent-loop/tsdown.config.ts",
"type": "file",
"name": "tsdown.config.ts",
"filePath": "agent-loop/tsdown.config.ts",
"summary": "agent-loop 的 tsdown 打包构建配置。",
"tags": [
"build-system",
"configuration",
"tsdown"
],
"complexity": "low"
},
{
"id": "file:agent-tool-presentation/src/index.ts",
"type": "file",
"name": "index.ts",
"filePath": "agent-tool-presentation/src/index.ts",
"summary": "agent-tool-presentation 插件入口,apply 按 Config 将工具呈现模式注入运行时上下文。",
"tags": [
"entry-point",
"plugin",
"tool-presentation"
],
"complexity": "low"
},
{
"id": "function:agent-tool-presentation/src/index.ts:apply",
"type": "function",
"name": "apply",
"filePath": "agent-tool-presentation/src/index.ts",
"lineRange": "59-72",
"summary": "插件 apply:按 Config 设定 tools.presentAs 并向运行时上下文注入呈现模式。",
"tags": [
"plugin-entry",
"apply",
"tool-presentation"
],
"complexity": "medium"
},
{
"id": "file:agent-tool-presentation/src/invariant.ts",
"type": "file",
"name": "invariant.ts",
"filePath": "agent-tool-presentation/src/invariant.ts",
"summary": "agent-tool-presentation 的 invariant 伴随文件。",
"tags": [
"invariant",
"plugin",
"runtime-check"
],
"complexity": "low"
},
{
"id": "function:agent-tool-presentation/src/invariant.ts:apply",
"type": "function",
"name": "apply",
"filePath": "agent-tool-presentation/src/invariant.ts",
"lineRange": "30-31",
"summary": "invariant 插件 apply 入口,向 ctx.invariants 注册检查。",
"tags": [
"invariant",
"plugin-entry",
"apply"
],
"complexity": "low"
},
{
"id": "file:agent-tool-presentation/tests/agent-tool-presentation.spec.ts",
"type": "file",
"name": "agent-tool-presentation.spec.ts",
"filePath": "agent-tool-presentation/tests/agent-tool-presentation.spec.ts",
"summary": "agent-tool-presentation 单元测试,装配 StubRuntime 与 scope 验证呈现模式注入。",
"tags": [
"test",
"vitest",
"tool-presentation",
"scope"
],
"complexity": "medium"
},
{
"id": "function:agent-tool-presentation/tests/agent-tool-presentation.spec.ts:host",
"type": "function",
"name": "host",
"filePath": "agent-tool-presentation/tests/agent-tool-presentation.spec.ts",
"lineRange": "31-44",
"summary": "测试 host:装载插件并通过 defineTool 注册工具。",
"tags": [
"test-helper",
"host",
"tool-registration"
],
"complexity": "medium"
},
{
"id": "function:agent-tool-presentation/tests/agent-tool-presentation.spec.ts:mount",
"type": "function",
"name": "mount",
"filePath": "agent-tool-presentation/tests/agent-tool-presentation.spec.ts",
"lineRange": "47-57",
"summary": "测试 mount:创建 scope 与 session 装载 agent-tool-presentation 插件并 await fiber。",
"tags": [
"test-helper",
"mount",
"scope"
],
"complexity": "medium"
}
],
"edges": [
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-default-model/src/index.ts",
"target": "class:agent-default-model/src/index.ts:AgentDefaultModelConfig"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-default-model/src/invariant.ts",
"target": "function:agent-default-model/src/invariant.ts:apply"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-default-model/tests/agent-default-model.spec.ts",
"target": "function:agent-default-model/tests/agent-default-model.spec.ts:boot"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-default-model/tests/agent-default-model.spec.ts",
"target": "class:agent-default-model/tests/agent-default-model.spec.ts:MemorySettings"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/invariant.ts",
"target": "function:agent-loop/src/invariant.ts:apply"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/tests/invariant.spec.ts",
"target": "function:agent-loop/tests/invariant.spec.ts:requestSetup"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/tests/properties.spec.ts",
"target": "function:agent-loop/tests/properties.spec.ts:harness"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/tests/properties.spec.ts",
"target": "function:agent-loop/tests/properties.spec.ts:nextIdle"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/tests/properties.spec.ts",
"target": "class:agent-loop/tests/properties.spec.ts:EchoAdapter"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/tests/request-cache.e2e.ts",
"target": "function:agent-loop/tests/request-cache.e2e.ts:loopHarness"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/tests/request-cache.e2e.ts",
"target": "function:agent-loop/tests/request-cache.e2e.ts:waitForIdle"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/tests/settings.spec.ts",
"target": "function:agent-loop/tests/settings.spec.ts:boot"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/tests/settings.spec.ts",
"target": "class:agent-loop/tests/settings.spec.ts:MemorySettings"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-tool-presentation/src/index.ts",
"target": "function:agent-tool-presentation/src/index.ts:apply"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-tool-presentation/src/invariant.ts",
"target": "function:agent-tool-presentation/src/invariant.ts:apply"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-tool-presentation/tests/agent-tool-presentation.spec.ts",
"target": "function:agent-tool-presentation/tests/agent-tool-presentation.spec.ts:host"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-tool-presentation/tests/agent-tool-presentation.spec.ts",
"target": "function:agent-tool-presentation/tests/agent-tool-presentation.spec.ts:mount"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent-default-model/src/index.ts",
"target": "class:agent-default-model/src/index.ts:AgentDefaultModelConfig"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent-default-model/src/invariant.ts",
"target": "function:agent-default-model/src/invariant.ts:apply"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent-loop/src/invariant.ts",
"target": "function:agent-loop/src/invariant.ts:apply"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent-tool-presentation/src/index.ts",
"target": "function:agent-tool-presentation/src/index.ts:apply"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent-tool-presentation/src/invariant.ts",
"target": "function:agent-tool-presentation/src/invariant.ts:apply"
},
{
"type": "imports",
"weight": 0.7,
"direction": "forward",
"source": "file:agent-default-model/tests/agent-default-model.spec.ts",
"target": "file:agent-default-model/src/index.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"direction": "forward",
"source": "file:agent-default-model/src/index.ts",
"target": "file:agent-default-model/tests/agent-default-model.spec.ts"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-tool-presentation/tests/agent-tool-presentation.spec.ts:mount",
"target": "function:scope/src/index.ts:createScope"
}
]
}
@@ -0,0 +1,796 @@
{
"nodes": [
{
"id": "file:agent/src/consumed-work.ts",
"type": "file",
"name": "consumed-work.ts",
"filePath": "agent/src/consumed-work.ts",
"summary": "计算已消费工作量的折叠逻辑,跟踪 stepped/claimed 集合并按 claim reason 折叠事件序列。",
"tags": [
"consumed-work",
"fold",
"agent",
"event-reduction"
],
"complexity": "medium"
},
{
"id": "function:agent/src/consumed-work.ts:accountsForClaim",
"type": "function",
"name": "accountsForClaim",
"filePath": "agent/src/consumed-work.ts",
"lineRange": "42-58",
"summary": "根据 claim reason 判断该 claim 是否计入已消费工作量。",
"tags": [
"consumed-work",
"claim",
"predicate"
],
"complexity": "low"
},
{
"id": "function:agent/src/consumed-work.ts:foldConsumedWork",
"type": "function",
"name": "foldConsumedWork",
"filePath": "agent/src/consumed-work.ts",
"lineRange": "68-108",
"summary": "折叠事件序列计算已消费工作量,维护 stepped/claimed 集合并按 claim 调用 accountsForClaim 调整。",
"tags": [
"consumed-work",
"fold",
"event-reduction",
"exported"
],
"complexity": "medium"
},
{
"id": "file:agent/src/invariant.ts",
"type": "file",
"name": "invariant.ts",
"filePath": "agent/src/invariant.ts",
"summary": "agent 的 invariant 伴随文件,install 监听状态变化校验合法状态轨迹。",
"tags": [
"invariant",
"plugin",
"runtime-check",
"agent"
],
"complexity": "low"
},
{
"id": "function:agent/src/invariant.ts:install",
"type": "function",
"name": "install",
"filePath": "agent/src/invariant.ts",
"lineRange": "15-24",
"summary": "注册状态变化监听,记录上一次状态并在非法跳变时调用 fail。",
"tags": [
"invariant",
"install",
"status-trace"
],
"complexity": "low"
},
{
"id": "function:agent/src/invariant.ts:apply",
"type": "function",
"name": "apply",
"filePath": "agent/src/invariant.ts",
"lineRange": "31-32",
"summary": "agent invariant 插件 apply 入口,向 ctx.invariants 注册 install 检查。",
"tags": [
"invariant",
"plugin-entry",
"apply"
],
"complexity": "low"
},
{
"id": "file:agent/src/model-selection.ts",
"type": "file",
"name": "model-selection.ts",
"filePath": "agent/src/model-selection.ts",
"summary": "安装模型选择钩子,在 assembly 与 request 生命周期应用选定的模型配置并管理 dispose。",
"tags": [
"model-selection",
"lifecycle",
"agent",
"hooks"
],
"complexity": "medium"
},
{
"id": "function:agent/src/model-selection.ts:installModelSelection",
"type": "function",
"name": "installModelSelection",
"filePath": "agent/src/model-selection.ts",
"lineRange": "39-75",
"summary": "在 agentCtx 注册 assembly 与 request 阶段的 waterfall 监听以应用 selection,并返回 dispose 句柄。",
"tags": [
"model-selection",
"lifecycle",
"hooks",
"exported"
],
"complexity": "medium"
},
{
"id": "file:agent/tests/agent-initiator.spec.ts",
"type": "file",
"name": "agent-initiator.spec.ts",
"filePath": "agent/tests/agent-initiator.spec.ts",
"summary": "agent initiator 测试,验证 withInitiator/requireInitiator 的并发与超时语义。",
"tags": [
"test",
"vitest",
"initiator",
"agent"
],
"complexity": "medium"
},
{
"id": "function:agent/tests/agent-initiator.spec.ts:harness",
"type": "function",
"name": "harness",
"filePath": "agent/tests/agent-initiator.spec.ts",
"lineRange": "12-24",
"summary": "测试 harness:装载 agent 插件构造上下文。",
"tags": [
"test-helper",
"harness",
"agent"
],
"complexity": "low"
},
{
"id": "file:agent/tests/agent.spec.ts",
"type": "file",
"name": "agent.spec.ts",
"filePath": "agent/tests/agent.spec.ts",
"summary": "agent registry 与 create/resume 流程测试,使用 stubAgent 桩件与调用记录。",
"tags": [
"test",
"vitest",
"agent-registry",
"stub"
],
"complexity": "medium"
},
{
"id": "function:agent/tests/agent.spec.ts:stubAgent",
"type": "function",
"name": "stubAgent",
"filePath": "agent/tests/agent.spec.ts",
"lineRange": "20-39",
"summary": "构造桩件 agent,基于 Session.create 与默认 task 行为并提供 overrides 合并。",
"tags": [
"test-fixture",
"stub",
"agent"
],
"complexity": "medium"
},
{
"id": "file:agent/tests/consumed-work.spec.ts",
"type": "file",
"name": "consumed-work.spec.ts",
"filePath": "agent/tests/consumed-work.spec.ts",
"summary": "consumed-work 折叠逻辑测试,构造 session 事件序列验证 stepped/claimed 行为。",
"tags": [
"test",
"vitest",
"consumed-work",
"event-reduction"
],
"complexity": "medium"
},
{
"id": "file:agent/tests/invariant.spec.ts",
"type": "file",
"name": "invariant.spec.ts",
"filePath": "agent/tests/invariant.spec.ts",
"summary": "agent invariant 测试,装配插件与 mock agent。",
"tags": [
"test",
"vitest",
"invariant",
"agent"
],
"complexity": "low"
},
{
"id": "file:agent/tests/verify-export-jsdoc.spec.ts",
"type": "file",
"name": "verify-export-jsdoc.spec.ts",
"filePath": "agent/tests/verify-export-jsdoc.spec.ts",
"summary": "verify-export-jsdoc 测试,在临时目录写 fixture 文件树验证导出 JSDoc 合规。",
"tags": [
"test",
"vitest",
"jsdoc",
"fixture",
"lint"
],
"complexity": "medium"
},
{
"id": "function:agent/tests/verify-export-jsdoc.spec.ts:fixture",
"type": "function",
"name": "fixture",
"filePath": "agent/tests/verify-export-jsdoc.spec.ts",
"lineRange": "18-27",
"summary": "在临时目录创建 fixture 文件树供 JSDoc 校验,记录 roots 供清理。",
"tags": [
"test-helper",
"fixture",
"fs"
],
"complexity": "low"
},
{
"id": "file:agent/tsdown.config.ts",
"type": "file",
"name": "tsdown.config.ts",
"filePath": "agent/tsdown.config.ts",
"summary": "agent 的 tsdown 打包构建配置。",
"tags": [
"build-system",
"configuration",
"tsdown"
],
"complexity": "low"
},
{
"id": "file:scope/src/index.ts",
"type": "file",
"name": "index.ts",
"filePath": "scope/src/index.ts",
"summary": "scope 插件入口,提供 scope 父子链、carrier 识别与 scopeTarget 过滤等核心 API。",
"tags": [
"entry-point",
"plugin",
"scope",
"carrier"
],
"complexity": "high"
},
{
"id": "function:scope/src/index.ts:bindScopeParent",
"type": "function",
"name": "bindScopeParent",
"filePath": "scope/src/index.ts",
"lineRange": "72-82",
"summary": "绑定 scope 父子关系,若已存在父则通过 linkScopeParent 重新链接。",
"tags": [
"scope",
"parent-binding",
"exported"
],
"complexity": "low"
},
{
"id": "function:scope/src/index.ts:scopeParentOf",
"type": "function",
"name": "scopeParentOf",
"filePath": "scope/src/index.ts",
"lineRange": "89-91",
"summary": "返回指定 scope key 的父 scope key。",
"tags": [
"scope",
"parent",
"getter",
"exported"
],
"complexity": "low"
},
{
"id": "function:scope/src/index.ts:scopeChainOf",
"type": "function",
"name": "scopeChainOf",
"filePath": "scope/src/index.ts",
"lineRange": "98-102",
"summary": "返回从根到指定 scope 的父链数组。",
"tags": [
"scope",
"chain",
"getter",
"exported"
],
"complexity": "low"
},
{
"id": "function:scope/src/index.ts:createScope",
"type": "function",
"name": "createScope",
"filePath": "scope/src/index.ts",
"lineRange": "137-147",
"summary": "创建子 scope fiber,绑定父级并扩展上下文,注册 quiesceFiber 清理。",
"tags": [
"scope",
"create",
"fiber",
"exported"
],
"complexity": "medium"
},
{
"id": "function:scope/src/index.ts:scopeOf",
"type": "function",
"name": "scopeOf",
"filePath": "scope/src/index.ts",
"lineRange": "154-156",
"summary": "从上下文读取当前 scope key。",
"tags": [
"scope",
"getter",
"exported"
],
"complexity": "low"
},
{
"id": "function:scope/src/index.ts:scopeTarget",
"type": "function",
"name": "scopeTarget",
"filePath": "scope/src/index.ts",
"lineRange": "170-185",
"summary": "基于 base filter 与 scope carrier 计算 scopeTarget,缓存 carrier key。",
"tags": [
"scope",
"target",
"filter",
"exported"
],
"complexity": "medium"
},
{
"id": "function:scope/src/index.ts:isScopeCarrier",
"type": "function",
"name": "isScopeCarrier",
"filePath": "scope/src/index.ts",
"lineRange": "192-194",
"summary": "判断 value 是否为已注册的 scope carrier。",
"tags": [
"scope",
"carrier",
"predicate",
"exported"
],
"complexity": "low"
},
{
"id": "function:scope/src/index.ts:carrierKeyOf",
"type": "function",
"name": "carrierKeyOf",
"filePath": "scope/src/index.ts",
"lineRange": "201-204",
"summary": "返回 carrier 的 scope key,先校验 isScopeCarrier。",
"tags": [
"scope",
"carrier",
"getter",
"exported"
],
"complexity": "low"
},
{
"id": "file:scope/src/invariant.ts",
"type": "file",
"name": "invariant.ts",
"filePath": "scope/src/invariant.ts",
"summary": "scope 的 invariant 伴随文件,install 校验 subject resolver 与 carrier 一致性。",
"tags": [
"invariant",
"plugin",
"runtime-check",
"scope"
],
"complexity": "medium"
},
{
"id": "function:scope/src/invariant.ts:install",
"type": "function",
"name": "install",
"filePath": "scope/src/invariant.ts",
"lineRange": "16-33",
"summary": "注册 subject resolver 校验,检查 carrier 合法性与 key 一致性并在违例时 fail。",
"tags": [
"invariant",
"install",
"carrier",
"subject"
],
"complexity": "medium"
},
{
"id": "function:scope/src/invariant.ts:apply",
"type": "function",
"name": "apply",
"filePath": "scope/src/invariant.ts",
"lineRange": "40-41",
"summary": "scope invariant 插件 apply 入口,向 ctx.invariants 注册 install 检查。",
"tags": [
"invariant",
"plugin-entry",
"apply"
],
"complexity": "low"
},
{
"id": "file:scope/src/store.ts",
"type": "file",
"name": "store.ts",
"filePath": "scope/src/store.ts",
"summary": "scope 分层存储,定义 NamedEntries/AnonymousEntries/ScopedLayers 三类作用域层。",
"tags": [
"scope",
"store",
"layers",
"scoped-entries"
],
"complexity": "high"
},
{
"id": "class:scope/src/store.ts:NamedEntries",
"type": "class",
"name": "NamedEntries",
"filePath": "scope/src/store.ts",
"lineRange": "30-105",
"summary": "命名条目存储,按 key 插入/查询,重复 key 报 duplicateError。",
"tags": [
"class",
"store",
"named-entries",
"scope"
],
"complexity": "medium"
},
{
"id": "class:scope/src/store.ts:AnonymousEntries",
"type": "class",
"name": "AnonymousEntries",
"filePath": "scope/src/store.ts",
"lineRange": "114-150",
"summary": "匿名条目存储,以 Symbol key 追加并支持 values 与 isEmpty。",
"tags": [
"class",
"store",
"anonymous-entries",
"scope"
],
"complexity": "low"
},
{
"id": "class:scope/src/store.ts:ScopedLayers",
"type": "class",
"name": "ScopedLayers",
"filePath": "scope/src/store.ts",
"lineRange": "159-267",
"summary": "分层作用域存储,维护 global 与 scoped 层并提供 effect/merge/peek/chainLayers。",
"tags": [
"class",
"store",
"scoped-layers",
"effect",
"scope"
],
"complexity": "high"
}
],
"edges": [
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent/src/consumed-work.ts",
"target": "function:agent/src/consumed-work.ts:accountsForClaim"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent/src/consumed-work.ts",
"target": "function:agent/src/consumed-work.ts:foldConsumedWork"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent/src/invariant.ts",
"target": "function:agent/src/invariant.ts:install"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent/src/invariant.ts",
"target": "function:agent/src/invariant.ts:apply"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent/src/model-selection.ts",
"target": "function:agent/src/model-selection.ts:installModelSelection"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent/tests/agent-initiator.spec.ts",
"target": "function:agent/tests/agent-initiator.spec.ts:harness"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent/tests/agent.spec.ts",
"target": "function:agent/tests/agent.spec.ts:stubAgent"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent/tests/verify-export-jsdoc.spec.ts",
"target": "function:agent/tests/verify-export-jsdoc.spec.ts:fixture"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:bindScopeParent"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:scopeParentOf"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:scopeChainOf"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:createScope"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:scopeOf"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:scopeTarget"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:isScopeCarrier"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:carrierKeyOf"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/invariant.ts",
"target": "function:scope/src/invariant.ts:install"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/invariant.ts",
"target": "function:scope/src/invariant.ts:apply"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/store.ts",
"target": "class:scope/src/store.ts:NamedEntries"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/store.ts",
"target": "class:scope/src/store.ts:AnonymousEntries"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:scope/src/store.ts",
"target": "class:scope/src/store.ts:ScopedLayers"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent/src/consumed-work.ts",
"target": "function:agent/src/consumed-work.ts:foldConsumedWork"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent/src/invariant.ts",
"target": "function:agent/src/invariant.ts:apply"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent/src/model-selection.ts",
"target": "function:agent/src/model-selection.ts:installModelSelection"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:bindScopeParent"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:scopeParentOf"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:scopeChainOf"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:createScope"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:scopeOf"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:scopeTarget"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:isScopeCarrier"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/index.ts",
"target": "function:scope/src/index.ts:carrierKeyOf"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/invariant.ts",
"target": "function:scope/src/invariant.ts:apply"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/store.ts",
"target": "class:scope/src/store.ts:NamedEntries"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/store.ts",
"target": "class:scope/src/store.ts:AnonymousEntries"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:scope/src/store.ts",
"target": "class:scope/src/store.ts:ScopedLayers"
},
{
"type": "imports",
"weight": 0.7,
"direction": "forward",
"source": "file:scope/src/store.ts",
"target": "file:scope/src/index.ts"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent/src/consumed-work.ts:foldConsumedWork",
"target": "function:agent/src/consumed-work.ts:accountsForClaim"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:scope/src/index.ts:createScope",
"target": "function:scope/src/index.ts:bindScopeParent"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:scope/src/index.ts:scopeTarget",
"target": "function:scope/src/index.ts:scopeOf"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:scope/src/index.ts:carrierKeyOf",
"target": "function:scope/src/index.ts:isScopeCarrier"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "class:scope/src/store.ts:ScopedLayers",
"target": "function:scope/src/index.ts:scopeChainOf"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "class:scope/src/store.ts:ScopedLayers",
"target": "function:scope/src/index.ts:scopeOf"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:scope/src/invariant.ts:install",
"target": "function:scope/src/index.ts:isScopeCarrier"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:scope/src/invariant.ts:install",
"target": "function:scope/src/index.ts:carrierKeyOf"
}
]
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,400 @@
{
"nodes": [
{
"id": "file:tools/tests/execution-mode.spec.ts",
"type": "file",
"name": "execution-mode.spec.ts",
"filePath": "tools/tests/execution-mode.spec.ts",
"summary": "测试工具执行的 fail-closed per-call 分类与 model-schema 隔离行为,覆盖 ToolExecutionMode 的决策路径与 SystemPrompt/ToolRuntime 装配。",
"tags": [
"test",
"validation",
"execution-mode",
"fail-closed"
],
"complexity": "medium"
},
{
"id": "file:tools/tests/execution-signal-types.spec.ts",
"type": "file",
"name": "execution-signal-types.spec.ts",
"filePath": "tools/tests/execution-signal-types.spec.ts",
"summary": "通过 expectTypeOf 与 @ts-expect-error 对工具执行信号 (signal)、ToolExecutionInput/ToolExecution/ToolRunContext 的只读与必填契约进行编译期断言。",
"tags": [
"test",
"validation",
"types",
"signal"
],
"complexity": "low"
},
{
"id": "file:tools/tests/gen-tool-catalog.spec.ts",
"type": "file",
"name": "gen-tool-catalog.spec.ts",
"filePath": "tools/tests/gen-tool-catalog.spec.ts",
"summary": "对 repo 根目录 scripts/gen-tool-catalog.ts 工具目录生成器进行 guarantee 测试,验证 collectToolCatalog 收集、assertManifestComplete 完整性与 render 渲染输出。",
"tags": [
"test",
"catalog",
"validation",
"generator"
],
"complexity": "medium"
},
{
"id": "file:tools/tests/invariant.spec.ts",
"type": "file",
"name": "invariant.spec.ts",
"filePath": "tools/tests/invariant.spec.ts",
"summary": "验证 tools 包的不变量断言:execution.arguments 冻结、waterfall stage 行为 (pre/post/around)、emit 结果与 scopeTarget 绑定,配合 dsh-invariants 注册表。",
"tags": [
"test",
"validation",
"invariant",
"execution"
],
"complexity": "medium"
},
{
"id": "file:tools/tests/properties.spec.ts",
"type": "file",
"name": "properties.spec.ts",
"filePath": "tools/tests/properties.spec.ts",
"summary": "基于 fast-check 的属性测试,验证由 ParameterSchemaSpec 生成的参数必能通过 validateArgs,且针对性破坏必被拒绝,闭合 validator/InferArgs 漂移风险。",
"tags": [
"test",
"validation",
"schema",
"property-testing"
],
"complexity": "high"
},
{
"id": "file:tools/tests/py-types.spec.ts",
"type": "file",
"name": "py-types.spec.ts",
"filePath": "tools/tests/py-types.spec.ts",
"summary": "测试 JSON Schema 到 Python TypedDict/类型映射 (jsonSchemaToPy) 及 renderToolsSdkPy SDK 渲染,覆盖 defineTool DSL 子集到 str/float/bool/Literal/list/dict 的映射。",
"tags": [
"test",
"validation",
"python",
"sdk",
"code-mode"
],
"complexity": "high"
},
{
"id": "file:tools/tests/scoped.spec.ts",
"type": "file",
"name": "scoped.spec.ts",
"filePath": "tools/tests/scoped.spec.ts",
"summary": "测试工具在 scoped/agent-scope 上下文中的执行,覆盖 scope 父子绑定 (bindScopeParent)、execution.arguments 冻结、callId 隔离与 deferContext 行为。",
"tags": [
"test",
"validation",
"scope",
"execution"
],
"complexity": "high"
},
{
"id": "file:tools/tests/tools.spec.ts",
"type": "file",
"name": "tools.spec.ts",
"filePath": "tools/tests/tools.spec.ts",
"summary": "tools 包主测试套件,覆盖 defineTool 注册与执行、approval 审批流、deferContext 上下文、signal 取消、defineContentToolFixture 内容工具 fixture 及参数类型推断等核心行为。",
"tags": [
"test",
"validation",
"tools",
"execution",
"approval"
],
"complexity": "high"
},
{
"id": "file:tools/tests/ts-types.spec.ts",
"type": "file",
"name": "ts-types.spec.ts",
"filePath": "tools/tests/ts-types.spec.ts",
"summary": "测试 JSON Schema 到 TypeScript 类型映射 (jsonSchemaToTs) 与 renderToolsSdk SDK 渲染,覆盖统一 schema 构造到 string/number/boolean/null/Literal/union 的映射。",
"tags": [
"test",
"validation",
"typescript",
"sdk",
"code-mode"
],
"complexity": "medium"
},
{
"id": "function:tools/tests/execution-signal-types.spec.ts:inputAndExecutionContracts",
"type": "function",
"name": "inputAndExecutionContracts",
"filePath": "tools/tests/execution-signal-types.spec.ts",
"lineRange": "12-38",
"summary": "通过 @ts-expect-error 断言 ToolExecutionInput/ToolExecution/ToolRunContext 三者的 signal 为只读且不可删除、不可置 undefined,验证调用方输入与流水线观察者视图的不可变契约。",
"tags": [
"test-helper",
"types",
"contract"
],
"complexity": "low"
},
{
"id": "function:tools/tests/execution-signal-types.spec.ts:observerContracts",
"type": "function",
"name": "observerContracts",
"filePath": "tools/tests/execution-signal-types.spec.ts",
"lineRange": "41-76",
"summary": "注册 tools/pre-execute、tools/post-execute、tools/result、tools/execute 四类监听器,逐一通过 @ts-expect-error 验证观察者收到的 execution.signal 不可写、不可删、不可置 undefined。",
"tags": [
"test-helper",
"observer",
"events"
],
"complexity": "medium"
},
{
"id": "function:tools/tests/properties.spec.ts:leafPropArb",
"type": "function",
"name": "leafPropArb",
"filePath": "tools/tests/properties.spec.ts",
"lineRange": "21-39",
"summary": "fast-check arbitrary,生成无嵌套的叶子 ParameterPropertySpecstring/number/integer/boolean/null/json,以及 enum、const、oneOf 变体),各带可选 required 标记。",
"tags": [
"test-helper",
"arbitrary",
"schema"
],
"complexity": "medium"
},
{
"id": "function:tools/tests/properties.spec.ts:propArb",
"type": "function",
"name": "propArb",
"filePath": "tools/tests/properties.spec.ts",
"lineRange": "42-66",
"summary": "递归 fast-check arbitrary,按 depth 生成含 object/array 嵌套的 ValueSchemaSpec,递归调用 leafPropArb 与 specArb 构造多层 schema。",
"tags": [
"test-helper",
"arbitrary",
"schema",
"recursive"
],
"complexity": "high"
},
{
"id": "function:tools/tests/properties.spec.ts:valueForProp",
"type": "function",
"name": "valueForProp",
"filePath": "tools/tests/properties.spec.ts",
"lineRange": "73-86",
"summary": "根据给定 ParameterPropertySpec 生成满足该 schema 的合法 JSON 值 arbitrary,处理 const、enum、标量、object(委托 validArgsForSpec)、array(递归)及 json 类型。",
"tags": [
"test-helper",
"arbitrary",
"value-generator"
],
"complexity": "medium"
},
{
"id": "function:tools/tests/properties.spec.ts:validArgsForSpec",
"type": "function",
"name": "validArgsForSpec",
"filePath": "tools/tests/properties.spec.ts",
"lineRange": "89-107",
"summary": "生成满足 ParameterSchemaSpec 的合法 args 对象 arbitraryrequired 键必出现、optional 键约半数出现,各键值由 valueForProp 递归生成。",
"tags": [
"test-helper",
"arbitrary",
"args-generator"
],
"complexity": "medium"
},
{
"id": "function:tools/tests/scoped.spec.ts:mintAgentScope",
"type": "function",
"name": "mintAgentScope",
"filePath": "tools/tests/scoped.spec.ts",
"lineRange": "25-34",
"summary": "创建绑定到 agent 名字的 scope carrier,通过注入 ['tools','systemPrompt'] 的插件在内部 Context 上调用 createScope,返回 scope 与作为 Agent-like 的 key。",
"tags": [
"test-helper",
"scope",
"carrier"
],
"complexity": "low"
},
{
"id": "function:tools/tests/scoped.spec.ts:tool",
"type": "function",
"name": "tool",
"filePath": "tools/tests/scoped.spec.ts",
"lineRange": "36-47",
"summary": "构造一个简易 ToolDefinition fixture,参数为空 object schema、输出 stringexecute 返回固定 reply 字符串用于 scope 执行测试。",
"tags": [
"test-helper",
"fixture",
"tool"
],
"complexity": "low"
},
{
"id": "function:tools/tests/scoped.spec.ts:run",
"type": "function",
"name": "run",
"filePath": "tools/tests/scoped.spec.ts",
"lineRange": "49-59",
"summary": "通过 ctx.tools.execute 执行具名工具(可选传入 agent scope),取首个 content 块文本返回,否则 JSON.stringify 回退。",
"tags": [
"test-helper",
"execution",
"runner"
],
"complexity": "low"
}
],
"edges": [
{
"type": "contains",
"weight": 1,
"source": "file:tools/tests/execution-signal-types.spec.ts",
"target": "function:tools/tests/execution-signal-types.spec.ts:inputAndExecutionContracts"
},
{
"type": "contains",
"weight": 1,
"source": "file:tools/tests/execution-signal-types.spec.ts",
"target": "function:tools/tests/execution-signal-types.spec.ts:observerContracts"
},
{
"type": "contains",
"weight": 1,
"source": "file:tools/tests/properties.spec.ts",
"target": "function:tools/tests/properties.spec.ts:leafPropArb"
},
{
"type": "contains",
"weight": 1,
"source": "file:tools/tests/properties.spec.ts",
"target": "function:tools/tests/properties.spec.ts:propArb"
},
{
"type": "contains",
"weight": 1,
"source": "file:tools/tests/properties.spec.ts",
"target": "function:tools/tests/properties.spec.ts:valueForProp"
},
{
"type": "contains",
"weight": 1,
"source": "file:tools/tests/properties.spec.ts",
"target": "function:tools/tests/properties.spec.ts:validArgsForSpec"
},
{
"type": "contains",
"weight": 1,
"source": "file:tools/tests/scoped.spec.ts",
"target": "function:tools/tests/scoped.spec.ts:mintAgentScope"
},
{
"type": "contains",
"weight": 1,
"source": "file:tools/tests/scoped.spec.ts",
"target": "function:tools/tests/scoped.spec.ts:tool"
},
{
"type": "contains",
"weight": 1,
"source": "file:tools/tests/scoped.spec.ts",
"target": "function:tools/tests/scoped.spec.ts:run"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/index.ts",
"target": "file:tools/tests/execution-mode.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/index.ts",
"target": "file:tools/tests/execution-signal-types.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/index.ts",
"target": "file:tools/tests/invariant.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/invariant.ts",
"target": "file:tools/tests/invariant.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/index.ts",
"target": "file:tools/tests/properties.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/py-types.ts",
"target": "file:tools/tests/py-types.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/index.ts",
"target": "file:tools/tests/py-types.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/index.ts",
"target": "file:tools/tests/scoped.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/index.ts",
"target": "file:tools/tests/tools.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/ts-types.ts",
"target": "file:tools/tests/ts-types.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:tools/src/index.ts",
"target": "file:tools/tests/ts-types.spec.ts"
},
{
"type": "calls",
"weight": 0.8,
"source": "function:tools/tests/properties.spec.ts:propArb",
"target": "function:tools/tests/properties.spec.ts:leafPropArb"
},
{
"type": "calls",
"weight": 0.8,
"source": "function:tools/tests/properties.spec.ts:valueForProp",
"target": "function:tools/tests/properties.spec.ts:validArgsForSpec"
},
{
"type": "calls",
"weight": 0.8,
"source": "function:tools/tests/properties.spec.ts:validArgsForSpec",
"target": "function:tools/tests/properties.spec.ts:valueForProp"
}
]
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,868 @@
{
"nodes": [
{
"id": "file:session/src/preparation.ts",
"type": "file",
"name": "preparation.ts",
"filePath": "session/src/preparation.ts",
"summary": "Session 创建前的准备句柄。封装 released 标志与 session 引用,在 prepare 阶段持有半构造 session 并在 create 时释放。",
"tags": [
"preparation",
"session",
"lifecycle"
],
"complexity": "low"
},
{
"id": "file:session/src/repair.ts",
"type": "file",
"name": "repair.ts",
"filePath": "session/src/repair.ts",
"summary": "中断 turn 的修复逻辑。interruptedTurnClosers 扫描事件流,为未关闭的 tool call 和未完成消息生成合成的 closer 事件,将 pending calls 标记为 TOOL_OUTCOME_UNKNOWN。",
"tags": [
"repair",
"interrupted-turn",
"tool-call",
"session"
],
"complexity": "medium"
},
{
"id": "file:session/src/request-header.ts",
"type": "file",
"name": "request-header.ts",
"filePath": "session/src/request-header.ts",
"summary": "请求头的规范化与比较。canonicalHeader 将 header 归一化为可比较形式,foldRequestHeader 从事件流中折叠出当前生效的 request header。",
"tags": [
"request-header",
"canonical",
"comparison",
"session"
],
"complexity": "medium"
},
{
"id": "file:session/src/surface.ts",
"type": "file",
"name": "surface.ts",
"filePath": "session/src/surface.ts",
"summary": "session surface 的投影计算。将 append/replacement 事件序列折叠为 surface node 列表(消息树),SurfaceManager 增量维护 fold 状态并校验 provenance 与 rewrite 语义。",
"tags": [
"surface",
"projection",
"fold",
"session"
],
"complexity": "high"
},
{
"id": "file:session/src/types.ts",
"type": "file",
"name": "types.ts",
"filePath": "session/src/types.ts",
"summary": "session 包的核心类型定义。定义 SessionId branded 类型、JsonValue 联合类型、SESSION_FORMAT_VERSION 常量以及 SessionEventMap 等事件类型声明。",
"tags": [
"type-definition",
"session",
"branded",
"event-map"
],
"complexity": "medium"
},
{
"id": "file:session/tests/repair.spec.ts",
"type": "file",
"name": "repair.spec.ts",
"filePath": "session/tests/repair.spec.ts",
"summary": "interruptedTurnClosers 修复逻辑的单元测试。验证中断 turn 下 pending tool calls 和消息的 closer 事件生成。",
"tags": [
"test",
"repair",
"interrupted-turn",
"session"
],
"complexity": "medium"
},
{
"id": "class:session/src/preparation.ts:SessionPreparation",
"type": "class",
"name": "SessionPreparation",
"filePath": "session/src/preparation.ts",
"lineRange": [
20,
49
],
"summary": "session 创建准备句柄。持有 released 标志和 session 引用,create 方法将 session 提交给 store 并进入 scope。",
"tags": [
"preparation",
"session",
"lifecycle"
],
"complexity": "low"
},
{
"id": "function:session/src/repair.ts:interruptedTurnClosers",
"type": "function",
"name": "interruptedTurnClosers",
"filePath": "session/src/repair.ts",
"lineRange": [
27,
133
],
"summary": "扫描事件流,为被中断的 turn 生成合成 closer 事件。将未完成的 tool call 标记为 TOOL_OUTCOME_UNKNOWN 并补全未关闭消息的 closer。",
"tags": [
"repair",
"interrupted-turn",
"tool-call",
"session"
],
"complexity": "high"
},
{
"id": "function:session/src/request-header.ts:canonicalHeader",
"type": "function",
"name": "canonicalHeader",
"filePath": "session/src/request-header.ts",
"lineRange": [
21,
31
],
"summary": "将 request header 规范化为可比较的 canonical 形式(排序/去重 schema)。",
"tags": [
"request-header",
"canonical"
],
"complexity": "low"
},
{
"id": "function:session/src/request-header.ts:headerEquals",
"type": "function",
"name": "headerEquals",
"filePath": "session/src/request-header.ts",
"lineRange": [
44,
54
],
"summary": "比较两个 request header 是否等价(callConfig + schema 深比较)。",
"tags": [
"request-header",
"comparison"
],
"complexity": "medium"
},
{
"id": "function:session/src/request-header.ts:foldRequestHeader",
"type": "function",
"name": "foldRequestHeader",
"filePath": "session/src/request-header.ts",
"lineRange": [
65,
71
],
"summary": "从事件流中折叠出自指定位置后生效的当前 request header。",
"tags": [
"request-header",
"fold",
"session"
],
"complexity": "low"
},
{
"id": "function:session/src/surface.ts:isSurfaceEligibleType",
"type": "function",
"name": "isSurfaceEligibleType",
"filePath": "session/src/surface.ts",
"lineRange": [
26,
28
],
"summary": "判断事件类型是否属于 surface 投影类型集合。",
"tags": [
"surface",
"predicate"
],
"complexity": "low"
},
{
"id": "function:session/src/surface.ts:isSurfaceEvent",
"type": "function",
"name": "isSurfaceEvent",
"filePath": "session/src/surface.ts",
"lineRange": [
35,
38
],
"summary": "判断事件是否为 surface 事件(类型 + seq 有效)。",
"tags": [
"surface",
"predicate"
],
"complexity": "low"
},
{
"id": "function:session/src/surface.ts:isAppendSurfaceEvent",
"type": "function",
"name": "isAppendSurfaceEvent",
"filePath": "session/src/surface.ts",
"lineRange": [
51,
55
],
"summary": "判断事件是否为 surface 追加操作。",
"tags": [
"surface",
"predicate",
"append"
],
"complexity": "low"
},
{
"id": "function:session/src/surface.ts:isReplacementSurfaceEvent",
"type": "function",
"name": "isReplacementSurfaceEvent",
"filePath": "session/src/surface.ts",
"lineRange": [
64,
68
],
"summary": "判断事件是否为 surface 替换操作。",
"tags": [
"surface",
"predicate",
"replace"
],
"complexity": "low"
},
{
"id": "function:session/src/surface.ts:deriveEventMessage",
"type": "function",
"name": "deriveEventMessage",
"filePath": "session/src/surface.ts",
"lineRange": [
83,
114
],
"summary": "从单个 surface 事件派生出对应的 message nodeuser/assistant/tool-result)。",
"tags": [
"surface",
"derive",
"message"
],
"complexity": "medium"
},
{
"id": "function:session/src/surface.ts:isReplaceOp",
"type": "function",
"name": "isReplaceOp",
"filePath": "session/src/surface.ts",
"lineRange": [
173,
182
],
"summary": "判断 surface 操作对象是否为替换操作(含 from/to seq 范围)。",
"tags": [
"surface",
"predicate",
"replace"
],
"complexity": "low"
},
{
"id": "function:session/src/surface.ts:surfaceOpOf",
"type": "function",
"name": "surfaceOpOf",
"filePath": "session/src/surface.ts",
"lineRange": [
185,
208
],
"summary": "将 surface 事件转换为 surface operationappend 或 replace)描述。",
"tags": [
"surface",
"operation",
"derive"
],
"complexity": "medium"
},
{
"id": "function:session/src/surface.ts:assertProvenance",
"type": "function",
"name": "assertProvenance",
"filePath": "session/src/surface.ts",
"lineRange": [
211,
243
],
"summary": "校验替换事件的 provenance(被替换 seq 全部存在于 shadowedSeqs 中)。",
"tags": [
"surface",
"validation",
"provenance"
],
"complexity": "medium"
},
{
"id": "function:session/src/surface.ts:replacementRange",
"type": "function",
"name": "replacementRange",
"filePath": "session/src/surface.ts",
"lineRange": [
246,
266
],
"summary": "计算 replace 操作在 surface nodes 中影响的索引范围。",
"tags": [
"surface",
"replace",
"range"
],
"complexity": "medium"
},
{
"id": "function:session/src/surface.ts:isDeepEqualJson",
"type": "function",
"name": "isDeepEqualJson",
"filePath": "session/src/surface.ts",
"lineRange": [
273,
284
],
"summary": "JSON 值的深度相等比较(递归数组/对象),用于判断 rewrite 是否无变化。",
"tags": [
"json",
"comparison",
"surface"
],
"complexity": "medium"
},
{
"id": "function:session/src/surface.ts:assertToolResultRewrite",
"type": "function",
"name": "assertToolResultRewrite",
"filePath": "session/src/surface.ts",
"lineRange": [
287,
318
],
"summary": "校验 tool-result rewrite 事件的 payload 与被替换事件一致或兼容。",
"tags": [
"surface",
"validation",
"tool-result",
"rewrite"
],
"complexity": "medium"
},
{
"id": "function:session/src/surface.ts:planSurfaceEvent",
"type": "function",
"name": "planSurfaceEvent",
"filePath": "session/src/surface.ts",
"lineRange": [
321,
347
],
"summary": "为单个 surface 事件生成执行计划(operation + range + provenance 校验)。",
"tags": [
"surface",
"plan",
"fold"
],
"complexity": "medium"
},
{
"id": "function:session/src/surface.ts:applySurfaceEvent",
"type": "function",
"name": "applySurfaceEvent",
"filePath": "session/src/surface.ts",
"lineRange": [
350,
359
],
"summary": "规划并应用一个 surface 事件到 fold stateplan + applyPlan)。",
"tags": [
"surface",
"apply",
"fold"
],
"complexity": "low"
},
{
"id": "function:session/src/surface.ts:applySurfacePlan",
"type": "function",
"name": "applySurfacePlan",
"filePath": "session/src/surface.ts",
"lineRange": [
362,
379
],
"summary": "将 surface plan 执行到 stateappend 追加 node、replace splice 替换范围)。",
"tags": [
"surface",
"apply",
"fold"
],
"complexity": "medium"
},
{
"id": "function:session/src/surface.ts:foldSurface",
"type": "function",
"name": "foldSurface",
"filePath": "session/src/surface.ts",
"lineRange": [
387,
395
],
"summary": "从事件序列完整折叠出 surface 结果(nodes + replacements 记录)。",
"tags": [
"surface",
"fold",
"projection"
],
"complexity": "low"
},
{
"id": "class:session/src/surface.ts:SurfaceManager",
"type": "class",
"name": "SurfaceManager",
"filePath": "session/src/surface.ts",
"lineRange": [
398,
460
],
"summary": "增量 surface 投影管理器。维护 fold state 和 pending planvalidateNext 增量校验并缓存 nodesreplaceGeneration 失效缓存。",
"tags": [
"surface",
"manager",
"incremental",
"fold"
],
"complexity": "medium"
},
{
"id": "function:session/src/types.ts:SessionId",
"type": "function",
"name": "SessionId",
"filePath": "session/src/types.ts",
"lineRange": [
29,
31
],
"summary": "SessionId branded 类型的构造/校验函数。",
"tags": [
"branded",
"session",
"type"
],
"complexity": "low"
}
],
"edges": [
{
"source": "file:session/src/preparation.ts",
"target": "class:session/src/preparation.ts:SessionPreparation",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/repair.ts",
"target": "function:session/src/repair.ts:interruptedTurnClosers",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/request-header.ts",
"target": "function:session/src/request-header.ts:canonicalHeader",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/request-header.ts",
"target": "function:session/src/request-header.ts:headerEquals",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/request-header.ts",
"target": "function:session/src/request-header.ts:foldRequestHeader",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isSurfaceEligibleType",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isSurfaceEvent",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isAppendSurfaceEvent",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isReplacementSurfaceEvent",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:deriveEventMessage",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isReplaceOp",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:surfaceOpOf",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:assertProvenance",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:replacementRange",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isDeepEqualJson",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:assertToolResultRewrite",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:planSurfaceEvent",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:applySurfaceEvent",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:applySurfacePlan",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:foldSurface",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "class:session/src/surface.ts:SurfaceManager",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/types.ts",
"target": "function:session/src/types.ts:SessionId",
"type": "contains",
"weight": 1,
"direction": "forward"
},
{
"source": "file:session/src/preparation.ts",
"target": "file:session/src/index.ts",
"type": "imports",
"weight": 0.7,
"direction": "forward"
},
{
"source": "file:session/src/repair.ts",
"target": "file:session/src/types.ts",
"type": "imports",
"weight": 0.7,
"direction": "forward"
},
{
"source": "file:session/src/request-header.ts",
"target": "file:session/src/types.ts",
"type": "imports",
"weight": 0.7,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "file:session/src/types.ts",
"type": "imports",
"weight": 0.7,
"direction": "forward"
},
{
"source": "file:session/src/types.ts",
"target": "file:session/src/json.ts",
"type": "imports",
"weight": 0.7,
"direction": "forward"
},
{
"source": "file:session/tests/repair.spec.ts",
"target": "file:session/src/index.ts",
"type": "imports",
"weight": 0.7,
"direction": "forward"
},
{
"source": "file:session/src/preparation.ts",
"target": "class:session/src/preparation.ts:SessionPreparation",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/repair.ts",
"target": "function:session/src/repair.ts:interruptedTurnClosers",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/request-header.ts",
"target": "function:session/src/request-header.ts:canonicalHeader",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/request-header.ts",
"target": "function:session/src/request-header.ts:headerEquals",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/request-header.ts",
"target": "function:session/src/request-header.ts:foldRequestHeader",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isSurfaceEligibleType",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isSurfaceEvent",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isAppendSurfaceEvent",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:isReplacementSurfaceEvent",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:deriveEventMessage",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "function:session/src/surface.ts:foldSurface",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/surface.ts",
"target": "class:session/src/surface.ts:SurfaceManager",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/types.ts",
"target": "function:session/src/types.ts:SessionId",
"type": "exports",
"weight": 0.8,
"direction": "forward"
},
{
"source": "file:session/src/index.ts",
"target": "file:session/tests/repair.spec.ts",
"type": "tested_by",
"weight": 0.5,
"direction": "forward"
},
{
"source": "function:session/src/request-header.ts:foldRequestHeader",
"target": "function:session/src/request-header.ts:canonicalHeader",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:isAppendSurfaceEvent",
"target": "function:session/src/surface.ts:isSurfaceEvent",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:isReplacementSurfaceEvent",
"target": "function:session/src/surface.ts:isSurfaceEvent",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:surfaceOpOf",
"target": "function:session/src/surface.ts:isSurfaceEligibleType",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:surfaceOpOf",
"target": "function:session/src/surface.ts:isReplaceOp",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:assertToolResultRewrite",
"target": "function:session/src/surface.ts:isDeepEqualJson",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:planSurfaceEvent",
"target": "function:session/src/surface.ts:surfaceOpOf",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:planSurfaceEvent",
"target": "function:session/src/surface.ts:assertProvenance",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:planSurfaceEvent",
"target": "function:session/src/surface.ts:replacementRange",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:planSurfaceEvent",
"target": "function:session/src/surface.ts:assertToolResultRewrite",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:applySurfaceEvent",
"target": "function:session/src/surface.ts:planSurfaceEvent",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:applySurfaceEvent",
"target": "function:session/src/surface.ts:applySurfacePlan",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "function:session/src/surface.ts:foldSurface",
"target": "function:session/src/surface.ts:applySurfaceEvent",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "class:session/src/surface.ts:SurfaceManager",
"target": "function:session/src/surface.ts:planSurfaceEvent",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "class:session/src/surface.ts:SurfaceManager",
"target": "function:session/src/surface.ts:applySurfacePlan",
"type": "calls",
"weight": 0.8,
"direction": "forward"
},
{
"source": "class:session/src/surface.ts:SurfaceManager",
"target": "function:session/src/surface.ts:applySurfaceEvent",
"type": "calls",
"weight": 0.8,
"direction": "forward"
}
]
}
@@ -0,0 +1,875 @@
{
"nodes": [
{
"id": "file:agent-loop/src/agent.ts",
"type": "file",
"name": "agent.ts",
"filePath": "agent-loop/src/agent.ts",
"summary": "定义 ReactLoopAgentagent-loop 的默认 agent 驱动器,实现 turn/step 循环、tool 分派、inbox 管理与 abort 语义。",
"tags": [
"agent-loop",
"react-loop-agent",
"turn-step",
"inbox",
"abort"
],
"complexity": "very-high"
},
{
"id": "file:agent-loop/src/constants.ts",
"type": "file",
"name": "constants.ts",
"filePath": "agent-loop/src/constants.ts",
"summary": "导出 DEFAULT_MAX_PARALLEL_TOOL_CALLS 常量,作为并行 tool call 上限的默认值,供 index.ts re-export。",
"tags": [
"constants",
"max-parallel-tool-calls"
],
"complexity": "low"
},
{
"id": "file:agent-loop/src/index.ts",
"type": "file",
"name": "index.ts",
"filePath": "agent-loop/src/index.ts",
"summary": "agent-loop 包主入口,导出 AgentLoop servicectx.agentLoop)及 settings schema;实现 agent 工厂生命周期、configured identity 恢复与 resume 流程。",
"tags": [
"entry-point",
"service",
"agent-loop",
"agent-factory",
"lifecycle"
],
"complexity": "very-high"
},
{
"id": "file:agent-loop/src/runtime-context.ts",
"type": "file",
"name": "runtime-context.ts",
"filePath": "agent-loop/src/runtime-context.ts",
"summary": "定义 RuntimeContextProjection,将 session surface 投影为 runtime context messages,供 system prompt 组装。",
"tags": [
"runtime-context",
"projection",
"surface",
"context"
],
"complexity": "medium"
},
{
"id": "file:agent-loop/src/tool-calls.ts",
"type": "file",
"name": "tool-calls.ts",
"filePath": "agent-loop/src/tool-calls.ts",
"summary": "实现 executeToolCalls,按 execution mode 调度并行/串行 tool call 组,通过 TOOL_RUNTIME_SCHEDULER 派发并追加结果到 session。",
"tags": [
"tool-calls",
"scheduler",
"execution-mode",
"parallel"
],
"complexity": "high"
},
{
"id": "file:agent-loop/tests/contract-regressions.spec.ts",
"type": "file",
"name": "contract-regressions.spec.ts",
"filePath": "agent-loop/tests/contract-regressions.spec.ts",
"summary": "agent-loop 契约回归测试,覆盖 cancel/inject/steer/resume 等边界行为,使用 MockAdapter 驱动 turn。",
"tags": [
"test",
"contract",
"regression",
"agent-loop"
],
"complexity": "high"
},
{
"id": "file:agent-loop/tests/runtime-context.spec.ts",
"type": "file",
"name": "runtime-context.spec.ts",
"filePath": "agent-loop/tests/runtime-context.spec.ts",
"summary": "RuntimeContextProjection 单元测试,验证 context message 投影行为。",
"tags": [
"test",
"runtime-context",
"projection"
],
"complexity": "low"
},
{
"id": "class:agent-loop/src/agent.ts:ReactLoopAgent",
"type": "class",
"name": "ReactLoopAgent",
"filePath": "agent-loop/src/agent.ts",
"lineRange": [
64,
496
],
"summary": "agent-loop 默认 agent 驱动器,持有 inbox/scope/dispatch/runtimeContext,实现 turn->preStep->step->buildRequest 循环与 cancel/steer/inject 控制流。",
"tags": [
"agent-driver",
"turn-step",
"fiber",
"abort",
"dispatch"
],
"complexity": "very-high"
},
{
"id": "function:agent-loop/src/agent.ts:ReactLoopAgent.runMaintenance",
"type": "function",
"name": "ReactLoopAgent.runMaintenance",
"filePath": "agent-loop/src/agent.ts",
"lineRange": [
142,
170
],
"summary": "在 idle phase 运行 maintenance job,结束后恢复 idle phase 并按 inbox 积压唤醒 driver。",
"tags": [
"maintenance",
"idle-phase",
"lifecycle"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/src/agent.ts:ReactLoopAgent.wakeDriver",
"type": "function",
"name": "ReactLoopAgent.wakeDriver",
"filePath": "agent-loop/src/agent.ts",
"lineRange": [
172,
193
],
"summary": "当 inbox 有待处理消息时启动一次 turn 驱动,保证 phase 切换与单次 kick 调度。",
"tags": [
"wake",
"driver",
"kick",
"phase"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/src/agent.ts:ReactLoopAgent.kick",
"type": "function",
"name": "ReactLoopAgent.kick",
"filePath": "agent-loop/src/agent.ts",
"lineRange": [
209,
225
],
"summary": "turn 驱动入口,循环调用 turn 直到 inbox 清空,完成后切回 idle 并按需再次唤醒。",
"tags": [
"kick",
"turn-entry",
"phase"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/src/agent.ts:ReactLoopAgent.preStep",
"type": "function",
"name": "ReactLoopAgent.preStep",
"filePath": "agent-loop/src/agent.ts",
"lineRange": [
226,
245
],
"summary": "组装单步上下文:claim inbox、assemble system prompt、投影 runtime context、触发 waterfall 拦截。",
"tags": [
"pre-step",
"context-assembly",
"waterfall",
"inbox"
],
"complexity": "high"
},
{
"id": "function:agent-loop/src/agent.ts:ReactLoopAgent.turn",
"type": "function",
"name": "ReactLoopAgent.turn",
"filePath": "agent-loop/src/agent.ts",
"lineRange": [
247,
332
],
"summary": "turn 驱动主循环:append user message、preStep、step、派发 tool 结果、处理 abort 与错误链。",
"tags": [
"turn",
"loop-driver",
"abort",
"error-chain"
],
"complexity": "very-high"
},
{
"id": "function:agent-loop/src/agent.ts:ReactLoopAgent.step",
"type": "function",
"name": "ReactLoopAgent.step",
"filePath": "agent-loop/src/agent.ts",
"lineRange": [
334,
411
],
"summary": "单步执行:render prompt、buildRequest、stream LLM、累积 chunk、派发 waterfall、创建 assistant message 并执行 tool calls。",
"tags": [
"step",
"llm-stream",
"waterfall",
"tool-dispatch"
],
"complexity": "very-high"
},
{
"id": "function:agent-loop/src/agent.ts:ReactLoopAgent.buildRequest",
"type": "function",
"name": "ReactLoopAgent.buildRequest",
"filePath": "agent-loop/src/agent.ts",
"lineRange": [
413,
496
],
"summary": "构建 LLM 请求:复用/创建 request header、prepareCall、追加 request context、deepFreeze 标记 markAgentLoopRequest。",
"tags": [
"build-request",
"llm-call",
"request-header",
"prepare-call"
],
"complexity": "high"
},
{
"id": "class:agent-loop/src/index.ts:FactoryOwnership",
"type": "class",
"name": "FactoryOwnership",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
40,
90
],
"summary": "跟踪 agent loop 拥有的 live agents 与 startup tasks,提供 teardown abort signal 与 waitWhileActive/dispose。",
"tags": [
"ownership",
"lifecycle",
"teardown",
"tracking"
],
"complexity": "medium"
},
{
"id": "class:agent-loop/src/index.ts:AgentLoop",
"type": "class",
"name": "AgentLoop",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
296,
711
],
"summary": "ctx.agentLoop service 实现,管理 configured identity 创建/恢复、agent 工厂 prepare/create/resume 生命周期与 settings section。",
"tags": [
"service",
"agent-factory",
"lifecycle",
"configured-identity",
"settings"
],
"complexity": "very-high"
},
{
"id": "function:agent-loop/src/index.ts:raceAbort",
"type": "function",
"name": "raceAbort",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
93,
106
],
"summary": "将 operation 与 abort signal 竞态,signal 触发时 reject AbortError 并清理 listener。",
"tags": [
"abort",
"race",
"signal"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/src/index.ts:raceAbortCall",
"type": "function",
"name": "raceAbortCall",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
109,
130
],
"summary": "在 raceAbort 基础上支持 releaseAbandoned 回调,用于释放被放弃的 prepared call 资源。",
"tags": [
"abort",
"race",
"prepared-call",
"release"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/src/index.ts:applyLauncherIdentities",
"type": "function",
"name": "applyLauncherIdentities",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
221,
234
],
"summary": "将 launcher 配置的 agent identities 应用到 agents 列表,跳过未定义 identity。",
"tags": [
"identities",
"launcher",
"config"
],
"complexity": "low"
},
{
"id": "function:agent-loop/src/index.ts:validateConfiguredAgents",
"type": "function",
"name": "validateConfiguredAgents",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
278,
293
],
"summary": "校验 configured agents 的 identity 唯一性与 resumeSessionId 合法性。",
"tags": [
"validation",
"configured-agents",
"identity"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/src/index.ts:AgentLoop.prepare",
"type": "function",
"name": "AgentLoop.prepare",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
459,
587
],
"summary": "agent 生命周期准备:assert options、绑定 caller/factory abort、enter session/agent scope、announce、emit agent event。",
"tags": [
"lifecycle",
"prepare",
"scope",
"announce"
],
"complexity": "very-high"
},
{
"id": "function:agent-loop/src/index.ts:AgentLoop.create",
"type": "function",
"name": "AgentLoop.create",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
589,
604
],
"summary": "创建新 agentSessionPreparation.create 后调用 prepare 并 publish。",
"tags": [
"create",
"lifecycle",
"session-preparation"
],
"complexity": "low"
},
{
"id": "function:agent-loop/src/index.ts:AgentLoop.setupAndPublish",
"type": "function",
"name": "AgentLoop.setupAndPublish",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
625,
660
],
"summary": "在 prepare 基础上 raceAbort 执行 setup commit,发布 agent 并处理 dispose。",
"tags": [
"setup",
"publish",
"commit",
"race-abort"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/src/index.ts:AgentLoop.resumeWith",
"type": "function",
"name": "AgentLoop.resumeWith",
"filePath": "agent-loop/src/index.ts",
"lineRange": [
662,
711
],
"summary": "从 persistence 恢复 sessionraceAbortCall 加载 preparation 后调用 setupAndPublish。",
"tags": [
"resume",
"persistence",
"race-abort-call",
"setup"
],
"complexity": "high"
},
{
"id": "class:agent-loop/src/runtime-context.ts:RuntimeContextProjection",
"type": "class",
"name": "RuntimeContextProjection",
"filePath": "agent-loop/src/runtime-context.ts",
"lineRange": [
25,
76
],
"summary": "监听 session surface 事件,保留 owned context messages 并投影为 runtime context,供 system prompt 组装。",
"tags": [
"runtime-context",
"projection",
"surface",
"context"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/src/tool-calls.ts:executeToolCalls",
"type": "function",
"name": "executeToolCalls",
"filePath": "agent-loop/src/tool-calls.ts",
"lineRange": [
59,
101
],
"summary": "解析 tool call 参数,按 execution mode 切分 group,串行调度 runGroup 并跳过超限 call。",
"tags": [
"tool-calls",
"execution-mode",
"dispatch",
"scheduling"
],
"complexity": "high"
},
{
"id": "function:agent-loop/src/tool-calls.ts:runGroup",
"type": "function",
"name": "runGroup",
"filePath": "agent-loop/src/tool-calls.ts",
"lineRange": [
121,
246
],
"summary": "并行调度一组 tool callfillPool 启动 call、commitReady 收集结果、追加 tool result 到 session。",
"tags": [
"parallel",
"tool-call",
"pool",
"commit"
],
"complexity": "very-high"
},
{
"id": "function:agent-loop/src/tool-calls.ts:appendToolResult",
"type": "function",
"name": "appendToolResult",
"filePath": "agent-loop/src/tool-calls.ts",
"lineRange": [
268,
289
],
"summary": "创建 tool result message 并追加到 session,处理 outcome 与 callSeq。",
"tags": [
"tool-result",
"session-append",
"outcome"
],
"complexity": "medium"
},
{
"id": "function:agent-loop/tests/contract-regressions.spec.ts:harness",
"type": "function",
"name": "harness",
"filePath": "agent-loop/tests/contract-regressions.spec.ts",
"lineRange": [
29,
39
],
"summary": "测试 harness:挂载 invariants、agent-loop、tools 等 plugin 并注册 MockAdapter。",
"tags": [
"test-harness",
"mock",
"setup"
],
"complexity": "low"
}
],
"edges": [
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "class:agent-loop/src/agent.ts:ReactLoopAgent"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.runMaintenance"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.wakeDriver"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.kick"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.preStep"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.turn"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.step"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.buildRequest"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "class:agent-loop/src/index.ts:FactoryOwnership"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "class:agent-loop/src/index.ts:AgentLoop"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "function:agent-loop/src/index.ts:raceAbort"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "function:agent-loop/src/index.ts:raceAbortCall"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "function:agent-loop/src/index.ts:applyLauncherIdentities"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "function:agent-loop/src/index.ts:validateConfiguredAgents"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "function:agent-loop/src/index.ts:AgentLoop.prepare"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "function:agent-loop/src/index.ts:AgentLoop.create"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "function:agent-loop/src/index.ts:AgentLoop.setupAndPublish"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "function:agent-loop/src/index.ts:AgentLoop.resumeWith"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/runtime-context.ts",
"target": "class:agent-loop/src/runtime-context.ts:RuntimeContextProjection"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/tool-calls.ts",
"target": "function:agent-loop/src/tool-calls.ts:executeToolCalls"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/tool-calls.ts",
"target": "function:agent-loop/src/tool-calls.ts:runGroup"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/src/tool-calls.ts",
"target": "function:agent-loop/src/tool-calls.ts:appendToolResult"
},
{
"type": "contains",
"weight": 1,
"direction": "forward",
"source": "file:agent-loop/tests/contract-regressions.spec.ts",
"target": "function:agent-loop/tests/contract-regressions.spec.ts:harness"
},
{
"type": "imports",
"weight": 0.7,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "file:agent-loop/src/runtime-context.ts"
},
{
"type": "imports",
"weight": 0.7,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "file:agent-loop/src/tool-calls.ts"
},
{
"type": "imports",
"weight": 0.7,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "file:agent-loop/src/agent.ts"
},
{
"type": "imports",
"weight": 0.7,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "file:agent-loop/src/constants.ts"
},
{
"type": "imports",
"weight": 0.7,
"direction": "forward",
"source": "file:agent-loop/tests/contract-regressions.spec.ts",
"target": "file:agent-loop/src/agent.ts"
},
{
"type": "imports",
"weight": 0.7,
"direction": "forward",
"source": "file:agent-loop/tests/contract-regressions.spec.ts",
"target": "file:agent-loop/tests/mock-adapter.ts"
},
{
"type": "imports",
"weight": 0.7,
"direction": "forward",
"source": "file:agent-loop/tests/runtime-context.spec.ts",
"target": "file:agent-loop/src/runtime-context.ts"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "class:agent-loop/src/agent.ts:ReactLoopAgent"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent-loop/src/index.ts",
"target": "class:agent-loop/src/index.ts:AgentLoop"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent-loop/src/runtime-context.ts",
"target": "class:agent-loop/src/runtime-context.ts:RuntimeContextProjection"
},
{
"type": "exports",
"weight": 0.8,
"direction": "forward",
"source": "file:agent-loop/src/tool-calls.ts",
"target": "function:agent-loop/src/tool-calls.ts:executeToolCalls"
},
{
"type": "tested_by",
"weight": 0.5,
"direction": "forward",
"source": "file:agent-loop/src/agent.ts",
"target": "file:agent-loop/tests/contract-regressions.spec.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"direction": "forward",
"source": "file:agent-loop/src/runtime-context.ts",
"target": "file:agent-loop/tests/runtime-context.spec.ts"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/agent.ts:ReactLoopAgent.kick",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.turn"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/agent.ts:ReactLoopAgent.kick",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.wakeDriver"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/agent.ts:ReactLoopAgent.runMaintenance",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.wakeDriver"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/agent.ts:ReactLoopAgent.wakeDriver",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.kick"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/agent.ts:ReactLoopAgent.turn",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.preStep"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/agent.ts:ReactLoopAgent.turn",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.step"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/agent.ts:ReactLoopAgent.step",
"target": "function:agent-loop/src/agent.ts:ReactLoopAgent.buildRequest"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/agent.ts:ReactLoopAgent.step",
"target": "function:agent-loop/src/tool-calls.ts:executeToolCalls"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/index.ts:AgentLoop.create",
"target": "function:agent-loop/src/index.ts:AgentLoop.prepare"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/index.ts:AgentLoop.setupAndPublish",
"target": "function:agent-loop/src/index.ts:AgentLoop.prepare"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/index.ts:AgentLoop.setupAndPublish",
"target": "function:agent-loop/src/index.ts:raceAbort"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/index.ts:AgentLoop.resumeWith",
"target": "function:agent-loop/src/index.ts:AgentLoop.setupAndPublish"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/index.ts:AgentLoop.resumeWith",
"target": "function:agent-loop/src/index.ts:raceAbortCall"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/index.ts:raceAbortCall",
"target": "function:agent-loop/src/index.ts:raceAbort"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/tool-calls.ts:executeToolCalls",
"target": "function:agent-loop/src/tool-calls.ts:runGroup"
},
{
"type": "calls",
"weight": 0.8,
"direction": "forward",
"source": "function:agent-loop/src/tool-calls.ts:runGroup",
"target": "function:agent-loop/src/tool-calls.ts:appendToolResult"
}
]
}
@@ -0,0 +1,421 @@
{
"nodes": [
{
"id": "file:agent/src/dispatch.ts",
"type": "file",
"name": "dispatch.ts",
"filePath": "agent/src/dispatch.ts",
"summary": "Agent-scoped 事件分发与 prompt 组装辅助模块。核心是 fused dispatcher agentEvents,将 agent subject 与其 scope carrier 绑定,使 scope key 与 payload 的 agent 字段不可分离;loop driver 在 agent 构造时构建一次 carrier 并复用,热路径分发零分配。",
"tags": [
"dispatch",
"agent-events",
"scope-carrier",
"fused-dispatcher",
"prompt-assembly"
],
"complexity": "medium",
"languageNotes": "AgentSubjectEvent 通过 conditional mapped type 从 Cordis Events 中筛选出 subject 为 agent 的事件(handler 首参携带 agent 且 this 声明为 Scoped<Agent>)。emit/serial/waterfall 三种分发模式分别对应 Cordis 的 notification、有序串行、around-middleware 语义。"
},
{
"id": "file:agent/src/inbox.ts",
"type": "file",
"name": "inbox.ts",
"filePath": "agent/src/inbox.ts",
"summary": "Agent 持久化 inbox 事件的增量投影。Inbox 类在构造时从 session 事件流重放 replay-once,后续消费 agent/inbox/spliced 事件,维护 next-turn 与 next-step 两条 pending 消息列表,所有变更先写持久化 session 事件再变更 live projection。",
"tags": [
"inbox",
"projection",
"durable-events",
"splice",
"pending-messages"
],
"complexity": "medium-high",
"languageNotes": "splice 语义对标 Array.splice(负 start、deleteCount 截断),validate 在持久化前校验坐标合法性与跨列表 message id 唯一性。mutate 是所有变更的统一入口,durable event 先于 live mutation 提交。"
},
{
"id": "file:agent/src/index.ts",
"type": "file",
"name": "index.ts",
"filePath": "agent/src/index.ts",
"summary": "dsh-agent 包主入口与 barrel。定义 AgentRegistry 服务(ctx.agents):live agent 注册表、factory 委派(AgentFactory 由 dsh-agent-loop 注册)、进程本地 initiator scope(基于 AsyncLocalStorage 的因果归因)。声明 ctx.agents / ctx.agent 访问器与 typert 注册。",
"tags": [
"entry-point",
"barrel",
"service",
"agent-registry",
"initiator-scope"
],
"complexity": "high",
"languageNotes": "initiator scope 通过 AsyncLocalStorage 跨异步链继承,runWithInitiator 精确保留同步/Promise 返回值;disposeInitiators 等待所有 initiator run 排空后再 invalidate。register 返回 exact Cordis effect disposeridentity-nesting 对 agent factory 的 teardown 顺序至关重要。"
},
{
"id": "file:agent/src/runtime-types.ts",
"type": "file",
"name": "runtime-types.ts",
"filePath": "agent/src/runtime-types.ts",
"summary": "公共 agent 类型与 live-runtime 事件词汇表。定义 Agent 接口(live agent handle)、AgentOptions、AgentStatus、PreStepDecision 等类型,并通过 declare module 向 Cordis Events 注入 agent/* 事件(created/disposed/status/inbox/session-start/pre-step/request/request-error/turn-stopping/error)。",
"tags": [
"type-definition",
"agent-interface",
"event-vocabulary",
"events-augmentation",
"live-runtime"
],
"complexity": "medium",
"languageNotes": "Agent 接口的 send/followup/steer/inject 描述 inbox 路由语义(next-turn vs next-step boundary、wake latch)。所有 agent/* 事件声明 this 为 Scoped<Agent>,配合 dsh-scope 做 scope-filtered dispatch。durable 事实仍归 dsh-session 事件。"
},
{
"id": "file:agent/src/types.ts",
"type": "file",
"name": "types.ts",
"filePath": "agent/src/types.ts",
"summary": "与 type-only consumer 共享的持久化 agent session-event 词汇表。定义 InboxTarget 类型并向 dsh-session SessionEventMap 注入 agent/inbox/spliced 持久化事件(target/start/removedCount/inserted/outcome)。",
"tags": [
"type-definition",
"session-event-map",
"inbox-spliced",
"durable-event",
"declaration-merge"
],
"complexity": "low",
"languageNotes": "InboxTarget 仅 'next-turn' | 'next-step' 两个值。agent/inbox/spliced 是 inbox 变更的持久化记录,live dispatch 先于 projection mutation。"
},
{
"id": "file:agent/tests/model-selection.spec.ts",
"type": "file",
"name": "model-selection.spec.ts",
"filePath": "agent/tests/model-selection.spec.ts",
"summary": "测试 installModelSelection():通过 agent/request waterfall 同时快照 prompt variables 与 request routing,并验证 dispose 后两个 listener 均卸载。使用真实 Cordis Context + SystemPrompt 插件组装验证。",
"tags": [
"test",
"model-selection",
"waterfall",
"prompt-variables",
"request-routing"
],
"complexity": "low",
"languageNotes": "测试覆盖 selection.current 变化对 agent/request 返回的 LlmCallConfig 的覆盖逻辑(provider/model/reasoningEffort 覆盖,temperature 继承),以及 dispose 后 waterfall 回退到 seed config。"
},
{
"id": "function:agent/src/dispatch.ts:agentCarrier",
"type": "function",
"name": "agentCarrier",
"filePath": "agent/src/dispatch.ts",
"lineRange": [
94,
96
],
"summary": "为单个 agent subject 构建无状态 scope carrierscopeTarget(agent, agent)),作为事件分发的 thisArg。agentEvents 接受外部传入的 carrier 以复用,避免热路径重复构建。",
"tags": [
"scope-carrier",
"carrier",
"scope-target"
],
"complexity": "low"
},
{
"id": "function:agent/src/dispatch.ts:agentEvents",
"type": "function",
"name": "agentEvents",
"filePath": "agent/src/dispatch.ts",
"lineRange": [
107,
149
],
"summary": "构建将 agent subject 与 scope carrier 绑定的 fused dispatcher,返回 AgentEventDispatch。emit 模式自行解析 callback 集合并独立 contain 同步 throw 与返回 Promise rejectionnotification 不可 veto);serial/waterfall 转发 Cordis mixin。fused 内部注入 agent 字段,保证 subject 与 scope key 不可分离。",
"tags": [
"fused-dispatcher",
"agent-events",
"emit",
"serial",
"waterfall"
],
"complexity": "high",
"languageNotes": "PayloadRest 省略 agent 字段由 fused 注入;spread 在前防止 structurally acceptable payload 覆盖 injected subject。每方法一处 shape-preserving cast 因 TypeScript 无法将 generic Tail<K> spread 关联到 thisArg overload 的 conditional 参数元组。"
},
{
"id": "function:agent/src/dispatch.ts:emitAgentEvent",
"type": "function",
"name": "emitAgentEvent",
"filePath": "agent/src/dispatch.ts",
"lineRange": [
158,
165
],
"summary": "无需分配 retained dispatcher 即可发出单条 contained agent notification 的便捷函数,内部调用 agentEvents(ctx, agent).emit。",
"tags": [
"emit",
"notification",
"convenience"
],
"complexity": "low"
},
{
"id": "function:agent/src/dispatch.ts:assembleContextFor",
"type": "function",
"name": "assembleContextFor",
"filePath": "agent/src/dispatch.ts",
"lineRange": [
174,
176
],
"summary": "构建 prompt 组装上下文,同时设置 agent 与 scope(指向同一 agent),确保 agent-scoped 的 prompt 与 tool contribution 不会被静默遗漏。可选 signal 用于 turn 相关组装。",
"tags": [
"prompt-assembly",
"assemble-context",
"scope"
],
"complexity": "low"
},
{
"id": "class:agent/src/inbox.ts:Inbox",
"type": "class",
"name": "Inbox",
"filePath": "agent/src/inbox.ts",
"lineRange": [
25,
220
],
"summary": "持久化 inbox 事件的增量 replay-once 投影。维护 next-turn/next-step 两条 UserMessage 列表,所有变更经 mutate 统一入口:先 append 持久化 agent/inbox/spliced 事件再变更 live state,并发布 inserted/discarded/claimed live notification。提供 splice/append/prepend/replace/remove/clear/claim 操作。",
"tags": [
"inbox",
"projection",
"splice",
"durable-event",
"validation"
],
"complexity": "medium-high",
"languageNotes": "mutate 实现 Array.splice 语义(NaN/负数处理);validate 校验坐标边界与跨列表 message id 唯一性。claim 是 agent loop step-boundary 的 internal 操作,取出 next-step 全量加可选一条 next-turn。"
},
{
"id": "class:agent/src/index.ts:AgentRegistry",
"type": "class",
"name": "AgentRegistry",
"filePath": "agent/src/index.ts",
"lineRange": [
256,
704
],
"summary": "Agent 服务(ctx.agents):维护 live agent 注册表(Map<SessionId, AgentEntry>),委派 agent 创建/恢复给注册的 AgentFactory(由 dsh-agent-loop 提供),并通过 AsyncLocalStorage 承载 process-local initiator 因果归因。register/enter/announce 提供有序生命周期原语,create/resume 经 factory 委派,dispose 时排空 initiator run 后 invalidate。",
"tags": [
"agent-registry",
"service",
"initiator-scope",
"factory",
"lifecycle"
],
"complexity": "high",
"languageNotes": "enter/announce 分离支持 async factory 的 unpublished setup→commit→publish 序列;detach 延迟到 announce 同步 dispatch unwind 后执行以保证 creation→disposal 顺序。runWithInitiator 精确保留同步/Promise 返回值,branded Promise @@species 异常也安全释放 run。register 返回 exact disposer 以 identity-nest teardown。"
},
{
"id": "interface:agent/src/runtime-types.ts:Agent",
"type": "interface",
"name": "Agent",
"filePath": "agent/src/runtime-types.ts",
"lineRange": [
64,
144
],
"summary": "公共 live-agent handle 接口。暴露 id(与 session 共享)、options、session、inbox、status、ctx,以及 cancel/whenIdle/runMaintenance/send/followup/steer/inject 方法。send 按 InboxTarget 路由到 next-turn/next-step boundary 并可选 wake driverinject 不 wake。",
"tags": [
"agent-interface",
"handle",
"lifecycle",
"inbox-routing",
"live-agent"
],
"complexity": "medium",
"languageNotes": "status 仅 'idle'|'running'disposal 不是第三状态。cancel 的 keepInbox 保留 queued/steering。runMaintenance 从 true idle phase 启动非 turn 维护任务。followup=next-turn wakesteer=next-stepinject=不 wake。"
},
{
"id": "interface:agent/src/runtime-types.ts:AgentEvents",
"type": "interface",
"name": "AgentEvents",
"filePath": "agent/src/runtime-types.ts",
"lineRange": [
146,
291
],
"summary": "通过 declare module 向 Cordis Events 注入的 agent/* 事件词汇表。涵盖 lifecycle emitagent/created、agent/disposed、agent/status)、inbox emitinserted/claimed/discarded)、session lifecycle emitsession-start)、extension points waterfall/serialpre-step、request、request-error、turn-stopping)、error emitagent/error)。所有事件 this 声明为 Scoped<Agent> 做 scope-filtered dispatch。",
"tags": [
"event-vocabulary",
"events-augmentation",
"waterfall",
"emit",
"scope-filtered"
],
"complexity": "medium",
"languageNotes": "agent/pre-step waterfall 可 reject step 或替换 messagesagent/request waterfall 替换 frozen call config(不可 mutate messages);agent/request-error 返回 {kind:'retry'} 可 own recoveryagent/turn-stopping serial 在 turn 提交前 awaitlistener 可 steer 阻止关闭。"
},
{
"id": "interface:agent/src/types.ts:SessionEventMap",
"type": "interface",
"name": "SessionEventMap",
"filePath": "agent/src/types.ts",
"lineRange": [
12,
27
],
"summary": "通过 declare module 向 dsh-session SessionEventMap 注入的持久化 inbox 事件 agent/inbox/spliced:记录 target、start、removedCount、inserted、可选 outcome('canceled')。live dispatch 先于 projection mutation,同步 observer 可读 pre-splice inbox 恢复 removed messages。",
"tags": [
"session-event-map",
"durable-event",
"inbox-spliced",
"declaration-merge"
],
"complexity": "low"
}
],
"edges": [
{
"type": "contains",
"weight": 1,
"source": "file:agent/src/dispatch.ts",
"target": "function:agent/src/dispatch.ts:agentCarrier"
},
{
"type": "contains",
"weight": 1,
"source": "file:agent/src/dispatch.ts",
"target": "function:agent/src/dispatch.ts:agentEvents"
},
{
"type": "contains",
"weight": 1,
"source": "file:agent/src/dispatch.ts",
"target": "function:agent/src/dispatch.ts:emitAgentEvent"
},
{
"type": "contains",
"weight": 1,
"source": "file:agent/src/dispatch.ts",
"target": "function:agent/src/dispatch.ts:assembleContextFor"
},
{
"type": "contains",
"weight": 1,
"source": "file:agent/src/inbox.ts",
"target": "class:agent/src/inbox.ts:Inbox"
},
{
"type": "contains",
"weight": 1,
"source": "file:agent/src/index.ts",
"target": "class:agent/src/index.ts:AgentRegistry"
},
{
"type": "contains",
"weight": 1,
"source": "file:agent/src/runtime-types.ts",
"target": "interface:agent/src/runtime-types.ts:Agent"
},
{
"type": "contains",
"weight": 1,
"source": "file:agent/src/runtime-types.ts",
"target": "interface:agent/src/runtime-types.ts:AgentEvents"
},
{
"type": "contains",
"weight": 1,
"source": "file:agent/src/types.ts",
"target": "interface:agent/src/types.ts:SessionEventMap"
},
{
"type": "exports",
"weight": 0.8,
"source": "file:agent/src/dispatch.ts",
"target": "function:agent/src/dispatch.ts:agentCarrier"
},
{
"type": "exports",
"weight": 0.8,
"source": "file:agent/src/dispatch.ts",
"target": "function:agent/src/dispatch.ts:agentEvents"
},
{
"type": "exports",
"weight": 0.8,
"source": "file:agent/src/dispatch.ts",
"target": "function:agent/src/dispatch.ts:emitAgentEvent"
},
{
"type": "exports",
"weight": 0.8,
"source": "file:agent/src/dispatch.ts",
"target": "function:agent/src/dispatch.ts:assembleContextFor"
},
{
"type": "exports",
"weight": 0.8,
"source": "file:agent/src/inbox.ts",
"target": "class:agent/src/inbox.ts:Inbox"
},
{
"type": "exports",
"weight": 0.8,
"source": "file:agent/src/index.ts",
"target": "class:agent/src/index.ts:AgentRegistry"
},
{
"type": "exports",
"weight": 0.8,
"source": "file:agent/src/runtime-types.ts",
"target": "interface:agent/src/runtime-types.ts:Agent"
},
{
"type": "imports",
"weight": 0.7,
"source": "file:agent/src/dispatch.ts",
"target": "file:agent/src/runtime-types.ts"
},
{
"type": "imports",
"weight": 0.7,
"source": "file:agent/src/inbox.ts",
"target": "file:agent/src/types.ts"
},
{
"type": "imports",
"weight": 0.7,
"source": "file:agent/src/index.ts",
"target": "file:agent/src/runtime-types.ts"
},
{
"type": "imports",
"weight": 0.7,
"source": "file:agent/src/runtime-types.ts",
"target": "file:agent/src/inbox.ts"
},
{
"type": "imports",
"weight": 0.7,
"source": "file:agent/src/runtime-types.ts",
"target": "file:agent/src/types.ts"
},
{
"type": "imports",
"weight": 0.7,
"source": "file:agent/tests/model-selection.spec.ts",
"target": "file:agent/src/index.ts"
},
{
"type": "tested_by",
"weight": 0.5,
"source": "file:agent/src/index.ts",
"target": "file:agent/tests/model-selection.spec.ts"
},
{
"type": "calls",
"weight": 0.8,
"source": "function:agent/src/dispatch.ts:emitAgentEvent",
"target": "function:agent/src/dispatch.ts:agentEvents"
},
{
"type": "calls",
"weight": 0.8,
"source": "function:agent/src/dispatch.ts:agentEvents",
"target": "function:agent/src/dispatch.ts:agentCarrier"
}
]
}
@@ -0,0 +1,158 @@
{
"nodes": [
{
"id": "config:README.i18n.yaml",
"type": "config",
"name": "README.i18n.yaml",
"filePath": "README.i18n.yaml",
"summary": "core 分组根级双语 README 配对一致性记录,保存 README.md 与 README.zh.md 的 git blob 哈希用于翻译门禁(verify-translation-pairing)。",
"tags": [
"configuration",
"i18n",
"bilingual"
],
"complexity": "simple"
},
{
"id": "document:README.md",
"type": "document",
"name": "README.md",
"filePath": "README.md",
"summary": "core 分组的入口文档,概述构成 harness 默认控制主干的产品包(scope、session、system-prompt、tools、agent、agent-default-model、agent-loop)及其 ctx 键与职责,并指向各子包 README 与子系统参考。",
"tags": [
"documentation",
"readme",
"entry-point"
],
"complexity": "simple"
},
{
"id": "document:README.zh.md",
"type": "document",
"name": "README.zh.md",
"filePath": "README.zh.md",
"summary": "core 分组入口文档的中文版,概述构成 harness 默认控制主干的产品包及其 ctx 键与职责。",
"tags": [
"documentation",
"readme",
"entry-point",
"i18n"
],
"complexity": "simple"
}
],
"edges": [
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:README.i18n.yaml",
"target": "document:README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:README.i18n.yaml",
"target": "document:README.zh.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.md",
"target": "document:scope/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.zh.md",
"target": "document:scope/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.md",
"target": "document:session/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.zh.md",
"target": "document:session/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.md",
"target": "document:system-prompt/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.zh.md",
"target": "document:system-prompt/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.md",
"target": "document:tools/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.zh.md",
"target": "document:tools/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.md",
"target": "document:agent/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.zh.md",
"target": "document:agent/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.md",
"target": "document:agent-default-model/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.zh.md",
"target": "document:agent-default-model/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.md",
"target": "document:agent-loop/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "document:README.zh.md",
"target": "document:agent-loop/README.md"
}
]
}
@@ -0,0 +1,123 @@
{
"nodes": [
{
"id": "config:agent-default-model/README.i18n.yaml",
"type": "config",
"name": "README.i18n.yaml",
"filePath": "agent-default-model/README.i18n.yaml",
"summary": "agent-default-model 包的双语 README 配对一致性记录,保存 README.md 与 README.zh.md 的 git blob 哈希用于翻译门禁。",
"tags": [
"configuration",
"i18n",
"bilingual"
],
"complexity": "simple"
},
{
"id": "document:agent-default-model/README.md",
"type": "document",
"name": "README.md",
"filePath": "agent-default-model/README.md",
"summary": "dsh-agent-default-model 包的英文 README,描述各 Agent 入口共享的默认模型选择插件,涵盖模型体验(KV Cache 影响)与已知限制。",
"tags": [
"documentation",
"readme",
"agent-default-model",
"model-selection"
],
"complexity": "simple"
},
{
"id": "document:agent-default-model/README.zh.md",
"type": "document",
"name": "README.zh.md",
"filePath": "agent-default-model/README.zh.md",
"summary": "dsh-agent-default-model 包的中文 README,描述各 Agent 入口共享的默认模型选择插件,涵盖模型体验(KV Cache 影响)与已知限制。",
"tags": [
"documentation",
"readme",
"i18n",
"agent-default-model",
"model-selection"
],
"complexity": "simple"
},
{
"id": "config:agent-default-model/package.json",
"type": "config",
"name": "package.json",
"filePath": "agent-default-model/package.json",
"summary": "npm 包 @deepseek-ai/dsh-agent-default-model 的清单文件,声明入口(lib/index.js)、types、exports、依赖与 peer 依赖。",
"tags": [
"configuration",
"npm",
"manifest"
],
"complexity": "simple"
},
{
"id": "config:agent-default-model/tsconfig.json",
"type": "config",
"name": "tsconfig.json",
"filePath": "agent-default-model/tsconfig.json",
"summary": "agent-default-model 子包的 TypeScript 编译配置,继承 tsconfig.base.jsonrootDir=src、outDir=lib/types,并声明对 vendored cordis/cosmokit/schemastery 及相关 workspace 包的 project references。",
"tags": [
"configuration",
"typescript",
"build-system"
],
"complexity": "simple"
}
],
"edges": [
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:agent-default-model/README.i18n.yaml",
"target": "document:agent-default-model/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:agent-default-model/README.i18n.yaml",
"target": "document:agent-default-model/README.zh.md"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:agent-default-model/README.md",
"target": "file:agent-default-model/src/index.ts"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:agent-default-model/README.zh.md",
"target": "file:agent-default-model/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:agent-default-model/tsconfig.json",
"target": "file:agent-default-model/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:agent-default-model/package.json",
"target": "file:agent-default-model/src/index.ts"
},
{
"type": "depends_on",
"direction": "forward",
"weight": 0.6,
"source": "config:agent-default-model/package.json",
"target": "file:agent-default-model/src/index.ts"
}
]
}
@@ -0,0 +1,123 @@
{
"nodes": [
{
"id": "config:agent-loop/README.i18n.yaml",
"type": "config",
"name": "README.i18n.yaml",
"filePath": "agent-loop/README.i18n.yaml",
"summary": "agent-loop 包的双语 README 配对一致性记录,保存 README.md 与 README.zh.md 的 git blob 哈希用于翻译门禁。",
"tags": [
"configuration",
"i18n",
"bilingual"
],
"complexity": "simple"
},
{
"id": "document:agent-loop/README.md",
"type": "document",
"name": "README.md",
"filePath": "agent-loop/README.md",
"summary": "dsh-agent-loop 包的英文 README,描述 AgentLoop 服务(ctx 键 agentLoop)即默认具体 agent 驱动器,涵盖公开 API、注入服务、不变量配套、配置、循环生命周期(agent.ts)、插件职责,以及完整对话请求、保留消息历史、取消后未分发调用等场景的模型体验。",
"tags": [
"documentation",
"readme",
"agent-loop",
"agent-driver"
],
"complexity": "simple"
},
{
"id": "document:agent-loop/README.zh.md",
"type": "document",
"name": "README.zh.md",
"filePath": "agent-loop/README.zh.md",
"summary": "dsh-agent-loop 包的中文 README,描述 AgentLoop 服务(ctx 键 agentLoop)即默认具体 agent 驱动器,涵盖公开 API、注入服务、不变量配套、配置、循环生命周期(agent.ts)、插件职责,以及完整对话请求、保留消息历史、取消后未分发调用等场景的模型体验。",
"tags": [
"documentation",
"readme",
"i18n",
"agent-loop",
"agent-driver"
],
"complexity": "simple"
},
{
"id": "config:agent-loop/package.json",
"type": "config",
"name": "package.json",
"filePath": "agent-loop/package.json",
"summary": "npm 包 @deepseek-ai/dsh-agent-loop 的清单文件,声明入口(lib/index.js)、types、exports、依赖与 peer 依赖。",
"tags": [
"configuration",
"npm",
"manifest"
],
"complexity": "simple"
},
{
"id": "config:agent-loop/tsconfig.json",
"type": "config",
"name": "tsconfig.json",
"filePath": "agent-loop/tsconfig.json",
"summary": "agent-loop 子包的 TypeScript 编译配置,继承 tsconfig.base.jsonrootDir=src、outDir=lib/types,并声明对 vendored cordis/cosmokit/schemastery 及相关 workspace 包的 project references。",
"tags": [
"configuration",
"typescript",
"build-system"
],
"complexity": "simple"
}
],
"edges": [
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:agent-loop/README.i18n.yaml",
"target": "document:agent-loop/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:agent-loop/README.i18n.yaml",
"target": "document:agent-loop/README.zh.md"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:agent-loop/README.md",
"target": "file:agent-loop/src/index.ts"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:agent-loop/README.zh.md",
"target": "file:agent-loop/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:agent-loop/tsconfig.json",
"target": "file:agent-loop/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:agent-loop/package.json",
"target": "file:agent-loop/src/index.ts"
},
{
"type": "depends_on",
"direction": "forward",
"weight": 0.6,
"source": "config:agent-loop/package.json",
"target": "file:agent-loop/src/index.ts"
}
]
}
@@ -0,0 +1,123 @@
{
"nodes": [
{
"id": "config:agent-tool-presentation/README.i18n.yaml",
"type": "config",
"name": "README.i18n.yaml",
"filePath": "agent-tool-presentation/README.i18n.yaml",
"summary": "agent-tool-presentation 包的双语 README 配对一致性记录,保存 README.md 与 README.zh.md 的 git blob 哈希用于翻译门禁。",
"tags": [
"configuration",
"i18n",
"bilingual"
],
"complexity": "simple"
},
{
"id": "document:agent-tool-presentation/README.md",
"type": "document",
"name": "README.md",
"filePath": "agent-tool-presentation/README.md",
"summary": "dsh-agent-tool-presentation 包的英文 README,说明为何采用一行插件而非下沉注册表,描述其作用、模型体验(KV Cache 影响)与已知限制。",
"tags": [
"documentation",
"readme",
"agent-tool-presentation",
"presentation"
],
"complexity": "simple"
},
{
"id": "document:agent-tool-presentation/README.zh.md",
"type": "document",
"name": "README.zh.md",
"filePath": "agent-tool-presentation/README.zh.md",
"summary": "dsh-agent-tool-presentation 包的中文 README,说明为何采用一行插件而非下沉注册表,描述其作用、模型体验(KV Cache 影响)与已知限制。",
"tags": [
"documentation",
"readme",
"i18n",
"agent-tool-presentation",
"presentation"
],
"complexity": "simple"
},
{
"id": "config:agent-tool-presentation/package.json",
"type": "config",
"name": "package.json",
"filePath": "agent-tool-presentation/package.json",
"summary": "npm 包 @deepseek-ai/dsh-agent-tool-presentation 的清单文件,声明入口(lib/index.js)、types、exports、依赖与 peer 依赖。",
"tags": [
"configuration",
"npm",
"manifest"
],
"complexity": "simple"
},
{
"id": "config:agent-tool-presentation/tsconfig.json",
"type": "config",
"name": "tsconfig.json",
"filePath": "agent-tool-presentation/tsconfig.json",
"summary": "agent-tool-presentation 子包的 TypeScript 编译配置,继承 tsconfig.base.jsonrootDir=src、outDir=lib/types,并声明对 vendored cordis/cosmokit/schemastery 及相关 workspace 包的 project references。",
"tags": [
"configuration",
"typescript",
"build-system"
],
"complexity": "simple"
}
],
"edges": [
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:agent-tool-presentation/README.i18n.yaml",
"target": "document:agent-tool-presentation/README.md"
},
{
"type": "related",
"direction": "forward",
"weight": 0.5,
"source": "config:agent-tool-presentation/README.i18n.yaml",
"target": "document:agent-tool-presentation/README.zh.md"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:agent-tool-presentation/README.md",
"target": "file:agent-tool-presentation/src/index.ts"
},
{
"type": "documents",
"direction": "forward",
"weight": 0.5,
"source": "document:agent-tool-presentation/README.zh.md",
"target": "file:agent-tool-presentation/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:agent-tool-presentation/tsconfig.json",
"target": "file:agent-tool-presentation/src/index.ts"
},
{
"type": "configures",
"direction": "forward",
"weight": 0.6,
"source": "config:agent-tool-presentation/package.json",
"target": "file:agent-tool-presentation/src/index.ts"
},
{
"type": "depends_on",
"direction": "forward",
"weight": 0.6,
"source": "config:agent-tool-presentation/package.json",
"target": "file:agent-tool-presentation/src/index.ts"
}
]
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,157 @@
{
"projectRoot": "/home/lambert/githubRepos/deepseek-harness/packages/core",
"sourceFilePaths": [
"README.i18n.yaml",
"README.md",
"README.zh.md",
"agent-default-model/README.i18n.yaml",
"agent-default-model/README.md",
"agent-default-model/README.zh.md",
"agent-default-model/package.json",
"agent-default-model/src/index.ts",
"agent-default-model/src/invariant.ts",
"agent-default-model/tests/agent-default-model.spec.ts",
"agent-default-model/tsconfig.json",
"agent-default-model/tsdown.config.ts",
"agent-loop/README.i18n.yaml",
"agent-loop/README.md",
"agent-loop/README.zh.md",
"agent-loop/package.json",
"agent-loop/src/agent.ts",
"agent-loop/src/constants.ts",
"agent-loop/src/index.ts",
"agent-loop/src/invariant.ts",
"agent-loop/src/runtime-context.ts",
"agent-loop/src/tool-calls.ts",
"agent-loop/tests/agent-initiator.spec.ts",
"agent-loop/tests/agent.spec.ts",
"agent-loop/tests/cancel.spec.ts",
"agent-loop/tests/config-session-id.spec.ts",
"agent-loop/tests/contract-regressions.spec.ts",
"agent-loop/tests/coverage-edges.spec.ts",
"agent-loop/tests/interception.spec.ts",
"agent-loop/tests/invariant.spec.ts",
"agent-loop/tests/loop.spec.ts",
"agent-loop/tests/mock-adapter.ts",
"agent-loop/tests/properties.spec.ts",
"agent-loop/tests/request-cache.e2e.ts",
"agent-loop/tests/request-error.spec.ts",
"agent-loop/tests/request-reconstruction.spec.ts",
"agent-loop/tests/resume.spec.ts",
"agent-loop/tests/runtime-context.spec.ts",
"agent-loop/tests/scope-lifecycle.spec.ts",
"agent-loop/tests/settings.spec.ts",
"agent-loop/tests/tool-calls.spec.ts",
"agent-loop/tests/tool-order.spec.ts",
"agent-loop/tsconfig.json",
"agent-loop/tsdown.config.ts",
"agent-tool-presentation/README.i18n.yaml",
"agent-tool-presentation/README.md",
"agent-tool-presentation/README.zh.md",
"agent-tool-presentation/package.json",
"agent-tool-presentation/src/index.ts",
"agent-tool-presentation/src/invariant.ts",
"agent-tool-presentation/tests/agent-tool-presentation.spec.ts",
"agent-tool-presentation/tsconfig.json",
"agent/README.i18n.yaml",
"agent/README.md",
"agent/README.zh.md",
"agent/package.json",
"agent/src/consumed-work.ts",
"agent/src/dispatch.ts",
"agent/src/inbox.ts",
"agent/src/index.ts",
"agent/src/invariant.ts",
"agent/src/model-selection.ts",
"agent/src/runtime-types.ts",
"agent/src/types.ts",
"agent/tests/agent-initiator.spec.ts",
"agent/tests/agent.spec.ts",
"agent/tests/consumed-work.spec.ts",
"agent/tests/invariant.spec.ts",
"agent/tests/model-selection.spec.ts",
"agent/tests/verify-export-jsdoc.spec.ts",
"agent/tsconfig.json",
"agent/tsdown.config.ts",
"scope/README.i18n.yaml",
"scope/README.md",
"scope/README.zh.md",
"scope/package.json",
"scope/src/index.ts",
"scope/src/invariant.ts",
"scope/src/store.ts",
"scope/tests/invariant.spec.ts",
"scope/tests/scope.spec.ts",
"scope/tests/store.spec.ts",
"scope/tsconfig.json",
"scope/tsdown.config.ts",
"session/README.i18n.yaml",
"session/README.md",
"session/README.zh.md",
"session/package.json",
"session/src/chunk-rows.ts",
"session/src/index.ts",
"session/src/invariant.ts",
"session/src/json.ts",
"session/src/known-event-types.ts",
"session/src/preparation.ts",
"session/src/repair.ts",
"session/src/request-header.ts",
"session/src/surface.ts",
"session/src/types.ts",
"session/tests/chunk-rows.spec.ts",
"session/tests/derived-cache.spec.ts",
"session/tests/fork.spec.ts",
"session/tests/gen-persistence-catalog.spec.ts",
"session/tests/invariant.spec.ts",
"session/tests/json.spec.ts",
"session/tests/properties.spec.ts",
"session/tests/repair.spec.ts",
"session/tests/request-header.spec.ts",
"session/tests/scoped.spec.ts",
"session/tests/session.spec.ts",
"session/tests/surface.spec.ts",
"session/tests/typert.spec.ts",
"session/tsconfig.json",
"session/tsdown.config.ts",
"system-prompt/README.i18n.yaml",
"system-prompt/README.md",
"system-prompt/README.zh.md",
"system-prompt/package.json",
"system-prompt/src/index.ts",
"system-prompt/src/invariant.ts",
"system-prompt/tests/invariant.spec.ts",
"system-prompt/tests/scoped.spec.ts",
"system-prompt/tests/system-prompt.spec.ts",
"system-prompt/tests/tool-order.spec.ts",
"system-prompt/tsconfig.json",
"tools/README.i18n.yaml",
"tools/README.md",
"tools/README.zh.md",
"tools/package.json",
"tools/src/code-mode.ts",
"tools/src/index.ts",
"tools/src/invariant.ts",
"tools/src/json-schema.ts",
"tools/src/presentation.ts",
"tools/src/py-types.ts",
"tools/src/schema.ts",
"tools/src/testing.ts",
"tools/src/ts-types.ts",
"tools/src/types.ts",
"tools/tests/code-mode.spec.ts",
"tools/tests/execution-mode.spec.ts",
"tools/tests/execution-signal-types.spec.ts",
"tools/tests/gen-tool-catalog.spec.ts",
"tools/tests/invariant.spec.ts",
"tools/tests/json-schema.spec.ts",
"tools/tests/properties.spec.ts",
"tools/tests/py-types.spec.ts",
"tools/tests/schema.spec.ts",
"tools/tests/scoped.spec.ts",
"tools/tests/tools.spec.ts",
"tools/tests/ts-types.spec.ts",
"tools/tsconfig.json"
],
"gitCommitHash": "740c3208c546001df26e62f74ccfd2d110609415"
}
@@ -0,0 +1,216 @@
[
{
"id": "layer:agent-loop",
"name": "Agent Loop 驱动层",
"description": "agent-loop 子包的 src 运行时与 tests。提供 ctx.agentLoop:默认的 agent turn 循环具体驱动,含 runtime-context、tool-calls、constants 与 cancel/resume 语义;intra-package import 密度最高 (0.0403)。",
"nodeIds": [
"file:agent-loop/tests/agent-initiator.spec.ts",
"file:agent-loop/tests/agent.spec.ts",
"file:agent-loop/tests/cancel.spec.ts",
"file:agent-loop/tests/config-session-id.spec.ts",
"file:agent-loop/tests/coverage-edges.spec.ts",
"file:agent-loop/tests/interception.spec.ts",
"file:agent-loop/tests/loop.spec.ts",
"file:agent-loop/tests/mock-adapter.ts",
"file:agent-loop/tests/request-error.spec.ts",
"file:agent-loop/tests/request-reconstruction.spec.ts",
"file:agent-loop/tests/resume.spec.ts",
"file:agent-loop/tests/scope-lifecycle.spec.ts",
"file:agent-loop/tests/tool-calls.spec.ts",
"file:agent-loop/tests/tool-order.spec.ts",
"file:agent-loop/src/agent.ts",
"file:agent-loop/src/constants.ts",
"file:agent-loop/src/index.ts",
"file:agent-loop/src/runtime-context.ts",
"file:agent-loop/src/tool-calls.ts",
"file:agent-loop/tests/contract-regressions.spec.ts",
"file:agent-loop/tests/runtime-context.spec.ts",
"file:agent-loop/src/invariant.ts",
"file:agent-loop/tests/invariant.spec.ts",
"file:agent-loop/tests/properties.spec.ts",
"file:agent-loop/tests/request-cache.e2e.ts",
"file:agent-loop/tests/settings.spec.ts"
]
},
{
"id": "layer:agent",
"name": "Agent 接口层",
"description": "agent 子包的 src 运行时与 tests。定义 ctx.agents 的 Agent 接口、registry、dispatch/inbox、model-selection 与 consumed-work 不变式。",
"nodeIds": [
"file:agent/src/dispatch.ts",
"file:agent/src/inbox.ts",
"file:agent/src/index.ts",
"file:agent/src/runtime-types.ts",
"file:agent/src/types.ts",
"file:agent/tests/model-selection.spec.ts",
"file:agent/src/consumed-work.ts",
"file:agent/src/invariant.ts",
"file:agent/src/model-selection.ts",
"file:agent/tests/agent-initiator.spec.ts",
"file:agent/tests/agent.spec.ts",
"file:agent/tests/consumed-work.spec.ts",
"file:agent/tests/invariant.spec.ts",
"file:agent/tests/verify-export-jsdoc.spec.ts"
]
},
{
"id": "layer:session",
"name": "Session 事件层",
"description": "session 子包的 src 运行时与 tests。提供 ctx.sessions 的 event-sourced 会话日志:chunk-rows、json、repair、surface、request-header、known-event-types 与 persistence catalog 生成。",
"nodeIds": [
"file:session/src/chunk-rows.ts",
"file:session/src/index.ts",
"file:session/src/invariant.ts",
"file:session/src/json.ts",
"file:session/src/preparation.ts",
"file:session/src/repair.ts",
"file:session/src/request-header.ts",
"file:session/src/surface.ts",
"file:session/src/types.ts",
"file:session/tests/repair.spec.ts",
"file:session/src/known-event-types.ts",
"file:session/tests/chunk-rows.spec.ts",
"file:session/tests/derived-cache.spec.ts",
"file:session/tests/fork.spec.ts",
"file:session/tests/gen-persistence-catalog.spec.ts",
"file:session/tests/invariant.spec.ts",
"file:session/tests/json.spec.ts",
"file:session/tests/properties.spec.ts",
"file:session/tests/request-header.spec.ts",
"file:session/tests/scoped.spec.ts",
"file:session/tests/session.spec.ts",
"file:session/tests/surface.spec.ts",
"file:session/tests/typert.spec.ts"
]
},
{
"id": "layer:system-prompt",
"name": "System Prompt 装配层",
"description": "system-prompt 子包的 src 运行时与 tests。提供 ctx.systemPrompt 的 prompt 与 tool-schema 装配;唯一向 tools 发出跨包 tested_by 边,体现对 tool schema 的依赖。",
"nodeIds": [
"file:system-prompt/src/index.ts",
"file:system-prompt/src/invariant.ts",
"file:system-prompt/tests/invariant.spec.ts",
"file:system-prompt/tests/scoped.spec.ts",
"file:system-prompt/tests/system-prompt.spec.ts",
"file:system-prompt/tests/tool-order.spec.ts"
]
},
{
"id": "layer:tools",
"name": "Tools 注册层",
"description": "tools 子包的 src 运行时与 tests。提供 ctx.tools 的工具 registry、schema、json-schema、code-mode、presentation 与 ts-types/py-types 类型映射;intra-package import 密度最高 (0.0541)。",
"nodeIds": [
"file:tools/src/code-mode.ts",
"file:tools/src/index.ts",
"file:tools/src/invariant.ts",
"file:tools/src/json-schema.ts",
"file:tools/src/presentation.ts",
"file:tools/src/py-types.ts",
"file:tools/src/schema.ts",
"file:tools/src/testing.ts",
"file:tools/src/ts-types.ts",
"file:tools/src/types.ts",
"file:tools/tests/json-schema.spec.ts",
"file:tools/tests/schema.spec.ts",
"file:tools/tests/code-mode.spec.ts",
"file:tools/tests/execution-mode.spec.ts",
"file:tools/tests/execution-signal-types.spec.ts",
"file:tools/tests/gen-tool-catalog.spec.ts",
"file:tools/tests/invariant.spec.ts",
"file:tools/tests/properties.spec.ts",
"file:tools/tests/py-types.spec.ts",
"file:tools/tests/scoped.spec.ts",
"file:tools/tests/tools.spec.ts",
"file:tools/tests/ts-types.spec.ts"
]
},
{
"id": "layer:scope",
"name": "Scope 上下文层",
"description": "scope 子包的 src 运行时与 tests。提供 scoped-context 原语与 store,作为各 plugin 共享的上下文作用域基础。",
"nodeIds": [
"file:scope/src/index.ts",
"file:scope/src/invariant.ts",
"file:scope/src/store.ts",
"file:scope/tests/invariant.spec.ts",
"file:scope/tests/scope.spec.ts",
"file:scope/tests/store.spec.ts"
]
},
{
"id": "layer:agent-config-plugins",
"name": "Agent 配置插件层",
"description": "agent-default-model 与 agent-tool-presentation 两个小型配置插件的 src 与 tests:分别提供 ctx.agentDefaultModel 默认模型选择与 tool presentation 渲染意图;二者跨包耦合为零,体量小故合并为单层。",
"nodeIds": [
"file:agent-default-model/src/index.ts",
"file:agent-default-model/src/invariant.ts",
"file:agent-default-model/tests/agent-default-model.spec.ts",
"file:agent-tool-presentation/src/index.ts",
"file:agent-tool-presentation/src/invariant.ts",
"file:agent-tool-presentation/tests/agent-tool-presentation.spec.ts"
]
},
{
"id": "layer:configuration",
"name": "构建与包配置层",
"description": "所有子包的 package.json、tsconfig.json、README.i18n.yaml 与 tsdown.config.ts(含 packages/core 组级根 README.i18n.yaml)。即构建 (tsdown)、打包 (package.json)、类型 (tsconfig) 与文档国际化 (i18n) 配置;不含运行时代码。",
"nodeIds": [
"config:README.i18n.yaml",
"config:agent-default-model/README.i18n.yaml",
"config:agent-default-model/package.json",
"config:agent-default-model/tsconfig.json",
"config:agent-loop/README.i18n.yaml",
"config:agent-loop/package.json",
"config:agent-loop/tsconfig.json",
"config:agent-tool-presentation/README.i18n.yaml",
"config:agent-tool-presentation/package.json",
"config:agent-tool-presentation/tsconfig.json",
"config:agent/README.i18n.yaml",
"config:agent/package.json",
"config:agent/tsconfig.json",
"config:scope/README.i18n.yaml",
"config:scope/package.json",
"config:scope/tsconfig.json",
"config:session/README.i18n.yaml",
"config:session/package.json",
"config:session/tsconfig.json",
"config:system-prompt/README.i18n.yaml",
"config:system-prompt/package.json",
"config:system-prompt/tsconfig.json",
"config:tools/README.i18n.yaml",
"config:tools/package.json",
"config:tools/tsconfig.json",
"file:agent-default-model/tsdown.config.ts",
"file:agent-loop/tsdown.config.ts",
"file:agent/tsdown.config.ts",
"file:scope/tsdown.config.ts",
"file:session/tsdown.config.ts"
]
},
{
"id": "layer:documentation",
"name": "文档层",
"description": "所有 README.md / README.zh.md(含 packages/core 组级根 README)。按 related 边构成 root -> 各子包的文档层级;doc coverage 对 8 个 src 组全覆盖。",
"nodeIds": [
"document:README.md",
"document:README.zh.md",
"document:agent-default-model/README.md",
"document:agent-default-model/README.zh.md",
"document:agent-loop/README.md",
"document:agent-loop/README.zh.md",
"document:agent-tool-presentation/README.md",
"document:agent-tool-presentation/README.zh.md",
"document:agent/README.md",
"document:agent/README.zh.md",
"document:scope/README.md",
"document:scope/README.zh.md",
"document:session/README.md",
"document:session/README.zh.md",
"document:system-prompt/README.md",
"document:system-prompt/README.zh.md",
"document:tools/README.md",
"document:tools/README.zh.md"
]
}
]
@@ -0,0 +1,39 @@
{
"issues": [],
"warnings": [
"Node 'file:agent-default-model/tsdown.config.ts' has no edges (orphan)",
"Node 'file:agent-loop/tsdown.config.ts' has no edges (orphan)",
"Node 'file:agent/tests/consumed-work.spec.ts' has no edges (orphan)",
"Node 'file:agent/tests/invariant.spec.ts' has no edges (orphan)",
"Node 'file:agent/tsdown.config.ts' has no edges (orphan)",
"Node 'file:scope/tsdown.config.ts' has no edges (orphan)",
"Node 'file:session/src/known-event-types.ts' has no edges (orphan)",
"Node 'file:session/tests/gen-persistence-catalog.spec.ts' has no edges (orphan)",
"Node 'file:session/tsdown.config.ts' has no edges (orphan)",
"Node 'file:tools/tests/gen-tool-catalog.spec.ts' has no edges (orphan)"
],
"stats": {
"totalNodes": 381,
"totalEdges": 585,
"totalLayers": 9,
"tourSteps": 8,
"nodeTypes": {
"file": 108,
"function": 194,
"class": 36,
"config": 25,
"document": 18
},
"edgeTypes": {
"contains": 230,
"imports": 60,
"exports": 87,
"tested_by": 44,
"calls": 92,
"related": 32,
"documents": 16,
"configures": 16,
"depends_on": 8
}
}
}
@@ -0,0 +1,264 @@
{
"scriptCompleted": true,
"stats": {
"filesScanned": 151,
"filesWithImports": 43,
"totalEdges": 60
},
"importMap": {
"README.i18n.yaml": [],
"README.md": [],
"README.zh.md": [],
"agent-default-model/README.i18n.yaml": [],
"agent-default-model/README.md": [],
"agent-default-model/README.zh.md": [],
"agent-default-model/package.json": [],
"agent-default-model/src/index.ts": [],
"agent-default-model/src/invariant.ts": [],
"agent-default-model/tests/agent-default-model.spec.ts": [
"agent-default-model/src/index.ts"
],
"agent-default-model/tsconfig.json": [],
"agent-default-model/tsdown.config.ts": [],
"agent-loop/README.i18n.yaml": [],
"agent-loop/README.md": [],
"agent-loop/README.zh.md": [],
"agent-loop/package.json": [],
"agent-loop/src/agent.ts": [
"agent-loop/src/runtime-context.ts",
"agent-loop/src/tool-calls.ts"
],
"agent-loop/src/constants.ts": [],
"agent-loop/src/index.ts": [
"agent-loop/src/agent.ts",
"agent-loop/src/constants.ts"
],
"agent-loop/src/invariant.ts": [],
"agent-loop/src/runtime-context.ts": [],
"agent-loop/src/tool-calls.ts": [],
"agent-loop/tests/agent-initiator.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/agent.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/cancel.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/config-session-id.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/contract-regressions.spec.ts": [
"agent-loop/src/agent.ts",
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/coverage-edges.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/interception.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/invariant.spec.ts": [],
"agent-loop/tests/loop.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/mock-adapter.ts": [],
"agent-loop/tests/properties.spec.ts": [],
"agent-loop/tests/request-cache.e2e.ts": [],
"agent-loop/tests/request-error.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/request-reconstruction.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/resume.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/runtime-context.spec.ts": [
"agent-loop/src/runtime-context.ts"
],
"agent-loop/tests/scope-lifecycle.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/settings.spec.ts": [],
"agent-loop/tests/tool-calls.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tests/tool-order.spec.ts": [
"agent-loop/tests/mock-adapter.ts"
],
"agent-loop/tsconfig.json": [],
"agent-loop/tsdown.config.ts": [],
"agent-tool-presentation/README.i18n.yaml": [],
"agent-tool-presentation/README.md": [],
"agent-tool-presentation/README.zh.md": [],
"agent-tool-presentation/package.json": [],
"agent-tool-presentation/src/index.ts": [],
"agent-tool-presentation/src/invariant.ts": [],
"agent-tool-presentation/tests/agent-tool-presentation.spec.ts": [],
"agent-tool-presentation/tsconfig.json": [],
"agent/README.i18n.yaml": [],
"agent/README.md": [],
"agent/README.zh.md": [],
"agent/package.json": [],
"agent/src/consumed-work.ts": [],
"agent/src/dispatch.ts": [
"agent/src/runtime-types.ts"
],
"agent/src/inbox.ts": [
"agent/src/types.ts"
],
"agent/src/index.ts": [
"agent/src/runtime-types.ts"
],
"agent/src/invariant.ts": [],
"agent/src/model-selection.ts": [],
"agent/src/runtime-types.ts": [
"agent/src/inbox.ts",
"agent/src/types.ts"
],
"agent/src/types.ts": [],
"agent/tests/agent-initiator.spec.ts": [],
"agent/tests/agent.spec.ts": [],
"agent/tests/consumed-work.spec.ts": [],
"agent/tests/invariant.spec.ts": [],
"agent/tests/model-selection.spec.ts": [
"agent/src/index.ts"
],
"agent/tests/verify-export-jsdoc.spec.ts": [],
"agent/tsconfig.json": [],
"agent/tsdown.config.ts": [],
"scope/README.i18n.yaml": [],
"scope/README.md": [],
"scope/README.zh.md": [],
"scope/package.json": [],
"scope/src/index.ts": [],
"scope/src/invariant.ts": [],
"scope/src/store.ts": [
"scope/src/index.ts"
],
"scope/tests/invariant.spec.ts": [],
"scope/tests/scope.spec.ts": [],
"scope/tests/store.spec.ts": [],
"scope/tsconfig.json": [],
"scope/tsdown.config.ts": [],
"session/README.i18n.yaml": [],
"session/README.md": [],
"session/README.zh.md": [],
"session/package.json": [],
"session/src/chunk-rows.ts": [
"session/src/types.ts"
],
"session/src/index.ts": [
"session/src/json.ts",
"session/src/request-header.ts",
"session/src/surface.ts",
"session/src/types.ts"
],
"session/src/invariant.ts": [
"session/src/repair.ts"
],
"session/src/json.ts": [],
"session/src/known-event-types.ts": [],
"session/src/preparation.ts": [
"session/src/index.ts"
],
"session/src/repair.ts": [
"session/src/types.ts"
],
"session/src/request-header.ts": [
"session/src/types.ts"
],
"session/src/surface.ts": [
"session/src/types.ts"
],
"session/src/types.ts": [
"session/src/json.ts"
],
"session/tests/chunk-rows.spec.ts": [],
"session/tests/derived-cache.spec.ts": [],
"session/tests/fork.spec.ts": [],
"session/tests/gen-persistence-catalog.spec.ts": [],
"session/tests/invariant.spec.ts": [],
"session/tests/json.spec.ts": [],
"session/tests/properties.spec.ts": [],
"session/tests/repair.spec.ts": [
"session/src/index.ts"
],
"session/tests/request-header.spec.ts": [],
"session/tests/scoped.spec.ts": [],
"session/tests/session.spec.ts": [],
"session/tests/surface.spec.ts": [],
"session/tests/typert.spec.ts": [],
"session/tsconfig.json": [],
"session/tsdown.config.ts": [],
"system-prompt/README.i18n.yaml": [],
"system-prompt/README.md": [],
"system-prompt/README.zh.md": [],
"system-prompt/package.json": [],
"system-prompt/src/index.ts": [],
"system-prompt/src/invariant.ts": [
"system-prompt/src/index.ts"
],
"system-prompt/tests/invariant.spec.ts": [],
"system-prompt/tests/scoped.spec.ts": [],
"system-prompt/tests/system-prompt.spec.ts": [],
"system-prompt/tests/tool-order.spec.ts": [],
"system-prompt/tsconfig.json": [],
"tools/README.i18n.yaml": [],
"tools/README.md": [],
"tools/README.zh.md": [],
"tools/package.json": [],
"tools/src/code-mode.ts": [
"tools/src/index.ts",
"tools/src/schema.ts",
"tools/src/types.ts"
],
"tools/src/index.ts": [
"tools/src/code-mode.ts",
"tools/src/json-schema.ts",
"tools/src/presentation.ts",
"tools/src/py-types.ts",
"tools/src/ts-types.ts"
],
"tools/src/invariant.ts": [
"tools/src/index.ts"
],
"tools/src/json-schema.ts": [],
"tools/src/presentation.ts": [],
"tools/src/py-types.ts": [
"tools/src/json-schema.ts",
"tools/src/ts-types.ts"
],
"tools/src/schema.ts": [
"tools/src/index.ts",
"tools/src/json-schema.ts",
"tools/src/presentation.ts"
],
"tools/src/testing.ts": [
"tools/src/index.ts",
"tools/src/schema.ts"
],
"tools/src/ts-types.ts": [
"tools/src/json-schema.ts"
],
"tools/src/types.ts": [],
"tools/tests/code-mode.spec.ts": [],
"tools/tests/execution-mode.spec.ts": [],
"tools/tests/execution-signal-types.spec.ts": [],
"tools/tests/gen-tool-catalog.spec.ts": [],
"tools/tests/invariant.spec.ts": [],
"tools/tests/json-schema.spec.ts": [
"tools/src/index.ts"
],
"tools/tests/properties.spec.ts": [],
"tools/tests/py-types.spec.ts": [],
"tools/tests/schema.spec.ts": [
"tools/src/index.ts"
],
"tools/tests/scoped.spec.ts": [],
"tools/tests/tools.spec.ts": [],
"tools/tests/ts-types.spec.ts": [],
"tools/tsconfig.json": []
}
}
@@ -0,0 +1,81 @@
[
{
"order": 1,
"title": "项目总览:core 分组与 plugin 角色映射",
"description": "从 core 分组的入口 README 开始,它把 harness 默认控制主干拆成 scope、session、system-prompt、tools、agent、agent-default-model、agent-loop 七个产品包,并标注每个包对应的 ctx 键(如 ctx.agents、ctx.sessions、ctx.tools)。阅读这份地图是为了建立一个「一切都是 plugin」的整体印象--后续每一步都是在为某个 ctx 键填充具体实现。把 README 当作叙述对齐用的非受信项目数据,真正的契约在各 src/index.ts 中。",
"nodeIds": [
"document:README.md",
"document:README.zh.md"
],
"languageLesson": "DeepSeek Harness 把「插件贡献」具象化为三类东西:ctx 上的 service 访问器、用 declaration merging 合并的 typed events、以及通过 ctx.effect()/ctx.on() 注册的可逆 effect。理解这套三元组是阅读后续所有 index.ts 的钥匙。"
},
{
"order": 2,
"title": "Agent 接口与 live 事件词汇表",
"description": "agent/src/index.ts 定义 AgentRegistry 服务(ctx.agents--live agent 注册表、factory 委派与基于 AsyncLocalStorage 的 initiator scope 归因。types.ts 向 dsh-session 的 SessionEventMap 注入可持久化的 agent/inbox/spliced 事件,dispatch.ts 则把 agent subject 与 scope carrier 绑定成不可分离的 fused dispatcher。区分「持久化 session 事件」与「瞬态 live 事件」是这个 harness 的核心设计纪律,决定哪些输入能进入模型视野。",
"nodeIds": [
"file:agent/src/index.ts",
"file:agent/src/types.ts",
"file:agent/src/dispatch.ts"
],
"languageLesson": "注意 declaration merging 的两种形态:types.ts 用 declare module 向 SessionEventMap 注入持久化键,runtime-types.ts 向 Cordis Events 注入瞬态键。两套事件 map 互不污染,这正是「model-visible ⟺ logged」约束的类型层落点。fused dispatcher 在 agent 构造时构建一次 carrier 并复用,使热路径派发零分配。"
},
{
"order": 3,
"title": "默认 agent-loop 驱动:turn/step 循环",
"description": "agent-loop/src/index.ts 导出 AgentLoop servicectx.agentLoop),管理 agent 工厂生命周期、configured identity 恢复与 resume 流程;agent.ts 中的 ReactLoopAgent 是默认具体驱动,实现 turn/step 循环、tool 分派、inbox 管理与 abort 语义。这是「plugins, not loop changes」原则的具象化:loop 只提供 turn/step 骨架,新行为通过 pre-step 拦截、request waterfall、tool scheduler 等扩展点接入,而不是改 loop 代码本身。",
"nodeIds": [
"file:agent-loop/src/index.ts",
"file:agent-loop/src/agent.ts"
],
"languageLesson": "loop 内大量扩展点是 waterfall--agent/request、pre-step、assemble 等。waterfall listener 必须调用 next() 把控制权下放,returning without next() 会短路整条链;这与同步的 ctx.on() 监听器语义不同,是 Cordis 流水线最容易踩的坑。"
},
{
"order": 4,
"title": "会话日志:event-sourced 的唯一真相源",
"description": "session/src/index.ts 定义 Session 类(event-sourced 日志 + 消息派生缓存)与 SessionStorectx.sessions 内存存储),并 re-export 全部子模块。types.ts 定义 SessionId branded 类型、JsonValue 联合、SESSION_FORMAT_VERSION 常量与 SessionEventMap。这个包强制「model-visible ⟺ logged」:任何到达模型请求的输入都必须能从 session 日志重建,新增 model-visible 输入必须新增一个 session 事件;只有结构性格式变化才 bump SESSION_FORMAT_VERSION,单纯加事件不 bump。",
"nodeIds": [
"file:session/src/index.ts",
"file:session/src/types.ts"
],
"languageLesson": "SessionId 用 Branded<string> 而非裸 string,保证 opaque 跨边界 id 在类型层不可与普通字符串互换--这是 dsh-brand 约定的体现。SessionEventMap 是 merge-extensible:各 plugin 用 declaration merging 向它注入自己的事件键,构建时知道其类型的日志才会被持久化路径接受(除非带 ignorable: true)。"
},
{
"order": 5,
"title": "工具注册表与执行管线",
"description": "tools/src/index.ts 实现 ToolRuntime servicectx.tools),聚合工具注册表、presentation 模式与 pre/guard/around/post/result 执行管线。schema.ts 是 author-facing 的 schema DSL:编译 ValueSchemaSpec/ParameterSchemaSpec 到受控 JSON Schema 子集,并提供 defineTool 类型化工具构造器与 validateArgs 校验。这条管线是「capability seam 完整三角色(Service Definition / Provider / Consumer)」原则的样板:tool 的定义、调度、执行结果分别可在 schema、index、scheduler 中独立演进。",
"nodeIds": [
"file:tools/src/index.ts",
"file:tools/src/schema.ts"
],
"languageLesson": "schema.ts 用受控 JSON Schema 子集而非完整 JSON Schema,并在 parser/config 边界用 json-schema.ts 校验 schema 合法性。这正是「trust TypeScript at typed same-process boundaries」的策略:在边界做一次校验,之后在 typed 同进程边界信任静态类型,不重复 runtime validation。"
},
{
"order": 6,
"title": "系统提示词的有序装配",
"description": "system-prompt/src/index.ts 注册 SystemPrompt servicectx.systemPrompt):有序 section、动态 context、tool schema provider 与 prompt variable,经 scope-filtered waterfall 组装 PromptAssembly 并渲染。它示范了 plugin 如何通过 ctx 上的注册器向多个有序槽位贡献片段,并由 owner 在 assemble 阶段统一折叠--这是「harness 身份」与「工具 schema」进入模型请求的统一入口,也是 tools 包跨包 tested_by 边的下游消费方。",
"nodeIds": [
"file:system-prompt/src/index.ts"
],
"languageLesson": "这里的 assemble 是 scope-filtered waterfallscoped context 注册的 section 会按 scope 父子链参与组装,销毁时随 scope 移除。toolOrder 校验、section 命名唯一性等不变量不在主路径里,而是作为 invariant companion 注册到 ctx.invariants,体现「runtime invariants assert owned relationships, not service presence」的纪律。"
},
{
"order": 7,
"title": "作用域原语:scoped context 的基础",
"description": "scope/src/index.ts 提供 scope 父子链、carrier 识别与 scopeTarget 过滤等核心 API,是各 plugin 共享的上下文作用域基础。agent/src/dispatch.ts 中「fused dispatcher 把 agent subject 与 scope carrier 绑定」的模式正是建立在 scope 之上:scope key 与 payload 的 agent 字段不可分离,让 scoped 派发在热路径零分配。理解 scope 才能理解为什么 system-prompt 的 scoped persona、agent 的 initiator scope、tools 的 scopeTarget 都能优雅地随 scope 销毁而回滚。",
"nodeIds": [
"file:scope/src/index.ts"
],
"languageLesson": "scope 把「上下文打标」做成显式数据结构(carrier WeakMap),而非隐式闭包变量。store.ts 的 NamedEntries/AnonymousEntries/ScopedLayers 三类层,配合 tsdown 把 invariant companion 单独编为不 bundle 的 ESMneverBundle 保留 carrier WeakMap 身份),是「source plane vs artifact plane, never mixed」原则的一个具体例子。"
},
{
"order": 8,
"title": "配置插件:默认模型与工具呈现",
"description": "agent-default-model/src/index.ts 与 agent-tool-presentation/src/index.ts 是两个体量极小的配置插件,示范「plugin 贡献 Config」而非「下沉注册表」的取舍。前者提供 ctx.agentDefaultModel 默认模型选择(关注 KV Cache 对模型体验的影响),后者把工具呈现模式(generic/terminal/diff 等)注入运行时上下文。它们之所以是独立 plugin 而非下沉到 ToolRuntime/AgentLoop,是因为这两个决策点应可从 cordis.yml 替换--这正是「No hardcoded tunables in plugins」原则的正面示范。",
"nodeIds": [
"file:agent-default-model/src/index.ts",
"file:agent-tool-presentation/src/index.ts"
],
"languageLesson": "注意 agent-tool-presentation 的 README 解释「为何采用一行 plugin 而非下沉注册表」--这是 plugin 架构的判断标准:当下沉会绑定具体决策、而该决策应留给部署替换时,就该是独立 plugin。每个 plugin 都带 invariant companion,由 apply 时向 ctx.invariants 注册,体现「runtime invariants assert owned relationships」而非依赖 service 方法存在。"
}
]
+59
View File
@@ -0,0 +1,59 @@
# .understandignore — patterns for files/dirs to exclude from analysis
# Syntax: same as .gitignore (globs, # comments, ! negation, trailing / for dirs)
# Lines below are suggestions — uncomment to activate.
# Use ! prefix to force-include something excluded by defaults.
#
# Built-in defaults (always excluded unless negated):
# node_modules/, .git/, dist/, build/, obj/, *.lock, *.min.js, etc.
#
# --- Test file patterns (uncomment to exclude) ---
# JS / TS
# *.test.*
# *.spec.*
# *.snap
# C# / .NET
# **/*Tests.cs
# **/*Test.cs
# **/*Fixture.cs
# **/*.Tests.csproj
# Java / Kotlin
# **/src/test/**
# **/*Test.java
# **/*IT.java
# **/*Spec.kt
# Go
# **/*_test.go
# C++
# **/*_test.cc
# **/*_test.cpp
# **/*_test.cxx
# **/*Test.cc
# **/*Test.cpp
# **/*_unittest.cc
# **/*_unittest.cpp
# **/*_browsertest.cc
# **/*_benchmark.cc
# **/*Benchmark.cpp
# Python
# **/test_*.py
# **/*_test.py
# **/tests.py
# **/conftest.py
# Rust
# **/tests.rs
# **/test_*.rs
# **/*_test.rs
# **/bench_*.rs
# **/*_bench.rs
# Ruby
# **/*_spec.rb
# **/*_test.rb
# **/test_*.rb
# **/spec_helper.rb
# **/test_helper.rb
# **/rails_helper.rb
# Swift
# **/Tests/**/*.swift
# **/Specs/**/*.swift
+1
View File
@@ -0,0 +1 @@
{"outputLanguage": "zh"}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
{
"lastAnalyzedAt": "2026-08-14T07:23:23.984Z",
"gitCommitHash": "740c3208c546001df26e62f74ccfd2d110609415",
"version": "1.0.0",
"analyzedFiles": 151
}