@chankov/agent-fleet 2.0.14 → 2.0.15
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/.pi/agent-fleet/scripts/fleet.ts +2 -1
- package/.pi/extensions/compact-and-continue/README.md +2 -2
- package/.pi/harnesses/agent-hub/README.md +89 -10
- package/.pi/harnesses/agent-hub/budget-recovery.ts +2 -2
- package/.pi/harnesses/agent-hub/commands/context.ts +2 -0
- package/.pi/harnesses/agent-hub/commands/recover.ts +13 -4
- package/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.pi/harnesses/agent-hub/context/budgets.ts +9 -7
- package/.pi/harnesses/agent-hub/deterministic-fs.ts +51 -12
- package/.pi/harnesses/agent-hub/dispatch-native-complete.ts +4 -0
- package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +14 -3
- package/.pi/harnesses/agent-hub/dispatch-native-types.ts +3 -0
- package/.pi/harnesses/agent-hub/dispatch-native.ts +9 -1
- package/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +2 -1
- package/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +2 -0
- package/.pi/harnesses/agent-hub/dispatch-triage-state.ts +23 -5
- package/.pi/harnesses/agent-hub/docs-lane.js +2 -1
- package/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.pi/harnesses/agent-hub/filesystem-tool.ts +75 -11
- package/.pi/harnesses/agent-hub/index.ts +246 -19
- package/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +13 -5
- package/.pi/harnesses/agent-hub/no-progress.ts +232 -28
- package/.pi/harnesses/agent-hub/orchestration-activation.ts +112 -0
- package/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.pi/harnesses/agent-hub/orchestration-route.ts +76 -0
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/policy/work-mode.ts +14 -5
- package/.pi/harnesses/agent-hub/process-obligations.ts +116 -15
- package/.pi/harnesses/agent-hub/prompts/fragments.ts +9 -11
- package/.pi/harnesses/agent-hub/recover-policy.ts +18 -1
- package/.pi/harnesses/agent-hub/recover-state.ts +1 -1
- package/.pi/harnesses/agent-hub/recovery-contract.ts +70 -0
- package/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.pi/harnesses/agent-hub/research/runtime.ts +2 -0
- package/.pi/harnesses/agent-hub/research/spawn-run.ts +15 -6
- package/.pi/harnesses/agent-hub/return-contract.js +27 -5
- package/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.pi/harnesses/agent-hub/run-budget.js +12 -0
- package/.pi/harnesses/agent-hub/scope-gate.js +23 -2
- package/.pi/harnesses/agent-hub/session-audit.ts +94 -8
- package/.pi/harnesses/agent-hub/spawn.ts +10 -2
- package/.pi/harnesses/agent-hub/system1-activity.ts +116 -1
- package/.pi/harnesses/agent-hub/system1-communication-store.ts +47 -13
- package/.pi/harnesses/agent-hub/system1-report.ts +50 -0
- package/.pi/harnesses/agent-hub/system1-runtime.ts +3 -2
- package/.pi/harnesses/agent-hub/task-triage-authorization.ts +122 -0
- package/.pi/harnesses/agent-hub/task-triage-config.ts +37 -0
- package/.pi/harnesses/agent-hub/task-triage-contract.ts +19 -0
- package/.pi/harnesses/agent-hub/task-triage-obligations.ts +104 -0
- package/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.pi/harnesses/agent-hub/task-triage-runtime.ts +125 -0
- package/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.pi/harnesses/agent-hub/tools/action-executors.ts +33 -10
- package/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +1 -1
- package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +86 -26
- package/.pi/harnesses/agent-hub/tools/herdr-executors.ts +9 -0
- package/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +9 -6
- package/.pi/harnesses/agent-hub/ui/fleet-source.ts +6 -2
- package/.pi/harnesses/agent-hub/ui/system1-communication.ts +1 -1
- package/.pi/harnesses/agent-hub/work-mode.ts +13 -8
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/context-budget-hub-prompt.ts +6 -1
- package/.pi/harnesses/lib/fleet-dashboard-view.ts +29 -4
- package/.pi/harnesses/lib/fleet-read-model.ts +73 -0
- package/.pi/harnesses/lib/system1/demo.ts +2 -4
- package/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.pi/prompts/af-build.md +9 -6
- package/.versions/2.0.15/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.15/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.15/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/coms-claude-bridge.ts +411 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/fleet.ts +217 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/flow.ts +157 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +210 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +34 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.15/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.15/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.15/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.15/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.15/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.15/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.15/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.15/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.15/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.15/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.15/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.15/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.15/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.15/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.15/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.15/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.15/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.15/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.15/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.15/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.15/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.15/.pi/extensions/package.json +9 -0
- package/.versions/2.0.15/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.15/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.15/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.15/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.15/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.15/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.15/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/README.md +1448 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/acceptance.ts +199 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/context.ts +47 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/config/agents.ts +178 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/config/overrides.ts +160 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/context/budgets.ts +206 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/delegate.ts +467 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/deterministic-fs.ts +166 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +259 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +231 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-native-types.ts +260 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-native.ts +234 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +38 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +76 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/filesystem-tool.ts +137 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/fixtures/registration-surface.json +64 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/index.ts +2597 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +133 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/no-progress.ts +563 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/orchestration-activation.ts +112 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/orchestration-route.ts +76 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/policy/work-mode.ts +135 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-config.ts +40 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-local.ts +88 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-observer.ts +105 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-rules.ts +143 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-runtime.ts +316 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-snapshot.ts +243 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/proactive-types.ts +63 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/process-obligations.ts +158 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/prompts/context.ts +54 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/prompts/fragments.ts +116 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/prompts/system-prompt.ts +122 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/recovery-contract.ts +150 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/research/runtime.ts +197 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/research/spawn-run.ts +183 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/return-contract.js +349 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/review-findings.js +104 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/run-budget.js +554 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/scope-gate.js +144 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/session-audit.ts +313 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/spawn.ts +534 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/system1-communication-store.ts +129 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/system1-runtime.ts +280 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-authorization.ts +122 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-config.ts +37 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-contract.ts +19 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-live-stage-closure.user-run.mjs +336 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-obligations.ts +104 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-reviewer-only.user-run.mjs +157 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-runtime.ts +125 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/action-executors.ts +208 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/context.ts +144 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +558 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/herdr-executors.ts +95 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/spawn-research.ts +65 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/work-mode.ts +179 -0
- package/.versions/2.0.15/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.15/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.15/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.15/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.15/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.15/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
- package/.versions/2.0.15/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.15/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.15/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.15/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.15/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.15/.pi/harnesses/damage-control-continue/index.ts +550 -0
- package/.versions/2.0.15/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.15/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.15/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.15/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.15/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.15/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.15/.pi/harnesses/lib/context-budget-child-prompt.ts +219 -0
- package/.versions/2.0.15/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.0.15/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.15/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.15/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/2.0.15/.pi/harnesses/lib/deterministic-handle-path.ts +23 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.15/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.15/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.15/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.15/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.15/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.15/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.15/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.15/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.15/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.15/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.15/.pi/harnesses/lib/system1/config.js +61 -0
- package/.versions/2.0.15/.pi/harnesses/lib/system1/contracts.ts +152 -0
- package/.versions/2.0.15/.pi/harnesses/lib/system1/demo.ts +104 -0
- package/.versions/2.0.15/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.15/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.0.15/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.15/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.15/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.15/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.15/.pi/prompts/af-build.md +27 -0
- package/.versions/2.0.15/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.15/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.15/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.15/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.15/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.15/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.15/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.15/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.15/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.15/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.15/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.15/.version +1 -0
- package/.versions/2.0.15/agents/architect.md +24 -0
- package/.versions/2.0.15/agents/bowser.md +28 -0
- package/.versions/2.0.15/agents/builder.md +55 -0
- package/.versions/2.0.15/agents/code-reviewer.md +209 -0
- package/.versions/2.0.15/agents/deep-researcher.md +32 -0
- package/.versions/2.0.15/agents/documenter.md +22 -0
- package/.versions/2.0.15/agents/orchestrator.md +22 -0
- package/.versions/2.0.15/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.15/agents/planner.md +105 -0
- package/.versions/2.0.15/agents/releaser.md +24 -0
- package/.versions/2.0.15/agents/researcher.md +30 -0
- package/.versions/2.0.15/agents/security-auditor.md +167 -0
- package/.versions/2.0.15/agents/test-engineer.md +153 -0
- package/.versions/2.0.15/agents/web-debugger.md +44 -0
- package/.versions/2.0.15/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.15/bin/catalog/harness-runtime-closure.json +73 -0
- package/.versions/2.0.15/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.15/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.15/docs/ARCHITECTURE.md +829 -0
- package/.versions/2.0.15/docs/agent-fleet-setup.md +1090 -0
- package/.versions/2.0.15/docs/claude-code-coms-bridge.md +134 -0
- package/.versions/2.0.15/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.15/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.15/docs/getting-started.md +126 -0
- package/.versions/2.0.15/docs/npm-install.md +525 -0
- package/.versions/2.0.15/docs/pi-extensions.md +454 -0
- package/.versions/2.0.15/docs/pi-setup.md +92 -0
- package/.versions/2.0.15/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.15/install-manifest.json +3193 -0
- package/.versions/2.0.15/justfile +247 -0
- package/.versions/2.0.15/manifest-meta.json +1071 -0
- package/.versions/2.0.15/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.15/references/communication-contract.md +26 -0
- package/.versions/2.0.15/references/definition-of-done.md +67 -0
- package/.versions/2.0.15/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.15/references/observability-checklist.md +92 -0
- package/.versions/2.0.15/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.15/references/performance-checklist.md +236 -0
- package/.versions/2.0.15/references/prompting-patterns.md +380 -0
- package/.versions/2.0.15/references/security-checklist.md +245 -0
- package/.versions/2.0.15/references/testing-patterns.md +235 -0
- package/.versions/2.0.15/references/workflow-authoring.md +304 -0
- package/.versions/2.0.15/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.15/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.15/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.15/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.15/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.15/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.15/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.15/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.15/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.15/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.15/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.15/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.15/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.15/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.15/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.15/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.15/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.15/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.15/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.15/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.0.15/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.15/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.15/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.15/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.15/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.0.15/skills/repository-ai-setup/SKILL.md +117 -0
- package/.versions/2.0.15/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.15/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.15/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.15/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.15/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.15/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.15/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.15/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.15/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/agents/builder.md +2 -2
- package/bin/cli.js +16 -2
- package/bin/lib/apply.js +5 -0
- package/bin/lib/doctor.js +85 -12
- package/bin/lib/reconcile.js +9 -1
- package/bin/lib/state.js +1 -0
- package/bin/lib/task-triage-setup.js +76 -0
- package/bin/lib/transaction.js +4 -0
- package/docs/ARCHITECTURE.md +99 -24
- package/docs/agent-fleet-setup.md +179 -6
- package/docs/npm-install.md +64 -15
- package/docs/pi-extensions.md +1 -1
- package/install-manifest.json +13 -3
- package/manifest-meta.json +6 -0
- package/package.json +9 -2
- package/skills/incremental-implementation/SKILL.md +64 -13
- package/skills/planning-and-task-breakdown/SKILL.md +43 -14
- package/skills/using-agent-skills/SKILL.md +2 -2
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
// USER-RUN LIVE ONLY: node .pi/harnesses/agent-hub/task-triage-live-stage-closure.user-run.mjs --live
|
|
2
|
+
// Real provider spend. Never imported by offline tests or npm test.
|
|
3
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { appendFileSync, cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { reviewClosureUnmet, reviewReturnTemplate } from "./task-triage-review-contract.mjs";
|
|
10
|
+
|
|
11
|
+
if (process.argv.length !== 3 || process.argv[2] !== "--live") {
|
|
12
|
+
console.error("LIVE MODEL SPEND: opt in explicitly with --live; this is not an offline test.");
|
|
13
|
+
process.exitCode = 2;
|
|
14
|
+
} else {
|
|
15
|
+
await run();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function run() {
|
|
19
|
+
const root = fileURLToPath(new URL("../../../", import.meta.url));
|
|
20
|
+
const dir = mkdtempSync(join(tmpdir(), "t4-live-stage-closure-")); // retained, never delete evidence
|
|
21
|
+
const worktree = join(dir, "worktree");
|
|
22
|
+
const evidence = join(dir, "evidence");
|
|
23
|
+
const runtimeTmp = join(dir, "runtime-tmp"), compileCache = join(dir, "node-compile-cache");
|
|
24
|
+
for (const path of [evidence, runtimeTmp, compileCache, join(worktree, ".pi/agents/personas"), join(worktree, "skills/orchestration-verification")]) mkdirSync(path, { recursive: true });
|
|
25
|
+
// Only the public skill instructions required by the synthetic personas; no repo source or secrets.
|
|
26
|
+
cpSync(join(root, "skills/orchestration-verification/SKILL.md"), join(worktree, "skills/orchestration-verification/SKILL.md"));
|
|
27
|
+
const model = "openai-codex/gpt-6-luna";
|
|
28
|
+
const initial = "# Synthetic Widget (isolated test fixture)\n\nThe wdiget renders a greeting.\n\n## Steps\n\n1. Correct the typo.\n2. Keep every other byte unchanged.\n";
|
|
29
|
+
const expected = initial.replace("wdiget renders", "widget renders");
|
|
30
|
+
const expectedHash = createHash("sha256").update(expected).digest("hex");
|
|
31
|
+
const readme = join(worktree, "README-SYNTH.md");
|
|
32
|
+
const before = join(evidence, "README-before.md"), after = join(evidence, "README-after.md");
|
|
33
|
+
const beforeDiff = join(evidence, "README-before.git-diff.patch");
|
|
34
|
+
const afterDiff = join(evidence, "README-before-after.git-diff.patch");
|
|
35
|
+
writeFileSync(readme, initial);
|
|
36
|
+
writeFileSync(before, initial);
|
|
37
|
+
writeFileSync(join(worktree, ".pi/agents/teams.yaml"), "stage:\n - planner\n - builder\n - code-reviewer\n");
|
|
38
|
+
for (const [name, tools] of [["planner", "read,write,grep,find,ls"], ["builder", "read,edit,bash"], ["code-reviewer", "read,grep,find,ls"]]) {
|
|
39
|
+
writeFileSync(join(worktree, `.pi/agents/personas/${name}.md`), `---\nname: ${name}\ndescription: Isolated synthetic ${name} for user-run T4 stage closure\ntools: ${tools}\nmodel: ${model}\ndelegate_depth: 0\n---\nWork only inside the isolated synthetic workspace. No delegation. Never read non-fixture repository data or credentials.\n${name === "planner" ? "For this synthetic task, write the plan to the absolute path declared in dispatch deliverables. Generic auto-handoff is separate and never substitutes for the explicit plan; cite the declared path in your return.\n" : name === "code-reviewer" ? "Start your final return with exactly one standalone line: VERDICT: APPROVE or VERDICT: REJECT. Never omit the colon or embed a verdict in prose.\n" : ""}`);
|
|
40
|
+
}
|
|
41
|
+
// Copy only this test gate into the synthetic fixture; it is not a Hub policy hook.
|
|
42
|
+
cpSync(join(root, ".pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs"), join(worktree, "stage-boundary.mjs"));
|
|
43
|
+
writeFileSync(join(worktree, "probe-hooks.ts"), `import { appendFileSync, readFileSync } from "node:fs";\nimport { createStageBoundary } from "./stage-boundary.mjs";\nexport default function (pi: any) {\n for (const hook of ["session_start", "before_agent_start", "turn_end", "session_shutdown"]) pi.on(hook, () => appendFileSync(process.env.T4_LIVE_EVENTS!, JSON.stringify({hook, at: Date.now()}) + "\\n"));\n let attempts = 0;\n const gate = createStageBoundary({\n stage: () => readFileSync(process.env.T4_LIVE_STAGE!, "utf8").trim(),\n planDeliverable: () => readFileSync(process.env.T4_LIVE_PLAN!, "utf8").trim(),\n record: (entry: any) => { if (++attempts <= 32) appendFileSync(process.env.T4_LIVE_DISPATCHES!, JSON.stringify(entry) + "\\n"); else if (attempts === 33) appendFileSync(process.env.T4_LIVE_DISPATCHES!, JSON.stringify({ truncated: true }) + "\\n"); },\n });\n pi.on("tool_call", (event: any, ctx: any) => gate(event, ctx));\n}\n`);
|
|
44
|
+
const git = (...args) => {
|
|
45
|
+
const result = spawnSync("git", ["-c", "core.excludesFile=/dev/null", ...args], { cwd: worktree, encoding: "utf8" });
|
|
46
|
+
if (result.error || ![0, 1].includes(result.status)) throw new Error(`synthetic git evidence failed: ${args.join(" ")} (${result.status})`);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
git("init", "-q");
|
|
50
|
+
const fixtureFiles = ["README-SYNTH.md", "probe-hooks.ts", "stage-boundary.mjs", "skills/orchestration-verification/SKILL.md", ".pi/agents/teams.yaml",
|
|
51
|
+
...["planner", "builder", "code-reviewer"].map(name => `.pi/agents/personas/${name}.md`)];
|
|
52
|
+
const baselineBytes = new Map(fixtureFiles.map(file => [file, readFileSync(join(worktree, file))]));
|
|
53
|
+
git("add", "--", ...fixtureFiles);
|
|
54
|
+
const commit = git("-c", "user.name=T4 Synthetic", "-c", "user.email=t4-synthetic@example.invalid",
|
|
55
|
+
"-c", "commit.gpgsign=false", "-c", "core.hooksPath=/dev/null", "commit", "-q", "-m", "synthetic fixture baseline");
|
|
56
|
+
const baselineStatus = git("status", "--short", "--untracked-files=all");
|
|
57
|
+
const baselineDiff = git("diff", "--no-index", "--", "/dev/null", "README-SYNTH.md");
|
|
58
|
+
if (commit.status !== 0 || baselineStatus.status !== 0 || baselineStatus.stdout !== "" || baselineDiff.status !== 1) throw new Error("baseline git capture failed");
|
|
59
|
+
writeFileSync(beforeDiff, baselineDiff.stdout);
|
|
60
|
+
const baselineStatusPath = join(evidence, "baseline-git-status.txt");
|
|
61
|
+
const afterStatusPath = join(evidence, "after-git-status.txt");
|
|
62
|
+
const reviewStatusPath = join(evidence, "after-review-git-status.txt");
|
|
63
|
+
const baselineManifest = join(evidence, "baseline-fixture-sha256.json");
|
|
64
|
+
const baselineFilesPath = join(evidence, "baseline-fixture-bytes.json");
|
|
65
|
+
writeFileSync(baselineStatusPath, baselineStatus.stdout);
|
|
66
|
+
writeFileSync(baselineFilesPath, JSON.stringify(Object.fromEntries([...baselineBytes].map(([file, bytes]) =>
|
|
67
|
+
[file, bytes.toString("utf8")])), null, 2));
|
|
68
|
+
writeFileSync(baselineManifest, JSON.stringify(Object.fromEntries([...baselineBytes].map(([file, bytes]) =>
|
|
69
|
+
[file, createHash("sha256").update(bytes).digest("hex")])), null, 2));
|
|
70
|
+
const check = `node -e 'const fs=require("node:fs"); const crypto=require("node:crypto"); const t=fs.readFileSync("README-SYNTH.md","utf8"); if (!t.includes("widget renders") || t.includes("wdiget") || t.split("\\n").length > 30 || crypto.createHash("sha256").update(t).digest("hex") !== "${expectedHash}") process.exit(1)'`;
|
|
71
|
+
const assertion = { id: "A1", tag: "test", text: "Synthetic README-SYNTH.md equals the baseline with only 'wdiget renders' corrected to 'widget renders'; it stays under 30 lines.", source: "isolated T4 live fixture", reference: before, critical_conditions: ["exact expected bytes", "no unrelated changes", "runtime check exit 0 at inspected revision"], test_command: check };
|
|
72
|
+
const contract = `A1 [test]: ${assertion.text} (source: ${assertion.source}). Explicit verification command: ${JSON.stringify(check)} (execute only through approved bash). Runtime acceptance and reviewer evidence are separate; neither a return path nor a bare claim proves semantic adequacy.`;
|
|
73
|
+
const resultPath = join(dir, "result.json"), rpcLog = join(dir, "rpc.log"), events = join(dir, "events.ndjson");
|
|
74
|
+
const stagePath = join(evidence, "authorized-stage.txt"), planPath = join(evidence, "authorized-plan.txt"), dispatchLog = join(evidence, "dispatch-attempts.ndjson");
|
|
75
|
+
function authorize(stage) {
|
|
76
|
+
const next = `${stagePath}.next`;
|
|
77
|
+
writeFileSync(next, stage);
|
|
78
|
+
renameSync(next, stagePath); // explicit harness-owned transition after each evidence gate
|
|
79
|
+
}
|
|
80
|
+
authorize("plan");
|
|
81
|
+
const outcome = { fixture: dir, worktree, model, declaredCheck: check,
|
|
82
|
+
baseline: { status: baselineStatus.stdout, statusPath: baselineStatusPath, manifest: baselineManifest,
|
|
83
|
+
filesPath: baselineFilesPath, diff: beforeDiff, bytes: before }, stages: [], error: null };
|
|
84
|
+
const save = () => {
|
|
85
|
+
outcome.dispatchAttempts = existsSync(dispatchLog) ? readFileSync(dispatchLog, "utf8").split("\n").filter(Boolean).map(line => JSON.parse(line)) : [];
|
|
86
|
+
writeFileSync(resultPath, JSON.stringify(outcome, null, 2));
|
|
87
|
+
};
|
|
88
|
+
save();
|
|
89
|
+
const env = { ...process.env, TMPDIR: runtimeTmp, NODE_COMPILE_CACHE: compileCache, T4_LIVE_EVENTS: events,
|
|
90
|
+
T4_LIVE_STAGE: stagePath, T4_LIVE_PLAN: planPath, T4_LIVE_DISPATCHES: dispatchLog };
|
|
91
|
+
// Inherit normal configured Pi auth/catalog; no credential values are read into task text or logs.
|
|
92
|
+
delete env.PI_OFFLINE;
|
|
93
|
+
delete env.TYPESAFE_API_KEY;
|
|
94
|
+
delete env.AGENT_HUB_TASK_TRIAGE_FAKE;
|
|
95
|
+
delete env.AGENT_HUB_TASK_TRIAGE_FAKE_RECORD;
|
|
96
|
+
if (env.NODE_OPTIONS?.includes("system1-no-network")) delete env.NODE_OPTIONS;
|
|
97
|
+
const child = spawn(join(root, "node_modules/.bin/pi"), [
|
|
98
|
+
"--mode", "rpc", "--no-session", "--no-extensions",
|
|
99
|
+
"-e", join(root, ".pi/harnesses/damage-control-continue/index.ts"),
|
|
100
|
+
"-e", join(root, ".pi/harnesses/ask-user-remote/index.ts"),
|
|
101
|
+
"-e", join(root, ".pi/harnesses/agent-hub/index.ts"),
|
|
102
|
+
"-e", join(worktree, "probe-hooks.ts"),
|
|
103
|
+
"--solo", "--work-mode", "orchestrator", "--agent-team", "stage", "--model", model,
|
|
104
|
+
], { cwd: worktree, env, detached: true, stdio: ["pipe", "pipe", "pipe"] });
|
|
105
|
+
let ended = false, exit, turns = 0, serial = 0, err = "", buffer = "";
|
|
106
|
+
const pending = new Map(), waiters = new Set(), parentModels = [];
|
|
107
|
+
const log = entry => appendFileSync(rpcLog, JSON.stringify(entry) + "\n");
|
|
108
|
+
function kill(signal) { if (child.pid && !ended) { try { process.kill(-child.pid, signal); } catch (e) { if (e.code !== "ESRCH") throw e; } } }
|
|
109
|
+
function stop(reason) {
|
|
110
|
+
ended = true;
|
|
111
|
+
for (const wake of waiters) wake();
|
|
112
|
+
for (const cb of pending.values()) cb({ success: false, error: reason });
|
|
113
|
+
pending.clear();
|
|
114
|
+
}
|
|
115
|
+
child.once("error", e => stop(`Pi spawn failed: ${e.message}`));
|
|
116
|
+
child.once("close", (code, signal) => { exit = { code, signal }; stop(`Pi exited: ${code ?? signal}`); });
|
|
117
|
+
child.stderr.on("data", c => { err += String(c); });
|
|
118
|
+
child.stdout.on("data", c => {
|
|
119
|
+
buffer += String(c);
|
|
120
|
+
for (let nl; (nl = buffer.indexOf("\n")) >= 0;) {
|
|
121
|
+
const line = buffer.slice(0, nl); buffer = buffer.slice(nl + 1);
|
|
122
|
+
let ev; try { ev = JSON.parse(line); } catch { continue; }
|
|
123
|
+
if (ev.type === "agent_end") { turns++; for (const wake of waiters) wake(); }
|
|
124
|
+
if (ev.type === "message_end" && ev.message?.role === "assistant") {
|
|
125
|
+
parentModels.push({ provider: ev.message.provider, model: ev.message.model, output: ev.message.usage?.output });
|
|
126
|
+
}
|
|
127
|
+
if (ev.type === "response" && pending.has(ev.id)) { const cb = pending.get(ev.id); pending.delete(ev.id); cb(ev); }
|
|
128
|
+
if (ev.type === "extension_ui_request") {
|
|
129
|
+
log({ type: "ui", method: ev.method, title: String(ev.title ?? "").slice(0, 300) });
|
|
130
|
+
if (ev.method === "select") {
|
|
131
|
+
// Never silently authorize an unexpected human decision or budget extension.
|
|
132
|
+
const deny = ev.options?.find(o => /no|deny|cancel/i.test(o));
|
|
133
|
+
if (!deny) { kill("SIGTERM"); continue; }
|
|
134
|
+
child.stdin.write(JSON.stringify({ type: "extension_ui_response", id: ev.id, value: deny }) + "\n");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
async function request(message, command = false) {
|
|
140
|
+
const previous = turns;
|
|
141
|
+
const reply = await new Promise((resolve, reject) => {
|
|
142
|
+
if (ended) return reject(new Error("Pi exited before request"));
|
|
143
|
+
const id = `t4-live-${++serial}`;
|
|
144
|
+
const timer = setTimeout(() => { pending.delete(id); kill("SIGTERM"); reject(new Error("Pi RPC timeout")); }, 600_000);
|
|
145
|
+
pending.set(id, ev => { clearTimeout(timer); resolve(ev); });
|
|
146
|
+
child.stdin.write(JSON.stringify({ id, type: "prompt", message }) + "\n");
|
|
147
|
+
});
|
|
148
|
+
if (!reply.success || command || turns > previous) return reply;
|
|
149
|
+
await new Promise((resolve, reject) => {
|
|
150
|
+
const wake = () => {
|
|
151
|
+
if (turns <= previous && !ended) return;
|
|
152
|
+
clearTimeout(timer); waiters.delete(wake);
|
|
153
|
+
if (ended && turns <= previous) reject(new Error("Pi exited before agent_end")); else resolve();
|
|
154
|
+
};
|
|
155
|
+
const timer = setTimeout(() => { waiters.delete(wake); kill("SIGTERM"); reject(new Error("Pi agent_end timeout")); }, 600_000);
|
|
156
|
+
waiters.add(wake); wake();
|
|
157
|
+
});
|
|
158
|
+
return reply;
|
|
159
|
+
}
|
|
160
|
+
function nonRuntimeStatus(status, sessionId) {
|
|
161
|
+
const prefix = `?? .pi/agent-sessions/sessions/${sessionId}/`;
|
|
162
|
+
return status.split("\n").filter(line => line && !line.startsWith(prefix)).join("\n");
|
|
163
|
+
}
|
|
164
|
+
function observedChildModel(sessionPath) {
|
|
165
|
+
if (!existsSync(sessionPath)) return { status: "unavailable", reason: "retained child session missing" };
|
|
166
|
+
let rows;
|
|
167
|
+
try { rows = readFileSync(sessionPath, "utf8").split("\n").filter(Boolean).map(line => JSON.parse(line)); }
|
|
168
|
+
catch { return { status: "unavailable", reason: "retained child session unreadable" }; }
|
|
169
|
+
const identities = rows.filter(row => row.type === "message" && row.message?.role === "assistant")
|
|
170
|
+
.map(row => ({ provider: row.message.provider, model: row.message.model }));
|
|
171
|
+
if (!identities.length || identities.some(m => typeof m.provider !== "string" || typeof m.model !== "string" || !m.provider || !m.model))
|
|
172
|
+
return { status: "unavailable", reason: "no complete assistant model identity in retained session" };
|
|
173
|
+
return { status: "observed", identities };
|
|
174
|
+
}
|
|
175
|
+
function snapshot(stage, role) {
|
|
176
|
+
const sessionsRoot = join(worktree, ".pi/agent-sessions/sessions");
|
|
177
|
+
const sessions = existsSync(sessionsRoot) ? readdirSync(sessionsRoot) : [];
|
|
178
|
+
if (sessions.length !== 1) throw new Error(`Expected one isolated session, got ${sessions.length}`);
|
|
179
|
+
const base = join(sessionsRoot, sessions[0]);
|
|
180
|
+
const dispatchRoot = join(base, "dispatches"), evidenceRoot = join(base, "artifacts/evidence");
|
|
181
|
+
// Count started dispatches, including any still pending; never hide an extra
|
|
182
|
+
// child just because its result has not been persisted yet.
|
|
183
|
+
const dispatches = readdirSync(dispatchRoot).filter(id => existsSync(join(dispatchRoot, id, "request.json")));
|
|
184
|
+
const matching = dispatches.filter(id => existsSync(join(dispatchRoot, id, "result.json")) &&
|
|
185
|
+
existsSync(join(base, "artifacts/returns", `${role}-${id}.md`)))
|
|
186
|
+
.map(id => ({ id, result: JSON.parse(readFileSync(join(dispatchRoot, id, "result.json"), "utf8")) }));
|
|
187
|
+
if (matching.length !== 1 || dispatches.length !== outcome.stages.length + 1) {
|
|
188
|
+
const observed = dispatches.map(id => {
|
|
189
|
+
const request = join(dispatchRoot, id, "request.json");
|
|
190
|
+
let agent = "unknown";
|
|
191
|
+
try { agent = JSON.parse(readFileSync(request, "utf8")).agent ?? "unknown"; } catch { /* keep ID */ }
|
|
192
|
+
return { agent, id };
|
|
193
|
+
});
|
|
194
|
+
throw new Error(`Expected exactly one ${role} child at ${stage}; saw ${dispatches.length} total: ${JSON.stringify(observed)}`);
|
|
195
|
+
}
|
|
196
|
+
const { id, result } = matching[0];
|
|
197
|
+
if (result.exitCode !== 0 || !result.diagnostics || !Object.hasOwn(result.diagnostics, "modelFallback") ||
|
|
198
|
+
result.diagnostics.modelFallback !== null || !(result.billed > 0))
|
|
199
|
+
throw new Error(`${role} did not complete with a retained explicit no-fallback result`);
|
|
200
|
+
// diagnostics.modelUsed is the requested spawn model, not an observed message identity.
|
|
201
|
+
const childModel = observedChildModel(join(dispatchRoot, id, "session.json"));
|
|
202
|
+
if (childModel.status === "observed" && childModel.identities.some(m => `${m.provider}/${m.model}` !== model))
|
|
203
|
+
throw new Error(`${role} emitted a model other than ${model}`);
|
|
204
|
+
const files = readdirSync(evidenceRoot).filter(f => f.startsWith(`${role}-acceptance-${id}`));
|
|
205
|
+
if (files.length !== 1) throw new Error(`Missing unique runtime ${role} acceptance artifact`);
|
|
206
|
+
const acceptancePath = join(evidenceRoot, files[0]);
|
|
207
|
+
const acceptance = JSON.parse(readFileSync(acceptancePath, "utf8"));
|
|
208
|
+
const canonicalResultPath = join(dispatchRoot, id, "result.json");
|
|
209
|
+
if (result.evidencePath !== canonicalResultPath || !existsSync(result.evidencePath)) throw new Error(`Missing canonical retained ${role} dispatch result`);
|
|
210
|
+
const item = { stage, role, id, resultPath: result.evidencePath, returnPath: join(base, "artifacts/returns", `${role}-${id}.md`), acceptancePath, process: acceptance.process, billed: result.billed, modelEvidence: { ...childModel,
|
|
211
|
+
requested: result.diagnostics?.modelUsed ?? null, fallback: result.diagnostics?.modelFallback ?? null } };
|
|
212
|
+
outcome.stages.push(item); save();
|
|
213
|
+
return { ...item, result, acceptance };
|
|
214
|
+
}
|
|
215
|
+
const p1 = `SYNTHETIC isolated live task; no repository data or credentials. Call set_task_tier tier "small", risk "low", scope "wide" with reason "synthetic stage-closure fixture". Call the REAL set_assertions tool with ${JSON.stringify({ assertions: [assertion] })}. Do not dispatch any child yet; finish this turn so the harness can declare the absolute plan path in the runtime session. Never manually mark stages satisfied.`;
|
|
216
|
+
const p2 = `Continue SAME task; the pre-builder test assertion must already be registered. Dispatch exactly one native builder pinned ${model}, backend "native", scope ["README-SYNTH.md"], deliverables ["README-SYNTH.md"]. Task: In the isolated synthetic fixture, read ${before} and README-SYNTH.md. Edit ONLY 'wdiget renders' to 'widget renders', preserving every other byte. After editing, run EXACTLY this declared command via normal approved bash, no wrapper: ${check}. Do not delegate, read repository files, or modify other files. ${contract} Report actual builder result and process obligations; never force pass.`;
|
|
217
|
+
try {
|
|
218
|
+
const one = await request(p1);
|
|
219
|
+
if (!one.success) throw new Error("classification/assertion turn failed");
|
|
220
|
+
const sessionsRoot = join(worktree, ".pi/agent-sessions/sessions");
|
|
221
|
+
const planSessions = existsSync(sessionsRoot) ? readdirSync(sessionsRoot) : [];
|
|
222
|
+
if (planSessions.length !== 1 ||
|
|
223
|
+
(existsSync(join(sessionsRoot, planSessions[0], "dispatches")) &&
|
|
224
|
+
readdirSync(join(sessionsRoot, planSessions[0], "dispatches")).some(id => existsSync(join(sessionsRoot, planSessions[0], "dispatches", id, "request.json")))))
|
|
225
|
+
throw new Error("Expected one initialized session and no child before plan path declaration");
|
|
226
|
+
const planArtifact = join(sessionsRoot, planSessions[0], "artifacts/plans/synthetic-readme-fix.md");
|
|
227
|
+
writeFileSync(planPath, planArtifact); // boundary and task share this exact absolute path
|
|
228
|
+
const pPlan = `Continue SAME synthetic task. Dispatch exactly one native planner pinned ${model}, backend "native", with deliverables ["${planArtifact}"]. Planner task: Read the synthetic README and public verification skill in this isolated worktree, write a short concrete typo-only plan using your write tool to the explicit absolute deliverable ${planArtifact}. This explicit plan artifact is distinct from the generic auto-handoff; do not substitute that auto-handoff for it. Return a matching plan for correcting ONLY 'wdiget renders' in README-SYNTH.md with this declared check: ${check}. The planner must not edit README or execute the check: report A1 and AF-MIN-CHANGE unproven at plan time; the builder will verify them. No other children or delegated helpers. Report the tool results; never manually mark stages satisfied.`;
|
|
229
|
+
const planned = await request(pPlan);
|
|
230
|
+
if (!planned.success) throw new Error("planner turn failed");
|
|
231
|
+
const plan = snapshot("plan", "planner");
|
|
232
|
+
if (plan.acceptance.process?.obligations?.plan?.status !== "satisfied" ||
|
|
233
|
+
plan.acceptance.readback?.length !== 1 || plan.acceptance.readback[0].status !== "read" ||
|
|
234
|
+
plan.acceptance.readback[0].changed !== true ||
|
|
235
|
+
plan.acceptance.readback[0].path !== planArtifact ||
|
|
236
|
+
plan.acceptance.compatibility?.hubAcceptanceStatus === "deliverable_failed" ||
|
|
237
|
+
!existsSync(planArtifact) || !readFileSync(planArtifact, "utf8").trim())
|
|
238
|
+
throw new Error(plan.acceptance.readback?.[0]?.status !== "read" || !existsSync(planArtifact)
|
|
239
|
+
? "real planner declared plan artifact was not read back"
|
|
240
|
+
: plan.acceptance.process?.obligations?.plan?.status !== "satisfied"
|
|
241
|
+
? "real planner artifact read back, but plan-stage gate remained open"
|
|
242
|
+
: "real planner artifact did not meet plan readback/change/content requirements");
|
|
243
|
+
// Planner can write: attribute no off-target change to the builder.
|
|
244
|
+
const planStatus = git("status", "--short", "--untracked-files=all");
|
|
245
|
+
const planNonRuntimeStatus = nonRuntimeStatus(planStatus.stdout, readdirSync(join(worktree, ".pi/agent-sessions/sessions"))[0]);
|
|
246
|
+
const planUnchangedFixture = [...baselineBytes].every(([file, bytes]) => readFileSync(join(worktree, file)).equals(bytes));
|
|
247
|
+
outcome.afterPlan = { gitStatus: planStatus.stdout, nonRuntimeStatus: planNonRuntimeStatus,
|
|
248
|
+
readmeUnchanged: readFileSync(readme, "utf8") === initial, unchangedFixture: planUnchangedFixture };
|
|
249
|
+
save();
|
|
250
|
+
if (planStatus.status !== 0 || planNonRuntimeStatus !== "" || !outcome.afterPlan.readmeUnchanged || !planUnchangedFixture)
|
|
251
|
+
throw new Error("planner changed README or non-runtime synthetic fixture before builder");
|
|
252
|
+
authorize("build");
|
|
253
|
+
const two = await request(p2);
|
|
254
|
+
if (!two.success) throw new Error("builder turn failed");
|
|
255
|
+
const build = snapshot("build", "builder");
|
|
256
|
+
const actual = readFileSync(readme, "utf8");
|
|
257
|
+
writeFileSync(after, actual);
|
|
258
|
+
const diff = git("diff", "--no-index", "--", before, after);
|
|
259
|
+
writeFileSync(afterDiff, diff.stdout);
|
|
260
|
+
const status = git("status", "--short", "--untracked-files=all");
|
|
261
|
+
writeFileSync(afterStatusPath, status.stdout);
|
|
262
|
+
// The one runtime-owned session is the only worktree infrastructure exception.
|
|
263
|
+
// Keep the full status: a new or changed file anywhere else must fail this gate.
|
|
264
|
+
const sessions = readdirSync(join(worktree, ".pi/agent-sessions/sessions"));
|
|
265
|
+
const sessionPrefix = sessions.length === 1 ? `?? .pi/agent-sessions/sessions/${sessions[0]}/` : null;
|
|
266
|
+
const changedOutsideSession = sessionPrefix ? nonRuntimeStatus(status.stdout, sessions[0]) : status.stdout;
|
|
267
|
+
const unchangedFixture = [...baselineBytes].every(([file, bytes]) =>
|
|
268
|
+
file === "README-SYNTH.md" || readFileSync(join(worktree, file)).equals(bytes));
|
|
269
|
+
outcome.after = { path: after, diffPath: afterDiff, gitStatus: status.stdout, statusPath: afterStatusPath,
|
|
270
|
+
nonRuntimeStatus: changedOutsideSession, unchangedFixture, exactExpectedBytes: actual === expected };
|
|
271
|
+
save();
|
|
272
|
+
if (actual !== expected || diff.status !== 1 || status.status !== 0 || sessions.length !== 1 ||
|
|
273
|
+
changedOutsideSession !== " M README-SYNTH.md" || !unchangedFixture) throw new Error("independent before/after bytes or git state failed");
|
|
274
|
+
const req = build.acceptance.verification?.requirements ?? [];
|
|
275
|
+
const checkEvidence = build.acceptance.verification?.checks?.[0];
|
|
276
|
+
if (build.acceptance.process?.obligations?.acceptance?.status !== "satisfied" ||
|
|
277
|
+
!["A1", "AF-MIN-CHANGE"].every(id => req.some(r => r.id === id && r.status === "passed")) ||
|
|
278
|
+
checkEvidence?.command?.[0] !== check || checkEvidence?.exitCode !== 0 ||
|
|
279
|
+
typeof checkEvidence?.inspectedRevision !== "string" || !checkEvidence.inspectedRevision ||
|
|
280
|
+
checkEvidence.inspectedRevision !== build.acceptance.task?.revision?.after || !existsSync(checkEvidence?.evidenceRef ?? "")) {
|
|
281
|
+
throw new Error("builder runtime acceptance/check/revision/readback incomplete; reviewer not dispatched");
|
|
282
|
+
}
|
|
283
|
+
// Every reviewer reference must be retained before the reviewer is dispatched.
|
|
284
|
+
const reviewInputs = [plan.returnPath, readme, before, after, beforeDiff, afterDiff,
|
|
285
|
+
baselineStatusPath, baselineManifest, baselineFilesPath, afterStatusPath,
|
|
286
|
+
build.acceptancePath, checkEvidence.evidenceRef, build.resultPath];
|
|
287
|
+
for (const path of reviewInputs) {
|
|
288
|
+
if (typeof path !== "string" || !existsSync(path)) throw new Error(`Reviewer input unavailable before dispatch: ${path}`);
|
|
289
|
+
}
|
|
290
|
+
const reviewPaths = [plan.returnPath, before, after, afterDiff, build.acceptancePath, checkEvidence.evidenceRef];
|
|
291
|
+
const returnTemplate = reviewReturnTemplate({ planReturnPath: plan.returnPath, before, after, afterDiff,
|
|
292
|
+
acceptancePath: build.acceptancePath, checkPath: checkEvidence.evidenceRef, check,
|
|
293
|
+
exitCode: checkEvidence.exitCode, inspectedRevision: checkEvidence.inspectedRevision });
|
|
294
|
+
const p3 = `Continue SAME synthetic task. Dispatch exactly one native code-reviewer pinned ${model}, backend "native", scope ["README-SYNTH.md"], review_reason "Human explicitly requested independent synthetic wide-stage review despite docs-only lane". Task: Independently inspect the actual planner output ${plan.returnPath} for a relevant typo-only plan and acceptance criteria; README-SYNTH.md in ${worktree}, BEFORE ${before}, AFTER ${after}, baseline diff ${beforeDiff}, before/after diff ${afterDiff}, clean committed baseline git status ${baselineStatusPath}, baseline fixture hashes ${baselineManifest}, immutable baseline fixture bytes ${baselineFilesPath}, full after git status ${afterStatusPath}, builder runtime acceptance ${build.acceptancePath}, builder check ${checkEvidence.evidenceRef}, and builder native result at the absolute canonical dispatch evidence path ${build.resultPath} (dispatches/${build.id}/result.json, NOT under artifacts/evidence). These paths are available NOW; read them as written, without shortening or rebasing relative paths. The only excluded after-status entries are untracked files under the single runtime-owned .pi/agent-sessions/sessions/${sessions[0]}/; every other tracked or untracked path is checked. Check the exact byte-level one-token change, unchanged other fixture bytes, absence of unrelated changes outside that session, and the actual declared check, exit code, inspected revision and deliverable readback. ${contract} Start your final return with exactly one standalone line, VERDICT: APPROVE only if plan, content and verification are adequate, otherwise VERDICT: REJECT. Never omit the colon or embed a verdict in prose. Include the parseable structured return keys changed_files, assertions_proven, assertions_unproven, assertions_failed, tests_run, open_risks, requires_user_decision. REVIEW INSTRUCTIONS / TEMPLATE ONLY — this is NOT returned evidence and the harness never inserts it into your response. The production parser recognizes an A1 evidence field ONLY after the literal delimiter ' — evidence: ' inside an assertions_proven entry. A phrase such as 'source: builder runtime evidence' in the note or tests_run is NOT A1 evidence. If and only if you independently read and confirm every cited file and runtime field, you may write an actual return using the following shape, replacing the observation placeholder with your own findings and choosing the verdict; keep the A1 evidence on ONE physical bullet line, with the JSON-quoted command and paths copied exactly to preserve embedded quotes, escapes, commas or newlines. Do not copy an unverified A1 proven entry. If unsupported, choose VERDICT: REJECT and put A1 under assertions_unproven or assertions_failed with the reason, not assertions_proven. Approval is never required.\n${returnTemplate}\nYou are read-only: do not promise or cite a new review artifact you cannot create; the Hub retains your actual return under its returnPath. No bash, edits, delegation or forced stage updates. Report reviewer result, not a manufactured pass.`;
|
|
295
|
+
authorize("review");
|
|
296
|
+
const three = await request(p3);
|
|
297
|
+
if (!three.success) throw new Error("reviewer turn failed");
|
|
298
|
+
const review = snapshot("review", "code-reviewer");
|
|
299
|
+
const reviewStatus = git("status", "--short", "--untracked-files=all");
|
|
300
|
+
writeFileSync(reviewStatusPath, reviewStatus.stdout);
|
|
301
|
+
const reviewNonRuntimeStatus = nonRuntimeStatus(reviewStatus.stdout, sessions[0]);
|
|
302
|
+
const reviewUnchangedFixture = [...baselineBytes].every(([file, bytes]) =>
|
|
303
|
+
file === "README-SYNTH.md" ? readFileSync(readme).equals(Buffer.from(expected)) : readFileSync(join(worktree, file)).equals(bytes));
|
|
304
|
+
outcome.afterReview = { gitStatus: reviewStatus.stdout, statusPath: reviewStatusPath,
|
|
305
|
+
nonRuntimeStatus: reviewNonRuntimeStatus, unchangedFixture: reviewUnchangedFixture };
|
|
306
|
+
if (reviewStatus.status !== 0 || reviewNonRuntimeStatus !== " M README-SYNTH.md" || !reviewUnchangedFixture)
|
|
307
|
+
throw new Error("independent post-review bytes or git state failed");
|
|
308
|
+
outcome.parentModels = parentModels;
|
|
309
|
+
if (parentModels.length < 3 || parentModels.some(m => m.provider !== "openai-codex" || m.model !== "gpt-6-luna" || !(m.output > 0))) throw new Error("parent provider/message usage not exactly luna on every observed response");
|
|
310
|
+
const reviewVerdict = review.result.output.split(/\r?\n/, 1)[0];
|
|
311
|
+
const unmet = reviewClosureUnmet({ process: review.acceptance.process, verdict: reviewVerdict,
|
|
312
|
+
parsed: review.acceptance.structuredReturn, requiredPaths: reviewPaths,
|
|
313
|
+
check, exitCode: checkEvidence.exitCode, inspectedRevision: checkEvidence.inspectedRevision });
|
|
314
|
+
if (unmet.length) throw new Error(`review closure unmet: ${unmet.join("; ")}`);
|
|
315
|
+
outcome.closed = true;
|
|
316
|
+
} catch (e) {
|
|
317
|
+
outcome.error = String(e?.message ?? e);
|
|
318
|
+
process.exitCode = 1;
|
|
319
|
+
} finally {
|
|
320
|
+
outcome.turns = turns;
|
|
321
|
+
outcome.parentModels = parentModels;
|
|
322
|
+
outcome.stderrTail = err.slice(-2000);
|
|
323
|
+
save();
|
|
324
|
+
child.stdin.end();
|
|
325
|
+
await new Promise(resolve => {
|
|
326
|
+
if (ended) return resolve();
|
|
327
|
+
const done = () => { clearTimeout(grace); clearTimeout(bound); resolve(); };
|
|
328
|
+
child.once("close", done);
|
|
329
|
+
const grace = setTimeout(() => kill("SIGTERM"), 2000);
|
|
330
|
+
const bound = setTimeout(() => { kill("SIGKILL"); resolve(); }, 8000);
|
|
331
|
+
});
|
|
332
|
+
outcome.shutdown = exit; save();
|
|
333
|
+
if (exit?.code !== 0 || exit?.signal) process.exitCode = 1;
|
|
334
|
+
console.log(JSON.stringify({ fixture: dir, result: resultPath, closed: !!outcome.closed, error: outcome.error, stages: outcome.stages.map(s => ({ role: s.role, process: s.process?.currentStage, modelEvidence: s.modelEvidence })) }));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createProcessState } from "./process-obligations.ts";
|
|
3
|
+
import type { createTaskTriageRuntime } from "./task-triage-runtime.ts";
|
|
4
|
+
import { consumeWaiverGrant, type WaiverGrant } from "./task-triage-authorization.ts";
|
|
5
|
+
import { normalizeProcessState, effectiveProcessStage, latestProcessState, processAuditRecord, evaluateProcessObligations, type ProcessObligationState, type ProcessAddition } from "./process-obligations.ts";
|
|
6
|
+
import { TASK_TRIAGE_MODEL, TASK_TRIAGE_POLICY_VERSION, TASK_TRIAGE_PROVIDER, TASK_TRIAGE_QUESTION_VERSION, type TaskTriageAssessment, type TriageReason } from "./task-triage-contract.ts";
|
|
7
|
+
export interface EvaluationBinding { taskId: string; evaluationId: string; inputRevision: string; }
|
|
8
|
+
/** Retry persistence without replaying an effect or discarding a current assessment.
|
|
9
|
+
* A corrupt latest entry, failed append/readback or oversized union stays blocked.
|
|
10
|
+
*/
|
|
11
|
+
export function recoverTaskTriageProcessState(options: {
|
|
12
|
+
state: ProcessObligationState; current: (EvaluationBinding & { assessment: TaskTriageAssessment }) | null;
|
|
13
|
+
taskId: string; budgetTier: string; append(record: ReturnType<typeof processAuditRecord>): void;
|
|
14
|
+
entries(): readonly unknown[];
|
|
15
|
+
}): ProcessObligationState {
|
|
16
|
+
const { state, current, taskId, budgetTier, append, entries } = options;
|
|
17
|
+
const next = current && current.taskId === taskId
|
|
18
|
+
? applyTaskTriageAdditions(state, current.assessment, current)
|
|
19
|
+
: normalizeProcessState(state);
|
|
20
|
+
// Never recover by skipping a corrupt tail: it may contain additional requirements.
|
|
21
|
+
const prior = latestProcessState(entries());
|
|
22
|
+
const known = normalizeProcessState(state);
|
|
23
|
+
if (known.additions!.some(a => a.taskId !== taskId)) throw new Error("In-memory additions belong to a different task; recovery requires session inspection");
|
|
24
|
+
// A failed stage/evidence append may leave memory ahead of the journal. Permit
|
|
25
|
+
// only a monotonic successor: no persisted source or baseline requirement lost.
|
|
26
|
+
const coversPrior = (prior.additions ?? []).every(a => known.additions!.some(b => JSON.stringify(b) === JSON.stringify(a)))
|
|
27
|
+
&& (["acceptance", "review", "plan"] as const).every(stage => !prior[stage].required || known[stage].required)
|
|
28
|
+
&& prior.changedFiles.every(path => known.changedFiles.includes(path))
|
|
29
|
+
&& prior.reassessments <= known.reassessments;
|
|
30
|
+
if (entries().some((entry: any) => (entry?.customType ?? entry?.type) === "agent-hub-process-state") && !coversPrior) throw new Error("Persisted process state differs from in-memory state; recovery requires session inspection");
|
|
31
|
+
append(processAuditRecord(next, evaluateProcessObligations(next, { writable: true, budgetTier })));
|
|
32
|
+
const restored = latestProcessState(entries());
|
|
33
|
+
if (JSON.stringify(restored) !== JSON.stringify(normalizeProcessState(next))) throw new Error("Process state readback differs from recovery candidate");
|
|
34
|
+
return restored;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Persist the transition before changing a runtime scope or reserving a scoped evaluation. */
|
|
38
|
+
export async function adoptTaskTriageState(options: {
|
|
39
|
+
runtime: ReturnType<typeof createTaskTriageRuntime> | null; taskId: string; newTask: boolean;
|
|
40
|
+
expandedScope?: string; pendingTransition: boolean; state: ProcessObligationState;
|
|
41
|
+
persist(state: ProcessObligationState): void; onPostCommitFailure(): void;
|
|
42
|
+
}): Promise<ProcessObligationState> {
|
|
43
|
+
const { runtime, taskId, expandedScope, pendingTransition, persist } = options;
|
|
44
|
+
const base = options.newTask ? createProcessState() : options.state;
|
|
45
|
+
// Before binding, persist only the *current* obligations. A refused new-task
|
|
46
|
+
// transition must leave the journal safe to restore even if binding is cancelled.
|
|
47
|
+
const needsBinding = !!(pendingTransition && runtime && !runtime.current);
|
|
48
|
+
if (needsBinding) persist(options.newTask ? options.state : base);
|
|
49
|
+
const bound = needsBinding ? await runtime!.bindInput(taskId) : runtime?.current;
|
|
50
|
+
if (pendingTransition && runtime && !bound) throw new Error("pending input was not evaluated");
|
|
51
|
+
const next = bound ? applyTaskTriageAdditions(base, bound.assessment, { taskId, evaluationId: bound.evaluationId, inputRevision: bound.revision }) : base;
|
|
52
|
+
if (needsBinding) {
|
|
53
|
+
try { persist(next); } catch {
|
|
54
|
+
options.onPostCommitFailure();
|
|
55
|
+
// The old task is still in memory and in the preflight journal entry. Do
|
|
56
|
+
// not reset task identity/assertions on a failed new-task process append.
|
|
57
|
+
if (options.newTask) throw new Error("new-task process state could not be persisted");
|
|
58
|
+
return base;
|
|
59
|
+
}
|
|
60
|
+
} else persist(next);
|
|
61
|
+
// A scope change starts only after the first durable process entry. Any later
|
|
62
|
+
// persistence failure is post-commit: keep the gate closed, never report it as
|
|
63
|
+
// a rejected adoption whose reservation could be rolled back.
|
|
64
|
+
if (expandedScope && runtime?.scope(expandedScope)) {
|
|
65
|
+
try {
|
|
66
|
+
const scoped = await runtime.evaluate(taskId);
|
|
67
|
+
if (!scoped) throw new Error("scoped input was not evaluated");
|
|
68
|
+
const revised = applyTaskTriageAdditions(next, scoped.assessment, { taskId, evaluationId: scoped.evaluationId, inputRevision: scoped.revision });
|
|
69
|
+
persist(revised);
|
|
70
|
+
runtime.adopt(taskId);
|
|
71
|
+
return revised;
|
|
72
|
+
} catch { options.onPostCommitFailure(); return next; }
|
|
73
|
+
}
|
|
74
|
+
runtime?.adopt(taskId);
|
|
75
|
+
return next;
|
|
76
|
+
}
|
|
77
|
+
export function applyTaskTriageAdditions(state: ProcessObligationState, assessment: TaskTriageAssessment, binding: EvaluationBinding): ProcessObligationState {
|
|
78
|
+
const next = normalizeProcessState(state);
|
|
79
|
+
if (assessment.status !== "applied" || !binding.taskId || !binding.evaluationId || !binding.inputRevision) return next;
|
|
80
|
+
const existing = new Set(next.additions?.map(a => a.id));
|
|
81
|
+
for (const reason of assessment.reasons) {
|
|
82
|
+
if (!["security_change", "wide_change", "irreversible_execution"].includes(reason)) continue;
|
|
83
|
+
const id = createHash("sha256").update(JSON.stringify([binding.taskId, binding.inputRevision, reason, TASK_TRIAGE_POLICY_VERSION, TASK_TRIAGE_QUESTION_VERSION, TASK_TRIAGE_PROVIDER, TASK_TRIAGE_MODEL])).digest("hex");
|
|
84
|
+
if (existing.has(id)) continue;
|
|
85
|
+
const addition: ProcessAddition = { id, source: "system1", ...binding, policyVersion: TASK_TRIAGE_POLICY_VERSION, questionVersion: TASK_TRIAGE_QUESTION_VERSION, provider: TASK_TRIAGE_PROVIDER, model: TASK_TRIAGE_MODEL, reason: reason as TriageReason, status: "active", waiverReason: null };
|
|
86
|
+
next.additions!.push(addition); existing.add(id);
|
|
87
|
+
// A newly required stage cannot inherit unrelated, uncovered old evidence.
|
|
88
|
+
if (reason === "wide_change") next.plan = { ...next.plan, evidenceRef: null, revision: null };
|
|
89
|
+
if (reason === "wide_change" || reason === "security_change") next.review = { ...next.review, evidenceRef: null, revision: null };
|
|
90
|
+
}
|
|
91
|
+
// Never persist a partial union or silently discard the last active requirement.
|
|
92
|
+
if (next.additions!.length > 300 || Buffer.byteLength(JSON.stringify(next.additions)) > 64 * 1024) throw new Error("Process additions exceed the persistence limit; dependent effects are blocked.");
|
|
93
|
+
return next;
|
|
94
|
+
}
|
|
95
|
+
/** A private, one-use human grant is required; model-provided flags have no authority. */
|
|
96
|
+
export function waiveTaskTriageAddition(state: ProcessObligationState, input: EvaluationBinding & { additionId: string; reason: string }, grant: WaiverGrant): ProcessObligationState | null {
|
|
97
|
+
if (!input.reason?.trim() || input.reason.length > 512) return null;
|
|
98
|
+
const next = normalizeProcessState(state);
|
|
99
|
+
const addition = next.additions?.find(a => a.id === input.additionId && a.taskId === input.taskId && a.evaluationId === input.evaluationId && a.inputRevision === input.inputRevision && a.status === "active");
|
|
100
|
+
if (!addition || !consumeWaiverGrant(grant, input)) return null;
|
|
101
|
+
addition.status = "waived"; addition.waiverReason = input.reason.trim();
|
|
102
|
+
return next;
|
|
103
|
+
}
|
|
104
|
+
export function pendingActionConfirmation(state: ProcessObligationState): ProcessAddition[] { const s = normalizeProcessState(state); return effectiveProcessStage(s, "confirmation") ? s.additions!.filter(a => a.reason === "irreversible_execution" && a.status === "active") : []; }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { System1Result } from "../lib/system1/contracts.ts";
|
|
2
|
+
import { TASK_TRIAGE_MODEL, TASK_TRIAGE_POLICY_VERSION, TASK_TRIAGE_PROVIDER, TASK_TRIAGE_QUESTION_VERSION, TASK_TRIAGE_QUESTIONS, type TaskTriageAssessment, type TriageReason } from "./task-triage-contract.ts";
|
|
3
|
+
export const TASK_TRIAGE_THRESHOLDS = Object.freeze({ security_change: 0.80, wide_change: 0.85, irreversible_execution: 0.80 });
|
|
4
|
+
const valid = (x: unknown): x is number => typeof x === "number" && Number.isFinite(x) && x >= 0 && x <= 1;
|
|
5
|
+
/** No negative result represents safety, permission, tier, or an override of declared risk. */
|
|
6
|
+
export function assessTaskTriage(result: System1Result, policyVersion: string = TASK_TRIAGE_POLICY_VERSION): TaskTriageAssessment {
|
|
7
|
+
if (policyVersion !== TASK_TRIAGE_POLICY_VERSION) return { status: "invalid_result", reasons: [], detail: "policy_version" };
|
|
8
|
+
if (result.status !== "ok") return { status: result.status, reasons: [], detail: "reason" in result ? result.reason : result.status };
|
|
9
|
+
const { metadata, answers } = result.evaluation;
|
|
10
|
+
if (metadata.provider !== TASK_TRIAGE_PROVIDER || metadata.requestedModel !== TASK_TRIAGE_MODEL || metadata.returnedModel !== TASK_TRIAGE_MODEL || metadata.questionSetVersion !== TASK_TRIAGE_QUESTION_VERSION) return { status: "invalid_result", reasons: [], detail: "version_or_provider" };
|
|
11
|
+
const ids = TASK_TRIAGE_QUESTIONS.map(q => q.id);
|
|
12
|
+
if (answers.length !== ids.length || new Set(answers.map(a => a.questionId)).size !== ids.length || answers.some(a => !ids.includes(a.questionId) || a.type !== "predicate" || !valid(a.probabilityTrue))) return { status: "invalid_result", reasons: [], detail: "answers" };
|
|
13
|
+
const p = Object.fromEntries(answers.map(a => [a.questionId, (a as { probabilityTrue: number }).probabilityTrue])) as Record<string, number>;
|
|
14
|
+
const reasons = (Object.entries(TASK_TRIAGE_THRESHOLDS) as [TriageReason, number][]).filter(([id, threshold]) => p[id] >= threshold).map(([id]) => id);
|
|
15
|
+
return { status: reasons.length ? "applied" : "no_additions", reasons, probabilities: { security_change: p.security_change, wide_change: p.wide_change, irreversible_execution: p.irreversible_execution }, diagnostic: { changeIntent: p.change_intent, contextSufficient: p.context_sufficient } };
|
|
16
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Harness-only review return instructions and evidence gate; never imported by product parser.
|
|
2
|
+
// This template is shown to the reviewer, not inserted into or substituted for its return.
|
|
3
|
+
export function reviewReturnTemplate({ planReturnPath, before, after, afterDiff, acceptancePath, checkPath, check, exitCode, inspectedRevision }) {
|
|
4
|
+
const evidence = [
|
|
5
|
+
`plan return ${JSON.stringify(planReturnPath)}`,
|
|
6
|
+
`BEFORE bytes ${JSON.stringify(before)}`,
|
|
7
|
+
`AFTER bytes ${JSON.stringify(after)}`,
|
|
8
|
+
`before/after diff ${JSON.stringify(afterDiff)}`,
|
|
9
|
+
`builder runtime acceptance ${JSON.stringify(acceptancePath)}`,
|
|
10
|
+
`builder check ${JSON.stringify(checkPath)}`,
|
|
11
|
+
`declared command ${JSON.stringify(check)}`,
|
|
12
|
+
`exit code ${exitCode}`,
|
|
13
|
+
`inspected revision ${JSON.stringify(inspectedRevision)}`,
|
|
14
|
+
"why the plan and one-token change are adequate: <reviewer's own observation>",
|
|
15
|
+
].join("; ");
|
|
16
|
+
return `VERDICT: APPROVE | VERDICT: REJECT (choose exactly one, as the first standalone line)
|
|
17
|
+
changed_files: [README-SYNTH.md — typo-only change, if independently confirmed]
|
|
18
|
+
assertions_proven:
|
|
19
|
+
- A1: independently checked plan, exact bytes, diff and runtime check — evidence: ${evidence}
|
|
20
|
+
assertions_unproven: []
|
|
21
|
+
assertions_failed: []
|
|
22
|
+
tests_run: [declared command and result observed in builder evidence, not run by reviewer]
|
|
23
|
+
open_risks: []
|
|
24
|
+
requires_user_decision: []`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Evaluate only the reviewer's actual parsed return and observed runtime facts.
|
|
28
|
+
export function reviewClosureUnmet({ process, verdict, parsed, requiredPaths, check, exitCode, inspectedRevision }) {
|
|
29
|
+
const unmet = [];
|
|
30
|
+
if (process?.obligations?.review?.status !== "satisfied") unmet.push("review obligation not satisfied");
|
|
31
|
+
if (process?.accepted !== true) unmet.push("process closure not accepted");
|
|
32
|
+
if (verdict !== "VERDICT: APPROVE") unmet.push("canonical first-line verdict is not APPROVE");
|
|
33
|
+
const evidence = parsed?.assertions_proven?.find(entry => entry.id === "A1")?.evidence;
|
|
34
|
+
if (typeof evidence !== "string") unmet.push("parsed A1 assertions_proven evidence field missing");
|
|
35
|
+
// Exact JSON strings preserve quotes, backslashes and newlines on one parser entry line.
|
|
36
|
+
const observed = typeof evidence === "string" ? evidence : "";
|
|
37
|
+
const missing = requiredPaths.filter(path => !observed.includes(JSON.stringify(path)));
|
|
38
|
+
if (missing.length) unmet.push(`parsed A1 evidence missing references: ${missing.join(", ")}`);
|
|
39
|
+
if (!observed.includes(`declared command ${JSON.stringify(check)}`)) unmet.push("parsed A1 evidence missing exact declared command");
|
|
40
|
+
if (!observed.includes(`exit code ${exitCode}`)) unmet.push("parsed A1 evidence missing exit code");
|
|
41
|
+
if (!observed.includes(`inspected revision ${JSON.stringify(inspectedRevision)}`)) unmet.push("parsed A1 evidence missing inspected revision");
|
|
42
|
+
return unmet;
|
|
43
|
+
}
|