@caupulican/pi-adaptative 0.93.3 → 0.93.4

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 (165) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/core/agent-session.d.ts.map +1 -1
  3. package/dist/core/agent-session.js +15 -9
  4. package/dist/core/agent-session.js.map +1 -1
  5. package/dist/core/autonomy/approval-gate.d.ts +1 -0
  6. package/dist/core/autonomy/approval-gate.d.ts.map +1 -1
  7. package/dist/core/autonomy/approval-gate.js +4 -1
  8. package/dist/core/autonomy/approval-gate.js.map +1 -1
  9. package/dist/core/autonomy/composite-tool-gate.d.ts +13 -0
  10. package/dist/core/autonomy/composite-tool-gate.d.ts.map +1 -0
  11. package/dist/core/autonomy/composite-tool-gate.js +44 -0
  12. package/dist/core/autonomy/composite-tool-gate.js.map +1 -0
  13. package/dist/core/autonomy/envelope-enforcement.d.ts +2 -0
  14. package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
  15. package/dist/core/autonomy/envelope-enforcement.js +48 -7
  16. package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
  17. package/dist/core/autonomy/gates.d.ts.map +1 -1
  18. package/dist/core/autonomy/gates.js +48 -76
  19. package/dist/core/autonomy/gates.js.map +1 -1
  20. package/dist/core/autonomy/path-scope.d.ts.map +1 -1
  21. package/dist/core/autonomy/path-scope.js +7 -7
  22. package/dist/core/autonomy/path-scope.js.map +1 -1
  23. package/dist/core/background-tool-task-controller.d.ts +2 -0
  24. package/dist/core/background-tool-task-controller.d.ts.map +1 -1
  25. package/dist/core/background-tool-task-controller.js +13 -5
  26. package/dist/core/background-tool-task-controller.js.map +1 -1
  27. package/dist/core/compaction-controller.d.ts +3 -0
  28. package/dist/core/compaction-controller.d.ts.map +1 -1
  29. package/dist/core/compaction-controller.js +132 -97
  30. package/dist/core/compaction-controller.js.map +1 -1
  31. package/dist/core/delegation/session-root-mailbox.d.ts.map +1 -1
  32. package/dist/core/delegation/session-root-mailbox.js +14 -1
  33. package/dist/core/delegation/session-root-mailbox.js.map +1 -1
  34. package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -1
  35. package/dist/core/delegation/worker-agent-control-coordinator.js +6 -9
  36. package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -1
  37. package/dist/core/delegation/worker-authority-resolver.d.ts.map +1 -1
  38. package/dist/core/delegation/worker-authority-resolver.js +3 -2
  39. package/dist/core/delegation/worker-authority-resolver.js.map +1 -1
  40. package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
  41. package/dist/core/delegation/worker-execution-policy.js +10 -8
  42. package/dist/core/delegation/worker-execution-policy.js.map +1 -1
  43. package/dist/core/foreground-recovery-controller.d.ts +2 -0
  44. package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
  45. package/dist/core/foreground-recovery-controller.js +18 -9
  46. package/dist/core/foreground-recovery-controller.js.map +1 -1
  47. package/dist/core/goal-loop-controller.d.ts.map +1 -1
  48. package/dist/core/goal-loop-controller.js +3 -5
  49. package/dist/core/goal-loop-controller.js.map +1 -1
  50. package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
  51. package/dist/core/goals/goal-auto-continue-controller.js +6 -0
  52. package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
  53. package/dist/core/goals/goal-state.d.ts.map +1 -1
  54. package/dist/core/goals/goal-state.js +1 -0
  55. package/dist/core/goals/goal-state.js.map +1 -1
  56. package/dist/core/goals/goal-tool-core.d.ts +2 -0
  57. package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
  58. package/dist/core/goals/goal-tool-core.js +1 -1
  59. package/dist/core/goals/goal-tool-core.js.map +1 -1
  60. package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
  61. package/dist/core/orchestration/capability-gateway.js +32 -9
  62. package/dist/core/orchestration/capability-gateway.js.map +1 -1
  63. package/dist/core/orchestration/lane-tool-manifests.js +5 -5
  64. package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
  65. package/dist/core/orchestration/policy-compiler.d.ts.map +1 -1
  66. package/dist/core/orchestration/policy-compiler.js +7 -0
  67. package/dist/core/orchestration/policy-compiler.js.map +1 -1
  68. package/dist/core/orchestration/profile-registry.js +2 -2
  69. package/dist/core/orchestration/profile-registry.js.map +1 -1
  70. package/dist/core/pipelines/active-context.d.ts +16 -0
  71. package/dist/core/pipelines/active-context.d.ts.map +1 -0
  72. package/dist/core/pipelines/active-context.js +29 -0
  73. package/dist/core/pipelines/active-context.js.map +1 -0
  74. package/dist/core/pipelines/context.d.ts +1 -1
  75. package/dist/core/pipelines/context.d.ts.map +1 -1
  76. package/dist/core/pipelines/context.js +40 -31
  77. package/dist/core/pipelines/context.js.map +1 -1
  78. package/dist/core/pipelines/discover.d.ts +5 -1
  79. package/dist/core/pipelines/discover.d.ts.map +1 -1
  80. package/dist/core/pipelines/discover.js +91 -33
  81. package/dist/core/pipelines/discover.js.map +1 -1
  82. package/dist/core/pipelines/increment.d.ts +0 -2
  83. package/dist/core/pipelines/increment.d.ts.map +1 -1
  84. package/dist/core/pipelines/increment.js +35 -13
  85. package/dist/core/pipelines/increment.js.map +1 -1
  86. package/dist/core/pipelines/index.d.ts +4 -3
  87. package/dist/core/pipelines/index.d.ts.map +1 -1
  88. package/dist/core/pipelines/index.js +4 -3
  89. package/dist/core/pipelines/index.js.map +1 -1
  90. package/dist/core/pipelines/run-state.d.ts +8 -0
  91. package/dist/core/pipelines/run-state.d.ts.map +1 -1
  92. package/dist/core/pipelines/run-state.js +172 -38
  93. package/dist/core/pipelines/run-state.js.map +1 -1
  94. package/dist/core/pipelines/types.d.ts +2 -0
  95. package/dist/core/pipelines/types.d.ts.map +1 -1
  96. package/dist/core/pipelines/types.js +21 -4
  97. package/dist/core/pipelines/types.js.map +1 -1
  98. package/dist/core/runtime-builder.d.ts +2 -1
  99. package/dist/core/runtime-builder.d.ts.map +1 -1
  100. package/dist/core/runtime-builder.js +46 -10
  101. package/dist/core/runtime-builder.js.map +1 -1
  102. package/dist/core/system-prompt-builder.d.ts +1 -0
  103. package/dist/core/system-prompt-builder.d.ts.map +1 -1
  104. package/dist/core/system-prompt-builder.js +25 -1
  105. package/dist/core/system-prompt-builder.js.map +1 -1
  106. package/dist/core/system-prompt.d.ts.map +1 -1
  107. package/dist/core/system-prompt.js +6 -1
  108. package/dist/core/system-prompt.js.map +1 -1
  109. package/dist/core/tasks/task-projection.d.ts +2 -0
  110. package/dist/core/tasks/task-projection.d.ts.map +1 -1
  111. package/dist/core/tasks/task-projection.js +2 -0
  112. package/dist/core/tasks/task-projection.js.map +1 -1
  113. package/dist/core/tasks/task-state.d.ts +10 -0
  114. package/dist/core/tasks/task-state.d.ts.map +1 -1
  115. package/dist/core/tasks/task-state.js +43 -2
  116. package/dist/core/tasks/task-state.js.map +1 -1
  117. package/dist/core/tool-capability-policy.d.ts +13 -3
  118. package/dist/core/tool-capability-policy.d.ts.map +1 -1
  119. package/dist/core/tool-capability-policy.js +136 -28
  120. package/dist/core/tool-capability-policy.js.map +1 -1
  121. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  122. package/dist/core/tools/edit-diff.js +45 -7
  123. package/dist/core/tools/edit-diff.js.map +1 -1
  124. package/dist/core/tools/edit.d.ts.map +1 -1
  125. package/dist/core/tools/edit.js +4 -0
  126. package/dist/core/tools/edit.js.map +1 -1
  127. package/dist/core/tools/goal.d.ts.map +1 -1
  128. package/dist/core/tools/goal.js +17 -1
  129. package/dist/core/tools/goal.js.map +1 -1
  130. package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
  131. package/dist/core/tools/orchestration-panel.js +1 -0
  132. package/dist/core/tools/orchestration-panel.js.map +1 -1
  133. package/dist/core/tools/persistent-process-coordinator.d.ts.map +1 -1
  134. package/dist/core/tools/persistent-process-coordinator.js +12 -7
  135. package/dist/core/tools/persistent-process-coordinator.js.map +1 -1
  136. package/dist/core/tools/pipeline.d.ts +1 -0
  137. package/dist/core/tools/pipeline.d.ts.map +1 -1
  138. package/dist/core/tools/pipeline.js +95 -44
  139. package/dist/core/tools/pipeline.js.map +1 -1
  140. package/dist/core/tools/secret-store.d.ts.map +1 -1
  141. package/dist/core/tools/secret-store.js +2 -1
  142. package/dist/core/tools/secret-store.js.map +1 -1
  143. package/dist/core/tools/shell-session.d.ts.map +1 -1
  144. package/dist/core/tools/shell-session.js +6 -1
  145. package/dist/core/tools/shell-session.js.map +1 -1
  146. package/dist/core/tools/task-steps.d.ts +10 -0
  147. package/dist/core/tools/task-steps.d.ts.map +1 -1
  148. package/dist/core/tools/task-steps.js +70 -29
  149. package/dist/core/tools/task-steps.js.map +1 -1
  150. package/dist/core/tools/windows-shell-engine.d.ts.map +1 -1
  151. package/dist/core/tools/windows-shell-engine.js +6 -1
  152. package/dist/core/tools/windows-shell-engine.js.map +1 -1
  153. package/dist/core/util/bounded-file.d.ts +8 -0
  154. package/dist/core/util/bounded-file.d.ts.map +1 -1
  155. package/dist/core/util/bounded-file.js +81 -16
  156. package/dist/core/util/bounded-file.js.map +1 -1
  157. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  158. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  159. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  160. package/examples/extensions/sandbox/package-lock.json +2 -2
  161. package/examples/extensions/sandbox/package.json +1 -1
  162. package/examples/extensions/with-deps/package-lock.json +2 -2
  163. package/examples/extensions/with-deps/package.json +1 -1
  164. package/npm-shrinkwrap.json +12 -12
  165. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"goal.js","sourceRoot":"","sources":["../../../src/core/tools/goal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAA0B,oBAAoB,EAAE,MAAM,4BAA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C,MAAM,KAAK,UAAU;oBAC5B,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE;oBACxB,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YACzD,OAAO,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACxE,CAAC;KACD,CAAC;IAEF,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AACnD,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { stat as fsStat } from \"node:fs/promises\";\nimport { type Static, Type } from \"typebox\";\nimport type { WorkerClaim } from \"../autonomy/contracts.ts\";\nimport type { LaneRecord } from \"../autonomy/lane-tracker.ts\";\nimport type { BackgroundToolTaskRef } from \"../background-tool-task-controller.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { type GoalStateRevision, getGoalStateRevision } from \"../goals/goal-lifecycle.ts\";\nimport { type GoalEvidenceKind, type GoalState, type GoalStatus, isGoalExecutionActive } from \"../goals/goal-state.ts\";\nimport {\n\tapplyGoalAction,\n\ttype GoalAction,\n\ttype GoalActionName,\n\ttype OpenTaskStepRef,\n\tsummarizeGoalState,\n} from \"../goals/goal-tool-core.ts\";\nimport { GOAL_LIFECYCLE_TOOL_NAMES, LEGACY_GOAL_TOOL_NAME } from \"../goals/goal-tool-names.ts\";\nimport {\n\temptyOrchestrationCall,\n\ttype OrchestrationPanelModel,\n\trenderOrchestrationToolResult,\n} from \"./orchestration-panel.ts\";\nimport { resolveToCwd } from \"./path-utils.ts\";\n\nconst goalSchema = Type.Object(\n\t{\n\t\taction: Type.Union(\n\t\t\t[\n\t\t\t\tType.Literal(\"get\"),\n\t\t\t\tType.Literal(\"start\"),\n\t\t\t\tType.Literal(\"add_requirement\"),\n\t\t\t\tType.Literal(\"satisfy_requirement\"),\n\t\t\t\tType.Literal(\"block_requirement\"),\n\t\t\t\tType.Literal(\"reopen_requirement\"),\n\t\t\t\tType.Literal(\"dispatch_worker\"),\n\t\t\t\tType.Literal(\"add_evidence\"),\n\t\t\t\tType.Literal(\"progress\"),\n\t\t\t\tType.Literal(\"no_progress\"),\n\t\t\t\tType.Literal(\"complete\"),\n\t\t\t\tType.Literal(\"increment\"),\n\t\t\t\tType.Literal(\"block_goal\"),\n\t\t\t],\n\t\t\t{ description: \"Goal record action.\" },\n\t\t),\n\t\tgoalId: Type.Optional(Type.String({ description: \"Stable goal id. Required for action 'start'.\" })),\n\t\tuserGoal: Type.Optional(Type.String({ description: \"The goal statement. Required for action 'start'.\" })),\n\t\ttokenBudget: Type.Optional(\n\t\t\tType.Integer({ minimum: 1, description: \"Optional positive token budget for action 'start'.\" }),\n\t\t),\n\t\trequirementId: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Requirement id for requirement actions.\",\n\t\t\t}),\n\t\t),\n\t\ttext: Type.Optional(Type.String({ description: \"Requirement text. Required for add_requirement.\" })),\n\t\tdependencies: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Optional IDs of requirements that must be satisfied before this one. Valid for add_requirement.\",\n\t\t\t}),\n\t\t),\n\t\tinstructions: Type.Optional(Type.String({ description: \"Worker instructions. Required for dispatch_worker.\" })),\n\t\tevidenceId: Type.Optional(Type.String({ description: \"Evidence id. Required for add_evidence.\" })),\n\t\tevidenceIds: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"Existing evidence ids for satisfy_requirement.\",\n\t\t\t}),\n\t\t),\n\t\tkind: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[\n\t\t\t\t\tType.Literal(\"file\"),\n\t\t\t\t\tType.Literal(\"test\"),\n\t\t\t\t\tType.Literal(\"tool\"),\n\t\t\t\t\tType.Literal(\"user\"),\n\t\t\t\t\tType.Literal(\"finding\"),\n\t\t\t\t\tType.Literal(\"worker\"),\n\t\t\t\t],\n\t\t\t\t{ description: \"Evidence kind. Required for add_evidence.\" },\n\t\t\t),\n\t\t),\n\t\tsummary: Type.Optional(Type.String({ description: \"Evidence summary. Required for add_evidence.\" })),\n\t\turi: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Optional file/URL, toolCallId, or laneId evidence locator.\",\n\t\t\t}),\n\t\t),\n\t\treason: Type.Optional(Type.String({ description: \"Reason for block_requirement or block_goal.\" })),\n\t\tdispatchTarget: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"in_process\"), Type.Literal(\"tmux\")], {\n\t\t\t\tdescription: \"Legacy target. Native is default; use tmux only for an owner-requested persistent pane.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst createGoalSchema = Type.Object(\n\t{\n\t\tobjective: Type.String({ description: \"Required. The concrete objective to start pursuing.\" }),\n\t\ttoken_budget: Type.Optional(\n\t\t\tType.Integer({ minimum: 1, description: \"Positive token budget. Omit unless explicitly requested.\" }),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst getGoalSchema = Type.Object({}, { additionalProperties: false });\n\nconst updateGoalSchema = Type.Object(\n\t{\n\t\tstatus: Type.Union([Type.Literal(\"active\"), Type.Literal(\"complete\"), Type.Literal(\"blocked\")], {\n\t\t\tdescription:\n\t\t\t\t\"Set active after concrete progress, complete after an evidence audit, or blocked after the same blocker persists for three turns.\",\n\t\t}),\n\t\treason: Type.Optional(\n\t\t\tType.String({ minLength: 1, description: \"Required for blocked: the recurring external blocker.\" }),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type GoalToolInput = Static<typeof goalSchema>;\nexport type GoalToolDefinition = ToolDefinition;\n\nexport interface GoalToolDetails {\n\taction: GoalActionName | \"get\";\n\tapplied: boolean;\n\terror?: string;\n\tstate?: GoalState;\n\t/** Set on 'dispatch_worker' when a worker lane actually started; mirrors the requirement's\n\t * new `boundLaneId`. The in-process route by default, or a real persistent tmux lane when\n\t * `dispatchTarget:\"tmux\"` was selected and routed -- see {@link GoalToolDependencies.dispatchTmuxWorker}. */\n\tdispatchedLaneId?: string;\n\t/** Set on 'dispatch_worker' when no worker was dispatched: a wired dependency declined (e.g. worker\n\t * delegation disabled, already at capacity, or an honest tmux skip reason -- see\n\t * {@link GoalToolDependencies.dispatchTmuxWorker}), or the indeterminate-binding guard refused a\n\t * re-dispatch against an already-bound requirement (`requirement_already_bound`/`bound_lane_indeterminate`).\n\t * The binding is recorded (or, for a guard refusal, left exactly as it was) with no NEW laneId. */\n\tdispatchSkipReason?: string;\n}\n\nexport interface GoalToolDependencies {\n\t/** Read the latest persisted goal state for the active session. */\n\tgetGoalState: () => GoalState | undefined;\n\t/** Persist a new goal state snapshot to the active session. */\n\tsaveGoalState: (state: GoalState, expected?: GoalStateRevision) => void;\n\t/** Clock injection for deterministic tests. */\n\tnow?: () => string;\n\t/**\n\t * Check whether `toolCallId` exists in this session's records, for validating kind:\"tool\"\n\t * evidence refs at add_evidence time. When not wired, a \"tool\" ref cannot be proven and is\n\t * recorded as `verified: false` rather than assumed true.\n\t */\n\thasToolCallId?: (toolCallId: string) => boolean;\n\t/**\n\t * Read the session's live worker lane records, for validating kind:\"worker\" evidence refs\n\t * (the `uri` is a laneId) at add_evidence time. Read-defensive: when not wired -- exactly like\n\t * `hasToolCallId` -- a \"worker\" ref cannot be proven and is recorded as `verified: false` rather\n\t * than assumed true. Live wiring is added separately.\n\t */\n\tgetLaneRecords?: () => readonly LaneRecord[];\n\t/**\n\t * Read persisted worker claim snapshots (keyed by `WorkerClaim.requestId`, which is the same\n\t * id as the dispatching lane's laneId), for validating kind:\"worker\" evidence refs. See\n\t * {@link getLaneRecords}. A matching claim that is `parentReviewRequired && !parentReviewedAt`\n\t * verifies `false` -- an unreviewed worker completion must never ungate goal completion through\n\t * the existing verified/complete gate.\n\t */\n\tgetWorkerClaimSnapshots?: () => readonly WorkerClaim[];\n\t/**\n\t * Tool-layer side effect for a 'dispatch_worker' action when `dispatchTarget` is 'in_process'\n\t * (the default) or when {@link dispatchTmuxWorker} is not wired: dispatches a real in-process\n\t * worker lane for the given requirement and returns the resulting laneId to bind onto it. When\n\t * the dependency is present but the underlying delegation starter declines (disabled, already at\n\t * capacity, etc.), return `{ skipReason }` instead of a laneId -- a real, non-silent skip that\n\t * the tool response surfaces, distinct from this dependency being altogether unwired (`undefined`\n\t * dep, or the dep returning `undefined`), which records the binding attempt structurally with no\n\t * laneId (a no-op).\n\t */\n\tstartWorkerDelegation?: (args: {\n\t\trequirementId: string;\n\t\tinstructions: string;\n\t}) => { laneId?: string; skipReason?: string } | undefined;\n\t/**\n\t * Tool-layer side effect for a 'dispatch_worker' action when `input.dispatchTarget === \"tmux\"`:\n\t * dispatches a REAL persistent tmux worker via the tmux_agent_manager extension's `fire_task`\n\t * action (core structurally invokes the same tool call the model would make; no extension change,\n\t * no faked launch or laneId -- see `tmux-dispatch.ts`'s `dispatchTmuxWorker`). Selected ONLY when\n\t * BOTH `input.dispatchTarget === \"tmux\"` AND this dependency is present; otherwise the EXISTING\n\t * {@link startWorkerDelegation} in-process path runs, byte-identical to before this field existed.\n\t * The honest skip-reason vocabulary this can return: `tmux_extension_not_loaded`,\n\t * `no_standing_grant` (the owner has not authorized unattended tmux dispatch),\n\t * `tmux_dispatch_failed`, `tmux_dispatch_incomplete`, `lane_correlation_failed`,\n\t * `worktree_create_failed` (worktree-sync is enabled but the lane-first `create_lane` call was\n\t * refused -- e.g. max lanes reached -- so no fire_task call was ever attempted),\n\t * `worker_capability_insufficient` (the model is sub-full class, has an unknown context window,\n\t * does not advertise a native tool-call path, or is graded-demoted to text-protocol/none -- see\n\t * `model-capability.ts`'s `evaluateLaneWorkerRefusal`; this is the parent's best-effort check\n\t * only, refused before any lane/pane side effect -- the dispatched child still refuses\n\t * authoritatively at its own startup regardless).\n\t */\n\tdispatchTmuxWorker?: (args: {\n\t\trequirementId: string;\n\t\tinstructions: string;\n\t}) => Promise<{ laneId?: string; skipReason?: string }>;\n\t/** Working directory for resolving kind:\"file\" evidence ref paths. Defaults to `process.cwd()`. */\n\tcwd?: () => string;\n\t/**\n\t * Gate agent-facing 'complete' on verified/user evidence backing. Defaults to `true` (on)\n\t * when omitted -- the conservative default; set to a function returning `false` to opt out.\n\t */\n\trequireVerifiedEvidenceForCompletion?: () => boolean;\n\t/**\n\t * Read-only open (non-terminal) task_steps steps on the active branch, for the goal⇄task\n\t * cross-visibility nudge in the tool response. When omitted, `summarizeGoalState` gets\n\t * no task-step context and simply emits no nudge -- goal-tool-core stays pure and never reads\n\t * task state itself; this is the only place that supplies it.\n\t */\n\tgetOpenTaskSteps?: () => readonly OpenTaskStepRef[];\n\t/** Live background tool_task records for kind:\"tool\" evidence and complete-time re-check. */\n\tgetBackgroundToolTasks?: () => readonly BackgroundToolTaskRef[];\n\t/** Active ICM pipeline run for the complete/increment join. */\n\tgetActivePipeline?: () => { runId: string; pipelineName: string; goalId?: string; status: string } | undefined;\n\t/** Model-facing start authority for the current foreground turn. Omitted by direct owner/test callers. */\n\tauthorizeStart?: (input: Pick<GoalToolInput, \"userGoal\" | \"tokenBudget\">) => string | undefined;\n\t/**\n\t * Live tool-evidence check. When wired, kind:\"tool\" uses this instead of {@link hasToolCallId}\n\t * so a still-running background handoff cannot verify as done.\n\t */\n\tresolveToolEvidence?: (uri: string) => boolean;\n}\n\nfunction allowsNativeTmuxFallback(reason: string | undefined): boolean {\n\treturn reason === \"tmux_unavailable\" || reason === \"tmux_extension_not_loaded\";\n}\n\n/**\n * Validate an evidence ref's `uri` against session records (\"tool\") or the filesystem (\"file\").\n * Returns `undefined` for kinds/refs that carry nothing checkable (e.g. \"user\"/\"finding\"/\"test\",\n * or a missing `uri`) -- absence of a ref is not the same as a ref that failed to verify.\n */\nasync function resolveEvidenceVerified(\n\tkind: GoalEvidenceKind,\n\turi: string | undefined,\n\tdeps: GoalToolDependencies,\n): Promise<boolean | undefined> {\n\tconst trimmedUri = uri?.trim();\n\tif (!trimmedUri) return undefined;\n\tif (kind === \"tool\") {\n\t\tif (deps.resolveToolEvidence) return deps.resolveToolEvidence(trimmedUri);\n\t\treturn deps.hasToolCallId ? deps.hasToolCallId(trimmedUri) : false;\n\t}\n\tif (kind === \"file\") {\n\t\tconst cwd = deps.cwd?.() ?? process.cwd();\n\t\ttry {\n\t\t\tconst stats = await fsStat(resolveToCwd(trimmedUri, cwd));\n\t\t\treturn stats.isFile();\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (kind === \"worker\") {\n\t\tif (!deps.getLaneRecords || !deps.getWorkerClaimSnapshots) return false;\n\t\tconst laneId = trimmedUri;\n\t\tconst record = deps.getLaneRecords().find((candidate) => candidate.laneId === laneId);\n\t\tif (!record) return false;\n\t\tconst claim = deps.getWorkerClaimSnapshots().find((candidate) => candidate.requestId === laneId);\n\t\tif (!claim) return false;\n\t\t// An unreviewed mutation (parentReviewRequired && no parentReviewedAt) can never verify true --\n\t\t// this is what stops an unreviewed worker completion from ungating goal completion through\n\t\t// the existing verified/complete gate (goal-tool-core's isVerifiedOrUserEvidence/complete).\n\t\tif (claim.parentReviewRequired === true && claim.parentReviewedAt === undefined) return false;\n\t\treturn claim.status === \"completed\";\n\t}\n\treturn undefined;\n}\n\nfunction toGoalAction(input: GoalToolInput): GoalAction | { error: string } {\n\tswitch (input.action) {\n\t\tcase \"start\":\n\t\t\treturn {\n\t\t\t\taction: \"start\",\n\t\t\t\tgoalId: input.goalId ?? \"\",\n\t\t\t\tuserGoal: input.userGoal ?? \"\",\n\t\t\t\ttokenBudget: input.tokenBudget,\n\t\t\t};\n\t\tcase \"add_requirement\":\n\t\t\treturn {\n\t\t\t\taction: \"add_requirement\",\n\t\t\t\trequirementId: input.requirementId ?? \"\",\n\t\t\t\ttext: input.text ?? \"\",\n\t\t\t\tdependencies: input.dependencies,\n\t\t\t};\n\t\tcase \"satisfy_requirement\":\n\t\t\treturn {\n\t\t\t\taction: \"satisfy_requirement\",\n\t\t\t\trequirementId: input.requirementId ?? \"\",\n\t\t\t\tevidenceIds: input.evidenceIds,\n\t\t\t};\n\t\tcase \"block_requirement\":\n\t\t\treturn {\n\t\t\t\taction: \"block_requirement\",\n\t\t\t\trequirementId: input.requirementId ?? \"\",\n\t\t\t\treason: input.reason ?? \"\",\n\t\t\t};\n\t\tcase \"reopen_requirement\":\n\t\t\treturn { action: \"reopen_requirement\", requirementId: input.requirementId ?? \"\" };\n\t\tcase \"dispatch_worker\":\n\t\t\treturn {\n\t\t\t\taction: \"dispatch_worker\",\n\t\t\t\trequirementId: input.requirementId ?? \"\",\n\t\t\t\tinstructions: input.instructions ?? \"\",\n\t\t\t};\n\t\tcase \"add_evidence\": {\n\t\t\tif (input.kind === undefined) {\n\t\t\t\treturn { error: \"add_evidence requires a kind.\" };\n\t\t\t}\n\t\t\tconst kind: GoalEvidenceKind = input.kind;\n\t\t\treturn {\n\t\t\t\taction: \"add_evidence\",\n\t\t\t\tevidenceId: input.evidenceId ?? \"\",\n\t\t\t\tkind,\n\t\t\t\tsummary: input.summary ?? \"\",\n\t\t\t\turi: input.uri,\n\t\t\t};\n\t\t}\n\t\tcase \"progress\":\n\t\t\treturn { action: \"progress\" };\n\t\tcase \"no_progress\":\n\t\t\treturn { action: \"no_progress\" };\n\t\tcase \"complete\":\n\t\t\treturn { action: \"complete\" };\n\t\tcase \"increment\":\n\t\t\treturn { action: \"increment\" };\n\t\tcase \"block_goal\":\n\t\t\treturn { action: \"block_goal\", reason: input.reason ?? \"\" };\n\t\tcase \"get\":\n\t\t\treturn { error: \"get is handled as a read-only action.\" };\n\t\tdefault:\n\t\t\treturn { error: \"Unknown goal action.\" };\n\t}\n}\n\nfunction goalPanelModel(details: GoalToolDetails | undefined): OrchestrationPanelModel {\n\tconst state = details?.state;\n\tif (!state) {\n\t\treturn {\n\t\t\tlabel: \"goal\",\n\t\t\taction: details?.action,\n\t\t\tstatus: details?.error ? \"error\" : \"idle\",\n\t\t\temptyText: details?.error ?? \"No goal state was returned.\",\n\t\t};\n\t}\n\tconst satisfied = state.requirements.filter((requirement) => requirement.status === \"satisfied\").length;\n\treturn {\n\t\tlabel: \"goal\",\n\t\taction: details.action,\n\t\tstatus:\n\t\t\tstate.status === \"completed\"\n\t\t\t\t? \"success\"\n\t\t\t\t: state.status === \"blocked\" ||\n\t\t\t\t\t\tstate.status === \"paused\" ||\n\t\t\t\t\t\tstate.status === \"usage_limited\" ||\n\t\t\t\t\t\tstate.status === \"budget_limited\"\n\t\t\t\t\t? \"warning\"\n\t\t\t\t\t: state.status === \"cancelled\"\n\t\t\t\t\t\t? \"idle\"\n\t\t\t\t\t\t: \"running\",\n\t\tsummary: [\n\t\t\t`${satisfied}/${state.requirements.length} requirements`,\n\t\t\t`${state.evidence.length} evidence`,\n\t\t\t...(state.tokenBudget !== undefined ? [`${state.tokensUsed ?? 0}/${state.tokenBudget} tokens`] : []),\n\t\t],\n\t\trows: state.requirements.map((requirement) => ({\n\t\t\tstatus:\n\t\t\t\trequirement.status === \"satisfied\"\n\t\t\t\t\t? (\"completed\" as const)\n\t\t\t\t\t: requirement.status === \"open\"\n\t\t\t\t\t\t? (\"pending\" as const)\n\t\t\t\t\t\t: (\"blocked\" as const),\n\t\t\tlabel: requirement.text,\n\t\t\tmeta: [\n\t\t\t\trequirement.id,\n\t\t\t\trequirement.evidenceIds.length > 0 ? `${requirement.evidenceIds.length} evidence` : undefined,\n\t\t\t\trequirement.boundLaneId ? `worker ${requirement.boundLaneId}` : undefined,\n\t\t\t].filter((value): value is string => value !== undefined),\n\t\t\tdetails: requirement.blockedReason ? [`blocked: ${requirement.blockedReason}`] : undefined,\n\t\t})),\n\t\tnotices: [\n\t\t\t...(details.dispatchSkipReason\n\t\t\t\t? [{ status: \"warning\" as const, text: `Worker dispatch skipped: ${details.dispatchSkipReason}` }]\n\t\t\t\t: []),\n\t\t\t...(state.blockedReason ? [{ status: \"warning\" as const, text: state.blockedReason }] : []),\n\t\t],\n\t\temptyText: \"No requirements recorded.\",\n\t};\n}\n\nexport function createGoalToolDefinition(deps: GoalToolDependencies): GoalToolDefinition {\n\tconst now = deps.now ?? (() => new Date().toISOString());\n\treturn {\n\t\tname: LEGACY_GOAL_TOOL_NAME,\n\t\tlabel: \"goal\",\n\t\tdescription:\n\t\t\t\"Read or update the durable goal for explicitly persistent work. Use task_steps for plans and delegate for workers; owner or system controls lifecycle and budget stops.\",\n\t\tpromptSnippet: \"Read or update the durable goal.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Start only for explicit persistent chat/system goal. get if uncertain; never replace unfinished goal; tokenBudget only if requested.\",\n\t\t\t\"Plans: task_steps. Workers: delegate. Background tools: tool_task wait once; cite taskId as kind=tool evidence.\",\n\t\t\t\"increment satisfies the current open requirement from unused evidence, or completes when none remain.\",\n\t\t\t\"complete needs current authoritative evidence, no remaining work, no linked open task_steps, no running tool_task, no active pipeline. block_goal needs same real impasse for 3 goal turns.\",\n\t\t],\n\t\tparameters: goalSchema,\n\t\trenderShell: \"self\",\n\t\trenderCall() {\n\t\t\treturn emptyOrchestrationCall();\n\t\t},\n\t\trenderResult(result, { expanded, isPartial }, theme) {\n\t\t\tconst details = result.details as GoalToolDetails | undefined;\n\t\t\treturn renderOrchestrationToolResult(theme, goalPanelModel(details), {\n\t\t\t\tisPartial,\n\t\t\t\tcollapse: !expanded && details?.applied === true,\n\t\t\t\texpanded: true,\n\t\t\t});\n\t\t},\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tinput: GoalToolInput,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: GoalToolDetails;\n\t\t\tisError?: boolean;\n\t\t}> {\n\t\t\tif (input.action === \"get\") {\n\t\t\t\tconst state = deps.getGoalState();\n\t\t\t\tif (!state) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No goal exists for this session.\" }],\n\t\t\t\t\t\tdetails: { action: \"get\", applied: false },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: summarizeGoalState(state) }],\n\t\t\t\t\tdetails: { action: \"get\", applied: false, state },\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (input.action === \"start\" && deps.authorizeStart) {\n\t\t\t\tconst error = deps.authorizeStart(input);\n\t\t\t\tif (error) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: `goal start failed: ${error}` }],\n\t\t\t\t\t\tdetails: { action: \"start\", applied: false, error },\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst mapped = toGoalAction(input);\n\t\t\tif (\"error\" in mapped) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `goal ${input.action} failed: ${mapped.error}` }],\n\t\t\t\t\tdetails: { action: input.action, applied: false, error: mapped.error },\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet action: GoalAction = mapped;\n\t\t\tif (action.action === \"add_evidence\") {\n\t\t\t\tconst verified = await resolveEvidenceVerified(action.kind, action.uri, deps);\n\t\t\t\taction = { ...action, verified };\n\t\t\t}\n\t\t\t// Honest dispatch reporting: distinguish \"dispatched\" (laneId), \"declined\" (skipReason --\n\t\t\t// the dependency IS wired but the underlying delegation starter refused, e.g. disabled or\n\t\t\t// already at capacity), and \"unwired\" (no dependency at all) -- never collapse a real\n\t\t\t// decline into a silent no-laneId no-op indistinguishable from the dep being absent.\n\t\t\tlet dispatchNote: string | undefined;\n\t\t\tlet dispatchSkipReason: string | undefined;\n\t\t\t// Indeterminate-binding dedupe guard: checked BEFORE any dispatch side effect, for BOTH\n\t\t\t// routes. A requirement already bound to a lane that is either still live (a plain\n\t\t\t// duplicate) or whose liveness/outcome cannot be determined at all (for example, a legacy\n\t\t\t// snapshot with no lane record or worker result) must never be\n\t\t\t// re-dispatched silently; only a CONFIRMED terminal outcome allows a legitimate retry.\n\t\t\tlet dispatchGuardRefused = false;\n\t\t\tif (action.action === \"dispatch_worker\") {\n\t\t\t\t// Captured into a `const` so the \"dispatch_worker\" narrowing survives into the closures\n\t\t\t\t// below -- TS does not narrow a `let`-bound outer variable across a callback boundary.\n\t\t\t\tconst dispatchAction = action;\n\t\t\t\tconst boundRequirement = deps\n\t\t\t\t\t.getGoalState()\n\t\t\t\t\t?.requirements.find((r) => r.id === dispatchAction.requirementId);\n\t\t\t\tconst bound = boundRequirement?.boundLaneId;\n\t\t\t\tif (bound !== undefined) {\n\t\t\t\t\tconst boundLaneRecord = deps.getLaneRecords?.().find((record) => record.laneId === bound);\n\t\t\t\t\tconst isLiveInFlight =\n\t\t\t\t\t\tboundLaneRecord !== undefined &&\n\t\t\t\t\t\t(boundLaneRecord.status === \"queued\" || boundLaneRecord.status === \"running\");\n\t\t\t\t\tif (isLiveInFlight) {\n\t\t\t\t\t\tdispatchSkipReason = \"requirement_already_bound\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// `boundLaneRecord` present here is necessarily terminal (isLiveInFlight was false).\n\t\t\t\t\t\tconst hasTerminalOutcome =\n\t\t\t\t\t\t\tboundLaneRecord !== undefined ||\n\t\t\t\t\t\t\t(deps.getWorkerClaimSnapshots?.().some((claim) => claim.requestId === bound) ?? false);\n\t\t\t\t\t\tif (!hasTerminalOutcome) dispatchSkipReason = \"bound_lane_indeterminate\";\n\t\t\t\t\t}\n\t\t\t\t\tif (dispatchSkipReason) {\n\t\t\t\t\t\tdispatchGuardRefused = true;\n\t\t\t\t\t\tdispatchNote = `No worker was dispatched (${dispatchSkipReason}); requirement '${dispatchAction.requirementId}' remains bound to lane '${bound}'.`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (action.action === \"dispatch_worker\" && !dispatchGuardRefused) {\n\t\t\t\tconst tmuxRequested = input.dispatchTarget === \"tmux\";\n\t\t\t\tlet useTmux = tmuxRequested && deps.dispatchTmuxWorker !== undefined;\n\t\t\t\tlet tmuxFallbackReason: string | undefined;\n\t\t\t\tlet dispatched: { laneId?: string; skipReason?: string } | undefined;\n\t\t\t\tif (useTmux) {\n\t\t\t\t\tdispatched = await deps.dispatchTmuxWorker?.({\n\t\t\t\t\t\trequirementId: action.requirementId,\n\t\t\t\t\t\tinstructions: action.instructions,\n\t\t\t\t\t});\n\t\t\t\t\tif (\n\t\t\t\t\t\t!dispatched?.laneId &&\n\t\t\t\t\t\tallowsNativeTmuxFallback(dispatched?.skipReason) &&\n\t\t\t\t\t\tdeps.startWorkerDelegation\n\t\t\t\t\t) {\n\t\t\t\t\t\ttmuxFallbackReason = dispatched?.skipReason;\n\t\t\t\t\t\tuseTmux = false;\n\t\t\t\t\t\tdispatched = deps.startWorkerDelegation({\n\t\t\t\t\t\t\trequirementId: action.requirementId,\n\t\t\t\t\t\t\tinstructions: action.instructions,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (tmuxRequested) tmuxFallbackReason = \"tmux_extension_not_loaded\";\n\t\t\t\t\tdispatched = deps.startWorkerDelegation?.({\n\t\t\t\t\t\trequirementId: action.requirementId,\n\t\t\t\t\t\tinstructions: action.instructions,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\taction = { ...action, laneId: dispatched?.laneId };\n\t\t\t\tif (dispatched?.laneId) {\n\t\t\t\t\tdispatchNote = tmuxFallbackReason\n\t\t\t\t\t\t? `Tmux route returned ${tmuxFallbackReason}; dispatched native fallback worker lane '${dispatched.laneId}' for requirement '${action.requirementId}'.`\n\t\t\t\t\t\t: useTmux\n\t\t\t\t\t\t\t? `Dispatched tmux worker lane '${dispatched.laneId}' for requirement '${action.requirementId}'.`\n\t\t\t\t\t\t\t: `Dispatched in-process worker lane '${dispatched.laneId}' for requirement '${action.requirementId}' (native default).`;\n\t\t\t\t} else {\n\t\t\t\t\tconst wired = useTmux ? deps.dispatchTmuxWorker : deps.startWorkerDelegation;\n\t\t\t\t\tdispatchSkipReason = dispatched?.skipReason ?? (wired ? \"declined\" : \"dependency_unwired\");\n\t\t\t\t\tdispatchNote = `${tmuxFallbackReason ? `Tmux route returned ${tmuxFallbackReason}; ` : \"\"}No worker was dispatched (${dispatchSkipReason}); requirement '${action.requirementId}' is recorded but not bound to a lane.`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst current = deps.getGoalState();\n\t\t\tlet nextState: GoalState;\n\t\t\tif (action.action === \"dispatch_worker\" && dispatchGuardRefused) {\n\t\t\t\t// Short-circuit: the guard refused before any dispatch attempt -- never call\n\t\t\t\t// applyGoalAction for this turn, so the requirement's existing `boundLaneId` is\n\t\t\t\t// preserved exactly as-is rather than clobbered to `undefined` by the reducer's\n\t\t\t\t// unconditional `boundLaneId: event.laneId` write (goal-state.ts's dispatch_worker case).\n\t\t\t\t// `current` is guaranteed defined here: the guard only refuses when a requirement with\n\t\t\t\t// a `boundLaneId` was found on it.\n\t\t\t\tnextState = current as GoalState;\n\t\t\t} else {\n\t\t\t\tconst result = applyGoalAction(current, action, now(), {\n\t\t\t\t\trequireVerifiedEvidenceForCompletion: deps.requireVerifiedEvidenceForCompletion?.() ?? true,\n\t\t\t\t\topenTaskSteps: deps.getOpenTaskSteps?.(),\n\t\t\t\t\tbackgroundToolTasks: deps.getBackgroundToolTasks?.(),\n\t\t\t\t\tactivePipeline: deps.getActivePipeline?.(),\n\t\t\t\t});\n\t\t\t\tif (!result.ok) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `goal ${input.action} failed: ${result.error}` }],\n\t\t\t\t\t\tdetails: { action: input.action, applied: false, error: result.error, state: current },\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdeps.saveGoalState(result.state, current ? getGoalStateRevision(current) : undefined);\n\t\t\t\tnextState = result.state;\n\t\t\t}\n\n\t\t\tconst summary = summarizeGoalState(nextState, { action, openTaskSteps: deps.getOpenTaskSteps?.() });\n\t\t\tconst text = dispatchNote\n\t\t\t\t? `goal ${input.action} recorded.\\n${summary}\\n${dispatchNote}`\n\t\t\t\t: `goal ${input.action} recorded.\\n${summary}`;\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\t\tdetails: {\n\t\t\t\t\taction: input.action,\n\t\t\t\t\tapplied: true,\n\t\t\t\t\tstate: nextState,\n\t\t\t\t\t...(action.action === \"dispatch_worker\" && action.laneId ? { dispatchedLaneId: action.laneId } : {}),\n\t\t\t\t\t...(action.action === \"dispatch_worker\" && !action.laneId ? { dispatchSkipReason } : {}),\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n\n/**\n * Build the compact Codex-compatible lifecycle surface as adapters over the authoritative legacy\n * goal executor. The wrappers own no state and duplicate no validation, persistence, accounting,\n * completion gate, or start-authority rule.\n */\nexport function createGoalLifecycleToolDefinitions(goalTool: GoalToolDefinition) {\n\tconst createGoal: ToolDefinition = {\n\t\tname: GOAL_LIFECYCLE_TOOL_NAMES[0],\n\t\tlabel: GOAL_LIFECYCLE_TOOL_NAMES[0],\n\t\tdescription:\n\t\t\t\"Create a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks. Set token_budget only when explicitly requested. Fails if an unfinished goal exists.\",\n\t\tpromptSnippet: \"Create an explicitly requested durable goal.\",\n\t\tparameters: createGoalSchema,\n\t\texecute(toolCallId, input: Static<typeof createGoalSchema>, signal, onUpdate, context) {\n\t\t\treturn goalTool.execute(\n\t\t\t\ttoolCallId,\n\t\t\t\t{\n\t\t\t\t\taction: \"start\",\n\t\t\t\t\tgoalId: `goal-${randomUUID()}`,\n\t\t\t\t\tuserGoal: input.objective,\n\t\t\t\t\ttokenBudget: input.token_budget,\n\t\t\t\t},\n\t\t\t\tsignal,\n\t\t\t\tonUpdate,\n\t\t\t\tcontext,\n\t\t\t);\n\t\t},\n\t};\n\n\tconst getGoal: ToolDefinition = {\n\t\tname: GOAL_LIFECYCLE_TOOL_NAMES[1],\n\t\tlabel: GOAL_LIFECYCLE_TOOL_NAMES[1],\n\t\tdescription:\n\t\t\t\"Get the current goal for this session, including status, budget, token and elapsed-time usage, requirements, evidence, and progress.\",\n\t\tpromptSnippet: \"Inspect the current durable goal.\",\n\t\tparameters: getGoalSchema,\n\t\texecute(toolCallId, _input, signal, onUpdate, context) {\n\t\t\treturn goalTool.execute(toolCallId, { action: \"get\" }, signal, onUpdate, context);\n\t\t},\n\t};\n\n\tconst updateGoal: ToolDefinition = {\n\t\tname: GOAL_LIFECYCLE_TOOL_NAMES[2],\n\t\tlabel: GOAL_LIFECYCLE_TOOL_NAMES[2],\n\t\tdescription:\n\t\t\t\"Update the existing goal. Set active only after concrete, verifiable progress in the current turn. Mark complete only when current evidence proves the full objective is achieved and no required work remains. Mark blocked only after the same blocking condition has recurred for at least three consecutive goal turns and no meaningful progress is possible without user input or external change; include that condition in reason. Never use blocked merely because work is hard, slow, uncertain, incomplete, or would benefit from clarification.\",\n\t\tpromptSnippet: \"Report concrete progress or mark the durable goal complete or genuinely blocked.\",\n\t\tparameters: updateGoalSchema,\n\t\texecute(toolCallId, input: Static<typeof updateGoalSchema>, signal, onUpdate, context) {\n\t\t\tconst requestedGoalStatus: GoalStatus = input.status === \"complete\" ? \"completed\" : input.status;\n\t\t\tconst action: GoalToolInput = isGoalExecutionActive(requestedGoalStatus)\n\t\t\t\t? { action: \"progress\" }\n\t\t\t\t: input.status === \"complete\"\n\t\t\t\t\t? { action: \"complete\" }\n\t\t\t\t\t: { action: \"block_goal\", reason: input.reason ?? \"\" };\n\t\t\treturn goalTool.execute(toolCallId, action, signal, onUpdate, context);\n\t\t},\n\t};\n\n\treturn [createGoal, getGoal, updateGoal] as const;\n}\n"]}
1
+ {"version":3,"file":"goal.js","sourceRoot":"","sources":["../../../src/core/tools/goal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI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C;AACnD,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { stat as fsStat } from \"node:fs/promises\";\nimport { type Static, Type } from \"typebox\";\nimport type { WorkerClaim } from \"../autonomy/contracts.ts\";\nimport type { LaneRecord } from \"../autonomy/lane-tracker.ts\";\nimport type { BackgroundToolTaskRef } from \"../background-tool-task-controller.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { type GoalStateRevision, getGoalStateRevision } from \"../goals/goal-lifecycle.ts\";\nimport { type GoalEvidenceKind, type GoalState, type GoalStatus, isGoalExecutionActive } from \"../goals/goal-state.ts\";\nimport {\n\tapplyGoalAction,\n\ttype GoalAction,\n\ttype GoalActionName,\n\ttype OpenTaskStepRef,\n\tsummarizeGoalState,\n} from \"../goals/goal-tool-core.ts\";\nimport { GOAL_LIFECYCLE_TOOL_NAMES, LEGACY_GOAL_TOOL_NAME } from \"../goals/goal-tool-names.ts\";\nimport {\n\temptyOrchestrationCall,\n\ttype OrchestrationPanelModel,\n\trenderOrchestrationToolResult,\n} from \"./orchestration-panel.ts\";\nimport { resolveToCwd } from \"./path-utils.ts\";\n\nconst goalSchema = Type.Object(\n\t{\n\t\taction: Type.Union(\n\t\t\t[\n\t\t\t\tType.Literal(\"get\"),\n\t\t\t\tType.Literal(\"start\"),\n\t\t\t\tType.Literal(\"add_requirement\"),\n\t\t\t\tType.Literal(\"satisfy_requirement\"),\n\t\t\t\tType.Literal(\"block_requirement\"),\n\t\t\t\tType.Literal(\"reopen_requirement\"),\n\t\t\t\tType.Literal(\"dispatch_worker\"),\n\t\t\t\tType.Literal(\"add_evidence\"),\n\t\t\t\tType.Literal(\"progress\"),\n\t\t\t\tType.Literal(\"no_progress\"),\n\t\t\t\tType.Literal(\"complete\"),\n\t\t\t\tType.Literal(\"increment\"),\n\t\t\t\tType.Literal(\"block_goal\"),\n\t\t\t],\n\t\t\t{ description: \"Goal record action.\" },\n\t\t),\n\t\tgoalId: Type.Optional(Type.String({ description: \"Stable goal id. Required for action 'start'.\" })),\n\t\tuserGoal: Type.Optional(Type.String({ description: \"The goal statement. Required for action 'start'.\" })),\n\t\ttokenBudget: Type.Optional(\n\t\t\tType.Integer({ minimum: 1, description: \"Optional positive token budget for action 'start'.\" }),\n\t\t),\n\t\trequirementId: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Requirement id for requirement actions.\",\n\t\t\t}),\n\t\t),\n\t\ttext: Type.Optional(Type.String({ description: \"Requirement text. Required for add_requirement.\" })),\n\t\tdependencies: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Optional IDs of requirements that must be satisfied before this one. Valid for add_requirement.\",\n\t\t\t}),\n\t\t),\n\t\tinstructions: Type.Optional(Type.String({ description: \"Worker instructions. Required for dispatch_worker.\" })),\n\t\tevidenceId: Type.Optional(Type.String({ description: \"Evidence id. Required for add_evidence.\" })),\n\t\tevidenceIds: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"Existing evidence ids for satisfy_requirement.\",\n\t\t\t}),\n\t\t),\n\t\tkind: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[\n\t\t\t\t\tType.Literal(\"file\"),\n\t\t\t\t\tType.Literal(\"test\"),\n\t\t\t\t\tType.Literal(\"tool\"),\n\t\t\t\t\tType.Literal(\"user\"),\n\t\t\t\t\tType.Literal(\"finding\"),\n\t\t\t\t\tType.Literal(\"worker\"),\n\t\t\t\t],\n\t\t\t\t{ description: \"Evidence kind. Required for add_evidence.\" },\n\t\t\t),\n\t\t),\n\t\tsummary: Type.Optional(Type.String({ description: \"Evidence summary. Required for add_evidence.\" })),\n\t\turi: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Optional file/URL, toolCallId, or laneId evidence locator.\",\n\t\t\t}),\n\t\t),\n\t\treason: Type.Optional(Type.String({ description: \"Reason for block_requirement or block_goal.\" })),\n\t\tdispatchTarget: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"in_process\"), Type.Literal(\"tmux\")], {\n\t\t\t\tdescription: \"Legacy target. Native is default; use tmux only for an owner-requested persistent pane.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst createGoalSchema = Type.Object(\n\t{\n\t\tobjective: Type.String({ description: \"Required. The concrete objective to start pursuing.\" }),\n\t\ttoken_budget: Type.Optional(\n\t\t\tType.Integer({ minimum: 1, description: \"Positive token budget. Omit unless explicitly requested.\" }),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst getGoalSchema = Type.Object({}, { additionalProperties: false });\n\nconst updateGoalSchema = Type.Object(\n\t{\n\t\tstatus: Type.Union([Type.Literal(\"active\"), Type.Literal(\"complete\"), Type.Literal(\"blocked\")], {\n\t\t\tdescription:\n\t\t\t\t\"Set active after concrete progress, complete after an evidence audit, or blocked after the same blocker persists for three turns.\",\n\t\t}),\n\t\treason: Type.Optional(\n\t\t\tType.String({ minLength: 1, description: \"Required for blocked: the recurring external blocker.\" }),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type GoalToolInput = Static<typeof goalSchema>;\nexport type GoalToolDefinition = ToolDefinition;\n\nexport interface GoalToolDetails {\n\taction: GoalActionName | \"get\";\n\tapplied: boolean;\n\terror?: string;\n\tstate?: GoalState;\n\t/** Set on 'dispatch_worker' when a worker lane actually started; mirrors the requirement's\n\t * new `boundLaneId`. The in-process route by default, or a real persistent tmux lane when\n\t * `dispatchTarget:\"tmux\"` was selected and routed -- see {@link GoalToolDependencies.dispatchTmuxWorker}. */\n\tdispatchedLaneId?: string;\n\t/** Set on 'dispatch_worker' when no worker was dispatched: a wired dependency declined (e.g. worker\n\t * delegation disabled, already at capacity, or an honest tmux skip reason -- see\n\t * {@link GoalToolDependencies.dispatchTmuxWorker}), or the indeterminate-binding guard refused a\n\t * re-dispatch against an already-bound requirement (`requirement_already_bound`/`bound_lane_indeterminate`).\n\t * The binding is recorded (or, for a guard refusal, left exactly as it was) with no NEW laneId. */\n\tdispatchSkipReason?: string;\n}\n\nexport interface GoalToolDependencies {\n\t/** Read the latest persisted goal state for the active session. */\n\tgetGoalState: () => GoalState | undefined;\n\t/** Persist a new goal state snapshot to the active session. */\n\tsaveGoalState: (state: GoalState, expected?: GoalStateRevision) => void;\n\t/** Clock injection for deterministic tests. */\n\tnow?: () => string;\n\t/**\n\t * Check whether `toolCallId` exists in this session's records, for validating kind:\"tool\"\n\t * evidence refs at add_evidence time. When not wired, a \"tool\" ref cannot be proven and is\n\t * recorded as `verified: false` rather than assumed true.\n\t */\n\thasToolCallId?: (toolCallId: string) => boolean;\n\t/**\n\t * Read the session's live worker lane records, for validating kind:\"worker\" evidence refs\n\t * (the `uri` is a laneId) at add_evidence time. Read-defensive: when not wired -- exactly like\n\t * `hasToolCallId` -- a \"worker\" ref cannot be proven and is recorded as `verified: false` rather\n\t * than assumed true. Live wiring is added separately.\n\t */\n\tgetLaneRecords?: () => readonly LaneRecord[];\n\t/**\n\t * Read persisted worker claim snapshots (keyed by `WorkerClaim.requestId`, which is the same\n\t * id as the dispatching lane's laneId), for validating kind:\"worker\" evidence refs. See\n\t * {@link getLaneRecords}. A matching claim that is `parentReviewRequired && !parentReviewedAt`\n\t * verifies `false` -- an unreviewed worker completion must never ungate goal completion through\n\t * the existing verified/complete gate.\n\t */\n\tgetWorkerClaimSnapshots?: () => readonly WorkerClaim[];\n\t/**\n\t * Tool-layer side effect for a 'dispatch_worker' action when `dispatchTarget` is 'in_process'\n\t * (the default) or when {@link dispatchTmuxWorker} is not wired: dispatches a real in-process\n\t * worker lane for the given requirement and returns the resulting laneId to bind onto it. When\n\t * the dependency is present but the underlying delegation starter declines (disabled, already at\n\t * capacity, etc.), return `{ skipReason }` instead of a laneId -- a real, non-silent skip that\n\t * the tool response surfaces, distinct from this dependency being altogether unwired (`undefined`\n\t * dep, or the dep returning `undefined`), which records the binding attempt structurally with no\n\t * laneId (a no-op).\n\t */\n\tstartWorkerDelegation?: (args: {\n\t\trequirementId: string;\n\t\tinstructions: string;\n\t}) => { laneId?: string; skipReason?: string } | undefined;\n\t/**\n\t * Tool-layer side effect for a 'dispatch_worker' action when `input.dispatchTarget === \"tmux\"`:\n\t * dispatches a REAL persistent tmux worker via the tmux_agent_manager extension's `fire_task`\n\t * action (core structurally invokes the same tool call the model would make; no extension change,\n\t * no faked launch or laneId -- see `tmux-dispatch.ts`'s `dispatchTmuxWorker`). Selected ONLY when\n\t * BOTH `input.dispatchTarget === \"tmux\"` AND this dependency is present; otherwise the EXISTING\n\t * {@link startWorkerDelegation} in-process path runs, byte-identical to before this field existed.\n\t * The honest skip-reason vocabulary this can return: `tmux_extension_not_loaded`,\n\t * `no_standing_grant` (the owner has not authorized unattended tmux dispatch),\n\t * `tmux_dispatch_failed`, `tmux_dispatch_incomplete`, `lane_correlation_failed`,\n\t * `worktree_create_failed` (worktree-sync is enabled but the lane-first `create_lane` call was\n\t * refused -- e.g. max lanes reached -- so no fire_task call was ever attempted),\n\t * `worker_capability_insufficient` (the model is sub-full class, has an unknown context window,\n\t * does not advertise a native tool-call path, or is graded-demoted to text-protocol/none -- see\n\t * `model-capability.ts`'s `evaluateLaneWorkerRefusal`; this is the parent's best-effort check\n\t * only, refused before any lane/pane side effect -- the dispatched child still refuses\n\t * authoritatively at its own startup regardless).\n\t */\n\tdispatchTmuxWorker?: (args: {\n\t\trequirementId: string;\n\t\tinstructions: string;\n\t}) => Promise<{ laneId?: string; skipReason?: string }>;\n\t/** Working directory for resolving kind:\"file\" evidence ref paths. Defaults to `process.cwd()`. */\n\tcwd?: () => string;\n\t/**\n\t * Gate agent-facing 'complete' on verified/user evidence backing. Defaults to `true` (on)\n\t * when omitted -- the conservative default; set to a function returning `false` to opt out.\n\t */\n\trequireVerifiedEvidenceForCompletion?: () => boolean;\n\t/**\n\t * Read-only open (non-terminal) task_steps steps on the active branch, for the goal⇄task\n\t * cross-visibility nudge in the tool response. When omitted, `summarizeGoalState` gets\n\t * no task-step context and simply emits no nudge -- goal-tool-core stays pure and never reads\n\t * task state itself; this is the only place that supplies it.\n\t */\n\tgetOpenTaskSteps?: () => readonly OpenTaskStepRef[];\n\t/** Live background tool_task records for kind:\"tool\" evidence and complete-time re-check. */\n\tgetBackgroundToolTasks?: () => readonly BackgroundToolTaskRef[];\n\t/** Active ICM pipeline run for the complete/increment join. */\n\tgetActivePipeline?: () => { runId: string; pipelineName: string; goalId?: string; status: string } | undefined;\n\t/** Model-facing start authority for the current foreground turn. Omitted by direct owner/test callers. */\n\tauthorizeStart?: (input: Pick<GoalToolInput, \"userGoal\" | \"tokenBudget\">) => string | undefined;\n\t/**\n\t * Live tool-evidence check. When wired, kind:\"tool\" uses this instead of {@link hasToolCallId}\n\t * so a still-running background handoff cannot verify as done.\n\t */\n\tresolveToolEvidence?: (uri: string) => boolean;\n}\n\nfunction allowsNativeTmuxFallback(reason: string | undefined): boolean {\n\treturn reason === \"tmux_unavailable\" || reason === \"tmux_extension_not_loaded\";\n}\n\n/**\n * Validate an evidence ref's `uri` against session records (\"tool\") or the filesystem (\"file\").\n * Returns `undefined` for kinds/refs that carry nothing checkable (e.g. \"user\"/\"finding\"/\"test\",\n * or a missing `uri`) -- absence of a ref is not the same as a ref that failed to verify.\n */\nasync function resolveEvidenceVerified(\n\tkind: GoalEvidenceKind,\n\turi: string | undefined,\n\tdeps: GoalToolDependencies,\n): Promise<boolean | undefined> {\n\tconst trimmedUri = uri?.trim();\n\tif (!trimmedUri) return undefined;\n\tif (kind === \"tool\") {\n\t\tif (deps.resolveToolEvidence) return deps.resolveToolEvidence(trimmedUri);\n\t\treturn deps.hasToolCallId ? deps.hasToolCallId(trimmedUri) : false;\n\t}\n\tif (kind === \"file\") {\n\t\tconst cwd = deps.cwd?.() ?? process.cwd();\n\t\ttry {\n\t\t\tconst stats = await fsStat(resolveToCwd(trimmedUri, cwd));\n\t\t\treturn stats.isFile();\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (kind === \"worker\") {\n\t\tif (!deps.getLaneRecords || !deps.getWorkerClaimSnapshots) return false;\n\t\tconst laneId = trimmedUri;\n\t\tconst record = deps.getLaneRecords().find((candidate) => candidate.laneId === laneId);\n\t\tif (!record) return false;\n\t\tconst claim = deps.getWorkerClaimSnapshots().find((candidate) => candidate.requestId === laneId);\n\t\tif (!claim) return false;\n\t\t// An unreviewed mutation (parentReviewRequired && no parentReviewedAt) can never verify true --\n\t\t// this is what stops an unreviewed worker completion from ungating goal completion through\n\t\t// the existing verified/complete gate (goal-tool-core's isVerifiedOrUserEvidence/complete).\n\t\tif (claim.parentReviewRequired === true && claim.parentReviewedAt === undefined) return false;\n\t\treturn claim.status === \"completed\";\n\t}\n\treturn undefined;\n}\n\nfunction toGoalAction(input: GoalToolInput): GoalAction | { error: string } {\n\tswitch (input.action) {\n\t\tcase \"start\":\n\t\t\treturn {\n\t\t\t\taction: \"start\",\n\t\t\t\tgoalId: input.goalId ?? \"\",\n\t\t\t\tuserGoal: input.userGoal ?? \"\",\n\t\t\t\ttokenBudget: input.tokenBudget,\n\t\t\t};\n\t\tcase \"add_requirement\":\n\t\t\treturn {\n\t\t\t\taction: \"add_requirement\",\n\t\t\t\trequirementId: input.requirementId ?? \"\",\n\t\t\t\ttext: input.text ?? \"\",\n\t\t\t\tdependencies: input.dependencies,\n\t\t\t};\n\t\tcase \"satisfy_requirement\":\n\t\t\treturn {\n\t\t\t\taction: \"satisfy_requirement\",\n\t\t\t\trequirementId: input.requirementId ?? \"\",\n\t\t\t\tevidenceIds: input.evidenceIds,\n\t\t\t};\n\t\tcase \"block_requirement\":\n\t\t\treturn {\n\t\t\t\taction: \"block_requirement\",\n\t\t\t\trequirementId: input.requirementId ?? \"\",\n\t\t\t\treason: input.reason ?? \"\",\n\t\t\t};\n\t\tcase \"reopen_requirement\":\n\t\t\treturn { action: \"reopen_requirement\", requirementId: input.requirementId ?? \"\" };\n\t\tcase \"dispatch_worker\":\n\t\t\treturn {\n\t\t\t\taction: \"dispatch_worker\",\n\t\t\t\trequirementId: input.requirementId ?? \"\",\n\t\t\t\tinstructions: input.instructions ?? \"\",\n\t\t\t};\n\t\tcase \"add_evidence\": {\n\t\t\tif (input.kind === undefined) {\n\t\t\t\treturn { error: \"add_evidence requires a kind.\" };\n\t\t\t}\n\t\t\tconst kind: GoalEvidenceKind = input.kind;\n\t\t\treturn {\n\t\t\t\taction: \"add_evidence\",\n\t\t\t\tevidenceId: input.evidenceId ?? \"\",\n\t\t\t\tkind,\n\t\t\t\tsummary: input.summary ?? \"\",\n\t\t\t\turi: input.uri,\n\t\t\t};\n\t\t}\n\t\tcase \"progress\":\n\t\t\treturn { action: \"progress\" };\n\t\tcase \"no_progress\":\n\t\t\treturn { action: \"no_progress\" };\n\t\tcase \"complete\":\n\t\t\treturn { action: \"complete\" };\n\t\tcase \"increment\":\n\t\t\treturn { action: \"increment\" };\n\t\tcase \"block_goal\":\n\t\t\treturn { action: \"block_goal\", reason: input.reason ?? \"\" };\n\t\tcase \"get\":\n\t\t\treturn { error: \"get is handled as a read-only action.\" };\n\t\tdefault:\n\t\t\treturn { error: \"Unknown goal action.\" };\n\t}\n}\n\nfunction goalPanelModel(details: GoalToolDetails | undefined): OrchestrationPanelModel {\n\tconst state = details?.state;\n\tif (!state) {\n\t\treturn {\n\t\t\tlabel: \"goal\",\n\t\t\taction: details?.action,\n\t\t\tstatus: details?.error ? \"error\" : \"idle\",\n\t\t\temptyText: details?.error ?? \"No goal state was returned.\",\n\t\t};\n\t}\n\tconst satisfied = state.requirements.filter((requirement) => requirement.status === \"satisfied\").length;\n\treturn {\n\t\tlabel: \"goal\",\n\t\taction: details.action,\n\t\tstatus:\n\t\t\tstate.status === \"completed\"\n\t\t\t\t? \"success\"\n\t\t\t\t: state.status === \"blocked\" ||\n\t\t\t\t\t\tstate.status === \"paused\" ||\n\t\t\t\t\t\tstate.status === \"usage_limited\" ||\n\t\t\t\t\t\tstate.status === \"budget_limited\"\n\t\t\t\t\t? \"warning\"\n\t\t\t\t\t: state.status === \"cancelled\"\n\t\t\t\t\t\t? \"idle\"\n\t\t\t\t\t\t: \"running\",\n\t\tsummary: [\n\t\t\t`${satisfied}/${state.requirements.length} requirements`,\n\t\t\t`${state.evidence.length} evidence`,\n\t\t\t...(state.tokenBudget !== undefined ? [`${state.tokensUsed ?? 0}/${state.tokenBudget} tokens`] : []),\n\t\t],\n\t\trows: state.requirements.map((requirement) => ({\n\t\t\tstatus:\n\t\t\t\trequirement.status === \"satisfied\"\n\t\t\t\t\t? (\"completed\" as const)\n\t\t\t\t\t: requirement.status === \"open\"\n\t\t\t\t\t\t? (\"pending\" as const)\n\t\t\t\t\t\t: (\"blocked\" as const),\n\t\t\tlabel: requirement.text,\n\t\t\tmeta: [\n\t\t\t\trequirement.id,\n\t\t\t\trequirement.evidenceIds.length > 0 ? `${requirement.evidenceIds.length} evidence` : undefined,\n\t\t\t\trequirement.boundLaneId ? `worker ${requirement.boundLaneId}` : undefined,\n\t\t\t].filter((value): value is string => value !== undefined),\n\t\t\tdetails: requirement.blockedReason ? [`blocked: ${requirement.blockedReason}`] : undefined,\n\t\t})),\n\t\tnotices: [\n\t\t\t...(details.dispatchSkipReason\n\t\t\t\t? [{ status: \"warning\" as const, text: `Worker dispatch skipped: ${details.dispatchSkipReason}` }]\n\t\t\t\t: []),\n\t\t\t...(state.blockedReason ? [{ status: \"warning\" as const, text: state.blockedReason }] : []),\n\t\t],\n\t\temptyText: \"No requirements recorded.\",\n\t};\n}\n\nexport function createGoalToolDefinition(deps: GoalToolDependencies): GoalToolDefinition {\n\tconst now = deps.now ?? (() => new Date().toISOString());\n\treturn {\n\t\tname: LEGACY_GOAL_TOOL_NAME,\n\t\tlabel: \"goal\",\n\t\tdescription:\n\t\t\t\"Read or update the durable goal for explicitly persistent work. Use task_steps for plans and delegate for workers; owner or system controls lifecycle and budget stops.\",\n\t\tpromptSnippet: \"Read or update the durable goal.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Start only for explicit persistent chat/system goal. get if uncertain; never replace unfinished goal; tokenBudget only if requested.\",\n\t\t\t\"Plans: task_steps. Workers: delegate. Background tools: tool_task wait once; cite taskId as kind=tool evidence.\",\n\t\t\t\"increment satisfies the current open requirement from unused evidence, or completes when none remain.\",\n\t\t\t\"complete needs current authoritative evidence, no remaining work, no linked open task_steps, no running tool_task, no active pipeline. block_goal needs same real impasse for 3 goal turns.\",\n\t\t],\n\t\tparameters: goalSchema,\n\t\trenderShell: \"self\",\n\t\trenderCall() {\n\t\t\treturn emptyOrchestrationCall();\n\t\t},\n\t\trenderResult(result, { expanded, isPartial }, theme) {\n\t\t\tconst details = result.details as GoalToolDetails | undefined;\n\t\t\treturn renderOrchestrationToolResult(theme, goalPanelModel(details), {\n\t\t\t\tisPartial,\n\t\t\t\tcollapse: !expanded && details?.applied === true,\n\t\t\t\texpanded: true,\n\t\t\t});\n\t\t},\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tinput: GoalToolInput,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: GoalToolDetails;\n\t\t\tisError?: boolean;\n\t\t}> {\n\t\t\tif (input.action === \"get\") {\n\t\t\t\tconst state = deps.getGoalState();\n\t\t\t\tif (!state) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No goal exists for this session.\" }],\n\t\t\t\t\t\tdetails: { action: \"get\", applied: false },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: summarizeGoalState(state) }],\n\t\t\t\t\tdetails: { action: \"get\", applied: false, state },\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (input.action === \"start\" && deps.authorizeStart) {\n\t\t\t\tconst error = deps.authorizeStart(input);\n\t\t\t\tif (error) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: `goal start failed: ${error}` }],\n\t\t\t\t\t\tdetails: { action: \"start\", applied: false, error },\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst mapped = toGoalAction(input);\n\t\t\tif (\"error\" in mapped) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `goal ${input.action} failed: ${mapped.error}` }],\n\t\t\t\t\tdetails: { action: input.action, applied: false, error: mapped.error },\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet action: GoalAction = mapped;\n\t\t\tif (action.action === \"add_evidence\") {\n\t\t\t\tconst verified = await resolveEvidenceVerified(action.kind, action.uri, deps);\n\t\t\t\taction = { ...action, verified };\n\t\t\t}\n\t\t\t// Honest dispatch reporting: distinguish \"dispatched\" (laneId), \"declined\" (skipReason --\n\t\t\t// the dependency IS wired but the underlying delegation starter refused, e.g. disabled or\n\t\t\t// already at capacity), and \"unwired\" (no dependency at all) -- never collapse a real\n\t\t\t// decline into a silent no-laneId no-op indistinguishable from the dep being absent.\n\t\t\tlet dispatchNote: string | undefined;\n\t\t\tlet dispatchSkipReason: string | undefined;\n\t\t\t// Indeterminate-binding dedupe guard: checked BEFORE any dispatch side effect, for BOTH\n\t\t\t// routes. A requirement already bound to a lane that is either still live (a plain\n\t\t\t// duplicate) or whose liveness/outcome cannot be determined at all (for example, a legacy\n\t\t\t// snapshot with no lane record or worker result) must never be\n\t\t\t// re-dispatched silently; only a CONFIRMED terminal outcome allows a legitimate retry.\n\t\t\tlet dispatchGuardRefused = false;\n\t\t\tif (action.action === \"dispatch_worker\") {\n\t\t\t\t// Captured into a `const` so the \"dispatch_worker\" narrowing survives into the closures\n\t\t\t\t// below -- TS does not narrow a `let`-bound outer variable across a callback boundary.\n\t\t\t\tconst dispatchAction = action;\n\t\t\t\tconst boundRequirement = deps\n\t\t\t\t\t.getGoalState()\n\t\t\t\t\t?.requirements.find((r) => r.id === dispatchAction.requirementId);\n\t\t\t\tconst bound = boundRequirement?.boundLaneId;\n\t\t\t\tif (bound !== undefined) {\n\t\t\t\t\tconst boundLaneRecord = deps.getLaneRecords?.().find((record) => record.laneId === bound);\n\t\t\t\t\tconst isLiveInFlight =\n\t\t\t\t\t\tboundLaneRecord !== undefined &&\n\t\t\t\t\t\t(boundLaneRecord.status === \"queued\" || boundLaneRecord.status === \"running\");\n\t\t\t\t\tif (isLiveInFlight) {\n\t\t\t\t\t\tdispatchSkipReason = \"requirement_already_bound\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// `boundLaneRecord` present here is necessarily terminal (isLiveInFlight was false).\n\t\t\t\t\t\tconst hasTerminalOutcome =\n\t\t\t\t\t\t\tboundLaneRecord !== undefined ||\n\t\t\t\t\t\t\t(deps.getWorkerClaimSnapshots?.().some((claim) => claim.requestId === bound) ?? false);\n\t\t\t\t\t\tif (!hasTerminalOutcome) dispatchSkipReason = \"bound_lane_indeterminate\";\n\t\t\t\t\t}\n\t\t\t\t\tif (dispatchSkipReason) {\n\t\t\t\t\t\tdispatchGuardRefused = true;\n\t\t\t\t\t\tdispatchNote = `No worker was dispatched (${dispatchSkipReason}); requirement '${dispatchAction.requirementId}' remains bound to lane '${bound}'.`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (action.action === \"dispatch_worker\" && !dispatchGuardRefused) {\n\t\t\t\tconst tmuxRequested = input.dispatchTarget === \"tmux\";\n\t\t\t\tlet useTmux = tmuxRequested && deps.dispatchTmuxWorker !== undefined;\n\t\t\t\tlet tmuxFallbackReason: string | undefined;\n\t\t\t\tlet dispatched: { laneId?: string; skipReason?: string } | undefined;\n\t\t\t\tif (useTmux) {\n\t\t\t\t\tdispatched = await deps.dispatchTmuxWorker?.({\n\t\t\t\t\t\trequirementId: action.requirementId,\n\t\t\t\t\t\tinstructions: action.instructions,\n\t\t\t\t\t});\n\t\t\t\t\tif (\n\t\t\t\t\t\t!dispatched?.laneId &&\n\t\t\t\t\t\tallowsNativeTmuxFallback(dispatched?.skipReason) &&\n\t\t\t\t\t\tdeps.startWorkerDelegation\n\t\t\t\t\t) {\n\t\t\t\t\t\ttmuxFallbackReason = dispatched?.skipReason;\n\t\t\t\t\t\tuseTmux = false;\n\t\t\t\t\t\tdispatched = deps.startWorkerDelegation({\n\t\t\t\t\t\t\trequirementId: action.requirementId,\n\t\t\t\t\t\t\tinstructions: action.instructions,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (tmuxRequested) tmuxFallbackReason = \"tmux_extension_not_loaded\";\n\t\t\t\t\tdispatched = deps.startWorkerDelegation?.({\n\t\t\t\t\t\trequirementId: action.requirementId,\n\t\t\t\t\t\tinstructions: action.instructions,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\taction = { ...action, laneId: dispatched?.laneId };\n\t\t\t\tif (dispatched?.laneId) {\n\t\t\t\t\tdispatchNote = tmuxFallbackReason\n\t\t\t\t\t\t? `Tmux route returned ${tmuxFallbackReason}; dispatched native fallback worker lane '${dispatched.laneId}' for requirement '${action.requirementId}'.`\n\t\t\t\t\t\t: useTmux\n\t\t\t\t\t\t\t? `Dispatched tmux worker lane '${dispatched.laneId}' for requirement '${action.requirementId}'.`\n\t\t\t\t\t\t\t: `Dispatched in-process worker lane '${dispatched.laneId}' for requirement '${action.requirementId}' (native default).`;\n\t\t\t\t} else {\n\t\t\t\t\tconst wired = useTmux ? deps.dispatchTmuxWorker : deps.startWorkerDelegation;\n\t\t\t\t\tdispatchSkipReason = dispatched?.skipReason ?? (wired ? \"declined\" : \"dependency_unwired\");\n\t\t\t\t\tdispatchNote = `${tmuxFallbackReason ? `Tmux route returned ${tmuxFallbackReason}; ` : \"\"}No worker was dispatched (${dispatchSkipReason}); requirement '${action.requirementId}' is recorded but not bound to a lane.`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst current = deps.getGoalState();\n\t\t\tlet nextState: GoalState;\n\t\t\tif (action.action === \"dispatch_worker\" && dispatchGuardRefused) {\n\t\t\t\t// Short-circuit: the guard refused before any dispatch attempt -- never call\n\t\t\t\t// applyGoalAction for this turn, so the requirement's existing `boundLaneId` is\n\t\t\t\t// preserved exactly as-is rather than clobbered to `undefined` by the reducer's\n\t\t\t\t// unconditional `boundLaneId: event.laneId` write (goal-state.ts's dispatch_worker case).\n\t\t\t\t// `current` is guaranteed defined here: the guard only refuses when a requirement with\n\t\t\t\t// a `boundLaneId` was found on it.\n\t\t\t\tnextState = current as GoalState;\n\t\t\t} else {\n\t\t\t\tlet activePipeline: ReturnType<NonNullable<GoalToolDependencies[\"getActivePipeline\"]>>;\n\t\t\t\tif (\n\t\t\t\t\tcurrent &&\n\t\t\t\t\tisGoalExecutionActive(current.status) &&\n\t\t\t\t\t(action.action === \"complete\" || action.action === \"increment\")\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tactivePipeline = deps.getActivePipeline?.();\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst message = `Cannot verify active pipeline state: ${error instanceof Error ? error.message : String(error)}`;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `goal ${input.action} failed: ${message}` }],\n\t\t\t\t\t\t\tdetails: { action: input.action, applied: false, error: message, state: current },\n\t\t\t\t\t\t\tisError: true,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst result = applyGoalAction(current, action, now(), {\n\t\t\t\t\trequireVerifiedEvidenceForCompletion: deps.requireVerifiedEvidenceForCompletion?.() ?? true,\n\t\t\t\t\topenTaskSteps: deps.getOpenTaskSteps?.(),\n\t\t\t\t\tbackgroundToolTasks: deps.getBackgroundToolTasks?.(),\n\t\t\t\t\tactivePipeline,\n\t\t\t\t});\n\t\t\t\tif (!result.ok) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `goal ${input.action} failed: ${result.error}` }],\n\t\t\t\t\t\tdetails: { action: input.action, applied: false, error: result.error, state: current },\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdeps.saveGoalState(result.state, current ? getGoalStateRevision(current) : undefined);\n\t\t\t\tnextState = result.state;\n\t\t\t}\n\n\t\t\tconst summary = summarizeGoalState(nextState, { action, openTaskSteps: deps.getOpenTaskSteps?.() });\n\t\t\tconst text = dispatchNote\n\t\t\t\t? `goal ${input.action} recorded.\\n${summary}\\n${dispatchNote}`\n\t\t\t\t: `goal ${input.action} recorded.\\n${summary}`;\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\t\tdetails: {\n\t\t\t\t\taction: input.action,\n\t\t\t\t\tapplied: true,\n\t\t\t\t\tstate: nextState,\n\t\t\t\t\t...(action.action === \"dispatch_worker\" && action.laneId ? { dispatchedLaneId: action.laneId } : {}),\n\t\t\t\t\t...(action.action === \"dispatch_worker\" && !action.laneId ? { dispatchSkipReason } : {}),\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n\n/**\n * Build the compact Codex-compatible lifecycle surface as adapters over the authoritative legacy\n * goal executor. The wrappers own no state and duplicate no validation, persistence, accounting,\n * completion gate, or start-authority rule.\n */\nexport function createGoalLifecycleToolDefinitions(goalTool: GoalToolDefinition) {\n\tconst createGoal: ToolDefinition = {\n\t\tname: GOAL_LIFECYCLE_TOOL_NAMES[0],\n\t\tlabel: GOAL_LIFECYCLE_TOOL_NAMES[0],\n\t\tdescription:\n\t\t\t\"Create a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks. Set token_budget only when explicitly requested. Fails if an unfinished goal exists.\",\n\t\tpromptSnippet: \"Create an explicitly requested durable goal.\",\n\t\tparameters: createGoalSchema,\n\t\texecute(toolCallId, input: Static<typeof createGoalSchema>, signal, onUpdate, context) {\n\t\t\treturn goalTool.execute(\n\t\t\t\ttoolCallId,\n\t\t\t\t{\n\t\t\t\t\taction: \"start\",\n\t\t\t\t\tgoalId: `goal-${randomUUID()}`,\n\t\t\t\t\tuserGoal: input.objective,\n\t\t\t\t\ttokenBudget: input.token_budget,\n\t\t\t\t},\n\t\t\t\tsignal,\n\t\t\t\tonUpdate,\n\t\t\t\tcontext,\n\t\t\t);\n\t\t},\n\t};\n\n\tconst getGoal: ToolDefinition = {\n\t\tname: GOAL_LIFECYCLE_TOOL_NAMES[1],\n\t\tlabel: GOAL_LIFECYCLE_TOOL_NAMES[1],\n\t\tdescription:\n\t\t\t\"Get the current goal for this session, including status, budget, token and elapsed-time usage, requirements, evidence, and progress.\",\n\t\tpromptSnippet: \"Inspect the current durable goal.\",\n\t\tparameters: getGoalSchema,\n\t\texecute(toolCallId, _input, signal, onUpdate, context) {\n\t\t\treturn goalTool.execute(toolCallId, { action: \"get\" }, signal, onUpdate, context);\n\t\t},\n\t};\n\n\tconst updateGoal: ToolDefinition = {\n\t\tname: GOAL_LIFECYCLE_TOOL_NAMES[2],\n\t\tlabel: GOAL_LIFECYCLE_TOOL_NAMES[2],\n\t\tdescription:\n\t\t\t\"Update the existing goal. Set active only after concrete, verifiable progress in the current turn. Mark complete only when current evidence proves the full objective is achieved and no required work remains. Mark blocked only after the same blocking condition has recurred for at least three consecutive goal turns and no meaningful progress is possible without user input or external change; include that condition in reason. Never use blocked merely because work is hard, slow, uncertain, incomplete, or would benefit from clarification.\",\n\t\tpromptSnippet: \"Report concrete progress or mark the durable goal complete or genuinely blocked.\",\n\t\tparameters: updateGoalSchema,\n\t\texecute(toolCallId, input: Static<typeof updateGoalSchema>, signal, onUpdate, context) {\n\t\t\tconst requestedGoalStatus: GoalStatus = input.status === \"complete\" ? \"completed\" : input.status;\n\t\t\tconst action: GoalToolInput = isGoalExecutionActive(requestedGoalStatus)\n\t\t\t\t? { action: \"progress\" }\n\t\t\t\t: input.status === \"complete\"\n\t\t\t\t\t? { action: \"complete\" }\n\t\t\t\t\t: { action: \"block_goal\", reason: input.reason ?? \"\" };\n\t\t\treturn goalTool.execute(toolCallId, action, signal, onUpdate, context);\n\t\t},\n\t};\n\n\treturn [createGoal, getGoal, updateGoal] as const;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-panel.d.ts","sourceRoot":"","sources":["../../../src/core/tools/orchestration-panel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAC3G,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,MAAM,sBAAsB,GAC/B,SAAS,GACT,QAAQ,GACR,SAAS,GACT,aAAa,GACb,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,kBAAkB,GAClB,WAAW,GACX,UAAU,GACV,UAAU,GACV,MAAM,CAAC;AAEV,MAAM,WAAW,qBAAqB;IACrC,MAAM,EAAE,sBAAsB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACjD,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,IAAI,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxC,OAAO,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,C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S;IAC7B,OAAO,CAAC,WAAW,CAAC,CAAW;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0B;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC,YAAY,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,uBAAuB,EAAE,QAAQ,UAAQ,EAIzE;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAK9B;IAED,UAAU,IAAI,IAAI,CAGjB;CACD;AAED,wBAAgB,6BAA6B,CAC5C,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GACnE,SAAS,CAGX;AAED,wBAAgB,sBAAsB,IAAI,SAAS,CAKlD"}
@@ -30,6 +30,7 @@ export function taskStepPanelRow(step) {
30
30
  step.requirementIds?.length
31
31
  ? `${step.requirementIds.length} requirement${step.requirementIds.length === 1 ? "" : "s"}`
32
32
  : undefined,
33
+ step.pipelineRunId && step.pipelineStageId ? `${step.pipelineRunId}/${step.pipelineStageId}` : undefined,
33
34
  step.evidence.length ? `${step.evidence.length} evidence` : undefined,
34
35
  ].filter((value) => value !== undefined);
35
36
  const details = [
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-panel.js","sourceRoot":"","sources":["../../../src/core/tools/orchestration-panel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAyB,MAAM,kDAAkD,CAAC;AAoD3G,MAAM,UAAU,GAA6C;IAC5D,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;IACtC,MAAM,EAAE,EAAE,IAAI,EAAE,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AC,EAAE;QAChB,UAAU,KAAI,CAAC;KACf,CAAC;AACH,CAAC","sourcesContent":["import type { Component } from \"@caupulican/pi-tui\";\nimport { truncateToWidth, visibleWidth } from \"@caupulican/pi-tui\";\nimport { renderTitleBadge, type TitleBadgeStatus } from \"../../modes/interactive/components/tool-title.ts\";\nimport type { Theme, ThemeColor } from \"../../modes/interactive/theme/theme.ts\";\nimport type { TaskStep } from \"../tasks/task-state.ts\";\n\nexport type OrchestrationRowStatus =\n\t| \"pending\"\n\t| \"queued\"\n\t| \"running\"\n\t| \"in_progress\"\n\t| \"completed\"\n\t| \"succeeded\"\n\t| \"partial\"\n\t| \"blocked\"\n\t| \"failed\"\n\t| \"timeout\"\n\t| \"budget_exhausted\"\n\t| \"cancelled\"\n\t| \"canceled\"\n\t| \"reviewed\"\n\t| \"info\";\n\nexport interface OrchestrationPanelRow {\n\tstatus: OrchestrationRowStatus;\n\tlabel: string;\n\tsection?: string;\n\tmeta?: readonly string[];\n\tdetails?: readonly string[];\n}\n\nexport interface OrchestrationPanelNotice {\n\tstatus: \"info\" | \"success\" | \"warning\" | \"error\";\n\ttext: string;\n}\n\nexport interface OrchestrationPanelModel {\n\tlabel: string;\n\taction?: string;\n\tstatus?: TitleBadgeStatus;\n\tsummary?: readonly string[];\n\trows?: readonly OrchestrationPanelRow[];\n\tnotices?: readonly OrchestrationPanelNotice[];\n\temptyText?: string;\n\thiddenRowCount?: number;\n}\n\ninterface RowStyle {\n\ticon: string;\n\tcolor: ThemeColor;\n\tstrike?: boolean;\n\tbold?: boolean;\n}\n\nconst ROW_STYLES: Record<OrchestrationRowStatus, RowStyle> = {\n\tpending: { icon: \"○\", color: \"muted\" },\n\tqueued: { icon: \"◌\", color: \"warning\" },\n\trunning: { icon: \"●\", color: \"accent\", bold: true },\n\tin_progress: { icon: \"●\", color: \"accent\", bold: true },\n\tcompleted: { icon: \"✓\", color: \"success\", strike: true },\n\tsucceeded: { icon: \"✓\", color: \"success\" },\n\tpartial: { icon: \"!\", color: \"warning\" },\n\tblocked: { icon: \"!\", color: \"warning\", bold: true },\n\tfailed: { icon: \"×\", color: \"error\", bold: true },\n\ttimeout: { icon: \"×\", color: \"warning\" },\n\tbudget_exhausted: { icon: \"!\", color: \"warning\" },\n\tcancelled: { icon: \"–\", color: \"muted\", strike: true },\n\tcanceled: { icon: \"–\", color: \"muted\", strike: true },\n\treviewed: { icon: \"✓\", color: \"success\" },\n\tinfo: { icon: \"·\", color: \"muted\" },\n};\n\nconst NOTICE_STYLES: Record<OrchestrationPanelNotice[\"status\"], { icon: string; color: ThemeColor }> = {\n\tinfo: { icon: \"·\", color: \"muted\" },\n\tsuccess: { icon: \"✓\", color: \"success\" },\n\twarning: { icon: \"!\", color: \"warning\" },\n\terror: { icon: \"×\", color: \"error\" },\n};\n\nexport function taskStepPanelRow(step: TaskStep): OrchestrationPanelRow {\n\tconst meta = [\n\t\tstep.priority === \"high\" ? \"high priority\" : undefined,\n\t\tstep.owner ? `@${step.owner}` : undefined,\n\t\tstep.requirementIds?.length\n\t\t\t? `${step.requirementIds.length} requirement${step.requirementIds.length === 1 ? \"\" : \"s\"}`\n\t\t\t: undefined,\n\t\tstep.evidence.length ? `${step.evidence.length} evidence` : undefined,\n\t].filter((value): value is string => value !== undefined);\n\tconst details = [\n\t\t...step.notes.slice(-2).map((note) => `note: ${note}`),\n\t\t...step.evidence.slice(-2).map((evidence) => `evidence: ${evidence}`),\n\t];\n\treturn {\n\t\tstatus: step.status,\n\t\tlabel: step.status === \"in_progress\" ? (step.activeForm ?? step.content) : step.content,\n\t\tmeta,\n\t\tdetails,\n\t};\n}\n\nfunction renderRow(theme: Theme, row: OrchestrationPanelRow, width: number, expanded: boolean): string[] {\n\tconst style = ROW_STYLES[row.status];\n\tconst prefix = ` ${theme.fg(style.color, style.icon)} `;\n\tconst meta = row.meta?.filter(Boolean).join(\" · \") ?? \"\";\n\tconst suffix = meta ? ` ${theme.fg(\"dim\", meta)}` : \"\";\n\tconst labelWidth = Math.max(4, width - visibleWidth(prefix) - visibleWidth(suffix));\n\tconst clippedLabel = truncateToWidth(row.label, labelWidth, \"…\");\n\tlet label = style.bold ? theme.bold(clippedLabel) : clippedLabel;\n\tif (style.strike) label = theme.strikethrough(label);\n\tconst lines = [`${prefix}${theme.fg(style.strike ? \"dim\" : \"text\", label)}${suffix}`];\n\tif (expanded) {\n\t\tfor (const detail of row.details ?? []) {\n\t\t\tlines.push(` ${theme.fg(\"dim\", truncateToWidth(detail, Math.max(4, width - 4), \"…\"))}`);\n\t\t}\n\t}\n\treturn lines;\n}\n\nexport function renderOrchestrationPanelLines(\n\ttheme: Theme,\n\tmodel: OrchestrationPanelModel,\n\twidth: number,\n\texpanded = false,\n): string[] {\n\tconst safeWidth = Math.max(1, width);\n\tconst title = renderTitleBadge(theme, {\n\t\tlabel: model.label,\n\t\taction: model.action,\n\t\tstatus: model.status ?? \"info\",\n\t});\n\tconst summary = model.summary?.filter(Boolean).join(theme.fg(\"dim\", \" · \")) ?? \"\";\n\tconst lines = [summary ? `${title} ${theme.fg(\"dim\", summary)}` : title];\n\tconst rows = model.rows ?? [];\n\tif (rows.length > 0) {\n\t\tlet section: string | undefined;\n\t\tfor (const row of rows) {\n\t\t\tif (row.section && row.section !== section) {\n\t\t\t\tsection = row.section;\n\t\t\t\tlines.push(` ${theme.fg(\"muted\", theme.bold(row.section))}`);\n\t\t\t}\n\t\t\tlines.push(...renderRow(theme, row, safeWidth, expanded));\n\t\t}\n\t} else if (model.emptyText) {\n\t\tlines.push(` ${theme.fg(\"muted\", model.emptyText)}`);\n\t}\n\tif ((model.hiddenRowCount ?? 0) > 0) {\n\t\tlines.push(` ${theme.fg(\"dim\", `… ${model.hiddenRowCount} more`)}`);\n\t}\n\tfor (const notice of model.notices ?? []) {\n\t\tconst style = NOTICE_STYLES[notice.status];\n\t\tlines.push(` ${theme.fg(style.color, style.icon)} ${theme.fg(\"dim\", notice.text)}`);\n\t}\n\treturn lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n}\n\nexport class OrchestrationPanelComponent implements Component {\n\tprivate cachedWidth?: number;\n\tprivate cachedLines?: string[];\n\tprivate readonly theme: Theme;\n\tprivate readonly model: OrchestrationPanelModel;\n\tprivate readonly expanded: boolean;\n\n\tconstructor(theme: Theme, model: OrchestrationPanelModel, expanded = false) {\n\t\tthis.theme = theme;\n\t\tthis.model = model;\n\t\tthis.expanded = expanded;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.cachedWidth === width && this.cachedLines) return this.cachedLines;\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = renderOrchestrationPanelLines(this.theme, this.model, width, this.expanded);\n\t\treturn this.cachedLines;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n}\n\nexport function renderOrchestrationToolResult(\n\ttheme: Theme,\n\tmodel: OrchestrationPanelModel,\n\toptions: { isPartial: boolean; collapse: boolean; expanded: boolean },\n): Component {\n\tif (options.isPartial || options.collapse) return emptyOrchestrationCall();\n\treturn new OrchestrationPanelComponent(theme, model, options.expanded);\n}\n\nexport function emptyOrchestrationCall(): Component {\n\treturn {\n\t\trender: () => [],\n\t\tinvalidate() {},\n\t};\n}\n"]}
1
+ {"version":3,"file":"orchestration-panel.js","sourceRoot":"","sources":["../../../src/core/tools/orchestration-panel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAyB,MAAM,kDAAkD,CAAC;AAoD3G,MAAM,UAAU,GAA6C;IAC5D,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;IACtC,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE;IACvC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EA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GAAG,EAAE,CAAC,EAAE;QAChB,UAAU,KAAI,CAAC;KACf,CAAC;AACH,CAAC","sourcesContent":["import type { Component } from \"@caupulican/pi-tui\";\nimport { truncateToWidth, visibleWidth } from \"@caupulican/pi-tui\";\nimport { renderTitleBadge, type TitleBadgeStatus } from \"../../modes/interactive/components/tool-title.ts\";\nimport type { Theme, ThemeColor } from \"../../modes/interactive/theme/theme.ts\";\nimport type { TaskStep } from \"../tasks/task-state.ts\";\n\nexport type OrchestrationRowStatus =\n\t| \"pending\"\n\t| \"queued\"\n\t| \"running\"\n\t| \"in_progress\"\n\t| \"completed\"\n\t| \"succeeded\"\n\t| \"partial\"\n\t| \"blocked\"\n\t| \"failed\"\n\t| \"timeout\"\n\t| \"budget_exhausted\"\n\t| \"cancelled\"\n\t| \"canceled\"\n\t| \"reviewed\"\n\t| \"info\";\n\nexport interface OrchestrationPanelRow {\n\tstatus: OrchestrationRowStatus;\n\tlabel: string;\n\tsection?: string;\n\tmeta?: readonly string[];\n\tdetails?: readonly string[];\n}\n\nexport interface OrchestrationPanelNotice {\n\tstatus: \"info\" | \"success\" | \"warning\" | \"error\";\n\ttext: string;\n}\n\nexport interface OrchestrationPanelModel {\n\tlabel: string;\n\taction?: string;\n\tstatus?: TitleBadgeStatus;\n\tsummary?: readonly string[];\n\trows?: readonly OrchestrationPanelRow[];\n\tnotices?: readonly OrchestrationPanelNotice[];\n\temptyText?: string;\n\thiddenRowCount?: number;\n}\n\ninterface RowStyle {\n\ticon: string;\n\tcolor: ThemeColor;\n\tstrike?: boolean;\n\tbold?: boolean;\n}\n\nconst ROW_STYLES: Record<OrchestrationRowStatus, RowStyle> = {\n\tpending: { icon: \"○\", color: \"muted\" },\n\tqueued: { icon: \"◌\", color: \"warning\" },\n\trunning: { icon: \"●\", color: \"accent\", bold: true },\n\tin_progress: { icon: \"●\", color: \"accent\", bold: true },\n\tcompleted: { icon: \"✓\", color: \"success\", strike: true },\n\tsucceeded: { icon: \"✓\", color: \"success\" },\n\tpartial: { icon: \"!\", color: \"warning\" },\n\tblocked: { icon: \"!\", color: \"warning\", bold: true },\n\tfailed: { icon: \"×\", color: \"error\", bold: true },\n\ttimeout: { icon: \"×\", color: \"warning\" },\n\tbudget_exhausted: { icon: \"!\", color: \"warning\" },\n\tcancelled: { icon: \"–\", color: \"muted\", strike: true },\n\tcanceled: { icon: \"–\", color: \"muted\", strike: true },\n\treviewed: { icon: \"✓\", color: \"success\" },\n\tinfo: { icon: \"·\", color: \"muted\" },\n};\n\nconst NOTICE_STYLES: Record<OrchestrationPanelNotice[\"status\"], { icon: string; color: ThemeColor }> = {\n\tinfo: { icon: \"·\", color: \"muted\" },\n\tsuccess: { icon: \"✓\", color: \"success\" },\n\twarning: { icon: \"!\", color: \"warning\" },\n\terror: { icon: \"×\", color: \"error\" },\n};\n\nexport function taskStepPanelRow(step: TaskStep): OrchestrationPanelRow {\n\tconst meta = [\n\t\tstep.priority === \"high\" ? \"high priority\" : undefined,\n\t\tstep.owner ? `@${step.owner}` : undefined,\n\t\tstep.requirementIds?.length\n\t\t\t? `${step.requirementIds.length} requirement${step.requirementIds.length === 1 ? \"\" : \"s\"}`\n\t\t\t: undefined,\n\t\tstep.pipelineRunId && step.pipelineStageId ? `${step.pipelineRunId}/${step.pipelineStageId}` : undefined,\n\t\tstep.evidence.length ? `${step.evidence.length} evidence` : undefined,\n\t].filter((value): value is string => value !== undefined);\n\tconst details = [\n\t\t...step.notes.slice(-2).map((note) => `note: ${note}`),\n\t\t...step.evidence.slice(-2).map((evidence) => `evidence: ${evidence}`),\n\t];\n\treturn {\n\t\tstatus: step.status,\n\t\tlabel: step.status === \"in_progress\" ? (step.activeForm ?? step.content) : step.content,\n\t\tmeta,\n\t\tdetails,\n\t};\n}\n\nfunction renderRow(theme: Theme, row: OrchestrationPanelRow, width: number, expanded: boolean): string[] {\n\tconst style = ROW_STYLES[row.status];\n\tconst prefix = ` ${theme.fg(style.color, style.icon)} `;\n\tconst meta = row.meta?.filter(Boolean).join(\" · \") ?? \"\";\n\tconst suffix = meta ? ` ${theme.fg(\"dim\", meta)}` : \"\";\n\tconst labelWidth = Math.max(4, width - visibleWidth(prefix) - visibleWidth(suffix));\n\tconst clippedLabel = truncateToWidth(row.label, labelWidth, \"…\");\n\tlet label = style.bold ? theme.bold(clippedLabel) : clippedLabel;\n\tif (style.strike) label = theme.strikethrough(label);\n\tconst lines = [`${prefix}${theme.fg(style.strike ? \"dim\" : \"text\", label)}${suffix}`];\n\tif (expanded) {\n\t\tfor (const detail of row.details ?? []) {\n\t\t\tlines.push(` ${theme.fg(\"dim\", truncateToWidth(detail, Math.max(4, width - 4), \"…\"))}`);\n\t\t}\n\t}\n\treturn lines;\n}\n\nexport function renderOrchestrationPanelLines(\n\ttheme: Theme,\n\tmodel: OrchestrationPanelModel,\n\twidth: number,\n\texpanded = false,\n): string[] {\n\tconst safeWidth = Math.max(1, width);\n\tconst title = renderTitleBadge(theme, {\n\t\tlabel: model.label,\n\t\taction: model.action,\n\t\tstatus: model.status ?? \"info\",\n\t});\n\tconst summary = model.summary?.filter(Boolean).join(theme.fg(\"dim\", \" · \")) ?? \"\";\n\tconst lines = [summary ? `${title} ${theme.fg(\"dim\", summary)}` : title];\n\tconst rows = model.rows ?? [];\n\tif (rows.length > 0) {\n\t\tlet section: string | undefined;\n\t\tfor (const row of rows) {\n\t\t\tif (row.section && row.section !== section) {\n\t\t\t\tsection = row.section;\n\t\t\t\tlines.push(` ${theme.fg(\"muted\", theme.bold(row.section))}`);\n\t\t\t}\n\t\t\tlines.push(...renderRow(theme, row, safeWidth, expanded));\n\t\t}\n\t} else if (model.emptyText) {\n\t\tlines.push(` ${theme.fg(\"muted\", model.emptyText)}`);\n\t}\n\tif ((model.hiddenRowCount ?? 0) > 0) {\n\t\tlines.push(` ${theme.fg(\"dim\", `… ${model.hiddenRowCount} more`)}`);\n\t}\n\tfor (const notice of model.notices ?? []) {\n\t\tconst style = NOTICE_STYLES[notice.status];\n\t\tlines.push(` ${theme.fg(style.color, style.icon)} ${theme.fg(\"dim\", notice.text)}`);\n\t}\n\treturn lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n}\n\nexport class OrchestrationPanelComponent implements Component {\n\tprivate cachedWidth?: number;\n\tprivate cachedLines?: string[];\n\tprivate readonly theme: Theme;\n\tprivate readonly model: OrchestrationPanelModel;\n\tprivate readonly expanded: boolean;\n\n\tconstructor(theme: Theme, model: OrchestrationPanelModel, expanded = false) {\n\t\tthis.theme = theme;\n\t\tthis.model = model;\n\t\tthis.expanded = expanded;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.cachedWidth === width && this.cachedLines) return this.cachedLines;\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = renderOrchestrationPanelLines(this.theme, this.model, width, this.expanded);\n\t\treturn this.cachedLines;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n}\n\nexport function renderOrchestrationToolResult(\n\ttheme: Theme,\n\tmodel: OrchestrationPanelModel,\n\toptions: { isPartial: boolean; collapse: boolean; expanded: boolean },\n): Component {\n\tif (options.isPartial || options.collapse) return emptyOrchestrationCall();\n\treturn new OrchestrationPanelComponent(theme, model, options.expanded);\n}\n\nexport function emptyOrchestrationCall(): Component {\n\treturn {\n\t\trender: () => [],\n\t\tinvalidate() {},\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"persistent-process-coordinator.d.ts","sourceRoot":"","sources":["../../../src/core/tools/persistent-process-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;CACnC;AAaD,qBAAa,4BAA4B;IACxC,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,QAAQ,CAAS;IAEzB,cAGC;IAED,IAAI,KAAK,IAAI,YAAY,GAAG,IAAI,CAE/B;IAED,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOnD;IAED,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAiCnE;IAED,IAAI,IAAI,IAAI,CAKX;IAED,OAAO,IAAI,IAAI,CAKd;IAED,mEAAmE;IACnE,kBAAkB,IAAI,IAAI,CAEzB;IAED,uFAAuF;IACvF,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAIhC;IAED,OAAO,CAAC,KAAK;CAMb"}
1
+ {"version":3,"file":"persistent-process-coordinator.d.ts","sourceRoot":"","sources":["../../../src/core/tools/persistent-process-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;CACnC;AAaD,qBAAa,4BAA4B;IACxC,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,QAAQ,CAAS;IAEzB,cAGC;IAED,IAAI,KAAK,IAAI,YAAY,GAAG,IAAI,CAE/B;IAED,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOnD;IAED,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAuCnE;IAED,IAAI,IAAI,IAAI,CAKX;IAED,OAAO,IAAI,IAAI,CAKd;IAED,mEAAmE;IACnE,kBAAkB,IAAI,IAAI,CAEzB;IAED,uFAAuF;IACvF,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAIhC;IAED,OAAO,CAAC,KAAK;CAMb"}
@@ -58,22 +58,27 @@ export class PersistentProcessCoordinator {
58
58
  return;
59
59
  handlers.onError(error instanceof Error ? error : new Error(String(error)));
60
60
  });
61
- // Process death is authoritative. Defer one check phase so stream data already delivered
62
- // by the kernel reaches the active protocol handler before the terminal callback.
61
+ let exitCode = null;
62
+ let fallbackTimer;
63
63
  child.on("exit", (code) => {
64
64
  if (this.currentChild !== child)
65
65
  return;
66
- setImmediate(() => {
66
+ exitCode = code;
67
+ fallbackTimer = setTimeout(() => {
67
68
  if (!this.clear(child))
68
69
  return;
69
- handlers.onClose(code);
70
- });
70
+ handlers.onClose(exitCode);
71
+ }, 2_000);
72
+ if (typeof fallbackTimer === "object" && fallbackTimer && "unref" in fallbackTimer) {
73
+ fallbackTimer.unref();
74
+ }
71
75
  });
72
- // A genuine close may arrive first; `clear` makes exit/close settlement idempotent.
73
76
  child.on("close", (code) => {
77
+ if (fallbackTimer)
78
+ clearTimeout(fallbackTimer);
74
79
  if (!this.clear(child))
75
80
  return;
76
- handlers.onClose(code);
81
+ handlers.onClose(code ?? exitCode);
77
82
  });
78
83
  }
79
84
  kill() {
@@ -1 +1 @@
1
- {"version":3,"file":"persistent-process-coordinator.js","sourceRoot":"","sources":["../../../src/core/tools/persistent-process-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA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cesContent":["/**\n * Shared lifecycle owner for one serialized, persistent child process.\n *\n * Wire protocols, state projection, and respawn policy stay with their concrete shell adapters.\n * This boundary owns only the invariant OS mechanics: one active task, one tracked child, stale\n * event rejection, exit/close arbitration, whole-tree kill, loop references, and parent exit.\n */\n\nimport type { ChildProcess } from \"node:child_process\";\nimport { setChildProcessLoopRef } from \"../../utils/child-process-ref.ts\";\nimport { killProcessTree, trackDetachedChildPid, untrackDetachedChildPid } from \"../../utils/shell.ts\";\n\nexport interface PersistentChildHandlers {\n\tonStdout(data: Buffer): void;\n\tonStderr(data: Buffer): void;\n\tonError(error: Error): void;\n\tonClose(code: number | null): void;\n}\n\nconst liveCoordinators = new Set<PersistentProcessCoordinator>();\nlet exitHookInstalled = false;\n\nfunction installExitHook(): void {\n\tif (exitHookInstalled) return;\n\texitHookInstalled = true;\n\tprocess.on(\"exit\", () => {\n\t\tfor (const coordinator of liveCoordinators) coordinator.killForProcessExit();\n\t});\n}\n\nexport class PersistentProcessCoordinator {\n\tprivate currentChild: ChildProcess | null = null;\n\tprivate queue: Promise<void> = Promise.resolve();\n\tprivate disposed = false;\n\n\tconstructor() {\n\t\tinstallExitHook();\n\t\tliveCoordinators.add(this);\n\t}\n\n\tget child(): ChildProcess | null {\n\t\treturn this.currentChild;\n\t}\n\n\trunSerialized<T>(task: () => Promise<T>): Promise<T> {\n\t\tconst run = this.queue.then(task);\n\t\tthis.queue = run.then(\n\t\t\t() => undefined,\n\t\t\t() => undefined,\n\t\t);\n\t\treturn run;\n\t}\n\n\tattach(child: ChildProcess, handlers: PersistentChildHandlers): void {\n\t\tif (this.disposed) {\n\t\t\tif (child.pid) killProcessTree(child.pid);\n\t\t\tthrow new Error(\"Persistent process coordinator is disposed\");\n\t\t}\n\t\tif (this.currentChild) throw new Error(\"Persistent process coordinator already owns a child\");\n\t\tthis.currentChild = child;\n\t\tif (child.pid) trackDetachedChildPid(child.pid);\n\n\t\tchild.stdout?.on(\"data\", (data: Buffer) => {\n\t\t\tif (this.currentChild === child) handlers.onStdout(data);\n\t\t});\n\t\tchild.stderr?.on(\"data\", (data: Buffer) => {\n\t\t\tif (this.currentChild === child) handlers.onStderr(data);\n\t\t});\n\t\tchild.on(\"error\", (error) => {\n\t\t\tif (!this.clear(child)) return;\n\t\t\thandlers.onError(error instanceof Error ? error : new Error(String(error)));\n\t\t});\n\t\t// Process death is authoritative. Defer one check phase so stream data already delivered\n\t\t// by the kernel reaches the active protocol handler before the terminal callback.\n\t\tchild.on(\"exit\", (code) => {\n\t\t\tif (this.currentChild !== child) return;\n\t\t\tsetImmediate(() => {\n\t\t\t\tif (!this.clear(child)) return;\n\t\t\t\thandlers.onClose(code);\n\t\t\t});\n\t\t});\n\t\t// A genuine close may arrive first; `clear` makes exit/close settlement idempotent.\n\t\tchild.on(\"close\", (code) => {\n\t\t\tif (!this.clear(child)) return;\n\t\t\thandlers.onClose(code);\n\t\t});\n\t}\n\n\tkill(): void {\n\t\tconst child = this.currentChild;\n\t\tif (!child) return;\n\t\tthis.clear(child);\n\t\tif (child.pid) killProcessTree(child.pid);\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tliveCoordinators.delete(this);\n\t\tthis.kill();\n\t}\n\n\t/** Synchronous best-effort tree kill for the process exit hook. */\n\tkillForProcessExit(): void {\n\t\tthis.kill();\n\t}\n\n\t/** Idle coordinators must not keep one-shot Node modes alive; active commands must. */\n\tsetLoopRef(active: boolean): void {\n\t\tconst child = this.currentChild;\n\t\tif (!child) return;\n\t\tsetChildProcessLoopRef(child, active);\n\t}\n\n\tprivate clear(child: ChildProcess): boolean {\n\t\tif (this.currentChild !== child) return false;\n\t\tif (child.pid) untrackDetachedChildPid(child.pid);\n\t\tthis.currentChild = null;\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"persistent-process-coordinator.js","sourceRoot":"","sources":["../../../src/core/tools/persistent-process-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAG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,CAAC,CAAC;IACvC,CAAC;IAEO,KAAK,CAAC,KAAmB;QAChC,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;QAC9C,IAAI,KAAK,CAAC,GAAG;YAAE,uBAAuB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["/**\n * Shared lifecycle owner for one serialized, persistent child process.\n *\n * Wire protocols, state projection, and respawn policy stay with their concrete shell adapters.\n * This boundary owns only the invariant OS mechanics: one active task, one tracked child, stale\n * event rejection, exit/close arbitration, whole-tree kill, loop references, and parent exit.\n */\n\nimport type { ChildProcess } from \"node:child_process\";\nimport { setChildProcessLoopRef } from \"../../utils/child-process-ref.ts\";\nimport { killProcessTree, trackDetachedChildPid, untrackDetachedChildPid } from \"../../utils/shell.ts\";\n\nexport interface PersistentChildHandlers {\n\tonStdout(data: Buffer): void;\n\tonStderr(data: Buffer): void;\n\tonError(error: Error): void;\n\tonClose(code: number | null): void;\n}\n\nconst liveCoordinators = new Set<PersistentProcessCoordinator>();\nlet exitHookInstalled = false;\n\nfunction installExitHook(): void {\n\tif (exitHookInstalled) return;\n\texitHookInstalled = true;\n\tprocess.on(\"exit\", () => {\n\t\tfor (const coordinator of liveCoordinators) coordinator.killForProcessExit();\n\t});\n}\n\nexport class PersistentProcessCoordinator {\n\tprivate currentChild: ChildProcess | null = null;\n\tprivate queue: Promise<void> = Promise.resolve();\n\tprivate disposed = false;\n\n\tconstructor() {\n\t\tinstallExitHook();\n\t\tliveCoordinators.add(this);\n\t}\n\n\tget child(): ChildProcess | null {\n\t\treturn this.currentChild;\n\t}\n\n\trunSerialized<T>(task: () => Promise<T>): Promise<T> {\n\t\tconst run = this.queue.then(task);\n\t\tthis.queue = run.then(\n\t\t\t() => undefined,\n\t\t\t() => undefined,\n\t\t);\n\t\treturn run;\n\t}\n\n\tattach(child: ChildProcess, handlers: PersistentChildHandlers): void {\n\t\tif (this.disposed) {\n\t\t\tif (child.pid) killProcessTree(child.pid);\n\t\t\tthrow new Error(\"Persistent process coordinator is disposed\");\n\t\t}\n\t\tif (this.currentChild) throw new Error(\"Persistent process coordinator already owns a child\");\n\t\tthis.currentChild = child;\n\t\tif (child.pid) trackDetachedChildPid(child.pid);\n\n\t\tchild.stdout?.on(\"data\", (data: Buffer) => {\n\t\t\tif (this.currentChild === child) handlers.onStdout(data);\n\t\t});\n\t\tchild.stderr?.on(\"data\", (data: Buffer) => {\n\t\t\tif (this.currentChild === child) handlers.onStderr(data);\n\t\t});\n\t\tchild.on(\"error\", (error) => {\n\t\t\tif (!this.clear(child)) return;\n\t\t\thandlers.onError(error instanceof Error ? error : new Error(String(error)));\n\t\t});\n\t\tlet exitCode: number | null = null;\n\t\tlet fallbackTimer: ReturnType<typeof setTimeout> | undefined;\n\n\t\tchild.on(\"exit\", (code) => {\n\t\t\tif (this.currentChild !== child) return;\n\t\t\texitCode = code;\n\t\t\tfallbackTimer = setTimeout(() => {\n\t\t\t\tif (!this.clear(child)) return;\n\t\t\t\thandlers.onClose(exitCode);\n\t\t\t}, 2_000);\n\t\t\tif (typeof fallbackTimer === \"object\" && fallbackTimer && \"unref\" in fallbackTimer) {\n\t\t\t\tfallbackTimer.unref();\n\t\t\t}\n\t\t});\n\n\t\tchild.on(\"close\", (code) => {\n\t\t\tif (fallbackTimer) clearTimeout(fallbackTimer);\n\t\t\tif (!this.clear(child)) return;\n\t\t\thandlers.onClose(code ?? exitCode);\n\t\t});\n\t}\n\n\tkill(): void {\n\t\tconst child = this.currentChild;\n\t\tif (!child) return;\n\t\tthis.clear(child);\n\t\tif (child.pid) killProcessTree(child.pid);\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tliveCoordinators.delete(this);\n\t\tthis.kill();\n\t}\n\n\t/** Synchronous best-effort tree kill for the process exit hook. */\n\tkillForProcessExit(): void {\n\t\tthis.kill();\n\t}\n\n\t/** Idle coordinators must not keep one-shot Node modes alive; active commands must. */\n\tsetLoopRef(active: boolean): void {\n\t\tconst child = this.currentChild;\n\t\tif (!child) return;\n\t\tsetChildProcessLoopRef(child, active);\n\t}\n\n\tprivate clear(child: ChildProcess): boolean {\n\t\tif (this.currentChild !== child) return false;\n\t\tif (child.pid) untrackDetachedChildPid(child.pid);\n\t\tthis.currentChild = null;\n\t\treturn true;\n\t}\n}\n"]}
@@ -16,6 +16,7 @@ export interface PipelineToolDetails {
16
16
  action: PipelineToolAction;
17
17
  applied: boolean;
18
18
  error?: string;
19
+ warning?: string;
19
20
  run?: PipelineRun;
20
21
  definitionName?: string;
21
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/core/tools/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAcN,KAAK,WAAW,EAEhB,MAAM,uBAAuB,CAAC;AAO/B,QAAA,MAAM,cAAc;;;;;EAqBnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,WAA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