pi-subagents 0.68.0 → 0.70.0
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 +62 -1
- package/agents/reviewer.md +3 -2
- package/docs/agents.md +10 -2
- package/docs/configuration.md +1 -1
- package/docs/extension-api.md +1 -1
- package/docs/models.md +3 -1
- package/docs/observability.md +6 -0
- package/docs/tool-reference.md +23 -2
- package/docs/watchdog.md +2 -0
- package/docs/workflows.md +54 -2
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +10 -0
- package/index.js.map +1 -0
- package/package.json +89 -73
- package/runner-peer-loader.mjs +4 -7
- package/runner-peer-preload.mjs +5 -7
- package/skills/pi-subagents/references/execution-controls.md +3 -1
- package/skills/pi-subagents/references/prompting-and-roles.md +2 -2
- package/src/agents/advertised-agent-prompt.d.ts +8 -0
- package/src/agents/advertised-agent-prompt.d.ts.map +1 -0
- package/src/agents/advertised-agent-prompt.js +77 -0
- package/src/agents/advertised-agent-prompt.js.map +1 -0
- package/src/agents/agent-management.d.ts +27 -0
- package/src/agents/agent-management.d.ts.map +1 -0
- package/src/agents/agent-management.js +1528 -0
- package/src/agents/agent-management.js.map +1 -0
- package/src/agents/agent-memory.d.ts +49 -0
- package/src/agents/agent-memory.d.ts.map +1 -0
- package/src/agents/agent-memory.js +349 -0
- package/src/agents/agent-memory.js.map +1 -0
- package/src/agents/agent-refinements.d.ts +100 -0
- package/src/agents/agent-refinements.d.ts.map +1 -0
- package/src/agents/agent-refinements.js +569 -0
- package/src/agents/agent-refinements.js.map +1 -0
- package/src/agents/agent-scope.d.ts +3 -0
- package/src/agents/agent-scope.d.ts.map +1 -0
- package/src/agents/agent-scope.js +6 -0
- package/src/agents/agent-scope.js.map +1 -0
- package/src/agents/agent-selection.d.ts +3 -0
- package/src/agents/agent-selection.d.ts.map +1 -0
- package/src/agents/agent-selection.js +23 -0
- package/src/agents/agent-selection.js.map +1 -0
- package/src/agents/agent-serializer.d.ts +8 -0
- package/src/agents/agent-serializer.d.ts.map +1 -0
- package/src/agents/agent-serializer.js +200 -0
- package/src/agents/agent-serializer.js.map +1 -0
- package/src/agents/agents.d.ts +313 -0
- package/src/agents/agents.d.ts.map +1 -0
- package/src/agents/agents.js +2622 -0
- package/src/agents/agents.js.map +1 -0
- package/src/agents/builtin-names.d.ts +2 -0
- package/src/agents/builtin-names.d.ts.map +1 -0
- package/src/agents/builtin-names.js +17 -0
- package/src/agents/builtin-names.js.map +1 -0
- package/src/agents/chain-serializer.d.ts +7 -0
- package/src/agents/chain-serializer.d.ts.map +1 -0
- package/src/agents/chain-serializer.js +319 -0
- package/src/agents/chain-serializer.js.map +1 -0
- package/src/agents/frontmatter.d.ts +16 -0
- package/src/agents/frontmatter.d.ts.map +1 -0
- package/src/agents/frontmatter.js +142 -0
- package/src/agents/frontmatter.js.map +1 -0
- package/src/agents/identity.d.ts +8 -0
- package/src/agents/identity.d.ts.map +1 -0
- package/src/agents/identity.js +30 -0
- package/src/agents/identity.js.map +1 -0
- package/src/agents/proactive-skills.d.ts +35 -0
- package/src/agents/proactive-skills.d.ts.map +1 -0
- package/src/agents/proactive-skills.js +154 -0
- package/src/agents/proactive-skills.js.map +1 -0
- package/src/agents/runtime-agent-events.d.ts +27 -0
- package/src/agents/runtime-agent-events.d.ts.map +1 -0
- package/src/agents/runtime-agent-events.js +53 -0
- package/src/agents/runtime-agent-events.js.map +1 -0
- package/src/agents/runtime-agent-registry.d.ts +59 -0
- package/src/agents/runtime-agent-registry.d.ts.map +1 -0
- package/src/agents/runtime-agent-registry.js +390 -0
- package/src/agents/runtime-agent-registry.js.map +1 -0
- package/src/agents/skills.d.ts +33 -0
- package/src/agents/skills.d.ts.map +1 -0
- package/src/agents/skills.js +685 -0
- package/src/agents/skills.js.map +1 -0
- package/src/api/agents.d.ts +5 -0
- package/src/api/agents.d.ts.map +1 -0
- package/src/api/agents.js +3 -0
- package/src/api/agents.js.map +1 -0
- package/src/api/background-work.d.ts +39 -0
- package/src/api/background-work.d.ts.map +1 -0
- package/src/api/background-work.js +165 -0
- package/src/api/background-work.js.map +1 -0
- package/src/api/capability-ceiling.d.ts +2 -0
- package/src/api/capability-ceiling.d.ts.map +1 -0
- package/src/api/capability-ceiling.js +2 -0
- package/src/api/capability-ceiling.js.map +1 -0
- package/src/api/child-tool-plan.d.ts +2 -0
- package/src/api/child-tool-plan.d.ts.map +1 -0
- package/src/api/child-tool-plan.js +2 -0
- package/src/api/child-tool-plan.js.map +1 -0
- package/src/api/control-channel.d.ts +2 -0
- package/src/api/control-channel.d.ts.map +1 -0
- package/src/api/control-channel.js +2 -0
- package/src/api/control-channel.js.map +1 -0
- package/src/api/delegation.d.ts +99 -0
- package/src/api/delegation.d.ts.map +1 -0
- package/src/api/delegation.js +9 -0
- package/src/api/delegation.js.map +1 -0
- package/src/api/external-job-provider.d.ts +58 -0
- package/src/api/external-job-provider.d.ts.map +1 -0
- package/src/api/external-job-provider.js +140 -0
- package/src/api/external-job-provider.js.map +1 -0
- package/src/api/external-runs.d.ts +48 -0
- package/src/api/external-runs.d.ts.map +1 -0
- package/src/api/external-runs.js +245 -0
- package/src/api/external-runs.js.map +1 -0
- package/src/api/intercom-bridge.d.ts +2 -0
- package/src/api/intercom-bridge.d.ts.map +1 -0
- package/src/api/intercom-bridge.js +2 -0
- package/src/api/intercom-bridge.js.map +1 -0
- package/src/api/preflight.d.ts +173 -0
- package/src/api/preflight.d.ts.map +1 -0
- package/src/api/preflight.js +362 -0
- package/src/api/preflight.js.map +1 -0
- package/src/api/project-panes.d.ts +8 -0
- package/src/api/project-panes.d.ts.map +1 -0
- package/src/api/project-panes.js +8 -0
- package/src/api/project-panes.js.map +1 -0
- package/src/api/required-child-extensions.d.ts +2 -0
- package/src/api/required-child-extensions.d.ts.map +1 -0
- package/src/api/required-child-extensions.js +2 -0
- package/src/api/required-child-extensions.js.map +1 -0
- package/src/api/shared-types.d.ts +2 -0
- package/src/api/shared-types.d.ts.map +1 -0
- package/src/api/shared-types.js +2 -0
- package/src/api/shared-types.js.map +1 -0
- package/src/api/workflow-resources.d.ts +3 -0
- package/src/api/workflow-resources.d.ts.map +1 -0
- package/src/api/workflow-resources.js +2 -0
- package/src/api/workflow-resources.js.map +1 -0
- package/src/extension/config.d.ts +8 -0
- package/src/extension/config.d.ts.map +1 -0
- package/src/extension/config.js +245 -0
- package/src/extension/config.js.map +1 -0
- package/src/extension/control-notices.d.ts +19 -0
- package/src/extension/control-notices.d.ts.map +1 -0
- package/src/extension/control-notices.js +34 -0
- package/src/extension/control-notices.js.map +1 -0
- package/src/extension/doctor.d.ts +33 -0
- package/src/extension/doctor.d.ts.map +1 -0
- package/src/extension/doctor.js +231 -0
- package/src/extension/doctor.js.map +1 -0
- package/src/extension/fanout-child.d.ts +7 -0
- package/src/extension/fanout-child.d.ts.map +1 -0
- package/src/extension/fanout-child.js +261 -0
- package/src/extension/fanout-child.js.map +1 -0
- package/src/extension/herdr-pi-bridge.d.ts +17 -0
- package/src/extension/herdr-pi-bridge.d.ts.map +1 -0
- package/src/extension/herdr-pi-bridge.js +243 -0
- package/src/extension/herdr-pi-bridge.js.map +1 -0
- package/src/extension/index.d.ts +20 -0
- package/src/extension/index.d.ts.map +1 -0
- package/src/extension/index.js +1108 -0
- package/src/extension/index.js.map +1 -0
- package/src/extension/public-execution.d.ts +62 -0
- package/src/extension/public-execution.d.ts.map +1 -0
- package/src/extension/public-execution.js +174 -0
- package/src/extension/public-execution.js.map +1 -0
- package/src/extension/rpc.d.ts +83 -0
- package/src/extension/rpc.d.ts.map +1 -0
- package/src/extension/rpc.js +687 -0
- package/src/extension/rpc.js.map +1 -0
- package/src/extension/schemas.d.ts +252 -0
- package/src/extension/schemas.d.ts.map +1 -0
- package/src/extension/schemas.js +396 -0
- package/src/extension/schemas.js.map +1 -0
- package/src/extension/steering-notices.d.ts +15 -0
- package/src/extension/steering-notices.d.ts.map +1 -0
- package/src/extension/steering-notices.js +23 -0
- package/src/extension/steering-notices.js.map +1 -0
- package/src/extension/subagent-guide.d.ts +4 -0
- package/src/extension/subagent-guide.d.ts.map +1 -0
- package/src/extension/subagent-guide.js +35 -0
- package/src/extension/subagent-guide.js.map +1 -0
- package/src/extension/tool-description.d.ts +20 -0
- package/src/extension/tool-description.d.ts.map +1 -0
- package/src/extension/tool-description.js +160 -0
- package/src/extension/tool-description.js.map +1 -0
- package/src/extension/tool-result.d.ts +10 -0
- package/src/extension/tool-result.d.ts.map +1 -0
- package/src/extension/tool-result.js +17 -0
- package/src/extension/tool-result.js.map +1 -0
- package/src/inspectors/actions.d.ts +23 -0
- package/src/inspectors/actions.d.ts.map +1 -0
- package/src/inspectors/actions.js +155 -0
- package/src/inspectors/actions.js.map +1 -0
- package/src/inspectors/ghostty/actions.d.ts +12 -0
- package/src/inspectors/ghostty/actions.d.ts.map +1 -0
- package/src/inspectors/ghostty/actions.js +63 -0
- package/src/inspectors/ghostty/actions.js.map +1 -0
- package/src/inspectors/ghostty/plugin.d.ts +8 -0
- package/src/inspectors/ghostty/plugin.d.ts.map +1 -0
- package/src/inspectors/ghostty/plugin.js +24 -0
- package/src/inspectors/ghostty/plugin.js.map +1 -0
- package/src/inspectors/herdr/actions.d.ts +26 -0
- package/src/inspectors/herdr/actions.d.ts.map +1 -0
- package/src/inspectors/herdr/actions.js +134 -0
- package/src/inspectors/herdr/actions.js.map +1 -0
- package/src/inspectors/herdr/client.d.ts +42 -0
- package/src/inspectors/herdr/client.d.ts.map +1 -0
- package/src/inspectors/herdr/client.js +130 -0
- package/src/inspectors/herdr/client.js.map +1 -0
- package/src/inspectors/herdr/focus.d.ts +25 -0
- package/src/inspectors/herdr/focus.d.ts.map +1 -0
- package/src/inspectors/herdr/focus.js +50 -0
- package/src/inspectors/herdr/focus.js.map +1 -0
- package/src/inspectors/herdr/plugin.d.ts +7 -0
- package/src/inspectors/herdr/plugin.d.ts.map +1 -0
- package/src/inspectors/herdr/plugin.js +15 -0
- package/src/inspectors/herdr/plugin.js.map +1 -0
- package/src/inspectors/herdr/project-panes.d.ts +137 -0
- package/src/inspectors/herdr/project-panes.d.ts.map +1 -0
- package/src/inspectors/herdr/project-panes.js +608 -0
- package/src/inspectors/herdr/project-panes.js.map +1 -0
- package/src/inspectors/inspector-runner.d.ts +24 -0
- package/src/inspectors/inspector-runner.d.ts.map +1 -0
- package/src/inspectors/inspector-runner.js +162 -0
- package/src/inspectors/inspector-runner.js.map +1 -0
- package/src/inspectors/plugins.d.ts +4 -0
- package/src/inspectors/plugins.d.ts.map +1 -0
- package/src/inspectors/plugins.js +7 -0
- package/src/inspectors/plugins.js.map +1 -0
- package/src/inspectors/session-roots-codec.d.ts +16 -0
- package/src/inspectors/session-roots-codec.d.ts.map +1 -0
- package/src/inspectors/session-roots-codec.js +33 -0
- package/src/inspectors/session-roots-codec.js.map +1 -0
- package/src/inspectors/shell-command.d.ts +2 -0
- package/src/inspectors/shell-command.d.ts.map +1 -0
- package/src/inspectors/shell-command.js +17 -0
- package/src/inspectors/shell-command.js.map +1 -0
- package/src/inspectors/types.d.ts +49 -0
- package/src/inspectors/types.d.ts.map +1 -0
- package/src/inspectors/types.js +2 -0
- package/src/inspectors/types.js.map +1 -0
- package/src/integrations/herdr-status.d.ts +46 -0
- package/src/integrations/herdr-status.d.ts.map +1 -0
- package/src/integrations/herdr-status.js +371 -0
- package/src/integrations/herdr-status.js.map +1 -0
- package/src/integrations/pi-web-session-liveness.d.ts +20 -0
- package/src/integrations/pi-web-session-liveness.d.ts.map +1 -0
- package/src/integrations/pi-web-session-liveness.js +54 -0
- package/src/integrations/pi-web-session-liveness.js.map +1 -0
- package/src/intercom/intercom-bridge.d.ts +59 -0
- package/src/intercom/intercom-bridge.d.ts.map +1 -0
- package/src/intercom/intercom-bridge.js +192 -0
- package/src/intercom/intercom-bridge.js.map +1 -0
- package/src/intercom/native-supervisor-channel.d.ts +64 -0
- package/src/intercom/native-supervisor-channel.d.ts.map +1 -0
- package/src/intercom/native-supervisor-channel.js +894 -0
- package/src/intercom/native-supervisor-channel.js.map +1 -0
- package/src/intercom/result-intercom.d.ts +36 -0
- package/src/intercom/result-intercom.d.ts.map +1 -0
- package/src/intercom/result-intercom.js +372 -0
- package/src/intercom/result-intercom.js.map +1 -0
- package/src/intercom/supervisor-ui.d.ts +40 -0
- package/src/intercom/supervisor-ui.d.ts.map +1 -0
- package/src/intercom/supervisor-ui.js +202 -0
- package/src/intercom/supervisor-ui.js.map +1 -0
- package/src/missions/actions.d.ts +55 -0
- package/src/missions/actions.d.ts.map +1 -0
- package/src/missions/actions.js +396 -0
- package/src/missions/actions.js.map +1 -0
- package/src/missions/goal-driver.d.ts +16 -0
- package/src/missions/goal-driver.d.ts.map +1 -0
- package/src/missions/goal-driver.js +157 -0
- package/src/missions/goal-driver.js.map +1 -0
- package/src/missions/lifecycle.d.ts +40 -0
- package/src/missions/lifecycle.d.ts.map +1 -0
- package/src/missions/lifecycle.js +352 -0
- package/src/missions/lifecycle.js.map +1 -0
- package/src/missions/store.d.ts +22 -0
- package/src/missions/store.d.ts.map +1 -0
- package/src/missions/store.js +573 -0
- package/src/missions/store.js.map +1 -0
- package/src/missions/types.d.ts +168 -0
- package/src/missions/types.d.ts.map +1 -0
- package/src/missions/types.js +10 -0
- package/src/missions/types.js.map +1 -0
- package/src/missions/workflow-state.d.ts +15 -0
- package/src/missions/workflow-state.d.ts.map +1 -0
- package/src/missions/workflow-state.js +274 -0
- package/src/missions/workflow-state.js.map +1 -0
- package/src/policy/authority.d.ts +10 -0
- package/src/policy/authority.d.ts.map +1 -0
- package/src/policy/authority.js +42 -0
- package/src/policy/authority.js.map +1 -0
- package/src/profiles/profiles.d.ts +135 -0
- package/src/profiles/profiles.d.ts.map +1 -0
- package/src/profiles/profiles.js +520 -0
- package/src/profiles/profiles.js.map +1 -0
- package/src/runs/background/active-async-capacity.d.ts +100 -0
- package/src/runs/background/active-async-capacity.d.ts.map +1 -0
- package/src/runs/background/active-async-capacity.js +492 -0
- package/src/runs/background/active-async-capacity.js.map +1 -0
- package/src/runs/background/active-run-index.d.ts +13 -0
- package/src/runs/background/active-run-index.d.ts.map +1 -0
- package/src/runs/background/active-run-index.js +158 -0
- package/src/runs/background/active-run-index.js.map +1 -0
- package/src/runs/background/async-execution.d.ts +274 -0
- package/src/runs/background/async-execution.d.ts.map +1 -0
- package/src/runs/background/async-execution.js +1989 -0
- package/src/runs/background/async-execution.js.map +1 -0
- package/src/runs/background/async-job-tracker.d.ts +28 -0
- package/src/runs/background/async-job-tracker.d.ts.map +1 -0
- package/src/runs/background/async-job-tracker.js +876 -0
- package/src/runs/background/async-job-tracker.js.map +1 -0
- package/src/runs/background/async-resume.d.ts +59 -0
- package/src/runs/background/async-resume.d.ts.map +1 -0
- package/src/runs/background/async-resume.js +670 -0
- package/src/runs/background/async-resume.js.map +1 -0
- package/src/runs/background/async-retention.d.ts +45 -0
- package/src/runs/background/async-retention.d.ts.map +1 -0
- package/src/runs/background/async-retention.js +884 -0
- package/src/runs/background/async-retention.js.map +1 -0
- package/src/runs/background/async-status-snapshot.d.ts +10 -0
- package/src/runs/background/async-status-snapshot.d.ts.map +1 -0
- package/src/runs/background/async-status-snapshot.js +25 -0
- package/src/runs/background/async-status-snapshot.js.map +1 -0
- package/src/runs/background/async-status.d.ts +169 -0
- package/src/runs/background/async-status.d.ts.map +1 -0
- package/src/runs/background/async-status.js +673 -0
- package/src/runs/background/async-status.js.map +1 -0
- package/src/runs/background/auto-drain.d.ts +17 -0
- package/src/runs/background/auto-drain.d.ts.map +1 -0
- package/src/runs/background/auto-drain.js +73 -0
- package/src/runs/background/auto-drain.js.map +1 -0
- package/src/runs/background/binary-bootstrap.d.ts +9 -0
- package/src/runs/background/binary-bootstrap.d.ts.map +1 -0
- package/src/runs/background/binary-bootstrap.js +41 -0
- package/src/runs/background/binary-bootstrap.js.map +1 -0
- package/src/runs/background/chain-append.d.ts +35 -0
- package/src/runs/background/chain-append.d.ts.map +1 -0
- package/src/runs/background/chain-append.js +300 -0
- package/src/runs/background/chain-append.js.map +1 -0
- package/src/runs/background/chain-root-attachment.d.ts +49 -0
- package/src/runs/background/chain-root-attachment.d.ts.map +1 -0
- package/src/runs/background/chain-root-attachment.js +184 -0
- package/src/runs/background/chain-root-attachment.js.map +1 -0
- package/src/runs/background/completion-batcher.d.ts +52 -0
- package/src/runs/background/completion-batcher.d.ts.map +1 -0
- package/src/runs/background/completion-batcher.js +120 -0
- package/src/runs/background/completion-batcher.js.map +1 -0
- package/src/runs/background/completion-dedupe.d.ts +14 -0
- package/src/runs/background/completion-dedupe.d.ts.map +1 -0
- package/src/runs/background/completion-dedupe.js +49 -0
- package/src/runs/background/completion-dedupe.js.map +1 -0
- package/src/runs/background/completion-replay.d.ts +48 -0
- package/src/runs/background/completion-replay.d.ts.map +1 -0
- package/src/runs/background/completion-replay.js +267 -0
- package/src/runs/background/completion-replay.js.map +1 -0
- package/src/runs/background/control-channel.d.ts +156 -0
- package/src/runs/background/control-channel.d.ts.map +1 -0
- package/src/runs/background/control-channel.js +521 -0
- package/src/runs/background/control-channel.js.map +1 -0
- package/src/runs/background/fleet-view.d.ts +64 -0
- package/src/runs/background/fleet-view.d.ts.map +1 -0
- package/src/runs/background/fleet-view.js +648 -0
- package/src/runs/background/fleet-view.js.map +1 -0
- package/src/runs/background/index-segment.d.ts +16 -0
- package/src/runs/background/index-segment.d.ts.map +1 -0
- package/src/runs/background/index-segment.js +59 -0
- package/src/runs/background/index-segment.js.map +1 -0
- package/src/runs/background/inspect-rpc.d.ts +60 -0
- package/src/runs/background/inspect-rpc.d.ts.map +1 -0
- package/src/runs/background/inspect-rpc.js +406 -0
- package/src/runs/background/inspect-rpc.js.map +1 -0
- package/src/runs/background/notify.d.ts +162 -0
- package/src/runs/background/notify.d.ts.map +1 -0
- package/src/runs/background/notify.js +665 -0
- package/src/runs/background/notify.js.map +1 -0
- package/src/runs/background/owned-process-tree.d.ts +11 -0
- package/src/runs/background/owned-process-tree.d.ts.map +1 -0
- package/src/runs/background/owned-process-tree.js +117 -0
- package/src/runs/background/owned-process-tree.js.map +1 -0
- package/src/runs/background/parallel-groups.d.ts +4 -0
- package/src/runs/background/parallel-groups.d.ts.map +1 -0
- package/src/runs/background/parallel-groups.js +47 -0
- package/src/runs/background/parallel-groups.js.map +1 -0
- package/src/runs/background/process-terminal.d.ts +34 -0
- package/src/runs/background/process-terminal.d.ts.map +1 -0
- package/src/runs/background/process-terminal.js +305 -0
- package/src/runs/background/process-terminal.js.map +1 -0
- package/src/runs/background/result-delivery-ownership.d.ts +11 -0
- package/src/runs/background/result-delivery-ownership.d.ts.map +1 -0
- package/src/runs/background/result-delivery-ownership.js +37 -0
- package/src/runs/background/result-delivery-ownership.js.map +1 -0
- package/src/runs/background/result-files.d.ts +33 -0
- package/src/runs/background/result-files.d.ts.map +1 -0
- package/src/runs/background/result-files.js +528 -0
- package/src/runs/background/result-files.js.map +1 -0
- package/src/runs/background/result-watcher.d.ts +87 -0
- package/src/runs/background/result-watcher.d.ts.map +1 -0
- package/src/runs/background/result-watcher.js +764 -0
- package/src/runs/background/result-watcher.js.map +1 -0
- package/src/runs/background/resume-guidance.d.ts +5 -0
- package/src/runs/background/resume-guidance.d.ts.map +1 -0
- package/src/runs/background/resume-guidance.js +57 -0
- package/src/runs/background/resume-guidance.js.map +1 -0
- package/src/runs/background/retained-children.d.ts +25 -0
- package/src/runs/background/retained-children.d.ts.map +1 -0
- package/src/runs/background/retained-children.js +128 -0
- package/src/runs/background/retained-children.js.map +1 -0
- package/src/runs/background/retained-nested-route-tracker.d.ts +13 -0
- package/src/runs/background/retained-nested-route-tracker.d.ts.map +1 -0
- package/src/runs/background/retained-nested-route-tracker.js +91 -0
- package/src/runs/background/retained-nested-route-tracker.js.map +1 -0
- package/src/runs/background/run-child-session.d.ts +123 -0
- package/src/runs/background/run-child-session.d.ts.map +1 -0
- package/src/runs/background/run-child-session.js +602 -0
- package/src/runs/background/run-child-session.js.map +1 -0
- package/src/runs/background/run-id-query.d.ts +4 -0
- package/src/runs/background/run-id-query.d.ts.map +1 -0
- package/src/runs/background/run-id-query.js +7 -0
- package/src/runs/background/run-id-query.js.map +1 -0
- package/src/runs/background/run-id-resolver.d.ts +23 -0
- package/src/runs/background/run-id-resolver.d.ts.map +1 -0
- package/src/runs/background/run-id-resolver.js +170 -0
- package/src/runs/background/run-id-resolver.js.map +1 -0
- package/src/runs/background/run-status.d.ts +26 -0
- package/src/runs/background/run-status.d.ts.map +1 -0
- package/src/runs/background/run-status.js +826 -0
- package/src/runs/background/run-status.js.map +1 -0
- package/src/runs/background/runner-aliases.d.ts +17 -0
- package/src/runs/background/runner-aliases.d.ts.map +1 -0
- package/src/runs/background/runner-aliases.js +141 -0
- package/src/runs/background/runner-aliases.js.map +1 -0
- package/src/runs/background/runner-child-launch.d.ts +24 -0
- package/src/runs/background/runner-child-launch.d.ts.map +1 -0
- package/src/runs/background/runner-child-launch.js +68 -0
- package/src/runs/background/runner-child-launch.js.map +1 -0
- package/src/runs/background/runner-child-sessions.d.ts +7 -0
- package/src/runs/background/runner-child-sessions.d.ts.map +1 -0
- package/src/runs/background/runner-child-sessions.js +35 -0
- package/src/runs/background/runner-child-sessions.js.map +1 -0
- package/src/runs/background/runner-http-dispatcher.d.ts +43 -0
- package/src/runs/background/runner-http-dispatcher.d.ts.map +1 -0
- package/src/runs/background/runner-http-dispatcher.js +114 -0
- package/src/runs/background/runner-http-dispatcher.js.map +1 -0
- package/src/runs/background/scheduled-runs.d.ts +116 -0
- package/src/runs/background/scheduled-runs.d.ts.map +1 -0
- package/src/runs/background/scheduled-runs.js +1024 -0
- package/src/runs/background/scheduled-runs.js.map +1 -0
- package/src/runs/background/stale-run-reconciler.d.ts +37 -0
- package/src/runs/background/stale-run-reconciler.d.ts.map +1 -0
- package/src/runs/background/stale-run-reconciler.js +393 -0
- package/src/runs/background/stale-run-reconciler.js.map +1 -0
- package/src/runs/background/steering.d.ts +52 -0
- package/src/runs/background/steering.d.ts.map +1 -0
- package/src/runs/background/steering.js +247 -0
- package/src/runs/background/steering.js.map +1 -0
- package/src/runs/background/subagent-runner.d.ts +201 -0
- package/src/runs/background/subagent-runner.d.ts.map +1 -0
- package/src/runs/background/subagent-runner.js +5134 -0
- package/src/runs/background/subagent-runner.js.map +1 -0
- package/src/runs/background/subagent-wait.d.ts +122 -0
- package/src/runs/background/subagent-wait.d.ts.map +1 -0
- package/src/runs/background/subagent-wait.js +735 -0
- package/src/runs/background/subagent-wait.js.map +1 -0
- package/src/runs/background/terminal-run-index.d.ts +8 -0
- package/src/runs/background/terminal-run-index.d.ts.map +1 -0
- package/src/runs/background/terminal-run-index.js +123 -0
- package/src/runs/background/terminal-run-index.js.map +1 -0
- package/src/runs/background/top-level-async.d.ts +8 -0
- package/src/runs/background/top-level-async.d.ts.map +1 -0
- package/src/runs/background/top-level-async.js +6 -0
- package/src/runs/background/top-level-async.js.map +1 -0
- package/src/runs/background/wait-completions.d.ts +29 -0
- package/src/runs/background/wait-completions.d.ts.map +1 -0
- package/src/runs/background/wait-completions.js +264 -0
- package/src/runs/background/wait-completions.js.map +1 -0
- package/src/runs/background/wait-config.d.ts +9 -0
- package/src/runs/background/wait-config.d.ts.map +1 -0
- package/src/runs/background/wait-config.js +47 -0
- package/src/runs/background/wait-config.js.map +1 -0
- package/src/runs/background/wait-subscriptions.d.ts +27 -0
- package/src/runs/background/wait-subscriptions.d.ts.map +1 -0
- package/src/runs/background/wait-subscriptions.js +337 -0
- package/src/runs/background/wait-subscriptions.js.map +1 -0
- package/src/runs/background/wait-tool.d.ts +7 -0
- package/src/runs/background/wait-tool.d.ts.map +1 -0
- package/src/runs/background/wait-tool.js +36 -0
- package/src/runs/background/wait-tool.js.map +1 -0
- package/src/runs/foreground/async-dismiss-action.d.ts +7 -0
- package/src/runs/foreground/async-dismiss-action.d.ts.map +1 -0
- package/src/runs/foreground/async-dismiss-action.js +82 -0
- package/src/runs/foreground/async-dismiss-action.js.map +1 -0
- package/src/runs/foreground/async-steering-action.d.ts +32 -0
- package/src/runs/foreground/async-steering-action.d.ts.map +1 -0
- package/src/runs/foreground/async-steering-action.js +270 -0
- package/src/runs/foreground/async-steering-action.js.map +1 -0
- package/src/runs/foreground/async-stop-action.d.ts +7 -0
- package/src/runs/foreground/async-stop-action.d.ts.map +1 -0
- package/src/runs/foreground/async-stop-action.js +171 -0
- package/src/runs/foreground/async-stop-action.js.map +1 -0
- package/src/runs/foreground/execution.d.ts +11 -0
- package/src/runs/foreground/execution.d.ts.map +1 -0
- package/src/runs/foreground/execution.js +2186 -0
- package/src/runs/foreground/execution.js.map +1 -0
- package/src/runs/foreground/foreground-control.d.ts +25 -0
- package/src/runs/foreground/foreground-control.d.ts.map +1 -0
- package/src/runs/foreground/foreground-control.js +139 -0
- package/src/runs/foreground/foreground-control.js.map +1 -0
- package/src/runs/foreground/foreground-history.d.ts +12 -0
- package/src/runs/foreground/foreground-history.d.ts.map +1 -0
- package/src/runs/foreground/foreground-history.js +165 -0
- package/src/runs/foreground/foreground-history.js.map +1 -0
- package/src/runs/foreground/prompt-audit.d.ts +33 -0
- package/src/runs/foreground/prompt-audit.d.ts.map +1 -0
- package/src/runs/foreground/prompt-audit.js +143 -0
- package/src/runs/foreground/prompt-audit.js.map +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +296 -0
- package/src/runs/foreground/subagent-executor.d.ts.map +1 -0
- package/src/runs/foreground/subagent-executor.js +7047 -0
- package/src/runs/foreground/subagent-executor.js.map +1 -0
- package/src/runs/foreground/workflow-detach-reconcile.d.ts +16 -0
- package/src/runs/foreground/workflow-detach-reconcile.d.ts.map +1 -0
- package/src/runs/foreground/workflow-detach-reconcile.js +284 -0
- package/src/runs/foreground/workflow-detach-reconcile.js.map +1 -0
- package/src/runs/foreground/workflow-foreground-steering.d.ts +44 -0
- package/src/runs/foreground/workflow-foreground-steering.d.ts.map +1 -0
- package/src/runs/foreground/workflow-foreground-steering.js +149 -0
- package/src/runs/foreground/workflow-foreground-steering.js.map +1 -0
- package/src/runs/shared/abort-recovery.d.ts +27 -0
- package/src/runs/shared/abort-recovery.d.ts.map +1 -0
- package/src/runs/shared/abort-recovery.js +109 -0
- package/src/runs/shared/abort-recovery.js.map +1 -0
- package/src/runs/shared/acceptance.d.ts +145 -0
- package/src/runs/shared/acceptance.d.ts.map +1 -0
- package/src/runs/shared/acceptance.js +1650 -0
- package/src/runs/shared/acceptance.js.map +1 -0
- package/src/runs/shared/agent-contract.d.ts +6 -0
- package/src/runs/shared/agent-contract.d.ts.map +1 -0
- package/src/runs/shared/agent-contract.js +36 -0
- package/src/runs/shared/agent-contract.js.map +1 -0
- package/src/runs/shared/async-status-projection.d.ts +94 -0
- package/src/runs/shared/async-status-projection.d.ts.map +1 -0
- package/src/runs/shared/async-status-projection.js +542 -0
- package/src/runs/shared/async-status-projection.js.map +1 -0
- package/src/runs/shared/background-process-options.d.ts +5 -0
- package/src/runs/shared/background-process-options.d.ts.map +1 -0
- package/src/runs/shared/background-process-options.js +7 -0
- package/src/runs/shared/background-process-options.js.map +1 -0
- package/src/runs/shared/capability-ceiling.d.ts +58 -0
- package/src/runs/shared/capability-ceiling.d.ts.map +1 -0
- package/src/runs/shared/capability-ceiling.js +179 -0
- package/src/runs/shared/capability-ceiling.js.map +1 -0
- package/src/runs/shared/chain-outputs.d.ts +19 -0
- package/src/runs/shared/chain-outputs.d.ts.map +1 -0
- package/src/runs/shared/chain-outputs.js +105 -0
- package/src/runs/shared/chain-outputs.js.map +1 -0
- package/src/runs/shared/child-hooks.d.ts +34 -0
- package/src/runs/shared/child-hooks.d.ts.map +1 -0
- package/src/runs/shared/child-hooks.js +188 -0
- package/src/runs/shared/child-hooks.js.map +1 -0
- package/src/runs/shared/child-identity.d.ts +24 -0
- package/src/runs/shared/child-identity.d.ts.map +1 -0
- package/src/runs/shared/child-identity.js +41 -0
- package/src/runs/shared/child-identity.js.map +1 -0
- package/src/runs/shared/child-launch-plan.d.ts +71 -0
- package/src/runs/shared/child-launch-plan.d.ts.map +1 -0
- package/src/runs/shared/child-launch-plan.js +89 -0
- package/src/runs/shared/child-launch-plan.js.map +1 -0
- package/src/runs/shared/child-launch.d.ts +114 -0
- package/src/runs/shared/child-launch.d.ts.map +1 -0
- package/src/runs/shared/child-launch.js +231 -0
- package/src/runs/shared/child-launch.js.map +1 -0
- package/src/runs/shared/child-lifecycle.d.ts +14 -0
- package/src/runs/shared/child-lifecycle.d.ts.map +1 -0
- package/src/runs/shared/child-lifecycle.js +23 -0
- package/src/runs/shared/child-lifecycle.js.map +1 -0
- package/src/runs/shared/child-runtime-config.d.ts +102 -0
- package/src/runs/shared/child-runtime-config.d.ts.map +1 -0
- package/src/runs/shared/child-runtime-config.js +39 -0
- package/src/runs/shared/child-runtime-config.js.map +1 -0
- package/src/runs/shared/child-session.d.ts +155 -0
- package/src/runs/shared/child-session.d.ts.map +1 -0
- package/src/runs/shared/child-session.js +347 -0
- package/src/runs/shared/child-session.js.map +1 -0
- package/src/runs/shared/child-tool-plan.d.ts +73 -0
- package/src/runs/shared/child-tool-plan.d.ts.map +1 -0
- package/src/runs/shared/child-tool-plan.js +380 -0
- package/src/runs/shared/child-tool-plan.js.map +1 -0
- package/src/runs/shared/claude-code-adapter.d.ts +25 -0
- package/src/runs/shared/claude-code-adapter.d.ts.map +1 -0
- package/src/runs/shared/claude-code-adapter.js +120 -0
- package/src/runs/shared/claude-code-adapter.js.map +1 -0
- package/src/runs/shared/codex-exec-adapter.d.ts +26 -0
- package/src/runs/shared/codex-exec-adapter.d.ts.map +1 -0
- package/src/runs/shared/codex-exec-adapter.js +128 -0
- package/src/runs/shared/codex-exec-adapter.js.map +1 -0
- package/src/runs/shared/completion-evidence.d.ts +31 -0
- package/src/runs/shared/completion-evidence.d.ts.map +1 -0
- package/src/runs/shared/completion-evidence.js +54 -0
- package/src/runs/shared/completion-evidence.js.map +1 -0
- package/src/runs/shared/completion-guard.d.ts +35 -0
- package/src/runs/shared/completion-guard.d.ts.map +1 -0
- package/src/runs/shared/completion-guard.js +214 -0
- package/src/runs/shared/completion-guard.js.map +1 -0
- package/src/runs/shared/context-mode.d.ts +13 -0
- package/src/runs/shared/context-mode.d.ts.map +1 -0
- package/src/runs/shared/context-mode.js +39 -0
- package/src/runs/shared/context-mode.js.map +1 -0
- package/src/runs/shared/cursor-agent-adapter.d.ts +27 -0
- package/src/runs/shared/cursor-agent-adapter.d.ts.map +1 -0
- package/src/runs/shared/cursor-agent-adapter.js +100 -0
- package/src/runs/shared/cursor-agent-adapter.js.map +1 -0
- package/src/runs/shared/dynamic-fanout.d.ts +50 -0
- package/src/runs/shared/dynamic-fanout.d.ts.map +1 -0
- package/src/runs/shared/dynamic-fanout.js +274 -0
- package/src/runs/shared/dynamic-fanout.js.map +1 -0
- package/src/runs/shared/effective-system-prompt.d.ts +18 -0
- package/src/runs/shared/effective-system-prompt.d.ts.map +1 -0
- package/src/runs/shared/effective-system-prompt.js +23 -0
- package/src/runs/shared/effective-system-prompt.js.map +1 -0
- package/src/runs/shared/extension-bindings.d.ts +17 -0
- package/src/runs/shared/extension-bindings.d.ts.map +1 -0
- package/src/runs/shared/extension-bindings.js +83 -0
- package/src/runs/shared/extension-bindings.js.map +1 -0
- package/src/runs/shared/external-cli-contract.d.ts +30 -0
- package/src/runs/shared/external-cli-contract.d.ts.map +1 -0
- package/src/runs/shared/external-cli-contract.js +146 -0
- package/src/runs/shared/external-cli-contract.js.map +1 -0
- package/src/runs/shared/external-cli-preflight.d.ts +32 -0
- package/src/runs/shared/external-cli-preflight.d.ts.map +1 -0
- package/src/runs/shared/external-cli-preflight.js +116 -0
- package/src/runs/shared/external-cli-preflight.js.map +1 -0
- package/src/runs/shared/external-cli-runner.d.ts +66 -0
- package/src/runs/shared/external-cli-runner.d.ts.map +1 -0
- package/src/runs/shared/external-cli-runner.js +421 -0
- package/src/runs/shared/external-cli-runner.js.map +1 -0
- package/src/runs/shared/external-job-bridge.d.ts +18 -0
- package/src/runs/shared/external-job-bridge.d.ts.map +1 -0
- package/src/runs/shared/external-job-bridge.js +424 -0
- package/src/runs/shared/external-job-bridge.js.map +1 -0
- package/src/runs/shared/external-job-runner.d.ts +45 -0
- package/src/runs/shared/external-job-runner.d.ts.map +1 -0
- package/src/runs/shared/external-job-runner.js +353 -0
- package/src/runs/shared/external-job-runner.js.map +1 -0
- package/src/runs/shared/fast-mode-extension.d.ts +4 -0
- package/src/runs/shared/fast-mode-extension.d.ts.map +1 -0
- package/src/runs/shared/fast-mode-extension.js +9 -0
- package/src/runs/shared/fast-mode-extension.js.map +1 -0
- package/src/runs/shared/herdr-connection.d.ts +71 -0
- package/src/runs/shared/herdr-connection.d.ts.map +1 -0
- package/src/runs/shared/herdr-connection.js +258 -0
- package/src/runs/shared/herdr-connection.js.map +1 -0
- package/src/runs/shared/herdr-external-adapters.d.ts +148 -0
- package/src/runs/shared/herdr-external-adapters.d.ts.map +1 -0
- package/src/runs/shared/herdr-external-adapters.js +405 -0
- package/src/runs/shared/herdr-external-adapters.js.map +1 -0
- package/src/runs/shared/herdr-machine.d.ts +48 -0
- package/src/runs/shared/herdr-machine.d.ts.map +1 -0
- package/src/runs/shared/herdr-machine.js +247 -0
- package/src/runs/shared/herdr-machine.js.map +1 -0
- package/src/runs/shared/herdr-pi-protocol.d.ts +22 -0
- package/src/runs/shared/herdr-pi-protocol.d.ts.map +1 -0
- package/src/runs/shared/herdr-pi-protocol.js +58 -0
- package/src/runs/shared/herdr-pi-protocol.js.map +1 -0
- package/src/runs/shared/herdr-placed-run.d.ts +267 -0
- package/src/runs/shared/herdr-placed-run.d.ts.map +1 -0
- package/src/runs/shared/herdr-placed-run.js +716 -0
- package/src/runs/shared/herdr-placed-run.js.map +1 -0
- package/src/runs/shared/host-step-status.d.ts +34 -0
- package/src/runs/shared/host-step-status.d.ts.map +1 -0
- package/src/runs/shared/host-step-status.js +245 -0
- package/src/runs/shared/host-step-status.js.map +1 -0
- package/src/runs/shared/lane-metadata.d.ts +24 -0
- package/src/runs/shared/lane-metadata.d.ts.map +1 -0
- package/src/runs/shared/lane-metadata.js +127 -0
- package/src/runs/shared/lane-metadata.js.map +1 -0
- package/src/runs/shared/launch-cwd.d.ts +2 -0
- package/src/runs/shared/launch-cwd.d.ts.map +1 -0
- package/src/runs/shared/launch-cwd.js +17 -0
- package/src/runs/shared/launch-cwd.js.map +1 -0
- package/src/runs/shared/llm-intent-arbiter.d.ts +48 -0
- package/src/runs/shared/llm-intent-arbiter.d.ts.map +1 -0
- package/src/runs/shared/llm-intent-arbiter.js +235 -0
- package/src/runs/shared/llm-intent-arbiter.js.map +1 -0
- package/src/runs/shared/long-running-guard.d.ts +33 -0
- package/src/runs/shared/long-running-guard.d.ts.map +1 -0
- package/src/runs/shared/long-running-guard.js +199 -0
- package/src/runs/shared/long-running-guard.js.map +1 -0
- package/src/runs/shared/mcp-config-sources.d.ts +30 -0
- package/src/runs/shared/mcp-config-sources.d.ts.map +1 -0
- package/src/runs/shared/mcp-config-sources.js +419 -0
- package/src/runs/shared/mcp-config-sources.js.map +1 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +59 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts.map +1 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.js +400 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.js.map +1 -0
- package/src/runs/shared/mcp-direct-tool-grant.d.ts +41 -0
- package/src/runs/shared/mcp-direct-tool-grant.d.ts.map +1 -0
- package/src/runs/shared/mcp-direct-tool-grant.js +146 -0
- package/src/runs/shared/mcp-direct-tool-grant.js.map +1 -0
- package/src/runs/shared/model-resolution-diagnostic.d.ts +22 -0
- package/src/runs/shared/model-resolution-diagnostic.d.ts.map +1 -0
- package/src/runs/shared/model-resolution-diagnostic.js +65 -0
- package/src/runs/shared/model-resolution-diagnostic.js.map +1 -0
- package/src/runs/shared/model-resolution.d.ts +92 -0
- package/src/runs/shared/model-resolution.d.ts.map +1 -0
- package/src/runs/shared/model-resolution.js +343 -0
- package/src/runs/shared/model-resolution.js.map +1 -0
- package/src/runs/shared/model-scope.d.ts +68 -0
- package/src/runs/shared/model-scope.d.ts.map +1 -0
- package/src/runs/shared/model-scope.js +156 -0
- package/src/runs/shared/model-scope.js.map +1 -0
- package/src/runs/shared/mutation-evidence.d.ts +19 -0
- package/src/runs/shared/mutation-evidence.d.ts.map +1 -0
- package/src/runs/shared/mutation-evidence.js +199 -0
- package/src/runs/shared/mutation-evidence.js.map +1 -0
- package/src/runs/shared/nested-events.d.ts +134 -0
- package/src/runs/shared/nested-events.d.ts.map +1 -0
- package/src/runs/shared/nested-events.js +1056 -0
- package/src/runs/shared/nested-events.js.map +1 -0
- package/src/runs/shared/nested-path.d.ts +9 -0
- package/src/runs/shared/nested-path.d.ts.map +1 -0
- package/src/runs/shared/nested-path.js +35 -0
- package/src/runs/shared/nested-path.js.map +1 -0
- package/src/runs/shared/nested-render.d.ts +21 -0
- package/src/runs/shared/nested-render.d.ts.map +1 -0
- package/src/runs/shared/nested-render.js +116 -0
- package/src/runs/shared/nested-render.js.map +1 -0
- package/src/runs/shared/orca-progress-tabs.d.ts +33 -0
- package/src/runs/shared/orca-progress-tabs.d.ts.map +1 -0
- package/src/runs/shared/orca-progress-tabs.js +527 -0
- package/src/runs/shared/orca-progress-tabs.js.map +1 -0
- package/src/runs/shared/parallel-handoff.d.ts +73 -0
- package/src/runs/shared/parallel-handoff.d.ts.map +1 -0
- package/src/runs/shared/parallel-handoff.js +733 -0
- package/src/runs/shared/parallel-handoff.js.map +1 -0
- package/src/runs/shared/parallel-utils.d.ts +165 -0
- package/src/runs/shared/parallel-utils.d.ts.map +1 -0
- package/src/runs/shared/parallel-utils.js +126 -0
- package/src/runs/shared/parallel-utils.js.map +1 -0
- package/src/runs/shared/permissions.d.ts +13 -0
- package/src/runs/shared/permissions.d.ts.map +1 -0
- package/src/runs/shared/permissions.js +93 -0
- package/src/runs/shared/permissions.js.map +1 -0
- package/src/runs/shared/pi-spawn.d.ts +28 -0
- package/src/runs/shared/pi-spawn.d.ts.map +1 -0
- package/src/runs/shared/pi-spawn.js +156 -0
- package/src/runs/shared/pi-spawn.js.map +1 -0
- package/src/runs/shared/process-signal.d.ts +16 -0
- package/src/runs/shared/process-signal.d.ts.map +1 -0
- package/src/runs/shared/process-signal.js +22 -0
- package/src/runs/shared/process-signal.js.map +1 -0
- package/src/runs/shared/readonly-drain-observation.d.ts +26 -0
- package/src/runs/shared/readonly-drain-observation.d.ts.map +1 -0
- package/src/runs/shared/readonly-drain-observation.js +51 -0
- package/src/runs/shared/readonly-drain-observation.js.map +1 -0
- package/src/runs/shared/run-fanout-budget.d.ts +15 -0
- package/src/runs/shared/run-fanout-budget.d.ts.map +1 -0
- package/src/runs/shared/run-fanout-budget.js +259 -0
- package/src/runs/shared/run-fanout-budget.js.map +1 -0
- package/src/runs/shared/run-history.d.ts +20 -0
- package/src/runs/shared/run-history.d.ts.map +1 -0
- package/src/runs/shared/run-history.js +200 -0
- package/src/runs/shared/run-history.js.map +1 -0
- package/src/runs/shared/runtime-acknowledged-extensions.d.ts +8 -0
- package/src/runs/shared/runtime-acknowledged-extensions.d.ts.map +1 -0
- package/src/runs/shared/runtime-acknowledged-extensions.js +45 -0
- package/src/runs/shared/runtime-acknowledged-extensions.js.map +1 -0
- package/src/runs/shared/session-lease.d.ts +70 -0
- package/src/runs/shared/session-lease.d.ts.map +1 -0
- package/src/runs/shared/session-lease.js +251 -0
- package/src/runs/shared/session-lease.js.map +1 -0
- package/src/runs/shared/single-output.d.ts +61 -0
- package/src/runs/shared/single-output.d.ts.map +1 -0
- package/src/runs/shared/single-output.js +263 -0
- package/src/runs/shared/single-output.js.map +1 -0
- package/src/runs/shared/spawn-budget.d.ts +21 -0
- package/src/runs/shared/spawn-budget.d.ts.map +1 -0
- package/src/runs/shared/spawn-budget.js +94 -0
- package/src/runs/shared/spawn-budget.js.map +1 -0
- package/src/runs/shared/structured-output.d.ts +57 -0
- package/src/runs/shared/structured-output.d.ts.map +1 -0
- package/src/runs/shared/structured-output.js +391 -0
- package/src/runs/shared/structured-output.js.map +1 -0
- package/src/runs/shared/subagent-control.d.ts +50 -0
- package/src/runs/shared/subagent-control.d.ts.map +1 -0
- package/src/runs/shared/subagent-control.js +247 -0
- package/src/runs/shared/subagent-control.js.map +1 -0
- package/src/runs/shared/subagent-prompt-runtime.d.ts +28 -0
- package/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -0
- package/src/runs/shared/subagent-prompt-runtime.js +548 -0
- package/src/runs/shared/subagent-prompt-runtime.js.map +1 -0
- package/src/runs/shared/task-intent.d.ts +38 -0
- package/src/runs/shared/task-intent.d.ts.map +1 -0
- package/src/runs/shared/task-intent.js +213 -0
- package/src/runs/shared/task-intent.js.map +1 -0
- package/src/runs/shared/tool-availability.d.ts +17 -0
- package/src/runs/shared/tool-availability.d.ts.map +1 -0
- package/src/runs/shared/tool-availability.js +30 -0
- package/src/runs/shared/tool-availability.js.map +1 -0
- package/src/runs/shared/tool-budget.d.ts +22 -0
- package/src/runs/shared/tool-budget.d.ts.map +1 -0
- package/src/runs/shared/tool-budget.js +79 -0
- package/src/runs/shared/tool-budget.js.map +1 -0
- package/src/runs/shared/tool-timeout.d.ts +32 -0
- package/src/runs/shared/tool-timeout.d.ts.map +1 -0
- package/src/runs/shared/tool-timeout.js +74 -0
- package/src/runs/shared/tool-timeout.js.map +1 -0
- package/src/runs/shared/usage-budget.d.ts +8 -0
- package/src/runs/shared/usage-budget.d.ts.map +1 -0
- package/src/runs/shared/usage-budget.js +75 -0
- package/src/runs/shared/usage-budget.js.map +1 -0
- package/src/runs/shared/usage-reconciliation.d.ts +9 -0
- package/src/runs/shared/usage-reconciliation.d.ts.map +1 -0
- package/src/runs/shared/usage-reconciliation.js +72 -0
- package/src/runs/shared/usage-reconciliation.js.map +1 -0
- package/src/runs/shared/workflow-async-child-guidance.d.ts +4 -0
- package/src/runs/shared/workflow-async-child-guidance.d.ts.map +1 -0
- package/src/runs/shared/workflow-async-child-guidance.js +18 -0
- package/src/runs/shared/workflow-async-child-guidance.js.map +1 -0
- package/src/runs/shared/workflow-graph.d.ts +32 -0
- package/src/runs/shared/workflow-graph.d.ts.map +1 -0
- package/src/runs/shared/workflow-graph.js +222 -0
- package/src/runs/shared/workflow-graph.js.map +1 -0
- package/src/runs/shared/worktree-cleanup-plan.d.ts +78 -0
- package/src/runs/shared/worktree-cleanup-plan.d.ts.map +1 -0
- package/src/runs/shared/worktree-cleanup-plan.js +782 -0
- package/src/runs/shared/worktree-cleanup-plan.js.map +1 -0
- package/src/runs/shared/worktree-setup-command.d.ts +39 -0
- package/src/runs/shared/worktree-setup-command.d.ts.map +1 -0
- package/src/runs/shared/worktree-setup-command.js +201 -0
- package/src/runs/shared/worktree-setup-command.js.map +1 -0
- package/src/runs/shared/worktree.d.ts +179 -0
- package/src/runs/shared/worktree.d.ts.map +1 -0
- package/src/runs/shared/worktree.js +1333 -0
- package/src/runs/shared/worktree.js.map +1 -0
- package/src/shared/accessible-dir.d.ts +12 -0
- package/src/shared/accessible-dir.d.ts.map +1 -0
- package/src/shared/accessible-dir.js +37 -0
- package/src/shared/accessible-dir.js.map +1 -0
- package/src/shared/agent-stream-options.d.ts +6 -0
- package/src/shared/agent-stream-options.d.ts.map +1 -0
- package/src/shared/agent-stream-options.js +4 -0
- package/src/shared/agent-stream-options.js.map +1 -0
- package/src/shared/artifacts.d.ts +23 -0
- package/src/shared/artifacts.d.ts.map +1 -0
- package/src/shared/artifacts.js +273 -0
- package/src/shared/artifacts.js.map +1 -0
- package/src/shared/atomic-json.d.ts +19 -0
- package/src/shared/atomic-json.d.ts.map +1 -0
- package/src/shared/atomic-json.js +60 -0
- package/src/shared/atomic-json.js.map +1 -0
- package/src/shared/capacity-resilient-json.d.ts +27 -0
- package/src/shared/capacity-resilient-json.d.ts.map +1 -0
- package/src/shared/capacity-resilient-json.js +87 -0
- package/src/shared/capacity-resilient-json.js.map +1 -0
- package/src/shared/child-cache-retention.d.ts +30 -0
- package/src/shared/child-cache-retention.d.ts.map +1 -0
- package/src/shared/child-cache-retention.js +41 -0
- package/src/shared/child-cache-retention.js.map +1 -0
- package/src/shared/child-session-name.d.ts +9 -0
- package/src/shared/child-session-name.d.ts.map +1 -0
- package/src/shared/child-session-name.js +39 -0
- package/src/shared/child-session-name.js.map +1 -0
- package/src/shared/child-transcript.d.ts +38 -0
- package/src/shared/child-transcript.d.ts.map +1 -0
- package/src/shared/child-transcript.js +226 -0
- package/src/shared/child-transcript.js.map +1 -0
- package/src/shared/completion-owner.d.ts +3 -0
- package/src/shared/completion-owner.d.ts.map +1 -0
- package/src/shared/completion-owner.js +9 -0
- package/src/shared/completion-owner.js.map +1 -0
- package/src/shared/display-text.d.ts +6 -0
- package/src/shared/display-text.d.ts.map +1 -0
- package/src/shared/display-text.js +155 -0
- package/src/shared/display-text.js.map +1 -0
- package/src/shared/extension-context.d.ts +6 -0
- package/src/shared/extension-context.d.ts.map +1 -0
- package/src/shared/extension-context.js +22 -0
- package/src/shared/extension-context.js.map +1 -0
- package/src/shared/file-coalescer.d.ts +12 -0
- package/src/shared/file-coalescer.d.ts.map +1 -0
- package/src/shared/file-coalescer.js +35 -0
- package/src/shared/file-coalescer.js.map +1 -0
- package/src/shared/file-system-retry.d.ts +32 -0
- package/src/shared/file-system-retry.d.ts.map +1 -0
- package/src/shared/file-system-retry.js +85 -0
- package/src/shared/file-system-retry.js.map +1 -0
- package/src/shared/fork-context.d.ts +59 -0
- package/src/shared/fork-context.d.ts.map +1 -0
- package/src/shared/fork-context.js +171 -0
- package/src/shared/fork-context.js.map +1 -0
- package/src/shared/fork-session-cwd.d.ts +3 -0
- package/src/shared/fork-session-cwd.d.ts.map +1 -0
- package/src/shared/fork-session-cwd.js +24 -0
- package/src/shared/fork-session-cwd.js.map +1 -0
- package/src/shared/formatters.d.ts +36 -0
- package/src/shared/formatters.d.ts.map +1 -0
- package/src/shared/formatters.js +143 -0
- package/src/shared/formatters.js.map +1 -0
- package/src/shared/jsonl-writer.d.ts +21 -0
- package/src/shared/jsonl-writer.d.ts.map +1 -0
- package/src/shared/jsonl-writer.js +68 -0
- package/src/shared/jsonl-writer.js.map +1 -0
- package/src/shared/launch-contract.d.ts +64 -0
- package/src/shared/launch-contract.d.ts.map +1 -0
- package/src/shared/launch-contract.js +141 -0
- package/src/shared/launch-contract.js.map +1 -0
- package/src/shared/model-info.d.ts +44 -0
- package/src/shared/model-info.d.ts.map +1 -0
- package/src/shared/model-info.js +73 -0
- package/src/shared/model-info.js.map +1 -0
- package/src/shared/model-response-aliases.d.ts +2 -0
- package/src/shared/model-response-aliases.d.ts.map +1 -0
- package/src/shared/model-response-aliases.js +16 -0
- package/src/shared/model-response-aliases.js.map +1 -0
- package/src/shared/node-executable.d.ts +2 -0
- package/src/shared/node-executable.d.ts.map +1 -0
- package/src/shared/node-executable.js +21 -0
- package/src/shared/node-executable.js.map +1 -0
- package/src/shared/opencode-session-headers.d.ts +13 -0
- package/src/shared/opencode-session-headers.d.ts.map +1 -0
- package/src/shared/opencode-session-headers.js +27 -0
- package/src/shared/opencode-session-headers.js.map +1 -0
- package/src/shared/prompt-resources.d.ts +6 -0
- package/src/shared/prompt-resources.d.ts.map +1 -0
- package/src/shared/prompt-resources.js +11 -0
- package/src/shared/prompt-resources.js.map +1 -0
- package/src/shared/pruned-fork.d.ts +35 -0
- package/src/shared/pruned-fork.d.ts.map +1 -0
- package/src/shared/pruned-fork.js +424 -0
- package/src/shared/pruned-fork.js.map +1 -0
- package/src/shared/required-child-extensions.d.ts +20 -0
- package/src/shared/required-child-extensions.d.ts.map +1 -0
- package/src/shared/required-child-extensions.js +74 -0
- package/src/shared/required-child-extensions.js.map +1 -0
- package/src/shared/session-file-trust.d.ts +2 -0
- package/src/shared/session-file-trust.d.ts.map +1 -0
- package/src/shared/session-file-trust.js +21 -0
- package/src/shared/session-file-trust.js.map +1 -0
- package/src/shared/session-identity.d.ts +7 -0
- package/src/shared/session-identity.d.ts.map +1 -0
- package/src/shared/session-identity.js +7 -0
- package/src/shared/session-identity.js.map +1 -0
- package/src/shared/session-tokens.d.ts +3 -0
- package/src/shared/session-tokens.d.ts.map +1 -0
- package/src/shared/session-tokens.js +59 -0
- package/src/shared/session-tokens.js.map +1 -0
- package/src/shared/settings.d.ts +147 -0
- package/src/shared/settings.d.ts.map +1 -0
- package/src/shared/settings.js +248 -0
- package/src/shared/settings.js.map +1 -0
- package/src/shared/shortcuts.d.ts +2 -0
- package/src/shared/shortcuts.d.ts.map +1 -0
- package/src/shared/shortcuts.js +18 -0
- package/src/shared/shortcuts.js.map +1 -0
- package/src/shared/status-format.d.ts +10 -0
- package/src/shared/status-format.d.ts.map +1 -0
- package/src/shared/status-format.js +61 -0
- package/src/shared/status-format.js.map +1 -0
- package/src/shared/thinking-ceiling.d.ts +14 -0
- package/src/shared/thinking-ceiling.d.ts.map +1 -0
- package/src/shared/thinking-ceiling.js +38 -0
- package/src/shared/thinking-ceiling.js.map +1 -0
- package/src/shared/types.d.ts +2667 -0
- package/src/shared/types.d.ts.map +1 -0
- package/src/shared/types.js +265 -0
- package/src/shared/types.js.map +1 -0
- package/src/shared/utf8.d.ts +6 -0
- package/src/shared/utf8.d.ts.map +1 -0
- package/src/shared/utf8.js +13 -0
- package/src/shared/utf8.js.map +1 -0
- package/src/shared/utils.d.ts +71 -0
- package/src/shared/utils.d.ts.map +1 -0
- package/src/shared/utils.js +593 -0
- package/src/shared/utils.js.map +1 -0
- package/src/shared/watch-strategy.d.ts +3 -0
- package/src/shared/watch-strategy.d.ts.map +1 -0
- package/src/shared/watch-strategy.js +6 -0
- package/src/shared/watch-strategy.js.map +1 -0
- package/src/shared/workflow-child-permit.d.ts +59 -0
- package/src/shared/workflow-child-permit.d.ts.map +1 -0
- package/src/shared/workflow-child-permit.js +160 -0
- package/src/shared/workflow-child-permit.js.map +1 -0
- package/src/slash/delegation-adapters.d.ts +147 -0
- package/src/slash/delegation-adapters.d.ts.map +1 -0
- package/src/slash/delegation-adapters.js +293 -0
- package/src/slash/delegation-adapters.js.map +1 -0
- package/src/slash/delegation-json.d.ts +11 -0
- package/src/slash/delegation-json.d.ts.map +1 -0
- package/src/slash/delegation-json.js +118 -0
- package/src/slash/delegation-json.js.map +1 -0
- package/src/slash/delegation-request.d.ts +13 -0
- package/src/slash/delegation-request.d.ts.map +1 -0
- package/src/slash/delegation-request.js +175 -0
- package/src/slash/delegation-request.js.map +1 -0
- package/src/slash/prompt-template-bridge.d.ts +27 -0
- package/src/slash/prompt-template-bridge.d.ts.map +1 -0
- package/src/slash/prompt-template-bridge.js +380 -0
- package/src/slash/prompt-template-bridge.js.map +1 -0
- package/src/slash/prompt-workflows.d.ts +22 -0
- package/src/slash/prompt-workflows.d.ts.map +1 -0
- package/src/slash/prompt-workflows.js +261 -0
- package/src/slash/prompt-workflows.js.map +1 -0
- package/src/slash/selector.d.ts +48 -0
- package/src/slash/selector.d.ts.map +1 -0
- package/src/slash/selector.js +118 -0
- package/src/slash/selector.js.map +1 -0
- package/src/slash/slash-bridge.d.ts +31 -0
- package/src/slash/slash-bridge.d.ts.map +1 -0
- package/src/slash/slash-bridge.js +133 -0
- package/src/slash/slash-bridge.js.map +1 -0
- package/src/slash/slash-commands.d.ts +9 -0
- package/src/slash/slash-commands.d.ts.map +1 -0
- package/src/slash/slash-commands.js +1295 -0
- package/src/slash/slash-commands.js.map +1 -0
- package/src/slash/slash-live-state.d.ts +22 -0
- package/src/slash/slash-live-state.d.ts.map +1 -0
- package/src/slash/slash-live-state.js +264 -0
- package/src/slash/slash-live-state.js.map +1 -0
- package/src/slash/subagents-admin.d.ts +3 -0
- package/src/slash/subagents-admin.d.ts.map +1 -0
- package/src/slash/subagents-admin.js +454 -0
- package/src/slash/subagents-admin.js.map +1 -0
- package/src/tui/fleet-status.d.ts +86 -0
- package/src/tui/fleet-status.d.ts.map +1 -0
- package/src/tui/fleet-status.js +1083 -0
- package/src/tui/fleet-status.js.map +1 -0
- package/src/tui/fleet-transcript.d.ts +50 -0
- package/src/tui/fleet-transcript.d.ts.map +1 -0
- package/src/tui/fleet-transcript.js +497 -0
- package/src/tui/fleet-transcript.js.map +1 -0
- package/src/tui/fleet.d.ts +169 -0
- package/src/tui/fleet.d.ts.map +1 -0
- package/src/tui/fleet.js +1412 -0
- package/src/tui/fleet.js.map +1 -0
- package/src/tui/render-helpers.d.ts +24 -0
- package/src/tui/render-helpers.d.ts.map +1 -0
- package/src/tui/render-helpers.js +101 -0
- package/src/tui/render-helpers.js.map +1 -0
- package/src/tui/render.d.ts +61 -0
- package/src/tui/render.d.ts.map +1 -0
- package/src/tui/render.js +3607 -0
- package/src/tui/render.js.map +1 -0
- package/src/watchdog/change-signature.d.ts +8 -0
- package/src/watchdog/change-signature.d.ts.map +1 -0
- package/src/watchdog/change-signature.js +246 -0
- package/src/watchdog/change-signature.js.map +1 -0
- package/src/watchdog/child-status.d.ts +54 -0
- package/src/watchdog/child-status.d.ts.map +1 -0
- package/src/watchdog/child-status.js +188 -0
- package/src/watchdog/child-status.js.map +1 -0
- package/src/watchdog/diff-tool.d.ts +23 -0
- package/src/watchdog/diff-tool.d.ts.map +1 -0
- package/src/watchdog/diff-tool.js +84 -0
- package/src/watchdog/diff-tool.js.map +1 -0
- package/src/watchdog/emission-guard.d.ts +37 -0
- package/src/watchdog/emission-guard.d.ts.map +1 -0
- package/src/watchdog/emission-guard.js +98 -0
- package/src/watchdog/emission-guard.js.map +1 -0
- package/src/watchdog/guidance.d.ts +4 -0
- package/src/watchdog/guidance.d.ts.map +1 -0
- package/src/watchdog/guidance.js +20 -0
- package/src/watchdog/guidance.js.map +1 -0
- package/src/watchdog/lsp-diagnostics.d.ts +18 -0
- package/src/watchdog/lsp-diagnostics.d.ts.map +1 -0
- package/src/watchdog/lsp-diagnostics.js +490 -0
- package/src/watchdog/lsp-diagnostics.js.map +1 -0
- package/src/watchdog/model-selection.d.ts +25 -0
- package/src/watchdog/model-selection.d.ts.map +1 -0
- package/src/watchdog/model-selection.js +168 -0
- package/src/watchdog/model-selection.js.map +1 -0
- package/src/watchdog/permission-arbiter.d.ts +21 -0
- package/src/watchdog/permission-arbiter.d.ts.map +1 -0
- package/src/watchdog/permission-arbiter.js +136 -0
- package/src/watchdog/permission-arbiter.js.map +1 -0
- package/src/watchdog/register-child.d.ts +12 -0
- package/src/watchdog/register-child.d.ts.map +1 -0
- package/src/watchdog/register-child.js +120 -0
- package/src/watchdog/register-child.js.map +1 -0
- package/src/watchdog/register-main.d.ts +10 -0
- package/src/watchdog/register-main.d.ts.map +1 -0
- package/src/watchdog/register-main.js +419 -0
- package/src/watchdog/register-main.js.map +1 -0
- package/src/watchdog/render.d.ts +12 -0
- package/src/watchdog/render.d.ts.map +1 -0
- package/src/watchdog/render.js +52 -0
- package/src/watchdog/render.js.map +1 -0
- package/src/watchdog/review.d.ts +36 -0
- package/src/watchdog/review.d.ts.map +1 -0
- package/src/watchdog/review.js +318 -0
- package/src/watchdog/review.js.map +1 -0
- package/src/watchdog/rules.d.ts +22 -0
- package/src/watchdog/rules.d.ts.map +1 -0
- package/src/watchdog/rules.js +59 -0
- package/src/watchdog/rules.js.map +1 -0
- package/src/watchdog/runtime.d.ts +196 -0
- package/src/watchdog/runtime.d.ts.map +1 -0
- package/src/watchdog/runtime.js +862 -0
- package/src/watchdog/runtime.js.map +1 -0
- package/src/watchdog/scope.d.ts +15 -0
- package/src/watchdog/scope.d.ts.map +1 -0
- package/src/watchdog/scope.js +45 -0
- package/src/watchdog/scope.js.map +1 -0
- package/src/watchdog/settings.d.ts +30 -0
- package/src/watchdog/settings.d.ts.map +1 -0
- package/src/watchdog/settings.js +476 -0
- package/src/watchdog/settings.js.map +1 -0
- package/src/watchdog/tool-actions.d.ts +18 -0
- package/src/watchdog/tool-actions.d.ts.map +1 -0
- package/src/watchdog/tool-actions.js +151 -0
- package/src/watchdog/tool-actions.js.map +1 -0
- package/src/watchdog/turn-delta.d.ts +12 -0
- package/src/watchdog/turn-delta.d.ts.map +1 -0
- package/src/watchdog/turn-delta.js +185 -0
- package/src/watchdog/turn-delta.js.map +1 -0
- package/src/watchdog/types.d.ts +142 -0
- package/src/watchdog/types.d.ts.map +1 -0
- package/src/watchdog/types.js +28 -0
- package/src/watchdog/types.js.map +1 -0
- package/src/watchdog/warning-format.d.ts +8 -0
- package/src/watchdog/warning-format.d.ts.map +1 -0
- package/src/watchdog/warning-format.js +60 -0
- package/src/watchdog/warning-format.js.map +1 -0
- package/src/workflows/chat-progress.d.ts +38 -0
- package/src/workflows/chat-progress.d.ts.map +1 -0
- package/src/workflows/chat-progress.js +130 -0
- package/src/workflows/chat-progress.js.map +1 -0
- package/src/workflows/host-command.d.ts +31 -0
- package/src/workflows/host-command.d.ts.map +1 -0
- package/src/workflows/host-command.js +228 -0
- package/src/workflows/host-command.js.map +1 -0
- package/src/workflows/scripted-workflow.d.ts +195 -0
- package/src/workflows/scripted-workflow.d.ts.map +1 -0
- package/src/workflows/scripted-workflow.js +2636 -0
- package/src/workflows/scripted-workflow.js.map +1 -0
- package/src/workflows/workflow-checklist.d.ts +124 -0
- package/src/workflows/workflow-checklist.d.ts.map +1 -0
- package/src/workflows/workflow-checklist.js +312 -0
- package/src/workflows/workflow-checklist.js.map +1 -0
- package/src/workflows/workflow-child-summary.d.ts +20 -0
- package/src/workflows/workflow-child-summary.d.ts.map +1 -0
- package/src/workflows/workflow-child-summary.js +179 -0
- package/src/workflows/workflow-child-summary.js.map +1 -0
- package/src/workflows/workflow-preflight.d.ts +59 -0
- package/src/workflows/workflow-preflight.d.ts.map +1 -0
- package/src/workflows/workflow-preflight.js +289 -0
- package/src/workflows/workflow-preflight.js.map +1 -0
- package/src/workflows/workflow-receipt.d.ts +35 -0
- package/src/workflows/workflow-receipt.d.ts.map +1 -0
- package/src/workflows/workflow-receipt.js +449 -0
- package/src/workflows/workflow-receipt.js.map +1 -0
- package/src/workflows/workflow-resources.d.ts +43 -0
- package/src/workflows/workflow-resources.d.ts.map +1 -0
- package/src/workflows/workflow-resources.js +230 -0
- package/src/workflows/workflow-resources.js.map +1 -0
- package/src/workflows/workflow-settlement.d.ts +85 -0
- package/src/workflows/workflow-settlement.d.ts.map +1 -0
- package/src/workflows/workflow-settlement.js +204 -0
- package/src/workflows/workflow-settlement.js.map +1 -0
- package/index.ts +0 -13
- package/src/agents/advertised-agent-prompt.ts +0 -94
- package/src/agents/agent-management.ts +0 -1417
- package/src/agents/agent-memory.ts +0 -254
- package/src/agents/agent-refinements.ts +0 -624
- package/src/agents/agent-scope.ts +0 -6
- package/src/agents/agent-selection.ts +0 -25
- package/src/agents/agent-serializer.ts +0 -182
- package/src/agents/agents.ts +0 -2917
- package/src/agents/builtin-names.ts +0 -16
- package/src/agents/chain-serializer.ts +0 -285
- package/src/agents/frontmatter.ts +0 -153
- package/src/agents/identity.ts +0 -30
- package/src/agents/proactive-skills.ts +0 -194
- package/src/agents/runtime-agent-events.ts +0 -70
- package/src/agents/runtime-agent-registry.ts +0 -430
- package/src/agents/skills.ts +0 -754
- package/src/api/agents.ts +0 -12
- package/src/api/background-work.ts +0 -206
- package/src/api/capability-ceiling.ts +0 -16
- package/src/api/child-tool-plan.ts +0 -5
- package/src/api/control-channel.ts +0 -4
- package/src/api/delegation.ts +0 -116
- package/src/api/external-job-provider.ts +0 -195
- package/src/api/external-runs.ts +0 -282
- package/src/api/intercom-bridge.ts +0 -3
- package/src/api/preflight.ts +0 -539
- package/src/api/project-panes.ts +0 -32
- package/src/api/required-child-extensions.ts +0 -6
- package/src/api/shared-types.ts +0 -29
- package/src/api/workflow-resources.ts +0 -6
- package/src/extension/config.ts +0 -230
- package/src/extension/control-notices.ts +0 -58
- package/src/extension/doctor.ts +0 -270
- package/src/extension/fanout-child.ts +0 -265
- package/src/extension/herdr-pi-bridge.ts +0 -160
- package/src/extension/index.ts +0 -1205
- package/src/extension/public-execution.ts +0 -225
- package/src/extension/rpc.ts +0 -848
- package/src/extension/schemas.ts +0 -422
- package/src/extension/steering-notices.ts +0 -35
- package/src/extension/subagent-guide.ts +0 -39
- package/src/extension/tool-description.ts +0 -175
- package/src/extension/tool-result.ts +0 -19
- package/src/inspectors/actions.ts +0 -148
- package/src/inspectors/ghostty/actions.ts +0 -74
- package/src/inspectors/ghostty/plugin.ts +0 -17
- package/src/inspectors/herdr/actions.ts +0 -155
- package/src/inspectors/herdr/client.ts +0 -130
- package/src/inspectors/herdr/focus.ts +0 -55
- package/src/inspectors/herdr/plugin.ts +0 -20
- package/src/inspectors/herdr/project-panes.ts +0 -730
- package/src/inspectors/inspector-runner.ts +0 -153
- package/src/inspectors/plugins.ts +0 -8
- package/src/inspectors/session-roots-codec.ts +0 -31
- package/src/inspectors/shell-command.ts +0 -16
- package/src/inspectors/types.ts +0 -51
- package/src/integrations/herdr-status.ts +0 -400
- package/src/integrations/pi-web-session-liveness.ts +0 -73
- package/src/intercom/intercom-bridge.ts +0 -233
- package/src/intercom/native-supervisor-channel.ts +0 -917
- package/src/intercom/result-intercom.ts +0 -423
- package/src/intercom/supervisor-ui.ts +0 -244
- package/src/missions/actions.ts +0 -433
- package/src/missions/goal-driver.ts +0 -164
- package/src/missions/lifecycle.ts +0 -367
- package/src/missions/store.ts +0 -584
- package/src/missions/types.ts +0 -190
- package/src/missions/workflow-state.ts +0 -281
- package/src/policy/authority.ts +0 -50
- package/src/profiles/profiles.ts +0 -668
- package/src/runs/background/active-async-capacity.ts +0 -520
- package/src/runs/background/active-run-index.ts +0 -155
- package/src/runs/background/async-execution.ts +0 -2278
- package/src/runs/background/async-job-tracker.ts +0 -826
- package/src/runs/background/async-resume.ts +0 -647
- package/src/runs/background/async-retention.ts +0 -912
- package/src/runs/background/async-status-snapshot.ts +0 -46
- package/src/runs/background/async-status.ts +0 -771
- package/src/runs/background/auto-drain.ts +0 -92
- package/src/runs/background/binary-bootstrap.ts +0 -38
- package/src/runs/background/chain-append.ts +0 -321
- package/src/runs/background/chain-root-attachment.ts +0 -259
- package/src/runs/background/completion-batcher.ts +0 -168
- package/src/runs/background/completion-dedupe.ts +0 -58
- package/src/runs/background/completion-replay.ts +0 -287
- package/src/runs/background/control-channel.ts +0 -600
- package/src/runs/background/fleet-view.ts +0 -648
- package/src/runs/background/index-segment.ts +0 -59
- package/src/runs/background/inspect-rpc.ts +0 -443
- package/src/runs/background/notify.ts +0 -819
- package/src/runs/background/owned-process-tree.ts +0 -131
- package/src/runs/background/parallel-groups.ts +0 -45
- package/src/runs/background/process-terminal.ts +0 -310
- package/src/runs/background/result-delivery-ownership.ts +0 -45
- package/src/runs/background/result-files.ts +0 -523
- package/src/runs/background/result-watcher.ts +0 -809
- package/src/runs/background/resume-guidance.ts +0 -56
- package/src/runs/background/retained-children.ts +0 -135
- package/src/runs/background/retained-nested-route-tracker.ts +0 -96
- package/src/runs/background/run-child-session.ts +0 -690
- package/src/runs/background/run-id-query.ts +0 -7
- package/src/runs/background/run-id-resolver.ts +0 -175
- package/src/runs/background/run-status.ts +0 -786
- package/src/runs/background/runner-aliases.ts +0 -142
- package/src/runs/background/runner-child-launch.ts +0 -91
- package/src/runs/background/runner-child-sessions.ts +0 -32
- package/src/runs/background/runner-http-dispatcher.ts +0 -119
- package/src/runs/background/scheduled-runs.ts +0 -1012
- package/src/runs/background/stale-run-reconciler.ts +0 -436
- package/src/runs/background/steering.ts +0 -260
- package/src/runs/background/subagent-runner.ts +0 -5341
- package/src/runs/background/subagent-wait.ts +0 -876
- package/src/runs/background/terminal-run-index.ts +0 -138
- package/src/runs/background/top-level-async.ts +0 -14
- package/src/runs/background/wait-completions.ts +0 -261
- package/src/runs/background/wait-config.ts +0 -50
- package/src/runs/background/wait-subscriptions.ts +0 -354
- package/src/runs/background/wait-tool.ts +0 -45
- package/src/runs/foreground/async-dismiss-action.ts +0 -86
- package/src/runs/foreground/async-steering-action.ts +0 -276
- package/src/runs/foreground/async-stop-action.ts +0 -176
- package/src/runs/foreground/execution.ts +0 -2231
- package/src/runs/foreground/foreground-control.ts +0 -157
- package/src/runs/foreground/foreground-history.ts +0 -163
- package/src/runs/foreground/prompt-audit.ts +0 -178
- package/src/runs/foreground/subagent-executor.ts +0 -7511
- package/src/runs/foreground/workflow-detach-reconcile.ts +0 -304
- package/src/runs/foreground/workflow-foreground-steering.ts +0 -169
- package/src/runs/shared/abort-recovery.ts +0 -119
- package/src/runs/shared/acceptance.ts +0 -1565
- package/src/runs/shared/agent-contract.ts +0 -38
- package/src/runs/shared/async-status-projection.ts +0 -659
- package/src/runs/shared/background-process-options.ts +0 -9
- package/src/runs/shared/capability-ceiling.ts +0 -211
- package/src/runs/shared/chain-outputs.ts +0 -116
- package/src/runs/shared/child-hooks.ts +0 -189
- package/src/runs/shared/child-identity.ts +0 -62
- package/src/runs/shared/child-launch-plan.ts +0 -163
- package/src/runs/shared/child-launch.ts +0 -342
- package/src/runs/shared/child-lifecycle.ts +0 -28
- package/src/runs/shared/child-runtime-config.ts +0 -133
- package/src/runs/shared/child-session.ts +0 -448
- package/src/runs/shared/child-tool-plan.ts +0 -661
- package/src/runs/shared/claude-code-adapter.ts +0 -133
- package/src/runs/shared/codex-exec-adapter.ts +0 -129
- package/src/runs/shared/completion-evidence.ts +0 -89
- package/src/runs/shared/completion-guard.ts +0 -255
- package/src/runs/shared/context-mode.ts +0 -44
- package/src/runs/shared/cursor-agent-adapter.ts +0 -114
- package/src/runs/shared/dynamic-fanout.ts +0 -297
- package/src/runs/shared/effective-system-prompt.ts +0 -33
- package/src/runs/shared/extension-bindings.ts +0 -78
- package/src/runs/shared/external-cli-contract.ts +0 -177
- package/src/runs/shared/external-cli-preflight.ts +0 -142
- package/src/runs/shared/external-cli-runner.ts +0 -431
- package/src/runs/shared/external-job-bridge.ts +0 -460
- package/src/runs/shared/external-job-runner.ts +0 -389
- package/src/runs/shared/fast-mode-extension.ts +0 -10
- package/src/runs/shared/herdr-connection.ts +0 -134
- package/src/runs/shared/herdr-external-adapters.ts +0 -169
- package/src/runs/shared/herdr-machine.ts +0 -279
- package/src/runs/shared/herdr-pi-protocol.ts +0 -59
- package/src/runs/shared/herdr-placed-run.ts +0 -263
- package/src/runs/shared/host-step-status.ts +0 -231
- package/src/runs/shared/lane-metadata.ts +0 -126
- package/src/runs/shared/launch-cwd.ts +0 -16
- package/src/runs/shared/llm-intent-arbiter.ts +0 -321
- package/src/runs/shared/long-running-guard.ts +0 -221
- package/src/runs/shared/mcp-config-sources.ts +0 -422
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +0 -484
- package/src/runs/shared/mcp-direct-tool-grant.ts +0 -194
- package/src/runs/shared/model-resolution-diagnostic.ts +0 -76
- package/src/runs/shared/model-resolution.ts +0 -441
- package/src/runs/shared/model-scope.ts +0 -205
- package/src/runs/shared/mutation-evidence.ts +0 -199
- package/src/runs/shared/nested-events.ts +0 -1079
- package/src/runs/shared/nested-path.ts +0 -38
- package/src/runs/shared/nested-render.ts +0 -127
- package/src/runs/shared/orca-progress-tabs.ts +0 -510
- package/src/runs/shared/parallel-handoff.ts +0 -741
- package/src/runs/shared/parallel-utils.ts +0 -279
- package/src/runs/shared/permissions.ts +0 -86
- package/src/runs/shared/pi-spawn.ts +0 -207
- package/src/runs/shared/process-signal.ts +0 -35
- package/src/runs/shared/readonly-drain-observation.ts +0 -42
- package/src/runs/shared/run-fanout-budget.ts +0 -267
- package/src/runs/shared/run-history.ts +0 -201
- package/src/runs/shared/runtime-acknowledged-extensions.ts +0 -44
- package/src/runs/shared/session-lease.ts +0 -293
- package/src/runs/shared/single-output.ts +0 -304
- package/src/runs/shared/spawn-budget.ts +0 -128
- package/src/runs/shared/structured-output.ts +0 -236
- package/src/runs/shared/subagent-control.ts +0 -294
- package/src/runs/shared/subagent-prompt-runtime.ts +0 -545
- package/src/runs/shared/task-intent.ts +0 -244
- package/src/runs/shared/tool-availability.ts +0 -37
- package/src/runs/shared/tool-budget.ts +0 -66
- package/src/runs/shared/tool-timeout.ts +0 -93
- package/src/runs/shared/usage-budget.ts +0 -65
- package/src/runs/shared/workflow-async-child-guidance.ts +0 -18
- package/src/runs/shared/workflow-graph.ts +0 -225
- package/src/runs/shared/worktree-cleanup-plan.ts +0 -869
- package/src/runs/shared/worktree-setup-command.ts +0 -213
- package/src/runs/shared/worktree.ts +0 -1516
- package/src/shared/accessible-dir.ts +0 -47
- package/src/shared/agent-stream-options.ts +0 -5
- package/src/shared/artifacts.ts +0 -281
- package/src/shared/atomic-json.ts +0 -83
- package/src/shared/capacity-resilient-json.ts +0 -102
- package/src/shared/child-cache-retention.ts +0 -43
- package/src/shared/child-session-name.ts +0 -46
- package/src/shared/child-transcript.ts +0 -264
- package/src/shared/completion-owner.ts +0 -14
- package/src/shared/display-text.ts +0 -150
- package/src/shared/extension-context.ts +0 -24
- package/src/shared/file-coalescer.ts +0 -49
- package/src/shared/file-system-retry.ts +0 -95
- package/src/shared/fork-context.ts +0 -236
- package/src/shared/fork-session-cwd.ts +0 -27
- package/src/shared/formatters.ts +0 -146
- package/src/shared/jsonl-writer.ts +0 -92
- package/src/shared/launch-contract.ts +0 -198
- package/src/shared/model-info.ts +0 -101
- package/src/shared/model-response-aliases.ts +0 -13
- package/src/shared/node-executable.ts +0 -21
- package/src/shared/opencode-session-headers.ts +0 -30
- package/src/shared/prompt-resources.ts +0 -11
- package/src/shared/pruned-fork.ts +0 -450
- package/src/shared/required-child-extensions.ts +0 -81
- package/src/shared/session-file-trust.ts +0 -19
- package/src/shared/session-identity.ts +0 -10
- package/src/shared/session-tokens.ts +0 -55
- package/src/shared/settings.ts +0 -412
- package/src/shared/shortcuts.ts +0 -13
- package/src/shared/status-format.ts +0 -55
- package/src/shared/thinking-ceiling.ts +0 -46
- package/src/shared/types.ts +0 -2972
- package/src/shared/utf8.ts +0 -11
- package/src/shared/utils.ts +0 -608
- package/src/shared/watch-strategy.ts +0 -12
- package/src/shared/workflow-child-permit.ts +0 -212
- package/src/slash/delegation-adapters.ts +0 -428
- package/src/slash/delegation-json.ts +0 -108
- package/src/slash/delegation-request.ts +0 -176
- package/src/slash/prompt-template-bridge.ts +0 -419
- package/src/slash/prompt-workflows.ts +0 -287
- package/src/slash/selector.ts +0 -147
- package/src/slash/slash-bridge.ts +0 -192
- package/src/slash/slash-commands.ts +0 -1325
- package/src/slash/slash-live-state.ts +0 -310
- package/src/slash/subagents-admin.ts +0 -460
- package/src/tui/fleet-status.ts +0 -1109
- package/src/tui/fleet-transcript.ts +0 -536
- package/src/tui/fleet.ts +0 -1448
- package/src/tui/render-helpers.ts +0 -111
- package/src/tui/render.ts +0 -3721
- package/src/types/pi-runtime-compat.d.ts +0 -8
- package/src/watchdog/change-signature.ts +0 -260
- package/src/watchdog/child-status.ts +0 -225
- package/src/watchdog/diff-tool.ts +0 -77
- package/src/watchdog/emission-guard.ts +0 -125
- package/src/watchdog/guidance.ts +0 -20
- package/src/watchdog/lsp-diagnostics.ts +0 -538
- package/src/watchdog/model-selection.ts +0 -187
- package/src/watchdog/permission-arbiter.ts +0 -156
- package/src/watchdog/register-child.ts +0 -128
- package/src/watchdog/register-main.ts +0 -445
- package/src/watchdog/render.ts +0 -53
- package/src/watchdog/review.ts +0 -363
- package/src/watchdog/rules.ts +0 -70
- package/src/watchdog/runtime.ts +0 -924
- package/src/watchdog/scope.ts +0 -51
- package/src/watchdog/settings.ts +0 -515
- package/src/watchdog/tool-actions.ts +0 -156
- package/src/watchdog/turn-delta.ts +0 -184
- package/src/watchdog/types.ts +0 -186
- package/src/watchdog/warning-format.ts +0 -72
- package/src/workflows/chat-progress.ts +0 -152
- package/src/workflows/host-command.ts +0 -235
- package/src/workflows/scripted-workflow.ts +0 -2553
- package/src/workflows/workflow-checklist.ts +0 -436
- package/src/workflows/workflow-child-summary.ts +0 -170
- package/src/workflows/workflow-preflight.ts +0 -297
- package/src/workflows/workflow-receipt.ts +0 -384
- package/src/workflows/workflow-resources.ts +0 -236
- package/src/workflows/workflow-settlement.ts +0 -249
|
@@ -1,1565 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
3
|
-
import { createHash } from "node:crypto";
|
|
4
|
-
import * as fs from "node:fs";
|
|
5
|
-
import * as path from "node:path";
|
|
6
|
-
import type {
|
|
7
|
-
AcceptanceConfig,
|
|
8
|
-
AcceptanceEvidenceKind,
|
|
9
|
-
AcceptanceInput,
|
|
10
|
-
AgentContract,
|
|
11
|
-
AcceptanceLedger,
|
|
12
|
-
AcceptanceLevel,
|
|
13
|
-
AcceptanceReport,
|
|
14
|
-
AcceptanceReviewGate,
|
|
15
|
-
AcceptanceRole,
|
|
16
|
-
AcceptanceRuntimeCheck,
|
|
17
|
-
AcceptanceRuntimeCheckStatus,
|
|
18
|
-
AcceptanceReviewResult,
|
|
19
|
-
AcceptanceVerifyCommand,
|
|
20
|
-
AcceptanceVerifyResult,
|
|
21
|
-
ResolvedAcceptanceConfig,
|
|
22
|
-
ResolvedAcceptanceGate,
|
|
23
|
-
SingleResult,
|
|
24
|
-
SubagentRunMode,
|
|
25
|
-
ChildWatchdogProgress,
|
|
26
|
-
} from "../../shared/types.ts";
|
|
27
|
-
import { unresolvedChildWatchdogBlockers } from "../../watchdog/child-status.ts";
|
|
28
|
-
import { isAgentContract } from "./agent-contract.ts";
|
|
29
|
-
import { classifyTaskMutationIntent, stripSeverityCompounds, taskMayMutate } from "./task-intent.ts";
|
|
30
|
-
|
|
31
|
-
const LEVEL_RANK: Record<Exclude<AcceptanceLevel, "auto">, number> = {
|
|
32
|
-
none: 0,
|
|
33
|
-
attested: 1,
|
|
34
|
-
checked: 2,
|
|
35
|
-
verified: 3,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const VALID_LEVELS = new Set<AcceptanceLevel>(["auto", "none", "attested", "checked", "verified"]);
|
|
39
|
-
const VALID_EVIDENCE_KINDS: AcceptanceEvidenceKind[] = [
|
|
40
|
-
"changed-files",
|
|
41
|
-
"tests-added",
|
|
42
|
-
"commands-run",
|
|
43
|
-
"validation-output",
|
|
44
|
-
"residual-risks",
|
|
45
|
-
"no-staged-files",
|
|
46
|
-
"diff-summary",
|
|
47
|
-
"review-findings",
|
|
48
|
-
"manual-notes",
|
|
49
|
-
];
|
|
50
|
-
const VALID_EVIDENCE = new Set<AcceptanceEvidenceKind>(VALID_EVIDENCE_KINDS);
|
|
51
|
-
const ACCEPTANCE_EVIDENCE_HELP = `Supported evidence kinds: ${VALID_EVIDENCE_KINDS.join(", ")}. Example: { level: "checked", evidence: ["commands-run", "changed-files"] }.`;
|
|
52
|
-
const ACCEPTANCE_OBJECT_EXAMPLE = "Example: { level: \"checked\", evidence: [\"commands-run\", \"changed-files\"] }.";
|
|
53
|
-
const ACCEPTANCE_CONFIG_KEYS = new Set(["level", "report", "criteria", "evidence", "verify", "review", "stopRules", "reason"]);
|
|
54
|
-
const ACCEPTANCE_GATE_KEYS = new Set(["id", "must", "evidence", "severity"]);
|
|
55
|
-
const ACCEPTANCE_VERIFY_KEYS = new Set(["id", "command", "timeoutMs", "cwd", "env", "allowFailure"]);
|
|
56
|
-
const ACCEPTANCE_REVIEW_KEYS = new Set(["agent", "focus", "required"]);
|
|
57
|
-
const EXPLICIT_REVIEWED_UNAVAILABLE = "is an achieved status, not a requestable acceptance level. For a read-only reviewer call, omit acceptance. To require independent review of a writer result, use acceptance.review.required and orchestrate the reviewer separately.";
|
|
58
|
-
|
|
59
|
-
function normalizeLevel(level: AcceptanceLevel | undefined): Exclude<AcceptanceLevel, "auto"> | "auto" {
|
|
60
|
-
return level ?? "auto";
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function unique<T>(items: T[]): T[] {
|
|
64
|
-
return [...new Set(items)];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function requiredEvidenceForLevel(level: Exclude<AcceptanceLevel, "auto">): AcceptanceEvidenceKind[] {
|
|
68
|
-
switch (level) {
|
|
69
|
-
case "none":
|
|
70
|
-
return [];
|
|
71
|
-
case "attested":
|
|
72
|
-
return ["manual-notes", "residual-risks"];
|
|
73
|
-
case "checked":
|
|
74
|
-
return ["changed-files", "tests-added", "commands-run", "residual-risks", "no-staged-files"];
|
|
75
|
-
case "verified":
|
|
76
|
-
return ["changed-files", "tests-added", "commands-run", "validation-output", "residual-risks", "no-staged-files"];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function inferLevel(input: {
|
|
81
|
-
agentName: string;
|
|
82
|
-
acceptanceRole?: AcceptanceRole;
|
|
83
|
-
task?: string;
|
|
84
|
-
mode?: SubagentRunMode;
|
|
85
|
-
async?: boolean;
|
|
86
|
-
dynamic?: boolean;
|
|
87
|
-
dynamicGroup?: boolean;
|
|
88
|
-
}): { level: Exclude<AcceptanceLevel, "auto">; reasons: string[]; criteria: string[]; evidence: AcceptanceEvidenceKind[]; review?: { agent?: string; required?: boolean } } {
|
|
89
|
-
const agent = input.agentName.toLowerCase();
|
|
90
|
-
const task = input.task?.toLowerCase() ?? "";
|
|
91
|
-
const reasons: string[] = [];
|
|
92
|
-
// Declared roles replace name heuristics, so use the full writer grammar to detect explicit mutation independently of the actual agent name.
|
|
93
|
-
const intent = classifyTaskMutationIntent(input.acceptanceRole ? "worker" : input.agentName, input.task ?? "");
|
|
94
|
-
const readOnlyTask = intent.kind === "read-only"
|
|
95
|
-
|| (intent.kind === "unknown" && /\b(?:read[- ]only|review[- ]only|no edits|without edits|inspect|summari[sz]e)\b/.test(task));
|
|
96
|
-
const rolePatchTask = input.acceptanceRole !== undefined
|
|
97
|
-
&& intent.kind !== "read-only"
|
|
98
|
-
&& !/\b(?:do not|don't|must not)\s+patch\b/.test(task)
|
|
99
|
-
&& /\bpatch\s+(?:(?:\.{0,2}[\\/])?(?:[\w.-]+[\\/])+[\w.-]+|[\w.-]+\.[a-z0-9]+\b|(?:the\s+)?parser\b)/.test(stripSeverityCompounds(task));
|
|
100
|
-
const taskMayWrite = readOnlyTask ? false : taskMayMutate(input.task ?? "") || intent.kind === "implementation" || rolePatchTask;
|
|
101
|
-
const readOnlyAgent = input.acceptanceRole === "read-only"
|
|
102
|
-
|| (input.acceptanceRole === undefined && /\b(?:reviewer|oracle|scout|researcher|analyst)\b/.test(agent));
|
|
103
|
-
const writeTask = taskMayWrite
|
|
104
|
-
|| (input.acceptanceRole === "writer" && !readOnlyTask)
|
|
105
|
-
|| (input.acceptanceRole === undefined && /\bworker\b/.test(agent) && !readOnlyTask);
|
|
106
|
-
const inferredReadOnly = readOnlyTask || ((readOnlyAgent || input.acceptanceRole === "read-only") && !taskMayWrite);
|
|
107
|
-
const roleResolvesReadOnly = input.acceptanceRole !== undefined && inferredReadOnly;
|
|
108
|
-
const dynamicResolvesReadOnly = inferredReadOnly && !writeTask;
|
|
109
|
-
const riskyKeywordPattern = /\b(?:release|migration|migrate|security|data[- ]loss|destructive|post-review|fix pass)\b/;
|
|
110
|
-
// Topic keywords cannot override classified read-only intent; unknown tasks keep their risk gate.
|
|
111
|
-
const keywordRiskReadOnly = input.acceptanceRole === undefined
|
|
112
|
-
? intent.kind === "read-only"
|
|
113
|
-
: inferredReadOnly;
|
|
114
|
-
const risky = Boolean(input.async && writeTask)
|
|
115
|
-
|| (Boolean(input.dynamic) && !roleResolvesReadOnly && !dynamicResolvesReadOnly)
|
|
116
|
-
|| (Boolean(input.dynamicGroup) && !roleResolvesReadOnly && !dynamicResolvesReadOnly)
|
|
117
|
-
|| (!keywordRiskReadOnly && riskyKeywordPattern.test(task));
|
|
118
|
-
|
|
119
|
-
if (risky) {
|
|
120
|
-
reasons.push(input.async ? "async write-capable or risky run" : "risky write-capable run");
|
|
121
|
-
if (input.dynamic || input.dynamicGroup) reasons.push("dynamic fanout context");
|
|
122
|
-
return {
|
|
123
|
-
level: "checked",
|
|
124
|
-
reasons,
|
|
125
|
-
criteria: ["Implement the requested change without widening scope", "Return evidence sufficient for an independent acceptance review"],
|
|
126
|
-
evidence: requiredEvidenceForLevel("checked"),
|
|
127
|
-
review: { agent: "reviewer", required: true },
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
if (writeTask && !readOnlyTask) {
|
|
131
|
-
reasons.push(input.acceptanceRole === "writer" && !taskMayWrite ? "declared writer acceptance role" : "write-capable worker/task");
|
|
132
|
-
return {
|
|
133
|
-
level: "checked",
|
|
134
|
-
reasons,
|
|
135
|
-
criteria: ["Implement the requested change without widening scope"],
|
|
136
|
-
evidence: requiredEvidenceForLevel("checked"),
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
if (readOnlyAgent || readOnlyTask) {
|
|
140
|
-
reasons.push(input.acceptanceRole === "read-only" && !readOnlyTask ? "declared read-only acceptance role" : readOnlyAgent ? "read-only/reviewer-style agent" : "read-only task wording");
|
|
141
|
-
return {
|
|
142
|
-
level: "none",
|
|
143
|
-
reasons,
|
|
144
|
-
criteria: ["Return concrete findings with file paths and severity when applicable"],
|
|
145
|
-
evidence: ["review-findings", "residual-risks"],
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
reasons.push("default lightweight attestation");
|
|
149
|
-
return {
|
|
150
|
-
level: "attested",
|
|
151
|
-
reasons,
|
|
152
|
-
criteria: ["Return a concise result and residual risks when applicable"],
|
|
153
|
-
evidence: ["manual-notes", "residual-risks"],
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
type AcceptanceInputNormalizationResult = { value: unknown; error?: string };
|
|
158
|
-
|
|
159
|
-
function normalizeAcceptanceValue(input: unknown, pathLabel = "acceptance"): AcceptanceInputNormalizationResult {
|
|
160
|
-
if (typeof input !== "string") return { value: input };
|
|
161
|
-
const trimmed = input.trim();
|
|
162
|
-
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return { value: input };
|
|
163
|
-
let parsed: unknown;
|
|
164
|
-
try {
|
|
165
|
-
parsed = JSON.parse(trimmed);
|
|
166
|
-
} catch (error) {
|
|
167
|
-
return {
|
|
168
|
-
value: input,
|
|
169
|
-
error: `${pathLabel} JSON string must encode a valid acceptance object: ${error instanceof Error ? error.message : String(error)}`,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
173
|
-
const kind = parsed === null ? "null" : Array.isArray(parsed) ? "an array" : typeof parsed;
|
|
174
|
-
return { value: input, error: `${pathLabel} JSON string must encode an object; got ${kind}.` };
|
|
175
|
-
}
|
|
176
|
-
return { value: parsed };
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export function normalizeAcceptanceInput(input: unknown): AcceptanceConfig {
|
|
180
|
-
const normalized = normalizeAcceptanceValue(input);
|
|
181
|
-
if (normalized.error) throw new Error(normalized.error);
|
|
182
|
-
input = normalized.value;
|
|
183
|
-
if (input === undefined || input === "auto") return { level: "auto" };
|
|
184
|
-
if (input === false) return { level: "none", reason: "disabled by deprecated false shorthand" };
|
|
185
|
-
if (typeof input === "string") return { level: input as AcceptanceConfig["level"] };
|
|
186
|
-
return { ...(input as AcceptanceConfig) };
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export type ResolvedAcceptanceReportMode = "off" | "optional" | "required";
|
|
190
|
-
|
|
191
|
-
export function resolveAcceptanceReportMode(input: unknown): ResolvedAcceptanceReportMode {
|
|
192
|
-
const normalized = normalizeAcceptanceValue(input);
|
|
193
|
-
if (normalized.error) throw new Error(normalized.error);
|
|
194
|
-
const value = normalized.value;
|
|
195
|
-
const report = value && typeof value === "object" && !Array.isArray(value) ? (value as AcceptanceConfig).report : undefined;
|
|
196
|
-
return value === false || report === "off" ? "off" : report === "on" ? "required" : "optional";
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
type GateAcceptanceNormalizationResult =
|
|
200
|
-
| { ok: true; acceptance?: AcceptanceInput }
|
|
201
|
-
| { ok: false; error: string };
|
|
202
|
-
|
|
203
|
-
export function normalizeGateAcceptance(gate: unknown, acceptance: AcceptanceInput | undefined): GateAcceptanceNormalizationResult {
|
|
204
|
-
if (gate === undefined) {
|
|
205
|
-
if (acceptance === undefined) return { ok: true };
|
|
206
|
-
const normalized = normalizeAcceptanceValue(acceptance);
|
|
207
|
-
return normalized.error ? { ok: false, error: normalized.error } : { ok: true, acceptance: normalized.value as AcceptanceInput };
|
|
208
|
-
}
|
|
209
|
-
if (typeof gate !== "string" || !gate.trim()) return { ok: false, error: "gate must be a non-empty command string." };
|
|
210
|
-
if (acceptance !== undefined && acceptance !== false) return { ok: false, error: "gate cannot be combined with acceptance; use one gate command or acceptance.verify." + describeGateAcceptanceConflict(gate, acceptance) };
|
|
211
|
-
return { ok: true, acceptance: { level: "verified", verify: [{ id: "gate", command: gate.trim() }] } };
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export function describeGateAcceptanceConflict(gate: unknown, acceptance: unknown): string {
|
|
215
|
-
const render = (value: unknown): string => {
|
|
216
|
-
let encoded: string;
|
|
217
|
-
try {
|
|
218
|
-
encoded = JSON.stringify(value) ?? String(value);
|
|
219
|
-
} catch {
|
|
220
|
-
encoded = String(value);
|
|
221
|
-
}
|
|
222
|
-
return encoded.length > 120 ? `${encoded.slice(0, 120)}...` : encoded;
|
|
223
|
-
};
|
|
224
|
-
return ` Both fields were present: gate=${render(gate)} acceptance=${render(acceptance)}.`;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function explicitAcceptanceCanDisable(explicit: AcceptanceConfig): boolean {
|
|
228
|
-
return explicit.level === "none" && typeof explicit.reason === "string" && explicit.reason.trim().length > 0;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function explicitAcceptanceRequestsPolicy(explicit: AcceptanceConfig): boolean {
|
|
232
|
-
return (explicit.level !== undefined && explicit.level !== "auto") || Object.keys(explicit).some((key) => key !== "level");
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function unsupportedEvidenceKindMessage(pathLabel: string, item: unknown): string {
|
|
236
|
-
const value = typeof item === "string" ? ` "${item}"` : "";
|
|
237
|
-
return `${pathLabel}${value} is not a supported evidence kind. ${ACCEPTANCE_EVIDENCE_HELP}`;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export function validateAcceptanceInput(input: unknown, pathLabel = "acceptance"): string[] {
|
|
241
|
-
const errors: string[] = [];
|
|
242
|
-
if (input === undefined) return errors;
|
|
243
|
-
if (input === false) return errors;
|
|
244
|
-
const normalized = normalizeAcceptanceValue(input, pathLabel);
|
|
245
|
-
if (normalized.error) return [normalized.error];
|
|
246
|
-
input = normalized.value;
|
|
247
|
-
if (typeof input === "string") {
|
|
248
|
-
if (input === "reviewed") errors.push(`${pathLabel} ${EXPLICIT_REVIEWED_UNAVAILABLE}`);
|
|
249
|
-
else if (!VALID_LEVELS.has(input as AcceptanceLevel)) errors.push(`${pathLabel} has invalid level '${input}'.`);
|
|
250
|
-
else if (input === "none") errors.push(`${pathLabel} level "none" requires a reason; use { level: "none", reason: "..." }.`);
|
|
251
|
-
else if (input === "verified") errors.push(`${pathLabel} level "verified" requires object form with at least one runtime verify command. Use level "checked" or provide a non-empty acceptance.verify array.`);
|
|
252
|
-
return errors;
|
|
253
|
-
}
|
|
254
|
-
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
255
|
-
errors.push(`${pathLabel} must be a string level, false, or an object. ${ACCEPTANCE_OBJECT_EXAMPLE}`);
|
|
256
|
-
return errors;
|
|
257
|
-
}
|
|
258
|
-
const value = input as Record<string, unknown>;
|
|
259
|
-
for (const key of Object.keys(value)) {
|
|
260
|
-
if (!ACCEPTANCE_CONFIG_KEYS.has(key)) errors.push(`${pathLabel}.${key} is not supported.`);
|
|
261
|
-
}
|
|
262
|
-
if (value.level === "reviewed") {
|
|
263
|
-
errors.push(`${pathLabel}.level ${EXPLICIT_REVIEWED_UNAVAILABLE}`);
|
|
264
|
-
} else if (value.level !== undefined && (typeof value.level !== "string" || !VALID_LEVELS.has(value.level as AcceptanceLevel))) {
|
|
265
|
-
errors.push(`${pathLabel}.level must be one of auto, none, attested, checked, verified.`);
|
|
266
|
-
}
|
|
267
|
-
if (value.report !== undefined && value.report !== "on" && value.report !== "off") {
|
|
268
|
-
errors.push(`${pathLabel}.report must be on or off.`);
|
|
269
|
-
}
|
|
270
|
-
if (value.level === "none" && (typeof value.reason !== "string" || !value.reason.trim())) {
|
|
271
|
-
errors.push(`${pathLabel}.reason is required when level is none.`);
|
|
272
|
-
}
|
|
273
|
-
if (value.reason !== undefined && typeof value.reason !== "string") errors.push(`${pathLabel}.reason must be a string.`);
|
|
274
|
-
if (value.criteria !== undefined && !Array.isArray(value.criteria)) errors.push(`${pathLabel}.criteria must be an array.`);
|
|
275
|
-
if (Array.isArray(value.criteria)) {
|
|
276
|
-
const criterionIds = new Set<string>();
|
|
277
|
-
for (const [index, criterion] of value.criteria.entries()) {
|
|
278
|
-
if (typeof criterion === "string") continue;
|
|
279
|
-
const criterionPath = `${pathLabel}.criteria[${index}]`;
|
|
280
|
-
if (!criterion || typeof criterion !== "object" || Array.isArray(criterion)) {
|
|
281
|
-
errors.push(`${criterionPath} must be a string or an object.`);
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
const gate = criterion as Record<string, unknown>;
|
|
285
|
-
for (const key of Object.keys(gate)) {
|
|
286
|
-
if (!ACCEPTANCE_GATE_KEYS.has(key)) errors.push(`${criterionPath}.${key} is not supported.`);
|
|
287
|
-
}
|
|
288
|
-
if (typeof gate.id !== "string" || !gate.id.trim()) {
|
|
289
|
-
errors.push(`${criterionPath}.id is required.`);
|
|
290
|
-
} else {
|
|
291
|
-
const normalizedId = normalizedToken(gate.id);
|
|
292
|
-
if (criterionIds.has(normalizedId)) errors.push(`${criterionPath}.id duplicates normalized criterion id '${normalizedId}'.`);
|
|
293
|
-
criterionIds.add(normalizedId);
|
|
294
|
-
}
|
|
295
|
-
if (typeof gate.must !== "string" || !gate.must.trim()) errors.push(`${criterionPath}.must is required.`);
|
|
296
|
-
if (gate.evidence !== undefined && !Array.isArray(gate.evidence)) errors.push(`${criterionPath}.evidence must be an array. ${ACCEPTANCE_EVIDENCE_HELP}`);
|
|
297
|
-
if (Array.isArray(gate.evidence)) {
|
|
298
|
-
for (const [evidenceIndex, item] of gate.evidence.entries()) {
|
|
299
|
-
if (typeof item !== "string" || !VALID_EVIDENCE.has(item as AcceptanceEvidenceKind)) {
|
|
300
|
-
errors.push(unsupportedEvidenceKindMessage(`${criterionPath}.evidence[${evidenceIndex}]`, item));
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
if (gate.severity !== undefined && gate.severity !== "required" && gate.severity !== "recommended") {
|
|
305
|
-
errors.push(`${criterionPath}.severity must be required or recommended.`);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
if (Array.isArray(value.evidence)) {
|
|
310
|
-
for (const [index, item] of value.evidence.entries()) {
|
|
311
|
-
if (typeof item !== "string" || !VALID_EVIDENCE.has(item as AcceptanceEvidenceKind)) {
|
|
312
|
-
errors.push(unsupportedEvidenceKindMessage(`${pathLabel}.evidence[${index}]`, item));
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
} else if (value.evidence !== undefined) {
|
|
316
|
-
errors.push(`${pathLabel}.evidence must be an array. ${ACCEPTANCE_EVIDENCE_HELP}`);
|
|
317
|
-
}
|
|
318
|
-
if (value.level === "verified" && (!Array.isArray(value.verify) || value.verify.length === 0)) {
|
|
319
|
-
errors.push(`${pathLabel}.verify must contain at least one runtime command when level is verified. Use level "checked" or provide a non-empty acceptance.verify array.`);
|
|
320
|
-
} else if (value.verify !== undefined && !Array.isArray(value.verify)) {
|
|
321
|
-
errors.push(`${pathLabel}.verify must be an array.`);
|
|
322
|
-
}
|
|
323
|
-
if (Array.isArray(value.verify)) {
|
|
324
|
-
for (const [index, command] of value.verify.entries()) {
|
|
325
|
-
if (!command || typeof command !== "object" || Array.isArray(command)) {
|
|
326
|
-
errors.push(`${pathLabel}.verify[${index}] must be an object.`);
|
|
327
|
-
continue;
|
|
328
|
-
}
|
|
329
|
-
const cmd = command as Record<string, unknown>;
|
|
330
|
-
for (const key of Object.keys(cmd)) {
|
|
331
|
-
if (!ACCEPTANCE_VERIFY_KEYS.has(key)) errors.push(`${pathLabel}.verify[${index}].${key} is not supported.`);
|
|
332
|
-
}
|
|
333
|
-
if (typeof cmd.id !== "string" || !cmd.id.trim()) errors.push(`${pathLabel}.verify[${index}].id is required.`);
|
|
334
|
-
if (typeof cmd.command !== "string" || !cmd.command.trim()) errors.push(`${pathLabel}.verify[${index}].command is required.`);
|
|
335
|
-
if (cmd.timeoutMs !== undefined && (typeof cmd.timeoutMs !== "number" || !Number.isInteger(cmd.timeoutMs) || cmd.timeoutMs < 1)) {
|
|
336
|
-
errors.push(`${pathLabel}.verify[${index}].timeoutMs must be an integer >= 1.`);
|
|
337
|
-
}
|
|
338
|
-
if (cmd.cwd !== undefined && typeof cmd.cwd !== "string") errors.push(`${pathLabel}.verify[${index}].cwd must be a string.`);
|
|
339
|
-
if (cmd.env !== undefined) {
|
|
340
|
-
if (!cmd.env || typeof cmd.env !== "object" || Array.isArray(cmd.env)) {
|
|
341
|
-
errors.push(`${pathLabel}.verify[${index}].env must be an object.`);
|
|
342
|
-
} else {
|
|
343
|
-
for (const [envKey, envValue] of Object.entries(cmd.env as Record<string, unknown>)) {
|
|
344
|
-
if (typeof envValue !== "string") errors.push(`${pathLabel}.verify[${index}].env.${envKey} must be a string.`);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (cmd.allowFailure !== undefined && typeof cmd.allowFailure !== "boolean") {
|
|
349
|
-
errors.push(`${pathLabel}.verify[${index}].allowFailure must be a boolean.`);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
if (value.review !== undefined && value.review !== false) {
|
|
354
|
-
if (!value.review || typeof value.review !== "object" || Array.isArray(value.review)) {
|
|
355
|
-
errors.push(`${pathLabel}.review must be false or an object.`);
|
|
356
|
-
} else {
|
|
357
|
-
const review = value.review as Record<string, unknown>;
|
|
358
|
-
for (const key of Object.keys(review)) {
|
|
359
|
-
if (!ACCEPTANCE_REVIEW_KEYS.has(key)) errors.push(`${pathLabel}.review.${key} is not supported.`);
|
|
360
|
-
}
|
|
361
|
-
if (review.agent !== undefined && typeof review.agent !== "string") errors.push(`${pathLabel}.review.agent must be a string.`);
|
|
362
|
-
if (review.focus !== undefined && typeof review.focus !== "string") errors.push(`${pathLabel}.review.focus must be a string.`);
|
|
363
|
-
if (review.required !== undefined && typeof review.required !== "boolean") errors.push(`${pathLabel}.review.required must be a boolean.`);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
if (value.stopRules !== undefined && !Array.isArray(value.stopRules)) errors.push(`${pathLabel}.stopRules must be an array.`);
|
|
367
|
-
if (Array.isArray(value.stopRules)) {
|
|
368
|
-
for (const [index, item] of value.stopRules.entries()) {
|
|
369
|
-
if (typeof item !== "string") errors.push(`${pathLabel}.stopRules[${index}] must be a string.`);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
return errors;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
type ExecutionAcceptanceInput = {
|
|
376
|
-
acceptance?: unknown;
|
|
377
|
-
outputSchema?: unknown;
|
|
378
|
-
tasks?: Array<{ acceptance?: unknown; outputSchema?: unknown }>;
|
|
379
|
-
chain?: Array<{
|
|
380
|
-
acceptance?: unknown;
|
|
381
|
-
outputSchema?: unknown;
|
|
382
|
-
parallel?: Array<{ acceptance?: unknown; outputSchema?: unknown }> | { acceptance?: unknown; outputSchema?: unknown };
|
|
383
|
-
}>;
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
export function validateExecutionAcceptancePolicy(input: ExecutionAcceptanceInput): string[] {
|
|
387
|
-
const errors = validateAcceptanceInput(input.acceptance, "acceptance");
|
|
388
|
-
for (const [index, task] of (input.tasks ?? []).entries()) {
|
|
389
|
-
errors.push(...validateAcceptanceInput(task.acceptance, `tasks[${index}].acceptance`));
|
|
390
|
-
}
|
|
391
|
-
for (const [stepIndex, step] of (input.chain ?? []).entries()) {
|
|
392
|
-
errors.push(...validateAcceptanceInput(step.acceptance, `chain[${stepIndex}].acceptance`));
|
|
393
|
-
if (Array.isArray(step.parallel)) {
|
|
394
|
-
for (const [taskIndex, task] of step.parallel.entries()) {
|
|
395
|
-
errors.push(...validateAcceptanceInput(task.acceptance, `chain[${stepIndex}].parallel[${taskIndex}].acceptance`));
|
|
396
|
-
}
|
|
397
|
-
} else if (step.parallel) {
|
|
398
|
-
errors.push(...validateAcceptanceInput(step.parallel.acceptance, `chain[${stepIndex}].parallel.acceptance`));
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
return errors;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
export function validateExecutionAcceptance(input: ExecutionAcceptanceInput): string[] {
|
|
405
|
-
const errors = validateExecutionAcceptancePolicy(input);
|
|
406
|
-
errors.push(...validateAcceptanceReportMode(input.acceptance, input.outputSchema, "acceptance"));
|
|
407
|
-
for (const [index, task] of (input.tasks ?? []).entries()) {
|
|
408
|
-
errors.push(...validateAcceptanceReportMode(task.acceptance, task.outputSchema, `tasks[${index}].acceptance`));
|
|
409
|
-
}
|
|
410
|
-
for (const [stepIndex, step] of (input.chain ?? []).entries()) {
|
|
411
|
-
errors.push(...validateAcceptanceReportMode(step.acceptance, step.outputSchema, `chain[${stepIndex}].acceptance`));
|
|
412
|
-
if (Array.isArray(step.parallel)) {
|
|
413
|
-
for (const [taskIndex, task] of step.parallel.entries()) {
|
|
414
|
-
errors.push(...validateAcceptanceReportMode(task.acceptance, task.outputSchema, `chain[${stepIndex}].parallel[${taskIndex}].acceptance`));
|
|
415
|
-
}
|
|
416
|
-
} else if (step.parallel) {
|
|
417
|
-
errors.push(...validateAcceptanceReportMode(step.parallel.acceptance, step.parallel.outputSchema, `chain[${stepIndex}].parallel.acceptance`));
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
return errors;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
function validateAcceptanceReportMode(acceptance: unknown, outputSchema: unknown, pathLabel: string): string[] {
|
|
424
|
-
const normalized = normalizeAcceptanceValue(acceptance, pathLabel);
|
|
425
|
-
if (normalized.error) return [];
|
|
426
|
-
acceptance = normalized.value;
|
|
427
|
-
if (!acceptance || typeof acceptance !== "object" || Array.isArray(acceptance)) return [];
|
|
428
|
-
if (!("report" in acceptance)) return [];
|
|
429
|
-
return outputSchema === undefined || outputSchema === false ? [`${pathLabel}.report requires outputSchema.`] : [];
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function normalizeCriteria(criteria: Array<string | { id?: string; must?: string; evidence?: AcceptanceEvidenceKind[]; severity?: "required" | "recommended" }> | undefined, evidence: AcceptanceEvidenceKind[]): ResolvedAcceptanceGate[] {
|
|
433
|
-
return (criteria ?? []).map((criterion, index): ResolvedAcceptanceGate => {
|
|
434
|
-
if (typeof criterion === "string") {
|
|
435
|
-
return { id: `criterion-${index + 1}`, must: criterion, evidence, severity: "required" };
|
|
436
|
-
}
|
|
437
|
-
return {
|
|
438
|
-
id: criterion.id?.trim() || `criterion-${index + 1}`,
|
|
439
|
-
must: criterion.must ?? "",
|
|
440
|
-
evidence: criterion.evidence?.filter((item) => VALID_EVIDENCE.has(item)) ?? evidence,
|
|
441
|
-
severity: criterion.severity ?? "required",
|
|
442
|
-
};
|
|
443
|
-
}).filter((criterion) => criterion.must.trim());
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
export function resolveEffectiveAcceptance(input: {
|
|
447
|
-
explicit?: AcceptanceInput;
|
|
448
|
-
agentName: string;
|
|
449
|
-
acceptanceRole?: AcceptanceRole;
|
|
450
|
-
task?: string;
|
|
451
|
-
mode?: SubagentRunMode;
|
|
452
|
-
async?: boolean;
|
|
453
|
-
dynamic?: boolean;
|
|
454
|
-
dynamicGroup?: boolean;
|
|
455
|
-
agentContract?: AgentContract;
|
|
456
|
-
}): ResolvedAcceptanceConfig {
|
|
457
|
-
const explicit = normalizeAcceptanceInput(input.explicit);
|
|
458
|
-
const explicitLevel = normalizeLevel(explicit.level);
|
|
459
|
-
if (isAgentContract(input.agentContract)) {
|
|
460
|
-
const level = explicitAcceptanceCanDisable(explicit) || explicitLevel === "auto"
|
|
461
|
-
? "none"
|
|
462
|
-
: explicitLevel;
|
|
463
|
-
const evidence = unique(explicit.evidence ?? []);
|
|
464
|
-
const criteria = normalizeCriteria(
|
|
465
|
-
explicit.criteria as Array<string | { id?: string; must?: string; evidence?: AcceptanceEvidenceKind[]; severity?: "required" | "recommended" }> | undefined,
|
|
466
|
-
evidence,
|
|
467
|
-
);
|
|
468
|
-
return {
|
|
469
|
-
level,
|
|
470
|
-
explicit: input.explicit !== undefined,
|
|
471
|
-
inferredReason: [],
|
|
472
|
-
criteria,
|
|
473
|
-
evidence,
|
|
474
|
-
verify: explicit.verify ?? [],
|
|
475
|
-
review: explicit.review,
|
|
476
|
-
stopRules: explicit.stopRules ?? [],
|
|
477
|
-
reason: explicit.reason,
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
const inferred = inferLevel(input);
|
|
481
|
-
const inferredLevel = inferred.level === "none" && explicitAcceptanceRequestsPolicy(explicit) ? "attested" : inferred.level;
|
|
482
|
-
const level = explicitAcceptanceCanDisable(explicit)
|
|
483
|
-
? "none"
|
|
484
|
-
: explicitLevel === "auto"
|
|
485
|
-
? inferredLevel
|
|
486
|
-
: (LEVEL_RANK[explicitLevel] >= LEVEL_RANK[inferredLevel] ? explicitLevel : inferredLevel);
|
|
487
|
-
const evidence = unique([...(level === inferredLevel ? inferred.evidence : requiredEvidenceForLevel(level)), ...(explicit.evidence ?? [])]);
|
|
488
|
-
const criteria = normalizeCriteria(
|
|
489
|
-
(explicit.criteria?.length ? explicit.criteria : inferred.criteria) as Array<string | { id?: string; must?: string; evidence?: AcceptanceEvidenceKind[]; severity?: "required" | "recommended" }>,
|
|
490
|
-
evidence,
|
|
491
|
-
);
|
|
492
|
-
const review = explicit.review !== undefined ? explicit.review : inferred.review;
|
|
493
|
-
return {
|
|
494
|
-
level,
|
|
495
|
-
explicit: input.explicit !== undefined,
|
|
496
|
-
inferredReason: inferred.reasons,
|
|
497
|
-
criteria: level === "none" ? [] : criteria,
|
|
498
|
-
evidence: level === "none" ? [] : evidence,
|
|
499
|
-
verify: explicit.verify ?? [],
|
|
500
|
-
review,
|
|
501
|
-
stopRules: explicit.stopRules ?? [],
|
|
502
|
-
reason: explicit.reason,
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
function acceptanceRequiresChildReport(acceptance: ResolvedAcceptanceConfig): boolean {
|
|
507
|
-
return acceptance.criteria.length > 0 || acceptance.evidence.length > 0;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
/** Label a declared review gate the same way in prompts and capability summaries. */
|
|
511
|
-
export function formatReviewGateLabel(review: AcceptanceReviewGate): string {
|
|
512
|
-
const status = review.required === false ? "optional" : "required";
|
|
513
|
-
return review.agent ? `${status} by ${review.agent}` : status;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
export function formatAcceptancePrompt(acceptance: ResolvedAcceptanceConfig, options: { reportOptional?: boolean; structuredOutput?: boolean } = {}): string {
|
|
517
|
-
if (acceptance.level === "none") return "";
|
|
518
|
-
if (options.reportOptional && !acceptanceRequiresChildReport(acceptance)) return "";
|
|
519
|
-
const lines = [
|
|
520
|
-
"",
|
|
521
|
-
"## Acceptance Contract",
|
|
522
|
-
`Acceptance level: ${acceptance.level}`,
|
|
523
|
-
"Completion is not accepted from prose alone. End with a structured acceptance report.",
|
|
524
|
-
"",
|
|
525
|
-
"Criteria:",
|
|
526
|
-
...(acceptance.criteria.length ? acceptance.criteria.map((criterion) => `- ${criterion.id}: ${criterion.must}`) : ["- Return the requested result."]),
|
|
527
|
-
"",
|
|
528
|
-
`Required evidence: ${acceptance.evidence.join(", ") || "none"}`,
|
|
529
|
-
];
|
|
530
|
-
if (acceptance.verify.length > 0) {
|
|
531
|
-
lines.push("", "Runtime verification commands configured by parent:");
|
|
532
|
-
for (const command of acceptance.verify) lines.push(`- ${command.id}: ${command.command}`);
|
|
533
|
-
}
|
|
534
|
-
if (acceptance.review) {
|
|
535
|
-
lines.push("", `Review gate: ${formatReviewGateLabel(acceptance.review)}.`);
|
|
536
|
-
if (acceptance.review.focus) lines.push(`Review focus: ${acceptance.review.focus}`);
|
|
537
|
-
}
|
|
538
|
-
if (acceptance.stopRules.length > 0) {
|
|
539
|
-
lines.push("", "Stop rules:", ...acceptance.stopRules.map((rule) => `- ${rule}`));
|
|
540
|
-
}
|
|
541
|
-
lines.push(
|
|
542
|
-
"",
|
|
543
|
-
options.structuredOutput
|
|
544
|
-
? "Include an `acceptanceReport` object in your final `structured_output` tool call in this shape:"
|
|
545
|
-
: "Finish with a fenced JSON block tagged `acceptance-report` in this shape:",
|
|
546
|
-
"Use empty arrays when no items apply; array fields contain strings unless object entries are shown.",
|
|
547
|
-
"Empty-string entries (`[\"\"]`) are ignored; use `[]` when nothing applies.",
|
|
548
|
-
"`criteriaSatisfied[].status` must be exactly one of: satisfied, not-satisfied, not-applicable.",
|
|
549
|
-
"`commandsRun[].result` must be exactly one of: passed, failed, not-run.",
|
|
550
|
-
"`manualNotes` and `notes` are optional strings; an empty string means no note and does not satisfy `manual-notes` evidence.",
|
|
551
|
-
...(options.structuredOutput ? [] : ["```acceptance-report"]),
|
|
552
|
-
JSON.stringify({
|
|
553
|
-
criteriaSatisfied: acceptance.criteria
|
|
554
|
-
.filter((criterion) => criterion.severity !== "recommended")
|
|
555
|
-
.map((criterion) => ({ id: criterion.id, status: "satisfied", evidence: "specific proof" })),
|
|
556
|
-
changedFiles: ["src/file.ts"],
|
|
557
|
-
testsAddedOrUpdated: ["test/file.test.ts"],
|
|
558
|
-
commandsRun: [{ command: "command", result: "passed", summary: "short result" }],
|
|
559
|
-
validationOutput: ["validation output or concise summary"],
|
|
560
|
-
residualRisks: ["none"],
|
|
561
|
-
noStagedFiles: true,
|
|
562
|
-
diffSummary: "short description of the diff",
|
|
563
|
-
reviewFindings: ["blocker: file.ts:12 - issue found, or no blockers"],
|
|
564
|
-
manualNotes: "anything else the parent should know",
|
|
565
|
-
}, null, 2),
|
|
566
|
-
...(options.structuredOutput ? [] : ["```"]),
|
|
567
|
-
);
|
|
568
|
-
return lines.join("\n");
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
function extractBalancedJson(text: string, start: number): string | undefined {
|
|
572
|
-
let depth = 0;
|
|
573
|
-
let inString = false;
|
|
574
|
-
let escaped = false;
|
|
575
|
-
for (let i = start; i < text.length; i++) {
|
|
576
|
-
const char = text[i]!;
|
|
577
|
-
if (inString) {
|
|
578
|
-
if (escaped) escaped = false;
|
|
579
|
-
else if (char === "\\") escaped = true;
|
|
580
|
-
else if (char === "\"") inString = false;
|
|
581
|
-
continue;
|
|
582
|
-
}
|
|
583
|
-
if (char === "\"") {
|
|
584
|
-
inString = true;
|
|
585
|
-
continue;
|
|
586
|
-
}
|
|
587
|
-
if (char === "{") depth++;
|
|
588
|
-
if (char === "}") {
|
|
589
|
-
depth--;
|
|
590
|
-
if (depth === 0) return text.slice(start, i + 1);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
return undefined;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
const ACCEPTANCE_REPORT_WRAPPERS = new Set(["acceptance", "acceptance-report", "acceptance_report", "acceptanceReport"]);
|
|
597
|
-
|
|
598
|
-
const ACCEPTANCE_REPORT_FIELDS: Record<string, keyof AcceptanceReport> = {
|
|
599
|
-
criteriaSatisfied: "criteriaSatisfied",
|
|
600
|
-
criteria_satisfied: "criteriaSatisfied",
|
|
601
|
-
changedFiles: "changedFiles",
|
|
602
|
-
changed_files: "changedFiles",
|
|
603
|
-
testsAddedOrUpdated: "testsAddedOrUpdated",
|
|
604
|
-
tests_added_or_updated: "testsAddedOrUpdated",
|
|
605
|
-
commandsRun: "commandsRun",
|
|
606
|
-
commands_run: "commandsRun",
|
|
607
|
-
validationOutput: "validationOutput",
|
|
608
|
-
validation_output: "validationOutput",
|
|
609
|
-
residualRisks: "residualRisks",
|
|
610
|
-
residual_risks: "residualRisks",
|
|
611
|
-
noStagedFiles: "noStagedFiles",
|
|
612
|
-
no_staged_files: "noStagedFiles",
|
|
613
|
-
diffSummary: "diffSummary",
|
|
614
|
-
diff_summary: "diffSummary",
|
|
615
|
-
reviewFindings: "reviewFindings",
|
|
616
|
-
review_findings: "reviewFindings",
|
|
617
|
-
manualNotes: "manualNotes",
|
|
618
|
-
manual_notes: "manualNotes",
|
|
619
|
-
notes: "notes",
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
const CRITERION_REPORT_FIELDS = new Set(["id", "status", "evidence"]);
|
|
623
|
-
const COMMAND_REPORT_FIELDS = new Set(["command", "result", "summary"]);
|
|
624
|
-
|
|
625
|
-
function normalizedToken(value: string): string {
|
|
626
|
-
return value.trim().toLowerCase().replace(/[\s_]+/g, "-").replace(/-+/g, "-");
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
function normalizeCriterionStatus(value: unknown): unknown {
|
|
630
|
-
if (typeof value !== "string") return value;
|
|
631
|
-
const token = normalizedToken(value);
|
|
632
|
-
if (["satisfied", "met", "complete", "completed", "done", "pass", "passed", "success", "succeeded"].includes(token)) return "satisfied";
|
|
633
|
-
if (["not-satisfied", "not-met", "unmet", "incomplete", "fail", "failed"].includes(token)) return "not-satisfied";
|
|
634
|
-
if (["not-applicable", "n-a", "na", "skip", "skipped"].includes(token)) return "not-applicable";
|
|
635
|
-
return value;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
function normalizeCommandResult(value: unknown): unknown {
|
|
639
|
-
if (typeof value !== "string") return value;
|
|
640
|
-
const token = normalizedToken(value);
|
|
641
|
-
if (["passed", "pass", "success", "successful", "succeeded", "ok"].includes(token)) return "passed";
|
|
642
|
-
if (["failed", "fail", "failure", "error"].includes(token)) return "failed";
|
|
643
|
-
if (["not-run", "not-executed", "skip", "skipped"].includes(token)) return "not-run";
|
|
644
|
-
return value;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
function normalizeCriterionReport(value: unknown, pathLabel: string, errors: string[]): unknown {
|
|
648
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
649
|
-
const normalized: Record<string, unknown> = {};
|
|
650
|
-
for (const [key, fieldValue] of Object.entries(value as Record<string, unknown>)) {
|
|
651
|
-
if (!CRITERION_REPORT_FIELDS.has(key)) {
|
|
652
|
-
errors.push(`${pathLabel}.${key}: unsupported acceptance criterion field`);
|
|
653
|
-
continue;
|
|
654
|
-
}
|
|
655
|
-
normalized[key] = key === "id" && typeof fieldValue === "string"
|
|
656
|
-
? normalizedToken(fieldValue)
|
|
657
|
-
: key === "status"
|
|
658
|
-
? normalizeCriterionStatus(fieldValue)
|
|
659
|
-
: fieldValue;
|
|
660
|
-
}
|
|
661
|
-
return normalized;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
function normalizeCommandReport(value: unknown, pathLabel: string, errors: string[]): unknown {
|
|
665
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
666
|
-
const normalized: Record<string, unknown> = {};
|
|
667
|
-
for (const [key, fieldValue] of Object.entries(value as Record<string, unknown>)) {
|
|
668
|
-
if (!COMMAND_REPORT_FIELDS.has(key)) {
|
|
669
|
-
errors.push(`${pathLabel}.${key}: unsupported acceptance command field`);
|
|
670
|
-
continue;
|
|
671
|
-
}
|
|
672
|
-
normalized[key] = key === "result" ? normalizeCommandResult(fieldValue) : fieldValue;
|
|
673
|
-
}
|
|
674
|
-
return normalized;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
function normalizeAcceptanceReportValue(value: unknown, pathLabel = ""): { value: unknown; pathLabel: string; errors: string[] } {
|
|
678
|
-
const errors: string[] = [];
|
|
679
|
-
let reportValue = value;
|
|
680
|
-
let reportPath = pathLabel;
|
|
681
|
-
if (reportValue && typeof reportValue === "object" && !Array.isArray(reportValue)) {
|
|
682
|
-
const record = reportValue as Record<string, unknown>;
|
|
683
|
-
const wrapperKeys = Object.keys(record).filter((key) => ACCEPTANCE_REPORT_WRAPPERS.has(key));
|
|
684
|
-
if (wrapperKeys.length > 0) {
|
|
685
|
-
const wrapperKey = wrapperKeys[0]!;
|
|
686
|
-
if (wrapperKeys.length > 1) errors.push(`${pathLabel || "acceptance-report"}: multiple acceptance report wrappers are ambiguous`);
|
|
687
|
-
for (const key of Object.keys(record)) {
|
|
688
|
-
if (key !== wrapperKey) errors.push(`${pathFor(pathLabel, key)}: unsupported alongside acceptance report wrapper '${wrapperKey}'`);
|
|
689
|
-
}
|
|
690
|
-
reportValue = record[wrapperKey];
|
|
691
|
-
reportPath = pathFor(pathLabel, wrapperKey);
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
if (!reportValue || typeof reportValue !== "object" || Array.isArray(reportValue)) return { value: reportValue, pathLabel: reportPath, errors };
|
|
695
|
-
|
|
696
|
-
const normalized: Record<string, unknown> = {};
|
|
697
|
-
for (const [key, fieldValue] of Object.entries(reportValue as Record<string, unknown>)) {
|
|
698
|
-
const canonical = ACCEPTANCE_REPORT_FIELDS[key];
|
|
699
|
-
if (!canonical) {
|
|
700
|
-
errors.push(`${pathFor(reportPath, key)}: unsupported acceptance report field`);
|
|
701
|
-
continue;
|
|
702
|
-
}
|
|
703
|
-
if (Object.hasOwn(normalized, canonical)) {
|
|
704
|
-
errors.push(`${pathFor(reportPath, key)}: duplicates normalized field '${canonical}'`);
|
|
705
|
-
continue;
|
|
706
|
-
}
|
|
707
|
-
const fieldPath = pathFor(reportPath, canonical);
|
|
708
|
-
switch (canonical) {
|
|
709
|
-
case "criteriaSatisfied": {
|
|
710
|
-
const items = Array.isArray(fieldValue) ? fieldValue : fieldValue && typeof fieldValue === "object" ? [fieldValue] : fieldValue;
|
|
711
|
-
normalized[canonical] = Array.isArray(items)
|
|
712
|
-
? items.map((item, index) => normalizeCriterionReport(item, `${fieldPath}[${index}]`, errors))
|
|
713
|
-
: items;
|
|
714
|
-
break;
|
|
715
|
-
}
|
|
716
|
-
case "commandsRun": {
|
|
717
|
-
const items = Array.isArray(fieldValue) ? fieldValue : fieldValue && typeof fieldValue === "object" ? [fieldValue] : fieldValue;
|
|
718
|
-
normalized[canonical] = Array.isArray(items)
|
|
719
|
-
? items.map((item, index) => normalizeCommandReport(item, `${fieldPath}[${index}]`, errors))
|
|
720
|
-
: items;
|
|
721
|
-
break;
|
|
722
|
-
}
|
|
723
|
-
case "changedFiles":
|
|
724
|
-
case "testsAddedOrUpdated":
|
|
725
|
-
case "validationOutput":
|
|
726
|
-
case "residualRisks":
|
|
727
|
-
case "reviewFindings": {
|
|
728
|
-
// Tolerate empty-string entries ("[\"\"]"): models write them for "no items"
|
|
729
|
-
// and a single empty entry must not reject the whole report. Drop them at
|
|
730
|
-
// parse time; non-string entries are kept so validateStringArrayField still
|
|
731
|
-
// flags structural garbage.
|
|
732
|
-
const items = typeof fieldValue === "string" ? [fieldValue] : fieldValue;
|
|
733
|
-
normalized[canonical] = Array.isArray(items)
|
|
734
|
-
? items.filter((item) => typeof item !== "string" || item.trim().length > 0)
|
|
735
|
-
: items;
|
|
736
|
-
break;
|
|
737
|
-
}
|
|
738
|
-
case "noStagedFiles": {
|
|
739
|
-
const token = typeof fieldValue === "string" ? fieldValue.trim().toLowerCase() : undefined;
|
|
740
|
-
normalized[canonical] = token === "true" ? true : token === "false" ? false : fieldValue;
|
|
741
|
-
break;
|
|
742
|
-
}
|
|
743
|
-
default:
|
|
744
|
-
normalized[canonical] = fieldValue;
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
return { value: normalized, pathLabel: reportPath, errors };
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
function hasGenericAcceptanceReportSignal(value: unknown): boolean {
|
|
751
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
752
|
-
const record = value as Record<string, unknown>;
|
|
753
|
-
return "criteriaSatisfied" in record && [
|
|
754
|
-
"changedFiles",
|
|
755
|
-
"testsAddedOrUpdated",
|
|
756
|
-
"commandsRun",
|
|
757
|
-
"validationOutput",
|
|
758
|
-
"residualRisks",
|
|
759
|
-
"noStagedFiles",
|
|
760
|
-
"diffSummary",
|
|
761
|
-
"reviewFindings",
|
|
762
|
-
"manualNotes",
|
|
763
|
-
].some((key) => key in record);
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
function parseReportJson(body: string): unknown {
|
|
767
|
-
const trimmed = body.trim();
|
|
768
|
-
try {
|
|
769
|
-
return JSON.parse(trimmed) as unknown;
|
|
770
|
-
} catch (error) {
|
|
771
|
-
const jsonStart = trimmed.indexOf("{");
|
|
772
|
-
if (jsonStart > 0) {
|
|
773
|
-
const json = extractBalancedJson(trimmed, jsonStart);
|
|
774
|
-
if (json) return JSON.parse(json) as unknown;
|
|
775
|
-
}
|
|
776
|
-
throw error;
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
function fencedBlocks(output: string, tag: string): string[] {
|
|
781
|
-
return [...output.matchAll(new RegExp(`\`\`\`${tag}\\s*\\n([\\s\\S]*?)\`\`\``, "gi"))]
|
|
782
|
-
.map((match) => match[1]?.trim())
|
|
783
|
-
.filter((value): value is string => Boolean(value));
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
function parseAcceptanceReportBody(body: string): { report?: AcceptanceReport; errors: string[] } {
|
|
787
|
-
return validateAcceptanceReport(parseReportJson(body));
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
interface AcceptanceReportParseResult {
|
|
791
|
-
report?: AcceptanceReport;
|
|
792
|
-
error?: string;
|
|
793
|
-
/** True when an acceptance-report signal was found but its envelope was invalid. */
|
|
794
|
-
malformed?: boolean;
|
|
795
|
-
sourcePath?: string;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
function parseUnterminatedAcceptanceReportFence(output: string): AcceptanceReportParseResult {
|
|
799
|
-
const opener = /```acceptance[-_]report\b[^\n]*\n/gi.exec(output);
|
|
800
|
-
if (!opener) return {};
|
|
801
|
-
const bodyStart = opener.index + opener[0].length;
|
|
802
|
-
if (output.indexOf("```", bodyStart) !== -1) return {};
|
|
803
|
-
try {
|
|
804
|
-
const validation = validateAcceptanceReport(JSON.parse(output.slice(bodyStart).trim()) as unknown);
|
|
805
|
-
return validation.report
|
|
806
|
-
? { report: validation.report }
|
|
807
|
-
: { error: `Failed to parse acceptance-report: Invalid acceptance-report: ${validation.errors.join("; ")}`, malformed: true };
|
|
808
|
-
} catch (error) {
|
|
809
|
-
return { error: `Failed to parse acceptance-report: ${error instanceof Error ? error.message : String(error)}`, malformed: true };
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
function parseGenericJsonAcceptanceReportBody(body: string): AcceptanceReportParseResult {
|
|
814
|
-
const parsed = parseReportJson(body);
|
|
815
|
-
const normalized = normalizeAcceptanceReportValue(parsed);
|
|
816
|
-
const hasCriteriaMarker = normalized.value !== null
|
|
817
|
-
&& typeof normalized.value === "object"
|
|
818
|
-
&& !Array.isArray(normalized.value)
|
|
819
|
-
&& "criteriaSatisfied" in normalized.value;
|
|
820
|
-
if (!hasGenericAcceptanceReportSignal(normalized.value) && !(hasCriteriaMarker && normalized.errors.length > 0)) return {};
|
|
821
|
-
const validation = validateAcceptanceReport(parsed);
|
|
822
|
-
return validation.report
|
|
823
|
-
? { report: validation.report }
|
|
824
|
-
: { error: `Invalid acceptance-report: ${validation.errors.join("; ")}`, malformed: true };
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
export const ACCEPTANCE_REPORT_NOT_FOUND = "Structured acceptance report not found.";
|
|
828
|
-
|
|
829
|
-
export function parseAcceptanceReport(output: string): AcceptanceReportParseResult {
|
|
830
|
-
const explicitFencePresent = /```acceptance[-_]report\b/i.test(output);
|
|
831
|
-
const fenced = fencedBlocks(output, "acceptance[-_]report");
|
|
832
|
-
const parseErrors: string[] = [];
|
|
833
|
-
for (const body of fenced) {
|
|
834
|
-
try {
|
|
835
|
-
const validation = parseAcceptanceReportBody(body);
|
|
836
|
-
if (validation.report) return { report: validation.report };
|
|
837
|
-
parseErrors.push(`Invalid acceptance-report: ${validation.errors.join("; ")}`);
|
|
838
|
-
} catch (error) {
|
|
839
|
-
parseErrors.push(error instanceof Error ? error.message : String(error));
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
if (parseErrors.length > 0) return { error: `Failed to parse acceptance-report: ${parseErrors.join("; ")}`, malformed: true };
|
|
843
|
-
if (explicitFencePresent) {
|
|
844
|
-
const recovered = parseUnterminatedAcceptanceReportFence(output);
|
|
845
|
-
if (recovered.report || recovered.error) return recovered;
|
|
846
|
-
return { error: "Failed to parse acceptance-report: Empty or unterminated acceptance-report fence.", malformed: true };
|
|
847
|
-
}
|
|
848
|
-
for (const body of fencedBlocks(output, "(?:json|jsonc|json5)")) {
|
|
849
|
-
try {
|
|
850
|
-
const parsed = parseGenericJsonAcceptanceReportBody(body);
|
|
851
|
-
if (parsed.report) return { report: parsed.report };
|
|
852
|
-
if (parsed.error) return { error: `Failed to parse acceptance-report: ${parsed.error}`, malformed: parsed.malformed };
|
|
853
|
-
} catch {
|
|
854
|
-
// Ignore unrelated malformed generic JSON. A recognizable report shape
|
|
855
|
-
// returns exact validation errors above instead of being mistaken for prose.
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
const markerIndex = output.search(/ACCEPTANCE_REPORT\s*:/i);
|
|
859
|
-
if (markerIndex !== -1) {
|
|
860
|
-
const jsonStart = output.indexOf("{", markerIndex);
|
|
861
|
-
if (jsonStart === -1) {
|
|
862
|
-
return { error: "Failed to parse acceptance-report: Expected a JSON object after ACCEPTANCE_REPORT:.", malformed: true };
|
|
863
|
-
}
|
|
864
|
-
const json = extractBalancedJson(output, jsonStart);
|
|
865
|
-
if (!json) {
|
|
866
|
-
return { error: "Failed to parse acceptance-report: Unterminated JSON object after ACCEPTANCE_REPORT:.", malformed: true };
|
|
867
|
-
}
|
|
868
|
-
try {
|
|
869
|
-
const parsed = JSON.parse(json) as unknown;
|
|
870
|
-
const validation = validateAcceptanceReport(parsed);
|
|
871
|
-
if (validation.report) return { report: validation.report };
|
|
872
|
-
return { error: `Failed to parse acceptance-report: Invalid acceptance-report: ${validation.errors.join("; ")}`, malformed: true };
|
|
873
|
-
} catch (error) {
|
|
874
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
875
|
-
return { error: `Failed to parse acceptance-report: ${message}`, malformed: true };
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
return { error: ACCEPTANCE_REPORT_NOT_FOUND };
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
function parseAcceptanceReportSources(
|
|
882
|
-
output: string,
|
|
883
|
-
fileOutput: { content: string; path: string; authoritative?: boolean } | undefined,
|
|
884
|
-
): AcceptanceReportParseResult {
|
|
885
|
-
const fromText = () => parseAcceptanceReport(output);
|
|
886
|
-
const fromFile = () => {
|
|
887
|
-
if (!fileOutput) return { error: ACCEPTANCE_REPORT_NOT_FOUND };
|
|
888
|
-
const parsed = parseAcceptanceReport(fileOutput.content);
|
|
889
|
-
return parsed.report || parsed.error === ACCEPTANCE_REPORT_NOT_FOUND
|
|
890
|
-
? parsed
|
|
891
|
-
: {
|
|
892
|
-
...parsed,
|
|
893
|
-
error: `${parsed.error} (in configured output ${fileOutput.path})`,
|
|
894
|
-
sourcePath: fileOutput.path,
|
|
895
|
-
};
|
|
896
|
-
};
|
|
897
|
-
const [primary, secondary] = fileOutput?.authoritative ? [fromFile, fromText] : [fromText, fromFile];
|
|
898
|
-
const first = primary();
|
|
899
|
-
// A malformed report in the primary source is a defect to surface, not a
|
|
900
|
-
// miss to paper over with the secondary source; only a genuinely absent
|
|
901
|
-
// report falls through.
|
|
902
|
-
if (first.report || first.error !== ACCEPTANCE_REPORT_NOT_FOUND) return first;
|
|
903
|
-
return secondary();
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
export function stripAcceptanceReport(output: string): string {
|
|
907
|
-
const trailingFencePattern = /\n?```(acceptance[-_]report|json|jsonc|json5)\s*\n([\s\S]*?)```\s*/gi;
|
|
908
|
-
let trailingFence: { index: number; tag: string; body: string } | undefined;
|
|
909
|
-
for (const match of output.matchAll(trailingFencePattern)) {
|
|
910
|
-
const end = (match.index ?? 0) + match[0].length;
|
|
911
|
-
if (output.slice(end).trim().length === 0 && match[1] && match[2]) {
|
|
912
|
-
trailingFence = { index: match.index ?? 0, tag: match[1].toLowerCase(), body: match[2] };
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
if (trailingFence) {
|
|
916
|
-
if (trailingFence.tag === "acceptance-report" || trailingFence.tag === "acceptance_report") return output.slice(0, trailingFence.index).trimEnd();
|
|
917
|
-
try {
|
|
918
|
-
if (parseGenericJsonAcceptanceReportBody(trailingFence.body).report) return output.slice(0, trailingFence.index).trimEnd();
|
|
919
|
-
} catch {
|
|
920
|
-
// Leave unrelated or malformed generic JSON fences visible.
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
return output
|
|
924
|
-
.replace(/\n?```acceptance[-_]report\s*\n[\s\S]*?```\s*$/i, "")
|
|
925
|
-
.replace(/\n?ACCEPTANCE_REPORT\s*:\s*\{[\s\S]*\}\s*$/i, "")
|
|
926
|
-
.trimEnd();
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
function isStringArray(value: unknown): value is string[] {
|
|
930
|
-
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
function pathFor(base: string, segment: string): string {
|
|
934
|
-
return base ? `${base}.${segment}` : segment;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
function describeValidationValue(value: unknown): string {
|
|
938
|
-
if (value === undefined) return "missing";
|
|
939
|
-
if (value === null) return "null";
|
|
940
|
-
if (Array.isArray(value)) return "array";
|
|
941
|
-
if (typeof value === "object") return "object";
|
|
942
|
-
if (typeof value === "string") {
|
|
943
|
-
const short = value.length > 80 ? `${value.slice(0, 77)}...` : value;
|
|
944
|
-
return JSON.stringify(short);
|
|
945
|
-
}
|
|
946
|
-
return `${typeof value} ${String(value)}`;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
function pushTypeError(errors: string[], pathLabel: string, expected: string, value: unknown): void {
|
|
950
|
-
errors.push(`${pathLabel}: expected ${expected}; got ${describeValidationValue(value)}`);
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
function validateStringArrayField(errors: string[], value: unknown, pathLabel: string): void {
|
|
954
|
-
if (!Array.isArray(value)) {
|
|
955
|
-
pushTypeError(errors, pathLabel, "string[]", value);
|
|
956
|
-
return;
|
|
957
|
-
}
|
|
958
|
-
for (const [index, item] of value.entries()) {
|
|
959
|
-
if (typeof item !== "string" || !item.trim()) pushTypeError(errors, `${pathLabel}[${index}]`, "non-empty string", item);
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
export function validateAcceptanceReport(value: unknown, pathLabel = ""): { report?: AcceptanceReport; errors: string[] } {
|
|
964
|
-
const normalized = normalizeAcceptanceReportValue(value, pathLabel);
|
|
965
|
-
value = normalized.value;
|
|
966
|
-
pathLabel = normalized.pathLabel;
|
|
967
|
-
const errors = normalized.errors;
|
|
968
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
969
|
-
pushTypeError(errors, pathLabel || "acceptance-report", "object", value);
|
|
970
|
-
return { errors };
|
|
971
|
-
}
|
|
972
|
-
const report = value as AcceptanceReport;
|
|
973
|
-
if (report.criteriaSatisfied !== undefined) {
|
|
974
|
-
if (!Array.isArray(report.criteriaSatisfied)) {
|
|
975
|
-
pushTypeError(errors, pathFor(pathLabel, "criteriaSatisfied"), "array", report.criteriaSatisfied);
|
|
976
|
-
} else {
|
|
977
|
-
const criterionIds = new Set<string>();
|
|
978
|
-
for (const [index, item] of report.criteriaSatisfied.entries()) {
|
|
979
|
-
const itemPath = `${pathFor(pathLabel, "criteriaSatisfied")}[${index}]`;
|
|
980
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
981
|
-
pushTypeError(errors, itemPath, "object", item);
|
|
982
|
-
continue;
|
|
983
|
-
}
|
|
984
|
-
const criterion = item as { id?: unknown; status?: unknown; evidence?: unknown };
|
|
985
|
-
if (criterion.id !== undefined && typeof criterion.id !== "string") {
|
|
986
|
-
pushTypeError(errors, `${itemPath}.id`, "string", criterion.id);
|
|
987
|
-
} else if (typeof criterion.id === "string" && criterion.id) {
|
|
988
|
-
if (criterionIds.has(criterion.id)) errors.push(`${itemPath}.id: duplicate normalized criterion id '${criterion.id}'`);
|
|
989
|
-
criterionIds.add(criterion.id);
|
|
990
|
-
}
|
|
991
|
-
if (criterion.status !== "satisfied" && criterion.status !== "not-satisfied" && criterion.status !== "not-applicable") {
|
|
992
|
-
pushTypeError(errors, `${itemPath}.status`, "one of \"satisfied\", \"not-satisfied\", \"not-applicable\"", criterion.status);
|
|
993
|
-
}
|
|
994
|
-
if (typeof criterion.evidence !== "string" || !criterion.evidence.trim()) pushTypeError(errors, `${itemPath}.evidence`, "non-empty string", criterion.evidence);
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
if (report.changedFiles !== undefined) validateStringArrayField(errors, report.changedFiles, pathFor(pathLabel, "changedFiles"));
|
|
999
|
-
if (report.testsAddedOrUpdated !== undefined) validateStringArrayField(errors, report.testsAddedOrUpdated, pathFor(pathLabel, "testsAddedOrUpdated"));
|
|
1000
|
-
if (report.commandsRun !== undefined) {
|
|
1001
|
-
if (!Array.isArray(report.commandsRun)) {
|
|
1002
|
-
pushTypeError(errors, pathFor(pathLabel, "commandsRun"), "array", report.commandsRun);
|
|
1003
|
-
} else {
|
|
1004
|
-
for (const [index, item] of report.commandsRun.entries()) {
|
|
1005
|
-
const itemPath = `${pathFor(pathLabel, "commandsRun")}[${index}]`;
|
|
1006
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
1007
|
-
pushTypeError(errors, itemPath, "object", item);
|
|
1008
|
-
continue;
|
|
1009
|
-
}
|
|
1010
|
-
const command = item as { command?: unknown; result?: unknown; summary?: unknown };
|
|
1011
|
-
if (typeof command.command !== "string" || !command.command.trim()) pushTypeError(errors, `${itemPath}.command`, "non-empty string", command.command);
|
|
1012
|
-
if (command.result !== "passed" && command.result !== "failed" && command.result !== "not-run") {
|
|
1013
|
-
pushTypeError(errors, `${itemPath}.result`, "one of \"passed\", \"failed\", \"not-run\"", command.result);
|
|
1014
|
-
}
|
|
1015
|
-
if (typeof command.summary !== "string" || !command.summary.trim()) pushTypeError(errors, `${itemPath}.summary`, "non-empty string", command.summary);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
if (report.validationOutput !== undefined) validateStringArrayField(errors, report.validationOutput, pathFor(pathLabel, "validationOutput"));
|
|
1020
|
-
if (report.residualRisks !== undefined) validateStringArrayField(errors, report.residualRisks, pathFor(pathLabel, "residualRisks"));
|
|
1021
|
-
if (report.noStagedFiles !== undefined && typeof report.noStagedFiles !== "boolean") pushTypeError(errors, pathFor(pathLabel, "noStagedFiles"), "boolean", report.noStagedFiles);
|
|
1022
|
-
if (report.diffSummary !== undefined && (typeof report.diffSummary !== "string" || !report.diffSummary.trim())) pushTypeError(errors, pathFor(pathLabel, "diffSummary"), "non-empty string", report.diffSummary);
|
|
1023
|
-
if (report.reviewFindings !== undefined) validateStringArrayField(errors, report.reviewFindings, pathFor(pathLabel, "reviewFindings"));
|
|
1024
|
-
if (report.manualNotes !== undefined && typeof report.manualNotes !== "string") pushTypeError(errors, pathFor(pathLabel, "manualNotes"), "string", report.manualNotes);
|
|
1025
|
-
if (report.notes !== undefined && typeof report.notes !== "string") pushTypeError(errors, pathFor(pathLabel, "notes"), "string", report.notes);
|
|
1026
|
-
if (errors.length > 0) return { errors };
|
|
1027
|
-
const hasReportField = report.criteriaSatisfied !== undefined
|
|
1028
|
-
|| report.changedFiles !== undefined
|
|
1029
|
-
|| report.testsAddedOrUpdated !== undefined
|
|
1030
|
-
|| report.commandsRun !== undefined
|
|
1031
|
-
|| report.validationOutput !== undefined
|
|
1032
|
-
|| report.residualRisks !== undefined
|
|
1033
|
-
|| report.noStagedFiles !== undefined
|
|
1034
|
-
|| report.diffSummary !== undefined
|
|
1035
|
-
|| report.manualNotes !== undefined
|
|
1036
|
-
|| report.notes !== undefined
|
|
1037
|
-
|| report.reviewFindings !== undefined;
|
|
1038
|
-
return hasReportField
|
|
1039
|
-
? { report, errors }
|
|
1040
|
-
: { errors: [`${pathLabel || "acceptance-report"}: expected at least one acceptance report field`] };
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
function checkCriteriaSatisfied(criteria: ResolvedAcceptanceGate[], report: AcceptanceReport): AcceptanceRuntimeCheck[] {
|
|
1044
|
-
const reports = new Map((report.criteriaSatisfied ?? []).filter((item) => item.id).map((item) => [normalizedToken(item.id!), item]));
|
|
1045
|
-
return criteria.filter((criterion) => criterion.severity !== "recommended").map((criterion) => {
|
|
1046
|
-
const item = reports.get(normalizedToken(criterion.id));
|
|
1047
|
-
if (!item) return { id: `criterion:${criterion.id}`, status: "failed", message: `Required criterion '${criterion.id}' was not reported.` };
|
|
1048
|
-
if (item.status !== "satisfied") return { id: `criterion:${criterion.id}`, status: "failed", message: `Required criterion '${criterion.id}' was reported as ${item.status}.` };
|
|
1049
|
-
return { id: `criterion:${criterion.id}`, status: "passed", message: `Required criterion '${criterion.id}' satisfied.` };
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
function reportEvidenceStatus(report: AcceptanceReport, kind: AcceptanceEvidenceKind): AcceptanceRuntimeCheckStatus {
|
|
1054
|
-
switch (kind) {
|
|
1055
|
-
case "changed-files":
|
|
1056
|
-
if (!isStringArray(report.changedFiles)) return "failed";
|
|
1057
|
-
return report.changedFiles.length === 0 ? "not-applicable" : "passed";
|
|
1058
|
-
case "tests-added":
|
|
1059
|
-
if (!isStringArray(report.testsAddedOrUpdated)) return "failed";
|
|
1060
|
-
return report.testsAddedOrUpdated.length === 0 ? "not-applicable" : "passed";
|
|
1061
|
-
case "commands-run": return Array.isArray(report.commandsRun) && report.commandsRun.length > 0 ? "passed" : "failed";
|
|
1062
|
-
case "validation-output": return isStringArray(report.validationOutput) && report.validationOutput.length > 0 ? "passed" : "failed";
|
|
1063
|
-
case "residual-risks": return isStringArray(report.residualRisks) ? "passed" : "failed";
|
|
1064
|
-
case "no-staged-files": return report.noStagedFiles === true ? "passed" : "failed";
|
|
1065
|
-
case "diff-summary": return typeof report.diffSummary === "string" && report.diffSummary.trim().length > 0 ? "passed" : "failed";
|
|
1066
|
-
case "review-findings": return isStringArray(report.reviewFindings) ? "passed" : "failed";
|
|
1067
|
-
case "manual-notes": return Boolean((report.manualNotes ?? report.notes)?.trim()) ? "passed" : "failed";
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
function checkNoStagedFiles(cwd: string): AcceptanceRuntimeCheck {
|
|
1072
|
-
const result = spawnSync("git", ["status", "--short"], { cwd, encoding: "utf-8", windowsHide: true });
|
|
1073
|
-
if (result.status !== 0) {
|
|
1074
|
-
return { id: "no-staged-files", status: "not-applicable", message: "git status unavailable; no staged-files check skipped" };
|
|
1075
|
-
}
|
|
1076
|
-
const staged = result.stdout.split(/\r?\n/).filter((line) => line.length >= 2 && line[0] !== " " && line[0] !== "?");
|
|
1077
|
-
return staged.length === 0
|
|
1078
|
-
? { id: "no-staged-files", status: "passed", message: "No staged files detected." }
|
|
1079
|
-
: { id: "no-staged-files", status: "failed", message: `Staged files present: ${staged.join(", ")}` };
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
function runStructuralChecks(acceptance: ResolvedAcceptanceConfig, report: AcceptanceReport, cwd: string): AcceptanceRuntimeCheck[] {
|
|
1083
|
-
const checks: AcceptanceRuntimeCheck[] = [];
|
|
1084
|
-
for (const kind of acceptance.evidence) {
|
|
1085
|
-
if (kind === "no-staged-files" && report.noStagedFiles === undefined) continue;
|
|
1086
|
-
const status = reportEvidenceStatus(report, kind);
|
|
1087
|
-
checks.push({
|
|
1088
|
-
id: `evidence:${kind}`,
|
|
1089
|
-
status,
|
|
1090
|
-
message: status === "passed"
|
|
1091
|
-
? `${kind} evidence present.`
|
|
1092
|
-
: status === "not-applicable"
|
|
1093
|
-
? `${kind} evidence explicitly reported as not applicable.`
|
|
1094
|
-
: `${kind} evidence missing from child report.`,
|
|
1095
|
-
});
|
|
1096
|
-
}
|
|
1097
|
-
if (acceptance.evidence.includes("no-staged-files")) checks.push(checkNoStagedFiles(cwd));
|
|
1098
|
-
return checks;
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
function trimOutput(value: string): string | undefined {
|
|
1102
|
-
const trimmed = value.trim();
|
|
1103
|
-
if (!trimmed) return undefined;
|
|
1104
|
-
return trimmed.length > 12_000 ? `${trimmed.slice(0, 12_000)}\n...[truncated]` : trimmed;
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
const SENSITIVE_ENV_KEY_PATTERN = /(?:^|_)(?:TOKEN|SECRET|PASSWORD|PASS|AUTH|CREDENTIAL|COOKIE|SESSION|PRIVATE|API_KEY|ACCESS_KEY)(?:_|$)/i;
|
|
1108
|
-
|
|
1109
|
-
function effectiveVerifyEnv(env: Record<string, string> | undefined): Record<string, string> {
|
|
1110
|
-
const inherited = Object.fromEntries(Object.entries(process.env).flatMap(([key, value]) => {
|
|
1111
|
-
return typeof value === "string" ? [[key, value]] : [];
|
|
1112
|
-
}));
|
|
1113
|
-
return { ...inherited, ...(env ?? {}) };
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
function verifyRedactionEnv(env: Record<string, string> | undefined): Record<string, string> {
|
|
1117
|
-
return Object.fromEntries(Object.entries(effectiveVerifyEnv(env)).filter(([key, value]) => {
|
|
1118
|
-
return value.length >= 4 && SENSITIVE_ENV_KEY_PATTERN.test(key);
|
|
1119
|
-
}));
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
function redactVerifyEnv(value: string, env: Record<string, string> | undefined): string {
|
|
1123
|
-
let redacted = value;
|
|
1124
|
-
const secrets = [...new Set(Object.values(verifyRedactionEnv(env)).filter(Boolean))].sort((left, right) => right.length - left.length);
|
|
1125
|
-
for (const secret of secrets) redacted = redacted.replaceAll(secret, "[REDACTED]");
|
|
1126
|
-
return redacted;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
function uniqueStrings(items: Array<string | undefined>): string[] {
|
|
1130
|
-
return unique(items.map((item) => item?.trim()).filter((item): item is string => Boolean(item)));
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
export function aggregateAcceptanceReport(input: {
|
|
1134
|
-
results: Array<Pick<SingleResult, "agent" | "acceptance" | "error"> & { exitCode: number | null }>;
|
|
1135
|
-
notes?: string;
|
|
1136
|
-
}): AcceptanceReport {
|
|
1137
|
-
const childReports = input.results.map((result) => result.acceptance?.childReport).filter((report): report is AcceptanceReport => Boolean(report));
|
|
1138
|
-
const blockers = input.results.filter((result) => result.exitCode !== 0 || result.acceptance?.status === "rejected");
|
|
1139
|
-
const successfulChildren = input.results.length > 0 && blockers.length === 0;
|
|
1140
|
-
return {
|
|
1141
|
-
criteriaSatisfied: [
|
|
1142
|
-
{ id: "criterion-1", status: successfulChildren ? "satisfied" : "not-satisfied", evidence: successfulChildren ? `All ${input.results.length} dynamic child run(s) completed without child or acceptance blockers.` : "Dynamic fanout produced no accepted child evidence." },
|
|
1143
|
-
{ id: "criterion-2", status: successfulChildren ? "satisfied" : "not-satisfied", evidence: successfulChildren ? "Collected child acceptance evidence for aggregate review." : "Dynamic fanout produced no aggregate review evidence." },
|
|
1144
|
-
...input.results.map((result, index): { id?: string; status: "satisfied" | "not-satisfied" | "not-applicable"; evidence: string } => ({
|
|
1145
|
-
id: `child-${index + 1}`,
|
|
1146
|
-
status: result.exitCode === 0 && result.acceptance?.status !== "rejected" ? "satisfied" : "not-satisfied",
|
|
1147
|
-
evidence: `${result.agent}: acceptance ${result.acceptance?.status ?? "unreported"}${result.error ? ` (${result.error})` : ""}`,
|
|
1148
|
-
})),
|
|
1149
|
-
],
|
|
1150
|
-
changedFiles: uniqueStrings(childReports.flatMap((report) => report.changedFiles ?? [])),
|
|
1151
|
-
testsAddedOrUpdated: uniqueStrings(childReports.flatMap((report) => report.testsAddedOrUpdated ?? [])),
|
|
1152
|
-
commandsRun: childReports.flatMap((report) => report.commandsRun ?? []),
|
|
1153
|
-
validationOutput: uniqueStrings(childReports.flatMap((report) => report.validationOutput ?? [])),
|
|
1154
|
-
residualRisks: uniqueStrings([
|
|
1155
|
-
...childReports.flatMap((report) => report.residualRisks ?? []),
|
|
1156
|
-
...blockers.map((result) => `${result.agent}: ${result.error ?? "child or acceptance gate failed"}`),
|
|
1157
|
-
]),
|
|
1158
|
-
noStagedFiles: childReports.length > 0 && childReports.every((report) => report.noStagedFiles === true),
|
|
1159
|
-
reviewFindings: uniqueStrings(childReports.flatMap((report) => report.reviewFindings ?? [])),
|
|
1160
|
-
manualNotes: input.notes ?? `Aggregated acceptance evidence from ${input.results.length} dynamic fanout child run(s).`,
|
|
1161
|
-
notes: input.notes,
|
|
1162
|
-
};
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
const DEFAULT_VERIFY_TIMEOUT_MS = 120_000;
|
|
1166
|
-
|
|
1167
|
-
function hash(value: string): string {
|
|
1168
|
-
return createHash("sha256").update(value).digest("hex");
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
interface VerifyWorkspaceState {
|
|
1172
|
-
kind: "git-tracked";
|
|
1173
|
-
repoRoot: string;
|
|
1174
|
-
cwdRelative: string;
|
|
1175
|
-
head: string;
|
|
1176
|
-
diffHash: string;
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
function readVerifyWorkspaceState(cwd: string): VerifyWorkspaceState | undefined {
|
|
1180
|
-
const repo = spawnSync("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf-8", windowsHide: true });
|
|
1181
|
-
if (repo.status !== 0 || !repo.stdout.trim()) return undefined;
|
|
1182
|
-
const repoRoot = fs.realpathSync(repo.stdout.trim());
|
|
1183
|
-
const head = spawnSync("git", ["rev-parse", "HEAD"], { cwd: repoRoot, encoding: "utf-8", windowsHide: true });
|
|
1184
|
-
const diff = spawnSync("git", ["diff", "--binary", "--full-index", "HEAD", "--"], { cwd: repoRoot, encoding: "utf-8", maxBuffer: 50 * 1024 * 1024, windowsHide: true });
|
|
1185
|
-
if (head.status !== 0 || diff.status !== 0 || !head.stdout.trim()) return undefined;
|
|
1186
|
-
return {
|
|
1187
|
-
kind: "git-tracked",
|
|
1188
|
-
repoRoot,
|
|
1189
|
-
cwdRelative: path.relative(repoRoot, fs.realpathSync(cwd)) || ".",
|
|
1190
|
-
head: head.stdout.trim(),
|
|
1191
|
-
diffHash: hash(diff.stdout),
|
|
1192
|
-
};
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
function isCachedVerifyResult(value: unknown): value is AcceptanceVerifyResult {
|
|
1196
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
1197
|
-
const result = value as Partial<AcceptanceVerifyResult>;
|
|
1198
|
-
return typeof result.id === "string"
|
|
1199
|
-
&& typeof result.command === "string"
|
|
1200
|
-
&& (typeof result.exitCode === "number" || result.exitCode === null)
|
|
1201
|
-
&& (result.status === "passed" || result.status === "failed" || result.status === "timed-out" || result.status === "allowed-failure")
|
|
1202
|
-
&& typeof result.durationMs === "number";
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
async function runMemoizedVerifyCommand(command: AcceptanceVerifyCommand, defaultCwd: string, options: {
|
|
1206
|
-
signal?: AbortSignal;
|
|
1207
|
-
abortMessage?: string;
|
|
1208
|
-
artifactsDir?: string;
|
|
1209
|
-
runId?: string;
|
|
1210
|
-
} = {}): Promise<AcceptanceVerifyResult> {
|
|
1211
|
-
const cwd = command.cwd ? path.resolve(defaultCwd, command.cwd) : defaultCwd;
|
|
1212
|
-
let workspaceState: VerifyWorkspaceState | undefined;
|
|
1213
|
-
try {
|
|
1214
|
-
workspaceState = readVerifyWorkspaceState(cwd);
|
|
1215
|
-
} catch {
|
|
1216
|
-
workspaceState = undefined;
|
|
1217
|
-
}
|
|
1218
|
-
if (!workspaceState || !options.artifactsDir || !options.runId) {
|
|
1219
|
-
return runVerifyCommand(command, defaultCwd, options);
|
|
1220
|
-
}
|
|
1221
|
-
const envKeys = Object.keys(command.env ?? {}).sort();
|
|
1222
|
-
const envHash = hash(JSON.stringify(Object.fromEntries(Object.entries(effectiveVerifyEnv(command.env)).sort(([left], [right]) => left.localeCompare(right)))));
|
|
1223
|
-
const timeoutMs = command.timeoutMs ?? DEFAULT_VERIFY_TIMEOUT_MS;
|
|
1224
|
-
const cacheKey = hash(JSON.stringify({
|
|
1225
|
-
version: 1,
|
|
1226
|
-
command: command.command,
|
|
1227
|
-
cwdRelative: workspaceState.cwdRelative,
|
|
1228
|
-
envKeys,
|
|
1229
|
-
envHash,
|
|
1230
|
-
timeoutMs,
|
|
1231
|
-
allowFailure: command.allowFailure === true,
|
|
1232
|
-
head: workspaceState.head,
|
|
1233
|
-
diffHash: workspaceState.diffHash,
|
|
1234
|
-
}));
|
|
1235
|
-
const artifactPath = path.join(options.artifactsDir, "acceptance", "verify", options.runId, `${cacheKey}.json`);
|
|
1236
|
-
try {
|
|
1237
|
-
const cached = JSON.parse(fs.readFileSync(artifactPath, "utf-8")) as { cacheKey?: unknown; result?: unknown };
|
|
1238
|
-
if (cached.cacheKey === cacheKey && isCachedVerifyResult(cached.result)) {
|
|
1239
|
-
return { ...cached.result, id: command.id, command: command.command, cwd, artifactPath, cacheKey, memoized: true, envKeys, envHash, workspaceState };
|
|
1240
|
-
}
|
|
1241
|
-
} catch {
|
|
1242
|
-
// A cache miss or unreadable artifact must not prevent host verification.
|
|
1243
|
-
}
|
|
1244
|
-
const result = await runVerifyCommand(command, defaultCwd, options);
|
|
1245
|
-
const evidenced: AcceptanceVerifyResult = { ...result, artifactPath, cacheKey, memoized: false, envKeys, envHash, workspaceState };
|
|
1246
|
-
try {
|
|
1247
|
-
fs.mkdirSync(path.dirname(artifactPath), { recursive: true });
|
|
1248
|
-
fs.writeFileSync(artifactPath, JSON.stringify({
|
|
1249
|
-
version: 1,
|
|
1250
|
-
cacheKey,
|
|
1251
|
-
command: command.command,
|
|
1252
|
-
cwdRelative: workspaceState.cwdRelative,
|
|
1253
|
-
envKeys,
|
|
1254
|
-
envHash,
|
|
1255
|
-
timeoutMs,
|
|
1256
|
-
allowFailure: command.allowFailure === true,
|
|
1257
|
-
workspaceState,
|
|
1258
|
-
result: evidenced,
|
|
1259
|
-
}, null, 2), "utf-8");
|
|
1260
|
-
} catch (error) {
|
|
1261
|
-
evidenced.artifactError = error instanceof Error ? error.message : String(error);
|
|
1262
|
-
delete evidenced.artifactPath;
|
|
1263
|
-
}
|
|
1264
|
-
return evidenced;
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
/**
|
|
1268
|
-
* On Windows with `shell: true`, cmd.exe parses the command line itself and an
|
|
1269
|
-
* unquoted executable path containing spaces (e.g. `C:\Program Files\...\tool.exe`)
|
|
1270
|
-
* is split at the first space, so cmd tries to run `C:\Program` and fails.
|
|
1271
|
-
*
|
|
1272
|
-
* The command line is ambiguous, so only an unquoted absolute drive path with
|
|
1273
|
-
* a space in a directory component is safe to identify as an executable. That
|
|
1274
|
-
* path is quoted; everything after it is preserved as arguments.
|
|
1275
|
-
*
|
|
1276
|
-
* Commands that already start with a quote, single-token commands, and commands
|
|
1277
|
-
* whose first token already ends in an executable extension are returned
|
|
1278
|
-
* unchanged. Non-Windows platforms pass the command through untouched.
|
|
1279
|
-
*/
|
|
1280
|
-
export function quoteExecutableForShell(command: string, platform: string = process.platform): string {
|
|
1281
|
-
if (platform !== "win32") return command;
|
|
1282
|
-
const trimmed = command.trimStart();
|
|
1283
|
-
if (trimmed.startsWith("\"")) return command;
|
|
1284
|
-
const firstToken = trimmed.match(/^\S+/)?.[0];
|
|
1285
|
-
if (/\.(?:exe|bat|cmd|com|ps1)$/i.test(firstToken ?? "")) return command;
|
|
1286
|
-
const match = trimmed.match(/^([A-Za-z]:\\[^"<>|&*?\r\n]*?\s[^"<>|&*?\r\n]*?\\[^"<>|&*?\r\n]*?\.(?:exe|bat|cmd|com|ps1))(?=\s|$)/i);
|
|
1287
|
-
const executable = match?.[1];
|
|
1288
|
-
if (executable && /\s/.test(executable) && !/[A-Za-z]:\\/.test(executable.slice(3))) {
|
|
1289
|
-
const rest = trimmed.slice(executable.length);
|
|
1290
|
-
const leading = command.slice(0, command.length - trimmed.length);
|
|
1291
|
-
return `${leading}"${executable}"${rest}`;
|
|
1292
|
-
}
|
|
1293
|
-
const extensionlessSpacedFilenameMatch = trimmed.match(/^([A-Za-z]:\\[^"<>|&*?\r\n]*?\s[^"<>|&*?\r\n]*?)(?=\s+--|$)/i);
|
|
1294
|
-
const extensionlessSpacedFilename = extensionlessSpacedFilenameMatch?.[1];
|
|
1295
|
-
if (extensionlessSpacedFilename && /\s/.test(extensionlessSpacedFilename.slice(0, extensionlessSpacedFilename.lastIndexOf("\\"))) && !/[A-Za-z]:\\/.test(extensionlessSpacedFilename.slice(3))) {
|
|
1296
|
-
const rest = trimmed.slice(extensionlessSpacedFilename.length);
|
|
1297
|
-
const leading = command.slice(0, command.length - trimmed.length);
|
|
1298
|
-
return `${leading}"${extensionlessSpacedFilename}"${rest}`;
|
|
1299
|
-
}
|
|
1300
|
-
const extensionlessMatch = trimmed.match(/^([A-Za-z]:\\[^"<>|&*?\r\n]*?\s[^"<>|&*?\r\n]*?\\[^"<>|&*?\s\r\n]+)(?=\s|$)/i);
|
|
1301
|
-
const extensionlessExecutable = extensionlessMatch?.[1];
|
|
1302
|
-
if (extensionlessExecutable && /\s/.test(extensionlessExecutable) && !/[A-Za-z]:\\/.test(extensionlessExecutable.slice(3)) && !/\s/.test(extensionlessExecutable.slice(extensionlessExecutable.lastIndexOf("\\") + 1))) {
|
|
1303
|
-
const rest = trimmed.slice(extensionlessExecutable.length);
|
|
1304
|
-
const leading = command.slice(0, command.length - trimmed.length);
|
|
1305
|
-
return `${leading}"${extensionlessExecutable}"${rest}`;
|
|
1306
|
-
}
|
|
1307
|
-
return command;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
function runVerifyCommand(command: AcceptanceVerifyCommand, defaultCwd: string, options: { signal?: AbortSignal; abortMessage?: string } = {}): Promise<AcceptanceVerifyResult> {
|
|
1311
|
-
return new Promise((resolve) => {
|
|
1312
|
-
const startedAt = Date.now();
|
|
1313
|
-
const cwd = command.cwd ? path.resolve(defaultCwd, command.cwd) : defaultCwd;
|
|
1314
|
-
let stdout = "";
|
|
1315
|
-
let stderr = "";
|
|
1316
|
-
let timedOut = false;
|
|
1317
|
-
let settled = false;
|
|
1318
|
-
let hardKill: NodeJS.Timeout | undefined;
|
|
1319
|
-
const child = spawn(quoteExecutableForShell(command.command), {
|
|
1320
|
-
cwd,
|
|
1321
|
-
env: effectiveVerifyEnv(command.env),
|
|
1322
|
-
shell: true,
|
|
1323
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
1324
|
-
windowsHide: true,
|
|
1325
|
-
});
|
|
1326
|
-
const finish = (result: Omit<AcceptanceVerifyResult, "id" | "command" | "cwd" | "durationMs">) => {
|
|
1327
|
-
if (settled) return;
|
|
1328
|
-
settled = true;
|
|
1329
|
-
clearTimeout(timeout);
|
|
1330
|
-
if (hardKill) clearTimeout(hardKill);
|
|
1331
|
-
options.signal?.removeEventListener("abort", abortVerification);
|
|
1332
|
-
resolve({
|
|
1333
|
-
id: command.id,
|
|
1334
|
-
command: command.command,
|
|
1335
|
-
cwd,
|
|
1336
|
-
durationMs: Date.now() - startedAt,
|
|
1337
|
-
...result,
|
|
1338
|
-
});
|
|
1339
|
-
};
|
|
1340
|
-
const abortVerification = () => {
|
|
1341
|
-
if (settled || timedOut) return;
|
|
1342
|
-
timedOut = true;
|
|
1343
|
-
child.kill("SIGTERM");
|
|
1344
|
-
hardKill = setTimeout(() => {
|
|
1345
|
-
child.kill("SIGKILL");
|
|
1346
|
-
finish({
|
|
1347
|
-
exitCode: null,
|
|
1348
|
-
status: "timed-out",
|
|
1349
|
-
stdout: trimOutput(redactVerifyEnv(stdout, command.env)),
|
|
1350
|
-
stderr: trimOutput(redactVerifyEnv(stderr || options.abortMessage || "Acceptance verification timed out.", command.env)),
|
|
1351
|
-
});
|
|
1352
|
-
}, 1000);
|
|
1353
|
-
hardKill.unref?.();
|
|
1354
|
-
};
|
|
1355
|
-
const timeout = setTimeout(abortVerification, command.timeoutMs ?? DEFAULT_VERIFY_TIMEOUT_MS);
|
|
1356
|
-
timeout.unref?.();
|
|
1357
|
-
if (options.signal?.aborted) abortVerification();
|
|
1358
|
-
else options.signal?.addEventListener("abort", abortVerification, { once: true });
|
|
1359
|
-
child.stdout.on("data", (chunk: Buffer) => {
|
|
1360
|
-
stdout += chunk.toString();
|
|
1361
|
-
});
|
|
1362
|
-
child.stderr.on("data", (chunk: Buffer) => {
|
|
1363
|
-
stderr += chunk.toString();
|
|
1364
|
-
});
|
|
1365
|
-
child.on("close", (exitCode) => {
|
|
1366
|
-
const passed = exitCode === 0 && !timedOut;
|
|
1367
|
-
finish({
|
|
1368
|
-
exitCode,
|
|
1369
|
-
status: timedOut ? "timed-out" : passed ? "passed" : command.allowFailure ? "allowed-failure" : "failed",
|
|
1370
|
-
stdout: trimOutput(redactVerifyEnv(stdout, command.env)),
|
|
1371
|
-
stderr: trimOutput(redactVerifyEnv(stderr || (timedOut ? options.abortMessage ?? "" : ""), command.env)),
|
|
1372
|
-
});
|
|
1373
|
-
});
|
|
1374
|
-
child.on("error", (error) => {
|
|
1375
|
-
finish({
|
|
1376
|
-
exitCode: timedOut ? null : 1,
|
|
1377
|
-
status: timedOut ? "timed-out" : command.allowFailure ? "allowed-failure" : "failed",
|
|
1378
|
-
stderr: timedOut
|
|
1379
|
-
? trimOutput(redactVerifyEnv(stderr || options.abortMessage || "Acceptance verification timed out.", command.env))
|
|
1380
|
-
: redactVerifyEnv(error instanceof Error ? error.message : String(error), command.env),
|
|
1381
|
-
});
|
|
1382
|
-
});
|
|
1383
|
-
});
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
export async function evaluateAcceptance(input: {
|
|
1387
|
-
acceptance: ResolvedAcceptanceConfig;
|
|
1388
|
-
output: string;
|
|
1389
|
-
cwd: string;
|
|
1390
|
-
/**
|
|
1391
|
-
* Content the child sent to its configured output file (from its own write
|
|
1392
|
-
* tool calls, not from disk, so a concurrent writer to the same path cannot
|
|
1393
|
-
* be misattributed). Searched for the acceptance report; searched before
|
|
1394
|
-
* the assistant output when `authoritative` (outputMode "file-only").
|
|
1395
|
-
*/
|
|
1396
|
-
fileOutput?: { content: string; path: string; authoritative?: boolean; durable?: boolean };
|
|
1397
|
-
report?: AcceptanceReport;
|
|
1398
|
-
reportError?: string;
|
|
1399
|
-
reviewResult?: AcceptanceReviewResult;
|
|
1400
|
-
signal?: AbortSignal;
|
|
1401
|
-
abortMessage?: string;
|
|
1402
|
-
reportOptional?: boolean;
|
|
1403
|
-
artifactsDir?: string;
|
|
1404
|
-
runId?: string;
|
|
1405
|
-
watchdog?: ChildWatchdogProgress;
|
|
1406
|
-
}): Promise<AcceptanceLedger> {
|
|
1407
|
-
const acceptance = input.acceptance;
|
|
1408
|
-
const initialStatus = acceptance.level === "none" ? "not-required" : "claimed";
|
|
1409
|
-
const ledger: AcceptanceLedger = {
|
|
1410
|
-
status: initialStatus,
|
|
1411
|
-
evidenceStatus: initialStatus,
|
|
1412
|
-
explicit: acceptance.explicit,
|
|
1413
|
-
effectiveAcceptance: acceptance,
|
|
1414
|
-
inferredReason: acceptance.inferredReason,
|
|
1415
|
-
criteria: acceptance.criteria,
|
|
1416
|
-
runtimeChecks: [],
|
|
1417
|
-
verifyRuns: [],
|
|
1418
|
-
};
|
|
1419
|
-
if (acceptance.level === "none") return ledger;
|
|
1420
|
-
|
|
1421
|
-
if (input.watchdog) {
|
|
1422
|
-
const unresolved = unresolvedChildWatchdogBlockers(input.watchdog);
|
|
1423
|
-
ledger.runtimeChecks.push(unresolved.length
|
|
1424
|
-
? { id: "watchdog-blocker", status: "failed", message: "Unresolved watchdog blocker (details are available in child watchdog status)." }
|
|
1425
|
-
: { id: "watchdog-blocker", status: "passed", message: "No unresolved watchdog blockers." });
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
const parsed: AcceptanceReportParseResult = input.reportError
|
|
1429
|
-
? { error: input.reportError }
|
|
1430
|
-
: input.report !== undefined
|
|
1431
|
-
? (() => {
|
|
1432
|
-
const validation = validateAcceptanceReport(input.report);
|
|
1433
|
-
return validation.report
|
|
1434
|
-
? { report: validation.report }
|
|
1435
|
-
: { error: `Failed to parse acceptance-report: Invalid acceptance-report: ${validation.errors.join("; ")}`, malformed: true };
|
|
1436
|
-
})()
|
|
1437
|
-
: parseAcceptanceReportSources(input.output, input.fileOutput);
|
|
1438
|
-
const durableFileOutput = input.fileOutput?.authoritative && input.fileOutput.durable ? input.fileOutput : undefined;
|
|
1439
|
-
if (parsed.malformed && parsed.sourcePath && durableFileOutput) {
|
|
1440
|
-
ledger.recovery = {
|
|
1441
|
-
status: "available-for-review",
|
|
1442
|
-
reason: "acceptance-metadata-rejected",
|
|
1443
|
-
reportPath: parsed.sourcePath,
|
|
1444
|
-
reportHash: hash(durableFileOutput.content),
|
|
1445
|
-
};
|
|
1446
|
-
}
|
|
1447
|
-
const needsReport = acceptanceRequiresChildReport(acceptance);
|
|
1448
|
-
if (parsed.report) {
|
|
1449
|
-
ledger.childReport = parsed.report;
|
|
1450
|
-
ledger.status = "attested";
|
|
1451
|
-
ledger.evidenceStatus = "attested";
|
|
1452
|
-
} else if (!input.reportOptional || needsReport || parsed.error !== ACCEPTANCE_REPORT_NOT_FOUND) {
|
|
1453
|
-
ledger.childReportParseError = parsed.error;
|
|
1454
|
-
ledger.runtimeChecks.push({ id: "attestation", status: "failed", message: parsed.error ?? "Structured acceptance report missing." });
|
|
1455
|
-
if (ledger.recovery) {
|
|
1456
|
-
ledger.status = "rejected";
|
|
1457
|
-
ledger.evidenceStatus = "rejected";
|
|
1458
|
-
}
|
|
1459
|
-
if (!input.reportOptional) {
|
|
1460
|
-
ledger.status = "rejected";
|
|
1461
|
-
ledger.evidenceStatus = "rejected";
|
|
1462
|
-
return ledger;
|
|
1463
|
-
}
|
|
1464
|
-
} else {
|
|
1465
|
-
ledger.childReportParseError = parsed.error;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
if (parsed.report && LEVEL_RANK[acceptance.level] >= LEVEL_RANK.checked) {
|
|
1469
|
-
ledger.runtimeChecks = [
|
|
1470
|
-
...ledger.runtimeChecks,
|
|
1471
|
-
...checkCriteriaSatisfied(acceptance.criteria, parsed.report),
|
|
1472
|
-
...runStructuralChecks(acceptance, parsed.report, input.cwd),
|
|
1473
|
-
];
|
|
1474
|
-
if (!ledger.runtimeChecks.some((check) => check.status === "failed")) {
|
|
1475
|
-
ledger.status = "checked";
|
|
1476
|
-
ledger.evidenceStatus = "checked";
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
if (LEVEL_RANK[acceptance.level] >= LEVEL_RANK.verified && (acceptance.level === "verified" || acceptance.verify.length > 0)) {
|
|
1481
|
-
if (acceptance.level === "verified" && acceptance.verify.length === 0) {
|
|
1482
|
-
ledger.runtimeChecks.push({ id: "verification-config", status: "failed", message: "verified acceptance requires runtime verify commands." });
|
|
1483
|
-
ledger.status = "rejected";
|
|
1484
|
-
ledger.evidenceStatus = "rejected";
|
|
1485
|
-
return ledger;
|
|
1486
|
-
}
|
|
1487
|
-
ledger.verifyRuns = [];
|
|
1488
|
-
for (const command of acceptance.verify) {
|
|
1489
|
-
ledger.verifyRuns.push(await runMemoizedVerifyCommand(command, input.cwd, {
|
|
1490
|
-
signal: input.signal,
|
|
1491
|
-
abortMessage: input.abortMessage,
|
|
1492
|
-
artifactsDir: input.artifactsDir,
|
|
1493
|
-
runId: input.runId,
|
|
1494
|
-
}));
|
|
1495
|
-
if (input.signal?.aborted) break;
|
|
1496
|
-
}
|
|
1497
|
-
if (ledger.verifyRuns.some((run) => run.status === "failed" || run.status === "timed-out")) {
|
|
1498
|
-
ledger.status = "rejected";
|
|
1499
|
-
ledger.evidenceStatus = "rejected";
|
|
1500
|
-
return ledger;
|
|
1501
|
-
}
|
|
1502
|
-
if (!ledger.runtimeChecks.some((check) => check.status === "failed")) {
|
|
1503
|
-
ledger.status = "verified";
|
|
1504
|
-
ledger.evidenceStatus = "verified";
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
if (ledger.runtimeChecks.some((check) => check.status === "failed")) {
|
|
1509
|
-
ledger.status = "rejected";
|
|
1510
|
-
ledger.evidenceStatus = "rejected";
|
|
1511
|
-
return ledger;
|
|
1512
|
-
}
|
|
1513
|
-
if (ledger.status === "claimed") {
|
|
1514
|
-
ledger.status = acceptance.level === "verified" ? "verified" : acceptance.level;
|
|
1515
|
-
ledger.evidenceStatus = ledger.status;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
if (acceptance.review) {
|
|
1519
|
-
if (input.reviewResult?.status === "reviewed") {
|
|
1520
|
-
ledger.reviewResult = input.reviewResult;
|
|
1521
|
-
ledger.status = "reviewed";
|
|
1522
|
-
} else if (input.reviewResult?.status === "blockers") {
|
|
1523
|
-
ledger.reviewResult = input.reviewResult;
|
|
1524
|
-
ledger.status = "rejected";
|
|
1525
|
-
} else if (acceptance.review.required !== false) {
|
|
1526
|
-
ledger.reviewResult = input.reviewResult ?? {
|
|
1527
|
-
status: "review-required",
|
|
1528
|
-
findings: [{
|
|
1529
|
-
severity: "non-blocking",
|
|
1530
|
-
issue: "Independent review has not been supplied.",
|
|
1531
|
-
rationale: "The run cannot be marked reviewed from child evidence alone.",
|
|
1532
|
-
}],
|
|
1533
|
-
};
|
|
1534
|
-
ledger.status = "review-required";
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
return ledger;
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
export function buildSkippedAcceptanceLedger(acceptance: ResolvedAcceptanceConfig, input: { id: string; message: string }): AcceptanceLedger {
|
|
1542
|
-
const status = acceptance.level === "none" ? "not-required" : "rejected";
|
|
1543
|
-
return {
|
|
1544
|
-
status,
|
|
1545
|
-
evidenceStatus: status,
|
|
1546
|
-
explicit: acceptance.explicit,
|
|
1547
|
-
effectiveAcceptance: acceptance,
|
|
1548
|
-
inferredReason: acceptance.inferredReason,
|
|
1549
|
-
criteria: acceptance.criteria,
|
|
1550
|
-
runtimeChecks: acceptance.level === "none"
|
|
1551
|
-
? []
|
|
1552
|
-
: [{ id: input.id, status: "failed", message: input.message }],
|
|
1553
|
-
verifyRuns: [],
|
|
1554
|
-
};
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
|
-
export function acceptanceFailureMessage(ledger: AcceptanceLedger): string | undefined {
|
|
1558
|
-
if (ledger.status !== "rejected") return undefined;
|
|
1559
|
-
const failedCheck = ledger.runtimeChecks.find((check) => check.status === "failed");
|
|
1560
|
-
if (failedCheck) return `Acceptance rejected: ${failedCheck.message}`;
|
|
1561
|
-
const failedVerify = ledger.verifyRuns.find((run) => run.status === "failed" || run.status === "timed-out");
|
|
1562
|
-
if (failedVerify) return `Acceptance verification '${failedVerify.id}' ${failedVerify.status}.`;
|
|
1563
|
-
if (ledger.reviewResult?.status === "blockers") return "Acceptance review found blockers.";
|
|
1564
|
-
return "Acceptance rejected.";
|
|
1565
|
-
}
|