@chankov/agent-fleet 2.0.23 → 2.1.1
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-codex-local-mcp.mjs +26 -0
- package/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +59 -0
- package/.pi/agent-fleet/scripts/fleet.ts +3 -0
- package/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +106 -0
- package/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +91 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +367 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +73 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +70 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +58 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +116 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +173 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +406 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +23 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +83 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
- package/.pi/agent-fleet/scripts/lib/fleet-command.ts +2 -0
- package/.pi/agent-fleet/scripts/package-lock.json +22 -0
- package/.pi/agent-fleet/scripts/package.json +1 -0
- package/.pi/agents/voices.yaml +1 -1
- package/.pi/harnesses/agent-hub/README.md +61 -4
- package/.pi/harnesses/agent-hub/acceptance.ts +8 -4
- package/.pi/harnesses/agent-hub/access-approval.ts +146 -21
- package/.pi/harnesses/agent-hub/assertion-ledger.js +1 -0
- package/.pi/harnesses/agent-hub/commands/config.ts +9 -0
- package/.pi/harnesses/agent-hub/commands/context.ts +1 -0
- package/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +2 -2
- package/.pi/harnesses/agent-hub/damage-guard-approval.ts +41 -17
- package/.pi/harnesses/agent-hub/damage-guard-hub.ts +16 -9
- package/.pi/harnesses/agent-hub/damage-guard-state.ts +2 -2
- package/.pi/harnesses/agent-hub/dispatch-native-complete.ts +4 -1
- package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +7 -1
- package/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +8 -1
- package/.pi/harnesses/agent-hub/dispatch-native-types.ts +1 -1
- package/.pi/harnesses/agent-hub/index.ts +102 -14
- package/.pi/harnesses/agent-hub/input/shortcuts.ts +3 -0
- package/.pi/harnesses/agent-hub/no-progress.ts +4 -4
- package/.pi/harnesses/agent-hub/operator-current-state.ts +53 -0
- package/.pi/harnesses/agent-hub/orchestration-activation.ts +1 -1
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
- package/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
- package/.pi/harnesses/agent-hub/private-config-current-state.ts +81 -0
- package/.pi/harnesses/agent-hub/private-config-fixtures.ts +26 -0
- package/.pi/harnesses/agent-hub/private-config-review.ts +100 -0
- package/.pi/harnesses/agent-hub/process-obligations.ts +26 -8
- package/.pi/harnesses/agent-hub/prompts/fragments.ts +1 -1
- package/.pi/harnesses/agent-hub/prompts/session-start.ts +1 -1
- package/.pi/harnesses/agent-hub/return-contract.js +24 -2
- package/.pi/harnesses/agent-hub/review-reuse.ts +3 -3
- package/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
- package/.pi/harnesses/agent-hub/runtime-receipts.ts +63 -0
- package/.pi/harnesses/agent-hub/runtime-test-check.ts +19 -2
- package/.pi/harnesses/agent-hub/spawn.ts +50 -13
- package/.pi/harnesses/agent-hub/specialist-result.ts +15 -6
- package/.pi/harnesses/agent-hub/system1-communication-store.ts +8 -0
- package/.pi/harnesses/agent-hub/task-resume-contract.ts +10 -0
- package/.pi/harnesses/agent-hub/task-triage-authorization.ts +36 -17
- package/.pi/harnesses/agent-hub/tools/action-executors.ts +4 -2
- package/.pi/harnesses/agent-hub/tools/coms-tools.ts +4 -4
- package/.pi/harnesses/agent-hub/tools/context.ts +4 -1
- package/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +15 -11
- package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +180 -44
- package/.pi/harnesses/agent-hub/tools/verification-contract.ts +1 -0
- package/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +11 -3
- package/.pi/harnesses/agent-hub/work-mode.ts +3 -1
- package/.pi/harnesses/ask-user-remote/README.md +2 -2
- package/.pi/harnesses/ask-user-remote/questions.ts +49 -2
- package/.pi/harnesses/ask-user-remote/runtime-ask.ts +13 -6
- package/.pi/harnesses/coms/README.md +5 -0
- package/.pi/harnesses/coms/index.ts +25 -2
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/index.ts +69 -31
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/bash-policy-analysis.ts +1 -1
- package/.pi/harnesses/lib/coms-core-io.ts +8 -1
- package/.pi/harnesses/lib/coms-core.ts +42 -8
- package/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
- package/.pi/harnesses/lib/coms-observation.ts +74 -0
- package/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
- package/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
- package/.pi/harnesses/lib/damage-control-shared.ts +46 -15
- package/.pi/harnesses/lib/exact-permission-port.ts +38 -0
- package/.pi/harnesses/lib/fleet-codex-event-bridge.ts +82 -0
- package/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
- package/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
- package/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
- package/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
- package/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
- package/.pi/harnesses/lib/fleet-config/view.ts +338 -0
- package/.pi/harnesses/lib/fleet-connection-control.ts +77 -0
- package/.pi/harnesses/lib/fleet-dashboard-view.ts +3 -1
- package/.pi/harnesses/lib/fleet-event-source.ts +21 -0
- package/.pi/harnesses/lib/fleet-notification-validation.ts +66 -0
- package/.pi/harnesses/lib/fleet-question-reference.ts +42 -0
- package/.pi/harnesses/lib/update-check.ts +5 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.1.0/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.1.0/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/fixtures/fleet-codex-allowlist-store-child.ts +31 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/fleet-codex-local-mcp.mjs +26 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +59 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/fleet.ts +248 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/flow.ts +166 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +122 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +91 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +349 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +72 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +53 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +111 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +173 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +384 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +23 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +81 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/fleet-command.ts +268 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +238 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/package-lock.json +57 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/package.json +10 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/pi-session.ts +9 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/team-up.ts +385 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/git.ts +99 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/quality.ts +65 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.1.0/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.1.0/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.1.0/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.1.0/.pi/agents/peers.yaml +147 -0
- package/.versions/2.1.0/.pi/agents/teams.yaml +41 -0
- package/.versions/2.1.0/.pi/agents/voices.yaml +13 -0
- package/.versions/2.1.0/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.1.0/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.1.0/.pi/extensions/btw/index.ts +916 -0
- package/.versions/2.1.0/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.1.0/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.1.0/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.1.0/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.1.0/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.1.0/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.1.0/.pi/extensions/compact-and-continue/index.ts +136 -0
- package/.versions/2.1.0/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.1.0/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.1.0/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.1.0/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.1.0/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.1.0/.pi/extensions/package.json +9 -0
- package/.versions/2.1.0/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.1.0/.pi/extensions/pi-voice-stt/config.ts +199 -0
- package/.versions/2.1.0/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.1.0/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.1.0/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.1.0/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.1.0/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/README.md +1584 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/acceptance.ts +204 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/access-approval.ts +266 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/assertion-ledger.js +68 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/config.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/context.ts +47 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/config/agents.ts +181 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/config/model-profiles.ts +237 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-continuity-compat.ts +30 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/damage-guard-approval.ts +83 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/damage-guard-hub.ts +263 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-native-complete.ts +176 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +298 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +260 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-native-types.ts +293 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-native.ts +236 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/external-blocker.js +92 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/fixtures/registration-surface.json +68 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/history-projection.ts +116 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/index.ts +2682 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/input/shortcuts.ts +23 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +145 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/no-progress.ts +622 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/operator-current-state.ts +53 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/policy/work-mode.ts +142 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/presentation.ts +54 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-snapshot.ts +279 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/process-obligations.ts +164 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/prompts/context.ts +55 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/prompts/fragments.ts +86 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/return-contract.js +371 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/review-continuity.ts +73 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/review-findings.js +96 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/review-reuse.ts +47 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/run-budget.js +342 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/runtime-receipts.ts +60 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/runtime-test-check.ts +79 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/scope-gate.js +233 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/session-audit.ts +331 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/spawn.ts +702 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/specialist-result.ts +78 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/system1-communication-store.ts +225 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-resume-contract.ts +75 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-authorization.ts +170 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-runtime.ts +130 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +79 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/action-executors.ts +214 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/context.ts +145 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +90 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +734 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/run-flow.ts +146 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tools/verification-contract.ts +81 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +157 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/work-mode.ts +188 -0
- package/.versions/2.1.0/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.1.0/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.1.0/.pi/harnesses/ask-user-remote/index.ts +571 -0
- package/.versions/2.1.0/.pi/harnesses/ask-user-remote/questions.ts +206 -0
- package/.versions/2.1.0/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.1.0/.pi/harnesses/ask-user-remote/runtime-ask.ts +90 -0
- package/.versions/2.1.0/.pi/harnesses/coms/README.md +105 -0
- package/.versions/2.1.0/.pi/harnesses/coms/index.ts +308 -0
- package/.versions/2.1.0/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.1.0/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.1.0/.pi/harnesses/damage-control-continue/README.md +161 -0
- package/.versions/2.1.0/.pi/harnesses/damage-control-continue/index.ts +659 -0
- package/.versions/2.1.0/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.1.0/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
- package/.versions/2.1.0/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
- package/.versions/2.1.0/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
- package/.versions/2.1.0/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
- package/.versions/2.1.0/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.1.0/.pi/harnesses/lib/approval-wait.ts +17 -0
- package/.versions/2.1.0/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
- package/.versions/2.1.0/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.1.0/.pi/harnesses/lib/clarification-policy.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/lib/coms-core-io.ts +422 -0
- package/.versions/2.1.0/.pi/harnesses/lib/coms-core.ts +720 -0
- package/.versions/2.1.0/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
- package/.versions/2.1.0/.pi/harnesses/lib/coms-observation.ts +74 -0
- package/.versions/2.1.0/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
- package/.versions/2.1.0/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
- package/.versions/2.1.0/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.1.0/.pi/harnesses/lib/context-budget-view.ts +112 -0
- package/.versions/2.1.0/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.1.0/.pi/harnesses/lib/context-compaction-policy.js +35 -0
- package/.versions/2.1.0/.pi/harnesses/lib/damage-action-hash.ts +28 -0
- package/.versions/2.1.0/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
- package/.versions/2.1.0/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
- package/.versions/2.1.0/.pi/harnesses/lib/damage-control-shared.ts +276 -0
- package/.versions/2.1.0/.pi/harnesses/lib/damage-guard-port.ts +25 -0
- package/.versions/2.1.0/.pi/harnesses/lib/damage-policy.ts +35 -0
- package/.versions/2.1.0/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
- package/.versions/2.1.0/.pi/harnesses/lib/damage-result-view.ts +16 -0
- package/.versions/2.1.0/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.1.0/.pi/harnesses/lib/exact-permission-port.ts +38 -0
- package/.versions/2.1.0/.pi/harnesses/lib/execution-trace.ts +45 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-codex-event-bridge.ts +81 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-config/view.ts +338 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-dashboard-view.ts +174 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-event-source.ts +21 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.1.0/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.1.0/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.1.0/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.1.0/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.1.0/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.1.0/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.1.0/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.1.0/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.1.0/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.1.0/.pi/harnesses/lib/identical-dialog.ts +27 -0
- package/.versions/2.1.0/.pi/harnesses/lib/installation-state.js +62 -0
- package/.versions/2.1.0/.pi/harnesses/lib/peer-target.ts +24 -0
- package/.versions/2.1.0/.pi/harnesses/lib/policy-roots.js +117 -0
- package/.versions/2.1.0/.pi/harnesses/lib/policy-roots.ts +32 -0
- package/.versions/2.1.0/.pi/harnesses/lib/process-shared.ts +9 -0
- package/.versions/2.1.0/.pi/harnesses/lib/resource-closure.js +26 -0
- package/.versions/2.1.0/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.1.0/.pi/harnesses/lib/semantic-approval.ts +80 -0
- package/.versions/2.1.0/.pi/harnesses/lib/session-target.ts +62 -0
- package/.versions/2.1.0/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config-loader.js +53 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config-v2.js +112 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
- package/.versions/2.1.0/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
- package/.versions/2.1.0/.pi/harnesses/lib/target-capabilities.js +7 -0
- package/.versions/2.1.0/.pi/harnesses/lib/update-check.ts +227 -0
- package/.versions/2.1.0/.pi/harnesses/lib/workspace-context.js +115 -0
- package/.versions/2.1.0/.pi/harnesses/lib/workspace-context.ts +22 -0
- package/.versions/2.1.0/.pi/harnesses/package-lock.json +2121 -0
- package/.versions/2.1.0/.pi/harnesses/package.json +13 -0
- package/.versions/2.1.0/.pi/prompts/af-build.md +27 -0
- package/.versions/2.1.0/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.1.0/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.1.0/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.1.0/.pi/prompts/af-review.md +16 -0
- package/.versions/2.1.0/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.1.0/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.1.0/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.1.0/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.1.0/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.1.0/.pi/prompts/af-test.md +19 -0
- package/.versions/2.1.0/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.1.0/.version +1 -0
- package/.versions/2.1.0/agents/architect.md +24 -0
- package/.versions/2.1.0/agents/bowser.md +28 -0
- package/.versions/2.1.0/agents/builder.md +55 -0
- package/.versions/2.1.0/agents/code-reviewer.md +209 -0
- package/.versions/2.1.0/agents/deep-researcher.md +32 -0
- package/.versions/2.1.0/agents/documenter.md +22 -0
- package/.versions/2.1.0/agents/orchestrator.md +22 -0
- package/.versions/2.1.0/agents/plan-reviewer.md +83 -0
- package/.versions/2.1.0/agents/planner.md +107 -0
- package/.versions/2.1.0/agents/releaser.md +24 -0
- package/.versions/2.1.0/agents/researcher.md +30 -0
- package/.versions/2.1.0/agents/security-auditor.md +167 -0
- package/.versions/2.1.0/agents/test-engineer.md +153 -0
- package/.versions/2.1.0/agents/web-debugger.md +44 -0
- package/.versions/2.1.0/agents/web-performance-auditor.md +194 -0
- package/.versions/2.1.0/bin/catalog/harness-runtime-closure.json +85 -0
- package/.versions/2.1.0/docs/ARCHITECTURE.md +1158 -0
- package/.versions/2.1.0/docs/agent-fleet-setup.md +1143 -0
- package/.versions/2.1.0/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.1.0/docs/codex-local-mcp.md +434 -0
- package/.versions/2.1.0/docs/codex-session-bridge.md +44 -0
- package/.versions/2.1.0/docs/codex-setup.md +183 -0
- package/.versions/2.1.0/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.1.0/docs/fleet-native-voice.md +135 -0
- package/.versions/2.1.0/docs/getting-started.md +126 -0
- package/.versions/2.1.0/docs/npm-install.md +535 -0
- package/.versions/2.1.0/docs/pi-extensions.md +455 -0
- package/.versions/2.1.0/docs/pi-setup.md +92 -0
- package/.versions/2.1.0/docs/skill-anatomy.md +150 -0
- package/.versions/2.1.0/install-manifest.json +3216 -0
- package/.versions/2.1.0/justfile +247 -0
- package/.versions/2.1.0/manifest-meta.json +1086 -0
- package/.versions/2.1.0/references/accessibility-checklist.md +160 -0
- package/.versions/2.1.0/references/communication-contract.md +26 -0
- package/.versions/2.1.0/references/definition-of-done.md +67 -0
- package/.versions/2.1.0/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.1.0/references/observability-checklist.md +92 -0
- package/.versions/2.1.0/references/orchestration-patterns.md +370 -0
- package/.versions/2.1.0/references/performance-checklist.md +236 -0
- package/.versions/2.1.0/references/prompting-patterns.md +380 -0
- package/.versions/2.1.0/references/security-checklist.md +245 -0
- package/.versions/2.1.0/references/testing-patterns.md +235 -0
- package/.versions/2.1.0/references/workflow-authoring.md +304 -0
- package/.versions/2.1.0/skills/_internal/grilling.md +59 -0
- package/.versions/2.1.0/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.1.0/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.1.0/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.1.0/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.1.0/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.1.0/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.1.0/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.1.0/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.1.0/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.1.0/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.1.0/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.1.0/skills/fleet-native-voice/SKILL.md +73 -0
- package/.versions/2.1.0/skills/fleet-native-voice/agents/openai.yaml +4 -0
- package/.versions/2.1.0/skills/fleet-native-voice.zip +0 -0
- package/.versions/2.1.0/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.1.0/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.1.0/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.1.0/skills/idea-refine/examples.md +238 -0
- package/.versions/2.1.0/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.1.0/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.1.0/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.1.0/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.1.0/skills/incremental-implementation.zip +0 -0
- package/.versions/2.1.0/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.1.0/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.1.0/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.1.0/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.1.0/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.1.0/skills/planning-and-task-breakdown.zip +0 -0
- package/.versions/2.1.0/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.1.0/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.1.0/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.1.0/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.1.0/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.1.0/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.1.0/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.1.0/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.1.0/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.1.0/skills/spec-driven-development.zip +0 -0
- package/.versions/2.1.0/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.1.0/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.1.1/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.1.1/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/fixtures/fleet-codex-allowlist-store-child.ts +31 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/fleet-codex-local-mcp.mjs +26 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +59 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/fleet.ts +248 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/flow.ts +166 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +106 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +91 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +367 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +73 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +70 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +58 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +116 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +173 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +406 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +23 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +83 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/fleet-command.ts +268 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +238 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/package-lock.json +57 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/package.json +10 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/pi-session.ts +9 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/team-up.ts +385 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/git.ts +99 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/quality.ts +65 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.1.1/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.1.1/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.1.1/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.1.1/.pi/agents/peers.yaml +147 -0
- package/.versions/2.1.1/.pi/agents/teams.yaml +41 -0
- package/.versions/2.1.1/.pi/agents/voices.yaml +13 -0
- package/.versions/2.1.1/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.1.1/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.1.1/.pi/extensions/btw/index.ts +916 -0
- package/.versions/2.1.1/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.1.1/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.1.1/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.1.1/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.1.1/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.1.1/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.1.1/.pi/extensions/compact-and-continue/index.ts +136 -0
- package/.versions/2.1.1/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.1.1/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.1.1/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.1.1/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.1.1/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.1.1/.pi/extensions/package.json +9 -0
- package/.versions/2.1.1/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.1.1/.pi/extensions/pi-voice-stt/config.ts +199 -0
- package/.versions/2.1.1/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.1.1/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.1.1/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.1.1/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.1.1/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/README.md +1584 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/acceptance.ts +204 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/access-approval.ts +266 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/assertion-ledger.js +68 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/config.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/context.ts +47 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/config/agents.ts +181 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/config/model-profiles.ts +237 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-continuity-compat.ts +30 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/damage-guard-approval.ts +83 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/damage-guard-hub.ts +263 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-native-complete.ts +176 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +301 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +262 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-native-types.ts +293 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-native.ts +236 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/external-blocker.js +92 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/fixtures/registration-surface.json +68 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/history-projection.ts +116 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/index.ts +2705 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/input/shortcuts.ts +23 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +145 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/no-progress.ts +622 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/operator-current-state.ts +53 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/policy/work-mode.ts +142 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/presentation.ts +54 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/private-config-current-state.ts +81 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/private-config-fixtures.ts +26 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/private-config-review.ts +100 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-snapshot.ts +279 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/process-obligations.ts +177 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/prompts/context.ts +55 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/prompts/fragments.ts +86 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/return-contract.js +371 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/review-continuity.ts +73 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/review-findings.js +96 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/review-reuse.ts +47 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/run-budget.js +342 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/runtime-receipts.ts +63 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/runtime-test-check.ts +85 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/scope-gate.js +233 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/session-audit.ts +331 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/spawn.ts +702 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/specialist-result.ts +78 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/system1-communication-store.ts +225 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-resume-contract.ts +80 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-authorization.ts +170 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-runtime.ts +130 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +79 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/action-executors.ts +216 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/context.ts +147 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +92 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +777 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/run-flow.ts +146 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tools/verification-contract.ts +81 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +163 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/work-mode.ts +188 -0
- package/.versions/2.1.1/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.1.1/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.1.1/.pi/harnesses/ask-user-remote/index.ts +571 -0
- package/.versions/2.1.1/.pi/harnesses/ask-user-remote/questions.ts +206 -0
- package/.versions/2.1.1/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.1.1/.pi/harnesses/ask-user-remote/runtime-ask.ts +90 -0
- package/.versions/2.1.1/.pi/harnesses/coms/README.md +105 -0
- package/.versions/2.1.1/.pi/harnesses/coms/index.ts +308 -0
- package/.versions/2.1.1/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.1.1/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.1.1/.pi/harnesses/damage-control-continue/README.md +161 -0
- package/.versions/2.1.1/.pi/harnesses/damage-control-continue/index.ts +659 -0
- package/.versions/2.1.1/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.1.1/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
- package/.versions/2.1.1/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
- package/.versions/2.1.1/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
- package/.versions/2.1.1/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
- package/.versions/2.1.1/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.1.1/.pi/harnesses/lib/approval-wait.ts +17 -0
- package/.versions/2.1.1/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
- package/.versions/2.1.1/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.1.1/.pi/harnesses/lib/clarification-policy.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/lib/coms-core-io.ts +422 -0
- package/.versions/2.1.1/.pi/harnesses/lib/coms-core.ts +720 -0
- package/.versions/2.1.1/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
- package/.versions/2.1.1/.pi/harnesses/lib/coms-observation.ts +74 -0
- package/.versions/2.1.1/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
- package/.versions/2.1.1/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
- package/.versions/2.1.1/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.1.1/.pi/harnesses/lib/context-budget-view.ts +112 -0
- package/.versions/2.1.1/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.1.1/.pi/harnesses/lib/context-compaction-policy.js +35 -0
- package/.versions/2.1.1/.pi/harnesses/lib/damage-action-hash.ts +28 -0
- package/.versions/2.1.1/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
- package/.versions/2.1.1/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
- package/.versions/2.1.1/.pi/harnesses/lib/damage-control-shared.ts +276 -0
- package/.versions/2.1.1/.pi/harnesses/lib/damage-guard-port.ts +25 -0
- package/.versions/2.1.1/.pi/harnesses/lib/damage-policy.ts +35 -0
- package/.versions/2.1.1/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
- package/.versions/2.1.1/.pi/harnesses/lib/damage-result-view.ts +16 -0
- package/.versions/2.1.1/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.1.1/.pi/harnesses/lib/exact-permission-port.ts +38 -0
- package/.versions/2.1.1/.pi/harnesses/lib/execution-trace.ts +45 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-codex-event-bridge.ts +82 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-config/view.ts +338 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-connection-control.ts +77 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-dashboard-view.ts +174 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-event-source.ts +21 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-notification-validation.ts +66 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-question-reference.ts +42 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.1.1/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.1.1/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.1.1/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.1.1/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.1.1/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.1.1/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.1.1/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.1.1/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.1.1/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.1.1/.pi/harnesses/lib/identical-dialog.ts +27 -0
- package/.versions/2.1.1/.pi/harnesses/lib/installation-state.js +62 -0
- package/.versions/2.1.1/.pi/harnesses/lib/peer-target.ts +24 -0
- package/.versions/2.1.1/.pi/harnesses/lib/policy-roots.js +117 -0
- package/.versions/2.1.1/.pi/harnesses/lib/policy-roots.ts +32 -0
- package/.versions/2.1.1/.pi/harnesses/lib/process-shared.ts +9 -0
- package/.versions/2.1.1/.pi/harnesses/lib/resource-closure.js +26 -0
- package/.versions/2.1.1/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.1.1/.pi/harnesses/lib/semantic-approval.ts +80 -0
- package/.versions/2.1.1/.pi/harnesses/lib/session-target.ts +62 -0
- package/.versions/2.1.1/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config-loader.js +53 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config-v2.js +112 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
- package/.versions/2.1.1/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
- package/.versions/2.1.1/.pi/harnesses/lib/target-capabilities.js +7 -0
- package/.versions/2.1.1/.pi/harnesses/lib/update-check.ts +227 -0
- package/.versions/2.1.1/.pi/harnesses/lib/workspace-context.js +115 -0
- package/.versions/2.1.1/.pi/harnesses/lib/workspace-context.ts +22 -0
- package/.versions/2.1.1/.pi/harnesses/package-lock.json +2121 -0
- package/.versions/2.1.1/.pi/harnesses/package.json +13 -0
- package/.versions/2.1.1/.pi/prompts/af-build.md +27 -0
- package/.versions/2.1.1/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.1.1/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.1.1/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.1.1/.pi/prompts/af-review.md +16 -0
- package/.versions/2.1.1/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.1.1/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.1.1/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.1.1/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.1.1/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.1.1/.pi/prompts/af-test.md +19 -0
- package/.versions/2.1.1/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.1.1/.version +1 -0
- package/.versions/2.1.1/agents/architect.md +24 -0
- package/.versions/2.1.1/agents/bowser.md +28 -0
- package/.versions/2.1.1/agents/builder.md +55 -0
- package/.versions/2.1.1/agents/code-reviewer.md +209 -0
- package/.versions/2.1.1/agents/deep-researcher.md +32 -0
- package/.versions/2.1.1/agents/documenter.md +22 -0
- package/.versions/2.1.1/agents/orchestrator.md +22 -0
- package/.versions/2.1.1/agents/plan-reviewer.md +83 -0
- package/.versions/2.1.1/agents/planner.md +107 -0
- package/.versions/2.1.1/agents/releaser.md +24 -0
- package/.versions/2.1.1/agents/researcher.md +30 -0
- package/.versions/2.1.1/agents/security-auditor.md +167 -0
- package/.versions/2.1.1/agents/test-engineer.md +153 -0
- package/.versions/2.1.1/agents/web-debugger.md +44 -0
- package/.versions/2.1.1/agents/web-performance-auditor.md +194 -0
- package/.versions/2.1.1/bin/catalog/harness-runtime-closure.json +85 -0
- package/.versions/2.1.1/docs/ARCHITECTURE.md +1187 -0
- package/.versions/2.1.1/docs/agent-fleet-setup.md +1143 -0
- package/.versions/2.1.1/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.1.1/docs/codex-local-mcp.md +487 -0
- package/.versions/2.1.1/docs/codex-session-bridge.md +44 -0
- package/.versions/2.1.1/docs/codex-setup.md +183 -0
- package/.versions/2.1.1/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.1.1/docs/fleet-native-voice.md +137 -0
- package/.versions/2.1.1/docs/getting-started.md +126 -0
- package/.versions/2.1.1/docs/npm-install.md +535 -0
- package/.versions/2.1.1/docs/pi-extensions.md +455 -0
- package/.versions/2.1.1/docs/pi-setup.md +92 -0
- package/.versions/2.1.1/docs/skill-anatomy.md +150 -0
- package/.versions/2.1.1/install-manifest.json +3239 -0
- package/.versions/2.1.1/justfile +247 -0
- package/.versions/2.1.1/manifest-meta.json +1087 -0
- package/.versions/2.1.1/references/accessibility-checklist.md +160 -0
- package/.versions/2.1.1/references/communication-contract.md +26 -0
- package/.versions/2.1.1/references/definition-of-done.md +67 -0
- package/.versions/2.1.1/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.1.1/references/observability-checklist.md +92 -0
- package/.versions/2.1.1/references/orchestration-patterns.md +370 -0
- package/.versions/2.1.1/references/performance-checklist.md +236 -0
- package/.versions/2.1.1/references/prompting-patterns.md +380 -0
- package/.versions/2.1.1/references/security-checklist.md +245 -0
- package/.versions/2.1.1/references/testing-patterns.md +235 -0
- package/.versions/2.1.1/references/workflow-authoring.md +304 -0
- package/.versions/2.1.1/skills/_internal/grilling.md +59 -0
- package/.versions/2.1.1/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.1.1/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.1.1/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.1.1/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.1.1/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.1.1/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.1.1/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.1.1/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.1.1/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.1.1/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.1.1/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.1.1/skills/fleet-connect/SKILL.md +25 -0
- package/.versions/2.1.1/skills/fleet-native-voice/SKILL.md +79 -0
- package/.versions/2.1.1/skills/fleet-native-voice/agents/openai.yaml +4 -0
- package/.versions/2.1.1/skills/fleet-native-voice.zip +0 -0
- package/.versions/2.1.1/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.1.1/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.1.1/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.1.1/skills/idea-refine/examples.md +238 -0
- package/.versions/2.1.1/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.1.1/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.1.1/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.1.1/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.1.1/skills/incremental-implementation.zip +0 -0
- package/.versions/2.1.1/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.1.1/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.1.1/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.1.1/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.1.1/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.1.1/skills/planning-and-task-breakdown.zip +0 -0
- package/.versions/2.1.1/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.1.1/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.1.1/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.1.1/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.1.1/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.1.1/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.1.1/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.1.1/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.1.1/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.1.1/skills/spec-driven-development.zip +0 -0
- package/.versions/2.1.1/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.1.1/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +31 -5
- package/README.md +12 -11
- package/agents/architect.md +1 -1
- package/agents/bowser.md +1 -1
- package/agents/builder.md +1 -1
- package/agents/code-reviewer.md +1 -1
- package/agents/plan-reviewer.md +1 -1
- package/agents/planner.md +1 -1
- package/agents/test-engineer.md +1 -1
- package/agents/web-debugger.md +1 -1
- package/agents/web-performance-auditor.md +1 -1
- package/bin/cli.js +115 -1
- package/bin/lib/apply.js +8 -1
- package/bin/lib/features.js +4 -1
- package/bin/lib/hermes-profile-artifact.js +21 -10
- package/bin/lib/inspect.js +103 -0
- package/bin/lib/mcp-probe.js +104 -0
- package/bin/lib/public-plan.js +2 -0
- package/bin/lib/repair-desired.js +1 -1
- package/bin/lib/set-codex-mcp.js +699 -0
- package/bin/lib/skill-zip.js +222 -0
- package/bin/snapshot-version.js +3 -1
- package/docs/ARCHITECTURE.md +176 -12
- package/docs/MIGRATION-agent-fleet.md +2 -2
- package/docs/agent-fleet-setup.md +39 -2
- package/docs/codex-local-mcp.md +487 -0
- package/docs/codex-session-bridge.md +28 -203
- package/docs/codex-setup.md +183 -0
- package/docs/fleet-native-voice.md +137 -0
- package/docs/npm-install.md +2 -2
- package/docs/session-worktree-targeting.md +79 -79
- package/docs/system1-agentic.md +1 -1
- package/docs/workflows.md +2 -2
- package/install-manifest.json +54 -66
- package/manifest-meta.json +48 -57
- package/package.json +12 -7
- package/skills/fleet-connect/SKILL.md +25 -0
- package/skills/fleet-native-voice.zip +0 -0
- package/skills/incremental-implementation/SKILL.md +1 -1
- package/skills/incremental-implementation.zip +0 -0
- package/.pi/agent-fleet/scripts/fleet-codex-client.ts +0 -69
- package/.pi/agent-fleet/scripts/fleet-codex-read.py +0 -148
- package/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +0 -63
- package/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +0 -190
- package/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +0 -166
- package/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +0 -124
- package/codex/fleet-session-client/SKILL.md +0 -34
- package/codex/fleet-session-client.zip +0 -0
|
@@ -0,0 +1,2705 @@
|
|
|
1
|
+
import {FleetConnectionControl,connectionLines,connectionNamespaces} from '../lib/fleet-connection-control.ts';
|
|
2
|
+
import {homedir} from 'node:os';
|
|
3
|
+
import { privateDeclarationHash, type PrivateProofUse } from './private-config-review.ts';
|
|
4
|
+
import { registerDiscoveryHub, configureDiscoveryHub, resetDiscoveryHub, discoveryHubEnabled, discoveryManagedReadbackAllowed, prepareDiscoveryNative } from './file-discovery/hub.ts';
|
|
5
|
+
import { registerDamageGuardHub, configureDamageGuardHub, resetDamageGuardHub, acceptDamageGuardInput, prepareDamageGuardNative } from './damage-guard-hub.ts';
|
|
6
|
+
import { bindSemanticScope } from '../lib/semantic-approval.ts';
|
|
7
|
+
import { registerAgenticHub, configureAgenticHub, agenticHubEnabled, agenticHubRuntime, resetAgenticHub } from './agentic-hub.ts';
|
|
8
|
+
import {worktreeConsumerService} from '../lib/system1/worktree-service.ts';
|
|
9
|
+
import { loadSystem1Snapshot } from "../lib/system1/config-loader.js";
|
|
10
|
+
import { normalizeSystem1Config } from "../lib/system1/config-v2.js";
|
|
11
|
+
import { registerDispatchTriage } from "./tools/dispatch-triage.ts";
|
|
12
|
+
import { createTriageRuntime } from "./dispatch-triage-runtime.ts";
|
|
13
|
+
import { type TriageConfig, type TriageInput } from "./dispatch-triage-contract.ts";
|
|
14
|
+
import { loadTaskTriageConfig } from "./task-triage-config.ts";
|
|
15
|
+
import { TASK_TRIAGE_MODEL } from "./task-triage-contract.ts";
|
|
16
|
+
import type { JevTransport } from "../lib/system1/jev.ts";
|
|
17
|
+
import { createTaskTriageRuntime, evaluatedTaskTriageInputChanged, TASK_TRIAGE_RUNTIME_ENTRY } from "./task-triage-runtime.ts";
|
|
18
|
+
import { adoptTaskTriageState, applyTaskTriageAdditions, recoverTaskTriageProcessState } from "./task-triage-obligations.ts";
|
|
19
|
+
import { confirmTaskTriageAction, confirmTaskTriageWaiver, consumeActionGrant, taskTriageActionAuditRecord, type TaskTriageActionObservation } from "./task-triage-authorization.ts";
|
|
20
|
+
import { registerTaskTriageRecover } from "./commands/task-triage-recover.ts";
|
|
21
|
+
import { registerTaskTriageWaiver } from "./commands/task-triage-waive.ts";
|
|
22
|
+
import { createCommunicationStore } from "./system1-communication-store.ts";
|
|
23
|
+
import { openSystem1Communication } from "./ui/system1-communication.ts";
|
|
24
|
+
import { registerRetry } from "./commands/retry.ts";
|
|
25
|
+
import { createHash } from "node:crypto";
|
|
26
|
+
import { loadProactiveConfig, isCaptureEnabled } from "./proactive-config.ts";
|
|
27
|
+
import { createProactiveRuntime, createHubCapture, composeHubProactive } from "./proactive-runtime.ts";
|
|
28
|
+
import type { ProactiveConfig } from "./proactive-types.ts";
|
|
29
|
+
import { registerRecover, runRecoverCommand } from "./commands/recover.ts";
|
|
30
|
+
import { createNoProgressGuard } from "./no-progress.ts";
|
|
31
|
+
import { renderNextInvocation, renderRecoverCommands } from './recover-policy.ts';
|
|
32
|
+
import { closeEvidenceSession, pruneEvidenceSessions } from "./execution-evidence.ts";
|
|
33
|
+
import { hasExplicitDispatcher, isCompleteProfile, dispatcherSelection, type ModelProfiles } from './config/model-profiles.ts';
|
|
34
|
+
import { createProfileActivation } from './policy/profile-activation.ts';
|
|
35
|
+
import { readActiveProfile, profileWorkInFlight, withProfileWork, assertProfileModel, profilePeerGate } from './policy/profile-runtime.ts';
|
|
36
|
+
import { resolveAssist } from './assist-profile.ts';
|
|
37
|
+
import { registerFilesystemTool, FILESYSTEM_POLICY_ROOTS_ENV } from './filesystem-tool.ts';
|
|
38
|
+
/** Agent Hub composition root: constructs mutable state, contexts, registrars, and ordered lifecycle ports. */
|
|
39
|
+
|
|
40
|
+
import type { AgentDef, AgentState, ResearchState } from "./types.ts";
|
|
41
|
+
import { DEFAULT_OVERRIDES, THINKING_LEVELS, parseAgentTeamOverrides, type AgentTeamOverrides } from "./config/overrides.ts";
|
|
42
|
+
import { loadAgentConfiguration } from "./config/agents.ts";
|
|
43
|
+
import { abbrevThinking, displayName, extractAskUserQuestions, extractNeedsResearch, resolveDelegateExtension, resolveThinkingLevel } from "./presentation.ts";
|
|
44
|
+
import { MAX_LIVE_ENTRY_CHARS, appendTimelineEvent, appendTimelineText, flushTimelineStore } from "./timeline.ts";
|
|
45
|
+
import type { ExtensionAPI, ExtensionContext, Theme } from "@mariozechner/pi-coding-agent";
|
|
46
|
+
import { DynamicBorder, getMarkdownTheme as getPiMdTheme, copyToClipboard } from "@mariozechner/pi-coding-agent";
|
|
47
|
+
import {
|
|
48
|
+
Text, Box, Container, Spacer, Markdown, matchesKey, Key,
|
|
49
|
+
type AutocompleteItem, truncateToWidth, visibleWidth,
|
|
50
|
+
} from "@mariozechner/pi-tui";
|
|
51
|
+
import { spawn, type ChildProcess } from "child_process";
|
|
52
|
+
import { spawnPiAgent, spawnPiAgentWithModelFallback, killPiTree, type Termination } from "./spawn.ts";
|
|
53
|
+
import { fenceOperatorCancel } from "./drift-runtime.ts";
|
|
54
|
+
import { researchTerminationOutcome, researchWatchdogSpawnOptions } from "./research-watchdog.ts";
|
|
55
|
+
import { composeFleetFooterHint, renderHubFooterLeft } from "./footer.ts";
|
|
56
|
+
import { HARNESS_VERSION, registerVersionStatus } from "./version.ts";
|
|
57
|
+
import { cancelLocalOwnedProcess, cancelLocalWaitOnly, monitorKeyForAgent } from "./monitor-control.ts";
|
|
58
|
+
import { createMonitorLifecycle } from "./monitor-lifecycle.ts";
|
|
59
|
+
import { createMonitorSessionBridge } from "./monitor-session-bridge.ts";
|
|
60
|
+
import {
|
|
61
|
+
AGENT_ID_ENV, ASK_ENDPOINT_ENV, EXEMPTIONS_FILE_ENV,
|
|
62
|
+
exemptionsFilePath, type AccessRequest,
|
|
63
|
+
} from "../lib/damage-control-shared.ts";
|
|
64
|
+
import { applyModelOverride, clampDelegateDepth, fallbackModelFor, isReadOnlyToolList, MAX_DELEGATE_DEPTH, normalizeAgentInput, orchestratorNeedsRoster, parseTeamsYaml, safeAgentKey, safePathWithin, taskFingerprint, upsertTeamInYaml } from "./helpers.ts";
|
|
65
|
+
import { DEFAULT_TASK_TIER, addTaskClockWait, applyTierChange, blockingFindingCap, checkTierPersonaGate, createTaskClock, isReviewPersona, openTaskClock, reviewBudgetClause } from "./run-budget.js";
|
|
66
|
+
import { countReviewFindings, findingBudgetNotice } from "./review-findings.js";
|
|
67
|
+
import { checkDocsLane, docsLaneNotice } from "./docs-lane.js";
|
|
68
|
+
import { checkExternalBlockerGate, extractExternalBlockers } from "./external-blocker.js";
|
|
69
|
+
import { DEFAULT_RUN_HISTORY_KEEP, normalizeRunHistoryKeep } from "./run-namespace.js";
|
|
70
|
+
import { validateAssertionBatch } from "./assertion-ledger.js";
|
|
71
|
+
import { DEFAULT_PROVIDER_LIMITS, createProviderSemaphore, parseProviderLimits } from "./provider-semaphore.js";
|
|
72
|
+
import {
|
|
73
|
+
PANE_PROMPT_TIMEOUT_MS,
|
|
74
|
+
launchPeerInPane,
|
|
75
|
+
peerReadyVerdict,
|
|
76
|
+
unaddressedPeerSweep,
|
|
77
|
+
} from "../lib/spawned-peers.js";
|
|
78
|
+
import { contextPct, estimatePromptTokens, resolveContextWindow } from "./context-window.js";
|
|
79
|
+
import { DEFAULT_WATCHDOG_SETTING, WATCHDOG_SETTINGS, normalizeWatchdogSetting, resolveWatchdogActive } from "./drift-watchdog.js";
|
|
80
|
+
import { createWatchdogActivity, createTaskTriageActivity, type WatchdogActivity, type TaskTriageActivity } from "./system1-activity.ts";
|
|
81
|
+
import { createWatchdogSystem1Session, disposeWatchdogSystem1Session, readWatchdogSystem1Snapshot, type WatchdogSystem1Session } from "./system1-runtime.ts";
|
|
82
|
+
import { shouldExtractReturn } from "./return-extract.js";
|
|
83
|
+
import { crossCheck, deliveryDisposition, extractAssertionIds, parseDeliveredReturn } from "./return-contract.js";
|
|
84
|
+
import { checkScope, diffAgainst, snapshotWorktree, worktreeRevision } from "./scope-gate.js";
|
|
85
|
+
import { validateEvidence } from "./evidence-rules.js";
|
|
86
|
+
import { comsRequiredRefusal, explicitComsRefusal, parseDispatchPolicy, resolveDispatchBackend } from "./backend-policy.js";
|
|
87
|
+
import { NATIVE_ROSTER_ENTRY_TYPE, persistedNativeRosterState, resolveSessionWorkMode, resolveSessionRoster, type WorkMode } from "./work-mode.ts";
|
|
88
|
+
import { compactWorkMode } from "./work-mode-controls.ts";
|
|
89
|
+
import { registerWorkMode } from "./commands/work-mode.ts";
|
|
90
|
+
import { registerAgentsTeam } from "./commands/agents-team.ts";
|
|
91
|
+
import { registerAgentsList } from "./commands/agents-list.ts";
|
|
92
|
+
import { registerAgentsHistory } from "./commands/agents-history.ts";
|
|
93
|
+
import { registerAgentsAdd } from "./commands/agents-add.ts";
|
|
94
|
+
import { registerAgentsDrop } from "./commands/agents-drop.ts";
|
|
95
|
+
import { registerAgentsSave } from "./commands/agents-save.ts";
|
|
96
|
+
import { registerAgentsKill } from "./commands/agents-kill.ts";
|
|
97
|
+
import { registerAgentsRestart } from "./commands/agents-restart.ts";
|
|
98
|
+
import { registerContextCommand } from "./commands/context-command.ts";
|
|
99
|
+
import { registerAudit } from "./commands/audit.ts";
|
|
100
|
+
import { registerConfig } from "./commands/config.ts";
|
|
101
|
+
import { showSessionAudit } from "./session-audit.ts";
|
|
102
|
+
import { createExecutionTrace, createNativeExecutionTrace, registerExecutionTrace, EXECUTION_TRACE_ENTRY } from "./execution-trace.ts";
|
|
103
|
+
import { beginRuntimeTrace } from "../lib/execution-trace.ts";
|
|
104
|
+
import { buildWatchdogReport, buildProactiveReport, commandProactiveLabels, readProactiveReport, formatWatchdogStatus, readWatchdogEvents } from "./system1-report.ts";
|
|
105
|
+
import { createProcessState, normalizeProcessState, processAllowsPersona, processOpenObligations, evaluateProcessObligations, latestProcessState, processAuditRecord, processTaskIdentityConflicts, processPreEffectGate, missingProcessRoleRecoveryHints, activeAdditionRecoveryHints, taskTransitionRecoveryHint, transitionToolDecision, latestPendingTaskTransition, TASK_TRANSITION_ENTRY_TYPE, type ProcessObligationState, type ProcessVerdict } from "./process-obligations.ts";
|
|
106
|
+
import { registerHubReport } from "./commands/hub-report.ts";
|
|
107
|
+
import { registerZoom } from "./commands/zoom.ts";
|
|
108
|
+
import { registerDispatchPolicy } from "./commands/dispatch-policy.ts";
|
|
109
|
+
import { registerAgentModel } from "./commands/agent-model.ts";
|
|
110
|
+
import { registerAgentModelThinking } from "./commands/agent-model-thinking.ts";
|
|
111
|
+
import { registerModels } from "./commands/models.ts";
|
|
112
|
+
import { registerAgentModelsSubstitute } from "./commands/agent-models-substitute.ts";
|
|
113
|
+
import { registerWatchdog } from "./commands/watchdog.ts";
|
|
114
|
+
import { registerComs } from "./commands/coms.ts";
|
|
115
|
+
import { registerHandoff } from "./commands/handoff.ts";
|
|
116
|
+
import { registerCompound } from "./commands/compound.ts";
|
|
117
|
+
import { registerPoll } from "./commands/poll.ts";
|
|
118
|
+
import { registerDebate } from "./commands/debate.ts";
|
|
119
|
+
import type { CommandContext } from "./commands/context.ts";
|
|
120
|
+
import { formatAfPollStarted, formatAfPollVoiceProgress, handleAfPoll } from "./poll-command.ts";
|
|
121
|
+
import { formatAfDebateStarted, formatAfDebateVoiceProgress, handleAfDebate } from "./debate-command.ts";
|
|
122
|
+
import { registerDispatchAgent } from "./tools/dispatch-agent.ts";
|
|
123
|
+
import { registerSpawnResearch } from "./tools/spawn-research.ts";
|
|
124
|
+
import { registerRunFlow } from "./tools/run-flow.ts";
|
|
125
|
+
import { resolvePersona as resolveFlowPersona } from "../../agent-fleet/scripts/workflows/lib/personas.ts";
|
|
126
|
+
import { assertProfileModel as assertFlowProfileModel } from "../../agent-fleet/scripts/workflows/lib/model-profile.ts";
|
|
127
|
+
import { registerSetTaskTier } from "./tools/set-task-tier.ts";
|
|
128
|
+
import { registerTeamAdjust } from "./tools/team-adjust.ts";
|
|
129
|
+
import { registerVerificationContract } from "./tools/verification-contract.ts";
|
|
130
|
+
import { registerComsTools } from "./tools/coms-tools.ts";
|
|
131
|
+
import { paneTail, peerManifest, peerPersonaExists, registerFleetTools, spawnDelaySeconds, STAGGER_ENV_VAR, waitForPeerRegistration } from "./tools/fleet-tools.ts";
|
|
132
|
+
import type { ToolContext } from "./tools/context.ts";
|
|
133
|
+
import { createToolExecutionOrchestration } from "./tools/execution-orchestration.ts";
|
|
134
|
+
import { latestPersistedCapabilityState, type ContextState, type PendingOperation } from "./capability-packs.ts";
|
|
135
|
+
import { contextPressureDiagnostic, createContextPressureState, pressureCapabilityState, transitionContextPressure, type ContextPressureState } from "./context-pressure.ts";
|
|
136
|
+
import { confirmationOutcome, capabilityConfirmationPack, capabilityConfirmationQuestion, type ConfirmableCapabilityPack } from "./capability-confirmation.ts";
|
|
137
|
+
import { confirmRecoverAction, confirmTaskSupersession, createReservedTaskIdentityReset } from "./budget-recovery.ts";
|
|
138
|
+
import { requestRuntimeAsk } from "../ask-user-remote/runtime-ask.ts";
|
|
139
|
+
import { observeAskUserResults } from "../ask-user-remote/index.ts";
|
|
140
|
+
import {PermissionRelay,registerPermissionRelay,handlePermissionEnvelope} from './permission-relay.ts';
|
|
141
|
+
import { handleQuestionEnvelope, registerQuestionPeer, questionChannel } from "../ask-user-remote/questions.ts";
|
|
142
|
+
import { handleObservationEnvelope } from "../lib/coms-observation.ts";
|
|
143
|
+
import { handleInstructionReceipt } from "../lib/coms-instruction-receipts.ts";
|
|
144
|
+
import { buildHubPeerSpawnPlan, launchHubPeerInPane } from "./peer-spawn-plan.ts";
|
|
145
|
+
import { RESEARCH_TOOLS, createResearchRuntime, parseResearchHandle } from "./research/runtime.ts";
|
|
146
|
+
import { requireSafetyHarness, resolveSafetyHarness } from "./safety-routing.ts";
|
|
147
|
+
import { createAccessApprovalRouter } from "./access-approval.ts";
|
|
148
|
+
import { readdirSync, readFileSync, existsSync, mkdirSync, unlinkSync, writeFileSync, rmSync } from "fs";
|
|
149
|
+
import { herdrPaneId } from "../lib/herdr-presence.ts";
|
|
150
|
+
import { herdr as herdrApi, herdrAvailable } from "../lib/herdr-client.ts";
|
|
151
|
+
import {
|
|
152
|
+
abbreviateModel,
|
|
153
|
+
createComsPeer,
|
|
154
|
+
hexFg,
|
|
155
|
+
nowIso,
|
|
156
|
+
readAllRegistryEntries,
|
|
157
|
+
readAllRegistryEntriesAcrossProjects,
|
|
158
|
+
type ComsIdentity,
|
|
159
|
+
type RegistryEntry as ComsRegistryEntry,
|
|
160
|
+
TIMEOUT_MS,
|
|
161
|
+
} from "../lib/coms-core.ts";
|
|
162
|
+
import { createGridUI } from "./ui/grid.ts";
|
|
163
|
+
import { createFleetSource } from "./ui/fleet-source.ts";
|
|
164
|
+
import { buildFleetRows } from "../lib/fleet-read-model.ts";
|
|
165
|
+
import { createFleetActions } from "./ui/fleet-actions.ts";
|
|
166
|
+
import { createDetailPanel } from "./ui/detail-panel.ts";
|
|
167
|
+
import { createFleetDashboard } from "./ui/fleet-dashboard.ts";
|
|
168
|
+
import { createContextBudgetUi } from "./ui/context-budget.ts";
|
|
169
|
+
import { createFleetConfigUi } from "../lib/fleet-config/ui.ts";
|
|
170
|
+
import { createPoolPresentation } from "./ui/pool.ts";
|
|
171
|
+
import { registerInputShortcuts } from "./input/shortcuts.ts";
|
|
172
|
+
import { createCompletionPresentation } from "./input/completions.ts";
|
|
173
|
+
import { createResearchControls } from "./research/controls.ts";
|
|
174
|
+
import { currentPiRuntimeVersion } from "./context-continuity-compat.ts";
|
|
175
|
+
import { createContextPressureLifecycle, createContextPressureRootState } from "./lifecycle/context-pressure.ts";
|
|
176
|
+
import { createTurnLifecycleHandlers, registerTurnPresence, registerTurnSettlement } from "./lifecycle/turn-handlers.ts";
|
|
177
|
+
import { createMonitorSession } from "./lifecycle/monitor-session.ts";
|
|
178
|
+
import { applySessionOverrides, registerSessionOrchestration, resetHubSession } from "./lifecycle/session-orchestration.ts";
|
|
179
|
+
import { openZoom, type TimelineEntry, type Zoomable } from "./ui/zoom.ts";
|
|
180
|
+
import { openHistory } from "./ui/history.ts";
|
|
181
|
+
import { createExecutionHistoryStore, type HistoryEntry } from "./ui/history-store.ts";
|
|
182
|
+
import { createHistoryProjectionMemo, projectCoordinationHistory } from "./history-projection.ts";
|
|
183
|
+
import { isTaskContinuation } from "./task-continuation.ts";
|
|
184
|
+
import { registerOperatorWatchdog } from "./operator-watchdog.ts";
|
|
185
|
+
import type { DriftJudgeInput } from "./dispatch-coms.ts";
|
|
186
|
+
import { createDispatchComs, createDispatchNative, createDispatchObservability, type DelegationChild } from "./dispatch-core.ts";
|
|
187
|
+
import type { FleetRow } from "../lib/fleet-read-model.ts";
|
|
188
|
+
import { gridColumnsForSize } from "../lib/fleet-dashboard-ops.ts";
|
|
189
|
+
import { createFleetTranscriptStore } from "../lib/fleet-transcript-store.ts";
|
|
190
|
+
import type { ContextBudgetComponent } from "../lib/context-budget.ts";
|
|
191
|
+
import { buildHubSystemPrompt as assembleHubPrompt } from "./prompts/system-prompt.ts";
|
|
192
|
+
import type { HubPromptContext } from "./prompts/context.ts";
|
|
193
|
+
import { buildSessionStartNotice, createSessionFooter } from "./prompts/session-start.ts";
|
|
194
|
+
import { registerSessionStart } from "./session-start.ts";
|
|
195
|
+
import { createHubStateContext } from "./context/hub-state.ts";
|
|
196
|
+
import { createAgentStateFactory } from "./context/agent-state.ts";
|
|
197
|
+
import { createBudgetContext, createSessionTotals, freshTurnReport, type TurnReport } from "./context/budgets.ts";
|
|
198
|
+
import { createAssertionsArtifactsContext, type Assertion, type InputArtifactPreview } from "./context/assertions-artifacts.ts";
|
|
199
|
+
import { createModelPolicy } from "./policy/models.ts";
|
|
200
|
+
import { createRosterPolicy } from "./policy/roster.ts";
|
|
201
|
+
import { createWorkModePolicy } from "./policy/work-mode.ts";
|
|
202
|
+
import { catalogSnapshot, latestPersistedToolCatalog, toolCatalogNotice, TOOL_CATALOG_ENTRY_TYPE, type ToolCatalogDelta } from "./tool-catalog-state.ts";
|
|
203
|
+
import { createToolCatalogRuntime } from "./tool-catalog-runtime.ts";
|
|
204
|
+
import { createUnknownToolCounter, latestPersistedUnknownToolCounter, observeUnknownToolCalls, restoreUnknownToolCounter, unknownToolNotice, UNKNOWN_TOOL_COUNTER_ENTRY_TYPE } from "./unknown-tool-counter.ts";
|
|
205
|
+
import { buildProjectDocsProtocol, buildProjectRulesProtocol, nativeResearchSystemPrompt } from "../lib/context-budget-child-prompt.ts";
|
|
206
|
+
import { parseEnvFile, resolveEnvFilePath } from "../../agent-fleet/scripts/lib/herdr-layout.ts";
|
|
207
|
+
import { worktreeTag } from "../../agent-fleet/scripts/lib/team-project.ts";
|
|
208
|
+
import { join, resolve } from "path";
|
|
209
|
+
import * as fs from "node:fs";
|
|
210
|
+
import * as path from "node:path";
|
|
211
|
+
import * as crypto from "node:crypto";
|
|
212
|
+
import { fileURLToPath } from "node:url";
|
|
213
|
+
|
|
214
|
+
// ── Extension ────────────────────────────────────
|
|
215
|
+
|
|
216
|
+
const CONTEXT_WARN_THRESHOLD = 70;
|
|
217
|
+
const RESEARCHER_PERSONAS = new Set(["researcher", "deep-researcher"]);
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Test-only transport seam for real-Pi acceptance. With the offline guard,
|
|
221
|
+
* the normal shared System 1 service uses deterministic wire responses rather
|
|
222
|
+
* than HTTPS; config, readiness, adapter, deadlines and consumers remain real.
|
|
223
|
+
* A profile alone cannot activate this seam outside the guarded test process.
|
|
224
|
+
*/
|
|
225
|
+
let taskTriageFakeInstances = 0;
|
|
226
|
+
function resolveTaskTriageTestTransport(): JevTransport | undefined {
|
|
227
|
+
const profile = process.env.AGENT_HUB_TASK_TRIAGE_FAKE;
|
|
228
|
+
const guard = `--import=${fileURLToPath(new URL("../../../bin/test/helpers/system1-no-network.js", import.meta.url))}`;
|
|
229
|
+
if (!profile || process.env.PI_OFFLINE !== "1" || !process.env.NODE_OPTIONS?.split(/\s+/).includes(guard)) return undefined;
|
|
230
|
+
const hot = profile === "security" ? "security_change" : profile === "wide" ? "wide_change" : profile === "irreversible" ? "irreversible_execution" : null;
|
|
231
|
+
if (!hot && profile !== "plain" && profile !== "timeout" && profile !== "context-safe") return undefined;
|
|
232
|
+
const instanceId = ++taskTriageFakeInstances;
|
|
233
|
+
return async request => {
|
|
234
|
+
const wire = JSON.parse(request.body.toString("utf8"));
|
|
235
|
+
const recordPath = process.env.AGENT_HUB_TASK_TRIAGE_FAKE_RECORD;
|
|
236
|
+
if (recordPath) {
|
|
237
|
+
try { fs.appendFileSync(recordPath, JSON.stringify({ at: Date.now(), profile, instanceId, pid: process.pid, questions: Object.keys(wire.questions), stateFingerprint: createHash("sha256").update(JSON.stringify(wire.state)).digest("hex"), questionFingerprint: createHash("sha256").update(JSON.stringify(wire.questions)).digest("hex"), stack: (new Error("fake-transport").stack ?? "").split("\n").slice(1, 6) }) + "\n"); } catch { /* evidence best-effort */ }
|
|
238
|
+
}
|
|
239
|
+
if(profile === "context-safe" && wire.questions.boundary && process.env.AGENT_HUB_CONTEXT_FAKE_DELAY_MS) {
|
|
240
|
+
const delay=Number(process.env.AGENT_HUB_CONTEXT_FAKE_DELAY_MS);
|
|
241
|
+
if(Number.isFinite(delay) && delay>0 && delay<=500) await new Promise(resolve=>setTimeout(resolve,delay));
|
|
242
|
+
}
|
|
243
|
+
if (profile === "timeout") {
|
|
244
|
+
return new Promise((_, reject) => {
|
|
245
|
+
if (request.signal.aborted) return reject(new Error("guarded fake transport deadline"));
|
|
246
|
+
request.signal.addEventListener("abort", () => reject(new Error("guarded fake transport deadline")), { once: true });
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
return { status: 200, headers: {}, body: JSON.stringify({ model: TASK_TRIAGE_MODEL,
|
|
250
|
+
answers: Object.fromEntries(Object.keys(wire.questions).map(id => {
|
|
251
|
+
if(profile === "context-safe" && (id === "boundary" || id === "retention")) {
|
|
252
|
+
const choice=id === "boundary"?"safe":"active_step";
|
|
253
|
+
const keys=id === "boundary"?["safe","unsafe","unknown"]:["standard","active_step","decisions","unknown"];
|
|
254
|
+
return [id,{type:"choice",choice,confidence:0.95,probabilities:Object.fromEntries(keys.map(key=>[key,key===choice?0.95:0.05/(keys.length-1)]))}];
|
|
255
|
+
}
|
|
256
|
+
return [id,{type:"noul",noul:id === hot?0.95:0.05}];
|
|
257
|
+
})),
|
|
258
|
+
usage: { input_tokens: 1, output_tokens: 1 },
|
|
259
|
+
}) };
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export default function (pi: ExtensionAPI) {
|
|
264
|
+
// ── Embedded coms: identity CLI flags ──
|
|
265
|
+
// Registered here (factory load time) so pi's CLI parser accepts them. Because
|
|
266
|
+
// coms is EMBEDDED (one extension, not a second `-e`), these register exactly once.
|
|
267
|
+
pi.registerFlag("name", { description: "Coms: override agent name (else frontmatter or auto-generated)", type: "string", default: undefined });
|
|
268
|
+
pi.registerFlag("purpose", { description: "Coms: override agent purpose (else frontmatter description)", type: "string", default: undefined });
|
|
269
|
+
pi.registerFlag("project", { description: "Coms: project namespace for peer discovery", type: "string", default: "default" });
|
|
270
|
+
pi.registerFlag("color", { description: "Coms: hex color #RRGGBB (else frontmatter or palette fallback)", type: "string", default: undefined });
|
|
271
|
+
pi.registerFlag("explicit", { description: "Coms: hide from auto-discovery; addressable only by exact name", type: "boolean", default: false });
|
|
272
|
+
pi.registerFlag("solo", { description: "Run without the coms layer (fixed specialists + research only — `just fleet hub --solo`)", type: "boolean", default: false });
|
|
273
|
+
pi.registerFlag("work-mode", { description: "Fleet main-agent work mode: operator|orchestrator", type: "string", default: undefined });
|
|
274
|
+
pi.registerFlag("agent-team", { description: "Internal: activate a named native roster from .pi/agents/teams.yaml", type: "string", default: undefined });
|
|
275
|
+
|
|
276
|
+
// ── Embedded coms: shared peer state ──
|
|
277
|
+
let currentCtx: ExtensionContext | null = null;
|
|
278
|
+
let refreshFleetUi = () => {};
|
|
279
|
+
const permissionRelay=new PermissionRelay(()=>observationOwner(),()=>accessTaskIdentity());registerPermissionRelay(pi,permissionRelay);registerPermissionRelay(pi.events,permissionRelay);
|
|
280
|
+
let codexNotifications:import('../../agent-fleet/scripts/lib/fleet-codex-event-runtime.ts').FleetCodexNotificationRuntime|undefined;
|
|
281
|
+
let renewCodexNotifications:((until:number)=>unknown)|undefined;
|
|
282
|
+
const codexPolicyRoot=process.env.AF_CODEX_POLICY_ROOT??path.join(homedir(),'.codex/agent-fleet/state/fleet-native');
|
|
283
|
+
const codexNamespace={hostProfile:process.env.AF_CODEX_HOST_PROFILE??'desktop',principal:process.env.AF_CODEX_PRINCIPAL??'local-user'};
|
|
284
|
+
const connectionControl=new FleetConnectionControl({owner:()=>observationOwner(),session:()=>codexNotifications?{status:()=>codexNotifications!.status(),renewUntil:until=>{if(!renewCodexNotifications)throw Error('renewal_unavailable');return renewCodexNotifications(until);}}:undefined,
|
|
285
|
+
defaultNamespace:codexNamespace,listNamespaces:async()=>(await connectionNamespaces(codexPolicyRoot)).filter(c=>c.hostProfile===codexNamespace.hostProfile&&c.principal===codexNamespace.principal),
|
|
286
|
+
readRights:async namespace=>{const owner=observationOwner();if(!owner)return {rights:[],status:'owner_unavailable'};
|
|
287
|
+
try{const {AllowedSessionsStore}=await import('../../agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts');const state=await new AllowedSessionsStore(codexPolicyRoot,namespace).open();
|
|
288
|
+
const b=state.bindings.find(b=>b.target.project===owner.project&&b.target.peer===owner.peer);
|
|
289
|
+
return b?{rights:[...b.rights],expiresAt:b.expiresAt,status:b.target.sessionId===owner.sessionId&&b.target.startedAt===owner.startedAt?b.status:'target_changed',revision:state.revision}:{rights:[],status:'not_connected',revision:state.revision};
|
|
290
|
+
}catch{return {rights:[],status:'rights_unavailable'};}
|
|
291
|
+
}});
|
|
292
|
+
let connectionRefreshAt=0,connectionRefreshBusy=false;
|
|
293
|
+
const refreshConnections=()=>{if(connectionRefreshBusy||Date.now()-connectionRefreshAt<2000)return;connectionRefreshAt=Date.now();connectionRefreshBusy=true;void connectionControl.refresh().finally(()=>{connectionRefreshBusy=false;refreshFleetUi();});};
|
|
294
|
+
// Explicit user command only: no configuration discovery or default host activation.
|
|
295
|
+
pi.registerCommand('af-codex-events',{description:'prepare|enable <private config.json> or disable; never starts daemon or grants approve',handler:async(args,ctx)=>{
|
|
296
|
+
let started:typeof codexNotifications;
|
|
297
|
+
try{
|
|
298
|
+
const split=args.trim().indexOf(' '),operation=split<0?args.trim():args.trim().slice(0,split),path=split<0?'':args.trim().slice(split+1).trim();
|
|
299
|
+
if(operation==='disable'){codexNotifications?.stop();codexNotifications=undefined;ctx.ui.notify('Codex event runtime stopped; no grants changed.','info');return;}
|
|
300
|
+
if(!['prepare','enable'].includes(operation)||!path)throw Error('notification_command_invalid');
|
|
301
|
+
const {readNotificationConfiguration,notificationConfigurationUnchanged,notificationPreview,renewNotificationConfiguration,FleetCodexNotificationRuntime}=await import('../../agent-fleet/scripts/lib/fleet-codex-event-runtime.ts');
|
|
302
|
+
const config=readNotificationConfiguration(path),preview=notificationPreview(config,observationOwner());
|
|
303
|
+
if(operation==='prepare'||!preview.ready){ctx.ui.notify(JSON.stringify(preview),preview.ready?'info':'warning');return;}
|
|
304
|
+
if(codexNotifications)throw Error('notification_runtime_already_running');
|
|
305
|
+
const runtime=new FleetCodexNotificationRuntime(config,()=>notificationConfigurationUnchanged(path,config)?observationOwner():null);const startup=runtime.start();started=runtime;codexNotifications=runtime;await startup;
|
|
306
|
+
renewCodexNotifications=until=>runtime.renewUntil(until,()=>{const next=renewNotificationConfiguration(path,config,until);config.approval.confirmedUntil=next.approval.confirmedUntil;});refreshConnections();
|
|
307
|
+
ctx.ui.notify('Codex event ingress enabled explicitly; ACK is not model delivery, no approve granted.','info');
|
|
308
|
+
}catch{if(started){started.stop();if(codexNotifications===started)codexNotifications=undefined;}ctx.ui.notify('Codex event operation refused or uncertain; inspect private journal, do not replay.','error');}
|
|
309
|
+
}});
|
|
310
|
+
pi.on('session_shutdown',async()=>{codexNotifications?.stop();codexNotifications=undefined;});
|
|
311
|
+
const coms = createComsPeer({
|
|
312
|
+
pi,
|
|
313
|
+
getContext: () => currentCtx,
|
|
314
|
+
instructionReceipts: true,
|
|
315
|
+
onPeersChanged: () => refreshFleetUi(),
|
|
316
|
+
acceptInbound: () => currentCtx && modelWorkBlockedByRosterRecovery(currentCtx)
|
|
317
|
+
? "orchestrator roster recovery required"
|
|
318
|
+
: null,
|
|
319
|
+
handleCustomEnvelope: (socket, envelope) => {
|
|
320
|
+
if(connectionControl.handle(socket,envelope))return true;
|
|
321
|
+
if (handleObservationEnvelope(socket, envelope, {
|
|
322
|
+
owner: observationOwner,
|
|
323
|
+
session: () => currentCtx?.sessionManager,
|
|
324
|
+
questions: () => { const owner = observationOwner(); return owner ? questionChannel.list(owner) : { status: 'stale' }; },
|
|
325
|
+
permissions:()=>permissionRelay.summary(),
|
|
326
|
+
})) return true;
|
|
327
|
+
if (handleInstructionReceipt(envelope, socket, observationOwner, currentCtx?.sessionManager)) return true;
|
|
328
|
+
if (handlePermissionEnvelope(socket,envelope,permissionRelay,observationOwner())) return true;
|
|
329
|
+
if (handleQuestionEnvelope(socket, envelope)) return true;
|
|
330
|
+
if (envelope.type !== "access_request") return false;
|
|
331
|
+
void accessApprovalRouter.handle(socket, envelope as AccessRequest);
|
|
332
|
+
return true;
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
function observationOwner() { return coms.ready && coms.identity ? {
|
|
336
|
+
project: coms.identity.project, peer: coms.identity.name,
|
|
337
|
+
sessionId: coms.identity.session_id, startedAt: coms.identity.started_at,
|
|
338
|
+
} : null; }
|
|
339
|
+
const unregisterQuestions = registerQuestionPeer(() => coms.ready && coms.identity ? {
|
|
340
|
+
project: coms.identity.project, peer: coms.identity.name,
|
|
341
|
+
sessionId: coms.identity.session_id, startedAt: coms.identity.started_at,
|
|
342
|
+
} : null);
|
|
343
|
+
let identity: ComsIdentity | null = null;
|
|
344
|
+
const peerCards = coms.peerCards;
|
|
345
|
+
const pendingReplies = coms.pendingReplies;
|
|
346
|
+
const inboundQueue = coms.inboundQueue;
|
|
347
|
+
let comsReady = false;
|
|
348
|
+
let monitorLifecycle: ReturnType<typeof createMonitorLifecycle> | null = null;
|
|
349
|
+
let monitorHubId: string | null = null;
|
|
350
|
+
let monitorTurnId: string | null = null;
|
|
351
|
+
let monitorBridge: ReturnType<typeof createMonitorSessionBridge> | null = null;
|
|
352
|
+
let monitorOwnerId: string | undefined;
|
|
353
|
+
|
|
354
|
+
// ── Damage-control exemptions + access escalation state ──
|
|
355
|
+
// exemptionsFile is the session-scoped shared exemptions file: /af-allow
|
|
356
|
+
// session grants (via the co-loaded damage-control-continue) and approved
|
|
357
|
+
// escalations land here, and spawned children read it through the
|
|
358
|
+
// AGENT_HUB_EXEMPTIONS_FILE env plumbing.
|
|
359
|
+
let exemptionsFile: string | null = null;
|
|
360
|
+
const accessEpochs=new Map<string,string>();
|
|
361
|
+
const accessTaskIdentity=()=>({taskId:noProgress.taskId(),inputRevision:crypto.createHash('sha256').update(JSON.stringify({task:hubTaskText,revision:taskTriage?.current?.revision??''})).digest('hex')});
|
|
362
|
+
const accessApprovalRouter = createAccessApprovalRouter({
|
|
363
|
+
relay:permissionRelay,appendPermissionLog:entry=>pi.appendEntry('damage-permission-decision',entry),taskIdentity:accessTaskIdentity,currentChild:request=>accessEpochs.get(request.agent)===request.accessEpoch&&agentStates.get(request.agent)?.status==='running',
|
|
364
|
+
traceBus: pi.events,
|
|
365
|
+
getContext: () => currentCtx,
|
|
366
|
+
getExemptionsFile: () => exemptionsFile,
|
|
367
|
+
appendLog: (entry) => { pi.appendEntry("damage-control-log", entry); },
|
|
368
|
+
now: nowIso,
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
const agentStates: Map<string, AgentState> = new Map();
|
|
372
|
+
// Live-only research helpers, keyed by numeric id (handle `rN`). Visible in the
|
|
373
|
+
// Fleet Dashboard (Alt+A) while running; evicted from this map on every terminal
|
|
374
|
+
// outcome. Session/transcript/findings files and /af-agents-history survive.
|
|
375
|
+
let researchStates: Map<number, ResearchState> = new Map();
|
|
376
|
+
// Metadata only: prompt text is never retained by this ledger.
|
|
377
|
+
let lastHubLedger: ContextBudgetComponent[] = [];
|
|
378
|
+
let nextResearchId = 1;
|
|
379
|
+
|
|
380
|
+
// ── Execution history (/af-agents-history) ──────────
|
|
381
|
+
// The typed store owns entries and turn/ask_user bookkeeping; index.ts owns
|
|
382
|
+
// composition and wires lifecycle events to its explicit API.
|
|
383
|
+
const executionHistory = createExecutionHistoryStore();
|
|
384
|
+
|
|
385
|
+
let researchPersonas: AgentDef[] = [];
|
|
386
|
+
let allAgentDefs: AgentDef[] = [];
|
|
387
|
+
let teams: Record<string, string[]> = {};
|
|
388
|
+
// Named model profiles from .pi/agents/model-profiles.yaml (validated at
|
|
389
|
+
// session start) and the session-lifetime per-persona model overrides set by
|
|
390
|
+
// /af-agent-model and /af-models (lowercase persona name → pi model spec). Overrides
|
|
391
|
+
// reset on session_start; profiles make re-applying cheap.
|
|
392
|
+
let modelProfiles: ModelProfiles = {};
|
|
393
|
+
let modelProfileErrors: string[] = [];
|
|
394
|
+
// Backend routing policy (.pi/agents/dispatch-policy.yaml): per dispatch, a
|
|
395
|
+
// member preferring coms is served by a live same-name pool peer instead of a
|
|
396
|
+
// native subagent spawn. Missing file → everything native (status quo).
|
|
397
|
+
let dispatchPolicy: {
|
|
398
|
+
default: string;
|
|
399
|
+
grace_s: number;
|
|
400
|
+
substitutions: Record<string, { prefer: string; fallback: string; timeout_s?: number }>;
|
|
401
|
+
} = { default: "native", grace_s: 30, substitutions: {} };
|
|
402
|
+
let dispatchPolicyWarnings: string[] = [];
|
|
403
|
+
// One "coms peer missing → native" notice per member per team activation.
|
|
404
|
+
const comsMissNotified = new Set<string>();
|
|
405
|
+
|
|
406
|
+
let activeTeamName = "";
|
|
407
|
+
let gridCols = 2;
|
|
408
|
+
let widgetCtx: any;
|
|
409
|
+
let sessionDir = "";
|
|
410
|
+
let contextWindow = 0;
|
|
411
|
+
// Per-provider in-flight cap for the hub's OWN spawns (specialists and
|
|
412
|
+
// research helpers, which the dispatcher can start in parallel). Delegate
|
|
413
|
+
// children are gated by the same policy inside their parent's process. The
|
|
414
|
+
// drift judge and the return extractor are deliberately NOT gated: both run
|
|
415
|
+
// while a specialist holds a permit, so queueing them behind that specialist
|
|
416
|
+
// would stall the very watchdog that is supposed to stop it.
|
|
417
|
+
const providerSemaphore = createProviderSemaphore({
|
|
418
|
+
...DEFAULT_PROVIDER_LIMITS,
|
|
419
|
+
...parseProviderLimits(process.env.AGENT_HUB_PROVIDER_LIMITS),
|
|
420
|
+
});
|
|
421
|
+
/**
|
|
422
|
+
* pi's model registry as a plain lookup — the documented source for every
|
|
423
|
+
* model's window, and the same one the dispatcher's own window comes from.
|
|
424
|
+
*/
|
|
425
|
+
function modelWindowLookup(ctx: any): (provider: string, modelId: string) => any {
|
|
426
|
+
return (provider, modelId) => ctx?.modelRegistry?.find?.(provider, modelId);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** Say so when a run is about to wait on a provider permit, not just hang. */
|
|
430
|
+
function notifyProviderQueue(model: string, label: string, ctx: any): void {
|
|
431
|
+
const cap = providerSemaphore.limitFor(model);
|
|
432
|
+
if (cap == null || providerSemaphore.inFlight(model) < cap) return;
|
|
433
|
+
const ahead = providerSemaphore.queued(model) + 1;
|
|
434
|
+
ctx?.ui?.notify(
|
|
435
|
+
`${label}: queued — ${cap} requests already in flight on this provider (${ahead} waiting). ` +
|
|
436
|
+
"Raise or disable the cap with AGENT_HUB_PROVIDER_LIMITS (e.g. custom=4, custom=off).",
|
|
437
|
+
"info",
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
let activeWritableDispatches = 0;
|
|
442
|
+
let writableOverlapCounter = 0;
|
|
443
|
+
function privateProofUse(cwd = currentCtx?.cwd || process.cwd()): PrivateProofUse {
|
|
444
|
+
return { cwd, taskId: noProgress.taskId(), sessionDir, declarationHash: privateDeclarationHash(assertions as any, hubTaskText), activeWriters: activeWritableDispatches, overlap: writableOverlapCounter };
|
|
445
|
+
}
|
|
446
|
+
let pendingHandoff: { target: string; token: string } | null = null;
|
|
447
|
+
const hubStateCtx = createHubStateContext({
|
|
448
|
+
getCurrentContext: () => currentCtx, setCurrentContext: value => { currentCtx = value; },
|
|
449
|
+
getExemptionsFile: () => exemptionsFile, setExemptionsFile: value => { exemptionsFile = value; },
|
|
450
|
+
getSessionDir: () => sessionDir, setSessionDir: value => { sessionDir = value; },
|
|
451
|
+
getWidgetContext: () => widgetCtx, setWidgetContext: value => { widgetCtx = value; },
|
|
452
|
+
getPendingHandoff: () => pendingHandoff, setPendingHandoff: value => { pendingHandoff = value; },
|
|
453
|
+
});
|
|
454
|
+
let userLanguage: string = DEFAULT_OVERRIDES.language;
|
|
455
|
+
// Project rule folders from the overrides file's `rules:` key (repo-relative,
|
|
456
|
+
// validated at session_start). Non-empty → every dispatched specialist gets a
|
|
457
|
+
// "Project rules" prompt block; personas resolve the folders index-first (a
|
|
458
|
+
// top-level README.md/index.md is a loading manifest) with recursive discovery
|
|
459
|
+
// as the no-index fallback.
|
|
460
|
+
let projectRulesDirs: string[] = [];
|
|
461
|
+
// Project documentation entry points from the overrides file's `docs:` key
|
|
462
|
+
// (repo-relative files or folders, validated at session_start). Non-empty →
|
|
463
|
+
// dispatched specialists and research helpers get a "Project docs" prompt block.
|
|
464
|
+
let projectDocsPaths: string[] = [];
|
|
465
|
+
|
|
466
|
+
// Prompt blocks for the project's own rules (HOW — compliance) and docs
|
|
467
|
+
// (WHAT/WHY — orientation). Rules discovery is index-first so a curated rule
|
|
468
|
+
// tree (README manifest + session bundles) is honored instead of bulk-read;
|
|
469
|
+
// the blind recursive find is only the no-index fallback. The validation duty
|
|
470
|
+
// itself is written into the planner/code-reviewer personas.
|
|
471
|
+
function buildRulesProtocol(): string {
|
|
472
|
+
return buildProjectRulesProtocol(projectRulesDirs);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function buildDocsProtocol(): string {
|
|
476
|
+
return buildProjectDocsProtocol(projectDocsPaths);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/** One canonical repository context file plus explicitly configured rule roots. */
|
|
480
|
+
function specialistProjectPolicyPaths(cwd: string): string[] {
|
|
481
|
+
const canonical = ["AGENTS.md", "CLAUDE.md"].find(candidate => existsSync(path.join(cwd, candidate)));
|
|
482
|
+
return [...new Set([...(canonical ? [canonical] : []), ...projectRulesDirs])];
|
|
483
|
+
}
|
|
484
|
+
// The one supported safety harness. Every native specialist, researcher, and
|
|
485
|
+
// nested delegate receives it; a missing harness refuses child dispatch.
|
|
486
|
+
let safetyHarnessPath: string | null = null;
|
|
487
|
+
// Resolved once at session_start: the delegate extension injected into
|
|
488
|
+
// specialists that declare `subagents:` (null → delegation disabled).
|
|
489
|
+
let delegateExtPath: string | null = null;
|
|
490
|
+
// Per-tool deadline for read/grep/find/ls in research helpers/delegates. The
|
|
491
|
+
// whole-run bound is separate: the turn budget's agentTurnMs (run-budget.js).
|
|
492
|
+
let reconSearchTimeoutMs: number | null = 120_000;
|
|
493
|
+
// ── Usage accounting and tier (run-budget.js) ──
|
|
494
|
+
// Dispatch/research counts and active time are visible accounting, never
|
|
495
|
+
// continuation quotas. Overrides bound only the child deadline and recycling.
|
|
496
|
+
// Turn counters reset in before_agent_start; task counters span the whole TASK
|
|
497
|
+
// and are cleared only by an explicit new task (`set_task_tier` with
|
|
498
|
+
// `new_task: true`), never by an ordinary user message.
|
|
499
|
+
let budgetOverrides: AgentTeamOverrides["budgetOverrides"] = {};
|
|
500
|
+
let turnDispatchCount = 0;
|
|
501
|
+
let turnResearchCount = 0;
|
|
502
|
+
let taskDispatchCount = 0;
|
|
503
|
+
let taskResearchCount = 0;
|
|
504
|
+
let taskLabel: string | null = null;
|
|
505
|
+
// The task clock charges ACTIVE time only — turns that ran, minus the time the
|
|
506
|
+
// dispatcher spent blocked on ask_user. Raw wall clock would bill the human's
|
|
507
|
+
// lunch break, an overnight pause, and every long answer against the task, and
|
|
508
|
+
// at small tier's 45-minute envelope that hard-stops a task with two dispatches
|
|
509
|
+
// spent. A false stop is worse than no stop: it teaches people to reset the
|
|
510
|
+
// task window reflexively, which is the one thing that must stay deliberate.
|
|
511
|
+
// The explicit clock state makes `active` authoritative: a stale timestamp can
|
|
512
|
+
// never turn inter-turn idle time into task work.
|
|
513
|
+
let taskClock = createTaskClock();
|
|
514
|
+
// Review dispatches spent on this task (review-round cap).
|
|
515
|
+
let taskReviewRounds = 0;
|
|
516
|
+
// Task tier (complexity triage): declared by the dispatcher via set_task_tier.
|
|
517
|
+
// TASK-scoped, not turn-scoped, and it moves by ratchet — down freely, up only
|
|
518
|
+
// with a stated reason (applyTierChange). Null until declared; the first
|
|
519
|
+
// dispatch assumes DEFAULT_TASK_TIER. Caps come from the tier envelope.
|
|
520
|
+
let taskTier: string | null = null;
|
|
521
|
+
// Was the tier ASSUMED by the hub rather than declared by the dispatcher? The
|
|
522
|
+
// distinction matters to the ratchet: an assumed tier must not turn the
|
|
523
|
+
// dispatcher's own first triage call into an "escalation" that needs a reason.
|
|
524
|
+
let taskTierAssumed = false;
|
|
525
|
+
// Correctness obligations are independent of the spend tier. They persist for
|
|
526
|
+
// the current task and reset only through the explicit new-task tool path.
|
|
527
|
+
let processState = createProcessState();
|
|
528
|
+
let taskTriage: ReturnType<typeof createTaskTriageRuntime> | null = null;
|
|
529
|
+
let taskTriageTestTransportActive = false;
|
|
530
|
+
let taskTriageActivity: TaskTriageActivity | null = null;
|
|
531
|
+
let taskTriageConfigStatus: "active" | "off" | "invalid" = "off";
|
|
532
|
+
let taskTriageConfigured = false;
|
|
533
|
+
let processPersistenceBlocked = false;
|
|
534
|
+
let pendingTaskTransition = false;
|
|
535
|
+
let transitionDiversions = 0;
|
|
536
|
+
let transitionHintDelivered = false;
|
|
537
|
+
let transitionBatchRefused = false;
|
|
538
|
+
let orchestratorSelfReadUsed = 0;
|
|
539
|
+
const processBlock = () => processPersistenceBlocked ? { reason: "process_state_corrupt", message: "Process persistence is blocked; dependent effects remain refused. Ask the human to run /af-task-triage-recover for a checked in-session append/readback; if it refuses, inspect or resume a valid session. Never edit session JSONL or reset obligations." } : pendingTaskTransition ? { reason: "task_transition_pending", message: taskTransitionRecoveryHint } : null;
|
|
540
|
+
const persistProcessVerdict = (state: ProcessObligationState, verdict: ProcessVerdict) => {
|
|
541
|
+
try { pi.appendEntry("agent-hub-process-state", processAuditRecord(state, verdict)); }
|
|
542
|
+
catch { processPersistenceBlocked = true; }
|
|
543
|
+
};
|
|
544
|
+
// Duplicate-dispatch guard: fingerprints of (agent, task) already dispatched
|
|
545
|
+
// THIS turn. Auto-research resumes and /af-agents-restart call dispatchAgent
|
|
546
|
+
// directly, so only real dispatcher tool calls are guarded.
|
|
547
|
+
const turnDispatchFingerprints = new Set<string>();
|
|
548
|
+
// ── External-blocker circuit breaker (external-blocker.js) ──
|
|
549
|
+
// Set when a specialist reports it needs something outside the fleet's reach;
|
|
550
|
+
// gates the next dispatch until the human has been addressed. Cleared by an
|
|
551
|
+
// ask_user call, by a new user turn (the human spoke), and by a new task.
|
|
552
|
+
let externalBlockers: { agent: string; what: string }[] = [];
|
|
553
|
+
let externalBlockerAcknowledged = false;
|
|
554
|
+
let externalBlockerRefusedOnce = false;
|
|
555
|
+
// Per-run artifact archive retention (run-namespace.js).
|
|
556
|
+
let runHistoryKeep: number | null = DEFAULT_RUN_HISTORY_KEEP;
|
|
557
|
+
// ── Drift watchdog (drift-watchdog.js) ──
|
|
558
|
+
// Hub-wide setting from the overrides file, live-switchable via /af-watchdog;
|
|
559
|
+
// per-agent overrides ("on"/"off") win over it. In operator work mode a
|
|
560
|
+
// dispatch_agent `watchdog` param wins over both. In orchestrator work mode the
|
|
561
|
+
// watchdog auto-arms unless hub or per-agent is explicitly off; dispatch
|
|
562
|
+
// `watchdog: false` cannot disarm it.
|
|
563
|
+
let watchdogSetting: string = DEFAULT_WATCHDOG_SETTING;
|
|
564
|
+
let watchdogJudgeModel: string | null = null;
|
|
565
|
+
let watchdogSystem1: WatchdogSystem1Session | null = null;
|
|
566
|
+
const communicationStore = createCommunicationStore();
|
|
567
|
+
let triageRuntime: ReturnType<typeof createTriageRuntime> | null = null;
|
|
568
|
+
let proactiveRuntime: ReturnType<typeof createProactiveRuntime> | null = null;
|
|
569
|
+
let system1Snapshot: ReturnType<typeof loadSystem1Snapshot> = normalizeSystem1Config(null);
|
|
570
|
+
let proactiveConfig: ProactiveConfig | null = null;
|
|
571
|
+
let proactiveHubDeliveries = 0;
|
|
572
|
+
const proactiveReportInput = () => proactiveRuntime ? { records: proactiveRuntime.records, history: proactiveRuntime.findings.history, current: proactiveRuntime.findings.current, activity: proactiveRuntime.activity.live(), feedback: { hubDelivered: proactiveHubDeliveries, nativeDelivered: null } } : undefined;
|
|
573
|
+
let hubTaskText: string | undefined;
|
|
574
|
+
const hubCapture = createHubCapture({ root: () => currentCtx?.cwd || process.cwd(), task: () => hubTaskText, policyRoots:()=>sessionOverrides?.policyRoots });
|
|
575
|
+
let watchdogActivity: WatchdogActivity | null = null;
|
|
576
|
+
const watchdogAgentOverrides = new Map<string, "on" | "off">();
|
|
577
|
+
// ── Per-turn cost report (/af-hub-report) ──
|
|
578
|
+
let turnReport: TurnReport = freshTurnReport();
|
|
579
|
+
let lastTurnReport: TurnReport | null = null;
|
|
580
|
+
const sessionTotals = createSessionTotals();
|
|
581
|
+
// Session-wide delegated-spend counter (tokens across all delegate children),
|
|
582
|
+
// surfaced in the status line. Resets on session_start.
|
|
583
|
+
let delegatedTokens = 0;
|
|
584
|
+
|
|
585
|
+
const noProgress = createNoProgressGuard((type, data) => pi.appendEntry(type, data));
|
|
586
|
+
const executionTrace = createExecutionTrace({
|
|
587
|
+
identity: () => ({ taskId: noProgress.taskId(), inputRevision: hubTaskText ?? "" }),
|
|
588
|
+
persist: row => pi.appendEntry(EXECUTION_TRACE_ENTRY, row),
|
|
589
|
+
});
|
|
590
|
+
registerExecutionTrace(pi, executionTrace);
|
|
591
|
+
const taskTriageMetadata = () => {
|
|
592
|
+
const current = taskTriage?.current;
|
|
593
|
+
return { taskId: noProgress.taskId(), inputRevision: taskTriage?.inputRevision, configuredStatus: taskTriageConfigStatus,
|
|
594
|
+
runtimeBlocks: [...(processPersistenceBlocked ? ["process_persistence_blocked" as const] : []), ...(pendingTaskTransition ? ["task_transition_pending" as const] : [])],
|
|
595
|
+
assessment: current ? { taskId: current.taskId, evaluationId: current.evaluationId, inputRevision: current.revision, assessment: current.assessment } : undefined };
|
|
596
|
+
};
|
|
597
|
+
let taskIdentityReset: ReturnType<typeof createReservedTaskIdentityReset>;
|
|
598
|
+
let unknownToolCounter = createUnknownToolCounter({ limit: 3 });
|
|
599
|
+
const toolCatalogRuntime = createToolCatalogRuntime(catalogSnapshot("operator", []));
|
|
600
|
+
let latestToolCatalogDelta: ToolCatalogDelta | null = null;
|
|
601
|
+
let latestUnknownToolNotice = "";
|
|
602
|
+
const seenUnknownToolCalls = new Set<string>();
|
|
603
|
+
const resetUnknownToolCounterForCurrentTask = () => {
|
|
604
|
+
unknownToolCounter.resetForNewTask(noProgress.taskId());
|
|
605
|
+
seenUnknownToolCalls.clear();
|
|
606
|
+
latestUnknownToolNotice = "";
|
|
607
|
+
};
|
|
608
|
+
const budgetCtx = createBudgetContext({
|
|
609
|
+
getBudgetOverrides: () => budgetOverrides,
|
|
610
|
+
getTurnDispatchCount: () => turnDispatchCount, setTurnDispatchCount: value => { turnDispatchCount = value; },
|
|
611
|
+
getTurnResearchCount: () => turnResearchCount, setTurnResearchCount: value => { turnResearchCount = value; },
|
|
612
|
+
resetNoProgress: (persistTaskIdentity) => noProgress.reset(persistTaskIdentity), resetUnknownToolCounter: resetUnknownToolCounterForCurrentTask,
|
|
613
|
+
getTaskDispatchCount: () => taskDispatchCount, setTaskDispatchCount: value => { taskDispatchCount = value; },
|
|
614
|
+
getTaskResearchCount: () => taskResearchCount, setTaskResearchCount: value => { taskResearchCount = value; },
|
|
615
|
+
getTaskLabel: () => taskLabel, setTaskLabel: value => { taskLabel = value; },
|
|
616
|
+
getTaskClock: () => taskClock, setTaskClock: value => { taskClock = value; },
|
|
617
|
+
getTaskReviewRounds: () => taskReviewRounds, setTaskReviewRounds: value => { taskReviewRounds = value; },
|
|
618
|
+
getTaskTier: () => taskTier, setTaskTier: value => { taskTier = value; },
|
|
619
|
+
getTaskTierAssumed: () => taskTierAssumed, setTaskTierAssumed: value => { taskTierAssumed = value; },
|
|
620
|
+
clearTurnDispatchFingerprints: () => turnDispatchFingerprints.clear(),
|
|
621
|
+
clearTaskCapabilities: () => workModePolicy.resetCapabilities(),
|
|
622
|
+
clearExternalBlockers: () => { externalBlockers = []; externalBlockerAcknowledged = false; externalBlockerRefusedOnce = false; },
|
|
623
|
+
resolveIncomingCapabilities: (acceptedUserInput = "") => { resolveIncomingCapabilities(acceptedUserInput, true); }, applyWorkModeTools: () => { applyWorkModeTools(); },
|
|
624
|
+
getTurnReport: () => turnReport,
|
|
625
|
+
setStatus: (key, value) => { widgetCtx?.ui?.setStatus(key, value); },
|
|
626
|
+
getAuditContext: () => ({ cwd: identity?.cwd ?? currentCtx?.cwd, sessionId: identity?.session_id, project: identity?.project }),
|
|
627
|
+
appendEntry: (type, data) => { pi.appendEntry(type, data); },
|
|
628
|
+
executionHistory,
|
|
629
|
+
});
|
|
630
|
+
const {
|
|
631
|
+
currentBudget, closeTurnActiveTime, resetTaskWindow,
|
|
632
|
+
hubAuditIdentity, hubLocationSuffix, taskResetSnapshot,
|
|
633
|
+
appendTaskResetEntry, updateModeStatus, ensureTaskTier,
|
|
634
|
+
} = budgetCtx;
|
|
635
|
+
taskIdentityReset = createReservedTaskIdentityReset(noProgress);
|
|
636
|
+
|
|
637
|
+
// ── Verification Contract: assertion ledger (advisory) ──
|
|
638
|
+
// Mutable ownership remains here; the extracted runtime receives explicit ports.
|
|
639
|
+
let assertions: Assertion[] = [];
|
|
640
|
+
const assertionsArtifactsCtx = createAssertionsArtifactsContext({
|
|
641
|
+
getAssertions: () => assertions,
|
|
642
|
+
getSessionDir: () => sessionDir,
|
|
643
|
+
getRunHistoryKeep: () => runHistoryKeep,
|
|
644
|
+
setStatus: (key, value) => { widgetCtx?.ui?.setStatus(key, value); },
|
|
645
|
+
});
|
|
646
|
+
const {
|
|
647
|
+
persistAssertions, assertionStatusLine, renderAssertionLedgerLines, renderAssertionLedgerText,
|
|
648
|
+
updateAssertionStatus, artifactsRoot, ensureArtifactsLayout, archivePreviousRun,
|
|
649
|
+
loadInputArtifacts, appendInputArtifacts, writeRunArtifact, evidencePathExists,
|
|
650
|
+
listArtifactFiles, renderArtifactIndexText, appendMachineHandoffSections,
|
|
651
|
+
} = assertionsArtifactsCtx;
|
|
652
|
+
|
|
653
|
+
const modelPolicy = createModelPolicy<AgentDef>({
|
|
654
|
+
getAllDefs: () => allAgentDefs,
|
|
655
|
+
getActiveDef: name => agentStates.get(name)?.def,
|
|
656
|
+
getResearchDefs: () => researchPersonas,
|
|
657
|
+
refreshUi: () => updateWidget(),
|
|
658
|
+
});
|
|
659
|
+
const {
|
|
660
|
+
allowedModels, substitutedModel, resolvedModel, resolvedSubagentModel,
|
|
661
|
+
resolvedThinking, switchablePersonaDef, allKnownModels,
|
|
662
|
+
} = modelPolicy;
|
|
663
|
+
|
|
664
|
+
let profileCommandContext: any;
|
|
665
|
+
const profileActivation = createProfileActivation({
|
|
666
|
+
busy: () => !profileCommandContext?.isIdle?.() || profileWorkInFlight()>0 ||
|
|
667
|
+
Array.from(agentStates.values()).some(state=>state.status==='running') ||
|
|
668
|
+
Array.from(researchStates.values()).some(state=>state.status==='running'),
|
|
669
|
+
defs: () => allAgentDefs,
|
|
670
|
+
available: async () => {
|
|
671
|
+
await profileCommandContext.modelRegistry.refresh?.();
|
|
672
|
+
return (profileCommandContext.modelRegistry.getAvailable?.()??[]).map((m:any)=>`${m.provider}/${m.id}`);
|
|
673
|
+
},
|
|
674
|
+
dispatcher: () => profileCommandContext?.model ? {model:`${profileCommandContext.model.provider}/${profileCommandContext.model.id}`,thinking:pi.getThinkingLevel()} : undefined,
|
|
675
|
+
setDispatcher: async selection => {
|
|
676
|
+
const slash=selection.model.indexOf('/');
|
|
677
|
+
const model=profileCommandContext.modelRegistry.find(selection.model.slice(0,slash),selection.model.slice(slash+1));
|
|
678
|
+
if(!model || !await pi.setModel(model)) return false;
|
|
679
|
+
if(selection.thinking) pi.setThinkingLevel(selection.thinking as any);
|
|
680
|
+
return true;
|
|
681
|
+
},
|
|
682
|
+
apply: profile => modelPolicy.applyProfile(profile),
|
|
683
|
+
});
|
|
684
|
+
pi.on('model_select', async (event,ctx) => {
|
|
685
|
+
contextWindow=event.model.contextWindow||0;
|
|
686
|
+
if(profileActivation.switching()) return;
|
|
687
|
+
const active=readActiveProfile();if(!active || !hasExplicitDispatcher(active.profile)) return;
|
|
688
|
+
try { assertProfileModel(`${event.model.provider}/${event.model.id}`,active); }
|
|
689
|
+
catch(error) {
|
|
690
|
+
ctx.abort();ctx.ui.notify(String(error),'error');
|
|
691
|
+
if(hasExplicitDispatcher(active.profile)) {
|
|
692
|
+
const target=dispatcherSelection(active.profile).model, slash=target.indexOf('/');
|
|
693
|
+
const model=ctx.modelRegistry.find(target.slice(0,slash),target.slice(slash+1));
|
|
694
|
+
if(model) await pi.setModel(model);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
pi.on('before_provider_request', async (_event,ctx) => {
|
|
699
|
+
const active=readActiveProfile();
|
|
700
|
+
if(!ctx.model || !active || !hasExplicitDispatcher(active.profile)) return;
|
|
701
|
+
try { assertProfileModel(`${ctx.model.provider}/${ctx.model.id}`,active); }
|
|
702
|
+
catch(error) {ctx.abort();ctx.ui.notify(String(error),'error');}
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
function appendDeclaredScope(task: string, scopeGlobs: string[]): string {
|
|
706
|
+
if (!scopeGlobs || scopeGlobs.length === 0) return task;
|
|
707
|
+
return task + `\n\n## Declared scope — advisory guardrail\nStay within these paths/globs when changing files; changes outside them will be flagged to the dispatcher for a human decision, not auto-reverted.\n${scopeGlobs.map(s => `- ${s}`).join("\n")}`;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
function loadAgents(cwd: string): void {
|
|
711
|
+
if (sessionDir) closeEvidenceSession(sessionDir);
|
|
712
|
+
loadAgentConfiguration(cwd, {
|
|
713
|
+
setSessionDir: hubStateCtx.setSessionDir, getSessionDir: hubStateCtx.getSessionDir,
|
|
714
|
+
archivePreviousRun, ensureArtifactsLayout, resetAssertions: () => { assertions = []; },
|
|
715
|
+
setAgentDefs: value => { allAgentDefs = value; }, setTeams: value => { teams = value; },
|
|
716
|
+
setModelProfiles: value => { modelProfiles = value; }, setModelProfileErrors: errors => { modelProfileErrors=errors; }, setDispatchPolicy: value => { dispatchPolicy = value; },
|
|
717
|
+
setDispatchPolicyWarnings: value => { dispatchPolicyWarnings = value; },
|
|
718
|
+
});
|
|
719
|
+
pruneEvidenceSessions(sessionDir, runHistoryKeep);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
const agentStateFactory = createAgentStateFactory(() => sessionDir);
|
|
723
|
+
const { sessionHealthIo, adoptableSessionFile, freshAgentState } = agentStateFactory;
|
|
724
|
+
|
|
725
|
+
// Auto-size grid columns based on team size
|
|
726
|
+
function recomputeGrid() {
|
|
727
|
+
gridCols = gridColumnsForSize(agentStates.size);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
const rosterPolicy = createRosterPolicy<AgentDef, AgentState>({
|
|
731
|
+
getTeams: () => teams, getAllDefs: () => allAgentDefs, getStates: () => agentStates,
|
|
732
|
+
getActiveTeamName: () => activeTeamName, setActiveTeamName: value => { activeTeamName = value; },
|
|
733
|
+
clearBackendNotices: () => comsMissNotified.clear(), createFreshState: freshAgentState,
|
|
734
|
+
adoptSession: adoptableSessionFile,
|
|
735
|
+
quarantineSession: agentStateFactory.quarantine,
|
|
736
|
+
persist: team => pi.appendEntry(NATIVE_ROSTER_ENTRY_TYPE, persistedNativeRosterState(team)),
|
|
737
|
+
recompute: recomputeGrid, refreshUi: () => updateWidget(), displayName,
|
|
738
|
+
orchestratorNeedsRosterAfterDrop: size => orchestratorNeedsRoster(getWorkMode(), size),
|
|
739
|
+
});
|
|
740
|
+
const { activateTeam, persistActiveRoster, add: rosterAdd, drop: rosterDrop } = rosterPolicy;
|
|
741
|
+
|
|
742
|
+
// ── Shared model presentation ─────────────────
|
|
743
|
+
// These formatters serve the extracted grid and the remaining composition-root
|
|
744
|
+
// call sites. Keep one implementation so cards, fleet rows, menus, fallback
|
|
745
|
+
// notices, and the footer retain the same presentation semantics.
|
|
746
|
+
function shortModel(model: string | undefined): string {
|
|
747
|
+
return model ? model.split("/").pop()! : "default";
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// A " (code)" thinking badge for display, or "" when the level is off.
|
|
751
|
+
function thinkingSuffix(rawThinking: string | undefined): string {
|
|
752
|
+
const code = abbrevThinking(resolveThinkingLevel(rawThinking));
|
|
753
|
+
return code ? ` (${code})` : "";
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
// The model + thinking badge a persona would dispatch with: "gpt-5.5 (xh)".
|
|
757
|
+
function modelWithThinking(def: AgentDef): string {
|
|
758
|
+
return shortModel(resolvedModel(def)) + thinkingSuffix(resolvedThinking(def));
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// ── Shared fleet source + below-editor widget ───────────────────────────
|
|
762
|
+
const fleetSource = createFleetSource({
|
|
763
|
+
getAgents: () => agentStates,
|
|
764
|
+
getResearch: () => researchStates,
|
|
765
|
+
getPeerInputs: format => fleetPeerInputs(format),
|
|
766
|
+
getPeerCards: () => peerCards,
|
|
767
|
+
getPendingReplies: () => pendingReplies.values(),
|
|
768
|
+
displayName,
|
|
769
|
+
modelForAgent: state => state.lastBackend === "coms" ? shortModel(state.comsPeerModel) : modelWithThinking(state.def),
|
|
770
|
+
modelForResearch: state => shortModel(state.model) + thinkingSuffix(resolvedThinking(state.def)),
|
|
771
|
+
modelForPeer: abbreviateModel,
|
|
772
|
+
getSystem1: () => watchdogActivity?.live() ?? null,
|
|
773
|
+
getTaskTriage: () => {
|
|
774
|
+
if (!taskTriageConfigured && !processState.additions?.length) return null;
|
|
775
|
+
try { return { ...taskTriageMetadata(), process: { schema: processState.schema, ...evaluateProcessObligations(processState, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }) } }; }
|
|
776
|
+
catch { return { ...taskTriageMetadata(), process: { schema: "invalid" } }; }
|
|
777
|
+
},
|
|
778
|
+
getProactive: () => proactiveRuntime ? { records: proactiveRuntime.records, history: proactiveRuntime.findings.history, current: proactiveRuntime.findings.current, activity: proactiveRuntime.activity.live() } : null,
|
|
779
|
+
});
|
|
780
|
+
let fleetActions: ReturnType<typeof createFleetActions<AgentState, ResearchState>> | null = null;
|
|
781
|
+
let fleetUiGeneration = 0;
|
|
782
|
+
const gridUI = createGridUI({
|
|
783
|
+
getWidgetContext: () => widgetCtx,
|
|
784
|
+
getRows: now => fleetSource.rows(now, { showFinished: true }),
|
|
785
|
+
getSnapshot: now => { const source = fleetSource.snapshot(now); return { rows: buildFleetRows(source, { showFinished: true }), proactive: source.proactive }; },
|
|
786
|
+
handleIntent: async intent => {
|
|
787
|
+
if (!fleetActions || !widgetCtx) return;
|
|
788
|
+
if (intent.type === "system1") { await gridUI.withSuspended(() => openSystem1Communication(widgetCtx!, communicationStore)); return; }
|
|
789
|
+
if (intent.type === "open") await gridUI.withSuspended(() => fleetActions!.open(intent.key, intent.runToken, widgetCtx!));
|
|
790
|
+
else await fleetActions.execute(intent.type, intent.key, intent.runToken, widgetCtx);
|
|
791
|
+
},
|
|
792
|
+
});
|
|
793
|
+
const { updateWidget } = gridUI;
|
|
794
|
+
refreshFleetUi = updateWidget;
|
|
795
|
+
|
|
796
|
+
// ── Delegation observability ─────────────────
|
|
797
|
+
const dispatchObservability = createDispatchObservability({
|
|
798
|
+
getSessionDir: () => sessionDir,
|
|
799
|
+
getDelegatedTokens: () => delegatedTokens,
|
|
800
|
+
setDelegatedTokens: value => { delegatedTokens = value; },
|
|
801
|
+
getWidgetContext: () => widgetCtx,
|
|
802
|
+
executionHistory,
|
|
803
|
+
displayName,
|
|
804
|
+
safeAgentKey,
|
|
805
|
+
safePathWithin,
|
|
806
|
+
createTranscriptStore: createFleetTranscriptStore,
|
|
807
|
+
appendTimelineText,
|
|
808
|
+
appendTimelineEvent,
|
|
809
|
+
updateWidget,
|
|
810
|
+
});
|
|
811
|
+
const { startDelegationWatch } = dispatchObservability;
|
|
812
|
+
|
|
813
|
+
// ── Dispatch Agent (returns Promise) ─────────
|
|
814
|
+
|
|
815
|
+
// ── Extracted coms dispatch, drift judge, and return extraction ──
|
|
816
|
+
const dispatchComs = createDispatchComs({
|
|
817
|
+
getIdentity: () => identity,
|
|
818
|
+
resolveTarget: target => coms.resolveTarget(target),
|
|
819
|
+
send: (params, auditExtra) => coms.send(params, auditExtra),
|
|
820
|
+
getPendingReply: msgId => pendingReplies.get(msgId),
|
|
821
|
+
deletePendingReply: msgId => { pendingReplies.delete(msgId); },
|
|
822
|
+
getSessionDir: () => sessionDir,
|
|
823
|
+
getWatchdogJudgeModel: () => watchdogJudgeModel,
|
|
824
|
+
getResearcherModel: () => {
|
|
825
|
+
const researcherDef = allAgentDefs.find(def => def.name.toLowerCase() === "researcher");
|
|
826
|
+
return researcherDef ? resolvedModel(researcherDef) ?? null : null;
|
|
827
|
+
},
|
|
828
|
+
displayName,
|
|
829
|
+
safeAgentKey,
|
|
830
|
+
safePathWithin,
|
|
831
|
+
appendInputArtifacts,
|
|
832
|
+
appendDeclaredScope,
|
|
833
|
+
buildRulesProtocol,
|
|
834
|
+
buildDocsProtocol,
|
|
835
|
+
updateWidget,
|
|
836
|
+
spawnPiAgent,
|
|
837
|
+
});
|
|
838
|
+
const { dispatchViaComs, runDriftJudge, runReturnExtraction } = dispatchComs;
|
|
839
|
+
registerOperatorWatchdog(pi, { setting: () => watchdogSetting, taskId: () => noProgress.taskId(), task: () => hubTaskText, runDriftJudge: (input, ctx) => runDriftJudge(input as unknown as DriftJudgeInput, ctx as ExtensionContext) });
|
|
840
|
+
|
|
841
|
+
const nativeDispatch = createDispatchNative({
|
|
842
|
+
traceNative: (owner, actor) => createNativeExecutionTrace(executionTrace, owner, actor),
|
|
843
|
+
prepareDamageGuard:input=>prepareDamageGuardNative(pi,input),
|
|
844
|
+
prepareDiscovery:input=>prepareDiscoveryNative(pi,input),
|
|
845
|
+
launchIdentity:()=>noProgress.taskToken(),
|
|
846
|
+
nativeAdmission:persona=>!processBlock()&&!provisionalCapabilityRefusal('fleet')&&!processPreEffectGate(processState,'child',persona),
|
|
847
|
+
getAgentState: key => agentStates.get(key),
|
|
848
|
+
getProcessState: () => processState,
|
|
849
|
+
listAgentStates: () => Array.from(agentStates.values()),
|
|
850
|
+
getSessionDir: () => sessionDir,
|
|
851
|
+
getDispatchPolicy: () => dispatchPolicy,
|
|
852
|
+
isComsReady: () => comsReady,
|
|
853
|
+
getIdentity: () => identity,
|
|
854
|
+
peersInScope: () => peersInScope(),
|
|
855
|
+
wasComsMissNotified: personaKey => comsMissNotified.has(personaKey),
|
|
856
|
+
markComsMissNotified: personaKey => { comsMissNotified.add(personaKey); },
|
|
857
|
+
startMonitorChild: (input, env) => {
|
|
858
|
+
const monitorStart = monitorTurnId;
|
|
859
|
+
return monitorStart ? monitorBridge?.startChild({ ...input, parentId: monitorStart }, env) : undefined;
|
|
860
|
+
},
|
|
861
|
+
finalizeMonitorChild: (task, output, status) => monitorBridge?.finalizeChildFor(task, output, status),
|
|
862
|
+
registerMonitorWaitOnly: (monitorKey, state) => monitorBridge?.registerWaitOnly(monitorKey, () => state.comsAbort?.()),
|
|
863
|
+
registerMonitorProcess: (task, proc) => monitorBridge?.registerOwnedProcessFor(task, proc),
|
|
864
|
+
appendMonitorOutput: (task, delta) => monitorBridge?.appendOutputFor(task, delta),
|
|
865
|
+
getContextWindow: () => contextWindow,
|
|
866
|
+
currentBudget,
|
|
867
|
+
bumpRecycle: () => { turnReport.recycles++; sessionTotals.recycles++; },
|
|
868
|
+
bumpDriftStop: () => { turnReport.driftStops++; sessionTotals.driftStops++; },
|
|
869
|
+
getSessionHealthIo: () => sessionHealthIo,
|
|
870
|
+
getSafetyHarnessPath: () => safetyHarnessPath,
|
|
871
|
+
getDelegateExtensionPath: () => delegateExtPath,
|
|
872
|
+
getReconSearchTimeoutMs: () => reconSearchTimeoutMs,
|
|
873
|
+
getProjectDocsPaths: () => projectDocsPaths,
|
|
874
|
+
getUserLanguage: () => userLanguage,
|
|
875
|
+
getWatchdogSetting: () => watchdogSetting,
|
|
876
|
+
getWatchdogAgentOverride: key => watchdogAgentOverrides.get(key),
|
|
877
|
+
getWatchdogSystem1: () => watchdogSystem1,
|
|
878
|
+
getWatchdogActivity: () => watchdogActivity,
|
|
879
|
+
getProactiveRuntime: () => proactiveRuntime,
|
|
880
|
+
getProactiveConfig: () => proactiveConfig,
|
|
881
|
+
getProactiveCapture: () => proactiveRuntime ? hubCapture : null,
|
|
882
|
+
getPolicyRoots: () => sessionOverrides?.policyRoots,
|
|
883
|
+
getWorkMode: () => getWorkMode(),
|
|
884
|
+
providerSemaphore,
|
|
885
|
+
executionHistory,
|
|
886
|
+
displayName,
|
|
887
|
+
shortModel: model => shortModel(model),
|
|
888
|
+
resolvedModel,
|
|
889
|
+
resolvedThinking,
|
|
890
|
+
resolveThinkingLevel,
|
|
891
|
+
resolvedSubagentModel,
|
|
892
|
+
substitutedModel,
|
|
893
|
+
modelWindowLookup,
|
|
894
|
+
specialistProjectPolicyPaths,
|
|
895
|
+
guardrailEnv,
|
|
896
|
+
appendInputArtifacts,
|
|
897
|
+
appendDeclaredScope,
|
|
898
|
+
flushTimelineStore,
|
|
899
|
+
appendTimelineText,
|
|
900
|
+
appendTimelineEvent,
|
|
901
|
+
createTranscriptStore: createFleetTranscriptStore,
|
|
902
|
+
updateWidget,
|
|
903
|
+
startDelegationWatch,
|
|
904
|
+
dispatchViaComs,
|
|
905
|
+
runDriftJudge,
|
|
906
|
+
notifyProviderQueue,
|
|
907
|
+
spawnPiAgentWithModelFallback,
|
|
908
|
+
});
|
|
909
|
+
const { dispatchAgent } = nativeDispatch;
|
|
910
|
+
|
|
911
|
+
// Shared child guardrail environment. Dispatch-native and research use the
|
|
912
|
+
// same root-owned exemptions and coms escalation endpoint.
|
|
913
|
+
function guardrailEnv(agentId: string): Record<string, string> {
|
|
914
|
+
const epoch=crypto.randomUUID();accessEpochs.set(agentId,epoch);
|
|
915
|
+
const env: Record<string, string> = { [AGENT_ID_ENV]: agentId,AGENT_HUB_ACCESS_EPOCH:epoch };
|
|
916
|
+
if (sessionOverrides?.policyRoots) env[FILESYSTEM_POLICY_ROOTS_ENV]=JSON.stringify(sessionOverrides.policyRoots);
|
|
917
|
+
if (exemptionsFile) env[EXEMPTIONS_FILE_ENV] = exemptionsFile;
|
|
918
|
+
if (comsReady && identity) env[ASK_ENDPOINT_ENV] = identity.endpoint;
|
|
919
|
+
return env;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// ── Research helper runtime ────────────────────
|
|
923
|
+
// The composition root owns the mutable bindings; the runtime reaches them only
|
|
924
|
+
// through these explicit ports so later controls can keep stable handles.
|
|
925
|
+
const researchRuntime = createResearchRuntime<AgentDef>({
|
|
926
|
+
prepareDamageGuard:input=>prepareDamageGuardNative(pi,input),
|
|
927
|
+
prepareDiscovery:input=>prepareDiscoveryNative(pi,input),
|
|
928
|
+
launchIdentity:()=>noProgress.taskToken(),
|
|
929
|
+
researchAdmission:()=>!processBlock(),
|
|
930
|
+
getResearchStates: () => researchStates,
|
|
931
|
+
setResearchStates: value => { researchStates = value; },
|
|
932
|
+
getNextResearchId: () => nextResearchId,
|
|
933
|
+
setNextResearchId: value => { nextResearchId = value; },
|
|
934
|
+
hubState: hubStateCtx, budget: budgetCtx, artifacts: assertionsArtifactsCtx,
|
|
935
|
+
executionHistory, providerSemaphore,
|
|
936
|
+
getSafetyHarnessPath: () => safetyHarnessPath,
|
|
937
|
+
getReconSearchTimeoutMs: () => reconSearchTimeoutMs,
|
|
938
|
+
getContextWindow: () => contextWindow,
|
|
939
|
+
resolvedModel, resolvedThinking, resolveThinkingLevel, fallbackModelFor, substitutedModel,
|
|
940
|
+
modelWindowLookup, guardrailEnv, notifyProviderQueue, spawnPiAgentWithModelFallback,
|
|
941
|
+
getProjectPolicyPaths: specialistProjectPolicyPaths,
|
|
942
|
+
getProjectDocsPaths: () => projectDocsPaths,
|
|
943
|
+
nativeResearchSystemPrompt, requireSafetyHarness, shortModel, displayName,
|
|
944
|
+
flushTimelineStore, appendTimelineText, appendTimelineEvent,
|
|
945
|
+
createTranscriptStore: createFleetTranscriptStore,
|
|
946
|
+
onElapsed: () => updateWidget(),
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
// ── Embedded coms: shared registry, transport, and pool core ──
|
|
950
|
+
const peersInScope = () => coms.peersInScope();
|
|
951
|
+
const resolveTarget = (target: string) => coms.resolveTarget(target);
|
|
952
|
+
|
|
953
|
+
const poolPresentation = createPoolPresentation({
|
|
954
|
+
getIdentity: () => identity,
|
|
955
|
+
getDisplayProject: () => coms.scope.displayProject,
|
|
956
|
+
includeExplicitPeers: () => coms.scope.includeExplicit,
|
|
957
|
+
getPeerCards: () => peerCards,
|
|
958
|
+
readProjectEntries: readAllRegistryEntries,
|
|
959
|
+
readAllEntries: readAllRegistryEntriesAcrossProjects,
|
|
960
|
+
truncate: truncateToWidth,
|
|
961
|
+
});
|
|
962
|
+
const fleetPeerInputs = poolPresentation.peerInputs;
|
|
963
|
+
|
|
964
|
+
// ── Extracted tool execution wiring ──
|
|
965
|
+
// Mutable fleet state remains composition-owned; executor modules receive ports.
|
|
966
|
+
let herdrFleetReady = false;
|
|
967
|
+
const hubSpawnedPeers = new Map<string, { name: string; paneId: string | null; addressed: boolean }>();
|
|
968
|
+
const markPeerAddressed = (name: string) => {
|
|
969
|
+
const entry = hubSpawnedPeers.get(String(name || "").toLowerCase());
|
|
970
|
+
if (entry) entry.addressed = true;
|
|
971
|
+
};
|
|
972
|
+
let lastHubPiSpawnAt: number | null = null;
|
|
973
|
+
|
|
974
|
+
let askUserAvailable = false;
|
|
975
|
+
let baselineTools: string[] = [];
|
|
976
|
+
let contextPressureState: ContextPressureState = createContextPressureState();
|
|
977
|
+
const pressureRootState = createContextPressureRootState();
|
|
978
|
+
|
|
979
|
+
function pendingCapabilityOperations(): PendingOperation[] {
|
|
980
|
+
const pending: PendingOperation[] = [];
|
|
981
|
+
if (pendingTaskTransition) pending.push({ pack: "fleet", kind: "task-transition" });
|
|
982
|
+
if (processOpenObligations(processState, undefined, privateProofUse()).some(stage => stage === "plan" || stage === "review")) pending.push({ pack: "fleet", kind: "process-stage" });
|
|
983
|
+
if (Array.from(agentStates.values()).some(state => state.status === "running") || Array.from(researchStates.values()).some(state => state.status === "running")) pending.push({ pack: "fleet", kind: "child" });
|
|
984
|
+
if (pendingReplies.size > 0 || pendingHandoff) pending.push({ pack: "peer", kind: "message" });
|
|
985
|
+
if (hubSpawnedPeers.size > 0) pending.push({ pack: "workspace", kind: "pane" });
|
|
986
|
+
return pending;
|
|
987
|
+
}
|
|
988
|
+
function recordToolCatalogChange(change: { fromMode: WorkMode; toMode: WorkMode; previous: readonly string[]; next: readonly string[]; reason: "refresh" | "mode_switch" }): void {
|
|
989
|
+
const { snapshot, delta } = toolCatalogRuntime.reconcile(change);
|
|
990
|
+
latestToolCatalogDelta = delta;
|
|
991
|
+
unknownToolCounter.noteCatalogChange(delta.catalogVersion);
|
|
992
|
+
const evidenceRef = `session-entry:${TOOL_CATALOG_ENTRY_TYPE}:${delta.catalogVersion}`;
|
|
993
|
+
let persisted = false;
|
|
994
|
+
try { persisted = toolCatalogRuntime.persist({ snapshot, delta }, (type, data) => pi.appendEntry(type, data), change.reason); } catch {}
|
|
995
|
+
if (persisted && delta.evidence.changed) noProgress.establishToolStateChange(delta.evidence.previousCatalogVersion, delta.evidence.catalogVersion, evidenceRef);
|
|
996
|
+
}
|
|
997
|
+
function capabilityContextState(): ContextState {
|
|
998
|
+
return pressureCapabilityState(contextPressureState, currentCtx?.getContextUsage?.()?.percent);
|
|
999
|
+
}
|
|
1000
|
+
const workModePolicy = createWorkModePolicy({
|
|
1001
|
+
getBaselineTools: () => baselineTools, getRosterSize: () => agentStates.size,
|
|
1002
|
+
getDeterministicToolsEnabled: () => resolveAssist(readActiveProfile()?.profile.assist)['deterministic-tools'],
|
|
1003
|
+
getAgenticAskEnabled: () => agenticHubEnabled(pi),
|
|
1004
|
+
getFileDiscoveryEnabled: () => discoveryHubEnabled(pi),
|
|
1005
|
+
getDispatchTriageEnabled: () => triageRuntime?.available === true,
|
|
1006
|
+
activateFallbackRoster: ctx => {
|
|
1007
|
+
if (!rosterPolicy.activateFirstValidTeam()) return;
|
|
1008
|
+
workModePolicy.clearRosterRecovery();
|
|
1009
|
+
persistActiveRoster();
|
|
1010
|
+
setTimeout(replayDeferredRecoveryInputs, 0);
|
|
1011
|
+
updateWidget();
|
|
1012
|
+
ctx.ui.setStatus("agent-team", `Team: ${activeTeamName} (${agentStates.size})`);
|
|
1013
|
+
},
|
|
1014
|
+
getActiveTeamName: () => activeTeamName, getComsReady: () => comsReady,
|
|
1015
|
+
getHerdrReady: () => herdrFleetReady, getAskUserAvailable: () => askUserAvailable,
|
|
1016
|
+
getIdentityLabel: () => identity ? `${identity.name}@${identity.project}` : null,
|
|
1017
|
+
getTaskTier: () => taskTier, getPendingOperations: pendingCapabilityOperations,
|
|
1018
|
+
getContextState: capabilityContextState, getActiveTools: () => pi.getActiveTools(), setActiveTools: tools => pi.setActiveTools(tools),
|
|
1019
|
+
recordToolCatalog: recordToolCatalogChange,
|
|
1020
|
+
persist: (type, data) => pi.appendEntry(type, data), replayDeferredInputs: replayDeferredRecoveryInputs,
|
|
1021
|
+
watchdogArmed: mode => resolveWatchdogActive(undefined, undefined, watchdogSetting, mode),
|
|
1022
|
+
});
|
|
1023
|
+
const {
|
|
1024
|
+
getWorkMode, getCapabilityResolution, resolveIncomingCapabilities, provisionalCapabilityRefusal,
|
|
1025
|
+
applyWorkModeTools, modelWorkBlockedByRosterRecovery,
|
|
1026
|
+
statusText: workModeStatusText, applySelection: applyWorkModeSelection, openPicker: openWorkModePicker,
|
|
1027
|
+
} = workModePolicy;
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
const toolCtx: ToolContext = createToolExecutionOrchestration({
|
|
1031
|
+
dispatch: {
|
|
1032
|
+
state: {
|
|
1033
|
+
getAcceptedUserInput: () => hubTaskText,
|
|
1034
|
+
getTurnDispatchCount: () => turnDispatchCount, setTurnDispatchCount: value => { turnDispatchCount = value; },
|
|
1035
|
+
getTurnResearchCount: () => turnResearchCount, setTurnResearchCount: value => { turnResearchCount = value; },
|
|
1036
|
+
getTaskDispatchCount: () => taskDispatchCount, setTaskDispatchCount: value => { taskDispatchCount = value; },
|
|
1037
|
+
getTaskResearchCount: () => taskResearchCount, setTaskResearchCount: value => { taskResearchCount = value; },
|
|
1038
|
+
getTaskReviewRounds: () => taskReviewRounds, setTaskReviewRounds: value => { taskReviewRounds = value; },
|
|
1039
|
+
getTaskTier: () => taskTier, getTurnReport: () => turnReport, getSessionTotals: () => sessionTotals,
|
|
1040
|
+
getProcessState: () => processState, setProcessState: value => { processState = value; }, persistProcessVerdict, processBlock,
|
|
1041
|
+
getTurnDispatchFingerprints: () => turnDispatchFingerprints,
|
|
1042
|
+
getExternalBlockers: () => externalBlockers,
|
|
1043
|
+
getExternalBlockerAcknowledged: () => externalBlockerAcknowledged, setExternalBlockerAcknowledged: value => { externalBlockerAcknowledged = value; },
|
|
1044
|
+
getExternalBlockerRefusedOnce: () => externalBlockerRefusedOnce, setExternalBlockerRefusedOnce: value => { externalBlockerRefusedOnce = value; },
|
|
1045
|
+
isAskUserAvailable: () => askUserAvailable, getUserLanguage: () => userLanguage, getSessionDir: () => sessionDir,
|
|
1046
|
+
getAgentStates: () => agentStates as any, getAssertions: () => assertions, getResearchPersonas: () => researchPersonas,
|
|
1047
|
+
getActiveWritableDispatches: () => activeWritableDispatches, setActiveWritableDispatches: value => { activeWritableDispatches = value; },
|
|
1048
|
+
getWritableOverlapCounter: () => writableOverlapCounter, setWritableOverlapCounter: value => { writableOverlapCounter = value; },
|
|
1049
|
+
},
|
|
1050
|
+
budget: budgetCtx, noProgress, artifacts: assertionsArtifactsCtx, research: researchRuntime,
|
|
1051
|
+
provisionalCapabilityRefusal, dispatchAgent, runReturnExtraction,
|
|
1052
|
+
returnExtractionAssist: () => resolveAssist(readActiveProfile()?.profile.assist)['return-extraction'],
|
|
1053
|
+
extractNeedsResearch, extractAskUserQuestions, contextPressure: percent => percent >= CONTEXT_WARN_THRESHOLD, displayName,
|
|
1054
|
+
resolvedAgentModel: (def, ctx) => resolvedModel(def as AgentDef) ?? (ctx.model ? `${ctx.model.provider}/${ctx.model.id}` : undefined),
|
|
1055
|
+
getToolCatalogVersion: () => toolCatalogRuntime.catalogForMessage().catalogVersion,
|
|
1056
|
+
},
|
|
1057
|
+
actions: {
|
|
1058
|
+
budget: budgetCtx, artifacts: assertionsArtifactsCtx, hubState: hubStateCtx,
|
|
1059
|
+
getAcceptedUserInput: () => hubTaskText,
|
|
1060
|
+
provisionalCapabilityRefusal,
|
|
1061
|
+
getTaskTier: () => taskTier, setTaskTier: value => { taskTier = value; },
|
|
1062
|
+
getTaskTierAssumed: () => taskTierAssumed, setTaskTierAssumed: value => { taskTierAssumed = value; },
|
|
1063
|
+
getProcessState: () => processState, setProcessState: value => { processState = value; },
|
|
1064
|
+
processBlock, adoptTaskTriage: async (id, newTask, expandedScope) => {
|
|
1065
|
+
if (processPersistenceBlocked) throw new Error("corrupt process state");
|
|
1066
|
+
const next = await adoptTaskTriageState({ runtime: taskTriage, taskId: id, newTask,
|
|
1067
|
+
expandedScope, pendingTransition: pendingTaskTransition, state: processState,
|
|
1068
|
+
persist: state => pi.appendEntry("agent-hub-process-state", processAuditRecord(state, evaluateProcessObligations(state, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER }))),
|
|
1069
|
+
onPostCommitFailure: () => { processPersistenceBlocked = true; },
|
|
1070
|
+
});
|
|
1071
|
+
pendingTaskTransition = false;
|
|
1072
|
+
transitionDiversions = 0;
|
|
1073
|
+
transitionHintDelivered = false;
|
|
1074
|
+
transitionBatchRefused = false;
|
|
1075
|
+
try { pi.appendEntry(TASK_TRANSITION_ENTRY_TYPE, { pending: false }); } catch { processPersistenceBlocked = true; }
|
|
1076
|
+
return next;
|
|
1077
|
+
},
|
|
1078
|
+
persistProcessState: value => persistProcessVerdict(value, evaluateProcessObligations(value, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() })),
|
|
1079
|
+
getTaskDispatchCount: () => taskDispatchCount, getTaskResearchCount: () => taskResearchCount,
|
|
1080
|
+
getTurnReport: () => turnReport, getAssertions: () => assertions, setAssertions: value => { assertions = value; },
|
|
1081
|
+
currentTaskId: () => noProgress.taskId(), currentRevision: ctx => worktreeRevision(ctx.cwd || process.cwd(), []),
|
|
1082
|
+
privateProofUse: ctx => privateProofUse(ctx.cwd || process.cwd()),
|
|
1083
|
+
adoptReservedTaskId: (id, resetTaskWindow) => { taskIdentityReset.run(id, resetTaskWindow); bindSemanticScope(id, hubTaskText ? createHash("sha256").update(hubTaskText).digest("hex") : ""); },
|
|
1084
|
+
confirmTaskSupersession: (input, ctx, signal) => confirmTaskSupersession(input, ctx, { language: () => userLanguage, currentTaskId: () => noProgress.taskId(), ask: (id, params, askCtx, askSignal) => requestRuntimeAsk(pi.events, id, params, askCtx, askSignal), startWait: id => executionHistory.startAskUser(id), endWait: (id, sameTask) => { const wait = executionHistory.endAskUser(id, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); } }, signal),
|
|
1085
|
+
getAgentStates: () => agentStates, rosterAdd, rosterDrop,
|
|
1086
|
+
getIdentity: () => identity, getComs: () => coms, resolveTarget,
|
|
1087
|
+
appendMachineHandoffSections, markPeerAddressed,
|
|
1088
|
+
},
|
|
1089
|
+
herdr: {
|
|
1090
|
+
getProcessState: () => processState, processBlock,
|
|
1091
|
+
provisionalCapabilityRefusal, isFleetReady: () => herdrFleetReady, isComsReady: () => comsReady,
|
|
1092
|
+
getIdentity: () => identity, getCurrentContext: () => currentCtx, peersInScope,
|
|
1093
|
+
getComsPeerNames: () => peersInScope().map(peer => peer.name), herdr: herdrApi,
|
|
1094
|
+
readEnvFile: file => fs.readFileSync(file, "utf-8"), envFileExists: file => fs.existsSync(file),
|
|
1095
|
+
getLastPiSpawnAt: () => lastHubPiSpawnAt, setLastPiSpawnAt: value => { lastHubPiSpawnAt = value; },
|
|
1096
|
+
recordSpawnedPeer: (name, paneId) => { hubSpawnedPeers.set(name.toLowerCase(), { name, paneId, addressed: false }); },
|
|
1097
|
+
},
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1100
|
+
function triageInput(task: string, scope: string[], language: string, domain: string): TriageInput {
|
|
1101
|
+
const candidates = [...agentStates.values()].map(s => {
|
|
1102
|
+
const name = s.def.name.toLowerCase();
|
|
1103
|
+
const research = ["researcher", "deep-researcher", ...researchPersonas.map(p => p.name.toLowerCase())].includes(name);
|
|
1104
|
+
const gate = processBlock() ?? processPreEffectGate(processState, "child", name) ?? (processAllowsPersona(processState,name) ? null : checkTierPersonaGate(taskTier,name)) ?? checkDocsLane(name, scope, undefined);
|
|
1105
|
+
return { name, description: s.def.description, ...(research ? { excluded: "research_persona" } : s.status === "running" ? { excluded: "busy" } : gate ? { excluded: gate.reason } : {}) };
|
|
1106
|
+
});
|
|
1107
|
+
return { taskId: noProgress.taskId(), task, scope, language, domain, candidates, constraints: JSON.stringify({ tier: taskTier, process: { risk: processState.risk, scope: processState.scope }, externalBlocked: externalBlockers.length > 0 && !externalBlockerAcknowledged }), complete: !(externalBlockers.length > 0 && !externalBlockerAcknowledged) };
|
|
1108
|
+
}
|
|
1109
|
+
registerDamageGuardHub(pi);
|
|
1110
|
+
registerAgenticHub(pi);
|
|
1111
|
+
registerDiscoveryHub(pi);
|
|
1112
|
+
registerDispatchTriage(pi, { runtime: () => triageRuntime, input: triageInput, blocked: () => provisionalCapabilityRefusal("fleet") });
|
|
1113
|
+
|
|
1114
|
+
// Keep the extracted tool surface flat and greppable in this composition root.
|
|
1115
|
+
registerDispatchAgent(pi, toolCtx, { disposition: (id, persona, reason) => triageRuntime?.disposition(id, persona, reason) ?? false, submitted: (id, persona, status) => triageRuntime?.submitted(id, persona, status) });
|
|
1116
|
+
registerSpawnResearch(pi, toolCtx);
|
|
1117
|
+
registerRunFlow(pi, {
|
|
1118
|
+
sessionDir: () => sessionDir,
|
|
1119
|
+
taskId: () => noProgress.taskId(),
|
|
1120
|
+
processObligations: () => evaluateProcessObligations(processState, { writable: false, budgetTier: taskTier ?? DEFAULT_TASK_TIER }),
|
|
1121
|
+
effectiveScoutConfig: cwd => {
|
|
1122
|
+
const persona = resolveFlowPersona("researcher", cwd);
|
|
1123
|
+
const model = persona.model!;
|
|
1124
|
+
assertFlowProfileModel(model);
|
|
1125
|
+
return { model, profile: readActiveProfile()?.name ?? null, tools: persona.tools.split(",").map(value => value.trim()).filter(Boolean), fallback: persona.fallbackModel ?? null, allowlisted: true };
|
|
1126
|
+
},
|
|
1127
|
+
reserveBudget: async (_params, _ctx, signal) => {
|
|
1128
|
+
ensureTaskTier();
|
|
1129
|
+
if (signal?.aborted) return { charged: false, operation: "research", owner: "hub", refusal: "Flow cancelled before budget charge." };
|
|
1130
|
+
turnResearchCount++; taskResearchCount++; turnReport.research++; sessionTotals.research++; budgetCtx.updateModeStatus();
|
|
1131
|
+
return { charged: true, operation: "research", owner: "hub" };
|
|
1132
|
+
},
|
|
1133
|
+
});
|
|
1134
|
+
registerSetTaskTier(pi, toolCtx);
|
|
1135
|
+
registerTeamAdjust(pi, toolCtx);
|
|
1136
|
+
registerVerificationContract(pi, toolCtx);
|
|
1137
|
+
registerComsTools(pi, toolCtx);
|
|
1138
|
+
registerFleetTools(pi, toolCtx);
|
|
1139
|
+
registerFilesystemTool(pi, {
|
|
1140
|
+
enabled: () => resolveAssist(readActiveProfile()?.profile.assist)['deterministic-tools'],
|
|
1141
|
+
readOnly: () => getWorkMode() === "orchestrator",
|
|
1142
|
+
sessionDir: () => sessionDir,
|
|
1143
|
+
policyRoots: () => sessionOverrides?.policyRoots,
|
|
1144
|
+
managedReadbackAllowed: handle => discoveryManagedReadbackAllowed(pi,handle),
|
|
1145
|
+
remainingSelfReadBytes: () => Math.max(0, 64 * 1024 - orchestratorSelfReadUsed),
|
|
1146
|
+
noteSelfReadBytes: bytes => { orchestratorSelfReadUsed += bytes; },
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
const researchControls = createResearchControls({
|
|
1150
|
+
runtime: researchRuntime,
|
|
1151
|
+
refresh: () => {},
|
|
1152
|
+
getAgents: () => agentStates, displayName, modelWorkBlocked: modelWorkBlockedByRosterRecovery,
|
|
1153
|
+
cancelWait: (state, kind) => cancelLocalWaitOnly({ abort: state.comsAbort, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), event: { kind } }),
|
|
1154
|
+
cancelOwned: state => { fenceOperatorCancel(state); cancelLocalOwnedProcess({ process: state.proc, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), treeKill: killPiTree }); },
|
|
1155
|
+
restartSpecialist: async (state: AgentState, ctx) => {
|
|
1156
|
+
if (state.status === "running" && (state.proc || state.comsAbort)) {
|
|
1157
|
+
let resolveTermination!: () => void;
|
|
1158
|
+
const terminated = new Promise<void>(resolve => { resolveTermination = resolve; });
|
|
1159
|
+
state.onTerminate = resolveTermination;
|
|
1160
|
+
fenceOperatorCancel(state);
|
|
1161
|
+
if (state.proc) { state.killedByOperator = true; state.restarting = true; if (state.dispatchId) proactiveRuntime?.abort(safeAgentKey(state.def.name), state.dispatchId); killPiTree(state.proc); }
|
|
1162
|
+
else await cancelLocalWaitOnly({ abort: state.comsAbort, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), event: { kind: "restart" } });
|
|
1163
|
+
await terminated;
|
|
1164
|
+
}
|
|
1165
|
+
state.sessionFile = null;
|
|
1166
|
+
const result = await dispatchAgent(state.def.name, state.task, ctx);
|
|
1167
|
+
pi.sendMessage({ customType: "agent-restart-result", content: `[${displayName(state.def.name)}] restarted by operator and ${result.exitCode === 0 ? "completed" : "failed"} in ${Math.round(result.elapsed / 1000)}s.`, display: true }, { deliverAs: "followUp", triggerTurn: true });
|
|
1168
|
+
},
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
// ── ask_user Tool (dispatcher → human) ──
|
|
1172
|
+
//
|
|
1173
|
+
// We do NOT register `ask_user` here. The recommended companion package
|
|
1174
|
+
// `pi-ask-user` (see docs/pi-setup.md) owns that tool name with a richer
|
|
1175
|
+
// implementation. Registering our own conflicts regardless of load order:
|
|
1176
|
+
// - if we register first, pi-ask-user fails to load
|
|
1177
|
+
// - if pi-ask-user registers first, our registration fails
|
|
1178
|
+
// and pi has no synchronous probe at load time — `pi.getAllTools()` is
|
|
1179
|
+
// a runtime action method that throws when called from the factory.
|
|
1180
|
+
//
|
|
1181
|
+
// Instead, in `session_start` (where action methods ARE allowed) we check
|
|
1182
|
+
// `pi.getAllTools()`, gate `ask_user` into `setActiveTools` only if present,
|
|
1183
|
+
// and warn the user to `pi install npm:pi-ask-user` if it's missing.
|
|
1184
|
+
|
|
1185
|
+
|
|
1186
|
+
// ── Commands ─────────────────────────────────
|
|
1187
|
+
|
|
1188
|
+
// /af-config and Alt+, — read-only configuration screen (shared with coms peers via lib/fleet-config).
|
|
1189
|
+
const fleetConfigUi = createFleetConfigUi({
|
|
1190
|
+
readHubOverrides: cwd => parseAgentTeamOverrides(cwd),
|
|
1191
|
+
livePeerNames: () => identity ? readAllRegistryEntries(identity.project).map(entry => entry.name) : [],
|
|
1192
|
+
runtimeRows: () => [
|
|
1193
|
+
{ label: "Work mode", detail: workModeStatusText(), origin: "runtime" },
|
|
1194
|
+
{ label: "Active roster", detail: activeTeamName ? `${activeTeamName} (${agentStates.size} specialists)` : "(none)", origin: ".pi/agents/teams.yaml" },
|
|
1195
|
+
{ label: "Coms identity", detail: identity ? `${identity.name}@${identity.project}${comsReady ? "" : " · not ready"}` : "not connected", origin: "runtime" },
|
|
1196
|
+
{ label: "Node", detail: process.version, origin: "runtime" },
|
|
1197
|
+
{ label: "Related screens", detail: "/af-work-mode · /af-agents-team · /af-dispatch-policy · /af-context · /af-allowed · /af-coms", origin: "runtime" },
|
|
1198
|
+
],
|
|
1199
|
+
});
|
|
1200
|
+
const openFleetConfig = (ctx: ExtensionContext, args = "") => gridUI.withSuspended(() => fleetConfigUi.open(ctx, args));
|
|
1201
|
+
|
|
1202
|
+
const commandCtx: CommandContext = {
|
|
1203
|
+
setWidgetContext: ctx => { widgetCtx = ctx; },
|
|
1204
|
+
applyWorkModeSelection,
|
|
1205
|
+
getWorkModeStatusText: workModeStatusText,
|
|
1206
|
+
openWorkModePicker,
|
|
1207
|
+
handleTaskTriageRecover: () => {
|
|
1208
|
+
if (!processPersistenceBlocked) return false;
|
|
1209
|
+
try {
|
|
1210
|
+
const recovered = recoverTaskTriageProcessState({ state: processState, current: taskTriage?.current ? { taskId: taskTriage.current.taskId, evaluationId: taskTriage.current.evaluationId, inputRevision: taskTriage.current.revision, assessment: taskTriage.current.assessment } : null,
|
|
1211
|
+
taskId: noProgress.taskId(), budgetTier: taskTier ?? DEFAULT_TASK_TIER,
|
|
1212
|
+
append: record => pi.appendEntry("agent-hub-process-state", record),
|
|
1213
|
+
entries: () => currentCtx?.sessionManager.getEntries() ?? [],
|
|
1214
|
+
});
|
|
1215
|
+
processState = recovered;
|
|
1216
|
+
processPersistenceBlocked = false;
|
|
1217
|
+
resolveIncomingCapabilities(""); applyWorkModeTools();
|
|
1218
|
+
return true;
|
|
1219
|
+
} catch { return false; }
|
|
1220
|
+
},
|
|
1221
|
+
handleTaskTriageWaive: async (args, ctx) => {
|
|
1222
|
+
const [id, ...words] = args.trim().split(/\s+/);
|
|
1223
|
+
const addition = processState.additions?.find(a => a.id === id && a.status === "active" && a.taskId === noProgress.taskId());
|
|
1224
|
+
if (!addition || !words.length || processBlock()) return false;
|
|
1225
|
+
const next = await confirmTaskTriageWaiver(processState, { taskId: addition.taskId, evaluationId: addition.evaluationId, inputRevision: addition.inputRevision, additionId: id, reason: words.join(" ") }, {
|
|
1226
|
+
taskId: () => noProgress.taskId(), inputRevision: () => taskTriage?.current?.revision ?? "",
|
|
1227
|
+
ask: (nonce, question, askCtx, signal) => requestRuntimeAsk(pi.events, nonce, question, askCtx, signal, undefined, 'permission'),
|
|
1228
|
+
startWait: nonce => executionHistory.startAskUser(nonce), endWait: (nonce, sameTask) => { const wait = executionHistory.endAskUser(nonce, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
|
|
1229
|
+
persist: value => pi.appendEntry("agent-hub-process-state", processAuditRecord(value, evaluateProcessObligations(value, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }))),
|
|
1230
|
+
}, ctx);
|
|
1231
|
+
if (next) processState = next;
|
|
1232
|
+
return !!next;
|
|
1233
|
+
},
|
|
1234
|
+
handleAudit: async (ctx, args = "") => {
|
|
1235
|
+
const input = proactiveReportInput();
|
|
1236
|
+
await showSessionAudit(ctx, sessionDir, input && { ...input, labels: commandProactiveLabels(sessionDir, args) }, {
|
|
1237
|
+
...taskTriageMetadata(), activity: taskTriageActivity?.live(),
|
|
1238
|
+
}, executionTrace.snapshot());
|
|
1239
|
+
},
|
|
1240
|
+
handleRetry: async (args, ctx) => {
|
|
1241
|
+
const dispatchId = args?.trim();
|
|
1242
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(dispatchId)) { ctx.ui.notify("Usage: /af-retry <dispatchId>", "error"); return; }
|
|
1243
|
+
const op = noProgress.byDispatch(dispatchId), attempt = op?.attempts.find(a => a.dispatchId === dispatchId);
|
|
1244
|
+
if (!op || !attempt) { ctx.ui.notify("Unknown dispatch ID; no retry authorized.", "error"); return; }
|
|
1245
|
+
await commandCtx.handleRecover(`retry ${op.operationId} ${attempt.attemptId}`, ctx);
|
|
1246
|
+
},
|
|
1247
|
+
handleRecover: async (args, ctx) => {
|
|
1248
|
+
await runRecoverCommand(args, ctx, {
|
|
1249
|
+
noProgress,
|
|
1250
|
+
currentRevision: cwd => worktreeRevision(cwd, []),
|
|
1251
|
+
confirm: confirmRecoverAction,
|
|
1252
|
+
askPorts: (op, attempt, action) => ({
|
|
1253
|
+
taskId: () => noProgress.taskId(), language: () => userLanguage,
|
|
1254
|
+
ask: (id: string, params: any, askCtx: any, signal: AbortSignal) => requestRuntimeAsk(pi.events, id, params, askCtx, signal),
|
|
1255
|
+
startWait: (id: string) => executionHistory.startAskUser(id),
|
|
1256
|
+
endWait: (id: string, sameTask: boolean) => { const wait = executionHistory.endAskUser(id, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
|
|
1257
|
+
valid: () => { const current = noProgress.inspect(op.operationId); return current?.attempts.at(-1)?.attemptId === attempt.attemptId && (action === "abandon" ? !current.abandoned && noProgress.isIdle(op.executor) : noProgress.canAuthorize(op.operationId, attempt.attemptId)); },
|
|
1258
|
+
consume: (nonce: string) => action === "abandon" ? noProgress.abandon(op.operationId, attempt.attemptId, nonce) : attempt.category === "indeterminate" ? noProgress.authorizeIndeterminate(op.operationId, attempt.attemptId, nonce) : noProgress.authorize(attempt.dispatchId),
|
|
1259
|
+
}),
|
|
1260
|
+
});
|
|
1261
|
+
},
|
|
1262
|
+
|
|
1263
|
+
handleAgentsTeam: async (_args, ctx) => {
|
|
1264
|
+
widgetCtx = ctx;
|
|
1265
|
+
const teamNames = Object.keys(teams);
|
|
1266
|
+
if (teamNames.length === 0) {
|
|
1267
|
+
ctx.ui.notify("No teams defined in .pi/agents/teams.yaml", "warning");
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
const options = teamNames.map(name => {
|
|
1272
|
+
const members = teams[name].map(m => displayName(m));
|
|
1273
|
+
return `${name} — ${members.join(", ")}`;
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
const choice = await ctx.ui.select("Select Team", options);
|
|
1277
|
+
if (choice === undefined) return;
|
|
1278
|
+
|
|
1279
|
+
const idx = options.indexOf(choice);
|
|
1280
|
+
const name = teamNames[idx];
|
|
1281
|
+
const selected = resolveSessionRoster({
|
|
1282
|
+
teams,
|
|
1283
|
+
entries: [],
|
|
1284
|
+
explicitRoster: name,
|
|
1285
|
+
availablePersonas: allAgentDefs.map(def => def.name),
|
|
1286
|
+
});
|
|
1287
|
+
if (!selected.roster) {
|
|
1288
|
+
ctx.ui.notify(`${selected.diagnostic} Fix .pi/agents/teams.yaml or select another team.`, "error");
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
activateTeam(selected.roster.name);
|
|
1292
|
+
workModePolicy.clearRosterRecovery();
|
|
1293
|
+
persistActiveRoster();
|
|
1294
|
+
resolveIncomingCapabilities("");
|
|
1295
|
+
applyWorkModeTools();
|
|
1296
|
+
setTimeout(replayDeferredRecoveryInputs, 0);
|
|
1297
|
+
updateWidget();
|
|
1298
|
+
ctx.ui.setStatus("agent-team", `Team: ${name} (${agentStates.size})`);
|
|
1299
|
+
ctx.ui.notify(`Team: ${name} — ${Array.from(agentStates.values()).map(s => displayName(s.def.name)).join(", ")}`, "info");
|
|
1300
|
+
},
|
|
1301
|
+
handleAgentsList: async (_args, _ctx) => {
|
|
1302
|
+
widgetCtx = _ctx;
|
|
1303
|
+
await openFleetDashboard(_ctx);
|
|
1304
|
+
},
|
|
1305
|
+
handleAgentsHistory: async (_args, ctx) => {
|
|
1306
|
+
widgetCtx = ctx;
|
|
1307
|
+
await openHistory(ctx, executionHistory, () => (activeTeamName ? `Team: ${activeTeamName}` : "Agent Hub"));
|
|
1308
|
+
},
|
|
1309
|
+
handleAgentsAdd: async (args, ctx) => {
|
|
1310
|
+
widgetCtx = ctx;
|
|
1311
|
+
const names = (args || "").trim().split(/\s+/).filter(Boolean);
|
|
1312
|
+
if (names.length === 0) {
|
|
1313
|
+
const available = allAgentDefs
|
|
1314
|
+
.filter(d => !agentStates.has(d.name.toLowerCase()))
|
|
1315
|
+
.map(d => d.name).sort().join(", ") || "(all personas are already in the team)";
|
|
1316
|
+
ctx.ui.notify(`Usage: /af-agents-add <persona> [<persona>…]\nNot in the team yet: ${available}`, "info");
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
const results = names.map(n => rosterAdd(n));
|
|
1320
|
+
const level = results.some(r => r.ok) ? "info" : "error";
|
|
1321
|
+
ctx.ui.notify(results.map(r => r.message).join("\n"), level);
|
|
1322
|
+
ctx.ui.setStatus("agent-team", `Native roster: ${activeTeamName || "(none)"}* (${agentStates.size})`);
|
|
1323
|
+
},
|
|
1324
|
+
handleAgentsDrop: async (args, ctx) => {
|
|
1325
|
+
widgetCtx = ctx;
|
|
1326
|
+
const names = (args || "").trim().split(/\s+/).filter(Boolean);
|
|
1327
|
+
if (names.length === 0) {
|
|
1328
|
+
ctx.ui.notify(`Usage: /af-agents-drop <persona> [<persona>…]\nActive team: ${Array.from(agentStates.values()).map(s => s.def.name).join(", ")}`, "info");
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
const results = names.map(n => rosterDrop(n));
|
|
1332
|
+
const level = results.some(r => r.ok) ? "info" : "error";
|
|
1333
|
+
ctx.ui.notify(results.map(r => r.message).join("\n"), level);
|
|
1334
|
+
ctx.ui.setStatus("agent-team", `Native roster: ${activeTeamName || "(none)"}* (${agentStates.size})`);
|
|
1335
|
+
},
|
|
1336
|
+
handleAgentsSave: async (args, ctx) => {
|
|
1337
|
+
widgetCtx = ctx;
|
|
1338
|
+
const name = (args || "").trim();
|
|
1339
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(name)) {
|
|
1340
|
+
ctx.ui.notify("Usage: /af-agents-save <team-name> (letters, digits, hyphens, underscores)", "error");
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
const members = Array.from(agentStates.values()).map(s => s.def.name);
|
|
1344
|
+
if (members.length === 0) {
|
|
1345
|
+
ctx.ui.notify("The active team is empty — nothing to save.", "error");
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
const teamsPath = join(ctx.cwd || process.cwd(), ".pi", "agents", "teams.yaml");
|
|
1349
|
+
let raw = "";
|
|
1350
|
+
try { raw = existsSync(teamsPath) ? readFileSync(teamsPath, "utf-8") : ""; } catch {}
|
|
1351
|
+
try {
|
|
1352
|
+
mkdirSync(join(ctx.cwd || process.cwd(), ".pi", "agents"), { recursive: true });
|
|
1353
|
+
writeFileSync(teamsPath, upsertTeamInYaml(raw, name, members), "utf-8");
|
|
1354
|
+
} catch (err) {
|
|
1355
|
+
ctx.ui.notify(`Could not write ${teamsPath}: ${err instanceof Error ? err.message : String(err)}`, "error");
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
teams[name] = members;
|
|
1359
|
+
activeTeamName = name;
|
|
1360
|
+
persistActiveRoster();
|
|
1361
|
+
ctx.ui.setStatus("agent-team", `Team: ${name} (${agentStates.size})`);
|
|
1362
|
+
ctx.ui.notify(`Team "${name}" saved to .pi/agents/teams.yaml — ${members.join(", ")}`, "info");
|
|
1363
|
+
},
|
|
1364
|
+
handleAgentsKill: async (args, ctx) => { widgetCtx = ctx; await researchControls.handleKill(args, ctx); },
|
|
1365
|
+
handleAgentsRestart: async (args, ctx) => { widgetCtx = ctx; await researchControls.handleRestart(args, ctx); },
|
|
1366
|
+
handleContext: async (_args, ctx) => {
|
|
1367
|
+
widgetCtx = ctx;
|
|
1368
|
+
await openContextBudget(ctx);
|
|
1369
|
+
},
|
|
1370
|
+
handleConfig: async (args, ctx) => {
|
|
1371
|
+
widgetCtx = ctx;
|
|
1372
|
+
await openFleetConfig(ctx, args);
|
|
1373
|
+
},
|
|
1374
|
+
handleHubReport: async (args, ctx) => {
|
|
1375
|
+
widgetCtx = ctx;
|
|
1376
|
+
const fmtTok = (n: number) => n >= 1_000_000 ? `${(n / 1_000_000).toFixed(1)}M` : n >= 1000 ? `${Math.round(n / 1000)}k` : String(n);
|
|
1377
|
+
const renderReport = (label: string, r: TurnReport): string => {
|
|
1378
|
+
const billed = r.dispatches.reduce((n, d) => n + d.billed, 0);
|
|
1379
|
+
const out = r.dispatches.reduce((n, d) => n + d.out, 0);
|
|
1380
|
+
const rows = r.dispatches.map(d => ` ${d.agent}: ${d.status} in ${Math.round(d.elapsed / 1000)}s · ${fmtTok(d.billed)} billed / ${fmtTok(d.out)} out`);
|
|
1381
|
+
return [
|
|
1382
|
+
`${label} — tier ${r.tier ?? "(unset)"} · ${r.dispatches.length} dispatch(es) · ${r.research} research · ` +
|
|
1383
|
+
`${fmtTok(billed)} billed / ${fmtTok(out)} out · ${r.recycles} recycle(s) · ${r.driftStops} drift stop(s) · ${r.refusals} refusal(s)`,
|
|
1384
|
+
...rows,
|
|
1385
|
+
].join("\n");
|
|
1386
|
+
};
|
|
1387
|
+
const lines: string[] = [];
|
|
1388
|
+
if (turnReport.dispatches.length > 0 || turnReport.research > 0 || turnReport.refusals > 0) {
|
|
1389
|
+
lines.push(renderReport("Current turn", turnReport));
|
|
1390
|
+
}
|
|
1391
|
+
if (lastTurnReport) lines.push(renderReport("Last turn", lastTurnReport));
|
|
1392
|
+
lines.push(
|
|
1393
|
+
`Session — ${sessionTotals.turns} dispatching turn(s) · ${sessionTotals.dispatches} dispatch(es) · ${sessionTotals.research} research · ` +
|
|
1394
|
+
`${fmtTok(sessionTotals.billed)} billed / ${fmtTok(sessionTotals.out)} out · ${sessionTotals.recycles} recycle(s) · ` +
|
|
1395
|
+
`${sessionTotals.driftStops} drift stop(s) · ${sessionTotals.refusals} refusal(s)`,
|
|
1396
|
+
);
|
|
1397
|
+
const sweep = unaddressedPeerSweep(Array.from(hubSpawnedPeers.values()));
|
|
1398
|
+
if (sweep) lines.push(sweep.message);
|
|
1399
|
+
const trace = readWatchdogEvents(sessionDir);
|
|
1400
|
+
lines.push(`Watchdog System 1 — ${JSON.stringify(buildWatchdogReport(trace.events, watchdogActivity?.live(), trace.integrity))}`);
|
|
1401
|
+
const proactiveInput = proactiveReportInput();
|
|
1402
|
+
lines.push(`Proactive review — ${JSON.stringify(proactiveInput ? buildProactiveReport({ ...proactiveInput, labels: commandProactiveLabels(sessionDir, args) }) : readProactiveReport(sessionDir))}`);
|
|
1403
|
+
ctx.ui.notify(lines.join("\n\n"), "info");
|
|
1404
|
+
},
|
|
1405
|
+
handleZoom: async (args, ctx) => {
|
|
1406
|
+
widgetCtx = ctx;
|
|
1407
|
+
const arg = args?.trim() || "";
|
|
1408
|
+
const rid = parseResearchHandle(arg);
|
|
1409
|
+
const target: Zoomable | undefined = rid != null
|
|
1410
|
+
? researchStates.get(rid)
|
|
1411
|
+
: arg
|
|
1412
|
+
? agentStates.get(arg.toLowerCase()) ?? findDelegationChild(arg)?.child
|
|
1413
|
+
: undefined;
|
|
1414
|
+
if (!target) {
|
|
1415
|
+
const teamKnown = Array.from(agentStates.values()).map(s => displayName(s.def.name)).join(", ");
|
|
1416
|
+
const researchKnown = Array.from(researchStates.values()).map(s => `r${s.id}`).join(", ");
|
|
1417
|
+
const childKnown = Array.from(agentStates.values())
|
|
1418
|
+
.flatMap(s => Array.from(s.delegations?.keys() || [])).join(", ");
|
|
1419
|
+
const known = [teamKnown, researchKnown, childKnown].filter(Boolean).join(", ");
|
|
1420
|
+
ctx.ui.notify(`Usage: /af-zoom <name|rN|child-id>. Known: ${known || "none"}`, "error");
|
|
1421
|
+
return;
|
|
1422
|
+
}
|
|
1423
|
+
const rowKey = (rid != null ? `r${rid}` : arg).toLowerCase();
|
|
1424
|
+
const row = fleetRows(true).find(r => r.key.toLowerCase() === rowKey);
|
|
1425
|
+
if (row) await openFleetDetail(row, ctx);
|
|
1426
|
+
else await openZoom(target, ctx);
|
|
1427
|
+
},
|
|
1428
|
+
handleDispatchPolicy: async (_args, ctx) => {
|
|
1429
|
+
widgetCtx = ctx;
|
|
1430
|
+
const live = new Set(comsReady && identity ? peersInScope().map(e => e.name.toLowerCase()) : []);
|
|
1431
|
+
const lines = Array.from(agentStates.values()).map(s => {
|
|
1432
|
+
const key = s.def.name.toLowerCase();
|
|
1433
|
+
const sub = dispatchPolicy.substitutions[key];
|
|
1434
|
+
const prefer = sub ? sub.prefer : dispatchPolicy.default === "coms" ? "coms" : "native";
|
|
1435
|
+
if (prefer !== "coms") return `${displayName(s.def.name)}: native`;
|
|
1436
|
+
const fb = sub?.fallback === "none" ? "coms-required" : "coms, fallback native";
|
|
1437
|
+
return `${displayName(s.def.name)}: ${fb} — peer ${live.has(key) ? "LIVE" : "not in pool"}`;
|
|
1438
|
+
});
|
|
1439
|
+
const policyPath = join(ctx.cwd || process.cwd(), ".pi", "agents", "dispatch-policy.yaml");
|
|
1440
|
+
const src = existsSync(policyPath) ? ".pi/agents/dispatch-policy.yaml" : "(no dispatch-policy.yaml — all native)";
|
|
1441
|
+
ctx.ui.notify(
|
|
1442
|
+
`Dispatch backends — ${src}, default: ${dispatchPolicy.default}\n${lines.join("\n") || "(no active team)"}\n` +
|
|
1443
|
+
`Routing is decided per dispatch against the live coms pool (/af-coms to refresh).`,
|
|
1444
|
+
"info",
|
|
1445
|
+
);
|
|
1446
|
+
},
|
|
1447
|
+
handleAgentModel: async (args, ctx) => {
|
|
1448
|
+
widgetCtx = ctx;
|
|
1449
|
+
const arg = (args || "").trim().toLowerCase();
|
|
1450
|
+
|
|
1451
|
+
// Dot form: <persona>.<role> targets a delegate sub-role. Candidates are
|
|
1452
|
+
// the role's declared model (default) + the parent's candidate list.
|
|
1453
|
+
if (arg.includes(".")) {
|
|
1454
|
+
const dot = arg.indexOf(".");
|
|
1455
|
+
const personaName = arg.slice(0, dot);
|
|
1456
|
+
const roleName = arg.slice(dot + 1);
|
|
1457
|
+
const parent = agentStates.get(personaName);
|
|
1458
|
+
const roles = parent?.def.subagents || {};
|
|
1459
|
+
const roleKey = Object.keys(roles).find(r => r.toLowerCase() === roleName);
|
|
1460
|
+
if (!parent || !roleKey) {
|
|
1461
|
+
const valid = Array.from(agentStates.values()).flatMap(s =>
|
|
1462
|
+
Object.keys(s.def.subagents || {}).map(r => `${s.def.name}.${r}`));
|
|
1463
|
+
ctx.ui.notify(
|
|
1464
|
+
`No sub-role "${arg}". Valid targets: ${valid.join(", ") || "none (no persona declares subagents:)"}`,
|
|
1465
|
+
"error",
|
|
1466
|
+
);
|
|
1467
|
+
return;
|
|
1468
|
+
}
|
|
1469
|
+
const role = roles[roleKey];
|
|
1470
|
+
const overrideKey = `${personaName}.${roleKey.toLowerCase()}`;
|
|
1471
|
+
const candidates: string[] = [];
|
|
1472
|
+
for (const m of [role.model, ...allowedModels(parent.def)]) {
|
|
1473
|
+
if (m && !candidates.includes(m)) candidates.push(m);
|
|
1474
|
+
}
|
|
1475
|
+
const current = resolvedSubagentModel(parent.def.name, roleKey, role.model);
|
|
1476
|
+
const options = candidates.map(m => {
|
|
1477
|
+
const tags = [m === role.model ? "default" : "", m === current ? "current" : ""].filter(Boolean);
|
|
1478
|
+
return tags.length ? `${m} (${tags.join(", ")})` : m;
|
|
1479
|
+
});
|
|
1480
|
+
const label = `${displayName(parent.def.name)}.${roleKey}`;
|
|
1481
|
+
const choice = await ctx.ui.select(`Model for ${label}`, options);
|
|
1482
|
+
if (choice === undefined) return;
|
|
1483
|
+
const picked = candidates[options.indexOf(choice)];
|
|
1484
|
+
const effectivePicked = substitutedModel(picked) ?? picked;
|
|
1485
|
+
if (effectivePicked === current) {
|
|
1486
|
+
ctx.ui.notify(`${label} is already on ${effectivePicked}`, "info");
|
|
1487
|
+
return;
|
|
1488
|
+
}
|
|
1489
|
+
if (picked === role.model) {
|
|
1490
|
+
modelPolicy.setSubagentOverride(personaName, roleKey, undefined);
|
|
1491
|
+
} else {
|
|
1492
|
+
modelPolicy.setSubagentOverride(personaName, roleKey, picked);
|
|
1493
|
+
}
|
|
1494
|
+
updateWidget();
|
|
1495
|
+
ctx.ui.notify(
|
|
1496
|
+
`${label} → ${effectivePicked} (applies on next dispatch of ${parent.def.name})`,
|
|
1497
|
+
"info",
|
|
1498
|
+
);
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
const name = arg;
|
|
1503
|
+
// Team member (live state) OR a research persona — both switchable.
|
|
1504
|
+
const def = name ? switchablePersonaDef(name) : undefined;
|
|
1505
|
+
if (!def) {
|
|
1506
|
+
const known = [
|
|
1507
|
+
...Array.from(agentStates.values()).map(s => s.def.name),
|
|
1508
|
+
...researchPersonas.map(d => d.name),
|
|
1509
|
+
].join(", ");
|
|
1510
|
+
ctx.ui.notify(`Usage: /af-agent-model <persona>[.<role>]. Known: ${known || "none"}`, "error");
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
if (!def.models || def.models.length === 0) {
|
|
1514
|
+
ctx.ui.notify(
|
|
1515
|
+
`${displayName(def.name)} declares no model candidates — add a \`models:\` list to ${def.file} or a \`models.${def.name}:\` override in .ai/agent-fleet-overrides.md.`,
|
|
1516
|
+
"warning",
|
|
1517
|
+
);
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
const candidates = allowedModels(def);
|
|
1521
|
+
const current = resolvedModel(def);
|
|
1522
|
+
// A persona without a frontmatter default runs on the dispatcher's model —
|
|
1523
|
+
// offer that as an explicit candidate so the override can be cleared.
|
|
1524
|
+
const DISPATCHER_DEFAULT = "(dispatcher's model)";
|
|
1525
|
+
if (!def.model) candidates.unshift(DISPATCHER_DEFAULT);
|
|
1526
|
+
const options = candidates.map(m => {
|
|
1527
|
+
const isDefault = def.model ? m === def.model : m === DISPATCHER_DEFAULT;
|
|
1528
|
+
const isCurrent = current ? m === current : m === DISPATCHER_DEFAULT;
|
|
1529
|
+
const tags = [isDefault ? "default" : "", isCurrent ? "current" : ""].filter(Boolean);
|
|
1530
|
+
return tags.length ? `${m} (${tags.join(", ")})` : m;
|
|
1531
|
+
});
|
|
1532
|
+
const choice = await ctx.ui.select(`Model for ${displayName(def.name)}`, options);
|
|
1533
|
+
if (choice === undefined) return;
|
|
1534
|
+
const picked = candidates[options.indexOf(choice)];
|
|
1535
|
+
const effectivePicked = picked === DISPATCHER_DEFAULT ? picked : (substitutedModel(picked) ?? picked);
|
|
1536
|
+
const pickedIsCurrent = current ? effectivePicked === current : picked === DISPATCHER_DEFAULT;
|
|
1537
|
+
if (pickedIsCurrent) {
|
|
1538
|
+
ctx.ui.notify(`${displayName(def.name)} is already on ${effectivePicked}`, "info");
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1541
|
+
if (picked === def.model || picked === DISPATCHER_DEFAULT) {
|
|
1542
|
+
modelPolicy.setPersonaOverride(name, undefined);
|
|
1543
|
+
} else {
|
|
1544
|
+
modelPolicy.setPersonaOverride(name, picked);
|
|
1545
|
+
}
|
|
1546
|
+
updateWidget();
|
|
1547
|
+
// Research helpers spawn fresh each time, so the switch lands on their
|
|
1548
|
+
// next spawn; team members apply on next dispatch (restartable now).
|
|
1549
|
+
const applyHint = (def.kind || "").toLowerCase() === "research"
|
|
1550
|
+
? "applies on next spawn_research"
|
|
1551
|
+
: `applies on next dispatch; /af-agents-restart ${def.name} to apply now`;
|
|
1552
|
+
ctx.ui.notify(`${displayName(def.name)} → ${effectivePicked} (${applyHint})`, "info");
|
|
1553
|
+
if ((dispatchPolicy.substitutions[name]?.prefer ?? dispatchPolicy.default) === "coms") {
|
|
1554
|
+
ctx.ui.notify(
|
|
1555
|
+
`Note: ${displayName(def.name)} prefers a coms peer (dispatch-policy.yaml) — this model override only applies to native(-fallback) runs; the peer keeps its own model.`,
|
|
1556
|
+
"info",
|
|
1557
|
+
);
|
|
1558
|
+
}
|
|
1559
|
+
},
|
|
1560
|
+
handleAgentModelThinking: async (args, ctx) => {
|
|
1561
|
+
widgetCtx = ctx;
|
|
1562
|
+
const name = (args || "").trim().toLowerCase();
|
|
1563
|
+
// Team member (live state) OR a research persona — both switchable.
|
|
1564
|
+
const def = name ? switchablePersonaDef(name) : undefined;
|
|
1565
|
+
if (!def) {
|
|
1566
|
+
const known = [
|
|
1567
|
+
...Array.from(agentStates.values()).map(s => s.def.name),
|
|
1568
|
+
...researchPersonas.map(d => d.name),
|
|
1569
|
+
].join(", ");
|
|
1570
|
+
ctx.ui.notify(`Usage: /af-agent-model-thinking <persona>. Known: ${known || "none"}`, "error");
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
const defaultLevel = resolveThinkingLevel(def.thinking);
|
|
1574
|
+
const current = resolveThinkingLevel(resolvedThinking(def));
|
|
1575
|
+
const levels = [...THINKING_LEVELS];
|
|
1576
|
+
const options = levels.map(l => {
|
|
1577
|
+
const tags = [l === defaultLevel ? "default" : "", l === current ? "current" : ""].filter(Boolean);
|
|
1578
|
+
return tags.length ? `${l} (${tags.join(", ")})` : l;
|
|
1579
|
+
});
|
|
1580
|
+
const choice = await ctx.ui.select(`Thinking level for ${displayName(def.name)}`, options);
|
|
1581
|
+
if (choice === undefined) return;
|
|
1582
|
+
const picked = levels[options.indexOf(choice)];
|
|
1583
|
+
if (picked === current) {
|
|
1584
|
+
ctx.ui.notify(`${displayName(def.name)} is already on thinking: ${picked}`, "info");
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
if (picked === defaultLevel) {
|
|
1588
|
+
modelPolicy.setThinkingOverride(name, undefined);
|
|
1589
|
+
} else {
|
|
1590
|
+
modelPolicy.setThinkingOverride(name, picked);
|
|
1591
|
+
}
|
|
1592
|
+
updateWidget();
|
|
1593
|
+
// Research helpers spawn fresh each time, so the switch lands on their
|
|
1594
|
+
// next spawn; team members apply on next dispatch (restartable now).
|
|
1595
|
+
const applyHint = (def.kind || "").toLowerCase() === "research"
|
|
1596
|
+
? "applies on next spawn_research"
|
|
1597
|
+
: `applies on next dispatch; /af-agents-restart ${def.name} to apply now`;
|
|
1598
|
+
ctx.ui.notify(`${displayName(def.name)} thinking → ${picked} (${applyHint})`, "info");
|
|
1599
|
+
},
|
|
1600
|
+
handleModels: async (args, ctx) => {
|
|
1601
|
+
widgetCtx = ctx;
|
|
1602
|
+
const names = Object.keys(modelProfiles);
|
|
1603
|
+
if (names.length === 0) {
|
|
1604
|
+
ctx.ui.notify("No model profiles loaded — define .pi/agents/model-profiles.yaml (invalid profiles are dropped at session start).", "warning");
|
|
1605
|
+
return;
|
|
1606
|
+
}
|
|
1607
|
+
let profileName = (args || "").trim();
|
|
1608
|
+
if (!profileName) {
|
|
1609
|
+
const options = names.map(n =>
|
|
1610
|
+
isCompleteProfile(modelProfiles[n])
|
|
1611
|
+
? `${n} — complete fleet (${shortModel((modelProfiles[n] as any).defaults.model)} default)`
|
|
1612
|
+
: `${n} — ${Object.entries(modelProfiles[n]).map(([p, m]) => `${p}: ${shortModel(m)}`).join(", ")}`,
|
|
1613
|
+
);
|
|
1614
|
+
const choice = await ctx.ui.select("Select model profile", options);
|
|
1615
|
+
if (choice === undefined) return;
|
|
1616
|
+
profileName = names[options.indexOf(choice)];
|
|
1617
|
+
}
|
|
1618
|
+
const profile = modelProfiles[profileName];
|
|
1619
|
+
if (!profile) {
|
|
1620
|
+
ctx.ui.notify(`No profile "${profileName}". Known: ${names.join(", ")}`, "error");
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1623
|
+
profileCommandContext=ctx;
|
|
1624
|
+
try {
|
|
1625
|
+
const applied=await profileActivation.activate(profileName,profile);
|
|
1626
|
+
applyWorkModeTools();
|
|
1627
|
+
ctx.ui.setStatus('hub-model-profile',isCompleteProfile(profile)?`Models: ${profileName}`:undefined);
|
|
1628
|
+
ctx.ui.notify(`Profile "${profileName}": ${applied.length} personas${isCompleteProfile(profile)?', all children, dispatcher and auxiliary models':''} switched.`, 'info');
|
|
1629
|
+
} catch(error) {ctx.ui.notify(String(error),'error');}
|
|
1630
|
+
},
|
|
1631
|
+
handleAgentModelsSubstitute: async (args, ctx) => {
|
|
1632
|
+
widgetCtx = ctx;
|
|
1633
|
+
const tokens = (args || "").trim().split(/\s+/).filter(Boolean);
|
|
1634
|
+
if (tokens.length === 0) {
|
|
1635
|
+
if (allKnownModels().length === 0) {
|
|
1636
|
+
ctx.ui.notify("No configured persona or sub-role models are available as substitution sources.", "warning");
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
await openFleetDashboard(ctx, true);
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1642
|
+
if (tokens.length !== 2) {
|
|
1643
|
+
ctx.ui.notify("Usage: /af-agent-models-substitute [<source> <target>]", "error");
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
await applySessionModelSubstitution(tokens[0], tokens[1], ctx);
|
|
1647
|
+
},
|
|
1648
|
+
handleWatchdog: async (args, ctx) => {
|
|
1649
|
+
widgetCtx = ctx;
|
|
1650
|
+
const parts = (args || "").trim().split(/\s+/).filter(Boolean);
|
|
1651
|
+
if (parts.length === 0) {
|
|
1652
|
+
const perAgent = watchdogAgentOverrides.size > 0
|
|
1653
|
+
? Array.from(watchdogAgentOverrides.entries()).map(([k, v]) => `${k}: ${v}`).join(", ")
|
|
1654
|
+
: "(none)";
|
|
1655
|
+
ctx.ui.notify(
|
|
1656
|
+
`Drift watchdog: ${watchdogSetting} (hub-wide)\nPer-agent overrides: ${perAgent}\n` +
|
|
1657
|
+
`Judge model: ${watchdogJudgeModel || "(researcher persona's, else dispatcher's)"}\n` +
|
|
1658
|
+
`${formatWatchdogStatus(watchdogSystem1, watchdogActivity)}\n` +
|
|
1659
|
+
`Usage: /af-watchdog on|off|auto — or /af-watchdog <agent> on|off|clear`,
|
|
1660
|
+
"info",
|
|
1661
|
+
);
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
if (parts.length === 1) {
|
|
1665
|
+
const setting = normalizeWatchdogSetting(parts[0]);
|
|
1666
|
+
if (!setting) {
|
|
1667
|
+
ctx.ui.notify(`Unknown setting "${parts[0]}" — expected one of: ${WATCHDOG_SETTINGS.join(", ")} (or /af-watchdog <agent> on|off|clear)`, "error");
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1670
|
+
watchdogSetting = setting;
|
|
1671
|
+
ctx.ui.notify(`Drift watchdog → ${setting} (applies from the next dispatch)`, "info");
|
|
1672
|
+
return;
|
|
1673
|
+
}
|
|
1674
|
+
const agentKey = normalizeAgentInput(parts[0]);
|
|
1675
|
+
const value = parts[1].toLowerCase();
|
|
1676
|
+
if (!agentStates.has(agentKey)) {
|
|
1677
|
+
ctx.ui.notify(`"${parts[0]}" is not in the active team (${Array.from(agentStates.values()).map(s => s.def.name).join(", ")})`, "error");
|
|
1678
|
+
return;
|
|
1679
|
+
}
|
|
1680
|
+
if (value === "clear") {
|
|
1681
|
+
watchdogAgentOverrides.delete(agentKey);
|
|
1682
|
+
ctx.ui.notify(`Drift watchdog override cleared for ${agentKey} (hub-wide setting "${watchdogSetting}" applies)`, "info");
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
if (value !== "on" && value !== "off") {
|
|
1686
|
+
ctx.ui.notify(`Per-agent watchdog must be on, off, or clear — got "${parts[1]}"`, "error");
|
|
1687
|
+
return;
|
|
1688
|
+
}
|
|
1689
|
+
watchdogAgentOverrides.set(agentKey, value);
|
|
1690
|
+
ctx.ui.notify(`Drift watchdog for ${agentKey} → ${value} (overrides the hub-wide "${watchdogSetting}")`, "info");
|
|
1691
|
+
},
|
|
1692
|
+
handleComs: async (args, ctx) => {
|
|
1693
|
+
if (!comsReady) { ctx.ui.notify("coms is not active in this session.", "warning"); return; }
|
|
1694
|
+
await coms.updateScope((args ?? "").trim(), ctx);
|
|
1695
|
+
},
|
|
1696
|
+
handleHandoff: async (args, ctx) => {
|
|
1697
|
+
if (modelWorkBlockedByRosterRecovery(ctx)) return;
|
|
1698
|
+
if (!comsReady) { ctx.ui.notify("coms is not active in this session — /af-handoff unavailable.", "warning"); return; }
|
|
1699
|
+
const target = (args ?? "").trim();
|
|
1700
|
+
if (!target) {
|
|
1701
|
+
ctx.ui.notify("Usage: /af-handoff <peer>. See the coms pool for live peer names.", "error");
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
const peer = resolveTarget(target);
|
|
1705
|
+
if (!peer) {
|
|
1706
|
+
ctx.ui.notify(`coms: no live peer "${target}". Use /af-coms to refresh the pool.`, "error");
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
const refusal=profilePeerGate({ peerModel: peer.model, targetResolved: true });if(refusal){ctx.ui.notify(refusal.content[0].text,"error");return;}
|
|
1710
|
+
const handoffToken = crypto.randomBytes(8).toString("hex");
|
|
1711
|
+
hubStateCtx.setPendingHandoff({ target: peer.name, token: handoffToken });
|
|
1712
|
+
pi.sendMessage({
|
|
1713
|
+
customType: "coms-handoff",
|
|
1714
|
+
content:
|
|
1715
|
+
`HANDOFF REQUEST → peer "${peer.name}".\n\n` +
|
|
1716
|
+
`Compose a SELF-CONTAINED handoff brief (the peer does NOT share your context): state the ` +
|
|
1717
|
+
`overall goal, what's been done so far, key decisions and constraints, the current status, ` +
|
|
1718
|
+
`and the concrete next steps you want the peer to take. Then call ` +
|
|
1719
|
+
`coms_send(target: "${peer.name}", handoff_token: "${handoffToken}", prompt: <the brief only; the hub appends the verification ledger and artifact index in code only when this token matches>), coms_await its msg_id, and relay ` +
|
|
1720
|
+
`the peer's reply to me in ${userLanguage}.`,
|
|
1721
|
+
display: true,
|
|
1722
|
+
}, { deliverAs: "followUp", triggerTurn: true });
|
|
1723
|
+
ctx.ui.notify(`Handoff to ${peer.name}: asking the dispatcher to compose a brief…`, "info");
|
|
1724
|
+
},
|
|
1725
|
+
handleCompound: async (args, ctx) => {
|
|
1726
|
+
if (modelWorkBlockedByRosterRecovery(ctx)) return;
|
|
1727
|
+
if (!agentStates.has("documenter")) {
|
|
1728
|
+
ctx.ui.notify(
|
|
1729
|
+
"compound: the documenter persona is not in the active team — switch with /af-agents-team (e.g. default or release), then re-run /af-compound.",
|
|
1730
|
+
"warning",
|
|
1731
|
+
);
|
|
1732
|
+
return;
|
|
1733
|
+
}
|
|
1734
|
+
const focus = (args ?? "").trim();
|
|
1735
|
+
const rulesLine = projectRulesDirs.length > 0
|
|
1736
|
+
? projectRulesDirs.join(", ")
|
|
1737
|
+
: "(none declared in .ai/agent-fleet-overrides.md — the documenter must locate an existing rules tree or, failing that, propose lessons without writing)";
|
|
1738
|
+
const docsLine = projectDocsPaths.length > 0
|
|
1739
|
+
? projectDocsPaths.join(", ")
|
|
1740
|
+
: "(none declared)";
|
|
1741
|
+
pi.sendMessage({
|
|
1742
|
+
customType: "compound-learning",
|
|
1743
|
+
content:
|
|
1744
|
+
`COMPOUND REQUEST — capture this session's lessons into the project's rules and docs (compound-learning pass).\n\n` +
|
|
1745
|
+
`1. From THIS session's context, compose a candidate-lessons brief: user corrections, review findings that recurred, ` +
|
|
1746
|
+
`wrong assumptions that cost rework, debugging root causes, and changes that invalidated existing docs. At most 5 lessons; ` +
|
|
1747
|
+
`each is one imperative sentence plus a one-line Why (the failure it prevents) and a one-line Evidence (what happened this session). ` +
|
|
1748
|
+
`${focus ? `Focus especially on: ${focus}. ` : ""}` +
|
|
1749
|
+
`If nothing rises to a lesson, tell the user there is nothing worth compounding and stop.\n` +
|
|
1750
|
+
`2. Confirm the list with the user in ${userLanguage} (ask_user when available) — they approve, trim, or reword. Do not dispatch before this confirmation.\n` +
|
|
1751
|
+
`3. Dispatch the documenter with a SELF-CONTAINED task (it shares none of your context) containing: the approved lessons verbatim ` +
|
|
1752
|
+
`(with Why + Evidence); the project rule folders: ${rulesLine}; the docs entry points: ${docsLine}; the assertion ledger path ` +
|
|
1753
|
+
`.pi/agent-sessions/assertions.json (when it exists); and the instruction to read skills/compound-learning/SKILL.md and follow it exactly — ` +
|
|
1754
|
+
`dedupe index-first against the existing rule tree, minimal diffs on existing files, caps of 5 lessons / 1 new file. State that the user ` +
|
|
1755
|
+
`already approved this lesson list, so it may apply without a second gate. Pass the relevant review/return/evidence artifact paths via the ` +
|
|
1756
|
+
`dispatch's artifacts array — paths only, never pasted bodies.\n` +
|
|
1757
|
+
`4. Relay the documenter's file-by-file result to me in ${userLanguage}.`,
|
|
1758
|
+
display: true,
|
|
1759
|
+
}, { deliverAs: "followUp", triggerTurn: true });
|
|
1760
|
+
ctx.ui.notify("Compound: asking the dispatcher to compose the candidate-lessons brief…", "info");
|
|
1761
|
+
},
|
|
1762
|
+
handlePoll: async (args, ctx) => {
|
|
1763
|
+
return withProfileWork(async () => {
|
|
1764
|
+
if (modelWorkBlockedByRosterRecovery(ctx)) return;
|
|
1765
|
+
const cwd = ctx.cwd || process.cwd();
|
|
1766
|
+
const result = await handleAfPoll({
|
|
1767
|
+
args: args ?? "",
|
|
1768
|
+
cwd,
|
|
1769
|
+
pollPanelOverride: readActiveProfile()?.name ?? parseAgentTeamOverrides(cwd).pollPanel,
|
|
1770
|
+
listPanels: async dir => {
|
|
1771
|
+
const { listPanelNames } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
|
|
1772
|
+
return listPanelNames(dir);
|
|
1773
|
+
},
|
|
1774
|
+
preflight: async ({ panel, persona, cwd: root }) => {
|
|
1775
|
+
const [{ resolvePersona }, { resolvePanel }, { checkChildVisibility }] = await Promise.all([
|
|
1776
|
+
import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
|
|
1777
|
+
import("../../agent-fleet/scripts/workflows/lib/voices.ts"),
|
|
1778
|
+
import("../../agent-fleet/scripts/workflows/lib/model-visibility.ts"),
|
|
1779
|
+
]);
|
|
1780
|
+
try { resolvePersona(persona, root); }
|
|
1781
|
+
catch (error) { return error instanceof Error ? error.message : String(error); }
|
|
1782
|
+
let voices;
|
|
1783
|
+
try { voices = resolvePanel(panel, root); }
|
|
1784
|
+
catch (error) { return error instanceof Error ? error.message : String(error); }
|
|
1785
|
+
const report = checkChildVisibility(voices.map(voice => voice.model));
|
|
1786
|
+
if (report.diagnostic) return `could not verify clean-room model visibility (${report.diagnostic})`;
|
|
1787
|
+
const hidden = report.models.filter(model => !model.ok);
|
|
1788
|
+
if (hidden.length) {
|
|
1789
|
+
return `panel "${panel}" has models not visible to a clean-room child: ${hidden.map(model => model.reasons[0] ?? model.model).join("; ")}`;
|
|
1790
|
+
}
|
|
1791
|
+
return null;
|
|
1792
|
+
},
|
|
1793
|
+
checkBudget: async () => {
|
|
1794
|
+
ensureTaskTier();
|
|
1795
|
+
return null;
|
|
1796
|
+
},
|
|
1797
|
+
chargeBudget: () => {
|
|
1798
|
+
turnDispatchCount += 1;
|
|
1799
|
+
taskDispatchCount += 1;
|
|
1800
|
+
sessionTotals.dispatches += 1;
|
|
1801
|
+
updateModeStatus();
|
|
1802
|
+
},
|
|
1803
|
+
onAccepted: async ({ panel, persona, question }) => {
|
|
1804
|
+
let voices: { name: string; model: string }[] = [];
|
|
1805
|
+
try {
|
|
1806
|
+
const { resolvePanel } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
|
|
1807
|
+
voices = resolvePanel(panel, cwd).map(voice => ({ name: voice.name, model: voice.model }));
|
|
1808
|
+
} catch { /* names are decorative */ }
|
|
1809
|
+
const started = formatAfPollStarted({ panel, persona, question, voices });
|
|
1810
|
+
ctx.ui.setStatus("hub-poll", `Poll: ${panel} (${voices.length || "?"} voices) running…`);
|
|
1811
|
+
ctx.ui.notify(`Poll started — panel ${panel}. This can take a minute.`, "info");
|
|
1812
|
+
pi.sendMessage({ customType: "af-poll-started", content: started, display: true }, { deliverAs: "followUp", triggerTurn: false });
|
|
1813
|
+
},
|
|
1814
|
+
execute: async ({ panel, persona, question }) => {
|
|
1815
|
+
const [{ Run }, { runPoll }, { runMerge }, { resolvePersona }] = await Promise.all([
|
|
1816
|
+
import("../../agent-fleet/scripts/workflows/lib/run.ts"),
|
|
1817
|
+
import("../../agent-fleet/scripts/workflows/lib/poll.ts"),
|
|
1818
|
+
import("../../agent-fleet/scripts/workflows/lib/merge.ts"),
|
|
1819
|
+
import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
|
|
1820
|
+
]);
|
|
1821
|
+
const run = new Run({ cwd, command: ["/af-poll", "--panel", panel, question] });
|
|
1822
|
+
const personaDef = resolvePersona(persona, cwd);
|
|
1823
|
+
const poll = await runPoll({
|
|
1824
|
+
run, cwd, persona: personaDef, panel, task: question,
|
|
1825
|
+
onVoice: result => {
|
|
1826
|
+
const voice = result.ok
|
|
1827
|
+
? { name: result.voice.name, model: result.voice.model, ok: true as const, position: result.report.position, confidence: result.report.confidence }
|
|
1828
|
+
: { name: result.voice.name, model: result.voice.model, ok: false as const, reason: result.reason };
|
|
1829
|
+
pi.sendMessage({ customType: "af-poll-voice", content: formatAfPollVoiceProgress(voice), display: true }, { deliverAs: "followUp", triggerTurn: false });
|
|
1830
|
+
},
|
|
1831
|
+
});
|
|
1832
|
+
ctx.ui.setStatus("hub-poll", `Poll: ${panel} merging…`);
|
|
1833
|
+
const merge = await runMerge({ run, cwd, persona: personaDef, panel, task: question, opinions: poll.results });
|
|
1834
|
+
const directory = path.relative(cwd, poll.directory) || poll.directory;
|
|
1835
|
+
return {
|
|
1836
|
+
panel,
|
|
1837
|
+
directory: directory.endsWith(path.sep) ? directory : `${directory}${path.sep}`,
|
|
1838
|
+
voices: poll.results.map(item => item.ok
|
|
1839
|
+
? { name: item.voice.name, model: item.voice.model, ok: true as const, position: item.report.position, confidence: item.report.confidence }
|
|
1840
|
+
: { name: item.voice.name, model: item.voice.model, ok: false as const, reason: item.reason }),
|
|
1841
|
+
recommendation: merge.report.recommendation,
|
|
1842
|
+
integrator: merge.integrator.name,
|
|
1843
|
+
};
|
|
1844
|
+
},
|
|
1845
|
+
});
|
|
1846
|
+
ctx.ui.setStatus("hub-poll", "");
|
|
1847
|
+
if (!result.ok) {
|
|
1848
|
+
ctx.ui.notify(result.message, "error");
|
|
1849
|
+
pi.sendMessage({ customType: "af-poll-failed", content: `POLL FAILED\n\n${result.message}`, display: true }, { deliverAs: "followUp", triggerTurn: false });
|
|
1850
|
+
return;
|
|
1851
|
+
}
|
|
1852
|
+
ctx.ui.notify(result.digest ?? result.message, "info");
|
|
1853
|
+
pi.sendMessage({
|
|
1854
|
+
customType: "af-poll",
|
|
1855
|
+
content: result.dispatcherNote ?? result.message,
|
|
1856
|
+
display: true,
|
|
1857
|
+
}, { deliverAs: "followUp", triggerTurn: true });
|
|
1858
|
+
});
|
|
1859
|
+
},
|
|
1860
|
+
handleDebate: async (args, ctx) => {
|
|
1861
|
+
return withProfileWork(async () => {
|
|
1862
|
+
if (modelWorkBlockedByRosterRecovery(ctx)) return;
|
|
1863
|
+
const cwd = ctx.cwd || process.cwd();
|
|
1864
|
+
const result = await handleAfDebate({
|
|
1865
|
+
args: args ?? "",
|
|
1866
|
+
cwd,
|
|
1867
|
+
pollPanelOverride: readActiveProfile()?.name ?? parseAgentTeamOverrides(cwd).pollPanel,
|
|
1868
|
+
listPanels: async dir => {
|
|
1869
|
+
const { listPanelNames } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
|
|
1870
|
+
return listPanelNames(dir);
|
|
1871
|
+
},
|
|
1872
|
+
preflight: async ({ panel, persona, cwd: root }) => {
|
|
1873
|
+
const [{ resolvePersona }, { resolvePanel }, { checkChildVisibility }] = await Promise.all([
|
|
1874
|
+
import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
|
|
1875
|
+
import("../../agent-fleet/scripts/workflows/lib/voices.ts"),
|
|
1876
|
+
import("../../agent-fleet/scripts/workflows/lib/model-visibility.ts"),
|
|
1877
|
+
]);
|
|
1878
|
+
try { resolvePersona(persona, root); }
|
|
1879
|
+
catch (error) { return error instanceof Error ? error.message : String(error); }
|
|
1880
|
+
let voices;
|
|
1881
|
+
try { voices = resolvePanel(panel, root); }
|
|
1882
|
+
catch (error) { return error instanceof Error ? error.message : String(error); }
|
|
1883
|
+
const report = checkChildVisibility(voices.map(voice => voice.model));
|
|
1884
|
+
if (report.diagnostic) return `could not verify clean-room model visibility (${report.diagnostic})`;
|
|
1885
|
+
const hidden = report.models.filter(model => !model.ok);
|
|
1886
|
+
if (hidden.length) {
|
|
1887
|
+
return `panel "${panel}" has models not visible to a clean-room child: ${hidden.map(model => model.reasons[0] ?? model.model).join("; ")}`;
|
|
1888
|
+
}
|
|
1889
|
+
return null;
|
|
1890
|
+
},
|
|
1891
|
+
checkBudget: async () => {
|
|
1892
|
+
ensureTaskTier();
|
|
1893
|
+
return null;
|
|
1894
|
+
},
|
|
1895
|
+
chargeBudget: () => {
|
|
1896
|
+
turnDispatchCount += 1;
|
|
1897
|
+
taskDispatchCount += 1;
|
|
1898
|
+
sessionTotals.dispatches += 1;
|
|
1899
|
+
updateModeStatus();
|
|
1900
|
+
},
|
|
1901
|
+
onAccepted: async ({ panel, persona, question, rounds }) => {
|
|
1902
|
+
let voices: { name: string; model: string }[] = [];
|
|
1903
|
+
try {
|
|
1904
|
+
const { resolvePanel } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
|
|
1905
|
+
voices = resolvePanel(panel, cwd).map(voice => ({ name: voice.name, model: voice.model }));
|
|
1906
|
+
} catch { /* names are decorative */ }
|
|
1907
|
+
const started = formatAfDebateStarted({ panel, persona, question, rounds, voices });
|
|
1908
|
+
ctx.ui.setStatus("hub-poll", `Debate: ${panel} (${rounds} rounds) running…`);
|
|
1909
|
+
ctx.ui.notify(`Debate started — panel ${panel}, ${rounds} rounds.`, "info");
|
|
1910
|
+
pi.sendMessage({ customType: "af-debate-started", content: started, display: true }, { deliverAs: "followUp", triggerTurn: false });
|
|
1911
|
+
},
|
|
1912
|
+
execute: async ({ panel, persona, question, rounds }) => {
|
|
1913
|
+
const [{ Run }, { runDebate }, { resolvePersona }] = await Promise.all([
|
|
1914
|
+
import("../../agent-fleet/scripts/workflows/lib/run.ts"),
|
|
1915
|
+
import("../../agent-fleet/scripts/workflows/lib/debate.ts"),
|
|
1916
|
+
import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
|
|
1917
|
+
]);
|
|
1918
|
+
const run = new Run({ cwd, command: ["/af-debate", "--panel", panel, "--rounds", String(rounds), question] });
|
|
1919
|
+
const personaDef = resolvePersona(persona, cwd);
|
|
1920
|
+
const debate = await runDebate({
|
|
1921
|
+
run, cwd, persona: personaDef, panel, task: question, rounds,
|
|
1922
|
+
onVoice: (result, round) => {
|
|
1923
|
+
const voice = result.ok
|
|
1924
|
+
? { name: result.voice.name, model: result.voice.model, ok: true as const, round, position: result.report.position, changed: result.report.changed }
|
|
1925
|
+
: { name: result.voice.name, model: result.voice.model, ok: false as const, round, reason: result.reason };
|
|
1926
|
+
ctx.ui.setStatus("hub-poll", `Debate: ${panel} round ${round}…`);
|
|
1927
|
+
pi.sendMessage({ customType: "af-debate-voice", content: formatAfDebateVoiceProgress(voice), display: true }, { deliverAs: "followUp", triggerTurn: false });
|
|
1928
|
+
},
|
|
1929
|
+
});
|
|
1930
|
+
const last = debate.roundsRun.at(-1)?.results ?? [];
|
|
1931
|
+
const directory = path.relative(cwd, debate.directory) || debate.directory;
|
|
1932
|
+
return {
|
|
1933
|
+
panel, rounds: debate.rounds,
|
|
1934
|
+
directory: directory.endsWith(path.sep) ? directory : `${directory}${path.sep}`,
|
|
1935
|
+
voices: last.map(item => item.ok
|
|
1936
|
+
? { name: item.voice.name, model: item.voice.model, ok: true as const, round: item.round, position: item.report.position, changed: item.report.changed }
|
|
1937
|
+
: { name: item.voice.name, model: item.voice.model, ok: false as const, round: item.round, reason: item.reason }),
|
|
1938
|
+
};
|
|
1939
|
+
},
|
|
1940
|
+
});
|
|
1941
|
+
ctx.ui.setStatus("hub-poll", "");
|
|
1942
|
+
if (!result.ok) {
|
|
1943
|
+
ctx.ui.notify(result.message, "error");
|
|
1944
|
+
pi.sendMessage({ customType: "af-debate-failed", content: `DEBATE FAILED\n\n${result.message}`, display: true }, { deliverAs: "followUp", triggerTurn: false });
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
ctx.ui.notify(result.digest ?? result.message, "info");
|
|
1948
|
+
pi.sendMessage({
|
|
1949
|
+
customType: "af-debate",
|
|
1950
|
+
content: result.dispatcherNote ?? result.message,
|
|
1951
|
+
display: true,
|
|
1952
|
+
}, { deliverAs: "followUp", triggerTurn: true });
|
|
1953
|
+
});
|
|
1954
|
+
},
|
|
1955
|
+
getAgentsKillCompletions: prefix => completions.agentsKill(prefix),
|
|
1956
|
+
getZoomCompletions: prefix => completions.zoom(prefix),
|
|
1957
|
+
getAgentModelCompletions: prefix => completions.agentModels(prefix),
|
|
1958
|
+
getAgentModelThinkingCompletions: prefix => completions.agentThinking(prefix),
|
|
1959
|
+
getModelProfileCompletions: prefix => completions.modelProfiles(prefix),
|
|
1960
|
+
getSubstituteCompletions: prefix => completions.substitutions(prefix),
|
|
1961
|
+
getComsPeerCompletions: prefix => completions.comsPeers(prefix),
|
|
1962
|
+
getSubagentTargetCompletions: prefix => completions.subagentTargets(prefix),
|
|
1963
|
+
};
|
|
1964
|
+
|
|
1965
|
+
// Keep the complete command surface flat and greppable in this composition root.
|
|
1966
|
+
registerAgentsTeam(pi, commandCtx);
|
|
1967
|
+
registerAgentsList(pi, commandCtx);
|
|
1968
|
+
registerAgentsHistory(pi, commandCtx);
|
|
1969
|
+
registerContextCommand(pi, commandCtx);
|
|
1970
|
+
registerAudit(pi, commandCtx);
|
|
1971
|
+
registerConfig(pi, commandCtx);
|
|
1972
|
+
registerWorkMode(pi, commandCtx);
|
|
1973
|
+
registerWatchdog(pi, commandCtx);
|
|
1974
|
+
registerAgentsAdd(pi, commandCtx);
|
|
1975
|
+
registerAgentsDrop(pi, commandCtx);
|
|
1976
|
+
registerAgentsSave(pi, commandCtx);
|
|
1977
|
+
registerHubReport(pi, commandCtx);
|
|
1978
|
+
registerZoom(pi, commandCtx);
|
|
1979
|
+
registerAgentModel(pi, commandCtx);
|
|
1980
|
+
registerAgentModelThinking(pi, commandCtx);
|
|
1981
|
+
registerModels(pi, commandCtx);
|
|
1982
|
+
registerAgentModelsSubstitute(pi, commandCtx);
|
|
1983
|
+
registerDispatchPolicy(pi, commandCtx);
|
|
1984
|
+
registerAgentsKill(pi, commandCtx);
|
|
1985
|
+
registerAgentsRestart(pi, commandCtx);
|
|
1986
|
+
registerComs(pi, commandCtx);
|
|
1987
|
+
registerHandoff(pi, commandCtx);
|
|
1988
|
+
registerCompound(pi, commandCtx);
|
|
1989
|
+
registerPoll(pi, commandCtx);
|
|
1990
|
+
registerRetry(pi, commandCtx);
|
|
1991
|
+
registerRecover(pi, commandCtx);
|
|
1992
|
+
registerDebate(pi, commandCtx);
|
|
1993
|
+
registerTaskTriageRecover(pi, commandCtx);
|
|
1994
|
+
registerTaskTriageWaiver(pi, commandCtx);
|
|
1995
|
+
|
|
1996
|
+
const detailPanel = createDetailPanel<AgentDef, AgentState, ResearchState>({
|
|
1997
|
+
getAgent: key => agentStates.get(key),
|
|
1998
|
+
getResearch: id => researchStates.get(id),
|
|
1999
|
+
parseResearchHandle,
|
|
2000
|
+
findDelegationChild,
|
|
2001
|
+
modelPolicy,
|
|
2002
|
+
displayName,
|
|
2003
|
+
shortModel,
|
|
2004
|
+
refreshUi: updateWidget,
|
|
2005
|
+
getDispatchPreference: name => (dispatchPolicy.substitutions[name.toLowerCase()]?.prefer ?? dispatchPolicy.default) === "coms" ? "coms" : "native",
|
|
2006
|
+
maxLiveEntryChars: MAX_LIVE_ENTRY_CHARS,
|
|
2007
|
+
getProactive: () => fleetSource.snapshot(Date.now()).proactive,
|
|
2008
|
+
readProactiveEvidence: (finding) => proactiveRuntime?.findings.readback(finding.snapshotHandle, finding.snapshotHash, finding.snapshotId, finding.unitId, finding.excerptHash) ?? null,
|
|
2009
|
+
currentFleetRow: key => fleetSource.rows(Date.now(), { showFinished: true }).find(row => row.key === key),
|
|
2010
|
+
});
|
|
2011
|
+
const { openFleetDetail, loadAvailableModelChoices } = detailPanel;
|
|
2012
|
+
const applySessionModelSubstitution = (source: string, target: string, ctx: any) => modelPolicy.applySessionSubstitution(source, target, {
|
|
2013
|
+
loadAvailable: current => loadAvailableModelChoices(ctx, current),
|
|
2014
|
+
notify: (message, level) => ctx.ui.notify(message, level),
|
|
2015
|
+
});
|
|
2016
|
+
|
|
2017
|
+
fleetActions = createFleetActions<AgentState, ResearchState>({
|
|
2018
|
+
getRows: () => fleetSource.rows(Date.now(), { showFinished: true }),
|
|
2019
|
+
getAgents: () => agentStates,
|
|
2020
|
+
getResearch: () => researchStates,
|
|
2021
|
+
parseResearchHandle,
|
|
2022
|
+
displayName,
|
|
2023
|
+
modelWorkBlocked: modelWorkBlockedByRosterRecovery,
|
|
2024
|
+
restartSpecialist: researchControls.restartSpecialist,
|
|
2025
|
+
removeResearch: researchControls.remove,
|
|
2026
|
+
killSpecialistProcess: state => { fenceOperatorCancel(state); cancelLocalOwnedProcess({ process: state.proc, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), treeKill: killPiTree }); },
|
|
2027
|
+
abortComs: state => { state.comsAbort?.(); },
|
|
2028
|
+
openDetail: openFleetDetail,
|
|
2029
|
+
generation: () => fleetUiGeneration,
|
|
2030
|
+
});
|
|
2031
|
+
let fleetShowFinished = false;
|
|
2032
|
+
let fleetFilter = "";
|
|
2033
|
+
const fleetDashboard = createFleetDashboard<AgentDef, AgentState, ResearchState>({
|
|
2034
|
+
onThinkingChanged: updateWidget,
|
|
2035
|
+
openSystem1: ctx => openSystem1Communication(ctx, communicationStore),
|
|
2036
|
+
getFleetRows: (now, unfiltered) => fleetSource.rows(now, unfiltered ? { showFinished: true } : { showFinished: fleetShowFinished, query: fleetFilter }),
|
|
2037
|
+
getTaskTriage: () => fleetSource.snapshot(Date.now()).taskTriage,
|
|
2038
|
+
getProactive: () => fleetSource.snapshot(Date.now()).proactive,
|
|
2039
|
+
readProactiveEvidence: (finding) => proactiveRuntime?.findings.readback(finding.snapshotHandle, finding.snapshotHash, finding.snapshotId, finding.unitId, finding.excerptHash) ?? null,
|
|
2040
|
+
actions: fleetActions,
|
|
2041
|
+
getAgents: () => agentStates,
|
|
2042
|
+
getResearch: () => researchStates,
|
|
2043
|
+
getShowFinished: () => fleetShowFinished,
|
|
2044
|
+
setShowFinished: value => { fleetShowFinished = value; },
|
|
2045
|
+
getFilter: () => fleetFilter,
|
|
2046
|
+
setFilter: value => { fleetFilter = value; },
|
|
2047
|
+
parseResearchHandle,
|
|
2048
|
+
displayName,
|
|
2049
|
+
shortModel,
|
|
2050
|
+
thinkingSuffix,
|
|
2051
|
+
modelWithThinking,
|
|
2052
|
+
resolvedThinking,
|
|
2053
|
+
abbreviatePeerModel: abbreviateModel,
|
|
2054
|
+
modelPolicy,
|
|
2055
|
+
loadAvailableModels: loadAvailableModelChoices,
|
|
2056
|
+
openDetail: openFleetDetail,
|
|
2057
|
+
openHistory: ctx => openHistory(ctx, executionHistory, () => (activeTeamName ? `Team: ${activeTeamName}` : "Agent Hub")),
|
|
2058
|
+
openConfig: ctx => fleetConfigUi.open(ctx as ExtensionContext),
|
|
2059
|
+
modelWorkBlocked: modelWorkBlockedByRosterRecovery,
|
|
2060
|
+
restartSpecialist: researchControls.restartSpecialist,
|
|
2061
|
+
removeResearch: researchControls.remove,
|
|
2062
|
+
killSpecialistProcess: state => { fenceOperatorCancel(state); cancelLocalOwnedProcess({ process: state.proc, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), treeKill: killPiTree }); },
|
|
2063
|
+
abortComs: state => { state.comsAbort?.(); },
|
|
2064
|
+
getComsLines: (width, theme) => poolPresentation.render(width, theme),
|
|
2065
|
+
getConnectionLines: (width) => {refreshConnections();const lines=connectionLines(connectionControl.rows());return ['Bounded private policy inventory; refresh every 2s',...(lines.length?lines:['No connection observed; absence is not proof of no saved grants'])].map(line=>truncateToWidth(line,width));},
|
|
2066
|
+
});
|
|
2067
|
+
const { fleetRows, openFleetDashboard: openFleetDashboardRaw } = fleetDashboard;
|
|
2068
|
+
const openFleetDashboard = (ctx: any, startSubstitution = false) => gridUI.withSuspended(() => openFleetDashboardRaw(ctx, startSubstitution));
|
|
2069
|
+
|
|
2070
|
+
const contextBudgetUi = createContextBudgetUi<AgentDef, AgentState, ResearchState>({
|
|
2071
|
+
getAgents: () => agentStates,
|
|
2072
|
+
getResearch: () => researchStates,
|
|
2073
|
+
getAllDefs: () => allAgentDefs,
|
|
2074
|
+
getResearchPersonas: () => researchPersonas,
|
|
2075
|
+
getPeers: () => peerCards.values(),
|
|
2076
|
+
modelPolicy,
|
|
2077
|
+
displayName,
|
|
2078
|
+
getProjectDocsPaths: () => projectDocsPaths,
|
|
2079
|
+
getUserLanguage: () => userLanguage,
|
|
2080
|
+
getDelegateExtensionPath: () => delegateExtPath,
|
|
2081
|
+
safeAgentKey,
|
|
2082
|
+
projectPolicyPaths: specialistProjectPolicyPaths,
|
|
2083
|
+
modelWindowLookup,
|
|
2084
|
+
getResearchTools: () => RESEARCH_TOOLS,
|
|
2085
|
+
getPromptLedger: () => lastHubLedger,
|
|
2086
|
+
getPressureState: () => contextPressureState,
|
|
2087
|
+
buildHubSystemPrompt: () => { buildHubSystemPrompt(); },
|
|
2088
|
+
getAllTools: () => typeof pi.getAllTools === "function" ? pi.getAllTools() : [],
|
|
2089
|
+
getActiveTools: () => typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [],
|
|
2090
|
+
getCommands: () => typeof pi.getCommands === "function" ? pi.getCommands() : [],
|
|
2091
|
+
});
|
|
2092
|
+
const { openContextBudget } = contextBudgetUi;
|
|
2093
|
+
|
|
2094
|
+
// A delegate child anywhere in the team, by its id (e.g. "quality-1").
|
|
2095
|
+
function findDelegationChild(arg: string): { child: DelegationChild; owner: AgentState } | null {
|
|
2096
|
+
const lower = arg.toLowerCase();
|
|
2097
|
+
for (const state of agentStates.values()) {
|
|
2098
|
+
const child = Array.from(state.delegations?.values() ?? []).find(candidate => candidate.id.toLowerCase() === lower);
|
|
2099
|
+
if (child) return { child, owner: state };
|
|
2100
|
+
}
|
|
2101
|
+
return null;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
const completions = createCompletionPresentation({
|
|
2105
|
+
getAgents: () => agentStates.values(), getResearch: () => researchStates.values(),
|
|
2106
|
+
getResearchPersonas: () => researchPersonas, getModelProfiles: () => modelProfiles,
|
|
2107
|
+
getPeers: peersInScope, displayName, shortModel, resolvedModel, resolvedThinking,
|
|
2108
|
+
resolveThinkingLevel, resolvedSubagentModel,
|
|
2109
|
+
getSubagentOverride: (persona, role) => modelPolicy.getSubagentOverride(persona, role),
|
|
2110
|
+
getSubstitutionSources: () => modelPolicy.allKnownModels().map(spec => {
|
|
2111
|
+
const target = modelPolicy.getSubstitution(spec);
|
|
2112
|
+
return { spec, label: target ? `${spec} → ${target} (active this session)` : spec };
|
|
2113
|
+
}),
|
|
2114
|
+
});
|
|
2115
|
+
|
|
2116
|
+
registerInputShortcuts(pi, {
|
|
2117
|
+
setWidgetContext: ctx => { widgetCtx = ctx; }, openFleetDashboard,
|
|
2118
|
+
toggleFleetWidget: () => gridUI.toggle(),
|
|
2119
|
+
workModeStatusText, openWorkModePicker,
|
|
2120
|
+
openFleetConfig: ctx => openFleetConfig(ctx),
|
|
2121
|
+
});
|
|
2122
|
+
|
|
2123
|
+
// Root owns subscription order; lifecycle modules own handler bodies.
|
|
2124
|
+
registerTurnPresence(pi, {
|
|
2125
|
+
beforeAgentPresence: () => turnHandlers.beforeAgentPresence(),
|
|
2126
|
+
});
|
|
2127
|
+
|
|
2128
|
+
// /af-handoff <peer> — hand the session off to a coms peer. Per decision G1 we do NOT
|
|
2129
|
+
// extract the compaction summary; instead we ask the dispatcher LLM (next turn) to
|
|
2130
|
+
// compose a SELF-CONTAINED brief and coms_send it, then await + relay the reply.
|
|
2131
|
+
// /af-compound [focus] — end-of-session compound-learning pass. Mirrors /af-handoff's
|
|
2132
|
+
// shape: the dispatcher LLM (which saw the whole session) composes the
|
|
2133
|
+
// candidate-lessons brief itself, gates it on the user, then dispatches the
|
|
2134
|
+
// documenter to land the approved lessons per skills/compound-learning/SKILL.md.
|
|
2135
|
+
// The rules/docs targets come from the overrides file; artifacts travel as
|
|
2136
|
+
// paths through the dispatch's `artifacts` array, never as pasted bodies.
|
|
2137
|
+
// ── ask_user wait tracking (for /af-agents-history real-work) ──
|
|
2138
|
+
// pi-ask-user blocks the dispatcher turn while the human answers. Bracket each
|
|
2139
|
+
// ask_user call with its tool_execution start/end so /af-agents-history can subtract
|
|
2140
|
+
// that "away from keyboard" time from the dispatcher's real work.
|
|
2141
|
+
// T11 production pre-effect gate: operator direct side effects use the same task-scoped process state as child dispatch.
|
|
2142
|
+
pi.on("tool_call", async (event: any, ctx) => {
|
|
2143
|
+
const toolName = String(event.toolName || "").toLowerCase();
|
|
2144
|
+
const block = processBlock();
|
|
2145
|
+
const gate = ["bash", "edit", "write"].includes(toolName) ? processPreEffectGate(processState, "write") : null;
|
|
2146
|
+
const finishPolicy = beginRuntimeTrace(pi.events, { kind: "policy", id: `process:${event.toolCallId}`, parentId: String(event.toolCallId), source: "process", tool: toolName, rule: block?.reason ?? gate?.reason ?? "no_process_hold", reason: block?.reason ?? gate?.reason });
|
|
2147
|
+
try {
|
|
2148
|
+
// set_task_tier binds the fence. ask_user is the human supersession path. Every other tool is a diversion.
|
|
2149
|
+
// The first assistant step may emit several tools together. Refuse that whole step without aborting,
|
|
2150
|
+
// so the model can still call set_task_tier. Abort only a later step that ignores the hint; terminate
|
|
2151
|
+
// alone cannot stop siblings whose calls already returned.
|
|
2152
|
+
if (block && toolName !== "set_task_tier" && toolName !== "ask_user") {
|
|
2153
|
+
const decision = transitionToolDecision(transitionHintDelivered, transitionDiversions, block.message);
|
|
2154
|
+
transitionDiversions = decision.nextCount;
|
|
2155
|
+
transitionBatchRefused = true;
|
|
2156
|
+
if (decision.terminate) ctx?.abort?.();
|
|
2157
|
+
finishPolicy({ status: "blocked" });
|
|
2158
|
+
return { block: true, terminate: decision.terminate, reason: decision.reason };
|
|
2159
|
+
}
|
|
2160
|
+
if (!["bash", "edit", "write"].includes(toolName)) return;
|
|
2161
|
+
if (!gate) return;
|
|
2162
|
+
if (gate.reason !== "action_confirmation_unsupported") { finishPolicy({ status: "blocked" }); return { block: true, reason: gate.message }; }
|
|
2163
|
+
const bound = taskTriage?.current;
|
|
2164
|
+
// Pi's tool_call contract provides the exact call id and input; absent fields cannot be bound.
|
|
2165
|
+
if (!bound || bound.taskId !== noProgress.taskId() || !event.toolCallId || !event.input || !ctx) { finishPolicy({ status: "blocked" }); return { block: true, reason: gate.message }; }
|
|
2166
|
+
const action = { taskId: bound.taskId, inputRevision: bound.revision, actionId: String(event.toolCallId), operation: String(event.toolName), target: crypto.createHash("sha256").update(JSON.stringify(event.input)).digest("hex"), cwd: ctx.cwd };
|
|
2167
|
+
const observeAction = (status: TaskTriageActionObservation) => {
|
|
2168
|
+
try { const record = taskTriageActionAuditRecord(action, status); if (record) pi.appendEntry("agent-hub-task-triage-action-observation", record); }
|
|
2169
|
+
catch { /* Diagnostic trace cannot alter effect authorization. */ }
|
|
2170
|
+
};
|
|
2171
|
+
observeAction("requested");
|
|
2172
|
+
let presentationFailure = "";
|
|
2173
|
+
const grant = await confirmTaskTriageAction(action, {
|
|
2174
|
+
relay:permissionRelay,permissionAudit:entry=>pi.appendEntry('task-triage-permission-decision',entry),
|
|
2175
|
+
presentationRefused: reason => { presentationFailure = `Task-triage approval was not shown: ${reason}. Exact action presentation refused; no authorization issued.`; },
|
|
2176
|
+
taskId: () => noProgress.taskId(), inputRevision: () => taskTriage?.current?.revision ?? "",
|
|
2177
|
+
ask: (id, question, askCtx, signal) => requestRuntimeAsk(pi.events, id, question, askCtx, signal, { parentId: action.actionId, source: "task-triage" }, 'permission'),
|
|
2178
|
+
startWait: id => executionHistory.startAskUser(id), endWait: (id, sameTask) => { const wait = executionHistory.endAskUser(id, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
|
|
2179
|
+
}, ctx, contract => { pi.appendEntry("agent-hub-task-triage-action-grant", contract); return true; }, undefined, { input: event.input, cwd: ctx.cwd });
|
|
2180
|
+
if (processBlock() || ctx.cwd !== action.cwd || String(event.toolName) !== action.operation || String(event.toolCallId) !== action.actionId
|
|
2181
|
+
|| noProgress.taskId() !== action.taskId || taskTriage?.current?.revision !== action.inputRevision
|
|
2182
|
+
|| crypto.createHash("sha256").update(JSON.stringify(event.input)).digest("hex") !== action.target) { finishPolicy({ status: "blocked" }); return { block: true, reason: "Action changed while confirmation was pending; effect refused." }; }
|
|
2183
|
+
if (!grant || !consumeActionGrant(grant, action)) { observeAction("not_granted"); finishPolicy({ status: "blocked" }); return { block: true, reason: presentationFailure || gate.message }; }
|
|
2184
|
+
try { pi.appendEntry("agent-hub-task-triage-action-consumed", action); }
|
|
2185
|
+
catch { observeAction("consumption_failed"); finishPolicy({ status: "blocked" }); return { block: true, reason: "One-use authorization consumption could not be persisted; effect refused." }; }
|
|
2186
|
+
} catch (error) { finishPolicy({ status: "failed" }); throw error; }
|
|
2187
|
+
finally { finishPolicy({ status: "allowed" }); }
|
|
2188
|
+
});
|
|
2189
|
+
pi.on("tool_execution_start", async event => turnHandlers.toolStart(event));
|
|
2190
|
+
observeAskUserResults(({ params, result, phase }) => {
|
|
2191
|
+
const pack = capabilityConfirmationPack(params.context);
|
|
2192
|
+
if (!pack) return;
|
|
2193
|
+
if (phase === "start") workModePolicy.setCapabilityConfirmation(pack, "pending");
|
|
2194
|
+
else {
|
|
2195
|
+
const outcome = confirmationOutcome(result);
|
|
2196
|
+
if (!outcome) return;
|
|
2197
|
+
workModePolicy.setCapabilityConfirmation(pack, outcome);
|
|
2198
|
+
resolveIncomingCapabilities("");
|
|
2199
|
+
applyWorkModeTools();
|
|
2200
|
+
}
|
|
2201
|
+
});
|
|
2202
|
+
|
|
2203
|
+
pi.on("tool_execution_end", async event => turnHandlers.toolEnd(event));
|
|
2204
|
+
|
|
2205
|
+
// ── System Prompt Override ───────────────────
|
|
2206
|
+
|
|
2207
|
+
|
|
2208
|
+
const hubPromptCtx: HubPromptContext = {
|
|
2209
|
+
getTriageBeforeDispatch: () => triageRuntime?.orchestratorBeforeDispatch === true,
|
|
2210
|
+
getAgenticAskMode: () => agenticHubRuntime(pi)?.mode ?? "off",
|
|
2211
|
+
getArtifactRoot: () => sessionDir ? artifactsRoot() : null,
|
|
2212
|
+
getCapabilityResolution,
|
|
2213
|
+
getActiveTools: () => pi.getActiveTools(),
|
|
2214
|
+
getToolCatalogNotice: () => [latestToolCatalogDelta ? toolCatalogNotice(latestToolCatalogDelta) : "", latestUnknownToolNotice].filter(Boolean).join("\n"),
|
|
2215
|
+
getAgents: () => Array.from(agentStates.values()).map(state => ({
|
|
2216
|
+
name: state.def.name,
|
|
2217
|
+
displayName: displayName(state.def.name),
|
|
2218
|
+
description: state.def.description,
|
|
2219
|
+
tools: state.def.tools,
|
|
2220
|
+
})),
|
|
2221
|
+
getResearchPersonas: () => researchPersonas.map(def => ({
|
|
2222
|
+
name: def.name,
|
|
2223
|
+
displayName: displayName(def.name),
|
|
2224
|
+
description: def.description,
|
|
2225
|
+
model: resolvedModel(def),
|
|
2226
|
+
thinking: resolveThinkingLevel(resolvedThinking(def)),
|
|
2227
|
+
})),
|
|
2228
|
+
getPromptState: () => ({
|
|
2229
|
+
requirements: assertions.map(a=>({id:a.id,text:a.text,source:a.source,reference:a.reference,criticalConditions:a.criticalConditions,recordedStatus:a.status,evidenceRevision:a.evidenceRevision,evidenceTaskId:a.evidenceTaskId})),
|
|
2230
|
+
taskTier: taskTier ?? DEFAULT_TASK_TIER,
|
|
2231
|
+
taskTierAssumed,
|
|
2232
|
+
processRisk: processState.risk,
|
|
2233
|
+
processScope: processState.scope,
|
|
2234
|
+
processOpen: Object.entries(evaluateProcessObligations(processState, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }).obligations).filter(([, value]) => value.status === "open").map(([name]) => name),
|
|
2235
|
+
turnDispatchCount,
|
|
2236
|
+
turnResearchCount,
|
|
2237
|
+
taskDispatchCount,
|
|
2238
|
+
taskResearchCount,
|
|
2239
|
+
taskReviewRounds,
|
|
2240
|
+
provisionalConfirmations: getCapabilityResolution().provisional
|
|
2241
|
+
.filter(pack => workModePolicy.getCapabilityConfirmation()[pack as ConfirmableCapabilityPack] !== "declined")
|
|
2242
|
+
.map(pack => ({
|
|
2243
|
+
pack,
|
|
2244
|
+
reason: getCapabilityResolution().reasons[pack],
|
|
2245
|
+
question: capabilityConfirmationQuestion(pack as ConfirmableCapabilityPack),
|
|
2246
|
+
})),
|
|
2247
|
+
}),
|
|
2248
|
+
getWorkMode,
|
|
2249
|
+
getActiveTeamName: () => activeTeamName,
|
|
2250
|
+
getUserLanguage: () => userLanguage,
|
|
2251
|
+
getRulesProtocol: buildRulesProtocol,
|
|
2252
|
+
getDocsProtocol: buildDocsProtocol,
|
|
2253
|
+
isAskUserAvailable: () => askUserAvailable,
|
|
2254
|
+
isComsReady: () => comsReady,
|
|
2255
|
+
getIdentity: () => identity,
|
|
2256
|
+
isHerdrFleetReady: () => herdrFleetReady,
|
|
2257
|
+
};
|
|
2258
|
+
|
|
2259
|
+
// This is also called by /af-context before the first turn. Keep prompt assembly
|
|
2260
|
+
// in this one production path so its ledger describes the exact next replacement.
|
|
2261
|
+
function buildHubSystemPrompt(): { systemPrompt: string } {
|
|
2262
|
+
const built = assembleHubPrompt(hubPromptCtx);
|
|
2263
|
+
lastHubLedger = built.ledger;
|
|
2264
|
+
const names = new Set(Array.from(agentStates.values(), s => s.def.name.toLowerCase()));
|
|
2265
|
+
const missingRoles = missingProcessRoleRecoveryHints(processState, names);
|
|
2266
|
+
const additions = activeAdditionRecoveryHints(processState, noProgress.taskId(), taskTriage?.current?.revision);
|
|
2267
|
+
return { systemPrompt: `${built.systemPrompt}\n\nTask-triage (experimental, uncertain): ${JSON.stringify(taskTriage?.status ?? { status: "skipped", detail: "consumer_off" })}. This does not change budget or authorize effects.${processBlock() ? ` BLOCKED: ${processBlock()!.message}` : ""}${missingRoles ? ` ${missingRoles} Never auto-raise tier or substitute an unrelated role.` : ""}${additions ? ` ${additions}` : ""}` };
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
const turnHandlers = createTurnLifecycleHandlers({
|
|
2271
|
+
setTurnState: state => coms.setTurnState(state),
|
|
2272
|
+
finishMonitorTurn: () => { if (monitorBridge && monitorTurnId) { monitorBridge.finishParent(monitorTurnId, "completed"); monitorTurnId = null; } },
|
|
2273
|
+
startMonitorTurn: () => { if (monitorBridge && monitorHubId) { monitorTurnId = `hub-turn-${monitorHubId}-${crypto.randomUUID()}`; monitorBridge.startParent({ id: monitorTurnId, hubInstanceId: monitorHubId, checkoutId: currentCtx?.cwd || process.cwd() }); } },
|
|
2274
|
+
startAskUser: id => executionHistory.startAskUser(id), endAskUser: (id, at) => executionHistory.endAskUser(id, at),
|
|
2275
|
+
acknowledgeExternalBlocker: () => { externalBlockerAcknowledged = true; externalBlockerRefusedOnce = false; },
|
|
2276
|
+
addAskUserWait: waitMs => { if (waitMs > 0) taskClock = addTaskClockWait(taskClock, waitMs); },
|
|
2277
|
+
applyWorkMode: applyWorkModeTools, closeTurnActiveTime, openTaskClock: at => { taskClock = openTaskClock(taskClock, at); }, startHistoryTurn: at => executionHistory.startTurn(at),
|
|
2278
|
+
resetTurnBudgetState: () => {
|
|
2279
|
+
turnDispatchCount = 0; turnResearchCount = 0; turnDispatchFingerprints.clear(); externalBlockerAcknowledged = true; externalBlockerRefusedOnce = false;
|
|
2280
|
+
if (turnReport.dispatches.length > 0 || turnReport.research > 0 || turnReport.refusals > 0) { lastTurnReport = turnReport; sessionTotals.turns++; }
|
|
2281
|
+
turnReport = freshTurnReport();
|
|
2282
|
+
},
|
|
2283
|
+
updateModeStatus, buildPrompt: buildHubSystemPrompt, endHistoryTurn: at => executionHistory.endTurn(at),
|
|
2284
|
+
unaddressedPeerWarning: () => unaddressedPeerSweep(Array.from(hubSpawnedPeers.values()))?.message ?? null,
|
|
2285
|
+
settlePeerTurn: ctx => coms.settleTurn(ctx, { dispatchQueued: false }),
|
|
2286
|
+
settlePressure: ctx => pressureLifecycle.agentSettled(ctx),
|
|
2287
|
+
dispatchQueuedPeerTurn: () => coms.dispatchQueued(),
|
|
2288
|
+
});
|
|
2289
|
+
pi.on("before_agent_start", async () => {
|
|
2290
|
+
if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
|
|
2291
|
+
try { fs.appendFileSync(process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD, JSON.stringify({ pid: process.pid, phase: "before_agent_start", consumerPresent: !!taskTriage, consumerStatus: taskTriage?.status.status ?? null, consumerDetail: taskTriage?.status.detail ?? null, calls: taskTriage?.calls ?? null, processPersistenceBlocked, rosterBlocked: !!currentCtx && modelWorkBlockedByRosterRecovery(currentCtx), pendingTaskTransition }) + "\n"); } catch { /* diagnostic only */ }
|
|
2292
|
+
}
|
|
2293
|
+
// Pressure/roster recovery gates run first; assessment runs before this model input.
|
|
2294
|
+
if (taskTriage && !processPersistenceBlocked && (!currentCtx || !modelWorkBlockedByRosterRecovery(currentCtx))) {
|
|
2295
|
+
// Persist the first task identity before binding a pre-model assessment:
|
|
2296
|
+
// compaction/resume must not mint a new ID for the same cached input.
|
|
2297
|
+
try { noProgress.persistTaskIdentity(); } catch { processPersistenceBlocked = true; }
|
|
2298
|
+
const assessment = processPersistenceBlocked ? null : await taskTriage.evaluate(noProgress.taskId());
|
|
2299
|
+
// Guarded offline fixture diagnostics: metadata only, never task text or provider payload.
|
|
2300
|
+
if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
|
|
2301
|
+
try { fs.appendFileSync(process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD, JSON.stringify({ pid: process.pid, phase: "assessment", inputRevision: assessment?.revision ?? null, fingerprint: assessment?.fingerprint ?? null, taskId: assessment?.taskId ?? null, status: assessment?.assessment.status ?? null, calls: taskTriage.calls, pendingTaskTransition, processPersistenceBlocked }) + "\n"); } catch { /* diagnostic only */ }
|
|
2302
|
+
}
|
|
2303
|
+
if (assessment && !pendingTaskTransition && !processPersistenceBlocked) {
|
|
2304
|
+
try {
|
|
2305
|
+
const next = applyTaskTriageAdditions(processState, assessment.assessment, { taskId: assessment.taskId, evaluationId: assessment.evaluationId, inputRevision: assessment.revision });
|
|
2306
|
+
if(JSON.stringify(next)!==JSON.stringify(normalizeProcessState(processState))) {
|
|
2307
|
+
pi.appendEntry("agent-hub-process-state", processAuditRecord(next, evaluateProcessObligations(next, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER })));
|
|
2308
|
+
processState = next;
|
|
2309
|
+
}
|
|
2310
|
+
} catch { processPersistenceBlocked = true; }
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
// Assessment can open a plan/review lease after input resolved its original packs.
|
|
2314
|
+
if (taskTriage) workModePolicy.refreshCapabilities();
|
|
2315
|
+
const result = turnHandlers.beforeAgentStart();
|
|
2316
|
+
toolCatalogRuntime.beginTurn();
|
|
2317
|
+
return result;
|
|
2318
|
+
});
|
|
2319
|
+
|
|
2320
|
+
const pressureLifecycle = createContextPressureLifecycle({
|
|
2321
|
+
continuity: { pi, runtimeVersion: currentPiRuntimeVersion(), taskIdentity: (() => { let token: object | undefined, revision=0; return () => { const next=noProgress.taskToken(); if(next!==token){token=next;revision++;} return {task:noProgress.taskId(),revision}; }; })() },
|
|
2322
|
+
getState: () => pressureRootState,
|
|
2323
|
+
setPressure: value => { contextPressureState = value; pressureRootState.pressure = value; },
|
|
2324
|
+
getCurrentContext: () => currentCtx,
|
|
2325
|
+
appendEntry: (type, data) => pi.appendEntry(type, data),
|
|
2326
|
+
sendUserMessage: (content, options) => pi.sendUserMessage(content as any, options),
|
|
2327
|
+
resolveCapabilities: resolveIncomingCapabilities, applyWorkMode: applyWorkModeTools,
|
|
2328
|
+
modelWorkBlocked: modelWorkBlockedByRosterRecovery,
|
|
2329
|
+
onAcceptedInput: (text, source, replayed) => {
|
|
2330
|
+
if ((source === "extension" && !replayed) || !text.trim()) return;
|
|
2331
|
+
if(hubTaskText && isTaskContinuation(text))return;
|
|
2332
|
+
if (evaluatedTaskTriageInputChanged(taskTriage?.current ?? null, text)) { pendingTaskTransition = true; transitionDiversions = 0; transitionHintDelivered = false; transitionBatchRefused = false; try { pi.appendEntry(TASK_TRANSITION_ENTRY_TYPE, { pending: true }); } catch { processPersistenceBlocked = true; } }
|
|
2333
|
+
hubTaskText = text;
|
|
2334
|
+
executionTrace.input(crypto.randomUUID());
|
|
2335
|
+
try { noProgress.persistTaskIdentity(); acceptDamageGuardInput(pi, text); bindSemanticScope(noProgress.taskId(), createHash("sha256").update(text).digest("hex")); } catch { processPersistenceBlocked = true; }
|
|
2336
|
+
taskTriage?.input(text, "interactive");
|
|
2337
|
+
},
|
|
2338
|
+
});
|
|
2339
|
+
function replayDeferredRecoveryInputs(): void { pressureLifecycle.replayDeferred(); }
|
|
2340
|
+
pi.on("message_end", async (event, ctx) => {
|
|
2341
|
+
const diagnostics = observeUnknownToolCalls({ message: event.message, catalog: toolCatalogRuntime.catalogForMessage(), taskId: unknownToolCounter.snapshot().activeTaskId || noProgress.taskId(), counter: unknownToolCounter, seenCallIds: seenUnknownToolCalls });
|
|
2342
|
+
for (const diagnostic of diagnostics) {
|
|
2343
|
+
latestUnknownToolNotice = unknownToolNotice(diagnostic);
|
|
2344
|
+
try { pi.appendEntry(UNKNOWN_TOOL_COUNTER_ENTRY_TYPE, { snapshot: unknownToolCounter.snapshot(), diagnostic }); } catch {}
|
|
2345
|
+
}
|
|
2346
|
+
pressureLifecycle.messageEnd(event, ctx);
|
|
2347
|
+
});
|
|
2348
|
+
pi.on("turn_start", event => { orchestratorSelfReadUsed = 0; hubCapture.start(event.turnIndex); });
|
|
2349
|
+
pi.on("turn_end", async (event, ctx) => {
|
|
2350
|
+
if (transitionBatchRefused && pendingTaskTransition) transitionHintDelivered = true;
|
|
2351
|
+
transitionBatchRefused = false;
|
|
2352
|
+
await pressureLifecycle.turnEnd(ctx);
|
|
2353
|
+
const text = event.message.role === "assistant" ? event.message.content.filter(c => c.type === "text").map(c => c.text).join("") : "";
|
|
2354
|
+
hubCapture.end(event.turnIndex, text);
|
|
2355
|
+
});
|
|
2356
|
+
// Stable historical views keep the provider prompt cache valid between turns.
|
|
2357
|
+
const historyProjection = createHistoryProjectionMemo();
|
|
2358
|
+
pi.on("context", async (event, ctx) => {
|
|
2359
|
+
const projection=projectCoordinationHistory(event.messages,sessionDir,historyProjection);
|
|
2360
|
+
if(projection.added)try{pi.appendEntry("agent-hub-context-projection",{projected:projection.projected,added:projection.added,savedBytes:projection.savedBytes});}catch{/* diagnostics cannot alter the model view */}
|
|
2361
|
+
pressureLifecycle.context(ctx);
|
|
2362
|
+
const context = hubCapture.hubContext();
|
|
2363
|
+
const text = context && proactiveRuntime?.feedback?.take("hub", "direct", context);
|
|
2364
|
+
if (text) { proactiveHubDeliveries++; return { messages: [...projection.messages, { role: "custom" as const, customType: "agent-fleet.proactive-advisory", content: text, display: false, timestamp: Date.now() }] }; }
|
|
2365
|
+
if(projection.projected)return {messages:projection.messages};
|
|
2366
|
+
});
|
|
2367
|
+
pi.on("session_compact", async (_event, ctx) => {
|
|
2368
|
+
noProgress.compact(ctx.sessionManager.getEntries());
|
|
2369
|
+
if (!processPersistenceBlocked) persistProcessVerdict(processState, evaluateProcessObligations(processState, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }));
|
|
2370
|
+
const result = toolCatalogRuntime.compact({
|
|
2371
|
+
mode: getWorkMode(), getEffectiveTools: () => pi.getActiveTools(),
|
|
2372
|
+
persist: (type, data) => pi.appendEntry(type, data), counterSnapshot: () => unknownToolCounter.snapshot(),
|
|
2373
|
+
retainCounter: () => unknownToolCounter.noteCompaction(),
|
|
2374
|
+
establishToolStateChange: (previous, next, evidenceRef) => noProgress.establishToolStateChange(previous, next, evidenceRef),
|
|
2375
|
+
settle: restored => pressureLifecycle.sessionCompact(restored),
|
|
2376
|
+
onError: error => { try { pi.appendEntry("agent-hub-tool-catalog-error", { reason: "compaction_restore", error: error instanceof Error ? error.message : String(error) }); } catch {} },
|
|
2377
|
+
});
|
|
2378
|
+
if (result) latestToolCatalogDelta = result.delta;
|
|
2379
|
+
});
|
|
2380
|
+
pi.on("input", async (event, ctx) => {
|
|
2381
|
+
const outcome = pressureLifecycle.input(event, ctx);
|
|
2382
|
+
return { action: outcome.action };
|
|
2383
|
+
});
|
|
2384
|
+
|
|
2385
|
+
// ── Session Start ────────────────────────────
|
|
2386
|
+
|
|
2387
|
+
let sessionOverrides: ReturnType<typeof parseAgentTeamOverrides> | undefined;
|
|
2388
|
+
let sessionSoloMode = false;
|
|
2389
|
+
const monitorSession = createMonitorSession({
|
|
2390
|
+
pi,
|
|
2391
|
+
getBridge: () => monitorBridge, setBridge: value => { monitorBridge = value; },
|
|
2392
|
+
getLifecycle: () => monitorLifecycle, setLifecycle: value => { monitorLifecycle = value; },
|
|
2393
|
+
setHubId: value => { monitorHubId = value; },
|
|
2394
|
+
getOwnerId: () => monitorOwnerId, setOwnerId: value => { monitorOwnerId = value; },
|
|
2395
|
+
queueDepth: () => inboundQueue.size,
|
|
2396
|
+
});
|
|
2397
|
+
registerSessionOrchestration(pi, {
|
|
2398
|
+
resetSession: async (_ctx) => { await resetDamageGuardHub(pi); resetHubSession(_ctx, {
|
|
2399
|
+
registerVersion: registerVersionStatus, resetPressure: pressureLifecycle.reset,
|
|
2400
|
+
clearRosterRecovery: workModePolicy.clearRosterRecovery, captureBaselineTools: () => { baselineTools = pi.getActiveTools(); },
|
|
2401
|
+
resetAccessApproval: () => {codexNotifications?.stop();codexNotifications=undefined;accessApprovalRouter.reset();permissionRelay.reset();accessEpochs.clear();},
|
|
2402
|
+
terminateResearch: () => { for (const st of researchStates.values()) if (st.proc && st.status === "running") { st.killedByOperator = true; st.proc.kill("SIGTERM"); } },
|
|
2403
|
+
resetResearch: researchRuntime.reset, resetHistory: executionHistory.reset,
|
|
2404
|
+
resetBudgets: () => { hubCapture.reset(); hubTaskText = undefined; proactiveRuntime = null; proactiveConfig = null; system1Snapshot = normalizeSystem1Config(null);
|
|
2405
|
+
resetAgenticHub(pi); resetDiscoveryHub(pi); proactiveHubDeliveries = 0; taskClock = createTaskClock(); noProgress.prepareSessionRestore(); resetUnknownToolCounterForCurrentTask(); toolCatalogRuntime.restore(catalogSnapshot(getWorkMode(), [])); latestToolCatalogDelta = null; },
|
|
2406
|
+
clearWidgets: _ctx => { fleetUiGeneration++; fleetActions?.reset(); gridUI.dispose(); },
|
|
2407
|
+
closeDelegationWatchers: () => { for (const st of agentStates.values()) { st.delegationsWatcher?.close(); st.delegationsWatcher = undefined; } },
|
|
2408
|
+
resetSessionState: ctx => { delegatedTokens = 0; hubSpawnedPeers.clear(); widgetCtx = ctx; contextWindow = ctx.model?.contextWindow || 0; gridUI.reset(); },
|
|
2409
|
+
resolveSafety: cwd => Boolean(safetyHarnessPath = resolveSafetyHarness(cwd)), resolveDelegate: cwd => { delegateExtPath = resolveDelegateExtension(cwd); },
|
|
2410
|
+
}); },
|
|
2411
|
+
restartMonitor: _ctx => monitorSession.restart(_ctx),
|
|
2412
|
+
initializeComs: async (_ctx) => {
|
|
2413
|
+
// ── Embedded coms init ──
|
|
2414
|
+
// Always refresh the ctx the coms handlers use. Bind the endpoint + register
|
|
2415
|
+
// in the pool exactly once per process (guard on comsReady), so a /new session
|
|
2416
|
+
// keeps the same peer identity rather than leaking a second socket. On any
|
|
2417
|
+
// failure we degrade: comsReady stays false and the coms_* tools are withheld.
|
|
2418
|
+
hubStateCtx.setCurrentContext(_ctx);
|
|
2419
|
+
sessionSoloMode = pi.getFlag("solo") === true;
|
|
2420
|
+
if (!comsReady && !sessionSoloMode) {
|
|
2421
|
+
try {
|
|
2422
|
+
identity = await coms.connect({ ctx: _ctx, defaultNamePrefix: "hub", defaultPurpose: "agent-hub dispatcher" });
|
|
2423
|
+
comsReady = true;
|
|
2424
|
+
try {
|
|
2425
|
+
_ctx.ui.setStatus("coms", `📡 ${identity.name}@${identity.project}`);
|
|
2426
|
+
} catch { /* hasUI may be false — non-fatal */ }
|
|
2427
|
+
} catch (err) {
|
|
2428
|
+
comsReady = false;
|
|
2429
|
+
try { _ctx.ui?.notify?.(`📡 coms: init failed — ${err instanceof Error ? err.message : String(err)} (coms tools disabled)`, "error"); } catch { /* ignore */ }
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
},
|
|
2433
|
+
initializeExemptions: (_ctx) => {
|
|
2434
|
+
try {
|
|
2435
|
+
system1Snapshot = loadSystem1Snapshot(_ctx.cwd || process.cwd());
|
|
2436
|
+
const config = loadProactiveConfig(_ctx.cwd || process.cwd(), system1Snapshot);
|
|
2437
|
+
if (isCaptureEnabled(config)) proactiveConfig = config;
|
|
2438
|
+
} catch { /* invalid config fails closed */ }
|
|
2439
|
+
// ── Damage-control shared exemptions file ──
|
|
2440
|
+
// One per hub session (solo mode included). Exporting the path on our own
|
|
2441
|
+
// process.env lets the co-loaded damage-control-continue mirror /af-allow
|
|
2442
|
+
// session grants into the same file the spawned children read.
|
|
2443
|
+
if (!exemptionsFile) {
|
|
2444
|
+
hubStateCtx.setExemptionsFile(exemptionsFilePath(identity?.session_id ?? `hub-solo-${process.pid}`));
|
|
2445
|
+
process.env[EXEMPTIONS_FILE_ENV] = exemptionsFile!;
|
|
2446
|
+
}
|
|
2447
|
+
},
|
|
2448
|
+
loadAgents: (_ctx) => {
|
|
2449
|
+
// Allocate a fresh namespace; shared legacy files belong to prior/live sessions.
|
|
2450
|
+
sessionOverrides = parseAgentTeamOverrides(_ctx.cwd);
|
|
2451
|
+
fleetConfigUi.recordBaseline(_ctx.cwd);
|
|
2452
|
+
try {
|
|
2453
|
+
const config = loadProactiveConfig(_ctx.cwd,system1Snapshot,sessionOverrides.policyRoots);
|
|
2454
|
+
proactiveConfig = isCaptureEnabled(config) ? config : null;
|
|
2455
|
+
} catch { proactiveConfig = null; /* invalid consent fails closed */ }
|
|
2456
|
+
runHistoryKeep = sessionOverrides.runHistoryKeep;
|
|
2457
|
+
|
|
2458
|
+
loadAgents(_ctx.cwd);
|
|
2459
|
+
// Composition follows applyOverrides: approved roots and the shared service do not exist yet.
|
|
2460
|
+
|
|
2461
|
+
// Surface non-fatal persona frontmatter warnings (skipped subagents roles,
|
|
2462
|
+
// bad delegate_depth) once per session.
|
|
2463
|
+
const fmWarnings = allAgentDefs.flatMap(d => (d.warnings || []).map(w => `${d.name}: ${w}`));
|
|
2464
|
+
if (fmWarnings.length > 0) {
|
|
2465
|
+
_ctx.ui.notify(`Persona frontmatter warnings:\n${fmWarnings.join("\n")}`, "warning");
|
|
2466
|
+
}
|
|
2467
|
+
if (!delegateExtPath && allAgentDefs.some(d => d.subagents)) {
|
|
2468
|
+
_ctx.ui.notify(
|
|
2469
|
+
"delegate.ts not found next to agent-hub — `subagents:` declarations are inert (specialists dispatch without a delegate tool).",
|
|
2470
|
+
"warning",
|
|
2471
|
+
);
|
|
2472
|
+
}
|
|
2473
|
+
},
|
|
2474
|
+
applyOverrides: (_ctx) => {
|
|
2475
|
+
if (!sessionOverrides) throw new Error("session_start applyOverrides ran before loadAgents");
|
|
2476
|
+
watchdogSystem1 = disposeWatchdogSystem1Session(watchdogSystem1);
|
|
2477
|
+
communicationStore.dispose();
|
|
2478
|
+
triageRuntime?.dispose(); triageRuntime = null;
|
|
2479
|
+
taskTriage?.dispose(); taskTriage = null;
|
|
2480
|
+
taskTriageActivity?.dispose(); taskTriageActivity = null;
|
|
2481
|
+
try { watchdogActivity?.dispose(); } catch { /* trace disposal must not block the session */ }
|
|
2482
|
+
// Stable for a real session across snapshot replacement; G2 must not split one session into artificial samples.
|
|
2483
|
+
watchdogActivity = sessionDir ? createWatchdogActivity({ directory: `${sessionDir}/artifacts/watchdog`, sessionId: path.basename(sessionDir) }) : null;
|
|
2484
|
+
const taskTriageTestTransport = resolveTaskTriageTestTransport();
|
|
2485
|
+
taskTriageTestTransportActive = !!taskTriageTestTransport;
|
|
2486
|
+
watchdogSystem1 = createWatchdogSystem1Session({ ...readWatchdogSystem1Snapshot({
|
|
2487
|
+
cwd: _ctx.cwd,
|
|
2488
|
+
snapshot: system1Snapshot,
|
|
2489
|
+
configuredMode: sessionOverrides.watchdogSystem1Mode,
|
|
2490
|
+
watchdogSetting: sessionOverrides.watchdogSetting,
|
|
2491
|
+
env: process.env,
|
|
2492
|
+
transport: taskTriageTestTransport,
|
|
2493
|
+
warnings: sessionOverrides.warnings,
|
|
2494
|
+
}), wrapService: service => communicationStore.wrap(service, { provider: "typesafe", model: "jev-1.13.0" }) });
|
|
2495
|
+
const triageConfig = (system1Snapshot?.consumers.dispatchTriage.config ?? null) as TriageConfig | null;
|
|
2496
|
+
const taskTriageConfig = loadTaskTriageConfig(_ctx.cwd || process.cwd(), system1Snapshot);
|
|
2497
|
+
const sharedService = watchdogSystem1?.sharedService;
|
|
2498
|
+
configureAgenticHub(pi, { snapshot: system1Snapshot, service: sharedService, ctx: _ctx, sessionDir, communicationStore, taskId: () => noProgress.taskId() });
|
|
2499
|
+
configureDiscoveryHub(pi, { snapshot: system1Snapshot, service: sharedService, ctx: _ctx, sessionDir, communicationStore, taskId: () => noProgress.taskId() });
|
|
2500
|
+
const serviceUnavailableReason = watchdogSystem1?.readiness.status === "ready" ? "unavailable" : watchdogSystem1?.readiness.reason ?? "unavailable";
|
|
2501
|
+
taskTriageConfigured = taskTriageConfig.status !== "missing";
|
|
2502
|
+
taskTriageConfigStatus = taskTriageConfig.status === "active" ? "active" : taskTriageConfig.status === "invalid" ? "invalid" : "off";
|
|
2503
|
+
taskTriageActivity = taskTriageConfig.status === "active" ? createTaskTriageActivity({ directory: sessionDir ? path.join(sessionDir, "artifacts/task-triage-activity") : undefined }) : null;
|
|
2504
|
+
taskTriage = taskTriageConfig.status === "active" ? createTaskTriageRuntime({ root: _ctx.cwd || process.cwd(), service: worktreeConsumerService(sharedService,system1Snapshot.document,'taskTriage'), serviceUnavailableReason, persist: state => pi.appendEntry(TASK_TRIAGE_RUNTIME_ENTRY, state), observer: taskTriageActivity! }) : null;
|
|
2505
|
+
if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
|
|
2506
|
+
try { fs.appendFileSync(process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD, JSON.stringify({ pid: process.pid, phase: "service_init", configStatus: taskTriageConfig.status, consumerPresent: !!taskTriage, fakeTransportActive: taskTriageTestTransportActive, sharedServiceReady: !!sharedService, serviceUnavailableReason }) + "\n"); } catch { /* diagnostic only */ }
|
|
2507
|
+
}
|
|
2508
|
+
if (taskTriage && !sharedService) {
|
|
2509
|
+
try { _ctx.ui.notify(`Task triage is enabled but unavailable (${serviceUnavailableReason}); no inference or new requirements will be added. Existing process obligations remain enforced.`, "warning"); }
|
|
2510
|
+
catch { /* Optional UI must not change process enforcement. The prompt retains the status. */ }
|
|
2511
|
+
}
|
|
2512
|
+
triageRuntime = createTriageRuntime({ config: triageConfig, service: worktreeConsumerService(watchdogSystem1?.sharedService,system1Snapshot.document,'dispatchTriage'),
|
|
2513
|
+
current: input => triageInput(input.task,input.scope,input.language,input.domain),
|
|
2514
|
+
trace: event => pi.appendEntry("agent-hub-triage", event),
|
|
2515
|
+
});
|
|
2516
|
+
applySessionOverrides(_ctx, sessionOverrides, {
|
|
2517
|
+
setLanguage: value => { userLanguage = value; },
|
|
2518
|
+
setReconTimeout: value => { reconSearchTimeoutMs = value; }, setBudgetOverrides: value => { budgetOverrides = value; },
|
|
2519
|
+
setWatchdog: (setting, judge) => { watchdogSetting = setting; watchdogJudgeModel = judge; },
|
|
2520
|
+
resetTurnCounts: () => { turnDispatchCount = 0; turnResearchCount = 0; },
|
|
2521
|
+
// Session setup clears in-memory budgets before restore, not the saved task.
|
|
2522
|
+
// A persisted reset here would append a new task event after the old one.
|
|
2523
|
+
resetTaskWindow: () => resetTaskWindow(null, Date.now(), false), updateModeStatus,
|
|
2524
|
+
setProjectRules: value => { projectRulesDirs = value; }, setProjectDocs: value => { projectDocsPaths = value; },
|
|
2525
|
+
resetModelPolicy: () => {modelPolicy.reset();profileActivation.reset();applyWorkModeTools();}, getModelProfileErrors: () => modelProfileErrors, getAgentDefs: () => allAgentDefs, getModelProfiles: () => modelProfiles,
|
|
2526
|
+
deleteModelProfile: name => { delete modelProfiles[name]; }, allowedModels,
|
|
2527
|
+
getDispatchPolicyWarnings: () => dispatchPolicyWarnings, setResearchPersonas: value => { researchPersonas = value; },
|
|
2528
|
+
});
|
|
2529
|
+
if (proactiveConfig && sessionDir) {
|
|
2530
|
+
try { proactiveRuntime = composeHubProactive({ config: proactiveConfig, root: _ctx.cwd, sessionDir,
|
|
2531
|
+
rulesRoots: sessionOverrides.rulesDirs, policyRoots: sessionOverrides.policyRoots, service: worktreeConsumerService(watchdogSystem1?.sharedService,system1Snapshot.document,'proactiveReview'), capture: hubCapture, onChange: updateWidget }); }
|
|
2532
|
+
catch { proactiveRuntime = null; proactiveConfig = null; } // unavailable composition never reports reviewed
|
|
2533
|
+
}
|
|
2534
|
+
},
|
|
2535
|
+
restoreRoster: async (_ctx) => {
|
|
2536
|
+
// Explicit CLI selection wins; otherwise restore only the canonical team name
|
|
2537
|
+
// and re-resolve it against current teams.yaml/persona files. An explicit
|
|
2538
|
+
// Operator work mode suppresses an ambient persisted roster unless --agent-team
|
|
2539
|
+
// was also supplied.
|
|
2540
|
+
agentStates.clear();
|
|
2541
|
+
activeTeamName = "";
|
|
2542
|
+
comsMissNotified.clear();
|
|
2543
|
+
recomputeGrid();
|
|
2544
|
+
const sessionEntries = _ctx.sessionManager.getEntries();
|
|
2545
|
+
// Resume restores the persisted fence. A missing entry is the legacy clear state.
|
|
2546
|
+
pendingTaskTransition = latestPendingTaskTransition(sessionEntries);
|
|
2547
|
+
transitionDiversions = 0;
|
|
2548
|
+
transitionHintDelivered = false;
|
|
2549
|
+
transitionBatchRefused = false;
|
|
2550
|
+
try { processState = latestProcessState(sessionEntries); processPersistenceBlocked = false; }
|
|
2551
|
+
catch { processState = createProcessState(); processPersistenceBlocked = true; }
|
|
2552
|
+
taskTriage?.restore(sessionEntries);
|
|
2553
|
+
const savedTaskIds = new Set(processState.additions?.map(addition => addition.taskId));
|
|
2554
|
+
noProgress.restore(sessionEntries, savedTaskIds.size === 1 ? [...savedTaskIds][0] : undefined);
|
|
2555
|
+
if (processTaskIdentityConflicts(processState, noProgress.taskId())) processPersistenceBlocked = true;
|
|
2556
|
+
await configureDamageGuardHub(pi, { snapshot: system1Snapshot, service: watchdogSystem1?.sharedService, ctx: _ctx, taskId: () => noProgress.taskId(), childAuthority: { taskToken: () => noProgress.taskToken(), admit: () => !processBlock() } });
|
|
2557
|
+
if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
|
|
2558
|
+
try { fs.appendFileSync(process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD, JSON.stringify({ pid: process.pid, phase: "restore", processPersistenceBlocked, savedTaskIdCount: savedTaskIds.size, taskIdMatchesAddition: savedTaskIds.size === 1 && savedTaskIds.has(noProgress.taskId()), consumerPresent: !!taskTriage, calls: taskTriage?.calls ?? null, consumerStatus: taskTriage?.status.status ?? null }) + "\n"); } catch { /* diagnostic only */ }
|
|
2559
|
+
}
|
|
2560
|
+
const persistedCatalog = latestPersistedToolCatalog(sessionEntries);
|
|
2561
|
+
if (persistedCatalog) toolCatalogRuntime.restore(persistedCatalog);
|
|
2562
|
+
const persistedUnknownTools = latestPersistedUnknownToolCounter(sessionEntries);
|
|
2563
|
+
if (persistedUnknownTools) unknownToolCounter = restoreUnknownToolCounter(persistedUnknownTools, { limit: 3 });
|
|
2564
|
+
const explicitWorkMode = pi.getFlag("work-mode");
|
|
2565
|
+
const explicitRoster = pi.getFlag("agent-team");
|
|
2566
|
+
const hasExplicitRoster = typeof explicitRoster === "string" && explicitRoster.trim() !== "";
|
|
2567
|
+
const startupRoster = resolveSessionRoster({
|
|
2568
|
+
teams,
|
|
2569
|
+
entries: sessionEntries,
|
|
2570
|
+
explicitRoster,
|
|
2571
|
+
availablePersonas: allAgentDefs.map(def => def.name),
|
|
2572
|
+
includePersisted: !(explicitWorkMode === "operator" && !hasExplicitRoster),
|
|
2573
|
+
});
|
|
2574
|
+
workModePolicy.setRestoredWorkMode(resolveSessionWorkMode({
|
|
2575
|
+
entries: sessionEntries,
|
|
2576
|
+
explicitWorkMode,
|
|
2577
|
+
hasExplicitRoster: startupRoster.source === "explicit",
|
|
2578
|
+
}));
|
|
2579
|
+
if (startupRoster.roster) {
|
|
2580
|
+
activateTeam(startupRoster.roster.name);
|
|
2581
|
+
persistActiveRoster();
|
|
2582
|
+
}
|
|
2583
|
+
const rosterRecoveryRequired = orchestratorNeedsRoster(getWorkMode(), agentStates.size);
|
|
2584
|
+
const rosterRecoveryDiagnostic = rosterRecoveryRequired
|
|
2585
|
+
? startupRoster.diagnostic || "Persisted orchestrator work mode has no native roster."
|
|
2586
|
+
: "";
|
|
2587
|
+
workModePolicy.setRosterRecovery(rosterRecoveryRequired, rosterRecoveryDiagnostic);
|
|
2588
|
+
if (startupRoster.diagnostic) {
|
|
2589
|
+
_ctx.ui.notify(
|
|
2590
|
+
`${startupRoster.diagnostic} ${rosterRecoveryRequired ? "Model input is blocked until you select /af-agents-team, restart with --agent-team <name>, or switch explicitly with --work-mode operator." : "Continuing without that roster."}`,
|
|
2591
|
+
rosterRecoveryRequired ? "error" : "warning",
|
|
2592
|
+
);
|
|
2593
|
+
} else if (rosterRecoveryRequired) {
|
|
2594
|
+
_ctx.ui.notify(
|
|
2595
|
+
`${rosterRecoveryDiagnostic} Model input is blocked until you select /af-agents-team, restart with --agent-team <name>, or switch explicitly with --work-mode operator.`,
|
|
2596
|
+
"error",
|
|
2597
|
+
);
|
|
2598
|
+
}
|
|
2599
|
+
},
|
|
2600
|
+
resolveCapabilities: async (_ctx) => {
|
|
2601
|
+
// Probe for `ask_user` (registered by the `pi-ask-user` companion package
|
|
2602
|
+
// when installed). Action methods like getAllTools are runtime-only, so
|
|
2603
|
+
// this MUST happen at session_start, not at extension load.
|
|
2604
|
+
askUserAvailable = pi.getAllTools().some(t => t.name === "ask_user");
|
|
2605
|
+
|
|
2606
|
+
// Fleet tools are available only inside a herdr pane with a live server.
|
|
2607
|
+
// The work mode policy adds gated groups without activating unavailable tools.
|
|
2608
|
+
herdrFleetReady = herdrPaneId() !== null && (await herdrAvailable()) !== null;
|
|
2609
|
+
const persistedCapabilities = latestPersistedCapabilityState(_ctx.sessionManager.getEntries());
|
|
2610
|
+
workModePolicy.restoreCapabilities({ taskPacks: persistedCapabilities?.taskPacks ?? [], provisional: persistedCapabilities?.provisional ?? [], confirmation: persistedCapabilities?.confirmation ?? {} });
|
|
2611
|
+
resolveIncomingCapabilities("");
|
|
2612
|
+
applyWorkModeTools();
|
|
2613
|
+
if (pressureLifecycle.observe(_ctx, "session_start") === "compact-now") {
|
|
2614
|
+
setTimeout(() => pressureLifecycle.runCompaction(_ctx, "session_start"), 0);
|
|
2615
|
+
}
|
|
2616
|
+
workModePolicy.updateStatus(_ctx);
|
|
2617
|
+
},
|
|
2618
|
+
notifyStartup: (_ctx) => {
|
|
2619
|
+
_ctx.ui.setStatus("agent-team", `Native roster: ${activeTeamName || "(none)"} (${agentStates.size})`);
|
|
2620
|
+
const members = Array.from(agentStates.values()).map(s => displayName(s.def.name)).join(", ");
|
|
2621
|
+
const askUserLabel = askUserAvailable
|
|
2622
|
+
? "available (via pi-ask-user)"
|
|
2623
|
+
: "NOT AVAILABLE — run `pi install npm:pi-ask-user`";
|
|
2624
|
+
const comsLabel = comsReady && identity
|
|
2625
|
+
? `📡 ${identity.name}@${identity.project} — peers via coms_list; /af-handoff <peer> to delegate`
|
|
2626
|
+
: sessionSoloMode
|
|
2627
|
+
? "off (--solo: fixed specialists + research only)"
|
|
2628
|
+
: "off (endpoint bind failed — coms tools disabled)";
|
|
2629
|
+
const fleetLabel = herdrFleetReady
|
|
2630
|
+
? "herdr — spawn/read/close panes + notify (herdr_* tools active)"
|
|
2631
|
+
: "off (not inside a herdr pane, or no herdr server)";
|
|
2632
|
+
const comsPreferred = Object.entries(dispatchPolicy.substitutions)
|
|
2633
|
+
.filter(([, s]) => s.prefer === "coms")
|
|
2634
|
+
.map(([n]) => n);
|
|
2635
|
+
const dispatchLabel = dispatchPolicy.default === "coms"
|
|
2636
|
+
? "coms default — any member with a live same-name pool peer is served by it (/af-dispatch-policy)"
|
|
2637
|
+
: comsPreferred.length > 0
|
|
2638
|
+
? `coms-preferred: ${comsPreferred.join(", ")} (live peer wins, /af-dispatch-policy for status)`
|
|
2639
|
+
: "all native (no substitutions in .pi/agents/dispatch-policy.yaml)";
|
|
2640
|
+
_ctx.ui.notify(buildSessionStartNotice({
|
|
2641
|
+
workMode: getWorkMode(),
|
|
2642
|
+
activeTeamName,
|
|
2643
|
+
agentCount: agentStates.size,
|
|
2644
|
+
members,
|
|
2645
|
+
dispatchLabel,
|
|
2646
|
+
userLanguage,
|
|
2647
|
+
askUserLabel,
|
|
2648
|
+
comsLabel,
|
|
2649
|
+
fleetLabel,
|
|
2650
|
+
}), "info");
|
|
2651
|
+
},
|
|
2652
|
+
updateWidget: (_ctx) => {
|
|
2653
|
+
updateWidget();
|
|
2654
|
+
},
|
|
2655
|
+
installFooter: (_ctx) => {
|
|
2656
|
+
_ctx.ui.setFooter(createSessionFooter({
|
|
2657
|
+
ctx: _ctx,
|
|
2658
|
+
version: HARNESS_VERSION ?? "unknown",
|
|
2659
|
+
getModel: () => _ctx.model ? `${_ctx.model.provider}/${_ctx.model.id}` : "no-model",
|
|
2660
|
+
getThinkingLevel: () => pi.getThinkingLevel?.() ?? undefined,
|
|
2661
|
+
thinkingSuffix,
|
|
2662
|
+
getHint: () => composeFleetFooterHint(compactWorkMode(getWorkMode())),
|
|
2663
|
+
renderLeft: renderHubFooterLeft,
|
|
2664
|
+
truncateToWidth,
|
|
2665
|
+
visibleWidth,
|
|
2666
|
+
}));
|
|
2667
|
+
},
|
|
2668
|
+
}, {
|
|
2669
|
+
finishEvidence: () => { if (sessionDir) closeEvidenceSession(sessionDir); },
|
|
2670
|
+
shutdownComs: async () => { await resetDamageGuardHub(pi); unregisterQuestions(); await coms.shutdown(); }, shutdownMonitor: () => monitorSession.shutdown(),
|
|
2671
|
+
removeExemptions: () => {
|
|
2672
|
+
if (!exemptionsFile) return;
|
|
2673
|
+
try { fs.unlinkSync(exemptionsFile); } catch {}
|
|
2674
|
+
hubStateCtx.setExemptionsFile(null);
|
|
2675
|
+
},
|
|
2676
|
+
terminateChildren: () => {
|
|
2677
|
+
hubCapture.reset(); proactiveRuntime = null;
|
|
2678
|
+
watchdogSystem1 = disposeWatchdogSystem1Session(watchdogSystem1);
|
|
2679
|
+
communicationStore.dispose();
|
|
2680
|
+
triageRuntime?.dispose(); triageRuntime = null;
|
|
2681
|
+
taskTriage?.dispose(); taskTriage = null;
|
|
2682
|
+
taskTriageActivity?.dispose(); taskTriageActivity = null;
|
|
2683
|
+
taskTriageConfigStatus = "off"; taskTriageConfigured = false;
|
|
2684
|
+
try { watchdogActivity?.dispose(); } catch { /* trace disposal must not block shutdown */ }
|
|
2685
|
+
watchdogActivity = null;
|
|
2686
|
+
for (const st of [...agentStates.values(), ...researchStates.values()]) {
|
|
2687
|
+
fenceOperatorCancel(st);
|
|
2688
|
+
if (st.proc && st.status === "running") try { st.killedByOperator = true; st.proc.kill("SIGTERM"); } catch {}
|
|
2689
|
+
}
|
|
2690
|
+
},
|
|
2691
|
+
clearPoolWidget: () => {
|
|
2692
|
+
gridUI.dispose();
|
|
2693
|
+
if (currentCtx?.hasUI) try { currentCtx.ui.setWidget("coms-pool", undefined); } catch {}
|
|
2694
|
+
},
|
|
2695
|
+
});
|
|
2696
|
+
|
|
2697
|
+
pi.on("agent_end", async (_event, ctx) => {
|
|
2698
|
+
toolCatalogRuntime.endTurn();
|
|
2699
|
+
await turnHandlers.agentEnd(ctx);
|
|
2700
|
+
});
|
|
2701
|
+
registerTurnSettlement(pi, {
|
|
2702
|
+
agentSettled: ctx => turnHandlers.agentSettled(ctx),
|
|
2703
|
+
});
|
|
2704
|
+
|
|
2705
|
+
}
|