agenthub-multiagent-mcp 1.61.0 → 1.65.0

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.
Files changed (131) hide show
  1. package/README.md +3 -3
  2. package/dist/brain/memvidBrain.d.ts +22 -0
  3. package/dist/brain/memvidBrain.d.ts.map +1 -1
  4. package/dist/brain/memvidBrain.js +41 -2
  5. package/dist/brain/memvidBrain.js.map +1 -1
  6. package/dist/brain/memvidBrain.test.js +90 -0
  7. package/dist/brain/memvidBrain.test.js.map +1 -1
  8. package/dist/brain/migrate.d.ts +43 -0
  9. package/dist/brain/migrate.d.ts.map +1 -1
  10. package/dist/brain/migrate.js +148 -23
  11. package/dist/brain/migrate.js.map +1 -1
  12. package/dist/brain/migrate.test.js +194 -1
  13. package/dist/brain/migrate.test.js.map +1 -1
  14. package/dist/channel.js +47 -5
  15. package/dist/channel.js.map +1 -1
  16. package/dist/channelDiagnostics.d.ts +36 -0
  17. package/dist/channelDiagnostics.d.ts.map +1 -1
  18. package/dist/channelDiagnostics.js +65 -0
  19. package/dist/channelDiagnostics.js.map +1 -1
  20. package/dist/channelDiagnostics.test.js +81 -1
  21. package/dist/channelDiagnostics.test.js.map +1 -1
  22. package/dist/client.d.ts +17 -0
  23. package/dist/client.d.ts.map +1 -1
  24. package/dist/client.js +32 -0
  25. package/dist/client.js.map +1 -1
  26. package/dist/daemon.js +16 -22
  27. package/dist/daemon.js.map +1 -1
  28. package/dist/index.js +36 -3
  29. package/dist/index.js.map +1 -1
  30. package/dist/lib/pending-items.d.ts +63 -0
  31. package/dist/lib/pending-items.d.ts.map +1 -0
  32. package/dist/lib/pending-items.js +96 -0
  33. package/dist/lib/pending-items.js.map +1 -0
  34. package/dist/pinSweep.d.ts +83 -0
  35. package/dist/pinSweep.d.ts.map +1 -0
  36. package/dist/pinSweep.js +105 -0
  37. package/dist/pinSweep.js.map +1 -0
  38. package/dist/pinSweep.test.d.ts +12 -0
  39. package/dist/pinSweep.test.d.ts.map +1 -0
  40. package/dist/pinSweep.test.js +110 -0
  41. package/dist/pinSweep.test.js.map +1 -0
  42. package/dist/pinSweepCli.d.ts +20 -0
  43. package/dist/pinSweepCli.d.ts.map +1 -0
  44. package/dist/pinSweepCli.js +287 -0
  45. package/dist/pinSweepCli.js.map +1 -0
  46. package/dist/run-claude.sh +36 -5
  47. package/dist/sessionCapture.d.ts.map +1 -1
  48. package/dist/sessionCapture.js +7 -1
  49. package/dist/sessionCapture.js.map +1 -1
  50. package/dist/sessionCapture.test.js +20 -0
  51. package/dist/sessionCapture.test.js.map +1 -1
  52. package/dist/setup.js +11 -0
  53. package/dist/setup.js.map +1 -1
  54. package/dist/shiftFiles.d.ts +33 -0
  55. package/dist/shiftFiles.d.ts.map +1 -0
  56. package/dist/shiftFiles.js +57 -0
  57. package/dist/shiftFiles.js.map +1 -0
  58. package/dist/shiftFiles.test.d.ts +2 -0
  59. package/dist/shiftFiles.test.d.ts.map +1 -0
  60. package/dist/shiftFiles.test.js +141 -0
  61. package/dist/shiftFiles.test.js.map +1 -0
  62. package/dist/skillInstaller.d.ts.map +1 -1
  63. package/dist/skillInstaller.gate.test.js +2 -0
  64. package/dist/skillInstaller.gate.test.js.map +1 -1
  65. package/dist/skillInstaller.js +8 -0
  66. package/dist/skillInstaller.js.map +1 -1
  67. package/dist/skillInstaller.test.js +8 -1
  68. package/dist/skillInstaller.test.js.map +1 -1
  69. package/dist/tools/goshtiRead.d.ts +72 -0
  70. package/dist/tools/goshtiRead.d.ts.map +1 -0
  71. package/dist/tools/goshtiRead.js +274 -0
  72. package/dist/tools/goshtiRead.js.map +1 -0
  73. package/dist/tools/goshtiRead.test.d.ts +8 -0
  74. package/dist/tools/goshtiRead.test.d.ts.map +1 -0
  75. package/dist/tools/goshtiRead.test.js +182 -0
  76. package/dist/tools/goshtiRead.test.js.map +1 -0
  77. package/dist/tools/inboxBounds.d.ts +80 -0
  78. package/dist/tools/inboxBounds.d.ts.map +1 -0
  79. package/dist/tools/inboxBounds.js +105 -0
  80. package/dist/tools/inboxBounds.js.map +1 -0
  81. package/dist/tools/inboxBounds.test.d.ts +15 -0
  82. package/dist/tools/inboxBounds.test.d.ts.map +1 -0
  83. package/dist/tools/inboxBounds.test.js +135 -0
  84. package/dist/tools/inboxBounds.test.js.map +1 -0
  85. package/dist/tools/index.d.ts +11 -0
  86. package/dist/tools/index.d.ts.map +1 -1
  87. package/dist/tools/index.js +106 -102
  88. package/dist/tools/index.js.map +1 -1
  89. package/dist/tools/intakeRequests.d.ts +35 -0
  90. package/dist/tools/intakeRequests.d.ts.map +1 -0
  91. package/dist/tools/intakeRequests.js +344 -0
  92. package/dist/tools/intakeRequests.js.map +1 -0
  93. package/dist/tools/intakeRequests.test.d.ts +8 -0
  94. package/dist/tools/intakeRequests.test.d.ts.map +1 -0
  95. package/dist/tools/intakeRequests.test.js +183 -0
  96. package/dist/tools/intakeRequests.test.js.map +1 -0
  97. package/dist/tools/openspec-viz/taskSync.d.ts +115 -0
  98. package/dist/tools/openspec-viz/taskSync.d.ts.map +1 -0
  99. package/dist/tools/openspec-viz/taskSync.js +144 -0
  100. package/dist/tools/openspec-viz/taskSync.js.map +1 -0
  101. package/dist/tools/openspec-viz/taskSync.test.d.ts +2 -0
  102. package/dist/tools/openspec-viz/taskSync.test.d.ts.map +1 -0
  103. package/dist/tools/openspec-viz/taskSync.test.js +198 -0
  104. package/dist/tools/openspec-viz/taskSync.test.js.map +1 -0
  105. package/dist/tools/pushedItemsSafety.test.d.ts +12 -0
  106. package/dist/tools/pushedItemsSafety.test.d.ts.map +1 -0
  107. package/dist/tools/pushedItemsSafety.test.js +179 -0
  108. package/dist/tools/pushedItemsSafety.test.js.map +1 -0
  109. package/dist/tools/tools.test.js +17 -5
  110. package/dist/tools/tools.test.js.map +1 -1
  111. package/dist/tools/wrapperCost.test.d.ts +13 -0
  112. package/dist/tools/wrapperCost.test.d.ts.map +1 -0
  113. package/dist/tools/wrapperCost.test.js +149 -0
  114. package/dist/tools/wrapperCost.test.js.map +1 -0
  115. package/dist/websocket.d.ts +30 -1
  116. package/dist/websocket.d.ts.map +1 -1
  117. package/dist/websocket.js +40 -3
  118. package/dist/websocket.js.map +1 -1
  119. package/dist/websocketQueue.test.d.ts +10 -0
  120. package/dist/websocketQueue.test.d.ts.map +1 -0
  121. package/dist/websocketQueue.test.js +78 -0
  122. package/dist/websocketQueue.test.js.map +1 -0
  123. package/package.json +4 -4
  124. package/skills/catalog.json +23 -10
  125. package/skills/commands/close-session.md +144 -144
  126. package/skills/commands/start-session.md +25 -6
  127. package/skills/manifest.json +8 -1
  128. package/skills/skills/code-brain-hook/SKILL.md +61 -61
  129. package/skills/skills/file-bug/SKILL.md +75 -75
  130. package/skills/skills/inbox/SKILL.md +99 -0
  131. package/skills/skills/multiagent-brainstorm/SKILL.md +164 -164
@@ -2,6 +2,7 @@
2
2
  * MCP tool definitions and handlers
3
3
  */
4
4
  import { resolveAgentIdentity, missingStateGuidance, credentialIsDead, } from "../agentIdentity.js";
5
+ import { boundInbox, resolveInboxLimit, CHECK_INBOX_DEFAULT_LIMIT, CHECK_INBOX_MAX_LIMIT, } from "./inboxBounds.js";
5
6
  import * as state from "../state.js";
6
7
  import * as contextModule from "../context.js";
7
8
  import { hookManager } from "../hooks/index.js";
@@ -9,9 +10,13 @@ import * as brainCapture from "../hooks/brainCapture.js";
9
10
  import { getBrain } from "../brain/backend.js";
10
11
  import open from "open";
11
12
  import { registerOpenSpecVizTools, handleOpenSpecVizToolCall } from "./openspec-viz/index.js";
13
+ import { syncTaskGroups, describeTaskSync } from "./openspec-viz/taskSync.js";
14
+ import { registerIntakeRequestTools, handleIntakeRequestToolCall, isIntakeRequestTool, } from "./intakeRequests.js";
12
15
  import { registerSessionControlTools, handleSessionControlToolCall, isSessionControlTool, } from "./sessionControl.js";
16
+ import { registerGoshtiReadTools, handleGoshtiReadToolCall, isGoshtiReadTool, } from "./goshtiRead.js";
13
17
  import { installPackFromArchive } from "../skillPackInstaller.js";
14
18
  import { getServerTime, useTimeInjection } from "../lib/server-time.js";
19
+ import { getPendingItems } from "../lib/pending-items.js";
15
20
  import { ENG_IC_CHARTER } from "../employee.js";
16
21
  import { promises as fsp } from "node:fs";
17
22
  import * as os from "node:os";
@@ -78,16 +83,23 @@ async function wrapWithPendingItems(client, agentId, result, context) {
78
83
  if (!agentId)
79
84
  return result;
80
85
  try {
81
- // Get items pushed via WebSocket (if connected)
82
- const pushedItems = context?.getPushedItems() || { tasks: [], messages: [] };
83
- // Fetch unread messages and pending tasks in parallel
84
- const [inbox, tasksResponse] = await Promise.all([
85
- client.getInbox(agentId, true, 10),
86
- client.getPendingTasks(agentId),
87
- ]);
88
- // Merge pushed items with fetched items (deduplicating by ID)
89
- const fetchedMessages = inbox.messages || [];
90
- const fetchedTasks = (tasksResponse.tasks || []);
86
+ // Read items pushed via WebSocket WITHOUT consuming them
87
+ // (fix-inbox-delivery-and-tool-wrapping §2.3). The old code drained the
88
+ // queue here, before the two fetches below — so a fetch that threw or timed
89
+ // out sent us to the catch with those messages already gone. They are
90
+ // consumed at the bottom of this function, once a response exists to carry
91
+ // them. peekPushedItems is optional on the context so older callers (and
92
+ // tests constructing a partial context) keep working.
93
+ const pushedItems = context?.peekPushedItems?.() ??
94
+ context?.getPushedItems?.() ?? { tasks: [], messages: [] };
95
+ // Read pending items from cache; never wait on the network
96
+ // (fix-inbox-delivery-and-tool-wrapping §3.2). This used to await two HTTP
97
+ // calls on every one of the 58 wrapped tools, each with a 45s deadline, so
98
+ // an unrelated tool could stall ~90s before doing its own work. A refresh
99
+ // now runs in the background and a cold cache simply carries nothing.
100
+ const cachedItems = getPendingItems(client, agentId);
101
+ const fetchedMessages = cachedItems.messages;
102
+ const fetchedTasks = cachedItems.tasks;
91
103
  // Deduplicate messages
92
104
  const messageIds = new Set(fetchedMessages.map((m) => m.id));
93
105
  const messages = [
@@ -128,7 +140,7 @@ async function wrapWithPendingItems(client, agentId, result, context) {
128
140
  urgentAction = {
129
141
  required: true,
130
142
  instruction: buildUrgentInstruction(urgentMsg),
131
- message: urgentMsg,
143
+ message_id: urgentMsg.id,
132
144
  };
133
145
  }
134
146
  }
@@ -148,10 +160,20 @@ async function wrapWithPendingItems(client, agentId, result, context) {
148
160
  console.warn("server_time injection failed:", err);
149
161
  }
150
162
  }
163
+ // The response now exists and carries these items, so they may be consumed
164
+ // (§2.3). Only the ids we actually peeked are named: anything pushed since
165
+ // then stays queued for the next tool call rather than being cleared away
166
+ // unseen. Reaching the catch above consumes nothing, which is the whole
167
+ // point of the split.
168
+ context?.commitPushedItems?.({
169
+ taskIds: pushedItems.tasks.map((t) => t.id),
170
+ messageIds: pushedItems.messages.map((m) => m.id),
171
+ });
151
172
  return wrapped;
152
173
  }
153
174
  catch (error) {
154
- // Don't break tool call if fetch fails
175
+ // Don't break tool call if fetch fails. Pushed items were only peeked, so
176
+ // they are still queued and will be delivered by the next call.
155
177
  console.warn("Failed to fetch pending items for wrapping:", error);
156
178
  return result;
157
179
  }
@@ -167,13 +189,16 @@ function isUrgentMessage(msg) {
167
189
  * Build instruction text for urgent messages
168
190
  */
169
191
  function buildUrgentInstruction(msg) {
192
+ // No body here (fix-inbox-delivery-and-tool-wrapping §3.4). Interpolating
193
+ // ${msg.body} made this the second of three copies of the same text in one
194
+ // response — the others being pending_messages[] and urgent_action.message.
195
+ // The instruction's job is to say what to do and which message to do it
196
+ // about; the body is one lookup away in pending_messages.
170
197
  return `URGENT: Agent [${msg.from_agent}] needs immediate assistance.
171
198
 
172
199
  Query: ${msg.subject}
173
200
 
174
- Details: ${msg.body}
175
-
176
- Spawn a subagent with Task tool to research and respond to this query. Use send_message to reply when done.`;
201
+ The full message is in this response's pending_messages[], id ${msg.id}. Read it there, then reply with the reply tool (message_id ${msg.id}).`;
177
202
  }
178
203
  /**
179
204
  * Build instruction text for pending tasks
@@ -690,7 +715,12 @@ export function registerTools() {
690
715
  },
691
716
  {
692
717
  name: "check_inbox",
693
- description: "Check for incoming messages",
718
+ description: "Check for incoming messages. The response is bounded: it carries " +
719
+ "`total`, `returned`, `omitted_count` and `truncated`, and a clipped " +
720
+ "body carries `_truncated.original_bytes`. When `truncated` is true you " +
721
+ "did NOT receive everything — do not mark_read anything you did not " +
722
+ "actually read, or it becomes invisible to everyone (unread_only never " +
723
+ "returns a read message again). Page with `limit` instead.",
694
724
  inputSchema: {
695
725
  type: "object",
696
726
  properties: {
@@ -698,6 +728,13 @@ export function registerTools() {
698
728
  type: "boolean",
699
729
  description: "Only return unread messages (default: false)",
700
730
  },
731
+ limit: {
732
+ type: "number",
733
+ description: `Max messages to return (default: ${CHECK_INBOX_DEFAULT_LIMIT}, ` +
734
+ `max: ${CHECK_INBOX_MAX_LIMIT}). Values above the max are clamped; ` +
735
+ `0, negative and non-numeric values take the default — there is no ` +
736
+ `way to request an unbounded inbox.`,
737
+ },
701
738
  },
702
739
  },
703
740
  },
@@ -2116,6 +2153,10 @@ export function registerTools() {
2116
2153
  },
2117
2154
  // Session steering + takeover (add-multiplayer-sessions §4.7, §5.9)
2118
2155
  ...registerSessionControlTools(),
2156
+ // Intake requests: file, triage, scope check (add-intake-requests §6.1)
2157
+ ...registerIntakeRequestTools(),
2158
+ // Reading Goshti as the agent's owner (add-agent-goshti-read §3.1)
2159
+ ...registerGoshtiReadTools(),
2119
2160
  // OpenSpec Visualizer tools
2120
2161
  ...registerOpenSpecVizTools(),
2121
2162
  // Intel layer tools (§2.5 — read-only MCP surface for intel.search + source catalog)
@@ -3006,6 +3047,18 @@ export async function handleToolCall(name, args, client, context) {
3006
3047
  if (isSessionControlTool(name)) {
3007
3048
  return handleSessionControlToolCall(name, args, client);
3008
3049
  }
3050
+ // Intake requests (add-intake-requests §6.1). Same module pattern: the module
3051
+ // owns its tool names and turns refusals into structured results.
3052
+ if (isIntakeRequestTool(name)) {
3053
+ return handleIntakeRequestToolCall(name, args, client, () => state.loadState(context.getWorkingDir())?.project_id);
3054
+ }
3055
+ // Goshti reads (add-agent-goshti-read §3.1). Same module pattern. The owner's
3056
+ // grant, the per-agent switch and the fixed tool list are all the server's
3057
+ // decisions; this only shapes the call and labels the answer as other
3058
+ // people's words.
3059
+ if (isGoshtiReadTool(name)) {
3060
+ return handleGoshtiReadToolCall(name, args, client);
3061
+ }
3009
3062
  switch (name) {
3010
3063
  // Registration
3011
3064
  case "agent_register": {
@@ -3682,10 +3735,19 @@ export async function handleToolCall(name, args, client, context) {
3682
3735
  return wrapWithPendingItems(client, agentId, result, context);
3683
3736
  }
3684
3737
  case "check_inbox": {
3685
- // No wrapping - already fetching messages
3738
+ // No wrapping - already fetching messages.
3739
+ //
3740
+ // The limit is explicit (fix-inbox-delivery-and-tool-wrapping §1.2).
3741
+ // Omitting it let the server apply its own default of 50 full-bodied
3742
+ // messages; one such response measured 115,769 characters, exceeded the
3743
+ // tool-result token budget and never reached the model at all. boundInbox
3744
+ // then declares anything it withheld, so a caller can never acknowledge
3745
+ // messages it did not actually receive.
3686
3746
  if (!agentId)
3687
3747
  throw new Error("Not registered. Call agent_register first.");
3688
- return client.getInbox(agentId, args.unread_only);
3748
+ const inboxLimit = resolveInboxLimit(args.limit);
3749
+ const raw = await client.getInbox(agentId, args.unread_only, inboxLimit);
3750
+ return boundInbox(raw);
3689
3751
  }
3690
3752
  case "mark_read": {
3691
3753
  const result = await client.markRead(args.message_id);
@@ -4689,89 +4751,29 @@ export async function handleToolCall(name, args, client, context) {
4689
4751
  catch {
4690
4752
  // Non-fatal if cleanup fails
4691
4753
  }
4692
- // 5. Sync tasks to ticket system (create Stories + Tasks from spec task groups)
4693
- let taskSyncResult;
4754
+ // 5. Sync tasks to ticket system (create Stories + Tasks from spec task groups).
4755
+ // The sync reports its own outcome. It used to be wrapped in a bare
4756
+ // `catch` here, which made a crashed sync byte-identical to one that
4757
+ // was never requested — the hierarchy was then discovered to be
4758
+ // missing only by independently listing the epic's children
4759
+ // (AGHUB-1469).
4694
4760
  const publishAgentState = workingDir ? state.loadState(workingDir) : undefined;
4695
- if (publishResult.sync_tasks && publishResult.taskGroups.length > 0 && publishAgentState?.project_id) {
4696
- taskSyncResult = { storiesCreated: 0, tasksCreated: 0, storiesSkipped: 0, tasksSkipped: 0 };
4761
+ const taskSyncOutcome = await syncTaskGroups({
4762
+ client,
4763
+ projectId: publishAgentState?.project_id ?? "",
4764
+ taskGroups: publishResult.taskGroups,
4765
+ ticketType: publishResult.ticket_type,
4766
+ ticketId: publishResult.ticket_id,
4697
4767
  // The change id is the input arg `id` — in change/diff modes that's
4698
- // the openspec change name. Stamp newly-created stories and tasks
4699
- // with it so the hierarchy resolver can find them.
4700
- const changeID = typeof args.id === "string" ? args.id : undefined;
4701
- try {
4702
- // Get existing stories to detect duplicates
4703
- const existingStories = await client.listProjectStories(publishAgentState.project_id);
4704
- const storyTitleMap = new Map(); // title → id
4705
- for (const s of existingStories.stories || []) {
4706
- storyTitleMap.set(s.title.toLowerCase().trim(), s.id);
4707
- }
4708
- for (const group of publishResult.taskGroups) {
4709
- const groupTitle = group.title.trim();
4710
- if (!groupTitle)
4711
- continue;
4712
- // Create or find story for this task group
4713
- let storyId;
4714
- const existingStoryId = storyTitleMap.get(groupTitle.toLowerCase());
4715
- if (existingStoryId) {
4716
- storyId = existingStoryId;
4717
- taskSyncResult.storiesSkipped++;
4718
- }
4719
- else {
4720
- const storyResult = await client.createStory({
4721
- project_id: publishAgentState.project_id,
4722
- epic_id: publishResult.ticket_type === "epic" ? publishResult.ticket_id : undefined,
4723
- title: groupTitle,
4724
- labels: ["openspec-sync"],
4725
- openspec_change_id: changeID,
4726
- });
4727
- storyId = storyResult.id;
4728
- storyTitleMap.set(groupTitle.toLowerCase(), storyId);
4729
- taskSyncResult.storiesCreated++;
4730
- }
4731
- // Get existing tasks for this story — map titles to ticket info for dedup + mapping
4732
- const existingTasks = await client.listProjectTasks(publishAgentState.project_id, storyId);
4733
- const taskInfoMap = new Map();
4734
- for (const t of existingTasks.tasks || []) {
4735
- taskInfoMap.set(t.title.toLowerCase().trim(), { id: t.id, key: t.key });
4736
- }
4737
- // Create tasks for each item in the group
4738
- for (const task of group.tasks) {
4739
- const taskTitle = task.text.trim();
4740
- if (!taskTitle)
4741
- continue;
4742
- const existingTask = taskInfoMap.get(taskTitle.toLowerCase());
4743
- if (existingTask) {
4744
- // Store the ticket mapping even for skipped (existing) tasks
4745
- task.ticket_id = existingTask.id;
4746
- task.ticket_key = existingTask.key;
4747
- taskSyncResult.tasksSkipped++;
4748
- continue;
4749
- }
4750
- const createdTask = await client.createTask({
4751
- project_id: publishAgentState.project_id,
4752
- story_id: storyId,
4753
- title: taskTitle,
4754
- labels: ["openspec-sync"],
4755
- });
4756
- // Store the ticket mapping for the newly created task. Tasks
4757
- // created here go through story_id, so the discriminated
4758
- // result is always ok:true; ignore the !ok branch silently
4759
- // (the outer try/catch will swallow truly unexpected errors).
4760
- if (createdTask.ok) {
4761
- task.ticket_id = createdTask.id;
4762
- task.ticket_key = createdTask.key;
4763
- taskSyncResult.tasksCreated++;
4764
- }
4765
- }
4766
- }
4767
- }
4768
- catch {
4769
- // Task sync failure is non-fatal
4770
- taskSyncResult = undefined;
4771
- }
4772
- }
4773
- // 6. Re-upload JSON with ticket ID mappings if task sync produced mappings
4774
- if (taskSyncResult) {
4768
+ // the openspec change name. Stamp newly-created stories with it so the
4769
+ // hierarchy resolver can find them.
4770
+ changeId: typeof args.id === "string" ? args.id : undefined,
4771
+ enabled: publishResult.sync_tasks,
4772
+ });
4773
+ // 6. Re-upload JSON with ticket ID mappings if task sync produced mappings.
4774
+ // A failed sync may still have mapped part of the hierarchy, so the
4775
+ // mappings it did write are preserved rather than discarded.
4776
+ if (taskSyncOutcome.status !== "skipped") {
4775
4777
  try {
4776
4778
  const fs = await import("fs");
4777
4779
  // Update the parsed JSON object's tasks with ticket mappings
@@ -4807,9 +4809,11 @@ export async function handleToolCall(name, args, client, context) {
4807
4809
  sections: publishResult.sections,
4808
4810
  requirementCount: publishResult.requirementCount,
4809
4811
  gapCount: publishResult.gapCount,
4810
- taskSync: taskSyncResult,
4811
- message: `Published OpenSpec to ${publishResult.ticket_key} (HTML + JSON, ${publishResult.requirementCount} requirements)` +
4812
- (taskSyncResult ? `. Task sync: ${taskSyncResult.storiesCreated} stories + ${taskSyncResult.tasksCreated} tasks created (${taskSyncResult.storiesSkipped + taskSyncResult.tasksSkipped} skipped as duplicates)` : ""),
4812
+ taskSync: taskSyncOutcome,
4813
+ // Always stated, so a caller reading only the message can tell a
4814
+ // successful sync from a failed or skipped one.
4815
+ message: `Published OpenSpec to ${publishResult.ticket_key} (HTML + JSON, ${publishResult.requirementCount} requirements). ` +
4816
+ describeTaskSync(taskSyncOutcome),
4813
4817
  }, context);
4814
4818
  }
4815
4819
  // Plan Review tools