@caupulican/pi-adaptative 0.96.0 → 0.96.2
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.
- package/CHANGELOG.md +22 -0
- package/dist/core/agent-session.d.ts +3 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +17 -6
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/delegation/sanitized-context-fork.d.ts.map +1 -1
- package/dist/core/delegation/sanitized-context-fork.js +2 -15
- package/dist/core/delegation/sanitized-context-fork.js.map +1 -1
- package/dist/core/delegation/worker-retry-policy.d.ts.map +1 -1
- package/dist/core/delegation/worker-retry-policy.js +12 -4
- package/dist/core/delegation/worker-retry-policy.js.map +1 -1
- package/dist/core/foreground-recovery-controller.d.ts +1 -0
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
- package/dist/core/foreground-recovery-controller.js +30 -13
- package/dist/core/foreground-recovery-controller.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts +2 -2
- package/dist/core/goal-loop-controller.js +2 -2
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/compact-goal-context.d.ts.map +1 -1
- package/dist/core/goals/compact-goal-context.js +12 -8
- package/dist/core/goals/compact-goal-context.js.map +1 -1
- package/dist/core/goals/goal-continuation-controller.d.ts +3 -3
- package/dist/core/goals/goal-continuation-controller.js +14 -15
- package/dist/core/goals/goal-continuation-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.d.ts +3 -3
- package/dist/core/goals/goal-continuation-defaults.js +3 -3
- package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
- package/dist/core/goals/goal-lifecycle.d.ts +2 -0
- package/dist/core/goals/goal-lifecycle.d.ts.map +1 -1
- package/dist/core/goals/goal-lifecycle.js +22 -0
- package/dist/core/goals/goal-lifecycle.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +8 -2
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-session-controller.js +22 -3
- package/dist/core/goals/goal-session-controller.js.map +1 -1
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +1 -7
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.js +1 -1
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/message-phase.d.ts +8 -0
- package/dist/core/message-phase.d.ts.map +1 -0
- package/dist/core/message-phase.js +48 -0
- package/dist/core/message-phase.js.map +1 -0
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/models/perf-profile.d.ts +1 -0
- package/dist/core/models/perf-profile.d.ts.map +1 -1
- package/dist/core/models/perf-profile.js +12 -3
- package/dist/core/models/perf-profile.js.map +1 -1
- package/dist/core/package-manager.d.ts +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +2 -21
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +5 -3
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +44 -12
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tools/goal.js +2 -2
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +5 -3
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +7 -2
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +2 -2
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.js +9 -0
- package/dist/modes/interactive/interactive-event-controller.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +9 -2
- package/dist/modes/interactive/session-flow-commands.js.map +1 -1
- package/docs/sessions.md +1 -1
- package/docs/tool-repair.md +4 -3
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
package/dist/core/tools/goal.js
CHANGED
|
@@ -249,7 +249,7 @@ export function createGoalToolDefinition(deps) {
|
|
|
249
249
|
"After bounded read-only survey, make the project-relative delivery contract explicit in the goal requirements: POC/MVP proves the requested capability; complete means full integration across affected project surfaces.",
|
|
250
250
|
"Plans: task_steps. Workers: delegate. Background tools: tool_task wait once; cite taskId as kind=tool evidence.",
|
|
251
251
|
"increment satisfies the current open requirement from unused evidence, or completes when none remain.",
|
|
252
|
-
"complete needs current authoritative evidence, no remaining work, no active goal-owned lanes, no open task_steps, no goal-owned running or cited non-completed tool_task, and no active pipeline. block_goal
|
|
252
|
+
"complete needs current authoritative evidence, no remaining work, no active goal-owned lanes, no open task_steps, no goal-owned running or cited non-completed tool_task, and no active pipeline. block_requirement/block_goal only when the same verified owner/approval boundary or capability impossibility persists for 3 consecutive no-progress goal turns despite distinct recovery approaches, and no meaningful progress is possible without owner input or external change; otherwise keep working.",
|
|
253
253
|
],
|
|
254
254
|
parameters: goalSchema,
|
|
255
255
|
renderShell: "self",
|
|
@@ -496,7 +496,7 @@ export function createGoalLifecycleToolDefinitions(goalTool) {
|
|
|
496
496
|
const updateGoal = {
|
|
497
497
|
name: GOAL_LIFECYCLE_TOOL_NAMES[2],
|
|
498
498
|
label: GOAL_LIFECYCLE_TOOL_NAMES[2],
|
|
499
|
-
description: "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
|
|
499
|
+
description: "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 when the same verified owner/approval boundary or capability impossibility persists for at least three consecutive no-progress goal turns despite distinct recovery approaches, and no meaningful progress is possible without owner input or external change; include the evidence and attempted approaches in reason. Never use blocked merely because work is hard, slow, uncertain, incomplete, or would benefit from clarification.",
|
|
500
500
|
promptSnippet: "Update goal; complete/block only with evidence.",
|
|
501
501
|
parameters: updateGoalSchema,
|
|
502
502
|
execute(toolCallId, input, signal, onUpdate, context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goal.js","sourceRoot":"","sources":["../../../src/core/tools/goal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAA0B,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EAA0D,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACvH,OAAO,EACN,eAAe,EAIf,kBAAkB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,EACN,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EAEvB,6BAA6B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAC7B;IACC,MAAM,EAAE,IAAI,CAAC,KAAK,CACjB;QACC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,OA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AM,UAAU,GAAmB;QAClC,IAAI,EAAE,yBAAyB,CAAC,CAAC,CAAC;QAClC,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC;QACnC,WAAW,EACV,6hBAA6hB;QAC9hB,aAAa,EAAE,iDAAiD;QAChE,UAAU,EAAE,gBAAgB;QAC5B,OAAO,CAAC,UAAU,EAAE,KAAsC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO;YACpF,MAAM,mBAAmB,GAAe,KAAK,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;YACjG,MAAM,MAAM,GAAkB,qBAAqB,CAAC,mBAAmB,CAAC;gBACvE,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE;gBACxB,CAAC,CAAC,KAAK,CAAC,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 { createHash, 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\tgoalEvidencePanelRow,\n\tgoalRequirementPanelRow,\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. Omit on add_requirement for a stable host id.\",\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(\n\t\t\tType.String({ description: \"Evidence id. Omit on add_evidence for a stable host id.\" }),\n\t\t),\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 when the task benefits from a 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 and refusing completion while goal-owned work is\n\t * queued or running. Read-defensive: when not wired -- exactly like `hasToolCallId` -- a \"worker\"\n\t * ref cannot be proven and is recorded as `verified: false` rather than assumed true.\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 * `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 budget normalization for the current foreground turn. Omitted by direct owner/test callers. */\n\tauthorizeStart?: (input: Pick<GoalToolInput, \"userGoal\" | \"tokenBudget\">) => string | number | null | 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 generatedGoalRecordId(prefix: \"req\" | \"ev\", value: unknown): string {\n\treturn `${prefix}-${createHash(\"sha256\").update(JSON.stringify(value)).digest(\"hex\").slice(0, 16)}`;\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:\n\t\t\t\t\tinput.requirementId ??\n\t\t\t\t\tgeneratedGoalRecordId(\"req\", {\n\t\t\t\t\t\ttext: input.text?.trim() ?? \"\",\n\t\t\t\t\t\tdependencies: [...(input.dependencies ?? [])].map((value) => value.trim()).sort(),\n\t\t\t\t\t}),\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:\n\t\t\t\t\tinput.evidenceId ??\n\t\t\t\t\tgeneratedGoalRecordId(\"ev\", {\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tsummary: input.summary?.trim() ?? \"\",\n\t\t\t\t\t\turi: input.uri?.trim() ?? \"\",\n\t\t\t\t\t}),\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\tdescription: state.userGoal,\n\t\twrapRows: true,\n\t\trows: [...state.requirements.map(goalRequirementPanelRow), ...state.evidence.map(goalEvidencePanelRow)],\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\nfunction goalExecutionError(\n\taction: GoalToolDetails[\"action\"],\n\tmessage: string,\n\tstate: GoalState,\n): { content: Array<{ type: \"text\"; text: string }>; details: GoalToolDetails; isError: true } {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: `goal ${action} failed: ${message}` }],\n\t\tdetails: { action, applied: false, error: message, state },\n\t\tisError: true,\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 work that benefits from persistent autonomous continuation. The agent may start one at its discretion or on explicit user/system request; only the owner or system may set a token budget.\",\n\t\tpromptSnippet: \"Read or update the durable goal.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Start when persistent continuation materially benefits current work or the user/system requests it. Skip routine one-turn tasks; get if uncertain; never replace unfinished goal; tokenBudget only if requested.\",\n\t\t\t\"After bounded read-only survey, make the project-relative delivery contract explicit in the goal requirements: POC/MVP proves the requested capability; complete means full integration across affected project surfaces.\",\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 active goal-owned lanes, no open task_steps, no goal-owned running or cited non-completed tool_task, and 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,\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\tlet normalizedInput = input;\n\t\t\tif (input.action === \"start\" && deps.authorizeStart) {\n\t\t\t\tconst authority = deps.authorizeStart(input);\n\t\t\t\tif (typeof authority === \"string\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: `goal start failed: ${authority}` }],\n\t\t\t\t\t\tdetails: { action: \"start\", applied: false, error: authority },\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tnormalizedInput = {\n\t\t\t\t\t...input,\n\t\t\t\t\t...(typeof authority === \"number\" ? { tokenBudget: authority } : {}),\n\t\t\t\t};\n\t\t\t\tif (authority === null) delete normalizedInput.tokenBudget;\n\t\t\t}\n\t\t\tconst mapped = toGoalAction(normalizedInput);\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\tlet activeGoalLaneIds: string[] | undefined;\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\tconst boundLaneIds = new Set(\n\t\t\t\t\t\t\tcurrent.requirements.flatMap((requirement) =>\n\t\t\t\t\t\t\t\trequirement.boundLaneId ? [requirement.boundLaneId] : [],\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tactiveGoalLaneIds = deps\n\t\t\t\t\t\t\t.getLaneRecords?.()\n\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t(record) =>\n\t\t\t\t\t\t\t\t\t(record.status === \"queued\" || record.status === \"running\") &&\n\t\t\t\t\t\t\t\t\t(record.goalId === current.goalId || boundLaneIds.has(record.laneId)),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map((record) => record.laneId);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst message = `Cannot verify active goal-owned lane state: ${error instanceof Error ? error.message : String(error)}`;\n\t\t\t\t\t\treturn goalExecutionError(input.action, message, current);\n\t\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 goalExecutionError(input.action, message, current);\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\tactiveGoalLaneIds,\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 durable goal when persistent autonomous continuation materially benefits the current work, or when the user/system explicitly requests one. Use agent discretion; skip routine short tasks. Set token_budget only when explicitly requested. Fails if an unfinished goal exists.\",\n\t\tpromptSnippet: \"Start 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 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: \"Update goal; complete/block only with evidence.\",\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,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAA0B,oBAAoB,EAAE,MAAM,4BA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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 { createHash, 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\tgoalEvidencePanelRow,\n\tgoalRequirementPanelRow,\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. Omit on add_requirement for a stable host id.\",\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(\n\t\t\tType.String({ description: \"Evidence id. Omit on add_evidence for a stable host id.\" }),\n\t\t),\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 when the task benefits from a 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 and refusing completion while goal-owned work is\n\t * queued or running. Read-defensive: when not wired -- exactly like `hasToolCallId` -- a \"worker\"\n\t * ref cannot be proven and is recorded as `verified: false` rather than assumed true.\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 * `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 budget normalization for the current foreground turn. Omitted by direct owner/test callers. */\n\tauthorizeStart?: (input: Pick<GoalToolInput, \"userGoal\" | \"tokenBudget\">) => string | number | null | 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 generatedGoalRecordId(prefix: \"req\" | \"ev\", value: unknown): string {\n\treturn `${prefix}-${createHash(\"sha256\").update(JSON.stringify(value)).digest(\"hex\").slice(0, 16)}`;\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:\n\t\t\t\t\tinput.requirementId ??\n\t\t\t\t\tgeneratedGoalRecordId(\"req\", {\n\t\t\t\t\t\ttext: input.text?.trim() ?? \"\",\n\t\t\t\t\t\tdependencies: [...(input.dependencies ?? [])].map((value) => value.trim()).sort(),\n\t\t\t\t\t}),\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:\n\t\t\t\t\tinput.evidenceId ??\n\t\t\t\t\tgeneratedGoalRecordId(\"ev\", {\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tsummary: input.summary?.trim() ?? \"\",\n\t\t\t\t\t\turi: input.uri?.trim() ?? \"\",\n\t\t\t\t\t}),\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\tdescription: state.userGoal,\n\t\twrapRows: true,\n\t\trows: [...state.requirements.map(goalRequirementPanelRow), ...state.evidence.map(goalEvidencePanelRow)],\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\nfunction goalExecutionError(\n\taction: GoalToolDetails[\"action\"],\n\tmessage: string,\n\tstate: GoalState,\n): { content: Array<{ type: \"text\"; text: string }>; details: GoalToolDetails; isError: true } {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: `goal ${action} failed: ${message}` }],\n\t\tdetails: { action, applied: false, error: message, state },\n\t\tisError: true,\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 work that benefits from persistent autonomous continuation. The agent may start one at its discretion or on explicit user/system request; only the owner or system may set a token budget.\",\n\t\tpromptSnippet: \"Read or update the durable goal.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Start when persistent continuation materially benefits current work or the user/system requests it. Skip routine one-turn tasks; get if uncertain; never replace unfinished goal; tokenBudget only if requested.\",\n\t\t\t\"After bounded read-only survey, make the project-relative delivery contract explicit in the goal requirements: POC/MVP proves the requested capability; complete means full integration across affected project surfaces.\",\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 active goal-owned lanes, no open task_steps, no goal-owned running or cited non-completed tool_task, and no active pipeline. block_requirement/block_goal only when the same verified owner/approval boundary or capability impossibility persists for 3 consecutive no-progress goal turns despite distinct recovery approaches, and no meaningful progress is possible without owner input or external change; otherwise keep working.\",\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,\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\tlet normalizedInput = input;\n\t\t\tif (input.action === \"start\" && deps.authorizeStart) {\n\t\t\t\tconst authority = deps.authorizeStart(input);\n\t\t\t\tif (typeof authority === \"string\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: `goal start failed: ${authority}` }],\n\t\t\t\t\t\tdetails: { action: \"start\", applied: false, error: authority },\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tnormalizedInput = {\n\t\t\t\t\t...input,\n\t\t\t\t\t...(typeof authority === \"number\" ? { tokenBudget: authority } : {}),\n\t\t\t\t};\n\t\t\t\tif (authority === null) delete normalizedInput.tokenBudget;\n\t\t\t}\n\t\t\tconst mapped = toGoalAction(normalizedInput);\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\tlet activeGoalLaneIds: string[] | undefined;\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\tconst boundLaneIds = new Set(\n\t\t\t\t\t\t\tcurrent.requirements.flatMap((requirement) =>\n\t\t\t\t\t\t\t\trequirement.boundLaneId ? [requirement.boundLaneId] : [],\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tactiveGoalLaneIds = deps\n\t\t\t\t\t\t\t.getLaneRecords?.()\n\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t(record) =>\n\t\t\t\t\t\t\t\t\t(record.status === \"queued\" || record.status === \"running\") &&\n\t\t\t\t\t\t\t\t\t(record.goalId === current.goalId || boundLaneIds.has(record.laneId)),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map((record) => record.laneId);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst message = `Cannot verify active goal-owned lane state: ${error instanceof Error ? error.message : String(error)}`;\n\t\t\t\t\t\treturn goalExecutionError(input.action, message, current);\n\t\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 goalExecutionError(input.action, message, current);\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\tactiveGoalLaneIds,\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 durable goal when persistent autonomous continuation materially benefits the current work, or when the user/system explicitly requests one. Use agent discretion; skip routine short tasks. Set token_budget only when explicitly requested. Fails if an unfinished goal exists.\",\n\t\tpromptSnippet: \"Start 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 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 when the same verified owner/approval boundary or capability impossibility persists for at least three consecutive no-progress goal turns despite distinct recovery approaches, and no meaningful progress is possible without owner input or external change; include the evidence and attempted approaches in reason. Never use blocked merely because work is hard, slow, uncertain, incomplete, or would benefit from clarification.\",\n\t\tpromptSnippet: \"Update goal; complete/block only with evidence.\",\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":"assistant-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAY,KAAK,aAAa,EAAgB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"assistant-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAY,KAAK,aAAa,EAAgB,MAAM,oBAAoB,CAAC;AAQ3F;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACvD,OAAO,CAAC,gBAAgB,CAAY;IACpC,OAAO,CAAC,iBAAiB,CAAU;IACnC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,WAAW,CAAC,CAAmB;IACvC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAS;IAE9B,YACC,OAAO,CAAC,EAAE,gBAAgB,EAC1B,iBAAiB,UAAQ,EACzB,aAAa,GAAE,aAAkC,EAcjD;IAEQ,UAAU,IAAI,IAAI,CAK1B;IAED,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAKxC;IAED,gBAAgB,IAAI,OAAO,CAE1B;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CASvC;IAED,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAkF7C;CACD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Container, Markdown, Spacer, Text } from "@caupulican/pi-tui";
|
|
2
|
+
import { isAssistantCommentary } from "../../../core/message-phase.js";
|
|
2
3
|
import { getMarkdownTheme, theme } from "../theme/theme.js";
|
|
3
4
|
const OSC133_ZONE_START = "\x1b]133;A\x07";
|
|
4
5
|
const OSC133_ZONE_END = "\x1b]133;B\x07";
|
|
@@ -48,7 +49,7 @@ export class AssistantMessageComponent extends Container {
|
|
|
48
49
|
this.lastMessage = message;
|
|
49
50
|
// Clear content container
|
|
50
51
|
this.contentContainer.clear();
|
|
51
|
-
const hasVisibleContent = message.content.some((c) => (c.type === "text" && c.text.trim()) ||
|
|
52
|
+
const hasVisibleContent = message.content.some((c) => (c.type === "text" && !isAssistantCommentary(c) && c.text.trim()) ||
|
|
52
53
|
(!this.hideThinkingBlock && c.type === "thinking" && c.thinking.trim()));
|
|
53
54
|
const hasToolCalls = message.content.some((c) => c.type === "toolCall");
|
|
54
55
|
this.visibleOutput =
|
|
@@ -59,7 +60,7 @@ export class AssistantMessageComponent extends Container {
|
|
|
59
60
|
// Render content in order
|
|
60
61
|
for (let i = 0; i < message.content.length; i++) {
|
|
61
62
|
const content = message.content[i];
|
|
62
|
-
if (content.type === "text" && content.text.trim()) {
|
|
63
|
+
if (content.type === "text" && !isAssistantCommentary(content) && content.text.trim()) {
|
|
63
64
|
// Assistant text messages with no background - trim the text
|
|
64
65
|
// Set paddingY=0 to avoid extra spacing before tool executions
|
|
65
66
|
this.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, this.markdownTheme));
|
|
@@ -82,7 +83,8 @@ export class AssistantMessageComponent extends Container {
|
|
|
82
83
|
if (!this.hideThinkingBlock) {
|
|
83
84
|
const hasVisibleContentAfter = message.content
|
|
84
85
|
.slice(i + 1)
|
|
85
|
-
.some((c) => (c.type === "text" && c
|
|
86
|
+
.some((c) => (c.type === "text" && !isAssistantCommentary(c) && c.text.trim()) ||
|
|
87
|
+
(c.type === "thinking" && c.thinking.trim()));
|
|
86
88
|
// Adjacent thinking blocks form one section instead of repeated visual chrome.
|
|
87
89
|
this.contentContainer.addChild(new Markdown(thinkingBlocks.join("\n\n"), 1, 0, this.markdownTheme, {
|
|
88
90
|
color: (text) => theme.fg("thinkingText", text),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAsB,MAAM,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAC3C,MAAM,eAAe,GAAG,gBAAgB,CAAC;AACzC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAQvD,YACC,OAA0B,EAC1B,iBAAiB,GAAG,KAAK,EACzB,aAAa,GAAkB,gBAAgB,EAAE;QAEjD,KAAK,EAAE,CAAC;QARD,iBAAY,GAAG,KAAK,CAAC;QACrB,kBAAa,GAAG,KAAK,CAAC;QAS7B,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QAEnC,sCAAsC;QACtC,IAAI,CAAC,gBAAgB,GAAG,IAAI,SAAS,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAErC,IAAI,OAAO,EAAE,CAAC;YACb,I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D","sourcesContent":["import type { AssistantMessage } from \"@caupulican/pi-ai\";\nimport { Container, Markdown, type MarkdownTheme, Spacer, Text } from \"@caupulican/pi-tui\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.ts\";\n\nconst OSC133_ZONE_START = \"\\x1b]133;A\\x07\";\nconst OSC133_ZONE_END = \"\\x1b]133;B\\x07\";\nconst OSC133_ZONE_FINAL = \"\\x1b]133;C\\x07\";\n\n/**\n * Component that renders a complete assistant message\n */\nexport class AssistantMessageComponent extends Container {\n\tprivate contentContainer: Container;\n\tprivate hideThinkingBlock: boolean;\n\tprivate markdownTheme: MarkdownTheme;\n\tprivate lastMessage?: AssistantMessage;\n\tprivate hasToolCalls = false;\n\tprivate visibleOutput = false;\n\n\tconstructor(\n\t\tmessage?: AssistantMessage,\n\t\thideThinkingBlock = false,\n\t\tmarkdownTheme: MarkdownTheme = getMarkdownTheme(),\n\t) {\n\t\tsuper();\n\n\t\tthis.hideThinkingBlock = hideThinkingBlock;\n\t\tthis.markdownTheme = markdownTheme;\n\n\t\t// Container for text/thinking content\n\t\tthis.contentContainer = new Container();\n\t\tthis.addChild(this.contentContainer);\n\n\t\tif (message) {\n\t\t\tthis.updateContent(message);\n\t\t}\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\tsetHideThinkingBlock(hide: boolean): void {\n\t\tthis.hideThinkingBlock = hide;\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\thasVisibleOutput(): boolean {\n\t\treturn this.visibleOutput;\n\t}\n\n\toverride render(width: number): string[] {\n\t\tconst lines = super.render(width);\n\t\tif (this.hasToolCalls || lines.length === 0) {\n\t\t\treturn lines;\n\t\t}\n\n\t\tlines[0] = OSC133_ZONE_START + lines[0];\n\t\tlines[lines.length - 1] = OSC133_ZONE_END + OSC133_ZONE_FINAL + lines[lines.length - 1];\n\t\treturn lines;\n\t}\n\n\tupdateContent(message: AssistantMessage): void {\n\t\tthis.lastMessage = message;\n\n\t\t// Clear content container\n\t\tthis.contentContainer.clear();\n\n\t\tconst hasVisibleContent = message.content.some(\n\t\t\t(c) =>\n\t\t\t\t(c.type === \"text\" && c.text.trim()) ||\n\t\t\t\t(!this.hideThinkingBlock && c.type === \"thinking\" && c.thinking.trim()),\n\t\t);\n\t\tconst hasToolCalls = message.content.some((c) => c.type === \"toolCall\");\n\t\tthis.visibleOutput =\n\t\t\thasVisibleContent || (!hasToolCalls && (message.stopReason === \"aborted\" || message.stopReason === \"error\"));\n\n\t\tif (hasVisibleContent) {\n\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t}\n\n\t\t// Render content in order\n\t\tfor (let i = 0; i < message.content.length; i++) {\n\t\t\tconst content = message.content[i];\n\t\t\tif (content.type === \"text\" && content.text.trim()) {\n\t\t\t\t// Assistant text messages with no background - trim the text\n\t\t\t\t// Set paddingY=0 to avoid extra spacing before tool executions\n\t\t\t\tthis.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, this.markdownTheme));\n\t\t\t} else if (content.type === \"thinking\") {\n\t\t\t\tconst thinkingBlocks: string[] = [];\n\t\t\t\tfor (; i < message.content.length; i++) {\n\t\t\t\t\tconst thinkingContent = message.content[i];\n\t\t\t\t\tif (thinkingContent.type !== \"thinking\") break;\n\t\t\t\t\tconst thinking = thinkingContent.thinking.trim();\n\t\t\t\t\tif (thinking) thinkingBlocks.push(thinking);\n\t\t\t\t}\n\t\t\t\ti--;\n\t\t\t\tif (thinkingBlocks.length === 0) continue;\n\n\t\t\t\t// Add spacing only when another visible assistant content block follows.\n\t\t\t\t// This avoids a superfluous blank line before separately-rendered tool execution blocks.\n\t\t\t\tif (!this.hideThinkingBlock) {\n\t\t\t\t\tconst hasVisibleContentAfter = message.content\n\t\t\t\t\t\t.slice(i + 1)\n\t\t\t\t\t\t.some((c) => (c.type === \"text\" && c.text.trim()) || (c.type === \"thinking\" && c.thinking.trim()));\n\t\t\t\t\t// Adjacent thinking blocks form one section instead of repeated visual chrome.\n\t\t\t\t\tthis.contentContainer.addChild(\n\t\t\t\t\t\tnew Markdown(thinkingBlocks.join(\"\\n\\n\"), 1, 0, this.markdownTheme, {\n\t\t\t\t\t\t\tcolor: (text: string) => theme.fg(\"thinkingText\", text),\n\t\t\t\t\t\t\titalic: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t\tif (hasVisibleContentAfter) {\n\t\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Check if aborted - show after partial content\n\t\t// But only if there are no tool calls (tool execution components will show the error)\n\t\tthis.hasToolCalls = hasToolCalls;\n\t\tif (!hasToolCalls) {\n\t\t\tif (message.stopReason === \"aborted\") {\n\t\t\t\tconst abortMessage =\n\t\t\t\t\tmessage.errorMessage && message.errorMessage !== \"Request was aborted\"\n\t\t\t\t\t\t? message.errorMessage\n\t\t\t\t\t\t: \"Operation aborted\";\n\t\t\t\tif (hasVisibleContent) {\n\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"error\", abortMessage), 1, 0));\n\t\t\t} else if (message.stopReason === \"error\") {\n\t\t\t\tconst errorMsg = message.errorMessage || \"Unknown error\";\n\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"error\", `Error: ${errorMsg}`), 1, 0));\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"assistant-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAsB,MAAM,EAA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AC,YAAY;oBACtB,CAAC,CAAC,mBAAmB,CAAC;gBACxB,IAAI,iBAAiB,EAAE,CAAC;oBACvB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/C,CAAC;qBAAM,CAAC;oBACP,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/C,CAAC;gBACD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACjF,CAAC;iBAAM,IAAI,OAAO,CAAC,UAAU,KAAK,OAAO,EAAE,CAAC;gBAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,IAAI,eAAe,CAAC;gBACzD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC9C,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACzF,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { AssistantMessage } from \"@caupulican/pi-ai\";\nimport { Container, Markdown, type MarkdownTheme, Spacer, Text } from \"@caupulican/pi-tui\";\nimport { isAssistantCommentary } from \"../../../core/message-phase.ts\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.ts\";\n\nconst OSC133_ZONE_START = \"\\x1b]133;A\\x07\";\nconst OSC133_ZONE_END = \"\\x1b]133;B\\x07\";\nconst OSC133_ZONE_FINAL = \"\\x1b]133;C\\x07\";\n\n/**\n * Component that renders a complete assistant message\n */\nexport class AssistantMessageComponent extends Container {\n\tprivate contentContainer: Container;\n\tprivate hideThinkingBlock: boolean;\n\tprivate markdownTheme: MarkdownTheme;\n\tprivate lastMessage?: AssistantMessage;\n\tprivate hasToolCalls = false;\n\tprivate visibleOutput = false;\n\n\tconstructor(\n\t\tmessage?: AssistantMessage,\n\t\thideThinkingBlock = false,\n\t\tmarkdownTheme: MarkdownTheme = getMarkdownTheme(),\n\t) {\n\t\tsuper();\n\n\t\tthis.hideThinkingBlock = hideThinkingBlock;\n\t\tthis.markdownTheme = markdownTheme;\n\n\t\t// Container for text/thinking content\n\t\tthis.contentContainer = new Container();\n\t\tthis.addChild(this.contentContainer);\n\n\t\tif (message) {\n\t\t\tthis.updateContent(message);\n\t\t}\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\tsetHideThinkingBlock(hide: boolean): void {\n\t\tthis.hideThinkingBlock = hide;\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\thasVisibleOutput(): boolean {\n\t\treturn this.visibleOutput;\n\t}\n\n\toverride render(width: number): string[] {\n\t\tconst lines = super.render(width);\n\t\tif (this.hasToolCalls || lines.length === 0) {\n\t\t\treturn lines;\n\t\t}\n\n\t\tlines[0] = OSC133_ZONE_START + lines[0];\n\t\tlines[lines.length - 1] = OSC133_ZONE_END + OSC133_ZONE_FINAL + lines[lines.length - 1];\n\t\treturn lines;\n\t}\n\n\tupdateContent(message: AssistantMessage): void {\n\t\tthis.lastMessage = message;\n\n\t\t// Clear content container\n\t\tthis.contentContainer.clear();\n\n\t\tconst hasVisibleContent = message.content.some(\n\t\t\t(c) =>\n\t\t\t\t(c.type === \"text\" && !isAssistantCommentary(c) && c.text.trim()) ||\n\t\t\t\t(!this.hideThinkingBlock && c.type === \"thinking\" && c.thinking.trim()),\n\t\t);\n\t\tconst hasToolCalls = message.content.some((c) => c.type === \"toolCall\");\n\t\tthis.visibleOutput =\n\t\t\thasVisibleContent || (!hasToolCalls && (message.stopReason === \"aborted\" || message.stopReason === \"error\"));\n\n\t\tif (hasVisibleContent) {\n\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t}\n\n\t\t// Render content in order\n\t\tfor (let i = 0; i < message.content.length; i++) {\n\t\t\tconst content = message.content[i];\n\t\t\tif (content.type === \"text\" && !isAssistantCommentary(content) && content.text.trim()) {\n\t\t\t\t// Assistant text messages with no background - trim the text\n\t\t\t\t// Set paddingY=0 to avoid extra spacing before tool executions\n\t\t\t\tthis.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, this.markdownTheme));\n\t\t\t} else if (content.type === \"thinking\") {\n\t\t\t\tconst thinkingBlocks: string[] = [];\n\t\t\t\tfor (; i < message.content.length; i++) {\n\t\t\t\t\tconst thinkingContent = message.content[i];\n\t\t\t\t\tif (thinkingContent.type !== \"thinking\") break;\n\t\t\t\t\tconst thinking = thinkingContent.thinking.trim();\n\t\t\t\t\tif (thinking) thinkingBlocks.push(thinking);\n\t\t\t\t}\n\t\t\t\ti--;\n\t\t\t\tif (thinkingBlocks.length === 0) continue;\n\n\t\t\t\t// Add spacing only when another visible assistant content block follows.\n\t\t\t\t// This avoids a superfluous blank line before separately-rendered tool execution blocks.\n\t\t\t\tif (!this.hideThinkingBlock) {\n\t\t\t\t\tconst hasVisibleContentAfter = message.content\n\t\t\t\t\t\t.slice(i + 1)\n\t\t\t\t\t\t.some(\n\t\t\t\t\t\t\t(c) =>\n\t\t\t\t\t\t\t\t(c.type === \"text\" && !isAssistantCommentary(c) && c.text.trim()) ||\n\t\t\t\t\t\t\t\t(c.type === \"thinking\" && c.thinking.trim()),\n\t\t\t\t\t\t);\n\t\t\t\t\t// Adjacent thinking blocks form one section instead of repeated visual chrome.\n\t\t\t\t\tthis.contentContainer.addChild(\n\t\t\t\t\t\tnew Markdown(thinkingBlocks.join(\"\\n\\n\"), 1, 0, this.markdownTheme, {\n\t\t\t\t\t\t\tcolor: (text: string) => theme.fg(\"thinkingText\", text),\n\t\t\t\t\t\t\titalic: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t\tif (hasVisibleContentAfter) {\n\t\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Check if aborted - show after partial content\n\t\t// But only if there are no tool calls (tool execution components will show the error)\n\t\tthis.hasToolCalls = hasToolCalls;\n\t\tif (!hasToolCalls) {\n\t\t\tif (message.stopReason === \"aborted\") {\n\t\t\t\tconst abortMessage =\n\t\t\t\t\tmessage.errorMessage && message.errorMessage !== \"Request was aborted\"\n\t\t\t\t\t\t? message.errorMessage\n\t\t\t\t\t\t: \"Operation aborted\";\n\t\t\t\tif (hasVisibleContent) {\n\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"error\", abortMessage), 1, 0));\n\t\t\t} else if (message.stopReason === \"error\") {\n\t\t\t\tconst errorMsg = message.errorMessage || \"Unknown error\";\n\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"error\", `Error: ${errorMsg}`), 1, 0));\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -148,11 +148,14 @@ function readSummaryContract(message, kind, items) {
|
|
|
148
148
|
if (summary.kind !== kind || !items || summary.totalCount < items.length)
|
|
149
149
|
return undefined;
|
|
150
150
|
const includedCounts = {
|
|
151
|
+
success: items.filter((item) => item.status === "success").length,
|
|
151
152
|
attention: items.filter((item) => item.status === "attention").length,
|
|
152
153
|
failed: items.filter((item) => item.status === "failed").length,
|
|
153
154
|
canceled: items.filter((item) => item.status === "canceled").length,
|
|
154
155
|
};
|
|
155
|
-
|
|
156
|
+
const successCount = summary.totalCount - summary.attentionCount - summary.failedCount - summary.canceledCount;
|
|
157
|
+
if (successCount < includedCounts.success ||
|
|
158
|
+
summary.attentionCount < includedCounts.attention ||
|
|
156
159
|
summary.failedCount < includedCounts.failed ||
|
|
157
160
|
summary.canceledCount < includedCounts.canceled) {
|
|
158
161
|
return undefined;
|
|
@@ -182,11 +185,13 @@ function formatBackgroundActivitySummary(message) {
|
|
|
182
185
|
if (!summary || !items)
|
|
183
186
|
return fallbackBackgroundActivitySummary(kind);
|
|
184
187
|
const nounName = kind === "agent" ? "agent" : "background task";
|
|
188
|
+
const successIds = items.filter((item) => item.status === "success").map((item) => item.id);
|
|
185
189
|
const attentionIds = items.filter((item) => item.status === "attention").map((item) => item.id);
|
|
186
190
|
const failedIds = items.filter((item) => item.status === "failed").map((item) => item.id);
|
|
187
191
|
const canceledIds = items.filter((item) => item.status === "canceled").map((item) => item.id);
|
|
192
|
+
const successCount = summary.totalCount - summary.attentionCount - summary.failedCount - summary.canceledCount;
|
|
188
193
|
const text = [
|
|
189
|
-
|
|
194
|
+
formatCountedStatus(successCount, nounName, "succeeded", "succeeded", successIds),
|
|
190
195
|
formatCountedStatus(summary.attentionCount, nounName, "needs verification", "need verification", attentionIds),
|
|
191
196
|
formatCountedStatus(summary.failedCount, nounName, "failed", "failed", failedIds),
|
|
192
197
|
formatCountedStatus(summary.canceledCount, nounName, "canceled", "canceled", canceledIds),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/custom-message.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,GAAG,EAEH,SAAS,EACT,QAAQ,EAER,MAAM,EACN,IAAI,EACJ,eAAe,GACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAGN,uCAAuC,EACvC,mCAAmC,GACnC,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE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AAC,CAAC,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;KAC/G,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,gCAAgC,CAAC,OAA+B;IACxE,IAAI,OAAO,CAAC,UAAU,KAAK,sBAAsB,EAAE,CAAC;QACnD,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC9D,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,KAAK,uBAAuB,EAAE,CAAC;QACpD,OAAO,EAAE,IAAI,EAAE,8BAA8B,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["import type { CustomMessage } from \"@caupulican/pi-agent-core\";\nimport type { TextContent } from \"@caupulican/pi-ai\";\nimport {\n\tBox,\n\ttype Component,\n\tContainer,\n\tMarkdown,\n\ttype MarkdownTheme,\n\tSpacer,\n\tText,\n\ttruncateToWidth,\n} from \"@caupulican/pi-tui\";\nimport type { MessageRenderer } from \"../../../core/extensions/types.ts\";\nimport {\n\ttype BackgroundActivitySummaryContract,\n\ttype BackgroundActivitySummaryItem,\n\tcreateBackgroundActivitySummaryContract,\n\tisBackgroundActivitySummaryContract,\n} from \"../../../core/foreground-terminal-handoff-controller.ts\";\nimport { isPlainRecord } from \"../../../core/util/value-guards.ts\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.ts\";\nimport { renderTitleBadge } from \"./tool-title.ts\";\n\n/**\n * Component that renders a custom message entry from extensions.\n * Uses distinct styling to differentiate from user messages.\n */\nexport class CustomMessageComponent extends Container {\n\tprivate message: CustomMessage<unknown>;\n\tprivate customRenderer?: MessageRenderer;\n\tprivate box: Box;\n\tprivate customComponent?: Component;\n\tprivate markdownTheme: MarkdownTheme;\n\tprivate _expanded = false;\n\n\tconstructor(\n\t\tmessage: CustomMessage<unknown>,\n\t\tcustomRenderer?: MessageRenderer,\n\t\tmarkdownTheme: MarkdownTheme = getMarkdownTheme(),\n\t) {\n\t\tsuper();\n\t\tthis.message = message;\n\t\tthis.customRenderer = customRenderer;\n\t\tthis.markdownTheme = markdownTheme;\n\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Create box with purple background (used for default rendering)\n\t\tthis.box = new Box(1, 1, (t) => theme.bg(\"customMessageBg\", t));\n\n\t\tthis.rebuild();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tif (this._expanded !== expanded) {\n\t\t\tthis._expanded = expanded;\n\t\t\tthis.rebuild();\n\t\t}\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.rebuild();\n\t}\n\n\tprivate rebuild(): void {\n\t\t// Remove previous content component\n\t\tif (this.customComponent) {\n\t\t\tthis.removeChild(this.customComponent);\n\t\t\tthis.customComponent = undefined;\n\t\t}\n\t\tthis.removeChild(this.box);\n\n\t\tconst backgroundSummary = formatBackgroundActivitySummary(this.message);\n\t\tif (backgroundSummary) {\n\t\t\tthis.customComponent = new BackgroundActivitySummaryComponent(backgroundSummary);\n\t\t\tthis.addChild(this.customComponent);\n\t\t\treturn;\n\t\t}\n\n\t\t// Try custom renderer first - it handles its own styling\n\t\tif (this.customRenderer) {\n\t\t\ttry {\n\t\t\t\tconst component = this.customRenderer(this.message, { expanded: this._expanded }, theme);\n\t\t\t\tif (component) {\n\t\t\t\t\t// Custom renderer provides its own styled component\n\t\t\t\t\tthis.customComponent = component;\n\t\t\t\t\tthis.addChild(component);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Fall through to default rendering\n\t\t\t}\n\t\t}\n\n\t\t// Default rendering uses our box\n\t\tthis.addChild(this.box);\n\t\tthis.box.clear();\n\n\t\t// Default rendering: label + content\n\t\tthis.box.addChild(new Text(renderTitleBadge(theme, { label: this.message.customType }), 0, 0));\n\t\tthis.box.addChild(new Spacer(1));\n\n\t\t// Extract text content\n\t\tlet text: string;\n\t\tif (typeof this.message.content === \"string\") {\n\t\t\ttext = this.message.content;\n\t\t} else {\n\t\t\ttext = this.message.content\n\t\t\t\t.filter((c): c is TextContent => c.type === \"text\")\n\t\t\t\t.map((c) => c.text)\n\t\t\t\t.join(\"\\n\");\n\t\t}\n\n\t\tthis.box.addChild(\n\t\t\tnew Markdown(text, 0, 0, this.markdownTheme, {\n\t\t\t\tcolor: (text: string) => theme.fg(\"customMessageText\", text),\n\t\t\t}),\n\t\t);\n\t}\n}\n\nfunction boundedIds(ids: readonly string[], totalCount: number): string {\n\tconst shown = ids.slice(0, 4);\n\tconst omitted = Math.max(0, totalCount - shown.length);\n\treturn `[${shown.join(\", \")}${omitted > 0 ? `, +${omitted}` : \"\"}]`;\n}\n\ninterface BackgroundActivitySummary {\n\ttext: string;\n\tstatus: \"success\" | \"warning\" | \"error\";\n}\n\nclass BackgroundActivitySummaryComponent implements Component {\n\tprivate readonly summary: BackgroundActivitySummary;\n\n\tconstructor(summary: BackgroundActivitySummary) {\n\t\tthis.summary = summary;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst line = `${theme.fg(this.summary.status, \"•\")} ${theme.fg(\"muted\", this.summary.text)}`;\n\t\treturn [truncateToWidth(line, Math.max(1, width), \"…\")];\n\t}\n\n\tinvalidate(): void {}\n}\n\nfunction noun(count: number, singular: string): string {\n\treturn count === 1 ? singular : `${singular}s`;\n}\n\nfunction formatCountedStatus(\n\tcount: number,\n\tsingularNoun: string,\n\tsingularVerb: string,\n\tpluralVerb: string,\n\tids: readonly string[],\n): string | undefined {\n\tif (count === 0) return undefined;\n\tconst verb = count === 1 ? singularVerb : pluralVerb;\n\tconst idsText = ids.length > 0 ? ` ${boundedIds(ids, count)}` : \"\";\n\treturn `${count} ${noun(count, singularNoun)} ${verb}${idsText}`;\n}\n\nfunction fallbackBackgroundActivitySummary(kind: \"agent\" | \"task\"): BackgroundActivitySummary {\n\tconst singularNoun = kind === \"agent\" ? \"agent\" : \"background task\";\n\treturn {\n\t\ttext: `Background ${singularNoun} activity unavailable`,\n\t\tstatus: \"warning\",\n\t};\n}\n\nfunction recordSummaryItems(\n\tkind: \"agent\" | \"task\",\n\trecords: readonly Record<string, unknown>[],\n): BackgroundActivitySummaryItem[] | undefined {\n\tconst items: BackgroundActivitySummaryItem[] = [];\n\tfor (const record of records) {\n\t\tconst id = kind === \"agent\" ? record.laneId : record.taskId;\n\t\tif (typeof id !== \"string\" || id.length === 0 || typeof record.status !== \"string\") return undefined;\n\t\tif (kind === \"agent\") {\n\t\t\tconst claimNeedsReview = isPlainRecord(record.claim) && record.claim.parentReviewRequired === true;\n\t\t\tconst status =\n\t\t\t\trecord.status === \"failed\" || record.status === \"timeout\" || record.status === \"budget_exhausted\"\n\t\t\t\t\t? \"failed\"\n\t\t\t\t\t: record.status === \"canceled\"\n\t\t\t\t\t\t? \"canceled\"\n\t\t\t\t\t\t: claimNeedsReview || record.status === \"partial\" || record.status === \"blocked\"\n\t\t\t\t\t\t\t? \"attention\"\n\t\t\t\t\t\t\t: record.status === \"succeeded\"\n\t\t\t\t\t\t\t\t? \"success\"\n\t\t\t\t\t\t\t\t: undefined;\n\t\t\tif (!status) return undefined;\n\t\t\titems.push({ id, status });\n\t\t\tcontinue;\n\t\t}\n\t\tif (record.status !== \"completed\" && record.status !== \"failed\" && record.status !== \"canceled\") return undefined;\n\t\titems.push({\n\t\t\tid,\n\t\t\tstatus: record.status === \"failed\" ? \"failed\" : record.status === \"canceled\" ? \"canceled\" : \"success\",\n\t\t});\n\t}\n\treturn items;\n}\n\nfunction readSummaryContract(\n\tmessage: CustomMessage<unknown>,\n\tkind: \"agent\" | \"task\",\n\titems: readonly BackgroundActivitySummaryItem[] | undefined,\n): BackgroundActivitySummaryContract | undefined {\n\tif (isPlainRecord(message.details) && isBackgroundActivitySummaryContract(message.details.summary)) {\n\t\tconst summary = message.details.summary;\n\t\tif (summary.kind !== kind || !items || summary.totalCount < items.length) return undefined;\n\t\tconst includedCounts = {\n\t\t\tattention: items.filter((item) => item.status === \"attention\").length,\n\t\t\tfailed: items.filter((item) => item.status === \"failed\").length,\n\t\t\tcanceled: items.filter((item) => item.status === \"canceled\").length,\n\t\t};\n\t\tif (\n\t\t\tsummary.attentionCount < includedCounts.attention ||\n\t\t\tsummary.failedCount < includedCounts.failed ||\n\t\t\tsummary.canceledCount < includedCounts.canceled\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn summary;\n\t}\n\treturn items && items.length > 0 ? createBackgroundActivitySummaryContract(kind, items) : undefined;\n}\n\nfunction formatBackgroundActivitySummary(message: CustomMessage<unknown>): BackgroundActivitySummary | undefined {\n\tconst supervisionSummary = formatSupervisionActivitySummary(message);\n\tif (supervisionSummary) return supervisionSummary;\n\tconst kind =\n\t\tmessage.customType === \"background-worker-completion\"\n\t\t\t? \"agent\"\n\t\t\t: message.customType === \"background-tool-completion\"\n\t\t\t\t? \"task\"\n\t\t\t\t: undefined;\n\tif (!kind) return undefined;\n\tif (!isPlainRecord(message.details) || !Array.isArray(message.details.records))\n\t\treturn fallbackBackgroundActivitySummary(kind);\n\tif (message.details.records.some((record) => !isPlainRecord(record))) return fallbackBackgroundActivitySummary(kind);\n\tconst records = message.details.records as Record<string, unknown>[];\n\tconst items = recordSummaryItems(kind, records);\n\tconst summary = readSummaryContract(message, kind, items);\n\tif (!summary || !items) return fallbackBackgroundActivitySummary(kind);\n\tconst nounName = kind === \"agent\" ? \"agent\" : \"background task\";\n\tconst attentionIds = items.filter((item) => item.status === \"attention\").map((item) => item.id);\n\tconst failedIds = items.filter((item) => item.status === \"failed\").map((item) => item.id);\n\tconst canceledIds = items.filter((item) => item.status === \"canceled\").map((item) => item.id);\n\tconst text = [\n\t\t`${summary.totalCount} ${noun(summary.totalCount, nounName)} finished`,\n\t\tformatCountedStatus(summary.attentionCount, nounName, \"needs verification\", \"need verification\", attentionIds),\n\t\tformatCountedStatus(summary.failedCount, nounName, \"failed\", \"failed\", failedIds),\n\t\tformatCountedStatus(summary.canceledCount, nounName, \"canceled\", \"canceled\", canceledIds),\n\t]\n\t\t.filter((part): part is string => part !== undefined)\n\t\t.join(\" | \");\n\treturn {\n\t\ttext,\n\t\tstatus:\n\t\t\tsummary.failedCount > 0 ? \"error\" : summary.attentionCount + summary.canceledCount > 0 ? \"warning\" : \"success\",\n\t};\n}\n\n/**\n * Supervision is durable model input, but its raw lifecycle prose is not a second TUI renderer.\n * Keep it in the session/custom-message stream for the model and transcript overlay while the\n * foreground history uses the same one-line activity projection as background completions.\n */\nfunction formatSupervisionActivitySummary(message: CustomMessage<unknown>): BackgroundActivitySummary | undefined {\n\tif (message.customType === \"worktree-sync-notice\") {\n\t\treturn { text: \"Worktree sync activity\", status: \"warning\" };\n\t}\n\tif (message.customType === \"process-matrix-notice\") {\n\t\treturn { text: \"Process supervision activity\", status: \"warning\" };\n\t}\n\treturn undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"custom-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/custom-message.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,GAAG,EAEH,SAAS,EACT,QAAQ,EAER,MAAM,EACN,IAAI,EACJ,eAAe,GACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAGN,uCAAuC,EACvC,mCAAmC,GACnC,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAQpD,YACC,OAA+B,EAC/B,cAAgC,EAChC,aAAa,GAAkB,gBAAgB,EAAE;QAEjD,KAAK,EAAE,CAAC;QAPD,cAAS,GAAG,KAAK,CAAC;QAQzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAA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QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC;KACzF;SACC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC;SACpD,IAAI,CAAC,KAAK,CAAC,CAAC;IACd,OAAO;QACN,IAAI;QACJ,MAAM,EACL,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;KAC/G,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,gCAAgC,CAAC,OAA+B;IACxE,IAAI,OAAO,CAAC,UAAU,KAAK,sBAAsB,EAAE,CAAC;QACnD,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC9D,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,KAAK,uBAAuB,EAAE,CAAC;QACpD,OAAO,EAAE,IAAI,EAAE,8BAA8B,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["import type { CustomMessage } from \"@caupulican/pi-agent-core\";\nimport type { TextContent } from \"@caupulican/pi-ai\";\nimport {\n\tBox,\n\ttype Component,\n\tContainer,\n\tMarkdown,\n\ttype MarkdownTheme,\n\tSpacer,\n\tText,\n\ttruncateToWidth,\n} from \"@caupulican/pi-tui\";\nimport type { MessageRenderer } from \"../../../core/extensions/types.ts\";\nimport {\n\ttype BackgroundActivitySummaryContract,\n\ttype BackgroundActivitySummaryItem,\n\tcreateBackgroundActivitySummaryContract,\n\tisBackgroundActivitySummaryContract,\n} from \"../../../core/foreground-terminal-handoff-controller.ts\";\nimport { isPlainRecord } from \"../../../core/util/value-guards.ts\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.ts\";\nimport { renderTitleBadge } from \"./tool-title.ts\";\n\n/**\n * Component that renders a custom message entry from extensions.\n * Uses distinct styling to differentiate from user messages.\n */\nexport class CustomMessageComponent extends Container {\n\tprivate message: CustomMessage<unknown>;\n\tprivate customRenderer?: MessageRenderer;\n\tprivate box: Box;\n\tprivate customComponent?: Component;\n\tprivate markdownTheme: MarkdownTheme;\n\tprivate _expanded = false;\n\n\tconstructor(\n\t\tmessage: CustomMessage<unknown>,\n\t\tcustomRenderer?: MessageRenderer,\n\t\tmarkdownTheme: MarkdownTheme = getMarkdownTheme(),\n\t) {\n\t\tsuper();\n\t\tthis.message = message;\n\t\tthis.customRenderer = customRenderer;\n\t\tthis.markdownTheme = markdownTheme;\n\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Create box with purple background (used for default rendering)\n\t\tthis.box = new Box(1, 1, (t) => theme.bg(\"customMessageBg\", t));\n\n\t\tthis.rebuild();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tif (this._expanded !== expanded) {\n\t\t\tthis._expanded = expanded;\n\t\t\tthis.rebuild();\n\t\t}\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.rebuild();\n\t}\n\n\tprivate rebuild(): void {\n\t\t// Remove previous content component\n\t\tif (this.customComponent) {\n\t\t\tthis.removeChild(this.customComponent);\n\t\t\tthis.customComponent = undefined;\n\t\t}\n\t\tthis.removeChild(this.box);\n\n\t\tconst backgroundSummary = formatBackgroundActivitySummary(this.message);\n\t\tif (backgroundSummary) {\n\t\t\tthis.customComponent = new BackgroundActivitySummaryComponent(backgroundSummary);\n\t\t\tthis.addChild(this.customComponent);\n\t\t\treturn;\n\t\t}\n\n\t\t// Try custom renderer first - it handles its own styling\n\t\tif (this.customRenderer) {\n\t\t\ttry {\n\t\t\t\tconst component = this.customRenderer(this.message, { expanded: this._expanded }, theme);\n\t\t\t\tif (component) {\n\t\t\t\t\t// Custom renderer provides its own styled component\n\t\t\t\t\tthis.customComponent = component;\n\t\t\t\t\tthis.addChild(component);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Fall through to default rendering\n\t\t\t}\n\t\t}\n\n\t\t// Default rendering uses our box\n\t\tthis.addChild(this.box);\n\t\tthis.box.clear();\n\n\t\t// Default rendering: label + content\n\t\tthis.box.addChild(new Text(renderTitleBadge(theme, { label: this.message.customType }), 0, 0));\n\t\tthis.box.addChild(new Spacer(1));\n\n\t\t// Extract text content\n\t\tlet text: string;\n\t\tif (typeof this.message.content === \"string\") {\n\t\t\ttext = this.message.content;\n\t\t} else {\n\t\t\ttext = this.message.content\n\t\t\t\t.filter((c): c is TextContent => c.type === \"text\")\n\t\t\t\t.map((c) => c.text)\n\t\t\t\t.join(\"\\n\");\n\t\t}\n\n\t\tthis.box.addChild(\n\t\t\tnew Markdown(text, 0, 0, this.markdownTheme, {\n\t\t\t\tcolor: (text: string) => theme.fg(\"customMessageText\", text),\n\t\t\t}),\n\t\t);\n\t}\n}\n\nfunction boundedIds(ids: readonly string[], totalCount: number): string {\n\tconst shown = ids.slice(0, 4);\n\tconst omitted = Math.max(0, totalCount - shown.length);\n\treturn `[${shown.join(\", \")}${omitted > 0 ? `, +${omitted}` : \"\"}]`;\n}\n\ninterface BackgroundActivitySummary {\n\ttext: string;\n\tstatus: \"success\" | \"warning\" | \"error\";\n}\n\nclass BackgroundActivitySummaryComponent implements Component {\n\tprivate readonly summary: BackgroundActivitySummary;\n\n\tconstructor(summary: BackgroundActivitySummary) {\n\t\tthis.summary = summary;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst line = `${theme.fg(this.summary.status, \"•\")} ${theme.fg(\"muted\", this.summary.text)}`;\n\t\treturn [truncateToWidth(line, Math.max(1, width), \"…\")];\n\t}\n\n\tinvalidate(): void {}\n}\n\nfunction noun(count: number, singular: string): string {\n\treturn count === 1 ? singular : `${singular}s`;\n}\n\nfunction formatCountedStatus(\n\tcount: number,\n\tsingularNoun: string,\n\tsingularVerb: string,\n\tpluralVerb: string,\n\tids: readonly string[],\n): string | undefined {\n\tif (count === 0) return undefined;\n\tconst verb = count === 1 ? singularVerb : pluralVerb;\n\tconst idsText = ids.length > 0 ? ` ${boundedIds(ids, count)}` : \"\";\n\treturn `${count} ${noun(count, singularNoun)} ${verb}${idsText}`;\n}\n\nfunction fallbackBackgroundActivitySummary(kind: \"agent\" | \"task\"): BackgroundActivitySummary {\n\tconst singularNoun = kind === \"agent\" ? \"agent\" : \"background task\";\n\treturn {\n\t\ttext: `Background ${singularNoun} activity unavailable`,\n\t\tstatus: \"warning\",\n\t};\n}\n\nfunction recordSummaryItems(\n\tkind: \"agent\" | \"task\",\n\trecords: readonly Record<string, unknown>[],\n): BackgroundActivitySummaryItem[] | undefined {\n\tconst items: BackgroundActivitySummaryItem[] = [];\n\tfor (const record of records) {\n\t\tconst id = kind === \"agent\" ? record.laneId : record.taskId;\n\t\tif (typeof id !== \"string\" || id.length === 0 || typeof record.status !== \"string\") return undefined;\n\t\tif (kind === \"agent\") {\n\t\t\tconst claimNeedsReview = isPlainRecord(record.claim) && record.claim.parentReviewRequired === true;\n\t\t\tconst status =\n\t\t\t\trecord.status === \"failed\" || record.status === \"timeout\" || record.status === \"budget_exhausted\"\n\t\t\t\t\t? \"failed\"\n\t\t\t\t\t: record.status === \"canceled\"\n\t\t\t\t\t\t? \"canceled\"\n\t\t\t\t\t\t: claimNeedsReview || record.status === \"partial\" || record.status === \"blocked\"\n\t\t\t\t\t\t\t? \"attention\"\n\t\t\t\t\t\t\t: record.status === \"succeeded\"\n\t\t\t\t\t\t\t\t? \"success\"\n\t\t\t\t\t\t\t\t: undefined;\n\t\t\tif (!status) return undefined;\n\t\t\titems.push({ id, status });\n\t\t\tcontinue;\n\t\t}\n\t\tif (record.status !== \"completed\" && record.status !== \"failed\" && record.status !== \"canceled\") return undefined;\n\t\titems.push({\n\t\t\tid,\n\t\t\tstatus: record.status === \"failed\" ? \"failed\" : record.status === \"canceled\" ? \"canceled\" : \"success\",\n\t\t});\n\t}\n\treturn items;\n}\n\nfunction readSummaryContract(\n\tmessage: CustomMessage<unknown>,\n\tkind: \"agent\" | \"task\",\n\titems: readonly BackgroundActivitySummaryItem[] | undefined,\n): BackgroundActivitySummaryContract | undefined {\n\tif (isPlainRecord(message.details) && isBackgroundActivitySummaryContract(message.details.summary)) {\n\t\tconst summary = message.details.summary;\n\t\tif (summary.kind !== kind || !items || summary.totalCount < items.length) return undefined;\n\t\tconst includedCounts = {\n\t\t\tsuccess: items.filter((item) => item.status === \"success\").length,\n\t\t\tattention: items.filter((item) => item.status === \"attention\").length,\n\t\t\tfailed: items.filter((item) => item.status === \"failed\").length,\n\t\t\tcanceled: items.filter((item) => item.status === \"canceled\").length,\n\t\t};\n\t\tconst successCount = summary.totalCount - summary.attentionCount - summary.failedCount - summary.canceledCount;\n\t\tif (\n\t\t\tsuccessCount < includedCounts.success ||\n\t\t\tsummary.attentionCount < includedCounts.attention ||\n\t\t\tsummary.failedCount < includedCounts.failed ||\n\t\t\tsummary.canceledCount < includedCounts.canceled\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn summary;\n\t}\n\treturn items && items.length > 0 ? createBackgroundActivitySummaryContract(kind, items) : undefined;\n}\n\nfunction formatBackgroundActivitySummary(message: CustomMessage<unknown>): BackgroundActivitySummary | undefined {\n\tconst supervisionSummary = formatSupervisionActivitySummary(message);\n\tif (supervisionSummary) return supervisionSummary;\n\tconst kind =\n\t\tmessage.customType === \"background-worker-completion\"\n\t\t\t? \"agent\"\n\t\t\t: message.customType === \"background-tool-completion\"\n\t\t\t\t? \"task\"\n\t\t\t\t: undefined;\n\tif (!kind) return undefined;\n\tif (!isPlainRecord(message.details) || !Array.isArray(message.details.records))\n\t\treturn fallbackBackgroundActivitySummary(kind);\n\tif (message.details.records.some((record) => !isPlainRecord(record))) return fallbackBackgroundActivitySummary(kind);\n\tconst records = message.details.records as Record<string, unknown>[];\n\tconst items = recordSummaryItems(kind, records);\n\tconst summary = readSummaryContract(message, kind, items);\n\tif (!summary || !items) return fallbackBackgroundActivitySummary(kind);\n\tconst nounName = kind === \"agent\" ? \"agent\" : \"background task\";\n\tconst successIds = items.filter((item) => item.status === \"success\").map((item) => item.id);\n\tconst attentionIds = items.filter((item) => item.status === \"attention\").map((item) => item.id);\n\tconst failedIds = items.filter((item) => item.status === \"failed\").map((item) => item.id);\n\tconst canceledIds = items.filter((item) => item.status === \"canceled\").map((item) => item.id);\n\tconst successCount = summary.totalCount - summary.attentionCount - summary.failedCount - summary.canceledCount;\n\tconst text = [\n\t\tformatCountedStatus(successCount, nounName, \"succeeded\", \"succeeded\", successIds),\n\t\tformatCountedStatus(summary.attentionCount, nounName, \"needs verification\", \"need verification\", attentionIds),\n\t\tformatCountedStatus(summary.failedCount, nounName, \"failed\", \"failed\", failedIds),\n\t\tformatCountedStatus(summary.canceledCount, nounName, \"canceled\", \"canceled\", canceledIds),\n\t]\n\t\t.filter((part): part is string => part !== undefined)\n\t\t.join(\" | \");\n\treturn {\n\t\ttext,\n\t\tstatus:\n\t\t\tsummary.failedCount > 0 ? \"error\" : summary.attentionCount + summary.canceledCount > 0 ? \"warning\" : \"success\",\n\t};\n}\n\n/**\n * Supervision is durable model input, but its raw lifecycle prose is not a second TUI renderer.\n * Keep it in the session/custom-message stream for the model and transcript overlay while the\n * foreground history uses the same one-line activity projection as background completions.\n */\nfunction formatSupervisionActivitySummary(message: CustomMessage<unknown>): BackgroundActivitySummary | undefined {\n\tif (message.customType === \"worktree-sync-notice\") {\n\t\treturn { text: \"Worktree sync activity\", status: \"warning\" };\n\t}\n\tif (message.customType === \"process-matrix-notice\") {\n\t\treturn { text: \"Process supervision activity\", status: \"warning\" };\n\t}\n\treturn undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/settings-selector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BA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nC,YAAY,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EAynB/D;IAED,eAAe,IAAI,YAAY,CAE9B;CACD"}
|
|
@@ -538,8 +538,8 @@ class AutonomySettingsSubmenu extends SettingsListSubmenu {
|
|
|
538
538
|
},
|
|
539
539
|
{
|
|
540
540
|
id: "autonomy-max-stall-turns",
|
|
541
|
-
label: "Goal
|
|
542
|
-
description: "
|
|
541
|
+
label: "Goal recovery threshold",
|
|
542
|
+
description: "Unchanged rounds before Pi must inspect failure evidence and switch approach without stopping",
|
|
543
543
|
currentValue: autonomyMaxStallTurnsValue(this.state),
|
|
544
544
|
values: AUTONOMY_MAX_STALL_TURN_VALUES,
|
|
545
545
|
},
|