@oh-my-dsh/auto-team 0.1.1 → 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 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 a user-created goal already exists at the first score, the threshold is multiplied by 0.6.
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 none exists;
22
- - ensures a user-facing reporting teammate named `reporter`, which is configurable; the Lead relays its updates to the user;
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.1.tgz
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.
@@ -104,7 +104,7 @@ When the profile provides the host `commands` service, the plugin registers `aut
104
104
 
105
105
  - `/auto-team-reset` clears the frozen score for the current session.
106
106
  - It appends a `plugin:auto-team/reset` record, so resuming the session does not restore the cleared score.
107
- - It steers the Lead to call `auto_team_score` again. The current goal and reporter stay in place.
107
+ - It is silent by default. Any text after the command is sent to the Lead as a user message; use `/auto-team-reset call auto_team_score again` when you want the Lead to re-score. The current goal and reporter stay in place.
108
108
  - The command is user-triggered; the model cannot invoke it.
109
109
 
110
110
  ## Guards and limits
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。如果第一次打分时已经存在用户触发的 goal,阈值乘以 0.6。
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
- - 复用当前 goal;没有 goal 就启动一个;
22
- - 确保存在名为 `reporter` 的汇报 Agent,名字可配置;它面向用户写更新,Lead 负责转达;
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.1.tgz
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 下。
@@ -104,7 +104,7 @@ profile 提供宿主 `commands` 服务时,插件注册 `auto-team-reset`:
104
104
 
105
105
  - `/auto-team-reset` 清空当前 session 的冻结分数。
106
106
  - 它写入 `plugin:auto-team/reset` 记录,resume 时不会恢复被清掉的分数。
107
- - 它提示 Lead 重新调用 `auto_team_score`;当前 goal 和汇报 Agent 保留。
107
+ - 它默认静默,不发送消息;命令后附带的文字会作为用户消息发给 Lead。想让 Lead 重新打分就写 `/auto-team-reset call auto_team_score again`。当前 goal 和汇报 Agent 保留。
108
108
  - 命令由用户触发,模型不能调用。
109
109
 
110
110
  ## 闸门与限制
package/lib/index.js CHANGED
@@ -207,8 +207,6 @@ const autoTeamProjectionDefinition = {
207
207
  */
208
208
  /** First-round steering text used when the scoring tool has not run yet. */
209
209
  const FIRST_ROUND_STEER_TEXT = `Auto Team: the first round has no score yet. Call auto_team_score now with the five difficulty factors and the task's universal-semantic objective; the turn stays open until the decision is recorded.`;
210
- /** Steering text used after the user resets the frozen score. */
211
- const RESET_STEER_TEXT = `Auto Team: the user reset the score. Call auto_team_score again with the current task's difficulty factors and objective before continuing.`;
212
210
  /** System prompt section that states the Lead's auto-team obligations. */
213
211
  function policyText(reportingAgentName, leadDeniedTools) {
214
212
  return `Auto Team policy
@@ -224,20 +222,155 @@ If the decision is solo, continue as a normal single agent.
224
222
  If the decision is team:
225
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.
226
224
  - The plugin starts or reuses the goal and ensures a reporting agent named "${reportingAgentName}".
227
- - The reporter writes for the user. Relay each update to the user as a user-facing message, and keep execution moving while details are resolved.
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.
228
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.
229
227
  - Let the goal runtime drive multi-round continuation; follow its rounds.
230
228
  - After the workers finish, review the final diff and run the tests in the main checkout.`;
231
229
  }
232
230
  /** Initial prompt for the dedicated reporting teammate. */
233
231
  function reporterPrompt() {
234
- return `You are the reporting agent for an auto-team task. Your reader is the user. The Lead relays each update to the user, so write every message as a user-facing status update in the user's language.
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.
235
233
 
236
- Cover what changed, what is blocked, and what the user needs to decide. Address the user directly.
234
+ Each turn ends after one update or one answer.
237
235
 
238
- Observe the roster and task board with list_agents and team_task_list. Hand each update to the Lead for relay with send_message({ target: "lead", message: "..." }). The Lead is the transport; the user is the reader.
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.
239
238
 
240
- Handle user-facing detail questions sent through the Lead. Record unresolved details, report the open question to the user, and keep execution moving. Your work is status, questions, and coordination; code changes belong to execution agents.`;
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;
241
374
  }
242
375
  //#endregion
243
376
  //#region src/reset-command.ts
@@ -245,25 +378,24 @@ Handle user-facing detail questions sent through the Lead. Record unresolved det
245
378
  function createResetCommand(autoTeam) {
246
379
  return {
247
380
  name: "auto-team-reset",
248
- description: "Clear the frozen Auto Team score for this session and ask the Lead to score again.",
381
+ description: "Clear the frozen Auto Team score for this session.",
249
382
  handler: (invocation) => {
250
383
  if (autoTeam.decisionOf(invocation.agent) === void 0) return {
251
384
  kind: "error",
252
385
  text: "No frozen Auto Team score exists in this session."
253
386
  };
254
387
  autoTeam.reset(invocation.agent);
255
- invocation.agent.steer(createMessage({
388
+ registerScoreTool(invocation.agent.ctx.tools, autoTeam);
389
+ const message = invocation.rawInput.trim();
390
+ if (message.length > 0) invocation.agent.steer(createMessage({
256
391
  role: "user",
257
392
  content: [{
258
393
  type: "text",
259
- text: RESET_STEER_TEXT
394
+ text: message
260
395
  }],
261
396
  source: { kind: "user" }
262
397
  }));
263
- return {
264
- kind: "success",
265
- text: "Auto Team score reset. The Lead will score again."
266
- };
398
+ return { kind: "success" };
267
399
  }
268
400
  };
269
401
  }
@@ -314,7 +446,9 @@ var AutoTeam = class {
314
446
  this.records.set(agent, existing);
315
447
  return await this.finish(agent, existing, request.signal);
316
448
  }
317
- const existingGoal = this.deps.goals.get(agent);
449
+ const currentGoal = this.deps.goals.get(agent);
450
+ let existingGoal = currentGoal;
451
+ if (currentGoal?.phase === "complete") existingGoal = void 0;
318
452
  const manualGoal = existingGoal !== void 0;
319
453
  const decision = createScoreDecision(request.assessment, {
320
454
  weights: this.config.weights,
@@ -423,130 +557,6 @@ function createAutoTeam(ctx, config) {
423
557
  }, config);
424
558
  }
425
559
  //#endregion
426
- //#region src/tool.ts
427
- /**
428
- * Model-facing scoring tool. The numeric score and threshold are never part of
429
- * the tool result.
430
- *
431
- * @module @oh-my-dsh/auto-team/tool
432
- */
433
- /** Build the one-shot scoring tool for a Lead agent scope. */
434
- function createScoreTool(autoTeam) {
435
- return defineTool({
436
- name: "auto_team_score",
437
- 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.",
438
- parameters: {
439
- scope: {
440
- type: "integer",
441
- required: true,
442
- enum: [
443
- 1,
444
- 2,
445
- 3,
446
- 4,
447
- 5
448
- ],
449
- description: "Expected change scope, from 1 low to 5 high."
450
- },
451
- parallelism: {
452
- type: "integer",
453
- required: true,
454
- enum: [
455
- 1,
456
- 2,
457
- 3,
458
- 4,
459
- 5
460
- ],
461
- description: "How much independent work can run in parallel, from 1 low to 5 high."
462
- },
463
- ambiguity: {
464
- type: "integer",
465
- required: true,
466
- enum: [
467
- 1,
468
- 2,
469
- 3,
470
- 4,
471
- 5
472
- ],
473
- description: "How much requirements or design uncertainty remains, from 1 low to 5 high."
474
- },
475
- risk: {
476
- type: "integer",
477
- required: true,
478
- enum: [
479
- 1,
480
- 2,
481
- 3,
482
- 4,
483
- 5
484
- ],
485
- description: "How costly a wrong change would be, from 1 low to 5 high."
486
- },
487
- expected_steps: {
488
- type: "integer",
489
- required: true,
490
- enum: [
491
- 1,
492
- 2,
493
- 3,
494
- 4,
495
- 5
496
- ],
497
- description: "Expected length of the task, from 1 short to 5 long."
498
- },
499
- objective: {
500
- type: "string",
501
- required: true,
502
- description: "The task goal in its ordinary, universal meaning. Used only when auto-team starts a goal."
503
- }
504
- },
505
- output: {
506
- schema: {
507
- type: "object",
508
- additionalProperties: false,
509
- properties: {
510
- decision: {
511
- type: "string",
512
- required: true,
513
- enum: ["team", "solo"]
514
- },
515
- goal: {
516
- type: "string",
517
- required: true,
518
- enum: [
519
- "started",
520
- "reused",
521
- "none"
522
- ]
523
- },
524
- reporter: { type: "string" }
525
- }
526
- },
527
- render: (_args, value) => [{
528
- type: "text",
529
- text: JSON.stringify(value)
530
- }]
531
- },
532
- async execute(args, exec) {
533
- const { agent } = exec;
534
- if (agent === void 0) throw new Error("auto_team_score requires a calling Agent");
535
- return await autoTeam.score(agent, {
536
- assessment: {
537
- scope: args.scope,
538
- parallelism: args.parallelism,
539
- ambiguity: args.ambiguity,
540
- risk: args.risk,
541
- expectedSteps: args.expected_steps
542
- },
543
- objective: args.objective,
544
- signal: exec.signal
545
- });
546
- }
547
- });
548
- }
549
- //#endregion
550
560
  //#region src/worker-guard.ts
551
561
  /**
552
562
  * Worker write/edit gate: a successful worktree is required, and when the host
@@ -654,7 +664,7 @@ function installLead(options) {
654
664
  order: systemPrompt.getSectionOrder("TEAM_POLICY"),
655
665
  text: policyText(config.reportingAgentName, config.leadDeniedTools)
656
666
  }));
657
- register(tools.register(createScoreTool(autoTeam)));
667
+ if (!autoTeam.hasScore(agent)) register(registerScoreTool(tools, autoTeam));
658
668
  if (source === "startup" || source === "clear") {
659
669
  const stop = agent.ctx.on("agent/turn-stopping", (payload) => {
660
670
  if (payload.agent !== agent || payload.turn !== 1 || autoTeam.hasScore(agent)) return;
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "dsh": ">=0.2.1-rc.2 <0.3.0"
30
30
  },
31
31
  "type": "module",
32
- "version": "0.1.1",
32
+ "version": "0.1.3",
33
33
  "imports": {
34
34
  "#src/*": "./src/*.ts"
35
35
  },