@rallycry/conveyor-agent 10.13.3 → 10.13.8

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.
@@ -196,6 +196,8 @@ var AgentConnection = class _AgentConnection {
196
196
  earlySpawnReviews = [];
197
197
  spawnTuiCallback = null;
198
198
  earlySpawnTuis = [];
199
+ probeUsageCallback = null;
200
+ earlyProbeUsage = false;
199
201
  // PTY relay (S5 terminal). Single-slot callbacks, set per PtySession run.
200
202
  ptyInputCallback = null;
201
203
  ptyResizeCallback = null;
@@ -407,6 +409,10 @@ var AgentConnection = class _AgentConnection {
407
409
  if (this.spawnTuiCallback) this.spawnTuiCallback(data);
408
410
  else this.earlySpawnTuis.push(data);
409
411
  });
412
+ this.socket.on("session:probeUsage", () => {
413
+ if (this.probeUsageCallback) this.probeUsageCallback();
414
+ else this.earlyProbeUsage = true;
415
+ });
410
416
  this.socket.on("session:finalizeSnapshot", () => {
411
417
  this.finalizeSnapshotCallback?.();
412
418
  });
@@ -667,6 +673,15 @@ var AgentConnection = class _AgentConnection {
667
673
  for (const data of this.earlySpawnTuis) callback(data);
668
674
  this.earlySpawnTuis = [];
669
675
  }
676
+ /** Register the on-demand usage-refresh handler; drains an early-buffered
677
+ * `session:probeUsage` that arrived before the runner was ready. */
678
+ onProbeUsage(callback) {
679
+ this.probeUsageCallback = callback;
680
+ if (this.earlyProbeUsage) {
681
+ this.earlyProbeUsage = false;
682
+ callback();
683
+ }
684
+ }
670
685
  /**
671
686
  * Report that a same-pod TUI/shell child failed to spawn (fire-and-forget).
672
687
  * The server Ends the orphaned session — no fallback pod (unlike review).
@@ -766,12 +781,13 @@ var AgentConnection = class _AgentConnection {
766
781
  });
767
782
  }
768
783
  }
769
- postChatMessage(content) {
784
+ postChatMessage(content, milestone) {
770
785
  if (!this.socket) return;
771
786
  if (this.suppressIfDuplicate(content)) return;
772
787
  void this.call("postAgentMessage", {
773
788
  sessionId: this.config.sessionId,
774
- content
789
+ content,
790
+ milestone
775
791
  }).catch(() => {
776
792
  });
777
793
  }
@@ -779,13 +795,14 @@ var AgentConnection = class _AgentConnection {
779
795
  // the message is acknowledged by the server before proceeding (e.g. before
780
796
  // aborting the session). Dedup still applies; a suppressed message resolves
781
797
  // immediately without hitting the wire.
782
- async postChatMessageAwait(content) {
798
+ async postChatMessageAwait(content, milestone) {
783
799
  if (!this.socket) return;
784
800
  if (this.suppressIfDuplicate(content)) return;
785
801
  try {
786
802
  await this.call("postAgentMessage", {
787
803
  sessionId: this.config.sessionId,
788
- content
804
+ content,
805
+ milestone
789
806
  });
790
807
  } catch (err) {
791
808
  process.stderr.write(
@@ -990,6 +1007,12 @@ ${q.question}${q.options.length ? "\n" + q.options.map((o) => `- ${o.label}: ${o
990
1007
  triggerIdentification() {
991
1008
  return this.call("triggerIdentification", { sessionId: this.config.sessionId });
992
1009
  }
1010
+ handoffToImplementer(payload) {
1011
+ return this.call("handoffToImplementer", {
1012
+ sessionId: this.config.sessionId,
1013
+ ...payload
1014
+ });
1015
+ }
993
1016
  async refreshAuthToken() {
994
1017
  const result = await this.refreshFromBootstrap();
995
1018
  return result.refreshedClaude;
@@ -2108,7 +2131,8 @@ var CreatePRInputSchema = z3.object({
2108
2131
  });
2109
2132
  var PostToChatInputSchema = z3.object({
2110
2133
  message: z3.string().min(1),
2111
- type: z3.enum(["message", "question", "update"]).optional().default("message")
2134
+ type: z3.enum(["message", "question", "update"]).optional().default("message"),
2135
+ milestone: z3.enum(["plan_ready", "implementation_complete", "blocked"]).optional()
2112
2136
  });
2113
2137
  var GetTaskContextRequestSchema = z3.object({
2114
2138
  sessionId: z3.string(),
@@ -2343,6 +2367,15 @@ var VoteSuggestionRequestSchema = z3.object({
2343
2367
  var TriggerIdentificationRequestSchema = z3.object({
2344
2368
  sessionId: z3.string()
2345
2369
  });
2370
+ var HandoffToImplementerRequestSchema = z3.object({
2371
+ sessionId: z3.string(),
2372
+ // Optional difficulty sizing — sets the task's story points before resolving
2373
+ // the matched implementer agent. Omit to hand off using the task's current
2374
+ // story points (or the project's default task agent when unsized).
2375
+ storyPoints: z3.number().int().positive().optional(),
2376
+ // Optional kickoff note posted to the task chat alongside the handoff notice.
2377
+ message: z3.string().optional()
2378
+ });
2346
2379
  var SubmitCodeReviewResultRequestSchema = z3.object({
2347
2380
  sessionId: z3.string(),
2348
2381
  approved: z3.boolean(),
@@ -2556,6 +2589,10 @@ var ListAccessibleProjectsRequestSchema = z4.object({
2556
2589
  var ListProjectTasksRequestSchema = z4.object({
2557
2590
  projectId: z4.string(),
2558
2591
  status: z4.string().optional(),
2592
+ // Card types to include. Omitted/empty → defaults to ["task"] in the handler
2593
+ // (mirrors searchProjectTasks) so listing doesn't surface incidents/suggestions
2594
+ // unless asked. Enum validation lives at the MCP tool layer.
2595
+ typeFilters: z4.array(z4.string()).optional(),
2559
2596
  assigneeId: z4.string().optional(),
2560
2597
  unassigned: z4.boolean().optional(),
2561
2598
  // Scope to a sub-project board when provided. Unlike the board layer's `?? null`
@@ -2596,6 +2633,9 @@ var GetProjectSummaryRequestSchema = z4.object({
2596
2633
  var GetProjectOnboardingStatusRequestSchema = z4.object({
2597
2634
  projectId: z4.string()
2598
2635
  });
2636
+ var GetProjectConnectUrlsRequestSchema = z4.object({
2637
+ projectId: z4.string()
2638
+ });
2599
2639
  var CreateProjectTaskRequestSchema = z4.object({
2600
2640
  projectId: z4.string(),
2601
2641
  title: z4.string().min(1),
@@ -2728,6 +2768,14 @@ var ResumeAdhocSessionRequestSchema = z4.object({
2728
2768
  workspaceId: z4.string(),
2729
2769
  requestingUserId: z4.string().optional()
2730
2770
  });
2771
+ var RefreshCodingAgentKeyUsageRequestSchema = z4.object({
2772
+ projectId: z4.string(),
2773
+ keyId: z4.string().optional(),
2774
+ requestingUserId: z4.string().optional()
2775
+ });
2776
+ var ListKeysToProbeRequestSchema = z4.object({
2777
+ sessionId: z4.string()
2778
+ });
2731
2779
  var CreateProjectReleaseRequestSchema = z4.object({
2732
2780
  projectId: z4.string(),
2733
2781
  taskIds: z4.array(z4.string()).optional(),
@@ -7493,9 +7541,12 @@ function buildPostToChatTool(connection) {
7493
7541
  "Post a message to the task chat for the team to see. Your turn output is NOT shown in chat, so this is the only way the team sees your status, summaries, and questions. Omit task_id to post to the current task's chat; pass a child's ID to message its chat.",
7494
7542
  {
7495
7543
  message: z9.string().describe("The message to post to the team"),
7496
- task_id: z9.string().optional().describe("Child task ID to post to. Omit to post to the current task's chat.")
7544
+ task_id: z9.string().optional().describe("Child task ID to post to. Omit to post to the current task's chat."),
7545
+ milestone: z9.enum(["plan_ready", "implementation_complete", "blocked"]).optional().describe(
7546
+ "Declare a narrative milestone instead of a routine update. Use SPARINGLY \u2014 only when the plan is ready, implementation is complete, or you are blocked. Milestones appear on the card's activity timeline and in Slack."
7547
+ )
7497
7548
  },
7498
- async ({ message, task_id }) => {
7549
+ async ({ message, task_id, milestone }) => {
7499
7550
  try {
7500
7551
  if (task_id) {
7501
7552
  await connection.call("postChildChatMessage", {
@@ -7516,7 +7567,7 @@ function buildPostToChatTool(connection) {
7516
7567
  })
7517
7568
  );
7518
7569
  }
7519
- await connection.call("postToChat", { message });
7570
+ await connection.call("postToChat", { message, milestone });
7520
7571
  return textResult(JSON.stringify({ posted: true }));
7521
7572
  } catch (error) {
7522
7573
  return textResult(
@@ -8096,6 +8147,36 @@ function buildUpdateTaskTool(connection) {
8096
8147
  }
8097
8148
  );
8098
8149
  }
8150
+ function buildHandoffTool(connection) {
8151
+ return defineTool(
8152
+ "handoff_to_agent",
8153
+ "Hand this task off to an implementer agent for the build phase \u2014 mid-conversation, same session, no restart. Call this once the plan is compiled and saved (update_task_plan). The server swaps this task to the difficulty-sized implementer agent (which may run at a different model level), announces the handoff in the activity log + chat, and switches you into build mode to start implementing. Size the work with the storyPoints arg (or set it first via update_task_properties). Returns the implementer's name + model.",
8154
+ {
8155
+ storyPoints: z12.number().int().positive().optional().describe(
8156
+ "Difficulty sizing (1=Common, 2=Magic, 3=Rare, 5=Unique, 8=Pack) \u2014 picks which implementer agent takes over. Omit to use the task's current story points."
8157
+ ),
8158
+ message: z12.string().optional().describe("Optional kickoff note posted to the chat alongside the handoff notice.")
8159
+ },
8160
+ async ({ storyPoints, message }) => {
8161
+ try {
8162
+ const result = await connection.handoffToImplementer({
8163
+ ...storyPoints !== void 0 && { storyPoints },
8164
+ ...message !== void 0 && { message }
8165
+ });
8166
+ if (!result.handedOff) {
8167
+ return textResult(`Handoff did not complete: ${result.reason ?? "unknown reason"}`);
8168
+ }
8169
+ return textResult(
8170
+ `Handed off to ${result.agentName} (${result.model}). Now in build mode \u2014 start implementing the plan.`
8171
+ );
8172
+ } catch (error) {
8173
+ return textResult(
8174
+ `Failed to hand off: ${error instanceof Error ? error.message : "Unknown error"}`
8175
+ );
8176
+ }
8177
+ }
8178
+ );
8179
+ }
8099
8180
  function buildCreateSubtaskTool(connection) {
8100
8181
  return defineTool(
8101
8182
  "create_subtask",
@@ -8513,12 +8594,14 @@ function buildConveyorTools(connection, config, context, agentMode) {
8513
8594
  const modeTools = getModeTools(effectiveMode, connection, config, context);
8514
8595
  const discoveryTools = effectiveMode === "discovery" || effectiveMode === "auto" || effectiveMode === "building" || effectiveMode === "chat" ? buildDiscoveryTools(connection) : [];
8515
8596
  const codeReviewTools = effectiveMode === "review" ? buildCodeReviewTools(connection) : [];
8597
+ const handoffTools = config.mode === "pm" && (effectiveMode === "discovery" || effectiveMode === "auto") ? [buildHandoffTool(connection)] : [];
8516
8598
  const emergencyTools = [buildForceUpdateTaskStatusTool(connection)];
8517
8599
  const tools = withAlwaysLoad([
8518
8600
  ...commonTools,
8519
8601
  ...modeTools,
8520
8602
  ...discoveryTools,
8521
8603
  ...codeReviewTools,
8604
+ ...handoffTools,
8522
8605
  ...emergencyTools
8523
8606
  ]);
8524
8607
  if (effectiveMode === "chat") {
@@ -10504,7 +10587,7 @@ async function runUsageProbe(deps = {}) {
10504
10587
  cols: 120,
10505
10588
  rows: 45,
10506
10589
  cwd,
10507
- env: buildProbeEnv()
10590
+ env: buildProbeEnv(deps.env)
10508
10591
  });
10509
10592
  } catch {
10510
10593
  resolve("");
@@ -12025,6 +12108,8 @@ export {
12025
12108
  Lifecycle,
12026
12109
  defineTool,
12027
12110
  cleanTerminalOutput,
12111
+ buildSynthesizedCredentials,
12112
+ claudeJsonPath,
12028
12113
  loadPtySpawn,
12029
12114
  inheritedEnv,
12030
12115
  buildPromptBytes,
@@ -12044,6 +12129,8 @@ export {
12044
12129
  findOnPath,
12045
12130
  resolvePlaywrightMcpServer,
12046
12131
  resolveSessionStart,
12132
+ parseUsageGauges,
12133
+ runUsageProbe,
12047
12134
  sampleKeyUsage,
12048
12135
  awaitGitReady,
12049
12136
  PortDiscovery,
@@ -12063,4 +12150,4 @@ export {
12063
12150
  runStartCommand,
12064
12151
  unshallowRepo
12065
12152
  };
12066
- //# sourceMappingURL=chunk-P4VWWR5O.js.map
12153
+ //# sourceMappingURL=chunk-AJZIO5QI.js.map