@rallycry/conveyor-agent 10.13.1 → 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;
@@ -1920,7 +1943,7 @@ var DEFAULT_RISK_LEVELS = [
1920
1943
  {
1921
1944
  level: "high",
1922
1945
  value: 3,
1923
- label: "High",
1946
+ label: "Elevated",
1924
1947
  description: "Touches important surface area; review carefully.",
1925
1948
  color: "#ea580c",
1926
1949
  ordinal: 1
@@ -1928,7 +1951,7 @@ var DEFAULT_RISK_LEVELS = [
1928
1951
  {
1929
1952
  level: "medium",
1930
1953
  value: 2,
1931
- label: "Medium",
1954
+ label: "Moderate",
1932
1955
  description: "Moderate surface area; normal review.",
1933
1956
  color: "#d97706",
1934
1957
  ordinal: 2
@@ -1936,13 +1959,15 @@ var DEFAULT_RISK_LEVELS = [
1936
1959
  {
1937
1960
  level: "low",
1938
1961
  value: 1,
1939
- label: "Low",
1962
+ label: "Minimal",
1940
1963
  description: "Small or isolated surface area.",
1941
1964
  color: "#64748b",
1942
1965
  ordinal: 3
1943
1966
  }
1944
1967
  ];
1945
- var LEVEL_BY_VALUE = new Map(DEFAULT_RISK_LEVELS.map((m) => [m.value, m.level]));
1968
+ var LEVEL_BY_VALUE = new Map(
1969
+ DEFAULT_RISK_LEVELS.map((m) => [m.value, m.level])
1970
+ );
1946
1971
  var ACTIVE_WORK_STATUSES = [
1947
1972
  "InProgress",
1948
1973
  "ReviewPR",
@@ -2106,7 +2131,8 @@ var CreatePRInputSchema = z3.object({
2106
2131
  });
2107
2132
  var PostToChatInputSchema = z3.object({
2108
2133
  message: z3.string().min(1),
2109
- 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()
2110
2136
  });
2111
2137
  var GetTaskContextRequestSchema = z3.object({
2112
2138
  sessionId: z3.string(),
@@ -2341,6 +2367,15 @@ var VoteSuggestionRequestSchema = z3.object({
2341
2367
  var TriggerIdentificationRequestSchema = z3.object({
2342
2368
  sessionId: z3.string()
2343
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
+ });
2344
2379
  var SubmitCodeReviewResultRequestSchema = z3.object({
2345
2380
  sessionId: z3.string(),
2346
2381
  approved: z3.boolean(),
@@ -2554,6 +2589,10 @@ var ListAccessibleProjectsRequestSchema = z4.object({
2554
2589
  var ListProjectTasksRequestSchema = z4.object({
2555
2590
  projectId: z4.string(),
2556
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(),
2557
2596
  assigneeId: z4.string().optional(),
2558
2597
  unassigned: z4.boolean().optional(),
2559
2598
  // Scope to a sub-project board when provided. Unlike the board layer's `?? null`
@@ -2594,6 +2633,9 @@ var GetProjectSummaryRequestSchema = z4.object({
2594
2633
  var GetProjectOnboardingStatusRequestSchema = z4.object({
2595
2634
  projectId: z4.string()
2596
2635
  });
2636
+ var GetProjectConnectUrlsRequestSchema = z4.object({
2637
+ projectId: z4.string()
2638
+ });
2597
2639
  var CreateProjectTaskRequestSchema = z4.object({
2598
2640
  projectId: z4.string(),
2599
2641
  title: z4.string().min(1),
@@ -2726,6 +2768,14 @@ var ResumeAdhocSessionRequestSchema = z4.object({
2726
2768
  workspaceId: z4.string(),
2727
2769
  requestingUserId: z4.string().optional()
2728
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
+ });
2729
2779
  var CreateProjectReleaseRequestSchema = z4.object({
2730
2780
  projectId: z4.string(),
2731
2781
  taskIds: z4.array(z4.string()).optional(),
@@ -3757,9 +3807,9 @@ function stringField2(record, ...keys) {
3757
3807
  function truncate(text, max) {
3758
3808
  return text.length > max ? `${text.slice(0, max)}\u2026` : text;
3759
3809
  }
3760
- function isCommandWrapperText(text) {
3810
+ function isNonConversationText(text) {
3761
3811
  const trimmed = text.trimStart();
3762
- return trimmed.startsWith("<command-name>") || trimmed.startsWith("<local-command-");
3812
+ return trimmed.startsWith("<command-name>") || trimmed.startsWith("<local-command-") || trimmed.startsWith("<task-notification>");
3763
3813
  }
3764
3814
  function mapSystem2(record) {
3765
3815
  if (record.subtype === "init") {
@@ -3841,7 +3891,7 @@ function mapUser(record) {
3841
3891
  return [];
3842
3892
  }
3843
3893
  const trimmed = text.trim();
3844
- if (trimmed.length === 0 || isCommandWrapperText(trimmed)) return [];
3894
+ if (trimmed.length === 0 || isNonConversationText(trimmed)) return [];
3845
3895
  return [{ kind: "user_text", text: truncate(trimmed, TEXT_MAX) }];
3846
3896
  }
3847
3897
  function mapChatRecords(raw) {
@@ -7491,9 +7541,12 @@ function buildPostToChatTool(connection) {
7491
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.",
7492
7542
  {
7493
7543
  message: z9.string().describe("The message to post to the team"),
7494
- 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
+ )
7495
7548
  },
7496
- async ({ message, task_id }) => {
7549
+ async ({ message, task_id, milestone }) => {
7497
7550
  try {
7498
7551
  if (task_id) {
7499
7552
  await connection.call("postChildChatMessage", {
@@ -7514,7 +7567,7 @@ function buildPostToChatTool(connection) {
7514
7567
  })
7515
7568
  );
7516
7569
  }
7517
- await connection.call("postToChat", { message });
7570
+ await connection.call("postToChat", { message, milestone });
7518
7571
  return textResult(JSON.stringify({ posted: true }));
7519
7572
  } catch (error) {
7520
7573
  return textResult(
@@ -8094,6 +8147,36 @@ function buildUpdateTaskTool(connection) {
8094
8147
  }
8095
8148
  );
8096
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
+ }
8097
8180
  function buildCreateSubtaskTool(connection) {
8098
8181
  return defineTool(
8099
8182
  "create_subtask",
@@ -8511,12 +8594,14 @@ function buildConveyorTools(connection, config, context, agentMode) {
8511
8594
  const modeTools = getModeTools(effectiveMode, connection, config, context);
8512
8595
  const discoveryTools = effectiveMode === "discovery" || effectiveMode === "auto" || effectiveMode === "building" || effectiveMode === "chat" ? buildDiscoveryTools(connection) : [];
8513
8596
  const codeReviewTools = effectiveMode === "review" ? buildCodeReviewTools(connection) : [];
8597
+ const handoffTools = config.mode === "pm" && (effectiveMode === "discovery" || effectiveMode === "auto") ? [buildHandoffTool(connection)] : [];
8514
8598
  const emergencyTools = [buildForceUpdateTaskStatusTool(connection)];
8515
8599
  const tools = withAlwaysLoad([
8516
8600
  ...commonTools,
8517
8601
  ...modeTools,
8518
8602
  ...discoveryTools,
8519
8603
  ...codeReviewTools,
8604
+ ...handoffTools,
8520
8605
  ...emergencyTools
8521
8606
  ]);
8522
8607
  if (effectiveMode === "chat") {
@@ -10502,7 +10587,7 @@ async function runUsageProbe(deps = {}) {
10502
10587
  cols: 120,
10503
10588
  rows: 45,
10504
10589
  cwd,
10505
- env: buildProbeEnv()
10590
+ env: buildProbeEnv(deps.env)
10506
10591
  });
10507
10592
  } catch {
10508
10593
  resolve("");
@@ -12023,6 +12108,8 @@ export {
12023
12108
  Lifecycle,
12024
12109
  defineTool,
12025
12110
  cleanTerminalOutput,
12111
+ buildSynthesizedCredentials,
12112
+ claudeJsonPath,
12026
12113
  loadPtySpawn,
12027
12114
  inheritedEnv,
12028
12115
  buildPromptBytes,
@@ -12042,6 +12129,8 @@ export {
12042
12129
  findOnPath,
12043
12130
  resolvePlaywrightMcpServer,
12044
12131
  resolveSessionStart,
12132
+ parseUsageGauges,
12133
+ runUsageProbe,
12045
12134
  sampleKeyUsage,
12046
12135
  awaitGitReady,
12047
12136
  PortDiscovery,
@@ -12061,4 +12150,4 @@ export {
12061
12150
  runStartCommand,
12062
12151
  unshallowRepo
12063
12152
  };
12064
- //# sourceMappingURL=chunk-NMZNCP66.js.map
12153
+ //# sourceMappingURL=chunk-AJZIO5QI.js.map