@oh-my-dsh/auto-team 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -13
- package/README.zh.md +17 -13
- package/lib/index.d.ts +2 -2
- package/lib/index.js +259 -215
- package/package.json +35 -28
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ English | [中文](README.zh.md)
|
|
|
4
4
|
|
|
5
5
|
`@oh-my-dsh/auto-team` is a host-only DeepSeek Harness plugin (Cordis id `auto-team`). It gives long tasks a scored start and a team-shaped run, and it keeps the numeric score out of the model's context.
|
|
6
6
|
|
|
7
|
-
The plugin adds the first-round decision, the goal bridge, and the Lead and worker policy gates.
|
|
7
|
+
The plugin adds the first-round decision, the goal bridge, and the Lead and worker policy gates. Delegation, messaging, and worktree tools come from the host profile. It targets DSH 0.2.2-rc.5 and Node.js 24.9 or later.
|
|
8
8
|
|
|
9
9
|
## How a task runs
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ The Lead calls `auto_team_score` once in the first round. The call takes five fa
|
|
|
12
12
|
|
|
13
13
|
The plugin turns the factors into a weighted score from 0 to 1. The model gets only `team` or `solo`; the score and the effective threshold stay host-side. The default threshold is 0.55. If an active user-created goal already exists at the first score, the threshold is multiplied by 0.6.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
A Lead with no recorded score must score before ending its turn, including after a reset or a resume without a score. An `agent/turn-stopping` listener steers it back with a reminder. After a successful score, `auto_team_score` removes itself; a reset makes the tool available again.
|
|
16
16
|
|
|
17
17
|
The score is frozen for the task. Only a user-triggered `/auto-team-reset` clears it; the next score becomes the new frozen decision. It is written to the session log as a `plugin:auto-team/score` record and folded into the host-only `autoTeam` projection, so resuming a session keeps the decision and does not score again.
|
|
18
18
|
|
|
@@ -32,12 +32,16 @@ On a solo decision the task runs as a normal single-agent task.
|
|
|
32
32
|
|
|
33
33
|
The profile must compose these host services:
|
|
34
34
|
|
|
35
|
-
- `
|
|
36
|
-
- `
|
|
35
|
+
- `sessionProjections` from `@deepseek-ai/dsh-session-projection` (required injection)
|
|
36
|
+
- `agents`, `tools`, `systemPrompt`
|
|
37
|
+
- `subagents` from `@deepseek-ai/dsh-subagent`, with the `spawn` provider (or the configured reporting provider)
|
|
37
38
|
- `goals` from `@deepseek-ai/dsh-goal`
|
|
38
|
-
- `commands` (optional; enables `/auto-team-reset`)
|
|
39
|
+
- `commands` from `@deepseek-ai/dsh-commands` (optional; enables `/auto-team-reset`)
|
|
40
|
+
- `create_worktree` from `@deepseek-ai/dsh-experimental-tool-worktree` (required for execution agents to pass the edit guard)
|
|
39
41
|
|
|
40
|
-
The plugin
|
|
42
|
+
Cordis waits for `sessionProjections` before activation. The plugin awaits its projection registration before restoring scores or exposing the scoring tool and stop guard. If the other host services are absent, it logs a warning and waits; an `internal/service` listener retries installation when they arrive. The `commands` service is optional: without it the score tool still works and `/auto-team-reset` is not registered.
|
|
43
|
+
|
|
44
|
+
The plugin uses the host’s `subagents` service instead of experimental Agent Teams: `rootOf`/`namesOf` for membership, `listDescendants` for reporter discovery, and `startActivation` for creation. Child guards install at `subagent/start`, after runtime ownership is published, rather than during the earlier `agent/created` notification. The old Agent Teams task-board tools are no longer a prerequisite.
|
|
41
45
|
|
|
42
46
|
## Install
|
|
43
47
|
|
|
@@ -60,7 +64,7 @@ dsh plugin --profile <profile> add @oh-my-dsh/auto-team
|
|
|
60
64
|
Or install a locally packed tarball:
|
|
61
65
|
|
|
62
66
|
```sh
|
|
63
|
-
dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.
|
|
67
|
+
dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.5.tgz
|
|
64
68
|
```
|
|
65
69
|
|
|
66
70
|
The package name is `@oh-my-dsh/auto-team`, published under the `@oh-my-dsh` scope.
|
|
@@ -75,7 +79,7 @@ Every field is optional. Schemastery checks the values at load; invalid values f
|
|
|
75
79
|
| `threshold` | `0.55` | Base score needed for Team mode. |
|
|
76
80
|
| `manualGoalFactor` | `0.6` | Multiplier applied to the threshold when a user-created goal exists. |
|
|
77
81
|
| `weights` | scope 0.3, parallelism 0.25, ambiguity 0.15, risk 0.15, expectedSteps 0.15 | Relative weight of each difficulty factor. |
|
|
78
|
-
| `reportingAgentName` | `reporter` |
|
|
82
|
+
| `reportingAgentName` | `reporter` | Reporting agent name: 1–32 lower-kebab-case characters, other than `lead`. |
|
|
79
83
|
| `reportingProvider` | `spawn` | Subagent provider used for the reporter. |
|
|
80
84
|
| `goalMaxRounds` | `256` | Round cap used when the plugin starts a goal. |
|
|
81
85
|
| `enforceLeadNoCode` | `true` | Install the Lead write/edit gate. |
|
|
@@ -96,7 +100,7 @@ The package adds one model-facing tool.
|
|
|
96
100
|
| `expected_steps` | integer 1 to 5 | Expected task length. |
|
|
97
101
|
| `objective` | string | The task goal in its ordinary meaning. Used only when the plugin starts a goal. |
|
|
98
102
|
|
|
99
|
-
It returns `{ decision, goal, reporter? }`. The numeric score and threshold are not in the result. The host's
|
|
103
|
+
It returns `{ decision, goal, reporter? }`. The numeric score and threshold are not in the result. The host's subagent tools handle delegation and messaging. The host goal lifecycle handles completion and continuation.
|
|
100
104
|
|
|
101
105
|
## Commands
|
|
102
106
|
|
|
@@ -104,15 +108,15 @@ When the profile provides the host `commands` service, the plugin registers `aut
|
|
|
104
108
|
|
|
105
109
|
- `/auto-team-reset` clears the frozen score for the current session.
|
|
106
110
|
- It appends a `plugin:auto-team/reset` record, so resuming the session does not restore the cleared score.
|
|
107
|
-
- It is silent by default
|
|
111
|
+
- It is silent by default and re-enables `auto_team_score`. Any text after the command is sent to the Lead as a user message. The next turn cannot end without a new score; a bare reset does not itself start a turn. The current goal and reporter stay in place.
|
|
108
112
|
- The command is user-triggered; the model cannot invoke it.
|
|
109
113
|
|
|
110
114
|
## Guards and limits
|
|
111
115
|
|
|
112
116
|
- The Lead gate is a tool-name policy, not a sandbox. `pwsh`, `run_code`, and direct filesystem effects can bypass it. The policy tells the Lead not to use them as a workaround.
|
|
113
117
|
- The worker gate checks that a `create_worktree` call succeeded and, when the host returns the worktree path, that each `write` or `edit` uses an absolute `file_path` inside it. If the host result has no path, the gate falls back to checking only that the call succeeded.
|
|
114
|
-
- The reporter is spawned with the configured provider.
|
|
115
|
-
-
|
|
118
|
+
- The reporter is spawned with the configured local, continuable provider. Its initial activation uses `delivery: 'caller'`: read and continue its replies in its own subagent conversation, without asking the Lead to relay them. DSH does not persist that result-delivery policy across cold resumes; a resumed activation may also notify its parent. If spawning fails, the score stays frozen and a later call retries the reporter.
|
|
119
|
+
- An isolated DSH 0.2.2-rc.5 `headless` profile smoke test installed the packed plugin and verified activation, host-only scoring, one-shot tool removal, and silent reset without calling a model. It did not exercise reporter conversations or worker worktrees in a live profile.
|
|
116
120
|
|
|
117
121
|
## Development
|
|
118
122
|
|
|
@@ -124,7 +128,7 @@ pnpm run build
|
|
|
124
128
|
pnpm pack --dry-run --json
|
|
125
129
|
```
|
|
126
130
|
|
|
127
|
-
The tests cover the scoring policy, configuration, goal and reporter orchestration, the durable score projection and reset, the reset command, the runtime install path, and the Loader export shape.
|
|
131
|
+
The tests cover the scoring policy, configuration, goal and reporter orchestration, the durable score projection and reset, the reset command, the runtime install path, and the Loader export shape. A real DSH 0.2.2-rc.5 projection-registry test also checks awaited handles, host-only visibility, replay, and fiber disposal.
|
|
128
132
|
|
|
129
133
|
Read [the design note](docs/auto-team-design.md) for the behavior and the flow chart, and [the plugin contracts](docs/dsh-plugin-contracts.md) for the package rules.
|
|
130
134
|
|
package/README.zh.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
`@oh-my-dsh/auto-team` 是一个只跑在宿主侧的 DeepSeek Harness 插件,Cordis id 为 `auto-team`。它给长任务一个带评分的起点和团队式的执行方式,同时把具体分数留在模型上下文之外。
|
|
6
6
|
|
|
7
|
-
插件负责首轮判断、goal 桥接,以及 Lead 和执行 Agent
|
|
7
|
+
插件负责首轮判断、goal 桥接,以及 Lead 和执行 Agent 的策略闸门。委派、消息和 worktree 工具由宿主 profile 提供。目标版本是 DSH 0.2.2-rc.5,需要 Node.js 24.9 或更高版本。
|
|
8
8
|
|
|
9
9
|
## 任务怎么跑
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
插件把因子折算成 0 到 1 的加权分数。模型只拿到 `team` 或 `solo`,分数和实际阈值都留在宿主侧。默认阈值是 0.55。如果第一次打分时已经存在有效的用户触发 goal,阈值乘以 0.6。
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Lead 没有分数时就必须在结束本轮前打分,包括 reset 后或 resume 时没有分数的情况。`agent/turn-stopping` 监听器会把它拉回来,再发一次提醒。成功打分后,`auto_team_score` 会注销自身;reset 后工具重新出现。
|
|
16
16
|
|
|
17
17
|
分数在任务内冻结。只有用户主动执行 `/auto-team-reset` 才能清空;下一次打分成为新的冻结决定。它以 `plugin:auto-team/score` 记录写进 session log,并折进宿主侧的 `autoTeam` 投影。resume 时恢复这个决定,不会重新打分。
|
|
18
18
|
|
|
@@ -32,12 +32,16 @@
|
|
|
32
32
|
|
|
33
33
|
profile 需要组合这些宿主服务:
|
|
34
34
|
|
|
35
|
-
- `
|
|
36
|
-
- `
|
|
35
|
+
- `sessionProjections`,来自 `@deepseek-ai/dsh-session-projection`(必需注入)
|
|
36
|
+
- `agents`、`tools`、`systemPrompt`
|
|
37
|
+
- `subagents`,来自 `@deepseek-ai/dsh-subagent`,并提供 `spawn` 或配置指定的汇报 provider
|
|
37
38
|
- `goals`,来自 `@deepseek-ai/dsh-goal`
|
|
38
|
-
- `commands`(可选;启用 `/auto-team-reset`)
|
|
39
|
+
- `commands`,来自 `@deepseek-ai/dsh-commands`(可选;启用 `/auto-team-reset`)
|
|
40
|
+
- `create_worktree`,来自 `@deepseek-ai/dsh-experimental-tool-worktree`(执行 Agent 通过编辑闸门所需)
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
Cordis 会等待 `sessionProjections` 到位才激活插件。插件先等待投影注册完成,再恢复分数、开放评分工具和停止守卫。其他宿主服务缺失时会打一条警告并等待;服务到位后,`internal/service` 监听器会重试安装。`commands` 服务是可选的:没有它,打分工具照常工作,但不会注册 `/auto-team-reset`。
|
|
43
|
+
|
|
44
|
+
插件使用宿主的 `subagents` 服务,不再依赖实验性的 Agent Teams:用 `rootOf`/`namesOf` 识别成员,用 `listDescendants` 查找汇报 Agent,用 `startActivation` 创建。执行 Agent 的守卫在运行时归属已发布的 `subagent/start` 安装,不在更早的 `agent/created` 中读取成员身份。旧 Agent Teams 任务板工具不再是前置依赖。
|
|
41
45
|
|
|
42
46
|
## 安装
|
|
43
47
|
|
|
@@ -60,7 +64,7 @@ dsh plugin --profile <profile> add @oh-my-dsh/auto-team
|
|
|
60
64
|
或者安装本地打包的 tarball:
|
|
61
65
|
|
|
62
66
|
```sh
|
|
63
|
-
dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.
|
|
67
|
+
dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.5.tgz
|
|
64
68
|
```
|
|
65
69
|
|
|
66
70
|
包名是 `@oh-my-dsh/auto-team`,发布在 `@oh-my-dsh` scope 下。
|
|
@@ -75,7 +79,7 @@ dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.3.tgz
|
|
|
75
79
|
| `threshold` | `0.55` | 进入团队模式的基础分数。 |
|
|
76
80
|
| `manualGoalFactor` | `0.6` | 已有用户触发 goal 时,阈值的乘数。 |
|
|
77
81
|
| `weights` | scope 0.3、parallelism 0.25、ambiguity 0.15、risk 0.15、expectedSteps 0.15 | 各难度因子的相对权重。 |
|
|
78
|
-
| `reportingAgentName` | `reporter` | 汇报 Agent
|
|
82
|
+
| `reportingAgentName` | `reporter` | 汇报 Agent 名字:1–32 个小写字母、数字或连字符,以字母开头,不能为 `lead`。 |
|
|
79
83
|
| `reportingProvider` | `spawn` | 创建汇报 Agent 时用的子 Agent provider。 |
|
|
80
84
|
| `goalMaxRounds` | `256` | 插件启动 goal 时使用的轮次上限。 |
|
|
81
85
|
| `enforceLeadNoCode` | `true` | 是否安装 Lead 的写文件闸门。 |
|
|
@@ -96,7 +100,7 @@ dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.3.tgz
|
|
|
96
100
|
| `expected_steps` | 1 到 5 的整数 | 预计任务有多长。 |
|
|
97
101
|
| `objective` | 字符串 | 任务在通常语义上的目标。只在插件启动 goal 时使用。 |
|
|
98
102
|
|
|
99
|
-
返回 `{ decision, goal, reporter? }
|
|
103
|
+
返回 `{ decision, goal, reporter? }`。分数和阈值不在返回里。委派和消息由宿主的 subagent 工具负责;完成和续跑由宿主的 goal 生命周期负责。
|
|
100
104
|
|
|
101
105
|
## 命令
|
|
102
106
|
|
|
@@ -104,15 +108,15 @@ profile 提供宿主 `commands` 服务时,插件注册 `auto-team-reset`:
|
|
|
104
108
|
|
|
105
109
|
- `/auto-team-reset` 清空当前 session 的冻结分数。
|
|
106
110
|
- 它写入 `plugin:auto-team/reset` 记录,resume 时不会恢复被清掉的分数。
|
|
107
|
-
-
|
|
111
|
+
- 它默认静默,并重新开放 `auto_team_score`;命令后附带的文字会作为用户消息发给 Lead。下一轮没有新分数就不能结束,但仅执行裸 reset 不会主动启动一轮。当前 goal 和汇报 Agent 保留。
|
|
108
112
|
- 命令由用户触发,模型不能调用。
|
|
109
113
|
|
|
110
114
|
## 闸门与限制
|
|
111
115
|
|
|
112
116
|
- Lead 的闸门是工具名策略,不是沙箱。`pwsh`、`run_code` 和直接的文件系统操作可以绕过。策略文本会明确要求 Lead 不要拿它们绕路。
|
|
113
117
|
- 执行 Agent 的闸门会检查 `create_worktree` 是否成功;宿主返回 worktree 路径时,还会要求每次 `write`/`edit` 的 `file_path` 是该路径内的绝对路径。宿主结果没有路径时,只检查成功。
|
|
114
|
-
- 汇报 Agent
|
|
115
|
-
-
|
|
118
|
+
- 汇报 Agent 使用配置的本地、可续接 provider 创建。首次 activation 采用 `delivery: 'caller'`:用户直接在它自己的子会话里阅读和继续对话,不需要 Lead 转述。DSH 不会跨冷恢复持久化这项结果投递策略;冷恢复后的一轮可能同时通知父 Agent。创建失败时,分数仍保持冻结,后续调用会重试创建。
|
|
119
|
+
- 已在隔离的 DSH 0.2.2-rc.5 `headless` profile 安装打包产物,不调用模型,验证了插件激活、评分仅在宿主侧可见、评分后工具注销和静默 reset。此次实测未覆盖汇报 Agent 的对话或执行 Agent 的 worktree。
|
|
116
120
|
|
|
117
121
|
## 开发
|
|
118
122
|
|
|
@@ -124,7 +128,7 @@ pnpm run build
|
|
|
124
128
|
pnpm pack --dry-run --json
|
|
125
129
|
```
|
|
126
130
|
|
|
127
|
-
测试覆盖评分策略、配置、goal 与汇报 Agent 编排、持久化分数投影与重设、重设命令、运行时安装路径,以及 Loader
|
|
131
|
+
测试覆盖评分策略、配置、goal 与汇报 Agent 编排、持久化分数投影与重设、重设命令、运行时安装路径,以及 Loader 导出形状。另用 DSH 0.2.2-rc.5 的真实投影注册表验证异步句柄、宿主侧可见性、重放和 fiber 清理。
|
|
128
132
|
|
|
129
133
|
行为说明和流程图见[设计文档](docs/auto-team-design.md),包规则见[插件契约](docs/dsh-plugin-contracts.md)。
|
|
130
134
|
|
package/lib/index.d.ts
CHANGED
|
@@ -68,8 +68,8 @@ interface PluginRuntime {
|
|
|
68
68
|
info: (message: string) => void;
|
|
69
69
|
warn: (message: string) => void;
|
|
70
70
|
}
|
|
71
|
-
/** Apply auto-team
|
|
72
|
-
declare function apply(ctx: Context, config: PluginConfig): void
|
|
71
|
+
/** Apply auto-team after its host-only score projection is ready. */
|
|
72
|
+
declare function apply(ctx: Context, config: PluginConfig): Promise<void>;
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/index.d.ts
|
|
75
75
|
/**
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import schema from "@deepseek-ai/schemastery";
|
|
2
2
|
import { createMessage } from "@deepseek-ai/dsh-llm";
|
|
3
|
+
import { SubagentError } from "@deepseek-ai/dsh-subagent";
|
|
3
4
|
import { appendPluginRecord, pluginRecordOf } from "@deepseek-ai/dsh-session";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
@@ -76,7 +77,7 @@ const DEFAULT_REPORTING_PROVIDER = "spawn";
|
|
|
76
77
|
const DEFAULT_GOAL_MAX_ROUNDS = 256;
|
|
77
78
|
const DEFAULT_ENFORCE_LEAD_NO_CODE = true;
|
|
78
79
|
const DEFAULT_LEAD_DENIED_TOOLS = ["write", "edit"];
|
|
79
|
-
const REPORTER_NAME_PATTERN = /^[a-z][a-z0-9-]
|
|
80
|
+
const REPORTER_NAME_PATTERN = /^[a-z][a-z0-9-]{0,31}$/u;
|
|
80
81
|
const UNIT_RANGE = {
|
|
81
82
|
min: 0,
|
|
82
83
|
max: 1
|
|
@@ -119,7 +120,7 @@ function resolveWeights(config) {
|
|
|
119
120
|
/** Resolve and validate the reporting teammate name. */
|
|
120
121
|
function resolveReportingAgentName(config) {
|
|
121
122
|
const name = config.reportingAgentName ?? DEFAULT_REPORTING_AGENT_NAME;
|
|
122
|
-
if (!REPORTER_NAME_PATTERN.test(name) || name === "lead") throw new TypeError("reportingAgentName must be lower-kebab-case and must not be \"lead\"");
|
|
123
|
+
if (!REPORTER_NAME_PATTERN.test(name) || name === "lead") throw new TypeError("reportingAgentName must be 1–32 lower-kebab-case characters and must not be \"lead\"");
|
|
123
124
|
return name;
|
|
124
125
|
}
|
|
125
126
|
/** Resolve and validate the goal round cap. */
|
|
@@ -173,10 +174,8 @@ function applyAutoTeamProjection(state, event) {
|
|
|
173
174
|
if (record === void 0) return state;
|
|
174
175
|
if (record.type === RESET_RECORD_TYPE) {
|
|
175
176
|
if (state.score === void 0) return state;
|
|
176
|
-
return {
|
|
177
|
-
|
|
178
|
-
score: void 0
|
|
179
|
-
};
|
|
177
|
+
if (state.failure === void 0) return {};
|
|
178
|
+
return { failure: state.failure };
|
|
180
179
|
}
|
|
181
180
|
if (record.type !== SCORE_RECORD_TYPE) return state;
|
|
182
181
|
if (state.score !== void 0) return state;
|
|
@@ -205,8 +204,8 @@ const autoTeamProjectionDefinition = {
|
|
|
205
204
|
*
|
|
206
205
|
* @module @oh-my-dsh/auto-team/prompt
|
|
207
206
|
*/
|
|
208
|
-
/**
|
|
209
|
-
const
|
|
207
|
+
/** Steering text used whenever no score is recorded, including after a reset. */
|
|
208
|
+
const NO_SCORE_STEER_TEXT = `Auto Team: no score is recorded. Call auto_team_score now with the current task's difficulty factors and objective; the turn stays open until the decision is recorded.`;
|
|
210
209
|
/** System prompt section that states the Lead's auto-team obligations. */
|
|
211
210
|
function policyText(reportingAgentName, leadDeniedTools) {
|
|
212
211
|
return `Auto Team policy
|
|
@@ -233,149 +232,15 @@ function reporterPrompt() {
|
|
|
233
232
|
|
|
234
233
|
Each turn ends after one update or one answer.
|
|
235
234
|
|
|
236
|
-
- Status update: read list_agents
|
|
235
|
+
- Status update: read list_agents once, then write one concise update for the user covering what changed, what is blocked, and what the user needs to decide.
|
|
237
236
|
- Detail question: answer the user's question directly.
|
|
238
237
|
|
|
239
238
|
Write the result in your reply to the user. Then end the turn and wait for the user's next message. Your work is status, questions, and coordination; code changes belong to execution agents.`;
|
|
240
239
|
}
|
|
241
240
|
//#endregion
|
|
242
|
-
//#region src/tool.ts
|
|
243
|
-
/**
|
|
244
|
-
* Model-facing scoring tool. The numeric score and threshold are never part of
|
|
245
|
-
* the tool result.
|
|
246
|
-
*
|
|
247
|
-
* @module @oh-my-dsh/auto-team/tool
|
|
248
|
-
*/
|
|
249
|
-
/** Build the one-shot scoring tool for a Lead agent scope. */
|
|
250
|
-
function scoreTool(autoTeam, onScored) {
|
|
251
|
-
return defineTool({
|
|
252
|
-
name: "auto_team_score",
|
|
253
|
-
description: "Record the assessment. Call when no decision exists.",
|
|
254
|
-
parameters: {
|
|
255
|
-
scope: {
|
|
256
|
-
type: "integer",
|
|
257
|
-
required: true,
|
|
258
|
-
enum: [
|
|
259
|
-
1,
|
|
260
|
-
2,
|
|
261
|
-
3,
|
|
262
|
-
4,
|
|
263
|
-
5
|
|
264
|
-
],
|
|
265
|
-
description: "Expected change scope, from 1 low to 5 high."
|
|
266
|
-
},
|
|
267
|
-
parallelism: {
|
|
268
|
-
type: "integer",
|
|
269
|
-
required: true,
|
|
270
|
-
enum: [
|
|
271
|
-
1,
|
|
272
|
-
2,
|
|
273
|
-
3,
|
|
274
|
-
4,
|
|
275
|
-
5
|
|
276
|
-
],
|
|
277
|
-
description: "How much independent work can run in parallel, from 1 low to 5 high."
|
|
278
|
-
},
|
|
279
|
-
ambiguity: {
|
|
280
|
-
type: "integer",
|
|
281
|
-
required: true,
|
|
282
|
-
enum: [
|
|
283
|
-
1,
|
|
284
|
-
2,
|
|
285
|
-
3,
|
|
286
|
-
4,
|
|
287
|
-
5
|
|
288
|
-
],
|
|
289
|
-
description: "How much requirements or design uncertainty remains, from 1 low to 5 high."
|
|
290
|
-
},
|
|
291
|
-
risk: {
|
|
292
|
-
type: "integer",
|
|
293
|
-
required: true,
|
|
294
|
-
enum: [
|
|
295
|
-
1,
|
|
296
|
-
2,
|
|
297
|
-
3,
|
|
298
|
-
4,
|
|
299
|
-
5
|
|
300
|
-
],
|
|
301
|
-
description: "How costly a wrong change would be, from 1 low to 5 high."
|
|
302
|
-
},
|
|
303
|
-
expected_steps: {
|
|
304
|
-
type: "integer",
|
|
305
|
-
required: true,
|
|
306
|
-
enum: [
|
|
307
|
-
1,
|
|
308
|
-
2,
|
|
309
|
-
3,
|
|
310
|
-
4,
|
|
311
|
-
5
|
|
312
|
-
],
|
|
313
|
-
description: "Expected length of the task, from 1 short to 5 long."
|
|
314
|
-
},
|
|
315
|
-
objective: {
|
|
316
|
-
type: "string",
|
|
317
|
-
required: true,
|
|
318
|
-
description: "The task goal in its ordinary, universal meaning. Used only when auto-team starts a goal."
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
output: {
|
|
322
|
-
schema: {
|
|
323
|
-
type: "object",
|
|
324
|
-
additionalProperties: false,
|
|
325
|
-
properties: {
|
|
326
|
-
decision: {
|
|
327
|
-
type: "string",
|
|
328
|
-
required: true,
|
|
329
|
-
enum: ["team", "solo"]
|
|
330
|
-
},
|
|
331
|
-
goal: {
|
|
332
|
-
type: "string",
|
|
333
|
-
required: true,
|
|
334
|
-
enum: [
|
|
335
|
-
"started",
|
|
336
|
-
"reused",
|
|
337
|
-
"none"
|
|
338
|
-
]
|
|
339
|
-
},
|
|
340
|
-
reporter: { type: "string" }
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
render: (_args, value) => [{
|
|
344
|
-
type: "text",
|
|
345
|
-
text: JSON.stringify(value)
|
|
346
|
-
}]
|
|
347
|
-
},
|
|
348
|
-
async execute(args, exec) {
|
|
349
|
-
const { agent } = exec;
|
|
350
|
-
if (agent === void 0) throw new Error("auto_team_score requires a calling Agent");
|
|
351
|
-
const result = await autoTeam.score(agent, {
|
|
352
|
-
assessment: {
|
|
353
|
-
scope: args.scope,
|
|
354
|
-
parallelism: args.parallelism,
|
|
355
|
-
ambiguity: args.ambiguity,
|
|
356
|
-
risk: args.risk,
|
|
357
|
-
expectedSteps: args.expected_steps
|
|
358
|
-
},
|
|
359
|
-
objective: args.objective,
|
|
360
|
-
signal: exec.signal
|
|
361
|
-
});
|
|
362
|
-
onScored?.();
|
|
363
|
-
return result;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
function registerScoreTool(tools, autoTeam) {
|
|
368
|
-
const holder = { dispose: () => void 0 };
|
|
369
|
-
const dispose = () => {
|
|
370
|
-
holder.dispose();
|
|
371
|
-
};
|
|
372
|
-
holder.dispose = tools.register(scoreTool(autoTeam, dispose));
|
|
373
|
-
return holder.dispose;
|
|
374
|
-
}
|
|
375
|
-
//#endregion
|
|
376
241
|
//#region src/reset-command.ts
|
|
377
242
|
/** Build the user-facing score reset command. */
|
|
378
|
-
function createResetCommand(autoTeam) {
|
|
243
|
+
function createResetCommand(autoTeam, registerTool) {
|
|
379
244
|
return {
|
|
380
245
|
name: "auto-team-reset",
|
|
381
246
|
description: "Clear the frozen Auto Team score for this session.",
|
|
@@ -385,7 +250,7 @@ function createResetCommand(autoTeam) {
|
|
|
385
250
|
text: "No frozen Auto Team score exists in this session."
|
|
386
251
|
};
|
|
387
252
|
autoTeam.reset(invocation.agent);
|
|
388
|
-
|
|
253
|
+
registerTool(invocation.agent);
|
|
389
254
|
const message = invocation.rawInput.trim();
|
|
390
255
|
if (message.length > 0) invocation.agent.steer(createMessage({
|
|
391
256
|
role: "user",
|
|
@@ -497,7 +362,9 @@ var AutoTeam = class {
|
|
|
497
362
|
/** Reuse an existing reporting teammate or spawn one. */
|
|
498
363
|
async ensureReporter(agent, signal) {
|
|
499
364
|
const name = this.config.reportingAgentName;
|
|
500
|
-
const
|
|
365
|
+
const members = await this.deps.team.listMembers(agent, signal);
|
|
366
|
+
signal.throwIfAborted();
|
|
367
|
+
const existing = members.find((member) => member.name === name);
|
|
501
368
|
if (existing !== void 0) return existing.name;
|
|
502
369
|
return (await this.deps.team.spawnReporter(agent, {
|
|
503
370
|
name,
|
|
@@ -516,37 +383,78 @@ function goalService(ctx) {
|
|
|
516
383
|
if (service === void 0) throw new Error("auto-team: goals service is unavailable");
|
|
517
384
|
return service;
|
|
518
385
|
}
|
|
519
|
-
/** Read the
|
|
386
|
+
/** Read the subagent service without assuming profile load order. */
|
|
520
387
|
function teamService(ctx) {
|
|
521
|
-
const service = ctx.get("
|
|
522
|
-
if (service === void 0) throw new Error("auto-team:
|
|
388
|
+
const service = ctx.get("subagents");
|
|
389
|
+
if (service === void 0) throw new Error("auto-team: subagents service is unavailable");
|
|
523
390
|
return service;
|
|
524
391
|
}
|
|
392
|
+
/** Observe detached completion without waking or injecting the Lead. */
|
|
393
|
+
async function observeReporter(ctx, activation) {
|
|
394
|
+
try {
|
|
395
|
+
await activation.result;
|
|
396
|
+
} catch (error) {
|
|
397
|
+
ctx.logger.warn("auto-team: reporter activation failed", error);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/** Start a fresh local reporter; its own Session is the user's conversation. */
|
|
401
|
+
async function spawnReporter(ctx, agent, request) {
|
|
402
|
+
const service = teamService(ctx);
|
|
403
|
+
const provider = service.getProvider(request.provider);
|
|
404
|
+
if (provider?.prepareContinuable === void 0 || provider.inheritsParentContext) throw new Error("auto-team: reporter requires a fresh local subagent provider");
|
|
405
|
+
const signal = AbortSignal.any([request.signal, request.lifetime]);
|
|
406
|
+
signal.throwIfAborted();
|
|
407
|
+
const activation = await service.startActivation({
|
|
408
|
+
parent: agent,
|
|
409
|
+
provider: request.provider,
|
|
410
|
+
name: request.name,
|
|
411
|
+
label: request.description,
|
|
412
|
+
prompt: [{
|
|
413
|
+
type: "text",
|
|
414
|
+
text: request.prompt
|
|
415
|
+
}],
|
|
416
|
+
delivery: "caller",
|
|
417
|
+
signal
|
|
418
|
+
});
|
|
419
|
+
observeReporter(ctx, activation);
|
|
420
|
+
try {
|
|
421
|
+
request.lifetime.throwIfAborted();
|
|
422
|
+
ctx.effect(() => async () => {
|
|
423
|
+
await activation.dispose();
|
|
424
|
+
}, "auto-team.reporter()");
|
|
425
|
+
} catch (error) {
|
|
426
|
+
await activation.dispose();
|
|
427
|
+
throw error;
|
|
428
|
+
}
|
|
429
|
+
return { name: request.name };
|
|
430
|
+
}
|
|
525
431
|
/** Build the goal, team, and durable score ports from Cordis services. */
|
|
526
|
-
function createAutoTeam(ctx, config) {
|
|
432
|
+
function createAutoTeam(ctx, config, projection) {
|
|
433
|
+
const lifetime = new AbortController();
|
|
434
|
+
ctx.effect(() => () => {
|
|
435
|
+
lifetime.abort();
|
|
436
|
+
}, "auto-team.reporter-startup()");
|
|
527
437
|
return new AutoTeam({
|
|
528
438
|
goals: {
|
|
529
439
|
get: (agent) => goalService(ctx).get(agent),
|
|
530
440
|
create: (agent, request) => goalService(ctx).create(agent, request)
|
|
531
441
|
},
|
|
532
442
|
team: {
|
|
533
|
-
listMembers: (agent) =>
|
|
443
|
+
listMembers: async (agent, signal) => {
|
|
444
|
+
return (await teamService(ctx).listDescendants(agent.id, signal)).flatMap((entry) => {
|
|
445
|
+
if (entry.kind !== "child" || entry.parentId !== agent.id || entry.mode !== "continuable" || entry.name === void 0) return [];
|
|
446
|
+
return [{ name: entry.name }];
|
|
447
|
+
});
|
|
448
|
+
},
|
|
534
449
|
spawnReporter: async (agent, request) => {
|
|
535
|
-
return
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
type: "text",
|
|
540
|
-
text: request.prompt
|
|
541
|
-
}],
|
|
542
|
-
context: "fresh",
|
|
543
|
-
provider: request.provider,
|
|
544
|
-
signal: request.signal
|
|
545
|
-
})).member.name };
|
|
450
|
+
return await spawnReporter(ctx, agent, {
|
|
451
|
+
...request,
|
|
452
|
+
lifetime: lifetime.signal
|
|
453
|
+
});
|
|
546
454
|
}
|
|
547
455
|
},
|
|
548
456
|
store: {
|
|
549
|
-
read: (agent) =>
|
|
457
|
+
read: (agent) => projection.stateOf(agent.session).score,
|
|
550
458
|
write: (agent, record) => {
|
|
551
459
|
appendPluginRecord(agent.session, "plugin:auto-team/score", record);
|
|
552
460
|
},
|
|
@@ -557,6 +465,140 @@ function createAutoTeam(ctx, config) {
|
|
|
557
465
|
}, config);
|
|
558
466
|
}
|
|
559
467
|
//#endregion
|
|
468
|
+
//#region src/tool.ts
|
|
469
|
+
/**
|
|
470
|
+
* Model-facing scoring tool. The numeric score and threshold are never part of
|
|
471
|
+
* the tool result.
|
|
472
|
+
*
|
|
473
|
+
* @module @oh-my-dsh/auto-team/tool
|
|
474
|
+
*/
|
|
475
|
+
/** Build the one-shot scoring tool for a Lead agent scope. */
|
|
476
|
+
function scoreTool(autoTeam, onScored) {
|
|
477
|
+
return defineTool({
|
|
478
|
+
name: "auto_team_score",
|
|
479
|
+
description: "Record the assessment. Call when no decision exists.",
|
|
480
|
+
parameters: {
|
|
481
|
+
scope: {
|
|
482
|
+
type: "integer",
|
|
483
|
+
required: true,
|
|
484
|
+
enum: [
|
|
485
|
+
1,
|
|
486
|
+
2,
|
|
487
|
+
3,
|
|
488
|
+
4,
|
|
489
|
+
5
|
|
490
|
+
],
|
|
491
|
+
description: "Expected change scope, from 1 low to 5 high."
|
|
492
|
+
},
|
|
493
|
+
parallelism: {
|
|
494
|
+
type: "integer",
|
|
495
|
+
required: true,
|
|
496
|
+
enum: [
|
|
497
|
+
1,
|
|
498
|
+
2,
|
|
499
|
+
3,
|
|
500
|
+
4,
|
|
501
|
+
5
|
|
502
|
+
],
|
|
503
|
+
description: "How much independent work can run in parallel, from 1 low to 5 high."
|
|
504
|
+
},
|
|
505
|
+
ambiguity: {
|
|
506
|
+
type: "integer",
|
|
507
|
+
required: true,
|
|
508
|
+
enum: [
|
|
509
|
+
1,
|
|
510
|
+
2,
|
|
511
|
+
3,
|
|
512
|
+
4,
|
|
513
|
+
5
|
|
514
|
+
],
|
|
515
|
+
description: "How much requirements or design uncertainty remains, from 1 low to 5 high."
|
|
516
|
+
},
|
|
517
|
+
risk: {
|
|
518
|
+
type: "integer",
|
|
519
|
+
required: true,
|
|
520
|
+
enum: [
|
|
521
|
+
1,
|
|
522
|
+
2,
|
|
523
|
+
3,
|
|
524
|
+
4,
|
|
525
|
+
5
|
|
526
|
+
],
|
|
527
|
+
description: "How costly a wrong change would be, from 1 low to 5 high."
|
|
528
|
+
},
|
|
529
|
+
expected_steps: {
|
|
530
|
+
type: "integer",
|
|
531
|
+
required: true,
|
|
532
|
+
enum: [
|
|
533
|
+
1,
|
|
534
|
+
2,
|
|
535
|
+
3,
|
|
536
|
+
4,
|
|
537
|
+
5
|
|
538
|
+
],
|
|
539
|
+
description: "Expected length of the task, from 1 short to 5 long."
|
|
540
|
+
},
|
|
541
|
+
objective: {
|
|
542
|
+
type: "string",
|
|
543
|
+
required: true,
|
|
544
|
+
description: "The task goal in its ordinary, universal meaning. Used only when auto-team starts a goal."
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
output: {
|
|
548
|
+
schema: {
|
|
549
|
+
type: "object",
|
|
550
|
+
additionalProperties: false,
|
|
551
|
+
properties: {
|
|
552
|
+
decision: {
|
|
553
|
+
type: "string",
|
|
554
|
+
required: true,
|
|
555
|
+
enum: ["team", "solo"]
|
|
556
|
+
},
|
|
557
|
+
goal: {
|
|
558
|
+
type: "string",
|
|
559
|
+
required: true,
|
|
560
|
+
enum: [
|
|
561
|
+
"started",
|
|
562
|
+
"reused",
|
|
563
|
+
"none"
|
|
564
|
+
]
|
|
565
|
+
},
|
|
566
|
+
reporter: { type: "string" }
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
render: (_args, value) => [{
|
|
570
|
+
type: "text",
|
|
571
|
+
text: JSON.stringify(value)
|
|
572
|
+
}]
|
|
573
|
+
},
|
|
574
|
+
async execute(args, exec) {
|
|
575
|
+
const { agent } = exec;
|
|
576
|
+
if (agent === void 0) throw new Error("auto_team_score requires a calling Agent");
|
|
577
|
+
const result = await autoTeam.score(agent, {
|
|
578
|
+
assessment: {
|
|
579
|
+
scope: args.scope,
|
|
580
|
+
parallelism: args.parallelism,
|
|
581
|
+
ambiguity: args.ambiguity,
|
|
582
|
+
risk: args.risk,
|
|
583
|
+
expectedSteps: args.expected_steps
|
|
584
|
+
},
|
|
585
|
+
objective: args.objective,
|
|
586
|
+
signal: exec.signal
|
|
587
|
+
});
|
|
588
|
+
onScored?.();
|
|
589
|
+
return result;
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
function registerScoreTool(tools, autoTeam) {
|
|
594
|
+
const holder = { dispose: () => void 0 };
|
|
595
|
+
const dispose = () => {
|
|
596
|
+
holder.dispose();
|
|
597
|
+
};
|
|
598
|
+
holder.dispose = tools.register(scoreTool(autoTeam, dispose));
|
|
599
|
+
return holder.dispose;
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
560
602
|
//#region src/worker-guard.ts
|
|
561
603
|
/**
|
|
562
604
|
* Worker write/edit gate: a successful worktree is required, and when the host
|
|
@@ -651,7 +693,7 @@ function createPluginRuntime(ctx) {
|
|
|
651
693
|
}
|
|
652
694
|
/** Install the prompt, scoring tool, and stop guard in one Lead scope. */
|
|
653
695
|
function installLead(options) {
|
|
654
|
-
const { agent, autoTeam, config
|
|
696
|
+
const { agent, autoTeam, config } = options;
|
|
655
697
|
const systemPrompt = agent.ctx.systemPrompt;
|
|
656
698
|
const tools = agent.ctx.tools;
|
|
657
699
|
const disposers = [];
|
|
@@ -665,22 +707,20 @@ function installLead(options) {
|
|
|
665
707
|
text: policyText(config.reportingAgentName, config.leadDeniedTools)
|
|
666
708
|
}));
|
|
667
709
|
if (!autoTeam.hasScore(agent)) register(registerScoreTool(tools, autoTeam));
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
});
|
|
683
|
-
}
|
|
710
|
+
const stop = agent.ctx.on("agent/turn-stopping", (payload) => {
|
|
711
|
+
if (payload.agent !== agent || autoTeam.hasScore(agent)) return;
|
|
712
|
+
agent.steer(createMessage({
|
|
713
|
+
role: "user",
|
|
714
|
+
content: [{
|
|
715
|
+
type: "text",
|
|
716
|
+
text: NO_SCORE_STEER_TEXT
|
|
717
|
+
}],
|
|
718
|
+
source: { kind: "user" }
|
|
719
|
+
}));
|
|
720
|
+
});
|
|
721
|
+
register(() => {
|
|
722
|
+
stop();
|
|
723
|
+
});
|
|
684
724
|
if (config.enforceLeadNoCode) {
|
|
685
725
|
const guard = agent.ctx.on("tools/pre-execute", async (exec, next) => {
|
|
686
726
|
if (exec.agent !== agent || autoTeam.decisionOf(agent) !== "team" || !config.leadDeniedTools.includes(exec.name)) return await next();
|
|
@@ -703,37 +743,30 @@ function installLead(options) {
|
|
|
703
743
|
}
|
|
704
744
|
/** Read the services needed by the install path without assuming load order. */
|
|
705
745
|
function servicesReady(ctx) {
|
|
706
|
-
return ctx.get("
|
|
746
|
+
return ctx.get("subagents") !== void 0 && ctx.get("agents") !== void 0 && ctx.get("goals") !== void 0 && ctx.get("tools") !== void 0 && ctx.get("systemPrompt") !== void 0;
|
|
707
747
|
}
|
|
708
|
-
/** Apply auto-team
|
|
709
|
-
function apply(ctx, config) {
|
|
748
|
+
/** Apply auto-team after its host-only score projection is ready. */
|
|
749
|
+
async function apply(ctx, config) {
|
|
710
750
|
const resolved = resolveConfig(config);
|
|
711
751
|
const runtime = createPluginRuntime(ctx);
|
|
712
752
|
runtime.info(resolved.message);
|
|
713
|
-
const
|
|
753
|
+
const projection = await ctx.sessionProjections.register(autoTeamProjectionDefinition);
|
|
754
|
+
const autoTeam = createAutoTeam(ctx, resolved, projection);
|
|
714
755
|
const installed = /* @__PURE__ */ new Map();
|
|
715
756
|
let warned = false;
|
|
716
|
-
let projectionRegistered = false;
|
|
717
757
|
let resetCommandRegistered = false;
|
|
718
|
-
const ensureProjection = () => {
|
|
719
|
-
if (projectionRegistered) return;
|
|
720
|
-
const registry = ctx.get("sessionProjections");
|
|
721
|
-
if (registry === void 0) return;
|
|
722
|
-
ctx.effect(() => registry.register(autoTeamProjectionDefinition), "auto-team.projection()");
|
|
723
|
-
projectionRegistered = true;
|
|
724
|
-
};
|
|
725
|
-
ensureProjection();
|
|
726
758
|
const ensureResetCommand = () => {
|
|
727
759
|
if (resetCommandRegistered) return;
|
|
728
760
|
const commands = ctx.get("commands");
|
|
729
761
|
if (!isCommandRuntime(commands)) return;
|
|
730
|
-
|
|
762
|
+
const command = createResetCommand(autoTeam, (agent) => {
|
|
763
|
+
ctx.effect(() => registerScoreTool(agent.ctx.tools, autoTeam), "auto-team.reset-score-tool()");
|
|
764
|
+
});
|
|
765
|
+
ctx.effect(() => commands.register(command), "auto-team.reset-command()");
|
|
731
766
|
resetCommandRegistered = true;
|
|
732
767
|
};
|
|
733
|
-
|
|
734
|
-
const install = (agent, source) => {
|
|
768
|
+
const install = (agent) => {
|
|
735
769
|
if (installed.has(agent)) return;
|
|
736
|
-
ensureProjection();
|
|
737
770
|
if (!servicesReady(ctx)) {
|
|
738
771
|
if (!warned) {
|
|
739
772
|
runtime.warn("auto-team: host services are unavailable; waiting for agent and goal services");
|
|
@@ -741,39 +774,50 @@ function apply(ctx, config) {
|
|
|
741
774
|
}
|
|
742
775
|
return;
|
|
743
776
|
}
|
|
744
|
-
const
|
|
745
|
-
if (
|
|
746
|
-
|
|
747
|
-
|
|
777
|
+
const subagents = ctx.get("subagents");
|
|
778
|
+
if (subagents === void 0) return;
|
|
779
|
+
let root = agent;
|
|
780
|
+
try {
|
|
781
|
+
root = subagents.rootOf(agent);
|
|
782
|
+
} catch (error) {
|
|
783
|
+
if (error instanceof SubagentError && error.code === "UNAUTHORIZED") return;
|
|
784
|
+
throw error;
|
|
785
|
+
}
|
|
786
|
+
if (root !== agent) {
|
|
787
|
+
if (subagents.namesOf(agent).self !== resolved.reportingAgentName) installed.set(agent, installWorkerGuard(agent, root, autoTeam));
|
|
748
788
|
return;
|
|
749
789
|
}
|
|
750
|
-
const restored =
|
|
751
|
-
if (restored !== void 0
|
|
790
|
+
const restored = projection.stateOf(agent.session).score;
|
|
791
|
+
if (restored !== void 0) autoTeam.restore(agent, restored);
|
|
752
792
|
installed.set(agent, installLead({
|
|
753
793
|
agent,
|
|
754
794
|
autoTeam,
|
|
755
|
-
config: resolved
|
|
756
|
-
source
|
|
795
|
+
config: resolved
|
|
757
796
|
}));
|
|
758
797
|
};
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
798
|
+
ctx.effect(() => () => {
|
|
799
|
+
for (const dispose of installed.values()) dispose();
|
|
800
|
+
installed.clear();
|
|
801
|
+
}, "auto-team.install()");
|
|
802
|
+
ctx.on("agent/created", ({ agent }) => {
|
|
803
|
+
if (agent.session.header.origin !== "subagent") install(agent);
|
|
804
|
+
});
|
|
805
|
+
ctx.on("subagent/start", (info) => {
|
|
806
|
+
if (!info.local) return;
|
|
807
|
+
const agent = ctx.get("agents")?.get(info.id);
|
|
808
|
+
if (agent !== void 0) install(agent);
|
|
762
809
|
});
|
|
763
810
|
ctx.on("agent/disposed", ({ agent }) => {
|
|
764
811
|
installed.get(agent)?.();
|
|
765
812
|
installed.delete(agent);
|
|
766
813
|
});
|
|
767
814
|
ctx.on("internal/service", (name) => {
|
|
768
|
-
if (name !== "
|
|
769
|
-
ensureProjection();
|
|
815
|
+
if (name !== "subagents" && name !== "agents" && name !== "goals" && name !== "tools" && name !== "systemPrompt" && name !== "commands") return;
|
|
770
816
|
ensureResetCommand();
|
|
771
817
|
for (const agent of ctx.get("agents")?.list() ?? []) install(agent);
|
|
772
818
|
});
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
installed.clear();
|
|
776
|
-
}, "auto-team.install()");
|
|
819
|
+
ensureResetCommand();
|
|
820
|
+
for (const agent of ctx.get("agents")?.list() ?? []) install(agent);
|
|
777
821
|
}
|
|
778
822
|
//#endregion
|
|
779
823
|
//#region src/index.ts
|
|
@@ -785,6 +829,6 @@ function apply(ctx, config) {
|
|
|
785
829
|
/** Cordis plugin name; keep this stable after publishing. */
|
|
786
830
|
const name = "auto-team";
|
|
787
831
|
/** Services that must exist before the plugin is applied. */
|
|
788
|
-
const inject = [];
|
|
832
|
+
const inject = ["sessionProjections"];
|
|
789
833
|
//#endregion
|
|
790
834
|
export { Config, apply, inject, name };
|
package/package.json
CHANGED
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": ">=24.
|
|
29
|
-
"dsh": ">=0.2.
|
|
28
|
+
"node": ">=24.9.0",
|
|
29
|
+
"dsh": ">=0.2.2-rc.5 <0.3.0"
|
|
30
30
|
},
|
|
31
31
|
"type": "module",
|
|
32
|
-
"version": "0.1.
|
|
32
|
+
"version": "0.1.5",
|
|
33
33
|
"imports": {
|
|
34
34
|
"#src/*": "./src/*.ts"
|
|
35
35
|
},
|
|
@@ -59,33 +59,39 @@
|
|
|
59
59
|
"patch": "./cordis.patch.yml"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"zod": "4.4.3"
|
|
64
|
-
},
|
|
65
62
|
"peerDependencies": {
|
|
66
|
-
"@deepseek-ai/cordis": "~4.0
|
|
67
|
-
"@deepseek-ai/
|
|
68
|
-
"@deepseek-ai/dsh-
|
|
69
|
-
"@deepseek-ai/dsh-
|
|
70
|
-
"@deepseek-ai/dsh-
|
|
71
|
-
"@deepseek-ai/dsh-
|
|
72
|
-
"@deepseek-ai/dsh-
|
|
73
|
-
"@deepseek-ai/dsh-
|
|
74
|
-
"@deepseek-ai/dsh-
|
|
75
|
-
"@deepseek-ai/
|
|
63
|
+
"@deepseek-ai/cordis": "~4.1.0",
|
|
64
|
+
"@deepseek-ai/dsh-agent": "0.2.2-rc.5",
|
|
65
|
+
"@deepseek-ai/dsh-goal": "0.2.2-rc.5",
|
|
66
|
+
"@deepseek-ai/dsh-llm": "0.2.2-rc.5",
|
|
67
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.5",
|
|
68
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.5",
|
|
69
|
+
"@deepseek-ai/dsh-subagent": "0.2.2-rc.5",
|
|
70
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-rc.5",
|
|
71
|
+
"@deepseek-ai/dsh-tools": "0.2.2-rc.5",
|
|
72
|
+
"@deepseek-ai/schemastery": "~3.19.0",
|
|
73
|
+
"zod": "4.6.6"
|
|
76
74
|
},
|
|
77
75
|
"devDependencies": {
|
|
78
|
-
"@deepseek-ai/cordis": "~4.0
|
|
79
|
-
"@deepseek-ai/cordis-plugin-loader": "~1.0
|
|
80
|
-
"@deepseek-ai/
|
|
81
|
-
"@deepseek-ai/dsh-
|
|
82
|
-
"@deepseek-ai/dsh-
|
|
83
|
-
"@deepseek-ai/dsh-
|
|
84
|
-
"@deepseek-ai/dsh-
|
|
85
|
-
"@deepseek-ai/dsh-
|
|
86
|
-
"@deepseek-ai/dsh-
|
|
87
|
-
"@deepseek-ai/dsh-
|
|
88
|
-
"@deepseek-ai/dsh-
|
|
76
|
+
"@deepseek-ai/cordis": "~4.1.0",
|
|
77
|
+
"@deepseek-ai/cordis-plugin-loader": "~1.1.0",
|
|
78
|
+
"@deepseek-ai/dsh-agent": "0.2.2-rc.5",
|
|
79
|
+
"@deepseek-ai/dsh-attachment": "0.2.2-rc.5",
|
|
80
|
+
"@deepseek-ai/dsh-error": "0.2.2-rc.5",
|
|
81
|
+
"@deepseek-ai/dsh-fs": "0.2.2-rc.5",
|
|
82
|
+
"@deepseek-ai/dsh-goal": "0.2.2-rc.5",
|
|
83
|
+
"@deepseek-ai/dsh-llm": "0.2.2-rc.5",
|
|
84
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-rc.5",
|
|
85
|
+
"@deepseek-ai/dsh-scope": "0.2.2-rc.5",
|
|
86
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.5",
|
|
87
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.5",
|
|
88
|
+
"@deepseek-ai/dsh-subagent": "0.2.2-rc.5",
|
|
89
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-rc.5",
|
|
90
|
+
"@deepseek-ai/dsh-tools": "0.2.2-rc.5",
|
|
91
|
+
"@deepseek-ai/dsh-user-approval": "0.2.2-rc.5",
|
|
92
|
+
"@deepseek-ai/dsh-util-time": "0.2.2-rc.5",
|
|
93
|
+
"@deepseek-ai/dsh-working-directory": "0.2.2-rc.5",
|
|
94
|
+
"@deepseek-ai/schemastery": "~3.19.0",
|
|
89
95
|
"@tsconfig/node24": "^24.0.5",
|
|
90
96
|
"@types/node": "^24.0.0",
|
|
91
97
|
"oxfmt": "0.73.0",
|
|
@@ -93,7 +99,8 @@
|
|
|
93
99
|
"oxlint-tsgolint": "7.0.2001",
|
|
94
100
|
"tsdown": "^0.22.2",
|
|
95
101
|
"typescript": "^6.0.3",
|
|
96
|
-
"vitest": "^4.1.11"
|
|
102
|
+
"vitest": "^4.1.11",
|
|
103
|
+
"zod": "4.6.6"
|
|
97
104
|
},
|
|
98
105
|
"scripts": {
|
|
99
106
|
"build": "tsdown",
|