@chankov/agent-fleet 2.0.13 → 2.0.14
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/harnesses/agent-hub/README.md +9 -0
- package/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +38 -0
- package/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +75 -0
- package/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +53 -0
- package/.pi/harnesses/agent-hub/dispatch-triage-state.ts +15 -0
- package/.pi/harnesses/agent-hub/index.ts +40 -6
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/prompts/context.ts +1 -0
- package/.pi/harnesses/agent-hub/prompts/system-prompt.ts +8 -1
- package/.pi/harnesses/agent-hub/system1-communication-store.ts +95 -0
- package/.pi/harnesses/agent-hub/system1-runtime.ts +5 -2
- package/.pi/harnesses/agent-hub/tools/context.ts +2 -0
- package/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +9 -3
- package/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +29 -1
- package/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.pi/harnesses/agent-hub/work-mode.ts +2 -1
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/fleet-dashboard-view.ts +1 -1
- package/.pi/harnesses/lib/fleet-strip-controller.ts +2 -1
- package/.pi/harnesses/lib/fleet-strip-view.ts +1 -1
- package/.versions/2.0.14/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.14/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.14/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/coms-claude-bridge.ts +411 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/fleet.ts +216 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/flow.ts +157 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +210 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +34 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.14/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.14/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.14/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.14/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.14/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.14/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.14/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.14/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.14/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.14/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.14/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.14/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.14/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.14/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.14/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.14/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.14/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.14/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.14/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.14/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.14/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.14/.pi/extensions/package.json +9 -0
- package/.versions/2.0.14/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.14/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.14/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.14/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.14/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.14/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.14/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/README.md +1369 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/acceptance.ts +199 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/context.ts +45 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/recover.ts +52 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/config/agents.ts +178 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/config/overrides.ts +160 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/context/budgets.ts +204 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/delegate.ts +467 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/deterministic-fs.ts +127 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-native-complete.ts +169 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +248 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +231 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-native-types.ts +257 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-native.ts +226 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +38 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +75 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +53 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/dispatch-triage-state.ts +15 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/docs-lane.js +122 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/filesystem-tool.ts +73 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/fixtures/registration-surface.json +62 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/index.ts +2370 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +125 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/no-progress.ts +359 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/policy/work-mode.ts +126 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-config.ts +40 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-local.ts +88 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-observer.ts +105 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-rules.ts +143 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-runtime.ts +316 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-snapshot.ts +243 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/proactive-types.ts +63 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/process-obligations.ts +57 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/prompts/context.ts +54 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/prompts/fragments.ts +118 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/prompts/system-prompt.ts +122 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/recover-policy.ts +27 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/recovery-contract.ts +80 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/research/runtime.ts +195 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/research/spawn-run.ts +174 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/return-contract.js +327 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/review-findings.js +104 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/run-budget.js +542 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/scope-gate.js +123 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/session-audit.ts +227 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/spawn.ts +526 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/system1-activity.ts +510 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/system1-communication-store.ts +95 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/system1-report.ts +225 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/system1-runtime.ts +279 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/action-executors.ts +185 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/context.ts +144 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +498 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/herdr-executors.ts +86 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/spawn-research.ts +65 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +152 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/fleet-source.ts +175 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/work-mode.ts +174 -0
- package/.versions/2.0.14/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.14/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.14/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.14/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.14/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.14/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
- package/.versions/2.0.14/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.14/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.14/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.14/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.14/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.14/.pi/harnesses/damage-control-continue/index.ts +550 -0
- package/.versions/2.0.14/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.14/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.14/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.14/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.14/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.14/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.14/.pi/harnesses/lib/context-budget-child-prompt.ts +219 -0
- package/.versions/2.0.14/.pi/harnesses/lib/context-budget-hub-prompt.ts +116 -0
- package/.versions/2.0.14/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.14/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.14/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/2.0.14/.pi/harnesses/lib/deterministic-handle-path.ts +23 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-dashboard-view.ts +147 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-read-model.ts +536 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.14/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.14/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.14/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.14/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.14/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.14/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.14/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.14/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.14/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.14/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.14/.pi/harnesses/lib/system1/config.js +61 -0
- package/.versions/2.0.14/.pi/harnesses/lib/system1/contracts.ts +152 -0
- package/.versions/2.0.14/.pi/harnesses/lib/system1/demo.ts +106 -0
- package/.versions/2.0.14/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.14/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.14/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.14/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.14/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.14/.pi/prompts/af-build.md +24 -0
- package/.versions/2.0.14/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.14/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.14/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.14/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.14/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.14/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.14/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.14/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.14/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.14/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.14/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.14/.version +1 -0
- package/.versions/2.0.14/agents/architect.md +24 -0
- package/.versions/2.0.14/agents/bowser.md +28 -0
- package/.versions/2.0.14/agents/builder.md +55 -0
- package/.versions/2.0.14/agents/code-reviewer.md +209 -0
- package/.versions/2.0.14/agents/deep-researcher.md +32 -0
- package/.versions/2.0.14/agents/documenter.md +22 -0
- package/.versions/2.0.14/agents/orchestrator.md +22 -0
- package/.versions/2.0.14/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.14/agents/planner.md +105 -0
- package/.versions/2.0.14/agents/releaser.md +24 -0
- package/.versions/2.0.14/agents/researcher.md +30 -0
- package/.versions/2.0.14/agents/security-auditor.md +167 -0
- package/.versions/2.0.14/agents/test-engineer.md +153 -0
- package/.versions/2.0.14/agents/web-debugger.md +44 -0
- package/.versions/2.0.14/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.14/bin/catalog/harness-runtime-closure.json +73 -0
- package/.versions/2.0.14/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.14/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.14/docs/ARCHITECTURE.md +754 -0
- package/.versions/2.0.14/docs/agent-fleet-setup.md +917 -0
- package/.versions/2.0.14/docs/claude-code-coms-bridge.md +134 -0
- package/.versions/2.0.14/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.14/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.14/docs/getting-started.md +126 -0
- package/.versions/2.0.14/docs/npm-install.md +476 -0
- package/.versions/2.0.14/docs/pi-extensions.md +454 -0
- package/.versions/2.0.14/docs/pi-setup.md +92 -0
- package/.versions/2.0.14/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.14/install-manifest.json +3183 -0
- package/.versions/2.0.14/justfile +247 -0
- package/.versions/2.0.14/manifest-meta.json +1065 -0
- package/.versions/2.0.14/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.14/references/communication-contract.md +26 -0
- package/.versions/2.0.14/references/definition-of-done.md +67 -0
- package/.versions/2.0.14/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.14/references/observability-checklist.md +92 -0
- package/.versions/2.0.14/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.14/references/performance-checklist.md +236 -0
- package/.versions/2.0.14/references/prompting-patterns.md +380 -0
- package/.versions/2.0.14/references/security-checklist.md +245 -0
- package/.versions/2.0.14/references/testing-patterns.md +235 -0
- package/.versions/2.0.14/references/workflow-authoring.md +304 -0
- package/.versions/2.0.14/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.14/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.14/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.14/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.14/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.14/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.14/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.14/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.14/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.14/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.14/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.14/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.14/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.14/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.14/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.14/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.14/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.14/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.14/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.14/skills/incremental-implementation/SKILL.md +302 -0
- package/.versions/2.0.14/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.14/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.14/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.14/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.14/skills/planning-and-task-breakdown/SKILL.md +289 -0
- package/.versions/2.0.14/skills/repository-ai-setup/SKILL.md +117 -0
- package/.versions/2.0.14/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.14/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.14/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.14/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.14/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.14/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.14/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.14/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.14/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +6 -0
- package/docs/ARCHITECTURE.md +1 -0
- package/docs/agent-fleet-setup.md +17 -0
- package/docs/npm-install.md +8 -0
- package/install-manifest.json +9 -1
- package/manifest-meta.json +8 -0
- package/package.json +3 -2
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
|
+
import { decodeDeterministicHandle } from "../lib/deterministic-handle-path.ts";
|
|
5
|
+
export { deterministicHandlePath } from "../lib/deterministic-handle-path.ts";
|
|
6
|
+
|
|
7
|
+
export const INVENTORY_PAGE_ENTRIES = 500;
|
|
8
|
+
export const CONTENT_REPLY_BYTES = 64 * 1024;
|
|
9
|
+
export const PREVIEW_CHARS = 180;
|
|
10
|
+
|
|
11
|
+
type Handle = { v: 1; kind: "file" | "inventory"; path: string; hash: string; offset: number };
|
|
12
|
+
export class PathOutsideAllowedRootError extends Error {}
|
|
13
|
+
const sha256 = (bytes: Buffer | string) => createHash("sha256").update(bytes).digest("hex");
|
|
14
|
+
const within = (root: string, target: string) => { const rel = relative(resolve(root), resolve(target)); return rel === "" || (!!rel && !rel.startsWith("..") && !isAbsolute(rel)); };
|
|
15
|
+
const encode = (value: Handle) => `t5:${Buffer.from(JSON.stringify(value)).toString("base64url")}`;
|
|
16
|
+
const decode = decodeDeterministicHandle;
|
|
17
|
+
function checkedExisting(path: string, allowedRoot = dirname(resolve(path))): string {
|
|
18
|
+
const lexical = resolve(path), root = resolve(allowedRoot);
|
|
19
|
+
if (!within(root, lexical)) throw new PathOutsideAllowedRootError(`Path outside allowed root: ${path}`);
|
|
20
|
+
let cursor = lexical;
|
|
21
|
+
while (!existsSync(cursor) && dirname(cursor) !== cursor) cursor = dirname(cursor);
|
|
22
|
+
const rootReal = realpathSync(root), cursorReal = realpathSync(cursor);
|
|
23
|
+
if (!within(rootReal, cursorReal)) throw new Error(`Symlink escape outside allowed root: ${path}`);
|
|
24
|
+
return lexical;
|
|
25
|
+
}
|
|
26
|
+
function fileState(path: string, allowedRoot?: string) {
|
|
27
|
+
const checked = checkedExisting(path, allowedRoot);
|
|
28
|
+
if (!existsSync(checked) || !statSync(checked).isFile()) throw new Error(`Not a regular file: ${path}`);
|
|
29
|
+
const bytes = readFileSync(checked);
|
|
30
|
+
return { path: checked, bytes, hash: sha256(bytes) };
|
|
31
|
+
}
|
|
32
|
+
function directoryState(root: string) {
|
|
33
|
+
const checked = checkedExisting(root, root);
|
|
34
|
+
if (!statSync(checked).isDirectory()) throw new Error(`Not a directory: ${root}`);
|
|
35
|
+
const rootReal = realpathSync(checked);
|
|
36
|
+
const entries = readdirSync(checked, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name)).map(entry => {
|
|
37
|
+
const path = join(checked, entry.name), lst = lstatSync(path);
|
|
38
|
+
if (lst.isSymbolicLink()) {
|
|
39
|
+
try {
|
|
40
|
+
if (!within(rootReal, realpathSync(path))) return { name: entry.name, path, type: "symlink", bytes: null, denied: true, reason: "symlink-target-outside-root" };
|
|
41
|
+
} catch {
|
|
42
|
+
return { name: entry.name, path, type: "symlink", bytes: null, denied: true, reason: "symlink-target-unavailable" };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return { name: entry.name, path, type: entry.isDirectory() ? "directory" : entry.isFile() ? "file" : entry.isSymbolicLink() ? "symlink" : "other", bytes: entry.isFile() ? lst.size : null };
|
|
46
|
+
});
|
|
47
|
+
return { root: checked, entries, hash: sha256(JSON.stringify(entries)) };
|
|
48
|
+
}
|
|
49
|
+
function utf8Preview(bytes: Buffer, chars = PREVIEW_CHARS): string {
|
|
50
|
+
return [...bytes.toString("utf8")].slice(0, chars).join("");
|
|
51
|
+
}
|
|
52
|
+
function lineAt(bytes: Buffer, offset: number): number { return offset === 0 ? 1 : bytes.subarray(0, offset).toString("utf8").split("\n").length; }
|
|
53
|
+
|
|
54
|
+
export function inventory(input: { root: string; handle?: string; pageSize?: number; boundedOutput?: boolean; followSymlinkEscape?: boolean }) {
|
|
55
|
+
if (input.followSymlinkEscape) throw new Error("Symlink escape following is forbidden");
|
|
56
|
+
const state = directoryState(input.root);
|
|
57
|
+
let offset = 0;
|
|
58
|
+
if (input.handle) {
|
|
59
|
+
const handle = decode(input.handle);
|
|
60
|
+
if (handle.kind !== "inventory" || resolve(handle.path) !== state.root || handle.hash !== state.hash) throw new Error("Stale inventory handle");
|
|
61
|
+
offset = handle.offset;
|
|
62
|
+
}
|
|
63
|
+
const requested = input.pageSize ?? INVENTORY_PAGE_ENTRIES;
|
|
64
|
+
const pageSize = input.boundedOutput === false ? requested : Math.min(requested, INVENTORY_PAGE_ENTRIES);
|
|
65
|
+
const entries = state.entries.slice(offset, offset + pageSize), nextOffset = offset + entries.length;
|
|
66
|
+
const nextHandle = nextOffset < state.entries.length ? encode({ v: 1, kind: "inventory", path: state.root, hash: state.hash, offset: nextOffset }) : null;
|
|
67
|
+
return { root: state.root, totalEntries: state.entries.length, entries, handle: input.handle ?? encode({ v: 1, kind: "inventory", path: state.root, hash: state.hash, offset }), nextHandle, truncated: nextHandle !== null, untrusted: true, modelDelegated: false };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function excerpt(input: { path: string; allowedRoot?: string; handle?: string; offset?: number; maxBytes?: number; previewChars?: number; boundedOutput?: boolean }) {
|
|
71
|
+
const state = fileState(input.path, input.allowedRoot);
|
|
72
|
+
let offset = input.offset ?? 0;
|
|
73
|
+
if (input.handle) {
|
|
74
|
+
const handle = decode(input.handle);
|
|
75
|
+
if (handle.kind !== "file" || resolve(handle.path) !== state.path || handle.hash !== state.hash) throw new Error("Stale file handle");
|
|
76
|
+
offset = handle.offset;
|
|
77
|
+
}
|
|
78
|
+
if (!Number.isSafeInteger(offset) || offset < 0 || offset > state.bytes.length) throw new Error("Invalid excerpt offset");
|
|
79
|
+
const requested = input.maxBytes ?? (input.boundedOutput === false ? state.bytes.length : CONTENT_REPLY_BYTES);
|
|
80
|
+
const maxBytes = input.boundedOutput === false ? requested : Math.min(requested, CONTENT_REPLY_BYTES);
|
|
81
|
+
const content = state.bytes.subarray(offset, Math.min(state.bytes.length, offset + maxBytes));
|
|
82
|
+
const nextOffset = offset + content.length, nextHandle = nextOffset < state.bytes.length ? encode({ v: 1, kind: "file", path: state.path, hash: state.hash, offset: nextOffset }) : null;
|
|
83
|
+
return { path: state.path, reference: `${state.path}:${lineAt(state.bytes, offset)}`, hash: state.hash, offset, content: Buffer.from(content), contentBytes: content.length, totalBytes: state.bytes.length, preview: utf8Preview(content, Math.min(input.previewChars ?? PREVIEW_CHARS, PREVIEW_CHARS)), onDiskHandle: encode({ v: 1, kind: "file", path: state.path, hash: state.hash, offset }), nextHandle, truncated: nextHandle !== null, untrusted: true, modelDelegated: false };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function readback(input: { handle: string; expectedHash?: string; allowedRoot?: string; maxBytes?: number; boundedOutput?: boolean }) {
|
|
87
|
+
const handle = decode(input.handle);
|
|
88
|
+
if (handle.kind !== "file") throw new Error("Readback requires a file handle");
|
|
89
|
+
const state = fileState(handle.path, input.allowedRoot);
|
|
90
|
+
if (state.hash !== handle.hash || (input.expectedHash && state.hash !== input.expectedHash)) throw new Error("Stale file handle: source bytes changed");
|
|
91
|
+
return excerpt({ path: state.path, allowedRoot: input.allowedRoot, offset: handle.offset, maxBytes: input.maxBytes, boundedOutput: input.boundedOutput });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function snapshotSource(input: { origin: "file"; path: string; allowedRoot?: string; sessionDir?: string }) {
|
|
95
|
+
if (input.origin !== "file") throw new Error(`Unsupported origin ${String(input.origin)}: snapshots accept local files only and never fetch the network`);
|
|
96
|
+
const state = fileState(input.path, input.allowedRoot);
|
|
97
|
+
const sessionDir = resolve(input.sessionDir ?? join(dirname(state.path), ".snapshots"));
|
|
98
|
+
mkdirSync(sessionDir, { recursive: true, mode: 0o700 });
|
|
99
|
+
const root = checkedExisting(sessionDir, sessionDir);
|
|
100
|
+
const dir = join(root, "artifacts", "evidence", "snapshots"); mkdirSync(dir, { recursive: true, mode: 0o700 }); checkedExisting(dir, root);
|
|
101
|
+
const contentPath = join(dir, `${state.hash}-${basename(state.path)}`);
|
|
102
|
+
if (!existsSync(contentPath)) copyFileSync(state.path, contentPath);
|
|
103
|
+
else {
|
|
104
|
+
const existing = fileState(contentPath, root);
|
|
105
|
+
if (existing.hash !== state.hash) throw new Error(`Snapshot collision or stale target: ${contentPath}`);
|
|
106
|
+
}
|
|
107
|
+
const metadataPath = `${contentPath}.json`;
|
|
108
|
+
if (!existsSync(metadataPath)) writeFileSync(metadataPath, JSON.stringify({ source: { origin: "file", path: state.path, bytes: state.bytes.length }, sha256: state.hash, contentPath, untrusted: true, modelDelegated: false }, null, 2), { mode: 0o600 });
|
|
109
|
+
else checkedExisting(metadataPath, root);
|
|
110
|
+
return { source: { origin: "file" as const, path: state.path, bytes: state.bytes.length }, hash: state.hash, contentPath, metadataPath, handle: encode({ v: 1, kind: "file", path: contentPath, hash: state.hash, offset: 0 }), untrusted: true, modelDelegated: false };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function utf8Prefix(buffer: Buffer, maxBytes: number): Buffer {
|
|
114
|
+
let end = Math.min(maxBytes, buffer.length);
|
|
115
|
+
while (end > 0 && (buffer[end] & 0xc0) === 0x80) end--;
|
|
116
|
+
return buffer.subarray(0, end);
|
|
117
|
+
}
|
|
118
|
+
export function boundOutput(input: { content: string | Buffer; retentionDir: string; label?: string }) {
|
|
119
|
+
const bytes = Buffer.isBuffer(input.content) ? input.content : Buffer.from(input.content, "utf8");
|
|
120
|
+
const dir = resolve(input.retentionDir); mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
121
|
+
const hash = sha256(bytes), contentPath = join(dir, `${input.label ?? "output"}-${randomUUID()}`); writeFileSync(contentPath, bytes, { mode: 0o600 });
|
|
122
|
+
const handle = encode({ v: 1, kind: "file", path: contentPath, hash, offset: 0 });
|
|
123
|
+
if (bytes.length <= CONTENT_REPLY_BYTES) return { reply: bytes.toString("utf8"), contentPath, handle, hash, totalBytes: bytes.length, truncated: false };
|
|
124
|
+
const suffix = Buffer.from(`\n\n[truncated: ${bytes.length} bytes total; full output handle ${handle}; path ${contentPath}]`, "utf8");
|
|
125
|
+
const prefix = utf8Prefix(bytes, CONTENT_REPLY_BYTES - suffix.length);
|
|
126
|
+
return { reply: Buffer.concat([prefix, suffix]).toString("utf8"), contentPath, handle, hash, totalBytes: bytes.length, truncated: true };
|
|
127
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Compatibility library for historical benchmark imports. No extension factory or import-time effects.
|
|
2
|
+
export const DIAGNOSTIC_TRANSPORT_REFUSAL_EXIT = 73;
|
|
3
|
+
|
|
4
|
+
export type ProviderOutputCapField = "max_output_tokens" | "max_completion_tokens" | "max_tokens";
|
|
5
|
+
export interface ProviderModelIdentity { provider?: unknown; api?: unknown; compat?: { maxTokensField?: unknown } }
|
|
6
|
+
|
|
7
|
+
/** Apply only installed, reviewed provider/API semantics; body fields alone never select a mapping. */
|
|
8
|
+
export function applyProviderOutputTokenCap(payload: Record<string, unknown>, model: ProviderModelIdentity | undefined, limit: unknown): { payload: Record<string, unknown>; field: ProviderOutputCapField } {
|
|
9
|
+
if (limit !== 2048) throw new Error("approved output-token cap must be exactly 2048");
|
|
10
|
+
const provider = model?.provider;
|
|
11
|
+
const api = model?.api;
|
|
12
|
+
const hasResponsesShape = typeof payload.model === "string" && payload.model.length > 0 && Array.isArray(payload.input) && payload.input.length > 0 && payload.stream === true && !Object.prototype.hasOwnProperty.call(payload, "messages");
|
|
13
|
+
const hasCompletionsShape = typeof payload.model === "string" && payload.model.length > 0 && Array.isArray(payload.messages) && payload.messages.length > 0 && payload.stream === true && !Object.prototype.hasOwnProperty.call(payload, "input");
|
|
14
|
+
const capFields: ProviderOutputCapField[] = ["max_output_tokens", "max_completion_tokens", "max_tokens"];
|
|
15
|
+
let field: ProviderOutputCapField;
|
|
16
|
+
if (provider === "xai" && api === "openai-responses" && hasResponsesShape) field = "max_output_tokens";
|
|
17
|
+
else if (provider === "omlx" && api === "openai-completions" && hasCompletionsShape) {
|
|
18
|
+
const configured = model?.compat?.maxTokensField;
|
|
19
|
+
if (configured === undefined) field = "max_completion_tokens";
|
|
20
|
+
else if (configured === "max_completion_tokens" || configured === "max_tokens") field = configured;
|
|
21
|
+
else throw new Error("unsupported OMLX compat maxTokensField");
|
|
22
|
+
}
|
|
23
|
+
else throw new Error("unsupported provider/API output-cap semantics or payload shape");
|
|
24
|
+
if (capFields.some(candidate => candidate !== field && Object.prototype.hasOwnProperty.call(payload, candidate))) throw new Error("payload contains an output-cap field incompatible with provider/API semantics");
|
|
25
|
+
return { payload: { ...payload, [field]: limit }, field };
|
|
26
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { closeSync, existsSync, fsyncSync, openSync, readFileSync, renameSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, join } from "node:path";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
|
|
5
|
+
export const COMPLETION_SERIES_BUDGET_SCHEMA = "agent-fleet.completion-series-budget/v2" as const;
|
|
6
|
+
export const COMPLETION_SERIES_BUDGET_V1_SCHEMA = "agent-fleet.completion-series-budget/v1" as const;
|
|
7
|
+
export const COMPLETION_SERIES_LOCK_SCHEMA = "agent-fleet.completion-series-lock/v1" as const;
|
|
8
|
+
export type CompletionSeriesStage = "diagnostic" | "benchmark";
|
|
9
|
+
|
|
10
|
+
export interface CompletionSeriesLimits {
|
|
11
|
+
seriesRequestLimit: 60;
|
|
12
|
+
stageRequestLimits: { diagnostic: 12; benchmark: 48 };
|
|
13
|
+
inputTokensPerRequest: 16384;
|
|
14
|
+
outputTokensPerRequest: 2048;
|
|
15
|
+
requestTimeoutMs: 180000;
|
|
16
|
+
maxActiveRequests: 1;
|
|
17
|
+
maxRequestsPerUnit: { diagnostic: 2; benchmark: 4 };
|
|
18
|
+
autoRetry: false;
|
|
19
|
+
fallback: false;
|
|
20
|
+
}
|
|
21
|
+
export interface CompletionReservation {
|
|
22
|
+
sequence: number; stage: CompletionSeriesStage; startedAt: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CompletionSeriesState {
|
|
25
|
+
schema: typeof COMPLETION_SERIES_BUDGET_SCHEMA;
|
|
26
|
+
seriesId: string;
|
|
27
|
+
seriesRequestsStarted: number;
|
|
28
|
+
stages: { diagnostic: { requestsStarted: number }; benchmark: { requestsStarted: number } };
|
|
29
|
+
reservationHistory: CompletionReservation[];
|
|
30
|
+
cancelled: boolean;
|
|
31
|
+
limits: CompletionSeriesLimits;
|
|
32
|
+
}
|
|
33
|
+
export interface CompletionSeriesLock {
|
|
34
|
+
schema: typeof COMPLETION_SERIES_LOCK_SCHEMA; ownerId: string; pid: number; acquiredAt: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CountingProvenance {
|
|
37
|
+
method: "serialized-provider-payload-utf8-bytes-times-2-plus-1024/v1";
|
|
38
|
+
count: number; serializedBytes: number; multiplier: 2; reservedTokens: 1024;
|
|
39
|
+
unit: "conservative-token-upper-bound"; cap: number; textOnly: true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class CompletionBudgetRefusal extends Error {
|
|
43
|
+
readonly reason: "cancelled" | "series-exhausted" | "stage-exhausted" | "probe-exhausted" | "lock-not-owned";
|
|
44
|
+
constructor(reason: CompletionBudgetRefusal["reason"], message: string) { super(message); this.name = "CompletionBudgetRefusal"; this.reason = reason; }
|
|
45
|
+
}
|
|
46
|
+
export class CompletionSeriesBusyError extends Error { constructor(message = "completion series is busy in another process") { super(message); this.name = "CompletionSeriesBusyError"; } }
|
|
47
|
+
|
|
48
|
+
export const T12_SERIES_LIMITS: CompletionSeriesLimits = Object.freeze({
|
|
49
|
+
seriesRequestLimit: 60,
|
|
50
|
+
stageRequestLimits: Object.freeze({ diagnostic: 12, benchmark: 48 }),
|
|
51
|
+
inputTokensPerRequest: 16384,
|
|
52
|
+
outputTokensPerRequest: 2048,
|
|
53
|
+
requestTimeoutMs: 180_000,
|
|
54
|
+
maxActiveRequests: 1,
|
|
55
|
+
maxRequestsPerUnit: Object.freeze({ diagnostic: 2, benchmark: 4 }),
|
|
56
|
+
autoRetry: false,
|
|
57
|
+
fallback: false,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export function sharedCompletionSeriesBudgetPath(sessionDir: string, seriesId: string): string {
|
|
61
|
+
if (!/^[A-Za-z0-9._-]{1,80}$/.test(seriesId)) throw new Error("invalid completion series identity");
|
|
62
|
+
const sessionsDir = dirname(sessionDir);
|
|
63
|
+
if (basename(sessionsDir) !== "sessions") throw new Error("managed session path is not under the runtime sessions directory");
|
|
64
|
+
return join(dirname(sessionsDir), "series", `${seriesId}-budget.json`);
|
|
65
|
+
}
|
|
66
|
+
export function completionSeriesLockPath(budgetPath: string): string { return `${budgetPath}.lock`; }
|
|
67
|
+
export function createCompletionSeriesState(seriesId: string, limits: CompletionSeriesLimits = T12_SERIES_LIMITS): CompletionSeriesState {
|
|
68
|
+
if (!seriesId.trim()) throw new Error("seriesId is required");
|
|
69
|
+
return { schema: COMPLETION_SERIES_BUDGET_SCHEMA, seriesId, seriesRequestsStarted: 0, stages: { diagnostic: { requestsStarted: 0 }, benchmark: { requestsStarted: 0 } }, reservationHistory: [], cancelled: false, limits: structuredClone(limits) };
|
|
70
|
+
}
|
|
71
|
+
function isStage(value: unknown): value is CompletionSeriesStage { return value === "diagnostic" || value === "benchmark"; }
|
|
72
|
+
function safeCount(value: unknown): value is number { return Number.isSafeInteger(value) && Number(value) >= 0; }
|
|
73
|
+
function validateV2(value: any): CompletionSeriesState {
|
|
74
|
+
if (value?.schema !== COMPLETION_SERIES_BUDGET_SCHEMA || typeof value.seriesId !== "string" || !safeCount(value.seriesRequestsStarted)
|
|
75
|
+
|| !safeCount(value?.stages?.diagnostic?.requestsStarted) || !safeCount(value?.stages?.benchmark?.requestsStarted)
|
|
76
|
+
|| !Array.isArray(value.reservationHistory) || typeof value.cancelled !== "boolean") throw new Error("invalid completion-series budget state");
|
|
77
|
+
if (value.stages.diagnostic.requestsStarted + value.stages.benchmark.requestsStarted !== value.seriesRequestsStarted) throw new Error("completion-series counters do not reconcile");
|
|
78
|
+
if (value.reservationHistory.length !== value.seriesRequestsStarted || value.reservationHistory.some((entry: any, index: number) => entry?.sequence !== index + 1 || !isStage(entry?.stage) || typeof entry?.startedAt !== "string")) throw new Error("completion-series reservation history does not reconcile");
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
export function readCompletionSeriesState(path: string): CompletionSeriesState {
|
|
82
|
+
return validateV2(JSON.parse(readFileSync(path, "utf8")));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Migrate only when every consumed request has explicit stage provenance.
|
|
87
|
+
* Old zero-use ledgers are unambiguous; nonzero aggregate-only v1 ledgers fail closed.
|
|
88
|
+
*/
|
|
89
|
+
export function migrateCompletionSeriesBudget(path: string): CompletionSeriesState {
|
|
90
|
+
const raw = JSON.parse(readFileSync(path, "utf8"));
|
|
91
|
+
if (raw?.schema === COMPLETION_SERIES_BUDGET_SCHEMA) return validateV2(raw);
|
|
92
|
+
if (raw?.schema !== COMPLETION_SERIES_BUDGET_V1_SCHEMA || typeof raw.seriesId !== "string" || !safeCount(raw.seriesRequestsStarted) || !safeCount(raw.stageRequestsStarted)) throw new Error("invalid completion-series budget state");
|
|
93
|
+
const history = Array.isArray(raw.reservationHistory) ? raw.reservationHistory : [];
|
|
94
|
+
if (raw.seriesRequestsStarted !== raw.stageRequestsStarted) throw new Error("ambiguous v1 completion-series allocation; refusing migration");
|
|
95
|
+
if (raw.seriesRequestsStarted > 0 && (history.length !== raw.seriesRequestsStarted || history.some((entry: any) => !isStage(entry?.stage) || typeof entry?.startedAt !== "string"))) throw new Error("ambiguous v1 completion-series allocation; refusing migration");
|
|
96
|
+
const migrated = createCompletionSeriesState(raw.seriesId);
|
|
97
|
+
migrated.cancelled = raw.cancelled === true;
|
|
98
|
+
for (const [index, entry] of history.entries()) {
|
|
99
|
+
const stage = entry.stage as CompletionSeriesStage;
|
|
100
|
+
migrated.seriesRequestsStarted++;
|
|
101
|
+
migrated.stages[stage].requestsStarted++;
|
|
102
|
+
migrated.reservationHistory.push({ sequence: index + 1, stage, startedAt: entry.startedAt });
|
|
103
|
+
}
|
|
104
|
+
writeCompletionSeriesState(path, migrated);
|
|
105
|
+
return migrated;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Crash-safe replacement: a provider request is sent only after this durable rename completes. */
|
|
109
|
+
export function writeCompletionSeriesState(path: string, state: CompletionSeriesState): void {
|
|
110
|
+
const validated = validateV2(state);
|
|
111
|
+
const temporary = `${path}.tmp-${process.pid}-${randomUUID()}`;
|
|
112
|
+
let fd: number | undefined;
|
|
113
|
+
try {
|
|
114
|
+
fd = openSync(temporary, "wx", 0o600);
|
|
115
|
+
writeSync(fd, JSON.stringify(validated, null, 2)); fsyncSync(fd); closeSync(fd); fd = undefined;
|
|
116
|
+
renameSync(temporary, path);
|
|
117
|
+
try { const dirFd = openSync(dirname(path), "r"); try { fsyncSync(dirFd); } finally { closeSync(dirFd); } } catch {}
|
|
118
|
+
} finally { if (fd !== undefined) closeSync(fd); try { unlinkSync(temporary); } catch {} }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function acquireCompletionSeriesLock(lockPath: string, ownerId = randomUUID()): CompletionSeriesLock {
|
|
122
|
+
const lock: CompletionSeriesLock = { schema: COMPLETION_SERIES_LOCK_SCHEMA, ownerId, pid: process.pid, acquiredAt: new Date().toISOString() };
|
|
123
|
+
let fd: number;
|
|
124
|
+
try { fd = openSync(lockPath, "wx", 0o600); }
|
|
125
|
+
catch (error: any) { if (error?.code === "EEXIST") throw new CompletionSeriesBusyError(); throw error; }
|
|
126
|
+
try { writeSync(fd, JSON.stringify(lock)); fsyncSync(fd); } catch (error) { try { unlinkSync(lockPath); } catch {} throw error; } finally { closeSync(fd); }
|
|
127
|
+
return lock;
|
|
128
|
+
}
|
|
129
|
+
export function readCompletionSeriesLock(lockPath: string): CompletionSeriesLock | null {
|
|
130
|
+
try { const value = JSON.parse(readFileSync(lockPath, "utf8")); return value?.schema === COMPLETION_SERIES_LOCK_SCHEMA && typeof value.ownerId === "string" && Number.isSafeInteger(value.pid) ? value : null; }
|
|
131
|
+
catch { return null; }
|
|
132
|
+
}
|
|
133
|
+
export function releaseOwnedCompletionSeriesLock(lockPath: string, ownerId: string): void {
|
|
134
|
+
const lock = readCompletionSeriesLock(lockPath);
|
|
135
|
+
if (!lock || lock.ownerId !== ownerId) throw new Error("completion-series lock ownership changed; refusing release");
|
|
136
|
+
unlinkSync(lockPath);
|
|
137
|
+
}
|
|
138
|
+
function processAlive(pid: number): boolean { try { process.kill(pid, 0); return true; } catch (error: any) { return error?.code !== "ESRCH"; } }
|
|
139
|
+
/** Human-only crash recovery. Never expires automatically and never releases a live owner. */
|
|
140
|
+
export function releaseCrashedCompletionSeriesLock(lockPath: string): "released" | "absent" {
|
|
141
|
+
if (!existsSync(lockPath)) return "absent";
|
|
142
|
+
const lock = readCompletionSeriesLock(lockPath);
|
|
143
|
+
if (lock && processAlive(lock.pid)) throw new CompletionSeriesBusyError(`completion series is owned by live pid ${lock.pid}`);
|
|
144
|
+
unlinkSync(lockPath); return "released";
|
|
145
|
+
}
|
|
146
|
+
function assertLockOwner(lockPath: string, ownerId: string): void {
|
|
147
|
+
const lock = readCompletionSeriesLock(lockPath);
|
|
148
|
+
if (!lock || lock.ownerId !== ownerId) throw new CompletionBudgetRefusal("lock-not-owned", "completion-series lock is not owned by this run");
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Reserve durably immediately before provider transport. Failed started completions remain charged. */
|
|
152
|
+
export function reserveCompletionRequest(path: string, unitRequestsStarted: number, lockPath: string, ownerId: string, stage: CompletionSeriesStage): CompletionSeriesState {
|
|
153
|
+
assertLockOwner(lockPath, ownerId);
|
|
154
|
+
const state = readCompletionSeriesState(path);
|
|
155
|
+
if (state.cancelled) throw new CompletionBudgetRefusal("cancelled", "completion series is fenced after cancellation");
|
|
156
|
+
if (state.seriesRequestsStarted >= state.limits.seriesRequestLimit) throw new CompletionBudgetRefusal("series-exhausted", "whole-series provider request budget exhausted");
|
|
157
|
+
if (state.stages[stage].requestsStarted >= state.limits.stageRequestLimits[stage]) throw new CompletionBudgetRefusal("stage-exhausted", `${stage}-stage provider request budget exhausted`);
|
|
158
|
+
if (unitRequestsStarted >= state.limits.maxRequestsPerUnit[stage]) throw new CompletionBudgetRefusal("probe-exhausted", `${stage} unit provider request budget exhausted`);
|
|
159
|
+
const next = structuredClone(state);
|
|
160
|
+
next.seriesRequestsStarted++;
|
|
161
|
+
next.stages[stage].requestsStarted++;
|
|
162
|
+
next.reservationHistory.push({ sequence: next.seriesRequestsStarted, stage, startedAt: new Date().toISOString() });
|
|
163
|
+
writeCompletionSeriesState(path, next); return next;
|
|
164
|
+
}
|
|
165
|
+
export function fenceCompletionSeries(path: string, lockPath: string, ownerId: string): CompletionSeriesState {
|
|
166
|
+
assertLockOwner(lockPath, ownerId);
|
|
167
|
+
const state = readCompletionSeriesState(path), next = { ...state, cancelled: true };
|
|
168
|
+
writeCompletionSeriesState(path, next); return next;
|
|
169
|
+
}
|
|
170
|
+
export function conservativeTextInputPreflight(payload: unknown, cap: number): CountingProvenance {
|
|
171
|
+
const serialized = JSON.stringify(payload);
|
|
172
|
+
if (serialized === undefined) throw new Error("provider payload cannot be serialized for input preflight");
|
|
173
|
+
const serializedBytes = Buffer.byteLength(serialized, "utf8");
|
|
174
|
+
const count = serializedBytes * 2 + 1024;
|
|
175
|
+
const provenance: CountingProvenance = { method: "serialized-provider-payload-utf8-bytes-times-2-plus-1024/v1", count, serializedBytes, multiplier: 2, reservedTokens: 1024, unit: "conservative-token-upper-bound", cap, textOnly: true };
|
|
176
|
+
if (count > cap) throw new Error(`provider payload conservative upper bound ${count} exceeds ${cap} input-token cap`);
|
|
177
|
+
return provenance;
|
|
178
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { profileService } from './policy/profile-runtime.ts';
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { buildDeliverableProtocol } from "../lib/context-budget-child-prompt.ts";
|
|
4
|
+
import { unlinkSync } from "node:fs";
|
|
5
|
+
import type { ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
import type { ComsIdentity, ComsSendParams, ComsSendResult, PendingReply, RegistryEntry } from "../lib/coms-core.ts";
|
|
7
|
+
import { judgeSessionFileName, type DriftJudgeOutcome } from "./drift-runtime.ts";
|
|
8
|
+
import { buildJudgePrompt, parseJudgeVerdict } from "./drift-watchdog.js";
|
|
9
|
+
import { externalBlockedProtocol } from "./external-blocker.js";
|
|
10
|
+
import { EXTRACTION_DEADLINE_MS, EXTRACTION_MODEL, buildExtractionPrompt, extractionSessionName } from "./return-extract.js";
|
|
11
|
+
import { parseStructuredReturn } from "./return-contract.js";
|
|
12
|
+
import type { SpawnPiAgentOptions } from "./spawn.ts";
|
|
13
|
+
|
|
14
|
+
export interface DispatchInputArtifactPreview {
|
|
15
|
+
input: string;
|
|
16
|
+
path: string;
|
|
17
|
+
displayPath: string;
|
|
18
|
+
preview: string;
|
|
19
|
+
resolvedFromKind?: string | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ComsDispatchState {
|
|
23
|
+
dispatchId?: string;
|
|
24
|
+
def: { name: string };
|
|
25
|
+
runCount: number;
|
|
26
|
+
lastBackend?: "native" | "coms";
|
|
27
|
+
comsPeerModel?: string;
|
|
28
|
+
contextPct: number;
|
|
29
|
+
lastWork: string;
|
|
30
|
+
comsAbort?: () => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface DriftJudgeInput {
|
|
34
|
+
agentLabel: string;
|
|
35
|
+
agentKey: string;
|
|
36
|
+
task: string;
|
|
37
|
+
scopeGlobs: string[];
|
|
38
|
+
hubOwnedGlobs: string[];
|
|
39
|
+
trail: string[];
|
|
40
|
+
violation: { rule: string; terminal?: boolean; detail: string };
|
|
41
|
+
/** Aborts the judge child. Cancellation is not an unavailable verdict. */
|
|
42
|
+
signal?: AbortSignal;
|
|
43
|
+
/** Unique per check/LLM attempt so a previous finally cannot unlink the new session. */
|
|
44
|
+
sessionKey?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type { DriftJudgeOutcome };
|
|
48
|
+
|
|
49
|
+
interface SpawnResult {
|
|
50
|
+
output: string;
|
|
51
|
+
exitCode: number | null;
|
|
52
|
+
spawnError?: string;
|
|
53
|
+
termination?: { reason?: string };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface DispatchComsDeps {
|
|
57
|
+
getIdentity(): ComsIdentity | null;
|
|
58
|
+
resolveTarget(target: string): RegistryEntry | null;
|
|
59
|
+
send(params: ComsSendParams, auditExtra?: Record<string, unknown>): Promise<ComsSendResult>;
|
|
60
|
+
getPendingReply(msgId: string): PendingReply | undefined;
|
|
61
|
+
deletePendingReply(msgId: string): void;
|
|
62
|
+
getSessionDir(): string;
|
|
63
|
+
getWatchdogJudgeModel(): string | null;
|
|
64
|
+
getResearcherModel(): string | null;
|
|
65
|
+
displayName(name: string): string;
|
|
66
|
+
safeAgentKey(name: string): string;
|
|
67
|
+
safePathWithin(root: string, ...parts: string[]): string;
|
|
68
|
+
appendInputArtifacts(task: string, artifacts: DispatchInputArtifactPreview[]): string;
|
|
69
|
+
appendDeclaredScope(task: string, scopeGlobs: string[]): string;
|
|
70
|
+
buildRulesProtocol(): string;
|
|
71
|
+
buildDocsProtocol(): string;
|
|
72
|
+
updateWidget(): void;
|
|
73
|
+
spawnPiAgent(options: SpawnPiAgentOptions): Promise<SpawnResult>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ComsDispatchResult {
|
|
77
|
+
output: string;
|
|
78
|
+
exitCode: number;
|
|
79
|
+
elapsed: number;
|
|
80
|
+
abandoned?: boolean;
|
|
81
|
+
pending?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function dispatchViaComs(
|
|
85
|
+
deps: DispatchComsDeps,
|
|
86
|
+
state: ComsDispatchState,
|
|
87
|
+
task: string,
|
|
88
|
+
peerName: string,
|
|
89
|
+
timeoutMs: number,
|
|
90
|
+
allowNativeFallback: boolean,
|
|
91
|
+
ctx: ExtensionContext,
|
|
92
|
+
inputArtifacts: DispatchInputArtifactPreview[],
|
|
93
|
+
scopeGlobs: string[],
|
|
94
|
+
): Promise<ComsDispatchResult | null> {
|
|
95
|
+
const peer = deps.resolveTarget(peerName);
|
|
96
|
+
if (!peer || !deps.getIdentity()) {
|
|
97
|
+
if (allowNativeFallback) return null;
|
|
98
|
+
return { output: `coms dispatch failed: peer "${peerName}" left the pool (fallback: none).`, exitCode: 1, elapsed: 0 };
|
|
99
|
+
}
|
|
100
|
+
state.lastBackend = "coms";
|
|
101
|
+
state.comsPeerModel = peer.model;
|
|
102
|
+
state.contextPct = peer.context_used_pct ?? 0;
|
|
103
|
+
state.lastWork = `→ coms peer ${peer.name}...`;
|
|
104
|
+
deps.updateWidget();
|
|
105
|
+
|
|
106
|
+
const agentKey = deps.safeAgentKey(state.def.name);
|
|
107
|
+
const runNumber = state.runCount;
|
|
108
|
+
const dispatchProtocol = `
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
## Dispatch protocol (agent-hub)
|
|
112
|
+
You are serving a dispatched task as a standing peer; the dispatcher only receives this reply, so make it your complete final answer.
|
|
113
|
+
- Clarification: if you need a HUMAN decision (ambiguity, missing input, contradiction, or a destructive/irreversible next step), do NOT guess — include line(s) of the form \`ASK_USER: <one clear English question>\`; you will be re-dispatched with the answers.
|
|
114
|
+
${externalBlockedProtocol()}
|
|
115
|
+
${buildDeliverableProtocol(agentKey, runNumber, deps.safePathWithin(deps.getSessionDir(), "artifacts"), state.dispatchId ?? randomUUID())}
|
|
116
|
+
- If the task includes acceptance assertions (A1, A2, ...), include the structured return from skills/orchestration-verification/SKILL.md.` +
|
|
117
|
+
deps.buildRulesProtocol() + deps.buildDocsProtocol();
|
|
118
|
+
const prompt = deps.appendDeclaredScope(deps.appendInputArtifacts(task, inputArtifacts), scopeGlobs) + dispatchProtocol;
|
|
119
|
+
|
|
120
|
+
let sent: ComsSendResult;
|
|
121
|
+
try {
|
|
122
|
+
sent = await deps.send({
|
|
123
|
+
target: peer.name,
|
|
124
|
+
prompt,
|
|
125
|
+
conversation_id: null,
|
|
126
|
+
response_schema: null,
|
|
127
|
+
reply_timeout_ms: timeoutMs,
|
|
128
|
+
}, { dispatched_as: state.def.name });
|
|
129
|
+
} catch (err) {
|
|
130
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
131
|
+
if (allowNativeFallback) {
|
|
132
|
+
ctx.ui.notify(`${deps.displayName(state.def.name)}: coms peer unreachable (${msg}) — falling back to a native subagent.`, "warning");
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
return { output: `coms dispatch to "${peer.name}" failed: ${msg} (fallback: none).`, exitCode: 1, elapsed: 0 };
|
|
136
|
+
}
|
|
137
|
+
const msgId = sent.msg_id;
|
|
138
|
+
const entry = deps.getPendingReply(msgId)!;
|
|
139
|
+
const timeoutPromise = new Promise<{ error: string }>(resolve => {
|
|
140
|
+
entry.timer = setTimeout(() => resolve({ error: "timeout" }), timeoutMs);
|
|
141
|
+
try { (entry.timer as any).unref?.(); } catch {}
|
|
142
|
+
});
|
|
143
|
+
let abandoned = false;
|
|
144
|
+
const abortPromise = new Promise<{ error: string }>(resolve => {
|
|
145
|
+
state.comsAbort = () => { abandoned = true; resolve({ error: "abandoned" }); };
|
|
146
|
+
});
|
|
147
|
+
const outcome = await Promise.race([entry.promise, abortPromise, timeoutPromise]);
|
|
148
|
+
state.comsAbort = undefined;
|
|
149
|
+
if (entry.timer) {
|
|
150
|
+
try { clearTimeout(entry.timer); } catch {}
|
|
151
|
+
entry.timer = null;
|
|
152
|
+
}
|
|
153
|
+
if (outcome.error !== "timeout") deps.deletePendingReply(msgId);
|
|
154
|
+
|
|
155
|
+
const after = deps.resolveTarget(peer.name);
|
|
156
|
+
if (after?.context_used_pct !== undefined) state.contextPct = after.context_used_pct;
|
|
157
|
+
if (abandoned) {
|
|
158
|
+
return {
|
|
159
|
+
output: `Dispatch to coms peer "${peer.name}" was abandoned by the operator. The peer may still be working in its own pane — do NOT auto-retry or re-dispatch; wait for the operator's instruction.`,
|
|
160
|
+
exitCode: 1,
|
|
161
|
+
elapsed: 0,
|
|
162
|
+
abandoned: true,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const err = outcome.error;
|
|
166
|
+
if (err === "timeout") {
|
|
167
|
+
return {
|
|
168
|
+
output: `coms dispatch pending after ${Math.round(timeoutMs / 1000)}s (msg_id ${msgId}). The peer may still complete; use coms_get/coms_await with this msg_id instead of re-dispatching.`,
|
|
169
|
+
exitCode: 1,
|
|
170
|
+
elapsed: 0,
|
|
171
|
+
pending: true,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (err) return { output: `coms peer "${peer.name}" returned an error: ${err}`, exitCode: 1, elapsed: 0 };
|
|
175
|
+
const response = (outcome as { response?: any }).response;
|
|
176
|
+
return { output: typeof response === "string" ? response : JSON.stringify(response, null, 2), exitCode: 0, elapsed: 0 };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function runDriftJudge(deps: DispatchComsDeps, input: DriftJudgeInput, ctx: ExtensionContext): Promise<DriftJudgeOutcome> {
|
|
180
|
+
if (input.signal?.aborted) return { status: "cancelled" };
|
|
181
|
+
const selection=profileService('watchdog');
|
|
182
|
+
const model = selection?.model ?? deps.getWatchdogJudgeModel()
|
|
183
|
+
?? deps.getResearcherModel()
|
|
184
|
+
?? (ctx.model ? `${ctx.model.provider}/${ctx.model.id}` : "openrouter/google/gemini-3-flash-preview");
|
|
185
|
+
const judgeSession = deps.safePathWithin(deps.getSessionDir(), judgeSessionFileName(input.sessionKey || randomUUID()));
|
|
186
|
+
try { unlinkSync(judgeSession); } catch {}
|
|
187
|
+
try {
|
|
188
|
+
const res = await deps.spawnPiAgent({
|
|
189
|
+
model,
|
|
190
|
+
tools: "read",
|
|
191
|
+
thinking: selection?.thinking ?? "off",
|
|
192
|
+
appendSystemPrompt: "You are a strict, terse runtime watchdog. Answer with exactly one VERDICT line.",
|
|
193
|
+
sessionFile: judgeSession,
|
|
194
|
+
signal: input.signal,
|
|
195
|
+
prompt: buildJudgePrompt({
|
|
196
|
+
agent: input.agentLabel,
|
|
197
|
+
task: input.task,
|
|
198
|
+
scopeGlobs: input.scopeGlobs,
|
|
199
|
+
hubOwnedGlobs: input.hubOwnedGlobs,
|
|
200
|
+
trail: input.trail,
|
|
201
|
+
violation: input.violation,
|
|
202
|
+
}),
|
|
203
|
+
detached: true,
|
|
204
|
+
turnDeadlineMs: 60_000,
|
|
205
|
+
});
|
|
206
|
+
if (input.signal?.aborted || res.termination?.reason === "cancelled") return { status: "cancelled" };
|
|
207
|
+
if (res.spawnError || res.exitCode !== 0) return { status: "unavailable" };
|
|
208
|
+
const parsed = parseJudgeVerdict(res.output);
|
|
209
|
+
if (!parsed) return { status: "unavailable" };
|
|
210
|
+
return { status: "verdict", verdict: parsed.verdict, reason: parsed.reason };
|
|
211
|
+
} catch {
|
|
212
|
+
return input.signal?.aborted ? { status: "cancelled" } : { status: "unavailable" };
|
|
213
|
+
}
|
|
214
|
+
finally { try { unlinkSync(judgeSession); } catch {} }
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async function runReturnExtraction(deps: DispatchComsDeps, returnPath: string, assertionIds: string[]): Promise<any | null> {
|
|
218
|
+
const extractSession = deps.safePathWithin(deps.getSessionDir(), extractionSessionName(returnPath));
|
|
219
|
+
try { unlinkSync(extractSession); } catch {}
|
|
220
|
+
try {
|
|
221
|
+
const res = await deps.spawnPiAgent({
|
|
222
|
+
model: profileService('return-extractor')?.model ?? EXTRACTION_MODEL,
|
|
223
|
+
tools: "read",
|
|
224
|
+
thinking: profileService('return-extractor')?.thinking ?? "off",
|
|
225
|
+
appendSystemPrompt: "You restate an existing report in a fixed format. You never judge the work and never invent evidence.",
|
|
226
|
+
sessionFile: extractSession,
|
|
227
|
+
prompt: buildExtractionPrompt({ returnPath, assertionIds }),
|
|
228
|
+
detached: true,
|
|
229
|
+
turnDeadlineMs: EXTRACTION_DEADLINE_MS,
|
|
230
|
+
});
|
|
231
|
+
if (res.spawnError || res.exitCode !== 0) return null;
|
|
232
|
+
return parseStructuredReturn(res.output);
|
|
233
|
+
} catch { return null; }
|
|
234
|
+
finally { try { unlinkSync(extractSession); } catch {} }
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export function createDispatchComs(deps: DispatchComsDeps) {
|
|
238
|
+
return {
|
|
239
|
+
dispatchViaComs: (
|
|
240
|
+
state: ComsDispatchState,
|
|
241
|
+
task: string,
|
|
242
|
+
peerName: string,
|
|
243
|
+
timeoutMs: number,
|
|
244
|
+
allowNativeFallback: boolean,
|
|
245
|
+
ctx: ExtensionContext,
|
|
246
|
+
inputArtifacts: DispatchInputArtifactPreview[],
|
|
247
|
+
scopeGlobs: string[],
|
|
248
|
+
) => dispatchViaComs(deps, state, task, peerName, timeoutMs, allowNativeFallback, ctx, inputArtifacts, scopeGlobs),
|
|
249
|
+
runDriftJudge: (input: DriftJudgeInput, ctx: ExtensionContext) => runDriftJudge(deps, input, ctx),
|
|
250
|
+
runReturnExtraction: (returnPath: string, assertionIds: string[], _ctx?: ExtensionContext) => runReturnExtraction(deps, returnPath, assertionIds),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Phase 4 dispatch facade. The composition root supplies explicit stateful deps;
|
|
2
|
+
// native, coms, and observability implementations remain internal modules.
|
|
3
|
+
export {
|
|
4
|
+
createDispatchComs,
|
|
5
|
+
type ComsDispatchResult,
|
|
6
|
+
type ComsDispatchState,
|
|
7
|
+
type DispatchComsDeps,
|
|
8
|
+
type DispatchInputArtifactPreview,
|
|
9
|
+
type DriftJudgeInput,
|
|
10
|
+
} from "./dispatch-coms.ts";
|
|
11
|
+
export {
|
|
12
|
+
createDispatchNative,
|
|
13
|
+
} from "./dispatch-native.ts";
|
|
14
|
+
export type {
|
|
15
|
+
NativeAgentDefinition,
|
|
16
|
+
NativeBackend,
|
|
17
|
+
NativeDispatchDeps,
|
|
18
|
+
NativeDispatchResult,
|
|
19
|
+
NativeDispatchState,
|
|
20
|
+
} from "./dispatch-native-types.ts";
|
|
21
|
+
export {
|
|
22
|
+
createDispatchObservability,
|
|
23
|
+
type DelegationChild,
|
|
24
|
+
type DelegationEvent,
|
|
25
|
+
type DelegationObservableState,
|
|
26
|
+
type DispatchObservabilityDeps,
|
|
27
|
+
} from "./dispatch-observability.ts";
|