@oh-my-dsh/auto-team 0.1.2 → 0.1.3
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 +4 -4
- package/README.zh.md +4 -4
- package/lib/index.js +145 -131
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The plugin adds the first-round decision, the goal bridge, and the Lead and work
|
|
|
10
10
|
|
|
11
11
|
The Lead calls `auto_team_score` once in the first round. The call takes five factors from 1 to 5, covering scope, parallelism, ambiguity, risk, and expected_steps, plus the task goal in its ordinary meaning.
|
|
12
12
|
|
|
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
|
|
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
|
The first round must be scored. If the turn tries to close before the tool ran, an `agent/turn-stopping` listener steers the Lead back with a reminder.
|
|
16
16
|
|
|
@@ -18,8 +18,8 @@ The score is frozen for the task. Only a user-triggered `/auto-team-reset` clear
|
|
|
18
18
|
|
|
19
19
|
On a team decision the plugin:
|
|
20
20
|
|
|
21
|
-
- reuses the current goal, or starts one when
|
|
22
|
-
- ensures a user-facing reporting teammate named `reporter`, which is configurable; the
|
|
21
|
+
- reuses the current goal, or starts one when no active goal exists; a completed goal is replaced;
|
|
22
|
+
- ensures a user-facing reporting teammate named `reporter`, which is configurable; the reporter sends one update or answer directly to the user per turn and returns; the Lead monitors the team on its own schedule;
|
|
23
23
|
- tells the Lead to keep the main Git repository and the team, and not to write code;
|
|
24
24
|
- denies the Lead's `write` and `edit` calls by default;
|
|
25
25
|
- requires each execution teammate to complete `create_worktree` before its own `write` or `edit` is allowed, and checks that an edit path stays inside the registered worktree when the host returns one. The reporter is exempt.
|
|
@@ -60,7 +60,7 @@ dsh plugin --profile <profile> add @oh-my-dsh/auto-team
|
|
|
60
60
|
Or install a locally packed tarball:
|
|
61
61
|
|
|
62
62
|
```sh
|
|
63
|
-
dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.
|
|
63
|
+
dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.3.tgz
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
The package name is `@oh-my-dsh/auto-team`, published under the `@oh-my-dsh` scope.
|
package/README.zh.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
首轮由 Lead 调用一次 `auto_team_score`。参数是五个 1 到 5 的难度因子:scope、parallelism、ambiguity、risk、expected_steps,再加一句任务在通常语义上的目标。
|
|
12
12
|
|
|
13
|
-
插件把因子折算成 0 到 1 的加权分数。模型只拿到 `team` 或 `solo`,分数和实际阈值都留在宿主侧。默认阈值是 0.55
|
|
13
|
+
插件把因子折算成 0 到 1 的加权分数。模型只拿到 `team` 或 `solo`,分数和实际阈值都留在宿主侧。默认阈值是 0.55。如果第一次打分时已经存在有效的用户触发 goal,阈值乘以 0.6。
|
|
14
14
|
|
|
15
15
|
首轮必须打分。如果这一轮想在没有调用工具时结束,`agent/turn-stopping` 监听器会把 Lead 拉回来,再发一次提醒。
|
|
16
16
|
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
决定使用团队后,插件会:
|
|
20
20
|
|
|
21
|
-
-
|
|
22
|
-
- 确保存在名为 `reporter` 的汇报 Agent
|
|
21
|
+
- 复用当前有效 goal;没有有效 goal 就启动一个,已完成的 goal 会被替换;
|
|
22
|
+
- 确保存在名为 `reporter` 的汇报 Agent,名字可配置;它每轮只发一条更新或回答就直接发给用户,然后返回;Lead 按自己的节奏监听团队;
|
|
23
23
|
- 提示 Lead 维护主 Git 仓库和团队,不写代码;
|
|
24
24
|
- 默认拒绝 Lead 的 `write` 和 `edit`;
|
|
25
25
|
- 要求每个执行 Agent 先成功调用 `create_worktree`,之后才允许自己的 `write` 或 `edit`;宿主返回 worktree 路径时,还会检查编辑路径是否在该 worktree 内。汇报 Agent 不受这条限制。
|
|
@@ -60,7 +60,7 @@ dsh plugin --profile <profile> add @oh-my-dsh/auto-team
|
|
|
60
60
|
或者安装本地打包的 tarball:
|
|
61
61
|
|
|
62
62
|
```sh
|
|
63
|
-
dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.
|
|
63
|
+
dsh plugin --profile <profile> add ./oh-my-dsh-auto-team-0.1.3.tgz
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
包名是 `@oh-my-dsh/auto-team`,发布在 `@oh-my-dsh` scope 下。
|
package/lib/index.js
CHANGED
|
@@ -222,20 +222,155 @@ If the decision is solo, continue as a normal single agent.
|
|
|
222
222
|
If the decision is team:
|
|
223
223
|
- Your role is the Main Git repository and the team. Code changes belong to execution agents. The Lead's ${leadDeniedTools.join(", ")} calls are denied in Team mode. Treat that gate as a policy check: use pwsh, run_code, and other tools for review, tests, and inspection only.
|
|
224
224
|
- The plugin starts or reuses the goal and ensures a reporting agent named "${reportingAgentName}".
|
|
225
|
-
- The reporter writes
|
|
225
|
+
- The reporter writes directly to the user on its own cadence. Monitor the team on your own schedule, and keep execution moving while details are resolved.
|
|
226
226
|
- Create shared tasks with disjoint write scopes, then spawn execution agents. Each execution agent creates its own worktree for its task before editing; the Lead works in the main checkout.
|
|
227
227
|
- Let the goal runtime drive multi-round continuation; follow its rounds.
|
|
228
228
|
- After the workers finish, review the final diff and run the tests in the main checkout.`;
|
|
229
229
|
}
|
|
230
230
|
/** Initial prompt for the dedicated reporting teammate. */
|
|
231
231
|
function reporterPrompt() {
|
|
232
|
-
return `You are the reporting agent for an auto-team task. Your reader is the user. The Lead
|
|
232
|
+
return `You are the reporting agent for an auto-team task. Your reader is the user. The Lead monitors the team on its own schedule.
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
Each turn ends after one update or one answer.
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
- Status update: read list_agents and team_task_list once, then write one concise update for the user covering what changed, what is blocked, and what the user needs to decide.
|
|
237
|
+
- Detail question: answer the user's question directly.
|
|
237
238
|
|
|
238
|
-
|
|
239
|
+
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
|
+
}
|
|
241
|
+
//#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;
|
|
239
374
|
}
|
|
240
375
|
//#endregion
|
|
241
376
|
//#region src/reset-command.ts
|
|
@@ -250,6 +385,7 @@ function createResetCommand(autoTeam) {
|
|
|
250
385
|
text: "No frozen Auto Team score exists in this session."
|
|
251
386
|
};
|
|
252
387
|
autoTeam.reset(invocation.agent);
|
|
388
|
+
registerScoreTool(invocation.agent.ctx.tools, autoTeam);
|
|
253
389
|
const message = invocation.rawInput.trim();
|
|
254
390
|
if (message.length > 0) invocation.agent.steer(createMessage({
|
|
255
391
|
role: "user",
|
|
@@ -310,7 +446,9 @@ var AutoTeam = class {
|
|
|
310
446
|
this.records.set(agent, existing);
|
|
311
447
|
return await this.finish(agent, existing, request.signal);
|
|
312
448
|
}
|
|
313
|
-
const
|
|
449
|
+
const currentGoal = this.deps.goals.get(agent);
|
|
450
|
+
let existingGoal = currentGoal;
|
|
451
|
+
if (currentGoal?.phase === "complete") existingGoal = void 0;
|
|
314
452
|
const manualGoal = existingGoal !== void 0;
|
|
315
453
|
const decision = createScoreDecision(request.assessment, {
|
|
316
454
|
weights: this.config.weights,
|
|
@@ -419,130 +557,6 @@ function createAutoTeam(ctx, config) {
|
|
|
419
557
|
}, config);
|
|
420
558
|
}
|
|
421
559
|
//#endregion
|
|
422
|
-
//#region src/tool.ts
|
|
423
|
-
/**
|
|
424
|
-
* Model-facing scoring tool. The numeric score and threshold are never part of
|
|
425
|
-
* the tool result.
|
|
426
|
-
*
|
|
427
|
-
* @module @oh-my-dsh/auto-team/tool
|
|
428
|
-
*/
|
|
429
|
-
/** Build the one-shot scoring tool for a Lead agent scope. */
|
|
430
|
-
function createScoreTool(autoTeam) {
|
|
431
|
-
return defineTool({
|
|
432
|
-
name: "auto_team_score",
|
|
433
|
-
description: "Record the first-round difficulty assessment and return the team or solo decision. Call once before any other action; the decision is frozen for the task.",
|
|
434
|
-
parameters: {
|
|
435
|
-
scope: {
|
|
436
|
-
type: "integer",
|
|
437
|
-
required: true,
|
|
438
|
-
enum: [
|
|
439
|
-
1,
|
|
440
|
-
2,
|
|
441
|
-
3,
|
|
442
|
-
4,
|
|
443
|
-
5
|
|
444
|
-
],
|
|
445
|
-
description: "Expected change scope, from 1 low to 5 high."
|
|
446
|
-
},
|
|
447
|
-
parallelism: {
|
|
448
|
-
type: "integer",
|
|
449
|
-
required: true,
|
|
450
|
-
enum: [
|
|
451
|
-
1,
|
|
452
|
-
2,
|
|
453
|
-
3,
|
|
454
|
-
4,
|
|
455
|
-
5
|
|
456
|
-
],
|
|
457
|
-
description: "How much independent work can run in parallel, from 1 low to 5 high."
|
|
458
|
-
},
|
|
459
|
-
ambiguity: {
|
|
460
|
-
type: "integer",
|
|
461
|
-
required: true,
|
|
462
|
-
enum: [
|
|
463
|
-
1,
|
|
464
|
-
2,
|
|
465
|
-
3,
|
|
466
|
-
4,
|
|
467
|
-
5
|
|
468
|
-
],
|
|
469
|
-
description: "How much requirements or design uncertainty remains, from 1 low to 5 high."
|
|
470
|
-
},
|
|
471
|
-
risk: {
|
|
472
|
-
type: "integer",
|
|
473
|
-
required: true,
|
|
474
|
-
enum: [
|
|
475
|
-
1,
|
|
476
|
-
2,
|
|
477
|
-
3,
|
|
478
|
-
4,
|
|
479
|
-
5
|
|
480
|
-
],
|
|
481
|
-
description: "How costly a wrong change would be, from 1 low to 5 high."
|
|
482
|
-
},
|
|
483
|
-
expected_steps: {
|
|
484
|
-
type: "integer",
|
|
485
|
-
required: true,
|
|
486
|
-
enum: [
|
|
487
|
-
1,
|
|
488
|
-
2,
|
|
489
|
-
3,
|
|
490
|
-
4,
|
|
491
|
-
5
|
|
492
|
-
],
|
|
493
|
-
description: "Expected length of the task, from 1 short to 5 long."
|
|
494
|
-
},
|
|
495
|
-
objective: {
|
|
496
|
-
type: "string",
|
|
497
|
-
required: true,
|
|
498
|
-
description: "The task goal in its ordinary, universal meaning. Used only when auto-team starts a goal."
|
|
499
|
-
}
|
|
500
|
-
},
|
|
501
|
-
output: {
|
|
502
|
-
schema: {
|
|
503
|
-
type: "object",
|
|
504
|
-
additionalProperties: false,
|
|
505
|
-
properties: {
|
|
506
|
-
decision: {
|
|
507
|
-
type: "string",
|
|
508
|
-
required: true,
|
|
509
|
-
enum: ["team", "solo"]
|
|
510
|
-
},
|
|
511
|
-
goal: {
|
|
512
|
-
type: "string",
|
|
513
|
-
required: true,
|
|
514
|
-
enum: [
|
|
515
|
-
"started",
|
|
516
|
-
"reused",
|
|
517
|
-
"none"
|
|
518
|
-
]
|
|
519
|
-
},
|
|
520
|
-
reporter: { type: "string" }
|
|
521
|
-
}
|
|
522
|
-
},
|
|
523
|
-
render: (_args, value) => [{
|
|
524
|
-
type: "text",
|
|
525
|
-
text: JSON.stringify(value)
|
|
526
|
-
}]
|
|
527
|
-
},
|
|
528
|
-
async execute(args, exec) {
|
|
529
|
-
const { agent } = exec;
|
|
530
|
-
if (agent === void 0) throw new Error("auto_team_score requires a calling Agent");
|
|
531
|
-
return await autoTeam.score(agent, {
|
|
532
|
-
assessment: {
|
|
533
|
-
scope: args.scope,
|
|
534
|
-
parallelism: args.parallelism,
|
|
535
|
-
ambiguity: args.ambiguity,
|
|
536
|
-
risk: args.risk,
|
|
537
|
-
expectedSteps: args.expected_steps
|
|
538
|
-
},
|
|
539
|
-
objective: args.objective,
|
|
540
|
-
signal: exec.signal
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
//#endregion
|
|
546
560
|
//#region src/worker-guard.ts
|
|
547
561
|
/**
|
|
548
562
|
* Worker write/edit gate: a successful worktree is required, and when the host
|
|
@@ -650,7 +664,7 @@ function installLead(options) {
|
|
|
650
664
|
order: systemPrompt.getSectionOrder("TEAM_POLICY"),
|
|
651
665
|
text: policyText(config.reportingAgentName, config.leadDeniedTools)
|
|
652
666
|
}));
|
|
653
|
-
|
|
667
|
+
if (!autoTeam.hasScore(agent)) register(registerScoreTool(tools, autoTeam));
|
|
654
668
|
if (source === "startup" || source === "clear") {
|
|
655
669
|
const stop = agent.ctx.on("agent/turn-stopping", (payload) => {
|
|
656
670
|
if (payload.agent !== agent || payload.turn !== 1 || autoTeam.hasScore(agent)) return;
|