@bastani/atomic 0.9.76 → 0.9.77

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 (183) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +26 -0
  3. package/dist/builtin/intercom/broker/broker.ts +153 -6
  4. package/dist/builtin/intercom/broker/client.ts +85 -3
  5. package/dist/builtin/intercom/broker/departed-children.ts +471 -0
  6. package/dist/builtin/intercom/broker/recipient-gone-errors.ts +280 -0
  7. package/dist/builtin/intercom/broker/restoring-recipients.ts +108 -7
  8. package/dist/builtin/intercom/broker/send-handler.ts +42 -0
  9. package/dist/builtin/intercom/broker/workflow-stage-aliases.ts +69 -0
  10. package/dist/builtin/intercom/index.bundle.mjs +374 -129
  11. package/dist/builtin/intercom/package.json +2 -2
  12. package/dist/builtin/intercom/types.ts +30 -1
  13. package/dist/builtin/mcp/package.json +1 -1
  14. package/dist/builtin/subagents/CHANGELOG.md +30 -0
  15. package/dist/builtin/subagents/README.md +1 -1
  16. package/dist/builtin/subagents/package.json +3 -3
  17. package/dist/builtin/subagents/skills/agent-browser/SKILL.md +1 -1
  18. package/dist/builtin/subagents/src/extension/index.bundle.mjs +64 -4
  19. package/dist/builtin/web-access/package.json +2 -2
  20. package/dist/builtin/workflows/CHANGELOG.md +28 -0
  21. package/dist/builtin/workflows/README.md +1 -1
  22. package/dist/builtin/workflows/package.json +2 -2
  23. package/dist/builtin/workflows/skills/impeccable/SKILL.md +3 -3
  24. package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -1
  25. package/dist/builtin/workflows/skills/impeccable/scripts/engine-checksums.txt +5 -5
  26. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +71 -56
  27. package/dist/builtin/workflows/src/extension/index.bundle.mjs +315 -112
  28. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +168 -9
  29. package/dist/builtin/workflows/src/index.js +168 -9
  30. package/dist/builtin/workflows/src/local-worker-entry.mjs +168 -9
  31. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  32. package/dist/core/agent-session-compaction.js +2 -1
  33. package/dist/core/agent-session-compaction.js.map +1 -1
  34. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  35. package/dist/core/agent-session-extension-bindings.js +2 -0
  36. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  37. package/dist/core/agent-session-methods.d.ts +1 -0
  38. package/dist/core/agent-session-methods.d.ts.map +1 -1
  39. package/dist/core/agent-session-methods.js.map +1 -1
  40. package/dist/core/agent-session-state.d.ts.map +1 -1
  41. package/dist/core/agent-session-state.js +7 -2
  42. package/dist/core/agent-session-state.js.map +1 -1
  43. package/dist/core/agent-session-tasks.d.ts +6 -0
  44. package/dist/core/agent-session-tasks.d.ts.map +1 -1
  45. package/dist/core/agent-session-tasks.js +13 -25
  46. package/dist/core/agent-session-tasks.js.map +1 -1
  47. package/dist/core/agent-session-types.d.ts +2 -0
  48. package/dist/core/agent-session-types.d.ts.map +1 -1
  49. package/dist/core/agent-session-types.js.map +1 -1
  50. package/dist/core/agent-session.d.ts +1 -0
  51. package/dist/core/agent-session.d.ts.map +1 -1
  52. package/dist/core/agent-session.js +2 -0
  53. package/dist/core/agent-session.js.map +1 -1
  54. package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
  55. package/dist/core/extensions/loader-rollback.js +1 -0
  56. package/dist/core/extensions/loader-rollback.js.map +1 -1
  57. package/dist/core/extensions/runner-context.d.ts +3 -3
  58. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  59. package/dist/core/extensions/runner-context.js +2 -1
  60. package/dist/core/extensions/runner-context.js.map +1 -1
  61. package/dist/core/extensions/runner.d.ts +9 -0
  62. package/dist/core/extensions/runner.d.ts.map +1 -1
  63. package/dist/core/extensions/runner.js +16 -1
  64. package/dist/core/extensions/runner.js.map +1 -1
  65. package/dist/core/sdk-types.d.ts +5 -0
  66. package/dist/core/sdk-types.d.ts.map +1 -1
  67. package/dist/core/sdk-types.js.map +1 -1
  68. package/dist/core/sdk.d.ts.map +1 -1
  69. package/dist/core/sdk.js +8 -1
  70. package/dist/core/sdk.js.map +1 -1
  71. package/dist/core/system-prompt.d.ts +6 -0
  72. package/dist/core/system-prompt.d.ts.map +1 -1
  73. package/dist/core/system-prompt.js +26 -18
  74. package/dist/core/system-prompt.js.map +1 -1
  75. package/dist/core/tasks/agent-adapter.js +2 -2
  76. package/dist/core/tasks/agent-adapter.js.map +1 -1
  77. package/dist/core/tasks/cancel-reason.d.ts +20 -0
  78. package/dist/core/tasks/cancel-reason.d.ts.map +1 -0
  79. package/dist/core/tasks/cancel-reason.js +47 -0
  80. package/dist/core/tasks/cancel-reason.js.map +1 -0
  81. package/dist/core/tasks/child-command-owner.d.ts +1 -1
  82. package/dist/core/tasks/child-command-owner.d.ts.map +1 -1
  83. package/dist/core/tasks/child-command-owner.js +22 -0
  84. package/dist/core/tasks/child-command-owner.js.map +1 -1
  85. package/dist/core/tasks/completion-message.d.ts +11 -0
  86. package/dist/core/tasks/completion-message.d.ts.map +1 -0
  87. package/dist/core/tasks/completion-message.js +30 -0
  88. package/dist/core/tasks/completion-message.js.map +1 -0
  89. package/dist/core/tasks/completion.d.ts +2 -0
  90. package/dist/core/tasks/completion.d.ts.map +1 -1
  91. package/dist/core/tasks/completion.js +30 -14
  92. package/dist/core/tasks/completion.js.map +1 -1
  93. package/dist/core/tasks/contracts.d.ts +4 -0
  94. package/dist/core/tasks/contracts.d.ts.map +1 -1
  95. package/dist/core/tasks/contracts.js.map +1 -1
  96. package/dist/core/tasks/supervisor.d.ts +29 -3
  97. package/dist/core/tasks/supervisor.d.ts.map +1 -1
  98. package/dist/core/tasks/supervisor.js +48 -25
  99. package/dist/core/tasks/supervisor.js.map +1 -1
  100. package/dist/core/tasks/task-view-source.d.ts +6 -0
  101. package/dist/core/tasks/task-view-source.d.ts.map +1 -1
  102. package/dist/core/tasks/task-view-source.js +49 -0
  103. package/dist/core/tasks/task-view-source.js.map +1 -1
  104. package/dist/core/tools/bash-pty-native.d.ts +6 -1
  105. package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
  106. package/dist/core/tools/bash-pty-native.js +5 -1
  107. package/dist/core/tools/bash-pty-native.js.map +1 -1
  108. package/dist/core/tools/bash.d.ts +5 -0
  109. package/dist/core/tools/bash.d.ts.map +1 -1
  110. package/dist/core/tools/bash.js +14 -5
  111. package/dist/core/tools/bash.js.map +1 -1
  112. package/dist/core/tools/history-protocol.d.ts +15 -1
  113. package/dist/core/tools/history-protocol.d.ts.map +1 -1
  114. package/dist/core/tools/history-protocol.js +9 -7
  115. package/dist/core/tools/history-protocol.js.map +1 -1
  116. package/dist/core/tools/shell-task-status.d.ts.map +1 -1
  117. package/dist/core/tools/shell-task-status.js +3 -13
  118. package/dist/core/tools/shell-task-status.js.map +1 -1
  119. package/dist/core/workflow-stage-admission.d.ts +2 -0
  120. package/dist/core/workflow-stage-admission.d.ts.map +1 -1
  121. package/dist/core/workflow-stage-admission.js +36 -6
  122. package/dist/core/workflow-stage-admission.js.map +1 -1
  123. package/dist/index.d.ts +1 -1
  124. package/dist/index.d.ts.map +1 -1
  125. package/dist/index.js +2 -2
  126. package/dist/index.js.map +1 -1
  127. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
  128. package/dist/modes/interactive/components/chat-session-host-rendering.js +12 -8
  129. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
  130. package/dist/modes/interactive/components/chat-session-host-state.d.ts +2 -0
  131. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  132. package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
  133. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  134. package/dist/modes/interactive/components/chat-session-host-types.d.ts +6 -0
  135. package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
  136. package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -1
  137. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  138. package/dist/modes/interactive/components/chat-session-host.js +5 -2
  139. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  140. package/dist/modes/interactive/components/footer.d.ts +8 -5
  141. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  142. package/dist/modes/interactive/components/footer.js +5 -2
  143. package/dist/modes/interactive/components/footer.js.map +1 -1
  144. package/dist/modes/interactive/components/index.d.ts +1 -0
  145. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  146. package/dist/modes/interactive/components/index.js +1 -0
  147. package/dist/modes/interactive/components/index.js.map +1 -1
  148. package/dist/modes/interactive/components/input-label.d.ts +29 -0
  149. package/dist/modes/interactive/components/input-label.d.ts.map +1 -0
  150. package/dist/modes/interactive/components/input-label.js +75 -0
  151. package/dist/modes/interactive/components/input-label.js.map +1 -0
  152. package/dist/modes/interactive/components/task-inspector.d.ts +4 -1
  153. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  154. package/dist/modes/interactive/components/task-inspector.js +6 -2
  155. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  156. package/dist/modes/interactive/components/task-transcript-page.d.ts +12 -1
  157. package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
  158. package/dist/modes/interactive/components/task-transcript-page.js +63 -6
  159. package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
  160. package/dist/modes/interactive/interactive-input-handling.js +1 -0
  161. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  162. package/dist/modes/interactive/interactive-slash-commands.js +1 -0
  163. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  164. package/dist/modes/interactive-engine/engine-session-stats.d.ts +1 -1
  165. package/dist/modes/interactive-engine/engine-session-stats.d.ts.map +1 -1
  166. package/dist/modes/interactive-engine/engine-session-stats.js.map +1 -1
  167. package/dist/modes/rpc/task-ui-bridge.d.ts +2 -2
  168. package/dist/modes/rpc/task-ui-bridge.d.ts.map +1 -1
  169. package/dist/modes/rpc/task-ui-bridge.js +2 -0
  170. package/dist/modes/rpc/task-ui-bridge.js.map +1 -1
  171. package/docs/background-tasks.md +14 -1
  172. package/docs/getting-started/first-session.md +1 -1
  173. package/docs/intercom/operations.md +4 -2
  174. package/docs/intercom/reference.md +18 -1
  175. package/docs/llama-cpp.md +1 -1
  176. package/docs/sessions.md +1 -1
  177. package/docs/subagents.md +5 -1
  178. package/docs/tools.md +1 -1
  179. package/docs/usage.md +1 -12
  180. package/docs/workflows/operations.md +3 -1
  181. package/docs/workflows/verification.md +1 -8
  182. package/npm-shrinkwrap.json +83 -98
  183. package/package.json +6 -6
@@ -75437,6 +75437,140 @@ var init_released_children = __esm(() => {
75437
75437
  SESSION_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
75438
75438
  });
75439
75439
 
75440
+ // dist/builtin/intercom/broker/recipient-gone-errors.ts
75441
+ function isIntercomRecipientGoneErrorCode(value2) {
75442
+ return CODES5.has(value2);
75443
+ }
75444
+ function hintFor3(code, childId) {
75445
+ if (code === "recipient_cancelled")
75446
+ return "It cannot be resumed; launch a fresh subagent if its work is still needed.";
75447
+ if (code === "recipient_disconnected")
75448
+ return 'Its launching session has not said why; check subagent({ action: "status" }) there, or try again shortly.';
75449
+ if (code === "recipient_owner_suspended")
75450
+ return "Try again once its launching session is back; to reach that session now, send to its workflow stage target (workflow:<rootRunId>/<stage>), which queues the message until the stage reopens.";
75451
+ return `Its launching session can continue it with subagent({ action: "resume", id: ${JSON.stringify(childId ?? "<child-id>")}, message: "<your message>" }).`;
75452
+ }
75453
+ function rehydrateIntercomRecipientGoneError(serialized) {
75454
+ const options = serialized.cause === undefined ? undefined : { cause: rehydrateCause3(serialized.cause, 1) };
75455
+ const { code, fields } = serialized;
75456
+ if (serialized.name === ENDED_NAME && code !== "recipient_disconnected" && code !== "recipient_owner_suspended")
75457
+ return new SubagentRecipientEndedError(code, fields, options);
75458
+ if (serialized.name === DISCONNECTED_NAME && code === "recipient_disconnected")
75459
+ return new SubagentRecipientDisconnectedError(fields, options);
75460
+ if (serialized.name === OWNER_SUSPENDED_NAME && code === "recipient_owner_suspended")
75461
+ return new SubagentRecipientOwnerSuspendedError(fields, options);
75462
+ const error = new IntercomRecipientGoneError(code, fields, options);
75463
+ Object.defineProperty(error, "name", { value: serialized.name });
75464
+ return error;
75465
+ }
75466
+ function readCause2(value2, depth) {
75467
+ if (value2 === undefined)
75468
+ return;
75469
+ if (!isWireObject2(value2) || typeof value2.name !== "string" || typeof value2.message !== "string")
75470
+ return false;
75471
+ const next = depth < MAX_CAUSE_DEPTH13 ? readCause2(value2.cause, depth + 1) : undefined;
75472
+ if (next === false)
75473
+ return false;
75474
+ return { name: value2.name, message: value2.message, ...next === undefined ? {} : { cause: next } };
75475
+ }
75476
+ function readSerializedIntercomRecipientGoneError(value2) {
75477
+ if (!isWireObject2(value2))
75478
+ return;
75479
+ const { name, code, message, hint, retryable, fields } = value2;
75480
+ if (typeof name !== "string" || !isIntercomRecipientGoneErrorCode(code))
75481
+ return;
75482
+ if (typeof message !== "string" || typeof hint !== "string" || typeof retryable !== "boolean")
75483
+ return;
75484
+ if (!isWireObject2(fields))
75485
+ return;
75486
+ const { target, childName, childId } = fields;
75487
+ if (typeof target !== "string" || typeof childName !== "string")
75488
+ return;
75489
+ if (childId !== undefined && typeof childId !== "string")
75490
+ return;
75491
+ const cause = readCause2(value2.cause, 1);
75492
+ if (cause === false)
75493
+ return;
75494
+ return {
75495
+ name,
75496
+ code,
75497
+ message,
75498
+ hint,
75499
+ retryable,
75500
+ fields: { target, childName, ...childId === undefined ? {} : { childId } },
75501
+ ...cause === undefined ? {} : { cause }
75502
+ };
75503
+ }
75504
+ var INTERCOM_RECIPIENT_GONE_ERROR_CODES, CODES5, WHAT, BASE_NAME3 = "IntercomRecipientGoneError", ENDED_NAME = "SubagentRecipientEndedError", DISCONNECTED_NAME = "SubagentRecipientDisconnectedError", OWNER_SUSPENDED_NAME = "SubagentRecipientOwnerSuspendedError", IntercomRecipientGoneError, SubagentRecipientEndedError, SubagentRecipientDisconnectedError, SubagentRecipientOwnerSuspendedError, NAMES4, ENDED_NAMES, DISCONNECTED_NAMES, OWNER_SUSPENDED_NAMES, MAX_CAUSE_DEPTH13 = 4, isWireObject2 = (value2) => typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
75505
+ var init_recipient_gone_errors = __esm(() => {
75506
+ init_released_child_errors();
75507
+ INTERCOM_RECIPIENT_GONE_ERROR_CODES = [
75508
+ "recipient_completed",
75509
+ "recipient_failed",
75510
+ "recipient_stopped",
75511
+ "recipient_cancelled",
75512
+ "recipient_disconnected",
75513
+ "recipient_owner_suspended"
75514
+ ];
75515
+ CODES5 = new Set(INTERCOM_RECIPIENT_GONE_ERROR_CODES);
75516
+ WHAT = {
75517
+ recipient_completed: "completed and has no live session",
75518
+ recipient_failed: "failed and has no live session",
75519
+ recipient_stopped: "was stopped (paused or quit) and has no live session",
75520
+ recipient_cancelled: "was cancelled for good and has no live session",
75521
+ recipient_disconnected: "disconnected and has not reconnected",
75522
+ recipient_owner_suspended: "is released and the session that launched it is suspended or disconnected, so nothing can wake it now"
75523
+ };
75524
+ IntercomRecipientGoneError = class IntercomRecipientGoneError extends Error {
75525
+ name = BASE_NAME3;
75526
+ code;
75527
+ hint;
75528
+ retryable;
75529
+ target;
75530
+ childName;
75531
+ childId;
75532
+ constructor(code, fields, options) {
75533
+ const hint = hintFor3(code, fields.childId);
75534
+ super(`Subagent ${JSON.stringify(fields.childName)} ${WHAT[code]} (${code}). ${hint}`, options);
75535
+ this.code = code;
75536
+ this.hint = hint;
75537
+ this.retryable = code === "recipient_disconnected" || code === "recipient_owner_suspended";
75538
+ this.target = fields.target;
75539
+ this.childName = fields.childName;
75540
+ this.childId = fields.childId;
75541
+ }
75542
+ get fields() {
75543
+ return {
75544
+ target: this.target,
75545
+ childName: this.childName,
75546
+ ...this.childId === undefined ? {} : { childId: this.childId }
75547
+ };
75548
+ }
75549
+ };
75550
+ SubagentRecipientEndedError = class SubagentRecipientEndedError extends IntercomRecipientGoneError {
75551
+ name = ENDED_NAME;
75552
+ constructor(code, fields, options) {
75553
+ super(code, fields, options);
75554
+ }
75555
+ };
75556
+ SubagentRecipientDisconnectedError = class SubagentRecipientDisconnectedError extends IntercomRecipientGoneError {
75557
+ name = DISCONNECTED_NAME;
75558
+ constructor(fields, options) {
75559
+ super("recipient_disconnected", fields, options);
75560
+ }
75561
+ };
75562
+ SubagentRecipientOwnerSuspendedError = class SubagentRecipientOwnerSuspendedError extends IntercomRecipientGoneError {
75563
+ name = OWNER_SUSPENDED_NAME;
75564
+ constructor(fields, options) {
75565
+ super("recipient_owner_suspended", fields, options);
75566
+ }
75567
+ };
75568
+ NAMES4 = new Set([BASE_NAME3, ENDED_NAME, DISCONNECTED_NAME, OWNER_SUSPENDED_NAME]);
75569
+ ENDED_NAMES = new Set([ENDED_NAME]);
75570
+ DISCONNECTED_NAMES = new Set([DISCONNECTED_NAME]);
75571
+ OWNER_SUSPENDED_NAMES = new Set([OWNER_SUSPENDED_NAME]);
75572
+ });
75573
+
75440
75574
  // dist/builtin/intercom/group.ts
75441
75575
  function normalizeGroup2(value2) {
75442
75576
  if (typeof value2 !== "string")
@@ -75507,7 +75641,7 @@ var init_live_route_refusal = __esm(() => {
75507
75641
  // dist/builtin/intercom/recoverable-disconnect.ts
75508
75642
  function isIntercomBrokerRetiring(error) {
75509
75643
  let current = error;
75510
- for (let depth = 0;depth <= MAX_CAUSE_DEPTH13; depth += 1) {
75644
+ for (let depth = 0;depth <= MAX_CAUSE_DEPTH14; depth += 1) {
75511
75645
  if (!(current instanceof Error))
75512
75646
  return false;
75513
75647
  if (current instanceof IntercomBrokerRetiringError)
@@ -75516,7 +75650,7 @@ function isIntercomBrokerRetiring(error) {
75516
75650
  }
75517
75651
  return false;
75518
75652
  }
75519
- var RECOVERABLE_DISCONNECT_MESSAGE = "Client disconnected", MAX_CAUSE_DEPTH13 = 8, IntercomClientDisconnectedError, IntercomBrokerTimeoutError, BROKER_RETIRING_CODE = "broker_retiring", BROKER_RETIRING_REASON = "Intercom broker is retiring; connect to its replacement", BROKER_ROUTING_CHANGED_CODE = "broker_routing_changed", IntercomBrokerRetiringError;
75653
+ var RECOVERABLE_DISCONNECT_MESSAGE = "Client disconnected", MAX_CAUSE_DEPTH14 = 8, IntercomClientDisconnectedError, IntercomBrokerTimeoutError, BROKER_RETIRING_CODE = "broker_retiring", BROKER_RETIRING_REASON = "Intercom broker is retiring; connect to its replacement", BROKER_ROUTING_CHANGED_CODE = "broker_routing_changed", IntercomBrokerRetiringError;
75520
75654
  var init_recoverable_disconnect = __esm(() => {
75521
75655
  init_live_route_refusal();
75522
75656
  IntercomClientDisconnectedError = class IntercomClientDisconnectedError extends Error {
@@ -75703,6 +75837,7 @@ var init_client = __esm(() => {
75703
75837
  init_released_child_errors();
75704
75838
  init_released_reply_errors();
75705
75839
  init_released_children();
75840
+ init_recipient_gone_errors();
75706
75841
  init_group();
75707
75842
  init_recoverable_disconnect();
75708
75843
  init_pending_stage_route_timeout_error();
@@ -75712,6 +75847,7 @@ var init_client = __esm(() => {
75712
75847
  init_retry_policy();
75713
75848
  init_workflow_prediction_fields();
75714
75849
  init_released_child_errors();
75850
+ init_recipient_gone_errors();
75715
75851
  init_released_reply_errors();
75716
75852
  ConnectionClosedBeforeRegistrationError = class ConnectionClosedBeforeRegistrationError extends Error {
75717
75853
  constructor() {
@@ -75750,6 +75886,7 @@ var init_client = __esm(() => {
75750
75886
  brokerClaimsWorkflowInvocations = false;
75751
75887
  connectAttempt;
75752
75888
  brokerExtendsSaves = false;
75889
+ brokerMarksEndedChildren = false;
75753
75890
  socket = null;
75754
75891
  _sessionId = null;
75755
75892
  _supervisorSessionId = null;
@@ -75978,6 +76115,7 @@ var init_client = __esm(() => {
75978
76115
  this._brokerProtocol = LEGACY_BROKER_PROTOCOL;
75979
76116
  this.brokerClaimsWorkflowInvocations = false;
75980
76117
  this.brokerExtendsSaves = false;
76118
+ this.brokerMarksEndedChildren = false;
75981
76119
  this._messageSource = undefined;
75982
76120
  this.disconnectError = null;
75983
76121
  if (connectionEstablished && !wasDisconnecting) {
@@ -76067,7 +76205,7 @@ var init_client = __esm(() => {
76067
76205
  }
76068
76206
  switch (brokerMessage.type) {
76069
76207
  case "registered": {
76070
- if (typeof brokerMessage.sessionId !== "string" || brokerMessage.supervisorSessionId !== undefined && typeof brokerMessage.supervisorSessionId !== "string" || brokerMessage.acknowledgesReceipt !== undefined && brokerMessage.acknowledgesReceipt !== true || brokerMessage.acknowledgesPendingStageRoutes !== undefined && brokerMessage.acknowledgesPendingStageRoutes !== true || brokerMessage.refusesPendingStageRoutesInPlace !== undefined && brokerMessage.refusesPendingStageRoutesInPlace !== true || brokerMessage.brokerStatus !== undefined && brokerMessage.brokerStatus !== true || brokerMessage.claimsWorkflowInvocations !== undefined && brokerMessage.claimsWorkflowInvocations !== true || brokerMessage.multiNodeRouting !== undefined && brokerMessage.multiNodeRouting !== "off" && brokerMessage.multiNodeRouting !== "starting" && brokerMessage.multiNodeRouting !== "on" && brokerMessage.multiNodeRouting !== "unavailable" || brokerMessage.extendsSaves !== undefined && brokerMessage.extendsSaves !== true || brokerMessage.protocol !== undefined && !isBrokerProtocolRange(brokerMessage.protocol)) {
76208
+ if (typeof brokerMessage.sessionId !== "string" || brokerMessage.supervisorSessionId !== undefined && typeof brokerMessage.supervisorSessionId !== "string" || brokerMessage.acknowledgesReceipt !== undefined && brokerMessage.acknowledgesReceipt !== true || brokerMessage.acknowledgesPendingStageRoutes !== undefined && brokerMessage.acknowledgesPendingStageRoutes !== true || brokerMessage.refusesPendingStageRoutesInPlace !== undefined && brokerMessage.refusesPendingStageRoutesInPlace !== true || brokerMessage.brokerStatus !== undefined && brokerMessage.brokerStatus !== true || brokerMessage.claimsWorkflowInvocations !== undefined && brokerMessage.claimsWorkflowInvocations !== true || brokerMessage.multiNodeRouting !== undefined && brokerMessage.multiNodeRouting !== "off" && brokerMessage.multiNodeRouting !== "starting" && brokerMessage.multiNodeRouting !== "on" && brokerMessage.multiNodeRouting !== "unavailable" || brokerMessage.extendsSaves !== undefined && brokerMessage.extendsSaves !== true || brokerMessage.marksEndedChildren !== undefined && brokerMessage.marksEndedChildren !== true || brokerMessage.protocol !== undefined && !isBrokerProtocolRange(brokerMessage.protocol)) {
76071
76209
  throw new Error("Invalid registered message");
76072
76210
  }
76073
76211
  if (this._sessionId !== null) {
@@ -76087,6 +76225,7 @@ var init_client = __esm(() => {
76087
76225
  this._multiNodeRouting = brokerMessage.multiNodeRouting;
76088
76226
  this.brokerClaimsWorkflowInvocations = brokerMessage.claimsWorkflowInvocations === true;
76089
76227
  this.brokerExtendsSaves = this.brokerAcknowledgesReceipt && brokerMessage.extendsSaves === true;
76228
+ this.brokerMarksEndedChildren = brokerMessage.marksEndedChildren === true;
76090
76229
  this._brokerProtocol = protocolRangeOf(brokerMessage.protocol);
76091
76230
  this.emit("_registered", { type: "registered", sessionId: brokerMessage.sessionId });
76092
76231
  break;
@@ -76370,7 +76509,9 @@ var init_client = __esm(() => {
76370
76509
  const { messageId, attemptId, reason, reasonCode } = brokerMessage;
76371
76510
  const wireError = brokerMessage.error;
76372
76511
  const error = readSerializedIntercomReleasedReplyError(wireError);
76373
- if (typeof messageId !== "string" || attemptId !== undefined && typeof attemptId !== "string" || typeof reason !== "string" || reasonCode !== undefined && (typeof reasonCode !== "string" || !isDeliveryFailureReasonCode(reasonCode)) || wireError !== undefined && (error === undefined || error.code !== reasonCode)) {
76512
+ const wireRecipientError = brokerMessage.recipientError;
76513
+ const recipientError = readSerializedIntercomRecipientGoneError(wireRecipientError);
76514
+ if (typeof messageId !== "string" || attemptId !== undefined && typeof attemptId !== "string" || typeof reason !== "string" || reasonCode !== undefined && (typeof reasonCode !== "string" || !isDeliveryFailureReasonCode(reasonCode)) || wireError !== undefined && (error === undefined || error.code !== reasonCode) || wireRecipientError !== undefined && (recipientError === undefined || reasonCode !== undefined)) {
76374
76515
  throw new Error("Invalid delivery_failed message");
76375
76516
  }
76376
76517
  const result = {
@@ -76378,7 +76519,8 @@ var init_client = __esm(() => {
76378
76519
  delivered: false,
76379
76520
  reason,
76380
76521
  ...reasonCode === undefined ? {} : { reasonCode },
76381
- ...error === undefined ? {} : { error: rehydrateIntercomReleasedReplyError(error) }
76522
+ ...error === undefined ? {} : { error: rehydrateIntercomReleasedReplyError(error) },
76523
+ ...recipientError === undefined ? {} : { reasonCode: recipientError.code, error: rehydrateIntercomRecipientGoneError(recipientError) }
76382
76524
  };
76383
76525
  if (attemptId === undefined)
76384
76526
  this.pendingSends.resolveLegacy(messageId, result);
@@ -76750,6 +76892,23 @@ var init_client = __esm(() => {
76750
76892
  });
76751
76893
  }
76752
76894
  }
76895
+ async markEndedChildren(children) {
76896
+ if (!this.brokerMarksEndedChildren)
76897
+ return;
76898
+ const wireChildren = children.map((child) => ({
76899
+ childName: child.childName,
76900
+ group: child.group,
76901
+ aliases: child.aliases,
76902
+ outcome: child.outcome,
76903
+ childId: child.childId
76904
+ }));
76905
+ for (let start = 0;start < wireChildren.length; start += RELEASED_CHILD_FRAME_MAX) {
76906
+ await this.restoringRecipientRequest({
76907
+ type: "mark_ended_children",
76908
+ children: wireChildren.slice(start, start + RELEASED_CHILD_FRAME_MAX)
76909
+ });
76910
+ }
76911
+ }
76753
76912
  acknowledgeReleasedChildWake(childName) {
76754
76913
  try {
76755
76914
  this.requireBrokerProtocol("acknowledge_released_child_wake");
@@ -92534,7 +92693,7 @@ function describeErrorWithCauses(error) {
92534
92693
  const messages = [];
92535
92694
  const visited = new Set;
92536
92695
  let current = error;
92537
- for (let depth = 0;current !== undefined && depth < MAX_CAUSE_DEPTH14 && !visited.has(current); depth++) {
92696
+ for (let depth = 0;current !== undefined && depth < MAX_CAUSE_DEPTH15 && !visited.has(current); depth++) {
92538
92697
  visited.add(current);
92539
92698
  const message = current instanceof Error ? current.message : String(current);
92540
92699
  if (!messages.includes(message))
@@ -92543,7 +92702,7 @@ function describeErrorWithCauses(error) {
92543
92702
  }
92544
92703
  return messages.join(": ");
92545
92704
  }
92546
- var MAX_CAUSE_DEPTH14 = 5;
92705
+ var MAX_CAUSE_DEPTH15 = 5;
92547
92706
 
92548
92707
  // dist/builtin/workflows/src/engine/run-durable-finalize.ts
92549
92708
  async function finalizeDurableTerminalStatus(input) {
@@ -103530,9 +103689,56 @@ function sortRunsByStatus(items, runOf, statusOf) {
103530
103689
  return aEnded ? (b.run.endedAt ?? 0) - (a.run.endedAt ?? 0) : b.run.startedAt - a.run.startedAt;
103531
103690
  }).map((entry) => entry.item);
103532
103691
  }
103692
+ // dist/builtin/workflows/src/tui/run-state-indicator.ts
103693
+ init_returned_run_status();
103694
+ init_tool_payload_bounds();
103695
+ var GLYPH_STATUS = {
103696
+ blocked: "blocked",
103697
+ paused: "paused",
103698
+ quit: "pending",
103699
+ resumed: "running"
103700
+ };
103701
+ var COLOR_STATUS = {
103702
+ blocked: "blocked",
103703
+ paused: "paused",
103704
+ quit: "paused",
103705
+ resumed: "running"
103706
+ };
103707
+ function isQuitRun2(run) {
103708
+ return run.endedAt === undefined && run.status === "paused" && run.exitReason === "quit";
103709
+ }
103710
+ function runStateIndicator(run) {
103711
+ if (isQuitRun2(run))
103712
+ return indicator("quit");
103713
+ const status = effectiveRunStatus(run);
103714
+ if (status === "blocked")
103715
+ return indicator("blocked", blockedReason(run));
103716
+ if (status === "paused")
103717
+ return indicator("paused");
103718
+ if (isResumedLiveRun(run))
103719
+ return indicator("resumed");
103720
+ return;
103721
+ }
103722
+ function runStateColor(state, theme) {
103723
+ return statusColor(COLOR_STATUS[state.kind], theme);
103724
+ }
103725
+ function indicator(kind, reason) {
103726
+ const glyph = statusIcon(GLYPH_STATUS[kind]);
103727
+ return { kind, glyph, text: `${glyph} ${kind}`, ...reason === undefined ? {} : { reason } };
103728
+ }
103729
+ function isResumedLiveRun(run) {
103730
+ if (run.status !== "running" || run.endedAt !== undefined)
103731
+ return false;
103732
+ return run.resumedAt !== undefined || run.resumeSource === "run_control" || run.resumedFromRunId !== undefined;
103733
+ }
103734
+ function blockedReason(run) {
103735
+ const reason = sanitizeToolTitleText(run.exitReason ?? "").trim();
103736
+ return reason.length > 0 ? reason : undefined;
103737
+ }
103738
+
103533
103739
  // dist/builtin/workflows/src/tui/status-list.ts
103534
103740
  var STAGE_LABEL_BUDGET = 24;
103535
- function isQuitRun2(run) {
103741
+ function isQuitRun3(run) {
103536
103742
  return run.endedAt === undefined && run.status === "paused" && run.exitReason === "quit";
103537
103743
  }
103538
103744
  function renderStatusList(runs, opts = {}) {
@@ -103669,26 +103875,23 @@ function pendingStageLine(line, width, theme) {
103669
103875
  function runAccent(run, theme, indicatorStatus) {
103670
103876
  if (!theme)
103671
103877
  return "#000000";
103672
- if (isQuitRun2(run))
103878
+ if (isQuitRun3(run))
103673
103879
  return theme.warning;
103674
103880
  return statusColor(indicatorStatus, theme);
103675
103881
  }
103676
103882
  function runTrailing(run, theme) {
103677
- if (isQuitRun2(run))
103678
- return { text: "○ quit", fg: theme?.warning };
103883
+ const runState = runStateIndicator(run);
103884
+ if (runState !== undefined)
103885
+ return { text: runState.text, fg: theme === undefined ? undefined : runStateColor(runState, theme) };
103679
103886
  switch (effectiveRunStatus(run)) {
103680
103887
  case "completed":
103681
103888
  return { text: "✓ completed", fg: theme?.success };
103682
103889
  case "running":
103683
103890
  return { text: "● running", fg: theme?.warning };
103684
- case "paused":
103685
- return { text: "❚❚ paused", fg: theme?.warning };
103686
103891
  case "skipped":
103687
103892
  return { text: "⊘ skipped", fg: theme?.dim };
103688
103893
  case "cancelled":
103689
103894
  return { text: "⊘ cancelled", fg: theme?.dim };
103690
- case "blocked":
103691
- return { text: "↑ blocked", fg: theme?.dim };
103692
103895
  case "failed":
103693
103896
  return { text: "✗ failed", fg: theme?.error };
103694
103897
  case "killed":
@@ -103703,7 +103906,7 @@ function runCardMeta(run, now) {
103703
103906
  const total = run.stages.length;
103704
103907
  const done = run.stages.filter((s) => s.status === "completed" || s.status === "failed" || s.status === "skipped").length;
103705
103908
  const ago = run.endedAt !== undefined ? `${fmtDuration(now - run.endedAt)} ago` : run.startedAt != null ? fmtDuration(elapsedRunMs(run, now)) : undefined;
103706
- if (isQuitRun2(run))
103909
+ if (isQuitRun3(run))
103707
103910
  return run.resumable === false ? "not resumable" : "resumable via /workflow resume";
103708
103911
  if (effectiveRunStatus(run) === "running") {
103709
103912
  if (isChain)
@@ -103817,7 +104020,7 @@ function countBuckets(runs) {
103817
104020
  const c = { active: 0, paused: 0, quit: 0, completed: 0, blocked: 0, failed: 0, pending: 0 };
103818
104021
  for (const r of runs) {
103819
104022
  const status = effectiveRunStatus(r);
103820
- if (isQuitRun2(r))
104023
+ if (isQuitRun3(r))
103821
104024
  c.quit++;
103822
104025
  else if (r.endedAt === undefined) {
103823
104026
  if (status === "pending")
@@ -103923,7 +104126,7 @@ function emptyStateLine(theme) {
103923
104126
  return ` ${hexToAnsi(theme.dim)}no workflow runs in current session${RESET}`;
103924
104127
  }
103925
104128
  function statusIconForRun(run, indicatorStatus) {
103926
- if (isQuitRun2(run))
104129
+ if (isQuitRun3(run))
103927
104130
  return statusIcon("pending");
103928
104131
  return statusIcon(indicatorStatus);
103929
104132
  }
@@ -104314,7 +104517,14 @@ function deriveGraphThemeFromPiTheme(theme) {
104314
104517
  import { isStaleExtensionContextError as isStaleExtensionContextError4 } from "@bastani/atomic";
104315
104518
 
104316
104519
  // dist/builtin/workflows/src/tui/header.ts
104317
- function pillFor(run, theme) {
104520
+ var LEFT_EDGE_PAD = 1;
104521
+ var RIGHT_EDGE_PAD = 2;
104522
+ var BADGE_GAP = 2;
104523
+ var SUBTITLE_GUTTER = 2;
104524
+ var MIN_TRUNCATED_REASON = 4;
104525
+ function pillFor(run, runState, theme) {
104526
+ if (runState !== undefined)
104527
+ return { border: runStateColor(runState, theme), label: "ORCHESTRATOR" };
104318
104528
  if (run.status === "failed")
104319
104529
  return { border: theme.error, label: "ORCHESTRATOR" };
104320
104530
  if (run.status === "completed")
@@ -104323,6 +104533,20 @@ function pillFor(run, theme) {
104323
104533
  return { border: theme.dim, label: "ORCHESTRATOR" };
104324
104534
  return { border: theme.accent, label: "ORCHESTRATOR" };
104325
104535
  }
104536
+ function runStateBadge(runState, subtitle, label, countBadges, width, theme) {
104537
+ const fg = runStateColor(runState, theme);
104538
+ if (runState.reason === undefined)
104539
+ return { text: runState.text, fg };
104540
+ const pillWidth = visibleWidth(` ${label} `) + 2;
104541
+ const badgesWidth = visibleWidth([runState.text, ...countBadges.map((b) => b.text)].join(" ".repeat(BADGE_GAP)));
104542
+ const room = width - LEFT_EDGE_PAD - pillWidth - RIGHT_EDGE_PAD - badgesWidth;
104543
+ const subtitleRoom = Math.min(visibleWidth(subtitle) + SUBTITLE_GUTTER + BADGE_GAP, Math.floor(room / 2));
104544
+ const reasonWidth = room - subtitleRoom;
104545
+ const reason = `: ${runState.reason}`;
104546
+ if (visibleWidth(reason) > reasonWidth && reasonWidth < MIN_TRUNCATED_REASON)
104547
+ return { text: runState.text, fg };
104548
+ return { text: `${runState.text}${truncateToWidth(reason, reasonWidth, "…")}`, fg };
104549
+ }
104326
104550
  function renderOutlinePill(label, borderHex, chromeBg) {
104327
104551
  const bc = hexToAnsi(borderHex);
104328
104552
  const padded = ` ${label} `;
@@ -104372,8 +104596,8 @@ function renderBandHeader(opts) {
104372
104596
  const rightVisible = badges.map((b) => b.text).join(" ");
104373
104597
  const rightW = visibleWidth(rightVisible);
104374
104598
  const rightStyled = badges.map((b) => `${hexToAnsi(b.fg)}${b.text}${RESET}${chromeBg}`).join(`${chromeBg} `);
104375
- const leftEdgePad = 1;
104376
- const rightEdgePad = 2;
104599
+ const leftEdgePad = LEFT_EDGE_PAD;
104600
+ const rightEdgePad = RIGHT_EDGE_PAD;
104377
104601
  const subtitleBudget = Math.max(0, width - leftEdgePad - pillW - rightW - rightEdgePad);
104378
104602
  const subtitleTextBudget = Math.max(0, subtitleBudget - 2);
104379
104603
  const subtitleText = subtitle.length > 0 && subtitleTextBudget > 0 ? truncateToWidth(subtitle, subtitleTextBudget, "…") : "";
@@ -104395,7 +104619,8 @@ function renderBandHeader(opts) {
104395
104619
  }
104396
104620
  function renderHeader(run, opts) {
104397
104621
  const { width, theme } = opts;
104398
- const pill = pillFor(run, theme);
104622
+ const runState = runStateIndicator(run);
104623
+ const pill = pillFor(run, runState, theme);
104399
104624
  const counts = {
104400
104625
  pending: 0,
104401
104626
  running: 0,
@@ -104418,6 +104643,8 @@ function renderHeader(run, opts) {
104418
104643
  badges.push({ text: `↵ ${counts.awaiting_input}`, fg: theme.info });
104419
104644
  if (counts.paused > 0)
104420
104645
  badges.push({ text: `❚❚ ${counts.paused}`, fg: theme.warning });
104646
+ if (counts.blocked > 0)
104647
+ badges.push({ text: `${statusIcon("blocked")} ${counts.blocked}`, fg: statusColor("blocked", theme) });
104421
104648
  if (counts.suspended > 0)
104422
104649
  badges.push({ text: `◷ ${counts.suspended}`, fg: theme.dim });
104423
104650
  if (counts.pending > 0)
@@ -104426,6 +104653,8 @@ function renderHeader(run, opts) {
104426
104653
  badges.push({ text: `⊘ ${counts.skipped}`, fg: theme.dim });
104427
104654
  if (counts.failed > 0)
104428
104655
  badges.push({ text: `✗ ${counts.failed}`, fg: theme.error });
104656
+ if (runState !== undefined)
104657
+ badges.unshift(runStateBadge(runState, run.name, pill.label, badges, width, theme));
104429
104658
  return renderBandHeader({
104430
104659
  label: pill.label,
104431
104660
  subtitle: run.name,
@@ -107703,6 +107932,14 @@ function truncateToWidthWithoutReset(text, width, suffix = "") {
107703
107932
  function statusText(status) {
107704
107933
  return status === "awaiting_input" ? "awaiting" : status === "completed" ? "complete" : status.replace(/_/g, " ");
107705
107934
  }
107935
+ function topBorder(innerWidth, border, runState, theme) {
107936
+ if (runState === undefined)
107937
+ return `${border}╭${"─".repeat(innerWidth)}╮${RESET}`;
107938
+ const title = truncateToWidth(` ${runState.text} `, innerWidth - 1, "");
107939
+ const titleFg = hexToAnsi(runStateColor(runState, theme));
107940
+ const rule = "─".repeat(innerWidth - 1 - visibleWidth(title));
107941
+ return `${border}╭─${RESET}${titleFg}${title}${RESET}${border}${rule}╮${RESET}`;
107942
+ }
107706
107943
  function renderSwitcher(stages, state, opts) {
107707
107944
  const { width, theme } = opts;
107708
107945
  const filtered = filterStages(stages, state.query);
@@ -107718,7 +107955,7 @@ function renderSwitcher(stages, state, opts) {
107718
107955
  const accent = hexBg(theme.accent);
107719
107956
  const accentFg = hexToAnsi(theme.backgroundElement);
107720
107957
  const lines = [];
107721
- lines.push(`${border}╭${"─".repeat(innerWidth)}╮${RESET}`);
107958
+ lines.push(topBorder(innerWidth, border, opts.runState, theme));
107722
107959
  const leftLabelText = " STAGES";
107723
107960
  const hint = innerWidth >= 44 ? canOpenStageChat ? STAGE_HINT : selectedIsTool ? TOOL_HINT : NO_CHAT_HINT : canOpenStageChat ? STAGE_COMPACT_HINT : selectedIsTool ? TOOL_COMPACT_HINT : NO_CHAT_COMPACT_HINT;
107724
107961
  const queryBudget = Math.max(0, innerWidth - visibleWidth(leftLabelText) - visibleWidth(hint) - 3);
@@ -108108,8 +108345,11 @@ class GraphViewRenderer extends GraphViewGraphRenderer {
108108
108345
  const displayStages = this._displayStages(run);
108109
108346
  const headerLines = renderHeader({ ...run, stages: displayStages }, { width, theme: this.graphTheme });
108110
108347
  const counts = this._counts(displayStages);
108111
- const trailer = `${hexToAnsi(this.graphTheme.dim)}` + `${counts.completed}/${displayStages.length} done` + (counts.running > 0 ? ` · ${counts.running} running` : "") + (counts.failed > 0 ? ` · ${counts.failed} failed` : "") + (counts.blocked > 0 ? ` · ${counts.blocked} blocked` : "") + RESET;
108112
- return [...headerLines, ` ${trailer}`];
108348
+ const dim = hexToAnsi(this.graphTheme.dim);
108349
+ const runState = runStateIndicator(run);
108350
+ const runStateLead = runState === undefined ? "" : `${hexToAnsi(runStateColor(runState, this.graphTheme))}${runState.text}${RESET}${dim} · `;
108351
+ const trailer = `${dim}${runStateLead}` + `${counts.completed}/${displayStages.length} done` + (counts.running > 0 ? ` · ${counts.running} running` : "") + (counts.failed > 0 ? ` · ${counts.failed} failed` : "") + (counts.blocked > 0 ? ` · ${counts.blocked} blocked` : "") + RESET;
108352
+ return [...headerLines, truncateToWidth(` ${trailer}`, width, "…")];
108113
108353
  }
108114
108354
  _renderOverlay(width) {
108115
108355
  const frameWidth = Math.max(40, width);
@@ -108283,6 +108523,7 @@ class GraphViewRenderer extends GraphViewGraphRenderer {
108283
108523
  const switcherLines = renderSwitcher(this._displayStages(run), this.switcherState, {
108284
108524
  width: switcherWidth,
108285
108525
  theme: this.graphTheme,
108526
+ runState: runStateIndicator(run),
108286
108527
  canOpenStageChat: (stage) => this._stageChatTarget(stage) !== undefined
108287
108528
  });
108288
108529
  const insertAt = Math.max(bodyStart, bodyStart + Math.min(2, Math.floor((bodyRows - switcherLines.length) / 3)));
@@ -108909,6 +109150,15 @@ function caretLineDown3(raw, caret) {
108909
109150
  return nextLineStart + offsetAtVisualColumn3(nextLine, col);
108910
109151
  }
108911
109152
 
109153
+ // dist/builtin/workflows/src/tui/stage-input-label.ts
109154
+ import {
109155
+ applyInputLabelToEditorTopRule,
109156
+ buildInputLabel,
109157
+ INPUT_LABEL_MIN_COLUMNS,
109158
+ inputLabelMarker,
109159
+ ruleOpenColor
109160
+ } from "@bastani/atomic";
109161
+
108912
109162
  // dist/builtin/workflows/src/tui/stage-chat-view-render-helpers.ts
108913
109163
  var ITALIC = "\x1B[3m";
108914
109164
  var FG_RESET = "\x1B[39m";
@@ -109037,16 +109287,20 @@ function renderHintsForPrompt(kind, theme) {
109037
109287
  }
109038
109288
 
109039
109289
  // dist/builtin/workflows/src/tui/stage-input-label.ts
109040
- var STAGE_INPUT_LABEL_MIN_COLUMNS = 40;
109041
- var STAGE_LABEL_MARKER = "[stage:";
109042
- var EDITOR_PREFIX = "[stage: ";
109043
- var EDITOR_SUFFIX = "] ";
109290
+ var STAGE_INPUT_LABEL_MIN_COLUMNS = INPUT_LABEL_MIN_COLUMNS;
109291
+ var STAGE_LABEL_MARKER = inputLabelMarker("stage");
109044
109292
  var WIDGET_PREFIX = "[stage: ";
109045
109293
  var WIDGET_SUFFIX = "]";
109046
109294
  var AWAITING_PREFIX = " [stage: ";
109047
109295
  var AWAITING_SUFFIX = "] ";
109048
109296
  var BOX_OPEN_CHARS = "╭┌+";
109049
109297
  var BOX_CLOSE_CHARS = "╮┐+";
109298
+ function stageLabelStyle(theme) {
109299
+ return {
109300
+ textMuted: (text) => paint2(text, theme.textMuted),
109301
+ text: (text) => paint2(text, theme.text)
109302
+ };
109303
+ }
109050
109304
  function resolvedStageName(stageName) {
109051
109305
  if (stageName === undefined || stageName.length === 0)
109052
109306
  return;
@@ -109055,63 +109309,11 @@ function resolvedStageName(stageName) {
109055
109309
  function lineHasStageLabel(line) {
109056
109310
  return stripAnsi(line).includes(STAGE_LABEL_MARKER);
109057
109311
  }
109058
- function leadingAnsi(line) {
109059
- return line.match(/^(\x1b\[[0-9;]*m)/)?.[1] ?? "";
109060
- }
109061
109312
  function buildStageInputLabel(theme, stageName, maxNameWidth, prefix, suffix) {
109062
- if (maxNameWidth < 1)
109063
- return;
109064
- const truncatedName = truncateToWidth(stageName, maxNameWidth, "…");
109065
- if (truncatedName.length === 0)
109066
- return;
109067
- const plain = prefix + truncatedName + suffix;
109068
- return {
109069
- plain,
109070
- styled: paint2(prefix, theme.textMuted) + paint2(truncatedName, theme.text, { bold: true }) + paint2(suffix, theme.textMuted)
109071
- };
109072
- }
109073
- var EDITOR_OVERFLOW_RE = /^(─*)( ↑ \d+ more )(─*)$/;
109074
- function editorOverflowPlain(plain) {
109075
- return EDITOR_OVERFLOW_RE.exec(plain)?.[2];
109076
- }
109077
- function decorateEditorTopLine(theme, name, line, plain, overflow) {
109078
- const width = visibleWidth(plain);
109079
- if (width < STAGE_INPUT_LABEL_MIN_COLUMNS)
109080
- return;
109081
- const overflowWidth = overflow === undefined ? 0 : visibleWidth(overflow);
109082
- const maxNameWidth = Math.max(1, width - overflowWidth - visibleWidth(EDITOR_PREFIX) - visibleWidth(EDITOR_SUFFIX) - 2);
109083
- const label = buildStageInputLabel(theme, name, maxNameWidth, EDITOR_PREFIX, EDITOR_SUFFIX);
109084
- if (!label)
109085
- return;
109086
- const labelWidth = visibleWidth(label.plain);
109087
- if (labelWidth + overflowWidth >= width)
109088
- return;
109089
- const fillWidth = Math.max(0, width - labelWidth - overflowWidth);
109090
- const openColor = leadingAnsi(line);
109091
- if (overflow === undefined) {
109092
- return openColor + RESET + label.styled + openColor + "─".repeat(fillWidth) + RESET;
109093
- }
109094
- const leftFill = Math.floor(fillWidth / 2);
109095
- const rightFill = fillWidth - leftFill;
109096
- return openColor + RESET + label.styled + openColor + "─".repeat(leftFill) + overflow + "─".repeat(rightFill) + RESET;
109313
+ return buildInputLabel(stageLabelStyle(theme), stageName, maxNameWidth, prefix, suffix);
109097
109314
  }
109098
109315
  function applyStageLabelToEditorTopRule(theme, stageName, editorLines) {
109099
- const name = resolvedStageName(stageName);
109100
- if (!name || editorLines.length === 0)
109101
- return [...editorLines];
109102
- const topLine = editorLines[0] ?? "";
109103
- if (lineHasStageLabel(topLine))
109104
- return [...editorLines];
109105
- const plain = stripAnsi(topLine);
109106
- const overflow = editorOverflowPlain(plain);
109107
- if (!/^─+$/.test(plain) && overflow === undefined)
109108
- return [...editorLines];
109109
- const decorated = decorateEditorTopLine(theme, name, topLine, plain, overflow);
109110
- if (decorated === undefined)
109111
- return [...editorLines];
109112
- const result = [...editorLines];
109113
- result[0] = decorated;
109114
- return result;
109316
+ return applyInputLabelToEditorTopRule(stageLabelStyle(theme), "stage", stageName, editorLines);
109115
109317
  }
109116
109318
  function classifyWidgetTopRule(plain) {
109117
109319
  const chars = Array.from(plain);
@@ -109154,7 +109356,7 @@ function applyStageLabelToWidgetTopRule(theme, stageName, widgetLines, width) {
109154
109356
  if (openWidth + labelWidth + closeWidth >= rule.width)
109155
109357
  return [...widgetLines];
109156
109358
  const fillWidth = Math.max(0, rule.width - openWidth - labelWidth - closeWidth);
109157
- const openColor = leadingAnsi(topLine);
109359
+ const openColor = ruleOpenColor(topLine);
109158
109360
  const newTopLine = rule.kind === "pure" ? openColor + RESET + label.styled + openColor + "─".repeat(fillWidth) + RESET : openColor + rule.open + RESET + label.styled + openColor + "─".repeat(fillWidth) + rule.close + RESET;
109159
109361
  return [newTopLine, ...widgetLines.slice(1)];
109160
109362
  }
@@ -109190,7 +109392,7 @@ function applyStageLabelToAwaitingInputTopRule(theme, stageName, lines) {
109190
109392
  if (visibleWidth(combined) > innerWidth)
109191
109393
  return [...lines];
109192
109394
  const fillLen = Math.max(0, innerWidth - visibleWidth(combined));
109193
- const openColor = leadingAnsi(line);
109395
+ const openColor = ruleOpenColor(line);
109194
109396
  const result = [...lines];
109195
109397
  result[unlabeledIndex] = `${openColor}╭${RESET}${combined}${openColor}${"─".repeat(fillLen)}╮${RESET}`;
109196
109398
  return result;
@@ -112905,7 +113107,7 @@ function isDisplayablePrompt(message) {
112905
113107
  function isTerminalOrBlockedRun(run) {
112906
113108
  return TERMINAL_OR_BLOCKED2.has(effectiveRunStatus(run)) || run.endedAt !== undefined;
112907
113109
  }
112908
- function isQuitRun3(run) {
113110
+ function isQuitRun4(run) {
112909
113111
  return run.endedAt === undefined && run.status === "paused" && run.exitReason === "quit";
112910
113112
  }
112911
113113
  function hasLiveAncestry(candidate, visibleRun, runsById) {
@@ -112921,7 +113123,7 @@ function hasLiveAncestry(candidate, visibleRun, runsById) {
112921
113123
  return false;
112922
113124
  const parent = runsById.get(parentRunId);
112923
113125
  const boundary = parent?.stages.find((stage) => stage.id === parentStageId);
112924
- if (parent === undefined || isTerminalOrBlockedRun(parent) || isQuitRun3(parent) || boundary === undefined || boundary.status !== "running" && boundary.status !== "awaiting_input") {
113126
+ if (parent === undefined || isTerminalOrBlockedRun(parent) || isQuitRun4(parent) || boundary === undefined || boundary.status !== "running" && boundary.status !== "awaiting_input") {
112925
113127
  return false;
112926
113128
  }
112927
113129
  current = parent;
@@ -112929,12 +113131,12 @@ function hasLiveAncestry(candidate, visibleRun, runsById) {
112929
113131
  return true;
112930
113132
  }
112931
113133
  function visibleRunTreeMembers(visibleRun, allRuns) {
112932
- if (isTerminalOrBlockedRun(visibleRun) || isQuitRun3(visibleRun))
113134
+ if (isTerminalOrBlockedRun(visibleRun) || isQuitRun4(visibleRun))
112933
113135
  return [];
112934
113136
  const runsById = new Map;
112935
113137
  const ambiguousRunIds = new Set;
112936
113138
  for (const candidate of allRuns) {
112937
- if (isTerminalOrBlockedRun(candidate) || isQuitRun3(candidate))
113139
+ if (isTerminalOrBlockedRun(candidate) || isQuitRun4(candidate))
112938
113140
  continue;
112939
113141
  if (runsById.has(candidate.id))
112940
113142
  ambiguousRunIds.add(candidate.id);
@@ -112947,7 +113149,7 @@ function visibleRunTreeMembers(visibleRun, allRuns) {
112947
113149
  return [];
112948
113150
  const members = [visibleRun];
112949
113151
  for (const candidate of allRuns) {
112950
- if (isTerminalOrBlockedRun(candidate) || isQuitRun3(candidate))
113152
+ if (isTerminalOrBlockedRun(candidate) || isQuitRun4(candidate))
112951
113153
  continue;
112952
113154
  if (candidate.id === visibleRun.id || ambiguousRunIds.has(candidate.id))
112953
113155
  continue;
@@ -113017,7 +113219,7 @@ function runPromptOccurrenceForStage(run, stage, prompt) {
113017
113219
  return descriptorOccurrence(run, stage.id, prompt.id, message, isDisplayablePrompt(message));
113018
113220
  }
113019
113221
  function pendingInputOccurrences(run) {
113020
- if (isTerminalOrBlockedRun(run) || isQuitRun3(run))
113222
+ if (isTerminalOrBlockedRun(run) || isQuitRun4(run))
113021
113223
  return [];
113022
113224
  const occurrences = run.pendingPrompt === undefined ? [] : [runPromptOccurrence(run, run.pendingPrompt)];
113023
113225
  return occurrences.concat(stagePromptOccurrences(run));
@@ -113060,17 +113262,17 @@ function formatDuration(ms) {
113060
113262
  const rmin = minutes % 60;
113061
113263
  return `${hours}h${rmin > 0 ? ` ${rmin}m` : ""}`;
113062
113264
  }
113063
- function isQuitRun4(run) {
113265
+ function isQuitRun5(run) {
113064
113266
  return run.endedAt === undefined && run.status === "paused" && run.exitReason === "quit";
113065
113267
  }
113066
113268
  function isActive(run) {
113067
- return run.endedAt === undefined && !isQuitRun4(run);
113269
+ return run.endedAt === undefined && !isQuitRun5(run);
113068
113270
  }
113069
113271
  function recentlyEnded(run, now) {
113070
113272
  return run.endedAt !== undefined && now - run.endedAt <= RECENT_ENDED_WINDOW_MS;
113071
113273
  }
113072
113274
  function recentlyQuit(run, now) {
113073
- return isQuitRun4(run) && run.quitAt !== undefined && now - run.quitAt <= RECENT_ENDED_WINDOW_MS;
113275
+ return isQuitRun5(run) && run.quitAt !== undefined && now - run.quitAt <= RECENT_ENDED_WINDOW_MS;
113074
113276
  }
113075
113277
  function subtreeAwaitsInput(root, allRuns) {
113076
113278
  return runIndicatorStatus(root, allRuns) === "awaiting_input";
@@ -113079,7 +113281,7 @@ function countRuns(runs, allRuns = runs) {
113079
113281
  const counts = { active: 0, paused: 0, quit: 0, done: 0, blocked: 0, failed: 0, awaiting: 0 };
113080
113282
  for (const r of runs) {
113081
113283
  const status = effectiveRunStatus(r);
113082
- if (isQuitRun4(r))
113284
+ if (isQuitRun5(r))
113083
113285
  counts.quit++;
113084
113286
  else if (status === "blocked")
113085
113287
  counts.blocked++;
@@ -113091,7 +113293,7 @@ function countRuns(runs, allRuns = runs) {
113091
113293
  counts.done++;
113092
113294
  else if (status === "failed" || status === "killed")
113093
113295
  counts.failed++;
113094
- if (r.endedAt === undefined && !isQuitRun4(r) && subtreeAwaitsInput(r, allRuns))
113296
+ if (r.endedAt === undefined && !isQuitRun5(r) && subtreeAwaitsInput(r, allRuns))
113095
113297
  counts.awaiting++;
113096
113298
  }
113097
113299
  return counts;
@@ -113104,7 +113306,7 @@ function nextWidgetRefreshDelayMs(snap, now = Date.now()) {
113104
113306
  for (const run of display) {
113105
113307
  if (run.endedAt !== undefined) {
113106
113308
  delays.push(Math.max(1, run.endedAt + RECENT_ENDED_WINDOW_MS - now + 1));
113107
- } else if (isQuitRun4(run) && run.quitAt !== undefined) {
113309
+ } else if (isQuitRun5(run) && run.quitAt !== undefined) {
113108
113310
  delays.push(Math.max(1, run.quitAt + RECENT_ENDED_WINDOW_MS - now + 1));
113109
113311
  }
113110
113312
  }
@@ -113124,12 +113326,12 @@ function selectDisplayRuns(snap, now) {
113124
113326
  return [...sort(active), ...sort(recent)];
113125
113327
  }
113126
113328
  function statusGlyph2(run, allRuns) {
113127
- if (isQuitRun4(run))
113329
+ if (isQuitRun5(run))
113128
113330
  return statusIcon("pending");
113129
113331
  return statusIcon(runIndicatorStatus(run, allRuns));
113130
113332
  }
113131
113333
  function statusFg(run, theme, allRuns) {
113132
- if (isQuitRun4(run))
113334
+ if (isQuitRun5(run))
113133
113335
  return theme.warning;
113134
113336
  const indicatorStatus = runIndicatorStatus(run, allRuns);
113135
113337
  if (indicatorStatus === "awaiting_input")
@@ -113215,7 +113417,7 @@ function metaLine(run, expandGraph, now, width = Number.POSITIVE_INFINITY, resol
113215
113417
  if (run.endedAt !== undefined) {
113216
113418
  return elapsedLabel(run, now);
113217
113419
  }
113218
- if (isQuitRun4(run))
113420
+ if (isQuitRun5(run))
113219
113421
  return run.resumable === false ? "quit · not resumable" : "quit · resumable via /workflow resume";
113220
113422
  if (effectiveRunStatus(run) === "blocked")
113221
113423
  return "blocked · resumable via /workflow resume";
@@ -113364,8 +113566,8 @@ function buildThemedWidgetLines(snap, piTheme, width = 120, now = Date.now(), la
113364
113566
  const displayCounts = countRuns(display, snap.runs);
113365
113567
  const visibleCounts = {
113366
113568
  active: display.filter((r) => r.endedAt === undefined && effectiveRunStatus(r) === "running").length,
113367
- paused: display.filter((r) => r.endedAt === undefined && effectiveRunStatus(r) === "paused" && !isQuitRun4(r)).length,
113368
- quit: display.filter(isQuitRun4).length,
113569
+ paused: display.filter((r) => r.endedAt === undefined && effectiveRunStatus(r) === "paused" && !isQuitRun5(r)).length,
113570
+ quit: display.filter(isQuitRun5).length,
113369
113571
  done: display.filter((r) => r.endedAt !== undefined && ["completed", "skipped", "cancelled"].includes(effectiveRunStatus(r))).length,
113370
113572
  blocked: display.filter((r) => effectiveRunStatus(r) === "blocked").length,
113371
113573
  failed: display.filter((r) => r.endedAt !== undefined && ["failed", "killed"].includes(effectiveRunStatus(r))).length,
@@ -113390,7 +113592,7 @@ function buildThemedWidgetLines(snap, piTheme, width = 120, now = Date.now(), la
113390
113592
  for (let i = 0;i < display.length; i++) {
113391
113593
  const run = display[i];
113392
113594
  const affordance = pendingInputAffordance(run, snap.runs);
113393
- const runLines = !isQuitRun4(run) && affordance !== undefined ? awaitingRunLines(run, now, themed ? graphTheme : undefined, snap.runs, affordance, bodyWidth, expandGraph) : themed ? themedRunLines(run, now, graphTheme, snap.runs, width, expandGraph) : plainRunLines(run, now, snap.runs, width, expandGraph);
113595
+ const runLines = !isQuitRun5(run) && affordance !== undefined ? awaitingRunLines(run, now, themed ? graphTheme : undefined, snap.runs, affordance, bodyWidth, expandGraph) : themed ? themedRunLines(run, now, graphTheme, snap.runs, width, expandGraph) : plainRunLines(run, now, snap.runs, width, expandGraph);
113394
113596
  body.push(...runLines);
113395
113597
  layout?.runs.push({
113396
113598
  id: run.id,
@@ -121160,9 +121362,6 @@ init_resume_eligibility();
121160
121362
  import { keyText as keyText2 } from "@bastani/atomic";
121161
121363
  init_workflow_artifacts();
121162
121364
  var ESCAPE_CODE = 27;
121163
- function isQuitRun5(run) {
121164
- return run.endedAt === undefined && run.status === "paused" && run.exitReason === "quit";
121165
- }
121166
121365
  var DOUBLE_ESCAPE_SEQUENCE = String.fromCharCode(ESCAPE_CODE, ESCAPE_CODE);
121167
121366
  function createSessionPickerState() {
121168
121367
  return { query: "", selectedIndex: 0, includeAll: true, filterFocused: false };
@@ -121309,9 +121508,11 @@ function renderRunRow(row, isSelected, inner, theme, now, allRuns) {
121309
121508
  const border = hexToAnsi(theme.border);
121310
121509
  const panelBg = hexBg(theme.bg);
121311
121510
  const run = row.run;
121312
- const indicatorStatus = isQuitRun5(run) ? run.status : runIndicatorStatus(run, allRuns);
121313
- const icon = statusIcon(indicatorStatus);
121314
- const iconColor = hexToAnsi(statusColor(indicatorStatus, theme));
121511
+ const runState = runStateIndicator(run);
121512
+ const quitState = runState?.kind === "quit" ? runState : undefined;
121513
+ const indicatorStatus = runIndicatorStatus(run, allRuns);
121514
+ const icon = quitState?.glyph ?? statusIcon(indicatorStatus);
121515
+ const iconColor = hexToAnsi(quitState === undefined ? statusColor(indicatorStatus, theme) : runStateColor(quitState, theme));
121315
121516
  const dim = hexToAnsi(theme.dim);
121316
121517
  const text = hexToAnsi(theme.text);
121317
121518
  const muted = hexToAnsi(theme.textMuted);
@@ -121325,10 +121526,12 @@ function renderRunRow(row, isSelected, inner, theme, now, allRuns) {
121325
121526
  };
121326
121527
  const elapsed = fmtElapsed(run, now);
121327
121528
  const elapsedCol = elapsed.padStart(8, " ");
121328
- const rightPlain = `${elapsedCol} `;
121529
+ const stateText = runState === undefined ? "" : `${runState.text} `;
121530
+ const stateStyled = runState === undefined ? "" : `${hexToAnsi(runStateColor(runState, theme))}${runState.text}${RESET}${panelBg} `;
121531
+ const rightPlain = `${stateText}${elapsedCol} `;
121329
121532
  const rightBudget = Math.max(1, inner - 5);
121330
121533
  const rightVisible = truncateToWidth(rightPlain, rightBudget, "…");
121331
- const right = visibleWidth(rightVisible) < visibleWidth(rightPlain) ? `${dim}${rightVisible}${RESET}${panelBg}` : `${muted}${elapsedCol}${RESET}${panelBg} `;
121534
+ const right = visibleWidth(rightVisible) < visibleWidth(rightPlain) ? `${dim}${rightVisible}${RESET}${panelBg}` : `${stateStyled}${muted}${elapsedCol}${RESET}${panelBg} `;
121332
121535
  const nameBudget = Math.max(1, inner - 3 - visibleWidth(rightVisible) - 1);
121333
121536
  const name = truncateToWidth(run.name, nameBudget, "…");
121334
121537
  const nameRow = isSelected ? `${border}│${RESET}${fillBackground(`${hexToAnsi(theme.backgroundElement)}${BOLD} ${name}${" ".repeat(Math.max(1, inner - 3 - visibleWidth(name) - visibleWidth(rightVisible)))}${rightVisible}`, inner, hexBg(theme.accent))}${border}│${RESET}` : `${border}│${RESET}${fillBackground(` ${text}${name}${RESET}${panelBg}${" ".repeat(Math.max(1, inner - 3 - visibleWidth(name) - visibleWidth(right)))}${right}`, inner, panelBg)}${border}│${RESET}`;
@@ -125237,7 +125440,7 @@ ${renderNotice("SHARED POOL", sharedPoolStatusLines(pool).join(`
125237
125440
  }
125238
125441
 
125239
125442
  // dist/builtin/workflows/src/extension/workflow-prompts.ts
125240
- var WORKFLOW_SELECTION_GUIDANCE = "Unless the user explicitly chooses inline execution for this task, treat workflows as the default execution path for non-trivial tasks and requests with structure and a verifiable objective. Decide yourself whether a workflow fits the request. Use one for well-defined, authorized work that benefits from durable stages, checkpoints, dependencies, recovery, review loops or deliberate approval gates. Work inline for brainstorming, discussion, unclear goals, tiny deterministic low-risk answers or edits where tracking costs more than it adds, or when the user asks to work inline, directly, quickly or without a workflow. Judge the task's shape first, then refine the call with execution history and the user's stated or recorded preferences; missing, sparse, or mostly inline workflow history is not by itself a reason to work inline. Honor an explicit user request for a named workflow. To launch, inspect candidates with list/get/inputs, then call workflow run with the registered workflow name and inputs matching its input contract. Ask only for genuinely missing information.";
125443
+ var WORKFLOW_SELECTION_GUIDANCE = "Unless the user explicitly chooses inline execution for this task, treat workflows as the default execution path for non-trivial tasks and requests with structure and a verifiable objective. Decide yourself whether a workflow fits the request. Use one for well-defined, authorized work that benefits from durable stages, checkpoints, dependencies, recovery, review loops or deliberate approval gates. Work inline for brainstorming, discussion, unclear goals, tiny deterministic low-risk answers or edits where tracking costs more than it adds, or when the user asks to work inline, directly, quickly or without a workflow. Judge the task's shape first, then refine the call with session memory (`history://` sessions and workflow runs) and the user's stated preferences; missing, sparse, or mostly inline workflow history is not by itself a reason to work inline. Honor an explicit user request for a named workflow. To launch, inspect candidates with list/get/inputs, then call workflow run with the registered workflow name and inputs matching its input contract. Ask only for genuinely missing information.";
125241
125444
  var WORKFLOW_TOOL_DESCRIPTION = WORKFLOW_SELECTION_GUIDANCE + " " + "Run starts the named workflow and returns its runId; invalid inputs fail without launching. User /workflow commands launch directly and authored ctx.workflow(...) remains internal composition. " + "When workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; after successfully creating and reloading a newly authored custom workflow, report the folder containing its generated code as 'Custom workflow created. You can inspect its code at: <workflow-folder-path>'; do this only for newly created custom workflows, never builtin or pre-existing workflows; " + "discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details (status with runId includes the final result; add summary:true for just status, result and blockers), " + "answer pending prompts only while the root workflow is nonterminal, pause/resume/quit runs, fork a durable run into a new run (fork with runId, optional fromStage and replacement inputs, to retry from a stage; the source run is never changed), and reload workflow resources. " + "When steering or communication is useful, use Intercom. Before steering a stage, join its invocation group. Use the Intercom `groups` action to discover it. Workflow invocation groups are named `workflow:<rootRunId>`. Then address the stage as `workflow:<rootRunId>/<segment>[/<segment>...]`; each segment may be a stage name, run id, or glob (`*` matches one segment and `**` any depth). Use `intercom list` inside the invocation group to see live, pending, and possible future targets. Live delivery is immediate; a known stage that has not started is queued and receives the message before its first model turn. Name and pattern sends remain sticky for every future matching stage until the root run terminates. When shared scope or acceptance criteria change, broadcast one authoritative update to `workflow:<rootRunId>/**` (or a narrower path pattern) rather than enumerating stages. A syntactically valid target outside the known set still queues and settles undeliverable at terminal only if never delivered; a note appears only when the target looks like a typo of a known stage. Use `ask` only for a reply-capable live session. " + "Treat a blocked run as continuable by default unless the user requests inline/no-workflow execution: then safely hold/stop it, reconcile completed work and in-flight side effects, and continue inline without duplication. Otherwise resume resumable blocks, answer pending prompts, steer past the obstacle, or start a follow-up workflow past a terminal block; resolve material ambiguity from user intent and repository evidence without bypassing safety or authorization. " + "For action 'run' and 'resume', budget accepts per-field duration, token, cost, and warning overrides; fields resolve over the workflow declaration and config, and 0 disables a field. Pass budget only for a user-specified limit; otherwise omit it and inherit. An estimate is not a budget. " + "For primitive prompt answers, use booleans or the documented confirm labels, exact case-insensitive select labels or 1-based indexes, and text strings for input/editor; an invalid answer remains pending and returns guidance instead of choosing a default. " + "For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. " + "Wrap critical parts of run inputs and steering messages in <keepContext>...</keepContext> so compaction preserves them verbatim in the stages that inherit them; tag role constraints, prohibitions, must-hold criteria, and identifiers, not background or bulk reference material. " + "For transcripts, prefer status/stages/stage to get sessionFile/transcriptPath, " + "quote the exact path without rewriting separators (Windows backslashes are valid), " + "then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview. " + "Use action 'models' to inspect models in the configured catalog; the result is a configured-auth snapshot showing what's present in the registry with configured authentication, not proof of credentials, entitlements, OAuth freshness, or live provider access. " + "When a user delegates best-stage-model selection for a custom workflow, author model:'auto'; runtime selects from the actual interpolated stage prompt and supplied context. Preserve explicit user concrete model/effort and constraints.";
125242
125445
  var DEFAULT_PROMPT_GUIDANCE = [
125243
125446
  WORKFLOW_SELECTION_GUIDANCE,