@chankov/agent-fleet 0.0.9 → 0.0.10
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/.claude/commands/doctor-agent-fleet.md +12 -7
- package/.claude/commands/setup-agent-fleet.md +7 -15
- package/.opencode/commands/af-doctor-agent-fleet.md +12 -7
- package/.opencode/commands/af-setup-agent-fleet.md +8 -6
- package/.pi/extensions/agent-fleet-update-check/README.md +2 -3
- package/.pi/extensions/btw/README.md +2 -2
- package/.pi/extensions/chrome-devtools-mcp/README.md +3 -6
- package/.pi/extensions/compact-and-continue/README.md +3 -3
- package/.pi/extensions/mcp-bridge/README.md +1 -1
- package/.pi/harnesses/agent-hub/README.md +139 -10
- package/.pi/harnesses/agent-hub/docs-lane.js +122 -0
- package/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.pi/harnesses/agent-hub/index.ts +448 -39
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/review-findings.js +102 -0
- package/.pi/harnesses/agent-hub/run-budget.js +302 -4
- package/.pi/harnesses/agent-hub/run-namespace.js +87 -0
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/prompts/af-doctor-agent-fleet.md +13 -6
- package/.pi/prompts/af-setup-agent-fleet.md +7 -15
- package/.versions/0.0.10/.claude/commands/build.md +44 -0
- package/.versions/0.0.10/.claude/commands/code-simplify.md +22 -0
- package/.versions/0.0.10/.claude/commands/design-agent.md +14 -0
- package/.versions/0.0.10/.claude/commands/doctor-agent-fleet.md +22 -0
- package/.versions/0.0.10/.claude/commands/orchestrate.md +112 -0
- package/.versions/0.0.10/.claude/commands/plan.md +16 -0
- package/.versions/0.0.10/.claude/commands/prime.md +22 -0
- package/.versions/0.0.10/.claude/commands/review.md +16 -0
- package/.versions/0.0.10/.claude/commands/set-hermes-telegram.md +15 -0
- package/.versions/0.0.10/.claude/commands/set-hermes-watchdog.md +6 -0
- package/.versions/0.0.10/.claude/commands/setup-agent-fleet.md +17 -0
- package/.versions/0.0.10/.claude/commands/ship.md +72 -0
- package/.versions/0.0.10/.claude/commands/spec.md +15 -0
- package/.versions/0.0.10/.claude/commands/test.md +19 -0
- package/.versions/0.0.10/.claude/commands/webperf.md +32 -0
- package/.versions/0.0.10/.claude/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.10/.opencode/commands/af-build.md +17 -0
- package/.versions/0.0.10/.opencode/commands/af-code-simplify.md +16 -0
- package/.versions/0.0.10/.opencode/commands/af-compound.md +16 -0
- package/.versions/0.0.10/.opencode/commands/af-design-agent.md +15 -0
- package/.versions/0.0.10/.opencode/commands/af-doctor-agent-fleet.md +22 -0
- package/.versions/0.0.10/.opencode/commands/af-orchestrate.md +112 -0
- package/.versions/0.0.10/.opencode/commands/af-plan.md +16 -0
- package/.versions/0.0.10/.opencode/commands/af-prime.md +22 -0
- package/.versions/0.0.10/.opencode/commands/af-review.md +15 -0
- package/.versions/0.0.10/.opencode/commands/af-set-hermes-telegram.md +15 -0
- package/.versions/0.0.10/.opencode/commands/af-set-hermes-watchdog.md +6 -0
- package/.versions/0.0.10/.opencode/commands/af-setup-agent-fleet.md +17 -0
- package/.versions/0.0.10/.opencode/commands/af-ship.md +16 -0
- package/.versions/0.0.10/.opencode/commands/af-spec.md +16 -0
- package/.versions/0.0.10/.opencode/commands/af-test.md +21 -0
- package/.versions/0.0.10/.opencode/commands/af-webperf.md +32 -0
- package/.versions/0.0.10/.opencode/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.10/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/0.0.10/.pi/agents/model-profiles.yaml +27 -0
- package/.versions/0.0.10/.pi/agents/peers.yaml +142 -0
- package/.versions/0.0.10/.pi/agents/teams.yaml +41 -0
- package/.versions/0.0.10/.pi/damage-control-rules.yaml +297 -0
- package/.versions/0.0.10/.pi/extensions/agent-fleet-update-check/README.md +57 -0
- package/.versions/0.0.10/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
- package/.versions/0.0.10/.pi/extensions/agent-fleet-update-check/package.json +6 -0
- package/.versions/0.0.10/.pi/extensions/btw/README.md +118 -0
- package/.versions/0.0.10/.pi/extensions/btw/index.ts +917 -0
- package/.versions/0.0.10/.pi/extensions/btw/package.json +6 -0
- package/.versions/0.0.10/.pi/extensions/btw/state.js +179 -0
- package/.versions/0.0.10/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/0.0.10/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/0.0.10/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/0.0.10/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/0.0.10/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/0.0.10/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/0.0.10/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/0.0.10/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/0.0.10/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/0.0.10/.pi/extensions/package-lock.json +1143 -0
- package/.versions/0.0.10/.pi/extensions/package.json +9 -0
- package/.versions/0.0.10/.pi/extensions/pi-voice-stt/README.md +201 -0
- package/.versions/0.0.10/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/0.0.10/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/0.0.10/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/0.0.10/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/0.0.10/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/0.0.10/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/README.md +1001 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/backend-policy.js +153 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/context-window.js +106 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/delegate.ts +435 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/docs-lane.js +122 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/drift-watchdog.js +211 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/footer.ts +31 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/helpers.ts +248 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/index.ts +9111 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/monitor-session-bridge.ts +257 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/research-retention.js +34 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/return-contract.js +293 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/return-extract.js +75 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/review-findings.js +102 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/run-budget.js +479 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/run-namespace.js +87 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/scope-gate.js +103 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/spawn.ts +354 -0
- package/.versions/0.0.10/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/0.0.10/.pi/harnesses/ask-user-remote/README.md +19 -0
- package/.versions/0.0.10/.pi/harnesses/ask-user-remote/index.ts +321 -0
- package/.versions/0.0.10/.pi/harnesses/ask-user-remote/race-core.js +106 -0
- package/.versions/0.0.10/.pi/harnesses/coms/README.md +100 -0
- package/.versions/0.0.10/.pi/harnesses/coms/index.ts +1767 -0
- package/.versions/0.0.10/.pi/harnesses/coms/package.json +7 -0
- package/.versions/0.0.10/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/0.0.10/.pi/harnesses/damage-control-continue/README.md +124 -0
- package/.versions/0.0.10/.pi/harnesses/damage-control-continue/index.ts +536 -0
- package/.versions/0.0.10/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/0.0.10/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/0.0.10/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/0.0.10/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/0.0.10/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/0.0.10/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/0.0.10/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/0.0.10/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/0.0.10/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/0.0.10/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/0.0.10/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/0.0.10/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/0.0.10/.pi/harnesses/lib/spawned-peers.js +190 -0
- package/.versions/0.0.10/.pi/harnesses/package-lock.json +35 -0
- package/.versions/0.0.10/.pi/harnesses/package.json +9 -0
- package/.versions/0.0.10/.pi/prompts/af-build.md +24 -0
- package/.versions/0.0.10/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/0.0.10/.pi/prompts/af-doctor-agent-fleet.md +22 -0
- package/.versions/0.0.10/.pi/prompts/af-plan.md +16 -0
- package/.versions/0.0.10/.pi/prompts/af-review.md +16 -0
- package/.versions/0.0.10/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/0.0.10/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/0.0.10/.pi/prompts/af-setup-agent-fleet.md +19 -0
- package/.versions/0.0.10/.pi/prompts/af-ship.md +17 -0
- package/.versions/0.0.10/.pi/prompts/af-spec.md +15 -0
- package/.versions/0.0.10/.pi/prompts/af-test.md +19 -0
- package/.versions/0.0.10/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/0.0.10/.version +1 -0
- package/.versions/0.0.10/agents/architect.md +24 -0
- package/.versions/0.0.10/agents/bowser.md +27 -0
- package/.versions/0.0.10/agents/builder.md +54 -0
- package/.versions/0.0.10/agents/code-reviewer.md +208 -0
- package/.versions/0.0.10/agents/deep-researcher.md +32 -0
- package/.versions/0.0.10/agents/documenter.md +18 -0
- package/.versions/0.0.10/agents/orchestrator.md +72 -0
- package/.versions/0.0.10/agents/plan-reviewer.md +83 -0
- package/.versions/0.0.10/agents/planner.md +70 -0
- package/.versions/0.0.10/agents/releaser.md +24 -0
- package/.versions/0.0.10/agents/researcher.md +28 -0
- package/.versions/0.0.10/agents/security-auditor.md +167 -0
- package/.versions/0.0.10/agents/test-engineer.md +153 -0
- package/.versions/0.0.10/agents/web-debugger.md +43 -0
- package/.versions/0.0.10/agents/web-performance-auditor.md +193 -0
- package/.versions/0.0.10/codex/CONDUCTOR.md +148 -0
- package/.versions/0.0.10/docs/ARCHITECTURE.md +303 -0
- package/.versions/0.0.10/docs/agent-fleet-setup.md +377 -0
- package/.versions/0.0.10/docs/claude-code-coms-bridge.md +109 -0
- package/.versions/0.0.10/docs/codex-remote-conductor.md +170 -0
- package/.versions/0.0.10/docs/coms-hermes-bridge.md +189 -0
- package/.versions/0.0.10/docs/getting-started.md +254 -0
- package/.versions/0.0.10/docs/npm-install.md +514 -0
- package/.versions/0.0.10/docs/opencode-setup.md +281 -0
- package/.versions/0.0.10/docs/pi-extensions.md +363 -0
- package/.versions/0.0.10/docs/pi-setup.md +571 -0
- package/.versions/0.0.10/docs/skill-anatomy.md +150 -0
- package/.versions/0.0.10/hermes/README.md +347 -0
- package/.versions/0.0.10/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/0.0.10/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/0.0.10/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/0.0.10/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/0.0.10/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/0.0.10/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/0.0.10/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/0.0.10/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/0.0.10/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/0.0.10/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/0.0.10/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/0.0.10/hooks/SIMPLIFY-IGNORE.md +90 -0
- package/.versions/0.0.10/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/0.0.10/hooks/hooks.json +14 -0
- package/.versions/0.0.10/hooks/session-start.sh +74 -0
- package/.versions/0.0.10/hooks/simplify-ignore.sh +302 -0
- package/.versions/0.0.10/install-manifest.json +3615 -0
- package/.versions/0.0.10/justfile +254 -0
- package/.versions/0.0.10/manifest-meta.json +472 -0
- package/.versions/0.0.10/references/accessibility-checklist.md +160 -0
- package/.versions/0.0.10/references/definition-of-done.md +67 -0
- package/.versions/0.0.10/references/fleet-coordination-patterns.md +151 -0
- package/.versions/0.0.10/references/observability-checklist.md +91 -0
- package/.versions/0.0.10/references/orchestration-patterns.md +370 -0
- package/.versions/0.0.10/references/performance-checklist.md +153 -0
- package/.versions/0.0.10/references/prompting-patterns.md +380 -0
- package/.versions/0.0.10/references/security-checklist.md +179 -0
- package/.versions/0.0.10/references/testing-patterns.md +236 -0
- package/.versions/0.0.10/scripts/codex-conductor.ts +41 -0
- package/.versions/0.0.10/scripts/codex-remote-control.ts +167 -0
- package/.versions/0.0.10/scripts/coms-claude-bridge.ts +401 -0
- package/.versions/0.0.10/scripts/coms-cli.ts +484 -0
- package/.versions/0.0.10/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/0.0.10/scripts/fleet.ts +168 -0
- package/.versions/0.0.10/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/0.0.10/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/0.0.10/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/0.0.10/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/0.0.10/scripts/lib/claude-bridge-core.ts +165 -0
- package/.versions/0.0.10/scripts/lib/codex-conductor.ts +88 -0
- package/.versions/0.0.10/scripts/lib/codex-remote-control.ts +480 -0
- package/.versions/0.0.10/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/0.0.10/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/0.0.10/scripts/lib/fleet-command.ts +111 -0
- package/.versions/0.0.10/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/0.0.10/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/0.0.10/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/0.0.10/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/0.0.10/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/0.0.10/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/0.0.10/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/0.0.10/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/0.0.10/scripts/lib/monitor-env.ts +120 -0
- package/.versions/0.0.10/scripts/lib/peer-launch.ts +314 -0
- package/.versions/0.0.10/scripts/lib/persona-banner.ts +62 -0
- package/.versions/0.0.10/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/0.0.10/scripts/lib/team-project.ts +193 -0
- package/.versions/0.0.10/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/0.0.10/scripts/peer-banner.ts +40 -0
- package/.versions/0.0.10/scripts/peer-launch.ts +259 -0
- package/.versions/0.0.10/scripts/team-snapshot.ts +237 -0
- package/.versions/0.0.10/scripts/team-up.ts +360 -0
- package/.versions/0.0.10/skills/_internal/grilling.md +11 -0
- package/.versions/0.0.10/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/0.0.10/skills/code-review-and-quality/SKILL.md +381 -0
- package/.versions/0.0.10/skills/compound-learning/SKILL.md +137 -0
- package/.versions/0.0.10/skills/context-engineering/SKILL.md +291 -0
- package/.versions/0.0.10/skills/deprecation-and-migration/SKILL.md +206 -0
- package/.versions/0.0.10/skills/designing-agents/SKILL.md +394 -0
- package/.versions/0.0.10/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/0.0.10/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.10/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/0.0.10/skills/guided-workspace-setup/SKILL.md +226 -0
- package/.versions/0.0.10/skills/guided-workspace-setup/companion-manifest.json +38 -0
- package/.versions/0.0.10/skills/idea-refine/SKILL.md +182 -0
- package/.versions/0.0.10/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.10/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.10/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.10/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.10/skills/incremental-implementation/SKILL.md +287 -0
- package/.versions/0.0.10/skills/interview-me/SKILL.md +226 -0
- package/.versions/0.0.10/skills/orchestration-verification/SKILL.md +181 -0
- package/.versions/0.0.10/skills/peer-coms/SKILL.md +90 -0
- package/.versions/0.0.10/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.10/skills/planning-and-task-breakdown/SKILL.md +254 -0
- package/.versions/0.0.10/skills/security-and-hardening/SKILL.md +461 -0
- package/.versions/0.0.10/skills/spec-driven-development/SKILL.md +257 -0
- package/.versions/0.0.10/skills/using-agent-skills/SKILL.md +199 -0
- package/.versions/0.0.10/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/README.md +11 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
- package/.versions/0.0.10/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
- package/CHANGELOG.md +103 -0
- package/README.md +22 -5
- package/agents/code-reviewer.md +4 -0
- package/agents/orchestrator.md +7 -1
- package/agents/plan-reviewer.md +22 -1
- package/bin/build-manifest.js +68 -0
- package/bin/cli.js +679 -49
- package/bin/lib/apply.js +641 -0
- package/bin/lib/manifest.js +731 -0
- package/bin/lib/merge-forms.js +106 -0
- package/bin/lib/plan.js +569 -0
- package/bin/lib/state.js +213 -0
- package/bin/lib/verify.js +576 -0
- package/bin/snapshot-version.js +5 -0
- package/docs/ARCHITECTURE.md +52 -11
- package/docs/agent-fleet-setup.md +59 -48
- package/docs/getting-started.md +29 -6
- package/docs/npm-install.md +208 -31
- package/docs/opencode-setup.md +32 -0
- package/docs/pi-extensions.md +17 -10
- package/docs/pi-setup.md +164 -69
- package/install-manifest.json +3615 -0
- package/manifest-meta.json +472 -0
- package/package.json +8 -3
- package/skills/browser-testing-with-devtools/SKILL.md +3 -4
- package/skills/guided-workspace-setup/SKILL.md +172 -490
- package/skills/planning-and-task-breakdown/SKILL.md +18 -0
- package/skills/spec-driven-development/SKILL.md +12 -0
|
@@ -89,7 +89,11 @@ import {
|
|
|
89
89
|
exemptionsFilePath, type AccessRequest,
|
|
90
90
|
} from "../lib/damage-control-shared.ts";
|
|
91
91
|
import { applyModelOverride, clampDelegateDepth, DELEGATE_TREE_SPAWN_BUDGET, fallbackModelFor, isReadOnlyToolList, MAX_DELEGATE_DEPTH, normalizeAgentInput, parseTeamsYaml, safeAgentKey, safePathWithin, taskFingerprint, upsertTeamInYaml } from "./helpers.ts";
|
|
92
|
-
import { DEFAULT_HUB_MODE, DEFAULT_TASK_TIER, HUB_MODES,
|
|
92
|
+
import { DEFAULT_HUB_MODE, DEFAULT_TASK_TIER, HUB_MODES, TASK_BUDGET_MULTIPLIER, applyTierChange, blockingFindingCap, budgetStatusLine, checkReviewRoundCap, checkTaskBudget, checkTierPersonaGate, checkTurnBudget, contextOverflowDiagnostic, isReviewPersona, normalizeHubMode, remainingTaskResearch, resolveTaskBudget, resolveTurnBudget, reviewBudgetClause, reviewRoundCap, shouldRecycleSession, turnActiveMs } from "./run-budget.js";
|
|
93
|
+
import { countReviewFindings, findingBudgetNotice } from "./review-findings.js";
|
|
94
|
+
import { checkDocsLane, docsLaneNotice } from "./docs-lane.js";
|
|
95
|
+
import { checkExternalBlockerGate, externalBlockedProtocol, extractExternalBlockers } from "./external-blocker.js";
|
|
96
|
+
import { DEFAULT_RUN_HISTORY_KEEP, appendRunIndex, buildRunMeta, makeRunId, normalizeRunHistoryKeep, pruneRunDirs, RUN_INDEX_FILENAME, RUNS_DIRNAME } from "./run-namespace.js";
|
|
93
97
|
import { MAX_OPEN_ASSERTIONS, validateAssertionBatch } from "./assertion-ledger.js";
|
|
94
98
|
import { DEFAULT_PROVIDER_LIMITS, createProviderSemaphore, parseProviderLimits } from "./provider-semaphore.js";
|
|
95
99
|
import {
|
|
@@ -113,7 +117,7 @@ import { comsRequiredRefusal, parseDispatchPolicy, resolveDispatchBackend } from
|
|
|
113
117
|
import { DEFAULT_RESEARCH_KEEP, parseResearchKeep, selectResearchPrunable } from "./research-retention.js";
|
|
114
118
|
import { requireSafetyHarness, resolveSafetyHarness } from "./safety-routing.ts";
|
|
115
119
|
import { createAccessApprovalRouter } from "./access-approval.ts";
|
|
116
|
-
import { readdirSync, readFileSync, existsSync, mkdirSync, renameSync, unlinkSync, writeFileSync, rmSync } from "fs";
|
|
120
|
+
import { chmodSync, readdirSync, readFileSync, existsSync, mkdirSync, renameSync, unlinkSync, writeFileSync, rmSync } from "fs";
|
|
117
121
|
import {
|
|
118
122
|
HerdrAgentWatch,
|
|
119
123
|
HerdrPresence,
|
|
@@ -449,6 +453,11 @@ function extractNeedsResearch(output: string): string[] {
|
|
|
449
453
|
// watchdog-judge-model: <model spec> — model for the drift judge (default:
|
|
450
454
|
// the researcher persona's model, else the
|
|
451
455
|
// dispatcher's).
|
|
456
|
+
// run-history-keep: <n>|off — how many previous sessions' artifact archives to
|
|
457
|
+
// retain under .pi/agent-sessions/runs/ (default 10).
|
|
458
|
+
// Each session archives the previous one's artifacts
|
|
459
|
+
// into an immutable runs/<runId>/ namespace instead of
|
|
460
|
+
// deleting them; "off" retains every run.
|
|
452
461
|
|
|
453
462
|
interface AgentTeamOverrides {
|
|
454
463
|
language: string;
|
|
@@ -474,6 +483,9 @@ interface AgentTeamOverrides {
|
|
|
474
483
|
};
|
|
475
484
|
watchdogSetting: string;
|
|
476
485
|
watchdogJudgeModel: string | null;
|
|
486
|
+
// How many previous sessions' artifact archives to keep under
|
|
487
|
+
// .pi/agent-sessions/runs/ (run-namespace.js). null = keep everything.
|
|
488
|
+
runHistoryKeep: number | null;
|
|
477
489
|
warnings: string[];
|
|
478
490
|
}
|
|
479
491
|
|
|
@@ -493,6 +505,7 @@ const DEFAULT_OVERRIDES: AgentTeamOverrides = {
|
|
|
493
505
|
budgetOverrides: {},
|
|
494
506
|
watchdogSetting: DEFAULT_WATCHDOG_SETTING,
|
|
495
507
|
watchdogJudgeModel: null,
|
|
508
|
+
runHistoryKeep: DEFAULT_RUN_HISTORY_KEEP,
|
|
496
509
|
warnings: [],
|
|
497
510
|
};
|
|
498
511
|
|
|
@@ -545,6 +558,14 @@ function parseAgentTeamOverrides(cwd: string): AgentTeamOverrides {
|
|
|
545
558
|
if (key === "docs" && value) {
|
|
546
559
|
result.docsPaths = value.split(",").map(s => s.trim()).filter(Boolean);
|
|
547
560
|
}
|
|
561
|
+
if (key === "run-history-keep" && value) {
|
|
562
|
+
const keep = normalizeRunHistoryKeep(value);
|
|
563
|
+
if (keep === undefined) {
|
|
564
|
+
result.warnings.push(`run-history-keep "${value}" is not a positive integer or "off" — using the default (${DEFAULT_RUN_HISTORY_KEEP})`);
|
|
565
|
+
} else {
|
|
566
|
+
result.runHistoryKeep = keep;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
548
569
|
if (key === "research-keep" && value) {
|
|
549
570
|
const keep = parseResearchKeep(value);
|
|
550
571
|
if (keep != null) {
|
|
@@ -2065,14 +2086,48 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2065
2086
|
let budgetOverrides: AgentTeamOverrides["budgetOverrides"] = {};
|
|
2066
2087
|
let turnDispatchCount = 0;
|
|
2067
2088
|
let turnResearchCount = 0;
|
|
2068
|
-
// Task tier (
|
|
2069
|
-
//
|
|
2070
|
-
//
|
|
2071
|
-
|
|
2089
|
+
// ── Task-scoped budget & tier (run-budget.js) ──
|
|
2090
|
+
// A per-message allowance cannot bound a task: every steering message opened a
|
|
2091
|
+
// fresh turn window, so a run could spend 8 dispatches and 60 minutes again and
|
|
2092
|
+
// again without any counter ever binding. These counters span the whole TASK
|
|
2093
|
+
// and are cleared only by an explicit new task (/af-new-task or
|
|
2094
|
+
// set_task_tier `new_task: true`) — not by a user message.
|
|
2095
|
+
let taskDispatchCount = 0;
|
|
2096
|
+
let taskResearchCount = 0;
|
|
2097
|
+
let taskLabel: string | null = null;
|
|
2098
|
+
// The task clock charges ACTIVE time only — turns that ran, minus the time the
|
|
2099
|
+
// dispatcher spent blocked on ask_user. Raw wall clock would bill the human's
|
|
2100
|
+
// lunch break, an overnight pause, and every long answer against the task, and
|
|
2101
|
+
// at fast mode's 45-minute envelope that hard-stops a task with two dispatches
|
|
2102
|
+
// spent. A false stop is worse than no stop: it teaches people to reset the
|
|
2103
|
+
// task window reflexively, which is the one thing that must stay deliberate.
|
|
2104
|
+
// `taskActiveMs` accumulates finished turns; the open turn is added at check time.
|
|
2105
|
+
let taskActiveMs = 0;
|
|
2106
|
+
let turnAskUserWaitMs = 0;
|
|
2107
|
+
// Review dispatches spent on this task (review-round cap).
|
|
2108
|
+
let taskReviewRounds = 0;
|
|
2109
|
+
// Task tier (complexity triage): declared by the dispatcher via set_task_tier.
|
|
2110
|
+
// TASK-scoped, not turn-scoped, and it moves by ratchet — down freely, up only
|
|
2111
|
+
// with a stated reason (applyTierChange). Null until declared; the first
|
|
2112
|
+
// dispatch assumes DEFAULT_TASK_TIER outside strict mode. Caps = min(mode, tier).
|
|
2113
|
+
let taskTier: string | null = null;
|
|
2114
|
+
// Was the tier ASSUMED by the hub rather than declared by the dispatcher? The
|
|
2115
|
+
// distinction matters to the ratchet: an assumed tier must not turn the
|
|
2116
|
+
// dispatcher's own first triage call into an "escalation" that needs a reason.
|
|
2117
|
+
let taskTierAssumed = false;
|
|
2072
2118
|
// Duplicate-dispatch guard: fingerprints of (agent, task) already dispatched
|
|
2073
2119
|
// THIS turn. Auto-research resumes and /af-agents-restart call dispatchAgent
|
|
2074
2120
|
// directly, so only real dispatcher tool calls are guarded.
|
|
2075
2121
|
const turnDispatchFingerprints = new Set<string>();
|
|
2122
|
+
// ── External-blocker circuit breaker (external-blocker.js) ──
|
|
2123
|
+
// Set when a specialist reports it needs something outside the fleet's reach;
|
|
2124
|
+
// gates the next dispatch until the human has been addressed. Cleared by an
|
|
2125
|
+
// ask_user call, by a new user turn (the human spoke), and by a new task.
|
|
2126
|
+
let externalBlockers: { agent: string; what: string }[] = [];
|
|
2127
|
+
let externalBlockerAcknowledged = false;
|
|
2128
|
+
let externalBlockerRefusedOnce = false;
|
|
2129
|
+
// Per-run artifact archive retention (run-namespace.js).
|
|
2130
|
+
let runHistoryKeep: number | null = DEFAULT_RUN_HISTORY_KEEP;
|
|
2076
2131
|
// ── Drift watchdog (drift-watchdog.js) ──
|
|
2077
2132
|
// Hub-wide setting from the overrides file, live-switchable via /af-watchdog;
|
|
2078
2133
|
// per-agent overrides ("on"/"off") win over it; a dispatch_agent `watchdog`
|
|
@@ -2081,13 +2136,81 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2081
2136
|
let watchdogJudgeModel: string | null = null;
|
|
2082
2137
|
const watchdogAgentOverrides = new Map<string, "on" | "off">();
|
|
2083
2138
|
function currentBudget() {
|
|
2084
|
-
return resolveTurnBudget(hubMode, budgetOverrides,
|
|
2139
|
+
return resolveTurnBudget(hubMode, budgetOverrides, taskTier);
|
|
2140
|
+
}
|
|
2141
|
+
function currentTaskBudget() {
|
|
2142
|
+
return resolveTaskBudget(currentBudget());
|
|
2143
|
+
}
|
|
2144
|
+
function taskCounters() {
|
|
2145
|
+
return { dispatches: taskDispatchCount, research: taskResearchCount };
|
|
2146
|
+
}
|
|
2147
|
+
/**
|
|
2148
|
+
* Active time spent on this task: finished turns plus the open turn, each
|
|
2149
|
+
* minus its ask_user waits. An ask_user still in flight is subtracted too, so
|
|
2150
|
+
* the clock does not tick while the dispatcher sits at a question.
|
|
2151
|
+
*/
|
|
2152
|
+
function taskActiveElapsedMs(): number {
|
|
2153
|
+
let openWait = 0;
|
|
2154
|
+
const now = Date.now();
|
|
2155
|
+
for (const startedAt of askUserStarts.values()) openWait += Math.max(0, now - startedAt);
|
|
2156
|
+
return taskActiveMs + turnActiveMs(currentTurnStartedAt, now, turnAskUserWaitMs + openWait);
|
|
2157
|
+
}
|
|
2158
|
+
/** Fold the turn that is ending into the task's active-time accumulator. */
|
|
2159
|
+
function closeTurnActiveTime() {
|
|
2160
|
+
if (!currentTurnStartedAt) return;
|
|
2161
|
+
taskActiveMs += turnActiveMs(currentTurnStartedAt, Date.now(), turnAskUserWaitMs);
|
|
2162
|
+
turnAskUserWaitMs = 0;
|
|
2163
|
+
}
|
|
2164
|
+
/** Clear the task window: counters, tier, clock, review rounds, blocker breaker. */
|
|
2165
|
+
function resetTaskWindow(label: string | null = null) {
|
|
2166
|
+
taskDispatchCount = 0;
|
|
2167
|
+
taskResearchCount = 0;
|
|
2168
|
+
taskActiveMs = 0;
|
|
2169
|
+
turnAskUserWaitMs = 0;
|
|
2170
|
+
taskReviewRounds = 0;
|
|
2171
|
+
taskLabel = label;
|
|
2172
|
+
taskTier = null;
|
|
2173
|
+
taskTierAssumed = false;
|
|
2174
|
+
externalBlockers = [];
|
|
2175
|
+
externalBlockerAcknowledged = false;
|
|
2176
|
+
externalBlockerRefusedOnce = false;
|
|
2177
|
+
turnDispatchFingerprints.clear();
|
|
2178
|
+
updateModeStatus();
|
|
2085
2179
|
}
|
|
2086
2180
|
function updateModeStatus() {
|
|
2087
2181
|
try {
|
|
2088
|
-
widgetCtx?.ui?.setStatus(
|
|
2182
|
+
widgetCtx?.ui?.setStatus(
|
|
2183
|
+
"hub-mode",
|
|
2184
|
+
budgetStatusLine(
|
|
2185
|
+
hubMode,
|
|
2186
|
+
{ dispatches: turnDispatchCount, research: turnResearchCount },
|
|
2187
|
+
currentBudget(),
|
|
2188
|
+
// A trailing "?" marks a tier the hub assumed rather than one the
|
|
2189
|
+
// dispatcher declared — the human can see that triage was skipped.
|
|
2190
|
+
taskTier && taskTierAssumed ? `${taskTier}?` : taskTier,
|
|
2191
|
+
{ counters: taskCounters(), budget: currentTaskBudget() },
|
|
2192
|
+
),
|
|
2193
|
+
);
|
|
2089
2194
|
} catch {}
|
|
2090
2195
|
}
|
|
2196
|
+
/**
|
|
2197
|
+
* The two gates that must run BEFORE any budget is charged, in severity
|
|
2198
|
+
* order: an unacknowledged external blocker, then the tier's persona gate.
|
|
2199
|
+
* Returns the refusal text, or null when the call may proceed.
|
|
2200
|
+
*/
|
|
2201
|
+
function preflightGate(persona: string): { reason: string; message: string } | null {
|
|
2202
|
+
const blocked = checkExternalBlockerGate({
|
|
2203
|
+
blockers: externalBlockers,
|
|
2204
|
+
acknowledged: externalBlockerAcknowledged,
|
|
2205
|
+
askUserAvailable,
|
|
2206
|
+
refusedOnce: externalBlockerRefusedOnce,
|
|
2207
|
+
});
|
|
2208
|
+
if (blocked) {
|
|
2209
|
+
externalBlockerRefusedOnce = true;
|
|
2210
|
+
return blocked;
|
|
2211
|
+
}
|
|
2212
|
+
return checkTierPersonaGate(taskTier, persona);
|
|
2213
|
+
}
|
|
2091
2214
|
// ── Per-turn cost report (/af-hub-report) ──
|
|
2092
2215
|
interface TurnReport {
|
|
2093
2216
|
startedAt: number;
|
|
@@ -2223,6 +2346,68 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2223
2346
|
return root;
|
|
2224
2347
|
}
|
|
2225
2348
|
|
|
2349
|
+
/**
|
|
2350
|
+
* Move the PREVIOUS session's artifacts into `runs/<runId>/artifacts/` — a
|
|
2351
|
+
* namespace written once and never reused — record it in `runs/index.json`,
|
|
2352
|
+
* and prune to `run-history-keep` archives. Best-effort throughout: failing to
|
|
2353
|
+
* archive must never stop a session from starting, but it must also never
|
|
2354
|
+
* silently fall back to deleting the artifacts.
|
|
2355
|
+
*/
|
|
2356
|
+
function archivePreviousRun(): string | null {
|
|
2357
|
+
const root = artifactsRoot();
|
|
2358
|
+
if (!existsSync(root)) return null;
|
|
2359
|
+
let counts: Record<string, number> = {};
|
|
2360
|
+
let total = 0;
|
|
2361
|
+
try {
|
|
2362
|
+
for (const kind of ARTIFACT_KINDS) {
|
|
2363
|
+
const dir = safePathWithin(root, kind);
|
|
2364
|
+
if (!existsSync(dir)) continue;
|
|
2365
|
+
const n = readdirSync(dir).length;
|
|
2366
|
+
if (n > 0) counts[kind] = n;
|
|
2367
|
+
total += n;
|
|
2368
|
+
}
|
|
2369
|
+
} catch { /* unreadable tree — fall through and try the move anyway */ }
|
|
2370
|
+
if (total === 0) {
|
|
2371
|
+
// Nothing worth keeping: an empty layout is not history.
|
|
2372
|
+
try { rmSync(root, { recursive: true, force: true }); } catch {}
|
|
2373
|
+
return null;
|
|
2374
|
+
}
|
|
2375
|
+
const runId = makeRunId();
|
|
2376
|
+
try {
|
|
2377
|
+
const runsDir = safePathWithin(sessionDir, RUNS_DIRNAME);
|
|
2378
|
+
const runDir = safePathWithin(runsDir, runId);
|
|
2379
|
+
mkdirSync(runDir, { recursive: true });
|
|
2380
|
+
renameSync(root, safePathWithin(runDir, "artifacts"));
|
|
2381
|
+
const meta = buildRunMeta({
|
|
2382
|
+
runId,
|
|
2383
|
+
archivedAt: Date.now(),
|
|
2384
|
+
cwd: sessionDir,
|
|
2385
|
+
project: process.env.PI_COMS_PROJECT || null,
|
|
2386
|
+
workspace: process.env.HERDR_WORKSPACE_ID || null,
|
|
2387
|
+
artifactCounts: counts,
|
|
2388
|
+
});
|
|
2389
|
+
const metaPath = safePathWithin(runDir, "meta.json");
|
|
2390
|
+
writeFileSync(metaPath, JSON.stringify(meta, null, 2));
|
|
2391
|
+
// Written once, never rewritten: make that a file mode, not a promise.
|
|
2392
|
+
try { chmodSync(metaPath, 0o444); } catch {}
|
|
2393
|
+
|
|
2394
|
+
const indexPath = safePathWithin(runsDir, RUN_INDEX_FILENAME);
|
|
2395
|
+
let existing: any = null;
|
|
2396
|
+
try { existing = JSON.parse(readFileSync(indexPath, "utf-8")); } catch {}
|
|
2397
|
+
const index = appendRunIndex(existing, { runId, archivedAt: meta.archivedAt, artifactCounts: counts, project: meta.project, workspace: meta.workspace }, runHistoryKeep);
|
|
2398
|
+
writeFileSync(indexPath, JSON.stringify(index, null, 2));
|
|
2399
|
+
|
|
2400
|
+
for (const stale of pruneRunDirs(readdirSync(runsDir), runHistoryKeep)) {
|
|
2401
|
+
try { rmSync(safePathWithin(runsDir, stale), { recursive: true, force: true }); } catch {}
|
|
2402
|
+
}
|
|
2403
|
+
return runId;
|
|
2404
|
+
} catch {
|
|
2405
|
+
// The archive failed. Leave the artifacts exactly where they are rather
|
|
2406
|
+
// than deleting them — a stale tree is recoverable, a deleted one is not.
|
|
2407
|
+
return null;
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2226
2411
|
function loadInputArtifacts(paths: string[] | undefined, ctx: any): InputArtifactPreview[] {
|
|
2227
2412
|
if (!paths || paths.length === 0) return [];
|
|
2228
2413
|
const root = ensureArtifactsLayout();
|
|
@@ -2381,7 +2566,13 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2381
2566
|
// dirs (delegate children's events + sessions).
|
|
2382
2567
|
try { rmSync(safePathWithin(sessionDir, "findings"), { recursive: true, force: true }); } catch {}
|
|
2383
2568
|
try { rmSync(safePathWithin(sessionDir, "delegations"), { recursive: true, force: true }); } catch {}
|
|
2384
|
-
|
|
2569
|
+
// Artifacts are NOT ephemeral, and deleting them here is what made a
|
|
2570
|
+
// post-mortem record eleven specialist returns and two reviews as NOT
|
|
2571
|
+
// RECOVERABLE: the next session's `builder-run1.md` reused the same path as
|
|
2572
|
+
// the previous session's, and the wipe removed the originals first. Archive
|
|
2573
|
+
// the previous session's artifacts into an immutable per-run namespace
|
|
2574
|
+
// instead, then start this session with an empty tree.
|
|
2575
|
+
archivePreviousRun();
|
|
2385
2576
|
ensureArtifactsLayout();
|
|
2386
2577
|
// The assertion ledger is per-task and as ephemeral as the session that owns
|
|
2387
2578
|
// it — wipe on session start like findings/, then start with an empty ledger.
|
|
@@ -3148,6 +3339,7 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
3148
3339
|
## Dispatch protocol (agent-hub)
|
|
3149
3340
|
You are serving a dispatched task as a standing peer; the dispatcher only receives this reply, so make it your complete final answer.
|
|
3150
3341
|
- Clarification: if you need a HUMAN decision (ambiguity, missing input, contradiction, or a destructive/irreversible next step), do NOT guess — include line(s) of the form \`ASK_USER: <one clear English question>\`; you will be re-dispatched with the answers.
|
|
3342
|
+
${externalBlockedProtocol()}
|
|
3151
3343
|
- Deliverable-to-file: when your deliverable is a document (plan, review, critique, inventory, report) and your tools allow writing, write the full document to .pi/agent-sessions/artifacts/<kind>/${agentKey}-run${runNumber}.md (kinds: plans, reviews, inventories, evidence) — never repo-root ./artifacts/... — and finish with the artifact-relative path (artifacts/<kind>/${agentKey}-run${runNumber}.md) plus a digest of at most 10 lines.
|
|
3152
3344
|
- If the task includes acceptance assertions (A1, A2, ...), include the structured return from skills/orchestration-verification/SKILL.md.` +
|
|
3153
3345
|
buildRulesProtocol() + buildDocsProtocol();
|
|
@@ -3548,6 +3740,9 @@ You may emit multiple ASK_USER lines if you have several questions. The dispatch
|
|
|
3548
3740
|
will surface each to the human user in ${userLanguage} and re-dispatch you with the
|
|
3549
3741
|
answers. Do not invent values, do not pick "reasonable defaults" silently — ask.
|
|
3550
3742
|
|
|
3743
|
+
## External-blocker protocol
|
|
3744
|
+
${externalBlockedProtocol()}
|
|
3745
|
+
|
|
3551
3746
|
## Research protocol
|
|
3552
3747
|
If you need reconnaissance you cannot perform with your own tools (broad code search,
|
|
3553
3748
|
reading unfamiliar areas of the codebase, summarizing docs), DO NOT guess and DO NOT
|
|
@@ -4835,21 +5030,56 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
4835
5030
|
artifacts: Type.Optional(Type.Array(Type.String({ description: "Optional repo-relative or session-artifact-relative input artifact path. The hub injects only path + one-line preview; the specialist must read the file itself." }))),
|
|
4836
5031
|
scope: Type.Optional(Type.Array(Type.String({ description: "Optional advisory file scope globs for writable agents. Changes outside are reported in details.scopeViolations; nothing is auto-reverted. Also arms the drift watchdog's live out-of-scope rule." }))),
|
|
4837
5032
|
watchdog: Type.Optional(Type.Boolean({ description: "Force the drift watchdog on/off for THIS dispatch (default: per-agent /af-watchdog override, then the hub-wide setting)." })),
|
|
5033
|
+
review_reason: Type.Optional(Type.String({ description: "Why a documentation-only change needs a review gate (e.g. it publishes a credential, or states a contract other systems rely on). Only needed when dispatching a review persona with a docs-only `scope`." })),
|
|
4838
5034
|
}),
|
|
4839
5035
|
|
|
4840
5036
|
async execute(_toolCallId, params, _signal, onUpdate, ctx) {
|
|
4841
|
-
const { task, artifacts, scope, watchdog } = params as { agent: string; task: string; artifacts?: string[]; scope?: string[]; watchdog?: boolean };
|
|
5037
|
+
const { task, artifacts, scope, watchdog, review_reason } = params as { agent: string; task: string; artifacts?: string[]; scope?: string[]; watchdog?: boolean; review_reason?: string };
|
|
4842
5038
|
// Display names / underscores resolve to the persona slug key space, so
|
|
4843
5039
|
// `agent: "Test Engineer"` never burns a dispatch on a lookup error.
|
|
4844
5040
|
const agent = normalizeAgentInput((params as { agent: string }).agent);
|
|
4845
|
-
// Unclassified
|
|
5041
|
+
// Unclassified task: assume the default tier (outside strict, whose full
|
|
4846
5042
|
// contract runs uncapped by tiers). The prompt asks for set_task_tier
|
|
4847
5043
|
// FIRST; this is the fail-safe, not the intended path.
|
|
4848
|
-
if (
|
|
4849
|
-
|
|
4850
|
-
|
|
5044
|
+
if (taskTier === null && hubMode !== "strict") {
|
|
5045
|
+
taskTier = DEFAULT_TASK_TIER;
|
|
5046
|
+
taskTierAssumed = true;
|
|
5047
|
+
turnReport.tier = taskTier;
|
|
4851
5048
|
updateModeStatus();
|
|
4852
5049
|
}
|
|
5050
|
+
// Pre-flight refusals, in severity order, BEFORE anything is charged: an
|
|
5051
|
+
// unacknowledged external blocker, the tier's persona gate, the review-round
|
|
5052
|
+
// cap, then the docs-only lane. None of these reached a specialist, so none
|
|
5053
|
+
// of them costs a budget slot.
|
|
5054
|
+
const preflight = preflightGate(agent)
|
|
5055
|
+
?? checkReviewRoundCap(taskTier, agent, taskReviewRounds)
|
|
5056
|
+
?? checkDocsLane(agent, scope || [], review_reason);
|
|
5057
|
+
if (preflight) {
|
|
5058
|
+
turnReport.refusals++;
|
|
5059
|
+
sessionTotals.refusals++;
|
|
5060
|
+
return {
|
|
5061
|
+
content: [{ type: "text", text: preflight.message }],
|
|
5062
|
+
details: { agent, task, status: preflight.reason, reason: preflight.reason, elapsed: 0, exitCode: 1, fullOutput: "" },
|
|
5063
|
+
};
|
|
5064
|
+
}
|
|
5065
|
+
// Task-budget gate: the outer bound a turn window never provided. Checked
|
|
5066
|
+
// BEFORE the turn budget because it is the more severe stop — a new user
|
|
5067
|
+
// message reopens the turn window but not the task window.
|
|
5068
|
+
const taskRefusal = checkTaskBudget(
|
|
5069
|
+
"dispatch",
|
|
5070
|
+
taskCounters(),
|
|
5071
|
+
currentTaskBudget(),
|
|
5072
|
+
taskActiveElapsedMs(),
|
|
5073
|
+
taskTier,
|
|
5074
|
+
);
|
|
5075
|
+
if (taskRefusal) {
|
|
5076
|
+
turnReport.refusals++;
|
|
5077
|
+
sessionTotals.refusals++;
|
|
5078
|
+
return {
|
|
5079
|
+
content: [{ type: "text", text: taskRefusal.message }],
|
|
5080
|
+
details: { agent, task, status: "task_budget_refused", reason: taskRefusal.reason, elapsed: 0, exitCode: 1, fullOutput: "" },
|
|
5081
|
+
};
|
|
5082
|
+
}
|
|
4853
5083
|
// Turn-budget gate: refuse BEFORE any spawn. The dispatcher must stop,
|
|
4854
5084
|
// summarize, and ask the user; a new user turn opens a fresh window.
|
|
4855
5085
|
const budgetRefusal = checkTurnBudget(
|
|
@@ -4897,6 +5127,8 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
4897
5127
|
};
|
|
4898
5128
|
}
|
|
4899
5129
|
turnDispatchCount++;
|
|
5130
|
+
taskDispatchCount++;
|
|
5131
|
+
if (isReviewPersona(agent)) taskReviewRounds++;
|
|
4900
5132
|
sessionTotals.dispatches++;
|
|
4901
5133
|
updateModeStatus();
|
|
4902
5134
|
let writableTracked = false;
|
|
@@ -4927,7 +5159,14 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
4927
5159
|
scopeSnapshot = snapshotWorktree(ctx.cwd || process.cwd());
|
|
4928
5160
|
}
|
|
4929
5161
|
|
|
4930
|
-
|
|
5162
|
+
// A review is a gate, and a gate has a size. Unbounded review authority
|
|
5163
|
+
// ratchets: each round's findings become plan invariants, and the larger
|
|
5164
|
+
// plan justifies another round. The cap binds BLOCKING findings only —
|
|
5165
|
+
// everything else is still reported, just not as a gate.
|
|
5166
|
+
const findingClause = reviewBudgetClause(taskTier, agent);
|
|
5167
|
+
const dispatchedTask = findingClause ? `${task}\n\n${findingClause}` : task;
|
|
5168
|
+
|
|
5169
|
+
let result = await dispatchAgent(agent, dispatchedTask, ctx, inputArtifacts, scopeGlobs, watchdog);
|
|
4931
5170
|
let dispatchBilled = result.billed ?? 0;
|
|
4932
5171
|
let dispatchOut = result.out ?? 0;
|
|
4933
5172
|
|
|
@@ -4937,9 +5176,25 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
4937
5176
|
// session with the paths. The dispatcher only ever sees a short notice,
|
|
4938
5177
|
// keeping its context clean of raw findings.
|
|
4939
5178
|
const researchRounds: { questions: string[]; files: string[] }[] = [];
|
|
5179
|
+
let autoResearchTaskCapped = false;
|
|
4940
5180
|
while (result.exitCode === 0 && researchRounds.length < MAX_AUTO_RESEARCH_ROUNDS) {
|
|
4941
|
-
|
|
5181
|
+
// The auto-pipe is exempt from the TURN budget (it is hub mechanics,
|
|
5182
|
+
// not a dispatcher decision, and must not steal the dispatcher's
|
|
5183
|
+
// slots) but NOT from the TASK envelope. At 2 rounds x 4 questions per
|
|
5184
|
+
// dispatch and 18 dispatches per task, leaving it uncounted would put
|
|
5185
|
+
// 144 research runs inside the bound that is meant to be the outer one.
|
|
5186
|
+
const researchLeft = remainingTaskResearch(currentTaskBudget(), taskCounters());
|
|
5187
|
+
if (researchLeft === 0) {
|
|
5188
|
+
autoResearchTaskCapped = true;
|
|
5189
|
+
break;
|
|
5190
|
+
}
|
|
5191
|
+
const questionCap = researchLeft == null
|
|
5192
|
+
? MAX_AUTO_RESEARCH_QUESTIONS
|
|
5193
|
+
: Math.min(MAX_AUTO_RESEARCH_QUESTIONS, researchLeft);
|
|
5194
|
+
const researchQs = extractNeedsResearch(result.output).slice(0, questionCap);
|
|
4942
5195
|
if (researchQs.length === 0) break;
|
|
5196
|
+
taskResearchCount += researchQs.length;
|
|
5197
|
+
updateModeStatus();
|
|
4943
5198
|
|
|
4944
5199
|
if (onUpdate) {
|
|
4945
5200
|
onUpdate({
|
|
@@ -5063,6 +5318,12 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
5063
5318
|
? `\n\n⚠ ${agent} still requests research (${unresolved.length} question(s)) but the auto-research budget is exhausted. ` +
|
|
5064
5319
|
`Run spawn_research yourself and re-dispatch with the findings, or simplify the task.`
|
|
5065
5320
|
: "";
|
|
5321
|
+
const autoResearchTaskNotice = autoResearchTaskCapped
|
|
5322
|
+
? `\n\n⚠ ${agent} paused for research, but the TASK research envelope is spent ` +
|
|
5323
|
+
`(${taskResearchCount}/${currentTaskBudget().maxResearch}) — no helper was spawned and the specialist ` +
|
|
5324
|
+
`was not resumed. Its questions are unanswered. Narrow the task so it can proceed on what it has, ` +
|
|
5325
|
+
`or open a new task window with /af-new-task if this is genuinely different work.`
|
|
5326
|
+
: "";
|
|
5066
5327
|
|
|
5067
5328
|
const returnPathNotice = returnPath ? `\n\nFull specialist output: ${returnPath}` : "";
|
|
5068
5329
|
// Named as a delivery failure, not a result: the run did not answer.
|
|
@@ -5089,6 +5350,42 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
5089
5350
|
: "";
|
|
5090
5351
|
const scopeNotice = scopeNoticeText(scopeViolations);
|
|
5091
5352
|
const contractNotice = contractNoticeText(contractNotices);
|
|
5353
|
+
// External blockers arm the circuit breaker: the NEXT dispatch is refused
|
|
5354
|
+
// until the human has been addressed. Recording it here (not in the
|
|
5355
|
+
// dispatcher's reading of the prose) is the point — a blocker that only
|
|
5356
|
+
// exists in a summary gets routed around.
|
|
5357
|
+
const reportedBlockers = extractExternalBlockers(result.output);
|
|
5358
|
+
let externalBlockerNotice = "";
|
|
5359
|
+
if (reportedBlockers.length > 0) {
|
|
5360
|
+
for (const what of reportedBlockers) {
|
|
5361
|
+
if (!externalBlockers.some(b => b.what === what)) externalBlockers.push({ agent, what });
|
|
5362
|
+
}
|
|
5363
|
+
externalBlockerAcknowledged = false;
|
|
5364
|
+
externalBlockerRefusedOnce = false;
|
|
5365
|
+
externalBlockerNotice = `\n\n⛔ ${agent} reported an EXTERNAL BLOCKER — something outside the fleet's reach is missing:\n` +
|
|
5366
|
+
reportedBlockers.map((w, i) => ` ${i + 1}. ${w}`).join("\n") +
|
|
5367
|
+
`\nThe next dispatch/research call is refused until you escalate this to the human. ` +
|
|
5368
|
+
`Do not build a substitute for the missing fact.`;
|
|
5369
|
+
}
|
|
5370
|
+
// Review accounting: count what came back and say so when it exceeds the
|
|
5371
|
+
// tier's cap. The hub does NOT reclassify findings — no rule it can
|
|
5372
|
+
// evaluate tells "invents a manifest" from "this leaks a credential",
|
|
5373
|
+
// and demoting the second by position is worse than tolerating the
|
|
5374
|
+
// first. The enforcement is the review-ROUND cap above, which needs no
|
|
5375
|
+
// judgement about content.
|
|
5376
|
+
let findingNotice = "";
|
|
5377
|
+
if (isReviewPersona(agent)) {
|
|
5378
|
+
findingNotice = findingBudgetNotice(
|
|
5379
|
+
agent,
|
|
5380
|
+
blockingFindingCap(taskTier),
|
|
5381
|
+
countReviewFindings(result.output),
|
|
5382
|
+
taskReviewRounds,
|
|
5383
|
+
reviewRoundCap(taskTier),
|
|
5384
|
+
) || "";
|
|
5385
|
+
}
|
|
5386
|
+
// A documentation-only dispatch closes on the writer's own verification.
|
|
5387
|
+
const docsNotice = docsLaneNotice(agent, scopeGlobs);
|
|
5388
|
+
const docsLaneText = docsNotice ? `\n\n${docsNotice}` : "";
|
|
5092
5389
|
// An extracted block is labelled every time it is shown: it was restated
|
|
5093
5390
|
// by a cheap pass, not declared by the specialist, and it must never be
|
|
5094
5391
|
// mistaken for first-hand evidence when gating on it.
|
|
@@ -5101,7 +5398,7 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
5101
5398
|
: truncated;
|
|
5102
5399
|
|
|
5103
5400
|
return {
|
|
5104
|
-
content: [{ type: "text", text: `${summary}${questionsNotice}${researchNotice}${budgetNotice}${returnPathNotice}${pendingNotice}${failurePathNotice}${artifactKindNotice}${contextNotice}${scopeNotice}\n\n${digest}` }],
|
|
5401
|
+
content: [{ type: "text", text: `${summary}${externalBlockerNotice}${questionsNotice}${researchNotice}${budgetNotice}${autoResearchTaskNotice}${returnPathNotice}${pendingNotice}${failurePathNotice}${artifactKindNotice}${contextNotice}${scopeNotice}${findingNotice}${docsLaneText}\n\n${digest}` }],
|
|
5105
5402
|
details: {
|
|
5106
5403
|
agent,
|
|
5107
5404
|
task,
|
|
@@ -5203,6 +5500,34 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
5203
5500
|
async execute(_toolCallId, params, _signal, onUpdate, ctx) {
|
|
5204
5501
|
const { task, persona, model, artifacts } = params as { task: string; persona?: string; model?: string; artifacts?: string[] };
|
|
5205
5502
|
|
|
5503
|
+
// Pre-flight refusals before anything is charged: an unacknowledged
|
|
5504
|
+
// external blocker, then the tier's persona gate (deep-researcher is the
|
|
5505
|
+
// most expensive helper in the system and is not a trivial-tier tool).
|
|
5506
|
+
const preflight = preflightGate(persona || "");
|
|
5507
|
+
if (preflight) {
|
|
5508
|
+
turnReport.refusals++;
|
|
5509
|
+
sessionTotals.refusals++;
|
|
5510
|
+
return {
|
|
5511
|
+
content: [{ type: "text", text: preflight.message }],
|
|
5512
|
+
details: { status: preflight.reason, reason: preflight.reason },
|
|
5513
|
+
};
|
|
5514
|
+
}
|
|
5515
|
+
// Task-budget gate: checked before the turn budget (the more severe stop).
|
|
5516
|
+
const taskRefusal = checkTaskBudget(
|
|
5517
|
+
"research",
|
|
5518
|
+
taskCounters(),
|
|
5519
|
+
currentTaskBudget(),
|
|
5520
|
+
taskActiveElapsedMs(),
|
|
5521
|
+
taskTier,
|
|
5522
|
+
);
|
|
5523
|
+
if (taskRefusal) {
|
|
5524
|
+
turnReport.refusals++;
|
|
5525
|
+
sessionTotals.refusals++;
|
|
5526
|
+
return {
|
|
5527
|
+
content: [{ type: "text", text: taskRefusal.message }],
|
|
5528
|
+
details: { status: "task_budget_refused", reason: taskRefusal.reason },
|
|
5529
|
+
};
|
|
5530
|
+
}
|
|
5206
5531
|
// Turn-budget gate (dispatcher-initiated research only — the auto-research
|
|
5207
5532
|
// pipe and the /af-research command are exempt).
|
|
5208
5533
|
const budgetRefusal = checkTurnBudget(
|
|
@@ -5256,6 +5581,7 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
5256
5581
|
}
|
|
5257
5582
|
|
|
5258
5583
|
turnResearchCount++;
|
|
5584
|
+
taskResearchCount++;
|
|
5259
5585
|
turnReport.research++;
|
|
5260
5586
|
sessionTotals.research++;
|
|
5261
5587
|
updateModeStatus();
|
|
@@ -5352,28 +5678,42 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
5352
5678
|
name: "set_task_tier",
|
|
5353
5679
|
label: "Set Task Tier",
|
|
5354
5680
|
description:
|
|
5355
|
-
"Classify
|
|
5681
|
+
"Classify the CURRENT TASK before your first dispatch: trivial (one obvious, low-risk change — 1 dispatch), small (a contained change, no planning pipeline — 2 dispatches), feature (a normal multi-step feature — 6 dispatches), project (a large effort — mode budget applies). The tier persists across user messages and moves by ratchet: LOWERING it is always free, RAISING it requires `reason` naming what the ask turned out to contain. Pass `new_task: true` only when the human has moved on to a genuinely different piece of work — it also resets the task budget.",
|
|
5356
5682
|
parameters: Type.Object({
|
|
5357
5683
|
tier: Type.String({ description: "One of: trivial | small | feature | project" }),
|
|
5358
|
-
reason: Type.Optional(Type.String({ description: "One line on why this tier fits the ask." })),
|
|
5684
|
+
reason: Type.Optional(Type.String({ description: "One line on why this tier fits the ask. REQUIRED when raising the tier above the current one." })),
|
|
5685
|
+
new_task: Type.Optional(Type.Boolean({ description: "The human moved on to a different piece of work: clears the task budget, the tier, and the duplicate guard. Not for a correction or a follow-up on the same work." })),
|
|
5359
5686
|
}),
|
|
5360
5687
|
async execute(_callId, params, _signal, _onUpdate, _ctx) {
|
|
5361
|
-
const { tier, reason } = params as { tier: string; reason?: string };
|
|
5362
|
-
|
|
5363
|
-
|
|
5688
|
+
const { tier, reason, new_task } = params as { tier: string; reason?: string; new_task?: boolean };
|
|
5689
|
+
if (new_task) resetTaskWindow(null);
|
|
5690
|
+
// An ASSUMED tier is the hub's fail-safe, not a declaration to ratchet
|
|
5691
|
+
// against: the dispatcher's own first triage must not be refused as an
|
|
5692
|
+
// "escalation" for lacking a reason it had no way to know it needed.
|
|
5693
|
+
const change = applyTierChange(taskTierAssumed ? null : taskTier, tier, reason);
|
|
5694
|
+
if (!change.ok) {
|
|
5364
5695
|
return {
|
|
5365
|
-
content: [{ type: "text" as const, text:
|
|
5366
|
-
details: { status: "error", tier:
|
|
5696
|
+
content: [{ type: "text" as const, text: change.message }],
|
|
5697
|
+
details: { status: "error", reason: change.reason, tier: change.tier },
|
|
5367
5698
|
};
|
|
5368
5699
|
}
|
|
5369
|
-
|
|
5370
|
-
|
|
5700
|
+
taskTier = change.tier;
|
|
5701
|
+
taskTierAssumed = false;
|
|
5702
|
+
turnReport.tier = change.tier;
|
|
5371
5703
|
updateModeStatus();
|
|
5372
5704
|
const b = currentBudget();
|
|
5705
|
+
const tb = currentTaskBudget();
|
|
5373
5706
|
const cap = (n: number | null) => (n == null ? "unlimited" : String(n));
|
|
5707
|
+
const spent = `${taskDispatchCount}/${cap(tb.maxDispatches)} dispatches, ${taskResearchCount}/${cap(tb.maxResearch)} research`;
|
|
5374
5708
|
return {
|
|
5375
|
-
content: [{
|
|
5376
|
-
|
|
5709
|
+
content: [{
|
|
5710
|
+
type: "text" as const,
|
|
5711
|
+
text: `${change.message}${new_task ? " (new task window opened)" : ""}\n` +
|
|
5712
|
+
`Per turn: ${cap(b.maxDispatches)} dispatches, ${cap(b.maxResearch)} research. ` +
|
|
5713
|
+
`Whole task: ${spent} spent. ` +
|
|
5714
|
+
`Size the apparatus accordingly — do not spend a cap just because it exists.`,
|
|
5715
|
+
}],
|
|
5716
|
+
details: { status: "ok", tier: change.tier, escalated: change.escalated, newTask: !!new_task },
|
|
5377
5717
|
};
|
|
5378
5718
|
},
|
|
5379
5719
|
renderCall(args, theme) {
|
|
@@ -6394,6 +6734,32 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
6394
6734
|
},
|
|
6395
6735
|
});
|
|
6396
6736
|
|
|
6737
|
+
// ── /af-new-task: open a fresh TASK window ──
|
|
6738
|
+
// The task budget is deliberately immune to a user message — a steering
|
|
6739
|
+
// message is a correction, not a new ask, and resetting on it is what let a
|
|
6740
|
+
// run spend a fresh envelope per correction. Opening a new window is
|
|
6741
|
+
// therefore an explicit, human decision, and this is where it is made.
|
|
6742
|
+
pi.registerCommand("af-new-task", {
|
|
6743
|
+
description: "Open a fresh task window: clears the task budget, the task tier, the duplicate guard, and any external-blocker stop. Use when moving on to different work — not for a correction to the current work.",
|
|
6744
|
+
handler: async (args, ctx) => {
|
|
6745
|
+
widgetCtx = ctx;
|
|
6746
|
+
const label = (args || "").trim() || null;
|
|
6747
|
+
const spentDispatches = taskDispatchCount;
|
|
6748
|
+
const spentResearch = taskResearchCount;
|
|
6749
|
+
const spentReviews = taskReviewRounds;
|
|
6750
|
+
const spentMin = Math.round(taskActiveElapsedMs() / 60_000);
|
|
6751
|
+
const priorTier = taskTier;
|
|
6752
|
+
resetTaskWindow(label);
|
|
6753
|
+
ctx.ui.notify(
|
|
6754
|
+
`New task window${label ? `: ${label}` : ""}\n` +
|
|
6755
|
+
`Previous task${priorTier ? ` (tier ${priorTier})` : ""} spent ${spentDispatches} dispatches, ` +
|
|
6756
|
+
`${spentResearch} research, ${spentReviews} review round(s), ${spentMin} min active.\n` +
|
|
6757
|
+
`Tier is unset — the dispatcher re-triages on its next dispatch.`,
|
|
6758
|
+
"success",
|
|
6759
|
+
);
|
|
6760
|
+
},
|
|
6761
|
+
});
|
|
6762
|
+
|
|
6397
6763
|
pi.registerCommand("af-watchdog", {
|
|
6398
6764
|
description: "Drift watchdog: /af-watchdog [on|off|auto] hub-wide, /af-watchdog <agent> [on|off|clear] per agent, no args to show",
|
|
6399
6765
|
handler: async (args, ctx) => {
|
|
@@ -7650,12 +8016,20 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
7650
8016
|
// ask_user call with its tool_execution start/end so /af-agents-history can subtract
|
|
7651
8017
|
// that "away from keyboard" time from the dispatcher's real work.
|
|
7652
8018
|
pi.on("tool_execution_start", async (event) => {
|
|
7653
|
-
if (event.toolName
|
|
8019
|
+
if (event.toolName !== "ask_user") return;
|
|
8020
|
+
askUserStarts.set(event.toolCallId, Date.now());
|
|
8021
|
+
// Asking the human IS the escalation the external-blocker breaker demands:
|
|
8022
|
+
// once it is under way, the gate opens.
|
|
8023
|
+
externalBlockerAcknowledged = true;
|
|
8024
|
+
externalBlockerRefusedOnce = false;
|
|
7654
8025
|
});
|
|
7655
8026
|
pi.on("tool_execution_end", async (event) => {
|
|
7656
8027
|
if (event.toolName !== "ask_user") return;
|
|
7657
8028
|
const startedAt = askUserStarts.get(event.toolCallId);
|
|
7658
8029
|
askUserStarts.delete(event.toolCallId);
|
|
8030
|
+
// The task clock bills active time only — the human's answer is not the
|
|
8031
|
+
// fleet's work, and billing it is what would false-stop a steered session.
|
|
8032
|
+
if (startedAt) turnAskUserWaitMs += Math.max(0, Date.now() - startedAt);
|
|
7659
8033
|
if (startedAt == null) return;
|
|
7660
8034
|
const interval: [number, number] = [startedAt, Date.now()];
|
|
7661
8035
|
// Attach to the live dispatcher entry, or buffer until one is created this turn.
|
|
@@ -7675,18 +8049,28 @@ Finish with the artifact-relative path plus a digest of no more than 10 lines. I
|
|
|
7675
8049
|
currentOrchestratorEntry.endedAt = Date.now();
|
|
7676
8050
|
if (currentOrchestratorEntry.status === "running") currentOrchestratorEntry.status = "done";
|
|
7677
8051
|
}
|
|
8052
|
+
// Fold the turn that just ended into the task's active-time accumulator
|
|
8053
|
+
// before the clock is re-based; inter-turn idle is never charged because
|
|
8054
|
+
// no turn is open across it.
|
|
8055
|
+
closeTurnActiveTime();
|
|
7678
8056
|
turnActive = true;
|
|
7679
8057
|
currentTurnStartedAt = Date.now();
|
|
7680
8058
|
currentOrchestratorEntry = null;
|
|
7681
8059
|
askUserStarts.clear();
|
|
7682
8060
|
turnAskUserIntervals.length = 0;
|
|
7683
|
-
// Fresh turn → fresh budget window (mode
|
|
7684
|
-
//
|
|
7685
|
-
//
|
|
8061
|
+
// Fresh turn → fresh TURN budget window (mode persists across turns). The
|
|
8062
|
+
// TASK budget, the tier, and the external-blocker breaker deliberately do
|
|
8063
|
+
// NOT reset here: a steering message is a correction to the same work, not
|
|
8064
|
+
// a new ask, and resetting on it is precisely how a run spent eight fresh
|
|
8065
|
+
// dispatches per correction and never hit a bound. Only /af-new-task (or
|
|
8066
|
+
// set_task_tier `new_task: true`) opens a new task window.
|
|
7686
8067
|
turnDispatchCount = 0;
|
|
7687
8068
|
turnResearchCount = 0;
|
|
7688
|
-
turnTaskTier = null;
|
|
7689
8069
|
turnDispatchFingerprints.clear();
|
|
8070
|
+
// The human sent a message, so an external blocker has been surfaced to them
|
|
8071
|
+
// by definition — the breaker opens and re-arms on the next report.
|
|
8072
|
+
externalBlockerAcknowledged = true;
|
|
8073
|
+
externalBlockerRefusedOnce = false;
|
|
7690
8074
|
// Snapshot the previous turn's cost report before opening a fresh one.
|
|
7691
8075
|
if (turnReport.dispatches.length > 0 || turnReport.research > 0 || turnReport.refusals > 0) {
|
|
7692
8076
|
lastTurnReport = turnReport;
|
|
@@ -7791,6 +8175,7 @@ ask the human. You MUST instead:
|
|
|
7791
8175
|
// budgets in code (dispatch_agent/spawn_research refuse past them); the
|
|
7792
8176
|
// prompt teaches the dispatcher to plan within them instead of hitting them.
|
|
7793
8177
|
const budget = currentBudget();
|
|
8178
|
+
const taskBudget = currentTaskBudget();
|
|
7794
8179
|
const cap = (n: number | null) => (n == null ? "unlimited" : String(n));
|
|
7795
8180
|
const capMin = (ms: number | null) => (ms == null ? "unlimited" : `${Math.round(ms / 60_000)} min`);
|
|
7796
8181
|
const modeSection = `## Task triage (FIRST, before any dispatch)
|
|
@@ -7807,14 +8192,31 @@ to how interesting the work is.
|
|
|
7807
8192
|
file, a numbered breakdown), do NOT re-plan or re-spec it. Skip planner and
|
|
7808
8193
|
plan-reviewer; batch the plan's tasks straight to the builder and use the plan's own
|
|
7809
8194
|
acceptance criteria as the assertions.
|
|
8195
|
+
- A plan is a spec, NOT a mandate to execute all of it. When the plan is larger than what
|
|
8196
|
+
the user actually asked for, do the asked-for part and say which parts you left — the
|
|
8197
|
+
plan's existence is not consent to run its every gate. If a plan for a small ask has
|
|
8198
|
+
grown gates, manifests, or provenance machinery nobody requested, name that to the user
|
|
8199
|
+
instead of executing it.
|
|
7810
8200
|
- Using every persona is a smell, not a virtue: each dispatch must change the outcome.
|
|
7811
8201
|
If a dispatch's absence would change nothing, don't make it.
|
|
7812
|
-
|
|
7813
|
-
|
|
8202
|
+
- THE TIER IS THE TASK'S, NOT THE TURN'S. It survives the user's next message and moves by
|
|
8203
|
+
ratchet: lowering it is always free, raising it needs a \`reason\` naming what the ask
|
|
8204
|
+
turned out to contain. A correction or follow-up ("no, only the one line") is the SAME
|
|
8205
|
+
task — do not re-triage it upward, and do not pass \`new_task\` for it. At trivial/small
|
|
8206
|
+
tiers the hub refuses planner, plan-reviewer, architect, security-auditor and
|
|
8207
|
+
deep-researcher in code; that refusal is a signal to do the work, not to raise the tier.
|
|
8208
|
+
|
|
8209
|
+
## Execution mode: ${hubMode}${taskTier ? ` · tier: ${taskTier}` : ""}
|
|
7814
8210
|
Budgets for THIS user turn (enforced by the hub — exhausted budgets make dispatch_agent/
|
|
7815
8211
|
spawn_research refuse; a new user message opens a fresh window; /af-hub-mode switches mode):
|
|
7816
8212
|
- dispatch_agent calls: ${cap(budget.maxDispatches)} · spawn_research calls: ${cap(budget.maxResearch)}
|
|
7817
8213
|
- turn wall clock: ${capMin(budget.wallMs)} · per-run deadline: ${capMin(budget.agentTurnMs)}
|
|
8214
|
+
Budgets for the WHOLE TASK (${TASK_BUDGET_MULTIPLIER}× the turn envelope; NOT reset by a user message —
|
|
8215
|
+
only by /af-new-task or set_task_tier \`new_task: true\`). Spent so far:
|
|
8216
|
+
- dispatches ${taskDispatchCount}/${cap(taskBudget.maxDispatches)} · research ${taskResearchCount}/${cap(taskBudget.maxResearch)} · active time ${Math.round(taskActiveElapsedMs() / 60_000)}/${capMin(taskBudget.wallMs)} min
|
|
8217
|
+
- review rounds ${taskReviewRounds}/${cap(reviewRoundCap(taskTier))} (a review is a gate, not a loop)
|
|
8218
|
+
Exhausting the TASK budget is a hard stop: it means the work outgrew its envelope three
|
|
8219
|
+
times over, which is a re-scoping decision for the human, not something to spend through.
|
|
7818
8220
|
Plan within the budget: batch related work into ONE dispatch (a coherent slice of 4–6
|
|
7819
8221
|
plan tasks, not one dispatch per micro-task), and when a budget refusal comes back, STOP —
|
|
7820
8222
|
summarize progress and ask the user; never retry the refused call in the same turn.
|
|
@@ -8300,6 +8702,13 @@ ${researchCatalog}`;
|
|
|
8300
8702
|
}
|
|
8301
8703
|
}
|
|
8302
8704
|
|
|
8705
|
+
// Per-project overrides are parsed BEFORE loadAgents: loadAgents archives the
|
|
8706
|
+
// previous session's artifacts, and that archive has to honor this project's
|
|
8707
|
+
// `run-history-keep` — reading it afterwards would apply the retention one
|
|
8708
|
+
// session late. Everything else the overrides drive is assigned below.
|
|
8709
|
+
const overrides = parseAgentTeamOverrides(_ctx.cwd);
|
|
8710
|
+
runHistoryKeep = overrides.runHistoryKeep;
|
|
8711
|
+
|
|
8303
8712
|
loadAgents(_ctx.cwd);
|
|
8304
8713
|
|
|
8305
8714
|
// Surface non-fatal persona frontmatter warnings (skipped subagents roles,
|
|
@@ -8315,8 +8724,8 @@ ${researchCatalog}`;
|
|
|
8315
8724
|
);
|
|
8316
8725
|
}
|
|
8317
8726
|
|
|
8318
|
-
//
|
|
8319
|
-
|
|
8727
|
+
// Apply the rest of the per-project overrides (user-facing language, persona
|
|
8728
|
+
// gate, models) — parsed above, before loadAgents.
|
|
8320
8729
|
userLanguage = overrides.language;
|
|
8321
8730
|
researchKeep = overrides.researchKeep;
|
|
8322
8731
|
reconSearchTimeoutMs = overrides.reconSearchTimeoutMs;
|
|
@@ -8326,8 +8735,8 @@ ${researchCatalog}`;
|
|
|
8326
8735
|
watchdogJudgeModel = overrides.watchdogJudgeModel;
|
|
8327
8736
|
turnDispatchCount = 0;
|
|
8328
8737
|
turnResearchCount = 0;
|
|
8329
|
-
|
|
8330
|
-
|
|
8738
|
+
// A new session is a new task by definition.
|
|
8739
|
+
resetTaskWindow(null);
|
|
8331
8740
|
updateModeStatus();
|
|
8332
8741
|
if (overrides.warnings.length > 0) {
|
|
8333
8742
|
_ctx.ui.notify(`agent-fleet-overrides warnings:\n${overrides.warnings.join("\n")}`, "warning");
|