@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,480 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import type { PiRunControl, Termination } from "./spawn.ts";
|
|
3
|
+
|
|
4
|
+
/** Only a valid judge verdict buys the success-path cooldown. */
|
|
5
|
+
export const DRIFT_JUDGE_COOLDOWN_MS = 90_000;
|
|
6
|
+
|
|
7
|
+
export type DriftJudgeOutcome =
|
|
8
|
+
| { status: "verdict"; verdict: string; reason: string }
|
|
9
|
+
| { status: "unavailable" }
|
|
10
|
+
| { status: "cancelled" };
|
|
11
|
+
|
|
12
|
+
export interface DriftViolation {
|
|
13
|
+
rule: string;
|
|
14
|
+
terminal?: boolean;
|
|
15
|
+
detail: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface DriftStopRecord {
|
|
19
|
+
rule: string;
|
|
20
|
+
detail: string;
|
|
21
|
+
verdict: string;
|
|
22
|
+
reason: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface DriftCheckIdentity {
|
|
26
|
+
readonly dispatchId: string;
|
|
27
|
+
readonly attemptId: string;
|
|
28
|
+
readonly checkId: string;
|
|
29
|
+
readonly snapshotId: string;
|
|
30
|
+
readonly llmAttemptId: string;
|
|
31
|
+
settled: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface DriftAttempt {
|
|
35
|
+
readonly dispatchId: string;
|
|
36
|
+
readonly attemptId: string;
|
|
37
|
+
readonly generation: number;
|
|
38
|
+
readonly signal: AbortSignal;
|
|
39
|
+
readonly childSignal: AbortSignal;
|
|
40
|
+
disposed: boolean;
|
|
41
|
+
settled: boolean;
|
|
42
|
+
stop: DriftStopRecord | null;
|
|
43
|
+
stopCheck: DriftCheckIdentity | null;
|
|
44
|
+
advisories: DriftStopRecord[];
|
|
45
|
+
checks: DriftCheckIdentity[];
|
|
46
|
+
unused: DriftJudgeOutcome[];
|
|
47
|
+
control?: PiRunControl;
|
|
48
|
+
dispose(): void;
|
|
49
|
+
markSettled(): void;
|
|
50
|
+
isLive(): boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface DriftAttemptLifecycle {
|
|
54
|
+
beforePhysicalSpawn(info: { generation: number }): { signal?: AbortSignal } | void;
|
|
55
|
+
afterPhysicalSpawn(info: { generation: number }): void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface DriftMonitorLike {
|
|
59
|
+
onToolStart(toolName: string, argStr: string, callId?: string): DriftViolation | null | undefined;
|
|
60
|
+
onToolEnd(toolName: string, isError?: boolean, callId?: string): DriftViolation | null | undefined;
|
|
61
|
+
trail(): string[];
|
|
62
|
+
isSignalCurrent?(violation: DriftViolation): boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface DriftRuntime {
|
|
66
|
+
readonly attempts: DriftAttempt[];
|
|
67
|
+
readonly fence: { dispose(): void };
|
|
68
|
+
readonly attemptLifecycle: DriftAttemptLifecycle;
|
|
69
|
+
readonly monitor: DriftMonitorLike | null;
|
|
70
|
+
acceptsCallbacks(): boolean;
|
|
71
|
+
bindControl(control: PiRunControl): void;
|
|
72
|
+
escalate(violation: DriftViolation): void;
|
|
73
|
+
outcomeFor(result: { termination?: Termination | null }): {
|
|
74
|
+
driftStop: DriftStopRecord | null;
|
|
75
|
+
driftAdvisories: DriftStopRecord[];
|
|
76
|
+
applied: boolean;
|
|
77
|
+
};
|
|
78
|
+
dispose(): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function fenceOperatorCancel(state: object | null | undefined): void {
|
|
82
|
+
// Research workers do not own a drift fence; native specialists may have one.
|
|
83
|
+
try {
|
|
84
|
+
if (state && "driftFence" in state) (state.driftFence as { dispose(): void } | null | undefined)?.dispose();
|
|
85
|
+
} catch { /* a fence must not block the kill */ }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A terminate request is not an applied stop. Exit precedence stays with the spawn classifier. */
|
|
89
|
+
export function reconcileAppliedDriftStop(
|
|
90
|
+
requested: DriftStopRecord | null,
|
|
91
|
+
termination: Termination | null | undefined,
|
|
92
|
+
): { applied: boolean; driftStop: DriftStopRecord | null } {
|
|
93
|
+
const applied = termination?.reason === "drift_stop";
|
|
94
|
+
return { applied, driftStop: applied ? requested : null };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function normalizeJudgeOutcome(value: unknown): DriftJudgeOutcome {
|
|
98
|
+
if (!value || typeof value !== "object") return { status: "unavailable" };
|
|
99
|
+
const record = value as { status?: string; verdict?: string; reason?: string };
|
|
100
|
+
if (record.status === "cancelled" || record.status === "unavailable") return { status: record.status };
|
|
101
|
+
if ((record.status === "verdict" || record.status == null) && (record.verdict === "on_track" || record.verdict === "drifting" || record.verdict === "stuck")) {
|
|
102
|
+
return { status: "verdict", verdict: record.verdict, reason: String(record.reason ?? "") };
|
|
103
|
+
}
|
|
104
|
+
return { status: "unavailable" };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function judgeSessionFileName(sessionKey: string): string {
|
|
108
|
+
const safe = sessionKey.replace(/[^a-zA-Z0-9._-]/g, "").slice(0, 180);
|
|
109
|
+
return `drift-judge-${safe || randomUUID()}.json`;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface DriftShadowLaunch {
|
|
113
|
+
check: DriftCheckIdentity;
|
|
114
|
+
attemptLive: () => boolean;
|
|
115
|
+
violation: DriftViolation;
|
|
116
|
+
signal: AbortSignal;
|
|
117
|
+
trail: string[];
|
|
118
|
+
observation: unknown;
|
|
119
|
+
/** Elapsed since this physical attempt began, captured with the tool observation. */
|
|
120
|
+
elapsedMs?: number;
|
|
121
|
+
retry?: boolean;
|
|
122
|
+
startLlm: () => void;
|
|
123
|
+
onShortcut?: () => void;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface DriftAppliedAttribution {
|
|
127
|
+
dispatchId: string;
|
|
128
|
+
attemptId: string;
|
|
129
|
+
checkId: string;
|
|
130
|
+
snapshotId: string;
|
|
131
|
+
llmAttemptId: string;
|
|
132
|
+
rule?: string;
|
|
133
|
+
outcome: "continue" | "advisory" | "drift_stop" | "judge_unavailable";
|
|
134
|
+
applied: "yes" | "no";
|
|
135
|
+
source: "llm" | "none" | "system1";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface DriftRuntimeOptions {
|
|
139
|
+
dispatchId: string;
|
|
140
|
+
agentKey: string;
|
|
141
|
+
agentLabel: string;
|
|
142
|
+
task: string;
|
|
143
|
+
scopeGlobs: string[];
|
|
144
|
+
hubOwnedGlobs: string[];
|
|
145
|
+
armed: boolean;
|
|
146
|
+
ctx: unknown;
|
|
147
|
+
runDriftJudge(input: Record<string, unknown>, ctx: unknown): Promise<unknown>;
|
|
148
|
+
monitor?: DriftMonitorLike | null;
|
|
149
|
+
now?: () => number;
|
|
150
|
+
setTimer?: (fn: () => void, ms: number) => ReturnType<typeof setTimeout>;
|
|
151
|
+
clearTimer?: (handle: ReturnType<typeof setTimeout>) => void;
|
|
152
|
+
/** Called synchronously before the LLM promise is observed. Must not be awaited. */
|
|
153
|
+
launchShadow?: (input: DriftShadowLaunch) => { onLlmSettled?: (value: unknown) => void; deferLlm?: boolean } | void;
|
|
154
|
+
onDispose?: () => void;
|
|
155
|
+
onOutcome?: (input: { applied: boolean; driftStop: DriftStopRecord | null; advisories: DriftStopRecord[]; attributions: DriftAppliedAttribution[] }) => void;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface Attempt extends DriftAttempt {
|
|
159
|
+
startedAt: number;
|
|
160
|
+
childAbort: AbortController;
|
|
161
|
+
judgeAbort: AbortController;
|
|
162
|
+
busyCheckId: string | null;
|
|
163
|
+
attachControl(control: PiRunControl): void;
|
|
164
|
+
openCheck(): DriftCheckIdentity;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function createAttempt(dispatchId: string, generation: number, startedAt: number): Attempt {
|
|
168
|
+
const childAbort = new AbortController();
|
|
169
|
+
const judgeAbort = new AbortController();
|
|
170
|
+
const attempt: Attempt = {
|
|
171
|
+
dispatchId,
|
|
172
|
+
generation,
|
|
173
|
+
startedAt,
|
|
174
|
+
attemptId: randomUUID(),
|
|
175
|
+
disposed: false,
|
|
176
|
+
settled: false,
|
|
177
|
+
stop: null,
|
|
178
|
+
stopCheck: null,
|
|
179
|
+
advisories: [],
|
|
180
|
+
checks: [],
|
|
181
|
+
unused: [],
|
|
182
|
+
busyCheckId: null,
|
|
183
|
+
childAbort,
|
|
184
|
+
judgeAbort,
|
|
185
|
+
get signal() { return judgeAbort.signal; },
|
|
186
|
+
get childSignal() { return childAbort.signal; },
|
|
187
|
+
isLive() { return !attempt.disposed; },
|
|
188
|
+
markSettled() { attempt.settled = true; },
|
|
189
|
+
dispose() {
|
|
190
|
+
if (attempt.disposed) return;
|
|
191
|
+
attempt.disposed = true;
|
|
192
|
+
attempt.control = undefined;
|
|
193
|
+
judgeAbort.abort();
|
|
194
|
+
if (!attempt.settled) childAbort.abort();
|
|
195
|
+
},
|
|
196
|
+
attachControl(control) {
|
|
197
|
+
attempt.control = {
|
|
198
|
+
terminate: (reason) => {
|
|
199
|
+
if (!attempt.isLive()) return;
|
|
200
|
+
control.terminate(reason);
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
openCheck() {
|
|
205
|
+
const check: DriftCheckIdentity = {
|
|
206
|
+
dispatchId,
|
|
207
|
+
attemptId: attempt.attemptId,
|
|
208
|
+
checkId: randomUUID(),
|
|
209
|
+
snapshotId: randomUUID(),
|
|
210
|
+
llmAttemptId: randomUUID(),
|
|
211
|
+
settled: false,
|
|
212
|
+
};
|
|
213
|
+
attempt.checks.push(check);
|
|
214
|
+
return check;
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
childAbort.signal.addEventListener("abort", () => judgeAbort.abort(), { once: true });
|
|
218
|
+
return attempt;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export function createDriftRuntime(options: DriftRuntimeOptions): DriftRuntime {
|
|
222
|
+
const now = options.now ?? Date.now;
|
|
223
|
+
const attempts: Attempt[] = [];
|
|
224
|
+
const open: Attempt[] = [];
|
|
225
|
+
let current: Attempt | null = null;
|
|
226
|
+
let generation = 0;
|
|
227
|
+
let cooldownUntil = 0;
|
|
228
|
+
let operatorFenced = false;
|
|
229
|
+
const queued = new Map<string, DriftViolation>();
|
|
230
|
+
let retry: { attempt: Attempt; violation: DriftViolation } | null = null;
|
|
231
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
232
|
+
const setTimer = options.setTimer ?? ((fn: () => void, delay: number) => { const handle = setTimeout(fn, delay); handle.unref?.(); return handle; });
|
|
233
|
+
const clearTimer = options.clearTimer ?? clearTimeout;
|
|
234
|
+
const clearPending = () => { if (timer) clearTimer(timer); timer = null; retry = null; queued.clear(); };
|
|
235
|
+
const currentSignal = (violation: DriftViolation) => monitor?.isSignalCurrent?.(violation) ?? true;
|
|
236
|
+
const dispatchAdvisories: DriftStopRecord[] = [];
|
|
237
|
+
const attributions: DriftAppliedAttribution[] = [];
|
|
238
|
+
const monitor = options.armed ? (options.monitor ?? null) : null;
|
|
239
|
+
const attribute = (check: DriftCheckIdentity, violation: DriftViolation, outcome: DriftAppliedAttribution["outcome"]) => {
|
|
240
|
+
attributions.push({
|
|
241
|
+
dispatchId: check.dispatchId,
|
|
242
|
+
attemptId: check.attemptId,
|
|
243
|
+
checkId: check.checkId,
|
|
244
|
+
snapshotId: check.snapshotId,
|
|
245
|
+
llmAttemptId: check.llmAttemptId,
|
|
246
|
+
rule: violation.rule,
|
|
247
|
+
outcome,
|
|
248
|
+
applied: "no",
|
|
249
|
+
source: "llm",
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const beginAttempt = (): Attempt => {
|
|
254
|
+
clearPending();
|
|
255
|
+
if (current && !current.disposed) current.dispose();
|
|
256
|
+
const attempt = createAttempt(options.dispatchId, ++generation, now());
|
|
257
|
+
attempts.push(attempt);
|
|
258
|
+
current = attempt;
|
|
259
|
+
// A fence survives the gap before the next physical launch. Do not clear it here.
|
|
260
|
+
if (operatorFenced) attempt.dispose();
|
|
261
|
+
return attempt;
|
|
262
|
+
};
|
|
263
|
+
const disposeAll = () => {
|
|
264
|
+
operatorFenced = true;
|
|
265
|
+
clearPending();
|
|
266
|
+
for (const attempt of attempts) attempt.dispose();
|
|
267
|
+
open.length = 0;
|
|
268
|
+
};
|
|
269
|
+
const schedule = (ms: number) => {
|
|
270
|
+
if (timer) clearTimer(timer);
|
|
271
|
+
timer = setTimer(() => {
|
|
272
|
+
timer = null;
|
|
273
|
+
const attempt = current;
|
|
274
|
+
if (!attempt?.isLive() || !monitor) return;
|
|
275
|
+
if (attempt.busyCheckId) return;
|
|
276
|
+
if (retry) {
|
|
277
|
+
const pending = retry;
|
|
278
|
+
retry = null;
|
|
279
|
+
if (pending.attempt === attempt && currentSignal(pending.violation)) { startCheck(attempt, pending.violation, true); return; }
|
|
280
|
+
}
|
|
281
|
+
if (now() < cooldownUntil) { schedule(cooldownUntil - now()); return; }
|
|
282
|
+
const signals = [...queued.values()].sort((a, b) => Number(b.terminal !== false) - Number(a.terminal !== false));
|
|
283
|
+
queued.clear();
|
|
284
|
+
for (const signal of signals) {
|
|
285
|
+
if (currentSignal(signal)) { startCheck(attempt, signal, false); break; }
|
|
286
|
+
}
|
|
287
|
+
}, Math.max(0, ms));
|
|
288
|
+
};
|
|
289
|
+
const finishJudge = (attempt: Attempt, check: DriftCheckIdentity, violation: DriftViolation, value: unknown, wasRetry: boolean) => {
|
|
290
|
+
if (check.settled) return;
|
|
291
|
+
check.settled = true;
|
|
292
|
+
if (attempt.busyCheckId === check.checkId) attempt.busyCheckId = null;
|
|
293
|
+
const outcome = normalizeJudgeOutcome(value);
|
|
294
|
+
if (!attempt.isLive() || current !== attempt) {
|
|
295
|
+
attempt.unused.push(outcome);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (outcome.status === "cancelled") return;
|
|
299
|
+
// An absent verdict is not an LLM decision to continue.
|
|
300
|
+
if (outcome.status === "unavailable") {
|
|
301
|
+
attribute(check, violation, "judge_unavailable");
|
|
302
|
+
if (!wasRetry && currentSignal(violation)) {
|
|
303
|
+
retry = { attempt, violation };
|
|
304
|
+
schedule(5_000);
|
|
305
|
+
} else if (queued.size) schedule(0);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
cooldownUntil = now() + DRIFT_JUDGE_COOLDOWN_MS;
|
|
309
|
+
if (timer) { clearTimer(timer); timer = null; }
|
|
310
|
+
if (queued.size && outcome.verdict !== "drifting" && outcome.verdict !== "stuck") schedule(DRIFT_JUDGE_COOLDOWN_MS);
|
|
311
|
+
if (outcome.verdict !== "drifting" && outcome.verdict !== "stuck") {
|
|
312
|
+
attribute(check, violation, "continue");
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const record: DriftStopRecord = {
|
|
316
|
+
rule: violation.rule,
|
|
317
|
+
detail: violation.detail,
|
|
318
|
+
verdict: outcome.verdict,
|
|
319
|
+
reason: outcome.reason,
|
|
320
|
+
};
|
|
321
|
+
if (violation.terminal === false) {
|
|
322
|
+
attempt.advisories.push(record);
|
|
323
|
+
dispatchAdvisories.push(record);
|
|
324
|
+
attribute(check, violation, "advisory");
|
|
325
|
+
if (queued.size) schedule(DRIFT_JUDGE_COOLDOWN_MS);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
attempt.stop = record;
|
|
329
|
+
attempt.stopCheck = check;
|
|
330
|
+
attribute(check, violation, "drift_stop");
|
|
331
|
+
if (!attempt.isLive()) return;
|
|
332
|
+
attempt.control?.terminate("drift_stop");
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const startCheck = (attempt: Attempt, violation: DriftViolation, wasRetry: boolean) => {
|
|
336
|
+
if (!monitor || !attempt.isLive() || attempt.busyCheckId || attempt.stop) return;
|
|
337
|
+
const check = attempt.openCheck();
|
|
338
|
+
attempt.busyCheckId = check.checkId;
|
|
339
|
+
const trail = monitor.trail().slice();
|
|
340
|
+
const observation = snapshotObservation(monitor);
|
|
341
|
+
const elapsedMs = Math.max(0, now() - attempt.startedAt);
|
|
342
|
+
let started = false;
|
|
343
|
+
const settled = { onLlmSettled: undefined as ((value: unknown) => void) | undefined };
|
|
344
|
+
const startLlm = () => {
|
|
345
|
+
if (started) return;
|
|
346
|
+
started = true;
|
|
347
|
+
void options.runDriftJudge({
|
|
348
|
+
agentLabel: options.agentLabel,
|
|
349
|
+
agentKey: options.agentKey,
|
|
350
|
+
task: options.task,
|
|
351
|
+
scopeGlobs: options.scopeGlobs,
|
|
352
|
+
hubOwnedGlobs: options.hubOwnedGlobs,
|
|
353
|
+
trail,
|
|
354
|
+
violation,
|
|
355
|
+
signal: attempt.signal,
|
|
356
|
+
sessionKey: `${attempt.attemptId}-${check.llmAttemptId}`,
|
|
357
|
+
dispatchId: attempt.dispatchId,
|
|
358
|
+
attemptId: attempt.attemptId,
|
|
359
|
+
checkId: check.checkId,
|
|
360
|
+
snapshotId: check.snapshotId,
|
|
361
|
+
llmAttemptId: check.llmAttemptId,
|
|
362
|
+
}, options.ctx).then(value => {
|
|
363
|
+
finishJudge(attempt, check, violation, value, wasRetry);
|
|
364
|
+
try { settled.onLlmSettled?.(value); } catch { /* trace must not change the judge outcome */ }
|
|
365
|
+
}).catch(() => {
|
|
366
|
+
finishJudge(attempt, check, violation, { status: "unavailable" }, wasRetry);
|
|
367
|
+
try { settled.onLlmSettled?.({ status: "unavailable" }); } catch { /* trace must not change the judge outcome */ }
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
let deferLlm = false;
|
|
371
|
+
try {
|
|
372
|
+
const hooks = options.launchShadow?.({
|
|
373
|
+
check,
|
|
374
|
+
attemptLive: () => attempt.isLive() && current === attempt,
|
|
375
|
+
violation,
|
|
376
|
+
signal: attempt.signal,
|
|
377
|
+
trail,
|
|
378
|
+
observation,
|
|
379
|
+
elapsedMs,
|
|
380
|
+
retry: wasRetry,
|
|
381
|
+
startLlm,
|
|
382
|
+
onShortcut: () => {
|
|
383
|
+
if (check.settled || !attempt.isLive() || current !== attempt || attempt.busyCheckId !== check.checkId) return;
|
|
384
|
+
check.settled = true;
|
|
385
|
+
attempt.busyCheckId = null;
|
|
386
|
+
cooldownUntil = now() + DRIFT_JUDGE_COOLDOWN_MS;
|
|
387
|
+
if (queued.size) schedule(DRIFT_JUDGE_COOLDOWN_MS);
|
|
388
|
+
attributions.push({ dispatchId: check.dispatchId, attemptId: check.attemptId, checkId: check.checkId,
|
|
389
|
+
snapshotId: check.snapshotId, llmAttemptId: check.llmAttemptId, rule: violation.rule, source: "system1", outcome: "continue", applied: "no" });
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
if (hooks && hooks.onLlmSettled) settled.onLlmSettled = hooks.onLlmSettled;
|
|
393
|
+
deferLlm = !!hooks && hooks.deferLlm === true;
|
|
394
|
+
} catch {
|
|
395
|
+
/* a shadow observer must not block the authoritative LLM */
|
|
396
|
+
}
|
|
397
|
+
if (!started && !deferLlm) startLlm();
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
return {
|
|
401
|
+
attempts,
|
|
402
|
+
monitor,
|
|
403
|
+
fence: { dispose: disposeAll },
|
|
404
|
+
attemptLifecycle: {
|
|
405
|
+
beforePhysicalSpawn() {
|
|
406
|
+
const attempt = beginAttempt();
|
|
407
|
+
open.push(attempt);
|
|
408
|
+
return { signal: attempt.childSignal };
|
|
409
|
+
},
|
|
410
|
+
afterPhysicalSpawn() {
|
|
411
|
+
const attempt = open.pop() ?? current;
|
|
412
|
+
attempt?.markSettled();
|
|
413
|
+
attempt?.dispose();
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
acceptsCallbacks() {
|
|
417
|
+
return current?.isLive() === true;
|
|
418
|
+
},
|
|
419
|
+
bindControl(control) {
|
|
420
|
+
if (!current?.isLive()) return;
|
|
421
|
+
current.attachControl(control);
|
|
422
|
+
},
|
|
423
|
+
escalate(violation) {
|
|
424
|
+
const attempt = current;
|
|
425
|
+
if (!monitor || !attempt?.isLive() || attempt.stop) return;
|
|
426
|
+
if (attempt.busyCheckId || now() < cooldownUntil || retry) {
|
|
427
|
+
queued.set(violation.rule, violation);
|
|
428
|
+
if (!attempt.busyCheckId && !retry) schedule(cooldownUntil - now());
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
startCheck(attempt, violation, false);
|
|
432
|
+
},
|
|
433
|
+
outcomeFor(result) {
|
|
434
|
+
const reconciled = reconcileAppliedDriftStop(current?.stop ?? null, result.termination);
|
|
435
|
+
const driftAdvisories = dispatchAdvisories.slice();
|
|
436
|
+
const stopCheckId = reconciled.applied ? current?.stopCheck?.checkId : undefined;
|
|
437
|
+
const payload = attributions.map((item) => ({
|
|
438
|
+
...item,
|
|
439
|
+
applied: item.outcome === "drift_stop" && item.checkId === stopCheckId && item.attemptId === current?.attemptId ? "yes" as const : "no" as const,
|
|
440
|
+
}));
|
|
441
|
+
const seen = new Set(payload.map((item) => `${item.attemptId}:${item.checkId}`));
|
|
442
|
+
if (current && !reconciled.applied) {
|
|
443
|
+
for (const check of current.checks) {
|
|
444
|
+
if (seen.has(`${check.attemptId}:${check.checkId}`)) continue;
|
|
445
|
+
payload.push({
|
|
446
|
+
dispatchId: check.dispatchId,
|
|
447
|
+
attemptId: check.attemptId,
|
|
448
|
+
checkId: check.checkId,
|
|
449
|
+
snapshotId: check.snapshotId,
|
|
450
|
+
llmAttemptId: check.llmAttemptId,
|
|
451
|
+
outcome: "continue",
|
|
452
|
+
applied: "no",
|
|
453
|
+
source: "none",
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
const outcome = {
|
|
458
|
+
driftStop: reconciled.driftStop,
|
|
459
|
+
driftAdvisories,
|
|
460
|
+
applied: reconciled.applied,
|
|
461
|
+
};
|
|
462
|
+
try { options.onOutcome?.({ applied: outcome.applied, driftStop: outcome.driftStop, advisories: outcome.driftAdvisories, attributions: payload }); } catch { /* trace must not change applied attribution */ }
|
|
463
|
+
return outcome;
|
|
464
|
+
},
|
|
465
|
+
dispose() {
|
|
466
|
+
disposeAll();
|
|
467
|
+
try { options.onDispose?.(); } catch { /* disposal must still fence the attempt */ }
|
|
468
|
+
},
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function snapshotObservation(monitor: DriftMonitorLike): unknown {
|
|
473
|
+
const read = (monitor as DriftMonitorLike & { structuredObservation?: () => unknown }).structuredObservation;
|
|
474
|
+
if (typeof read !== "function") return undefined;
|
|
475
|
+
try {
|
|
476
|
+
return JSON.parse(JSON.stringify(read())) as unknown;
|
|
477
|
+
} catch {
|
|
478
|
+
return undefined;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { WATCHDOG_QUESTIONS_VERSION, WATCHDOG_STATE_VERSION, classifyStatusAnswer, type WatchdogStateBuild } from "./drift-system1.ts";
|
|
2
|
+
import type { System1Result } from "../lib/system1/contracts.ts";
|
|
3
|
+
|
|
4
|
+
export const WATCHDOG_POLICY_VERSION = "watchdog-policy/v1";
|
|
5
|
+
export interface AcceptedWatchdogProfile {
|
|
6
|
+
readonly policyVersion: typeof WATCHDOG_POLICY_VERSION;
|
|
7
|
+
readonly stateVersion: typeof WATCHDOG_STATE_VERSION;
|
|
8
|
+
readonly questionsVersion: typeof WATCHDOG_QUESTIONS_VERSION;
|
|
9
|
+
readonly provider: "typesafe";
|
|
10
|
+
readonly model: "jev-1.13.0";
|
|
11
|
+
readonly rules: readonly string[];
|
|
12
|
+
readonly minConfidence: number;
|
|
13
|
+
readonly maxContradiction: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PolicyDecision { action: "continue" | "llm" | "discard"; reason: string; source: "system1" | "none" }
|
|
16
|
+
const fallback = (reason: string): PolicyDecision => ({ action: "llm", reason, source: "none" });
|
|
17
|
+
/** No stop result exists. A config string cannot supply or approve a profile. */
|
|
18
|
+
export function decideSystem1(result: System1Result | unknown, snapshot: { live: boolean; rule: string; state: WatchdogStateBuild; requestedModel: string }, profile: AcceptedWatchdogProfile | null): PolicyDecision {
|
|
19
|
+
if (!snapshot.live) return { action: "discard", reason: "stale_attempt", source: "none" };
|
|
20
|
+
if (!profile) return fallback("calibration_required");
|
|
21
|
+
if (profile.policyVersion !== WATCHDOG_POLICY_VERSION || profile.stateVersion !== WATCHDOG_STATE_VERSION || profile.questionsVersion !== WATCHDOG_QUESTIONS_VERSION || !profile.rules.includes(snapshot.rule)) return fallback("profile_mismatch");
|
|
22
|
+
if (!snapshot.state.ok || snapshot.state.state.coverage.shortcut_blocked || snapshot.state.state.signal.rule !== snapshot.rule) return fallback("incomplete_state");
|
|
23
|
+
if (!Number.isFinite(profile.minConfidence) || profile.minConfidence < 0 || profile.minConfidence > 1 || !Number.isFinite(profile.maxContradiction) || profile.maxContradiction < 0 || profile.maxContradiction > 1) return fallback("invalid_profile");
|
|
24
|
+
if (!result || typeof result !== "object" || (result as System1Result).status !== "ok") return fallback("provider_unavailable");
|
|
25
|
+
const evaluation = (result as Extract<System1Result, { status: "ok" }>).evaluation;
|
|
26
|
+
if (evaluation.metadata.provider !== profile.provider || evaluation.metadata.requestedModel !== snapshot.requestedModel || evaluation.metadata.requestedModel !== profile.model || evaluation.metadata.returnedModel !== profile.model || evaluation.metadata.questionSetVersion !== profile.questionsVersion) return fallback("model_mismatch");
|
|
27
|
+
const answers = evaluation.answers;
|
|
28
|
+
if (!Array.isArray(answers) || answers.length !== 4 || new Set(answers.map(a => a.questionId)).size !== 4) return fallback("missing_answers");
|
|
29
|
+
const status = answers.find(a => a.questionId === "status");
|
|
30
|
+
const classified = classifyStatusAnswer(status);
|
|
31
|
+
if (!classified.usable || classified.value !== "on_track" || classified.provenance !== "provider" || status?.type !== "choice") return fallback("not_on_track");
|
|
32
|
+
const { confidence, distribution } = status.uncertainty;
|
|
33
|
+
if (confidence! < profile.minConfidence || !distribution || Object.values(distribution).some(v => !Number.isFinite(v) || v < 0 || v > 1) || distribution.on_track < profile.minConfidence || Math.abs(Object.values(distribution).reduce((a, b) => a + b, 0) - 1) > 0.02) return fallback("low_confidence");
|
|
34
|
+
for (const id of ["repeating", "outside_task", "trail_carries_instructions"]) {
|
|
35
|
+
const answer = answers.find(a => a.questionId === id);
|
|
36
|
+
if (answer?.type !== "predicate" || answer.uncertainty?.provenance !== "provider" || !Number.isFinite(answer.probabilityTrue) || answer.probabilityTrue < 0 || answer.probabilityTrue > profile.maxContradiction) return fallback(`contradiction_${id}`);
|
|
37
|
+
}
|
|
38
|
+
return { action: "continue", reason: "accepted_on_track", source: "system1" };
|
|
39
|
+
}
|