@mclawnet/mcp-server 0.1.5 → 0.1.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/tools/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,aAAa,EACb,wBAAwB,EACxB,eAAe,GAIhB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAC;AAOhE,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL;YACE,IAAI,EAAE,eAAe;YACrB,WAAW,EACT,iHAAiH;YACnH,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;oBACnE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA+B,EAAE;oBACvE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;oBACjE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE;oBAC3E,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,gDAAgD,EAAE;iBAC9F;gBACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;aAC9B;SACF;QACD;YACE,IAAI,EAAE,cAAc;YACpB,WAAW,EACT,qIAAqI;YACvI,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;oBACnE,OAAO,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AQ,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,iBAAiB,GAAG,CAAC,CAAC;IAC1B,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,OAAO;YAAE,iBAAiB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,MAAM,GAAG;QACb,KAAK;QACL,UAAU,EAAE,aAAa,CAAC,OAAO;QACjC,aAAa,EAAE,aAAa,CAAC,MAAM;QACnC,YAAY;QACZ,cAAc,EAAE,OAAO,CAAC,MAAM;QAC9B,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,YAAY;QACrB,iBAAiB;KAClB,CAAC;IAEF,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IAC7C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;KAC1D,CAAC;AACJ,CAAC"}
@@ -56,6 +56,10 @@ export declare function getTaskToolDefinitions(): ({
56
56
  };
57
57
  description: string;
58
58
  };
59
+ planTaskId: {
60
+ type: string;
61
+ description: string;
62
+ };
59
63
  sourceMessageId?: undefined;
60
64
  sourceInstanceId?: undefined;
61
65
  taskId?: undefined;
@@ -113,6 +117,10 @@ export declare function getTaskToolDefinitions(): ({
113
117
  };
114
118
  description: string;
115
119
  };
120
+ planTaskId: {
121
+ type: string;
122
+ description: string;
123
+ };
116
124
  sourceMessageId: {
117
125
  type: string;
118
126
  description: string;
@@ -156,6 +164,7 @@ export declare function getTaskToolDefinitions(): ({
156
164
  owner?: undefined;
157
165
  from?: undefined;
158
166
  blockedBy?: undefined;
167
+ planTaskId?: undefined;
159
168
  sourceMessageId?: undefined;
160
169
  sourceInstanceId?: undefined;
161
170
  status?: undefined;
@@ -199,6 +208,7 @@ export declare function getTaskToolDefinitions(): ({
199
208
  description?: undefined;
200
209
  from?: undefined;
201
210
  blockedBy?: undefined;
211
+ planTaskId?: undefined;
202
212
  sourceMessageId?: undefined;
203
213
  sourceInstanceId?: undefined;
204
214
  taskId?: undefined;
@@ -240,6 +250,7 @@ export declare function getTaskToolDefinitions(): ({
240
250
  owner?: undefined;
241
251
  from?: undefined;
242
252
  blockedBy?: undefined;
253
+ planTaskId?: undefined;
243
254
  sourceMessageId?: undefined;
244
255
  sourceInstanceId?: undefined;
245
256
  author?: undefined;
@@ -281,6 +292,7 @@ export declare function getTaskToolDefinitions(): ({
281
292
  description?: undefined;
282
293
  swarmId?: undefined;
283
294
  blockedBy?: undefined;
295
+ planTaskId?: undefined;
284
296
  sourceMessageId?: undefined;
285
297
  sourceInstanceId?: undefined;
286
298
  status?: undefined;
@@ -333,6 +345,7 @@ export declare function getTaskToolDefinitions(): ({
333
345
  owner?: undefined;
334
346
  from?: undefined;
335
347
  blockedBy?: undefined;
348
+ planTaskId?: undefined;
336
349
  sourceMessageId?: undefined;
337
350
  sourceInstanceId?: undefined;
338
351
  status?: undefined;
@@ -369,6 +382,7 @@ export declare function getTaskToolDefinitions(): ({
369
382
  owner?: undefined;
370
383
  from?: undefined;
371
384
  blockedBy?: undefined;
385
+ planTaskId?: undefined;
372
386
  sourceMessageId?: undefined;
373
387
  sourceInstanceId?: undefined;
374
388
  taskId?: undefined;
@@ -413,6 +427,7 @@ export declare function getTaskToolDefinitions(): ({
413
427
  owner?: undefined;
414
428
  from?: undefined;
415
429
  blockedBy?: undefined;
430
+ planTaskId?: undefined;
416
431
  sourceMessageId?: undefined;
417
432
  sourceInstanceId?: undefined;
418
433
  taskId?: undefined;
@@ -453,6 +468,7 @@ export declare function getTaskToolDefinitions(): ({
453
468
  owner?: undefined;
454
469
  from?: undefined;
455
470
  blockedBy?: undefined;
471
+ planTaskId?: undefined;
456
472
  sourceMessageId?: undefined;
457
473
  sourceInstanceId?: undefined;
458
474
  taskId?: undefined;
@@ -502,6 +518,7 @@ export declare function getTaskToolDefinitions(): ({
502
518
  owner?: undefined;
503
519
  from?: undefined;
504
520
  blockedBy?: undefined;
521
+ planTaskId?: undefined;
505
522
  sourceMessageId?: undefined;
506
523
  sourceInstanceId?: undefined;
507
524
  taskId?: undefined;
@@ -523,4 +540,14 @@ export declare function handleTaskToolCall(name: string, args: Record<string, un
523
540
  }>;
524
541
  isError?: boolean;
525
542
  }>;
543
+ /**
544
+ * Infer a plan task id from a task subject prefix. Matches patterns like
545
+ * `t1: ...`, `t2.5 - ...`, `[t1] ...`, `[t2.5]: ...`. Returns lowercased
546
+ * id (e.g. `t1`, `t2.5`) on hit, undefined otherwise.
547
+ *
548
+ * Deliberately conservative — requires the t-prefix to be followed by `:`,
549
+ * whitespace, or be inside `[...]`. This avoids misclassifying titles like
550
+ * "Test123 do thing" or "t9999_some_label" as plan ids.
551
+ */
552
+ export declare function inferPlanTaskIdFromSubject(subject: string): string | undefined;
526
553
  //# sourceMappingURL=task.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/tools/task.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B;AAED,eAAO,MAAM,eAAe,aAa1B,CAAC;AAeH,wBAAgB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,eAAO,MAAM,eAAe,aAa1B,CAAC;AAeH,wBAAgB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoOrC;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA0ChF;AAucD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM9E"}
@@ -1,9 +1,9 @@
1
- import { existsSync, readFileSync } from "node:fs";
1
+ import { existsSync, readFileSync, promises as fsp } from "node:fs";
2
2
  import { join } from "node:path";
3
- import { randomUUID } from "node:crypto";
3
+ import { randomUUID, randomBytes } from "node:crypto";
4
4
  import { createLogger } from "@mclawnet/logger";
5
5
  import { TaskStore, classifyBlockers, computeLeadBriefing, computeMemberBriefing, computeTaskBriefing, formatLeadBriefing, formatMemberBriefing, formatTaskBriefing, projectRoot, } from "@mclawnet/task";
6
- import { InboxStore } from "@mclawnet/swarm";
6
+ import { InboxStore, pickStrongestStatus } from "@mclawnet/swarm";
7
7
  const log = createLogger({ module: "mcp-server/tools/task" });
8
8
  export const TASK_TOOL_NAMES = new Set([
9
9
  "task_create",
@@ -49,6 +49,10 @@ export function getTaskToolDefinitions() {
49
49
  items: { type: "string" },
50
50
  description: "Task ids this task is blocked by (optional)",
51
51
  },
52
+ planTaskId: {
53
+ type: "string",
54
+ description: "Plan task id (e.g. 't1', 't2.5') linking this live task back to a plan node.",
55
+ },
52
56
  },
53
57
  required: ["workDir", "teamName", "subject", "from"],
54
58
  },
@@ -71,6 +75,10 @@ export function getTaskToolDefinitions() {
71
75
  items: { type: "string" },
72
76
  description: "Task ids this task is blocked by (optional)",
73
77
  },
78
+ planTaskId: {
79
+ type: "string",
80
+ description: "Plan task id (e.g. 't1', 't2.5') linking this live task back to a plan node.",
81
+ },
74
82
  sourceMessageId: { type: "string", description: "Inbox message id this task is spun off from" },
75
83
  sourceInstanceId: { type: "string", description: "Instance id that owned the source message" },
76
84
  },
@@ -307,20 +315,40 @@ function getStore(args, context) {
307
315
  }
308
316
  async function handleTaskCreate(args, context) {
309
317
  assertQueenCaller(args, "task_create");
310
- const teamName = args.teamName;
318
+ const requestedTeamName = args.teamName;
311
319
  const subject = args.subject;
312
- if (!teamName)
320
+ if (!requestedTeamName)
313
321
  throw new Error("teamName is required");
314
322
  if (!subject)
315
323
  throw new Error("subject is required");
324
+ const swarmId = args.swarmId ?? null;
325
+ const explicitPlanTaskId = args.planTaskId;
326
+ // Subject infer: if queen forgot planTaskId but tagged the subject with
327
+ // `[t1]` / `t2.5: ...`, fold the inference back into the persisted task.
328
+ // Reversal of PR#91 Fix 1C: that PR demoted infer to response-only because
329
+ // a mis-inferred id (e.g. "t1: 修 t2 的 bug") could silently corrupt the
330
+ // plan-progress UI. But the queen has been retrained to prefix subjects on
331
+ // purpose, and not persisting means plan-sync still finds zero matches —
332
+ // we restore the writeback and surface the inferred id in the response so
333
+ // the queen can spot a bad guess and re-issue task_create.
334
+ const inferredPlanTaskId = explicitPlanTaskId ?? inferPlanTaskIdFromSubject(subject);
335
+ const effectivePlanTaskId = explicitPlanTaskId ?? inferredPlanTaskId;
336
+ // teamName consistency: when this task belongs to a swarm, its teamName
337
+ // must match the swarm's. Queens have a habit of passing the project's
338
+ // topic (e.g. "game-dev") instead of the actual template id (e.g.
339
+ // "dev-team"), which then breaks any UI that joins tasks-by-team. Override
340
+ // silently and surface a warning so the caller learns.
341
+ const teamWarning = await reconcileTeamName(args.workDir, swarmId, requestedTeamName, context);
342
+ const teamName = teamWarning?.effective ?? requestedTeamName;
316
343
  const store = getStore(args, context);
317
344
  const task = await store.create({
318
345
  teamName,
319
346
  subject,
320
347
  description: args.description,
321
- swarmId: args.swarmId ?? null,
348
+ swarmId,
322
349
  owner: args.owner ?? null,
323
350
  blockedBy: args.blockedBy ?? [],
351
+ planTaskId: effectivePlanTaskId,
324
352
  });
325
353
  if (task.swarmId && task.owner) {
326
354
  const msg = {
@@ -338,17 +366,25 @@ async function handleTaskCreate(args, context) {
338
366
  };
339
367
  await appendInboxBestEffort(args.workDir, task.swarmId, task.owner, msg, context);
340
368
  }
369
+ const text = await appendPlanLinkAnnotations(JSON.stringify(task), {
370
+ workDir: args.workDir,
371
+ swarmId,
372
+ explicitPlanTaskId,
373
+ inferredPlanTaskId,
374
+ teamWarning: teamWarning?.warning,
375
+ context,
376
+ });
341
377
  return {
342
- content: [{ type: "text", text: JSON.stringify(task) }],
378
+ content: [{ type: "text", text }],
343
379
  };
344
380
  }
345
381
  async function handleTaskCreateFromMessage(args, context) {
346
382
  assertQueenCaller(args, "task_create_from_message");
347
- const teamName = args.teamName;
383
+ const requestedTeamName = args.teamName;
348
384
  const subject = args.subject;
349
385
  const sourceMessageId = args.sourceMessageId;
350
386
  const sourceInstanceId = args.sourceInstanceId;
351
- if (!teamName)
387
+ if (!requestedTeamName)
352
388
  throw new Error("teamName is required");
353
389
  if (!subject)
354
390
  throw new Error("subject is required");
@@ -356,14 +392,22 @@ async function handleTaskCreateFromMessage(args, context) {
356
392
  throw new Error("sourceMessageId is required");
357
393
  if (!sourceInstanceId)
358
394
  throw new Error("sourceInstanceId is required");
395
+ const swarmId = args.swarmId ?? null;
396
+ const explicitPlanTaskId = args.planTaskId;
397
+ // Subject infer is persisted; see comment in handleTaskCreate.
398
+ const inferredPlanTaskId = explicitPlanTaskId ?? inferPlanTaskIdFromSubject(subject);
399
+ const effectivePlanTaskId = explicitPlanTaskId ?? inferredPlanTaskId;
400
+ const teamWarning = await reconcileTeamName(args.workDir, swarmId, requestedTeamName, context);
401
+ const teamName = teamWarning?.effective ?? requestedTeamName;
359
402
  const store = getStore(args, context);
360
403
  const task = await store.create({
361
404
  teamName,
362
405
  subject,
363
406
  description: args.description,
364
- swarmId: args.swarmId ?? null,
407
+ swarmId,
365
408
  owner: args.owner ?? null,
366
409
  blockedBy: args.blockedBy ?? [],
410
+ planTaskId: effectivePlanTaskId,
367
411
  });
368
412
  await store.addComment(task.id, {
369
413
  id: randomUUID(),
@@ -372,8 +416,16 @@ async function handleTaskCreateFromMessage(args, context) {
372
416
  body: `Spun off from message ${sourceMessageId} (instance ${sourceInstanceId})`,
373
417
  });
374
418
  const fresh = store.get(task.id);
419
+ const text = await appendPlanLinkAnnotations(JSON.stringify(fresh), {
420
+ workDir: args.workDir,
421
+ swarmId,
422
+ explicitPlanTaskId,
423
+ inferredPlanTaskId,
424
+ teamWarning: teamWarning?.warning,
425
+ context,
426
+ });
375
427
  return {
376
- content: [{ type: "text", text: JSON.stringify(fresh) }],
428
+ content: [{ type: "text", text }],
377
429
  };
378
430
  }
379
431
  async function handleTaskGet(args, context) {
@@ -464,6 +516,14 @@ async function handleTaskSetStatus(args, context) {
464
516
  if (status === "completed" && current.status !== "completed") {
465
517
  await notifyUnblockedAfterCompletion(store, updated, args, context);
466
518
  }
519
+ // Re-sync plan.tasks[].status in recovery.json so the swarm's plan view
520
+ // reflects this status change immediately. The coordinator's own
521
+ // syncPlanStatusFromTasks only runs on persistSwarm (swarm-level events),
522
+ // so without this MCP-side write-back the plan would stay stale until the
523
+ // next role spawn / member change / etc. Best-effort.
524
+ if (current.swarmId) {
525
+ await syncPlanStatusInRecoveryFile(args.workDir, current.swarmId, context.inbox?.rootDir ?? context.rootDir, store);
526
+ }
467
527
  // Re-read to reflect any link cleanup we may have done above.
468
528
  const fresh = store.tryGet(taskId) ?? updated;
469
529
  return {
@@ -607,6 +667,234 @@ async function handleTaskBriefing(args, context) {
607
667
  content: [{ type: "text", text }],
608
668
  };
609
669
  }
670
+ /**
671
+ * Infer a plan task id from a task subject prefix. Matches patterns like
672
+ * `t1: ...`, `t2.5 - ...`, `[t1] ...`, `[t2.5]: ...`. Returns lowercased
673
+ * id (e.g. `t1`, `t2.5`) on hit, undefined otherwise.
674
+ *
675
+ * Deliberately conservative — requires the t-prefix to be followed by `:`,
676
+ * whitespace, or be inside `[...]`. This avoids misclassifying titles like
677
+ * "Test123 do thing" or "t9999_some_label" as plan ids.
678
+ */
679
+ export function inferPlanTaskIdFromSubject(subject) {
680
+ if (!subject)
681
+ return undefined;
682
+ const m = subject.match(/^\[(t\d+(?:\.\d+)*)\]\s*[:\-]?\s*\S|^(t\d+(?:\.\d+)*)\s*[:\-]\s*\S/i);
683
+ if (!m)
684
+ return undefined;
685
+ const id = (m[1] ?? m[2] ?? "").toLowerCase();
686
+ return id || undefined;
687
+ }
688
+ /**
689
+ * Read the swarm's teamName from its `recovery.json` snapshot. Returns null
690
+ * when the snapshot is missing, malformed, or has no `teamName` field.
691
+ * Used to reconcile task_create's `args.teamName` against the swarm's truth.
692
+ */
693
+ async function readSwarmTeamName(workDir, swarmId, rootDir) {
694
+ try {
695
+ const snapshotPath = join(projectRoot(workDir, rootDir), "swarms", swarmId, "recovery.json");
696
+ try {
697
+ await fsp.access(snapshotPath);
698
+ }
699
+ catch {
700
+ return null;
701
+ }
702
+ const raw = await fsp.readFile(snapshotPath, "utf-8");
703
+ const snapshot = JSON.parse(raw);
704
+ return typeof snapshot.teamName === "string" && snapshot.teamName.length > 0
705
+ ? snapshot.teamName
706
+ : null;
707
+ }
708
+ catch (err) {
709
+ log.warn({ err, swarmId }, "readSwarmTeamName failed");
710
+ return null;
711
+ }
712
+ }
713
+ /**
714
+ * When a task is scoped to a swarm, force its teamName to match the swarm's
715
+ * authoritative teamName from recovery.json. Queens commonly mis-pass the
716
+ * project topic (e.g. "game-dev") instead of the template id (e.g.
717
+ * "dev-team"), which then breaks any UI joining tasks-by-team.
718
+ *
719
+ * Returns `{ effective, warning? }`:
720
+ * - `effective` is the teamName to actually persist (swarm's value when
721
+ * resolved, otherwise the caller's).
722
+ * - `warning` is a human-readable note appended to the response when the
723
+ * caller's value was overridden.
724
+ *
725
+ * Graceful fallback: when swarmId is null or the snapshot can't be read, the
726
+ * caller's teamName is used verbatim and no warning is emitted.
727
+ */
728
+ async function reconcileTeamName(workDir, swarmId, requested, context) {
729
+ if (!swarmId)
730
+ return null;
731
+ const swarmTeam = await readSwarmTeamName(workDir, swarmId, context.rootDir);
732
+ if (!swarmTeam)
733
+ return null;
734
+ if (swarmTeam === requested)
735
+ return { effective: swarmTeam };
736
+ return {
737
+ effective: swarmTeam,
738
+ warning: `⚠ teamName 已校正:你传 '${requested}' 但 swarm 实际是 '${swarmTeam}',已用 swarm 的值。`,
739
+ };
740
+ }
741
+ /**
742
+ * `recovery.json` snapshot. Returns the set of plan task ids when a plan
743
+ * with phases is found, or null when no plan / no snapshot / unparseable.
744
+ *
745
+ * Used by `task_create` / `task_create_from_message` to emit a warning when
746
+ * a derived task is missing a `planTaskId` link, or references an id the
747
+ * plan doesn't contain.
748
+ */
749
+ async function readPlanTaskIds(workDir, swarmId, rootDir) {
750
+ try {
751
+ const snapshotPath = join(projectRoot(workDir, rootDir), "swarms", swarmId, "recovery.json");
752
+ try {
753
+ await fsp.access(snapshotPath);
754
+ }
755
+ catch {
756
+ return null;
757
+ }
758
+ const raw = await fsp.readFile(snapshotPath, "utf-8");
759
+ const snapshot = JSON.parse(raw);
760
+ const plan = snapshot.plan;
761
+ if (!plan || !Array.isArray(plan.phases) || plan.phases.length === 0)
762
+ return null;
763
+ const ids = new Set();
764
+ for (const phase of plan.phases) {
765
+ if (!Array.isArray(phase?.tasks))
766
+ continue;
767
+ for (const task of phase.tasks) {
768
+ if (typeof task?.id === "string")
769
+ ids.add(task.id);
770
+ }
771
+ }
772
+ return ids.size > 0 ? ids : null;
773
+ }
774
+ catch (err) {
775
+ log.warn({ err, swarmId }, "readPlanTaskIds failed");
776
+ return null;
777
+ }
778
+ }
779
+ /**
780
+ * Re-sync plan.tasks[].status in the swarm's recovery.json from the live
781
+ * TaskStore. Mirrors SwarmCoordinator.syncPlanStatusFromTasks but written
782
+ * for the MCP server side so task_set_status changes are immediately
783
+ * visible to anyone reading recovery.json (UI / CLI / user inspection).
784
+ *
785
+ * Read-modify-write on the entire snapshot file, mutating only plan task
786
+ * statuses. Atomic via tmp + rename. Tight critical section minimises the
787
+ * race window vs the coordinator's own persistSwarm; either side's next
788
+ * write will re-sync from the task store, so eventual consistency holds.
789
+ *
790
+ * Best-effort: any failure logged but never throws back to the tool caller.
791
+ */
792
+ async function syncPlanStatusInRecoveryFile(workDir, swarmId, rootDir, store) {
793
+ const swarmDir = join(projectRoot(workDir, rootDir), "swarms", swarmId);
794
+ const snapshotPath = join(swarmDir, "recovery.json");
795
+ try {
796
+ try {
797
+ await fsp.access(snapshotPath);
798
+ }
799
+ catch {
800
+ return;
801
+ }
802
+ const raw = await fsp.readFile(snapshotPath, "utf-8");
803
+ const snapshot = JSON.parse(raw);
804
+ const plan = snapshot.plan;
805
+ if (!plan || !Array.isArray(plan.phases) || plan.phases.length === 0)
806
+ return;
807
+ const liveTasks = store.listBySwarm(swarmId);
808
+ const byPlanId = new Map();
809
+ for (const t of liveTasks) {
810
+ if (!t.planTaskId)
811
+ continue;
812
+ const arr = byPlanId.get(t.planTaskId) ?? [];
813
+ arr.push(t.status);
814
+ byPlanId.set(t.planTaskId, arr);
815
+ }
816
+ let mutated = false;
817
+ for (const phase of plan.phases) {
818
+ if (!Array.isArray(phase?.tasks))
819
+ continue;
820
+ for (const task of phase.tasks) {
821
+ if (typeof task?.id !== "string")
822
+ continue;
823
+ const statuses = byPlanId.get(task.id);
824
+ if (!statuses || statuses.length === 0)
825
+ continue;
826
+ const next = pickStrongestStatus(statuses);
827
+ if (task.status !== next) {
828
+ task.status = next;
829
+ mutated = true;
830
+ }
831
+ }
832
+ }
833
+ if (!mutated)
834
+ return;
835
+ const tmpPath = join(swarmDir, `recovery.${randomBytes(6).toString("hex")}.tmp`);
836
+ await fsp.writeFile(tmpPath, JSON.stringify(snapshot, null, 2));
837
+ try {
838
+ await fsp.rename(tmpPath, snapshotPath);
839
+ }
840
+ catch (err) {
841
+ await fsp.unlink(tmpPath).catch(() => { });
842
+ throw err;
843
+ }
844
+ }
845
+ catch (err) {
846
+ log.warn({ err, swarmId }, "syncPlanStatusInRecoveryFile failed");
847
+ }
848
+ }
849
+ /**
850
+ * Compose the text body for a task_create / task_create_from_message
851
+ * response, appending up to two notices after the task JSON:
852
+ *
853
+ * - "ℹ Inferred planTaskId" — when caller didn't pass planTaskId but the
854
+ * subject prefix matched (so the queen can spot a wrong inference).
855
+ * - "⚠ Plan link warning" — when the swarm has a plan and either
856
+ * planTaskId is missing OR the supplied id isn't in the plan.
857
+ *
858
+ * Both notices are suppressed when planTaskId is supplied AND matches a
859
+ * plan node (the happy path).
860
+ *
861
+ * Degrades gracefully: if the swarm has no readable plan, the warning is
862
+ * suppressed too — we don't yell at queens for ad-hoc swarms.
863
+ */
864
+ async function appendPlanLinkAnnotations(baseText, opts) {
865
+ const notes = [];
866
+ if (opts.teamWarning) {
867
+ notes.push(opts.teamWarning);
868
+ }
869
+ if (!opts.explicitPlanTaskId && opts.inferredPlanTaskId) {
870
+ // Writeback semantics (reversal of PR#91 Fix 1C): the inferred id IS
871
+ // persisted on the task, so plan-sync finds it. Surface a ✅ note in
872
+ // the response so the queen can spot a wrong guess and re-issue
873
+ // task_create with an explicit planTaskId.
874
+ notes.push(`✅ 已从 subject 推断 planTaskId='${opts.inferredPlanTaskId}',已写入 store。若不正确请用 task_set_status 或重新创建。`);
875
+ }
876
+ if (opts.swarmId) {
877
+ const planIds = await readPlanTaskIds(opts.workDir, opts.swarmId, opts.context.rootDir);
878
+ if (planIds) {
879
+ // Effective planTaskId for warning purposes = explicit ?? inferred.
880
+ // Once inference is persisted, a successful infer should silence the
881
+ // "missing planTaskId" warning — the task IS linked.
882
+ const effective = opts.explicitPlanTaskId ?? opts.inferredPlanTaskId;
883
+ if (!effective) {
884
+ notes.push("⚠ Plan link warning: this task was not linked to any plan node (planTaskId 未传)。" +
885
+ " Plan progress UI 不会显示该 task。如果这是 plan 派生任务,请补传 planTaskId。");
886
+ }
887
+ else if (!planIds.has(effective)) {
888
+ const source = opts.explicitPlanTaskId ? "" : " (inferred from subject)";
889
+ notes.push(`⚠ Plan link warning: planTaskId '${effective}'${source} 未在 plan 中找到。` +
890
+ " 请确认 plan 节点 id 拼写是否正确。");
891
+ }
892
+ }
893
+ }
894
+ if (notes.length === 0)
895
+ return baseText;
896
+ return `${baseText}\n\n${notes.join("\n")}`;
897
+ }
610
898
  /**
611
899
  * Resolve the queen instance id for a swarm by reading the swarm snapshot
612
900
  * (`recovery.json`) from disk. Returns null when the snapshot is missing,