@chankov/agent-fleet 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/harnesses/agent-hub/README.md +60 -60
- package/.pi/harnesses/agent-hub/context-window.js +1 -1
- package/.pi/harnesses/agent-hub/drift-watchdog.js +11 -4
- package/.pi/harnesses/agent-hub/execution-profile.ts +69 -0
- package/.pi/harnesses/agent-hub/footer.ts +3 -2
- package/.pi/harnesses/agent-hub/hub-state-audit.js +0 -14
- package/.pi/harnesses/agent-hub/index.ts +351 -261
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/provider-semaphore.js +1 -1
- package/.pi/harnesses/agent-hub/run-budget.js +67 -69
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/fleet-dashboard-view.ts +3 -1
- package/.pi/harnesses/lib/fleet-detail-view.ts +39 -4
- package/.versions/1.0.3/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/1.0.3/.pi/agents/model-profiles.yaml +27 -0
- package/.versions/1.0.3/.pi/agents/peers.yaml +142 -0
- package/.versions/1.0.3/.pi/agents/teams.yaml +41 -0
- package/.versions/1.0.3/.pi/damage-control-rules.yaml +297 -0
- package/.versions/1.0.3/.pi/extensions/agent-fleet-update-check/README.md +57 -0
- package/.versions/1.0.3/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
- package/.versions/1.0.3/.pi/extensions/agent-fleet-update-check/package.json +6 -0
- package/.versions/1.0.3/.pi/extensions/btw/README.md +120 -0
- package/.versions/1.0.3/.pi/extensions/btw/index.ts +914 -0
- package/.versions/1.0.3/.pi/extensions/btw/package.json +6 -0
- package/.versions/1.0.3/.pi/extensions/btw/state.js +179 -0
- package/.versions/1.0.3/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/1.0.3/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/1.0.3/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/1.0.3/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/1.0.3/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/1.0.3/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/1.0.3/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/1.0.3/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/1.0.3/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/1.0.3/.pi/extensions/package-lock.json +1175 -0
- package/.versions/1.0.3/.pi/extensions/package.json +9 -0
- package/.versions/1.0.3/.pi/extensions/pi-voice-stt/README.md +205 -0
- package/.versions/1.0.3/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/1.0.3/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/1.0.3/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/1.0.3/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/1.0.3/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/1.0.3/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/README.md +1156 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/budget-continuation.ts +73 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/context-window.js +106 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/delegate.ts +435 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/docs-lane.js +122 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/drift-watchdog.js +218 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/execution-profile.ts +69 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/footer.ts +36 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/helpers.ts +266 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/hub-state-audit.js +59 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/index.ts +9999 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/posture.ts +158 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/research-retention.js +34 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/return-contract.js +293 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/return-extract.js +75 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/review-findings.js +102 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/run-budget.js +537 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/run-namespace.js +87 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/scope-gate.js +103 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/spawn.ts +366 -0
- package/.versions/1.0.3/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/1.0.3/.pi/harnesses/ask-user-remote/README.md +53 -0
- package/.versions/1.0.3/.pi/harnesses/ask-user-remote/index.ts +532 -0
- package/.versions/1.0.3/.pi/harnesses/ask-user-remote/race-core.js +106 -0
- package/.versions/1.0.3/.pi/harnesses/coms/README.md +100 -0
- package/.versions/1.0.3/.pi/harnesses/coms/index.ts +1767 -0
- package/.versions/1.0.3/.pi/harnesses/coms/package.json +7 -0
- package/.versions/1.0.3/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/1.0.3/.pi/harnesses/damage-control-continue/README.md +124 -0
- package/.versions/1.0.3/.pi/harnesses/damage-control-continue/index.ts +536 -0
- package/.versions/1.0.3/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/1.0.3/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/1.0.3/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/1.0.3/.pi/harnesses/lib/context-budget-child-prompt.ts +179 -0
- package/.versions/1.0.3/.pi/harnesses/lib/context-budget-hub-prompt.ts +116 -0
- package/.versions/1.0.3/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/1.0.3/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/1.0.3/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fleet-dashboard-ops.ts +155 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fleet-dashboard-view.ts +142 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fleet-detail-view.ts +168 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fleet-read-model.ts +131 -0
- package/.versions/1.0.3/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/1.0.3/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/1.0.3/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/1.0.3/.pi/harnesses/lib/spawned-peers.js +190 -0
- package/.versions/1.0.3/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/1.0.3/.pi/harnesses/package.json +10 -0
- package/.versions/1.0.3/.pi/prompts/af-build.md +24 -0
- package/.versions/1.0.3/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/1.0.3/.pi/prompts/af-plan.md +16 -0
- package/.versions/1.0.3/.pi/prompts/af-review.md +16 -0
- package/.versions/1.0.3/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/1.0.3/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/1.0.3/.pi/prompts/af-ship.md +17 -0
- package/.versions/1.0.3/.pi/prompts/af-spec.md +15 -0
- package/.versions/1.0.3/.pi/prompts/af-test.md +19 -0
- package/.versions/1.0.3/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/1.0.3/.version +1 -0
- package/.versions/1.0.3/agents/architect.md +25 -0
- package/.versions/1.0.3/agents/bowser.md +28 -0
- package/.versions/1.0.3/agents/builder.md +55 -0
- package/.versions/1.0.3/agents/code-reviewer.md +209 -0
- package/.versions/1.0.3/agents/deep-researcher.md +33 -0
- package/.versions/1.0.3/agents/documenter.md +19 -0
- package/.versions/1.0.3/agents/orchestrator.md +21 -0
- package/.versions/1.0.3/agents/plan-reviewer.md +84 -0
- package/.versions/1.0.3/agents/planner.md +71 -0
- package/.versions/1.0.3/agents/releaser.md +25 -0
- package/.versions/1.0.3/agents/researcher.md +29 -0
- package/.versions/1.0.3/agents/security-auditor.md +168 -0
- package/.versions/1.0.3/agents/test-engineer.md +154 -0
- package/.versions/1.0.3/agents/web-debugger.md +44 -0
- package/.versions/1.0.3/agents/web-performance-auditor.md +194 -0
- package/.versions/1.0.3/bin/catalog/harness-runtime-closure.json +38 -0
- package/.versions/1.0.3/codex/CONDUCTOR.md +148 -0
- package/.versions/1.0.3/docs/ARCHITECTURE.md +375 -0
- package/.versions/1.0.3/docs/agent-fleet-setup.md +468 -0
- package/.versions/1.0.3/docs/claude-code-coms-bridge.md +128 -0
- package/.versions/1.0.3/docs/codex-remote-conductor.md +170 -0
- package/.versions/1.0.3/docs/coms-hermes-bridge.md +189 -0
- package/.versions/1.0.3/docs/getting-started.md +98 -0
- package/.versions/1.0.3/docs/npm-install.md +292 -0
- package/.versions/1.0.3/docs/pi-extensions.md +441 -0
- package/.versions/1.0.3/docs/pi-setup.md +74 -0
- package/.versions/1.0.3/docs/skill-anatomy.md +150 -0
- package/.versions/1.0.3/hermes/README.md +347 -0
- package/.versions/1.0.3/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/1.0.3/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/1.0.3/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/1.0.3/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/1.0.3/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/1.0.3/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/1.0.3/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/1.0.3/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/1.0.3/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/1.0.3/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/1.0.3/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/1.0.3/install-manifest.json +2745 -0
- package/.versions/1.0.3/justfile +272 -0
- package/.versions/1.0.3/manifest-meta.json +882 -0
- package/.versions/1.0.3/references/accessibility-checklist.md +160 -0
- package/.versions/1.0.3/references/definition-of-done.md +67 -0
- package/.versions/1.0.3/references/fleet-coordination-patterns.md +151 -0
- package/.versions/1.0.3/references/observability-checklist.md +91 -0
- package/.versions/1.0.3/references/orchestration-patterns.md +370 -0
- package/.versions/1.0.3/references/performance-checklist.md +153 -0
- package/.versions/1.0.3/references/prompting-patterns.md +380 -0
- package/.versions/1.0.3/references/security-checklist.md +179 -0
- package/.versions/1.0.3/references/testing-patterns.md +236 -0
- package/.versions/1.0.3/scripts/codex-conductor.ts +41 -0
- package/.versions/1.0.3/scripts/codex-remote-control.ts +167 -0
- package/.versions/1.0.3/scripts/coms-claude-bridge.ts +411 -0
- package/.versions/1.0.3/scripts/coms-cli.ts +484 -0
- package/.versions/1.0.3/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/1.0.3/scripts/fleet.ts +185 -0
- package/.versions/1.0.3/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/1.0.3/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/1.0.3/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/1.0.3/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/1.0.3/scripts/lib/claude-bridge-core.ts +210 -0
- package/.versions/1.0.3/scripts/lib/codex-conductor.ts +88 -0
- package/.versions/1.0.3/scripts/lib/codex-remote-control.ts +480 -0
- package/.versions/1.0.3/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/1.0.3/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/1.0.3/scripts/lib/fleet-command.ts +266 -0
- package/.versions/1.0.3/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/1.0.3/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/1.0.3/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/1.0.3/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/1.0.3/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/1.0.3/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/1.0.3/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/1.0.3/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/1.0.3/scripts/lib/monitor-env.ts +146 -0
- package/.versions/1.0.3/scripts/lib/peer-launch.ts +318 -0
- package/.versions/1.0.3/scripts/lib/persona-banner.ts +62 -0
- package/.versions/1.0.3/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/1.0.3/scripts/lib/team-project.ts +213 -0
- package/.versions/1.0.3/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/1.0.3/scripts/peer-banner.ts +40 -0
- package/.versions/1.0.3/scripts/peer-launch.ts +259 -0
- package/.versions/1.0.3/scripts/team-snapshot.ts +237 -0
- package/.versions/1.0.3/scripts/team-up.ts +406 -0
- package/.versions/1.0.3/skills/_internal/grilling.md +11 -0
- package/.versions/1.0.3/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/1.0.3/skills/code-review-and-quality/SKILL.md +381 -0
- package/.versions/1.0.3/skills/compound-learning/SKILL.md +137 -0
- package/.versions/1.0.3/skills/context-engineering/SKILL.md +291 -0
- package/.versions/1.0.3/skills/deprecation-and-migration/SKILL.md +206 -0
- package/.versions/1.0.3/skills/designing-agents/SKILL.md +394 -0
- package/.versions/1.0.3/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/1.0.3/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/1.0.3/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/1.0.3/skills/idea-refine/SKILL.md +182 -0
- package/.versions/1.0.3/skills/idea-refine/examples.md +238 -0
- package/.versions/1.0.3/skills/idea-refine/frameworks.md +99 -0
- package/.versions/1.0.3/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/1.0.3/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/1.0.3/skills/incremental-implementation/SKILL.md +287 -0
- package/.versions/1.0.3/skills/interview-me/SKILL.md +226 -0
- package/.versions/1.0.3/skills/orchestration-verification/SKILL.md +181 -0
- package/.versions/1.0.3/skills/peer-coms/SKILL.md +90 -0
- package/.versions/1.0.3/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/1.0.3/skills/planning-and-task-breakdown/SKILL.md +254 -0
- package/.versions/1.0.3/skills/security-and-hardening/SKILL.md +461 -0
- package/.versions/1.0.3/skills/spec-driven-development/SKILL.md +257 -0
- package/.versions/1.0.3/skills/using-agent-skills/SKILL.md +199 -0
- package/.versions/1.0.3/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/README.md +11 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
- package/.versions/1.0.3/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
- package/CHANGELOG.md +6 -0
- package/README.md +5 -4
- package/agents/architect.md +1 -0
- package/agents/bowser.md +1 -0
- package/agents/builder.md +1 -0
- package/agents/code-reviewer.md +1 -0
- package/agents/deep-researcher.md +1 -0
- package/agents/documenter.md +1 -0
- package/agents/orchestrator.md +1 -0
- package/agents/plan-reviewer.md +1 -0
- package/agents/planner.md +1 -0
- package/agents/releaser.md +1 -0
- package/agents/researcher.md +1 -0
- package/agents/security-auditor.md +1 -0
- package/agents/test-engineer.md +1 -0
- package/agents/web-debugger.md +1 -0
- package/agents/web-performance-auditor.md +1 -0
- package/bin/lib/validate-overrides.js +1 -1
- package/docs/ARCHITECTURE.md +25 -19
- package/docs/agent-fleet-setup.md +8 -8
- package/docs/pi-extensions.md +4 -2
- package/install-manifest.json +1 -1
- package/package.json +2 -2
- package/scripts/fleet.ts +1 -1
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* /af-agent-model-thinking <persona> — switch a team or research persona's thinking
|
|
24
24
|
* level (off|minimal|low|medium|high|xhigh)
|
|
25
25
|
* /af-models [profile] — apply a named model profile (.pi/agents/model-profiles.yaml)
|
|
26
|
-
* /af-agent-models-substitute <source> <target> —
|
|
26
|
+
* /af-agent-models-substitute [<source> <target>] — visually pick/save a session-wide model substitution
|
|
27
27
|
* /af-dispatch-policy — show which members route to coms peers (.pi/agents/dispatch-policy.yaml)
|
|
28
28
|
* /af-agents-kill <name|rN|all> — SIGTERM a frozen specialist (and its delegation
|
|
29
29
|
* tree); on a research helper it kills AND removes the
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
* (team member, research helper rN, or delegate child id)
|
|
36
36
|
* /af-research <task> — spawn a read-only research helper (@persona, --model)
|
|
37
37
|
* /af-agents-cont rN ... — resume a finished research helper (alias: /af-research-cont)
|
|
38
|
+
* /af-work-mode [operator|orchestrator]
|
|
39
|
+
* — posture picker (alias of /af-posture; Alt+M)
|
|
40
|
+
* /af-posture [operator|orchestrator] — show/switch direct vs delegate-only
|
|
38
41
|
*
|
|
39
42
|
* Finished research helpers are auto-pruned: auto-research pipe helpers as soon
|
|
40
43
|
* as they finish (findings persist as files under findings/), manual/persona
|
|
@@ -47,9 +50,9 @@
|
|
|
47
50
|
* documenter to land them in the project's rules/docs
|
|
48
51
|
*
|
|
49
52
|
* Shortcuts:
|
|
50
|
-
* Alt+A —
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
+
* Alt+A — open the Fleet Dashboard
|
|
54
|
+
* Alt+M — open the posture picker (operator | orchestrator)
|
|
55
|
+
* Alt+Shift+A — toggle the compact running-agents widget
|
|
53
56
|
* Alt+] / Alt+[ — compact view: mark next/previous running subagent
|
|
54
57
|
* Alt+\ — compact view: zoom the marked subagent (Q/Esc closes)
|
|
55
58
|
*
|
|
@@ -90,8 +93,8 @@ import {
|
|
|
90
93
|
exemptionsFilePath, type AccessRequest,
|
|
91
94
|
} from "../lib/damage-control-shared.ts";
|
|
92
95
|
import { applyModelOverride, clampDelegateDepth, DELEGATE_TREE_SPAWN_BUDGET, fallbackModelFor, isReadOnlyToolList, MAX_DELEGATE_DEPTH, normalizeAgentInput, orchestratorNeedsRoster, parseTeamsYaml, safeAgentKey, safePathWithin, taskFingerprint, upsertTeamInYaml } from "./helpers.ts";
|
|
93
|
-
import {
|
|
94
|
-
import { buildBudgetContinuationAudit, buildHubAuditIdentity,
|
|
96
|
+
import { DEFAULT_TASK_TIER, addTaskClockWait, applyTierChange, blockingFindingCap, budgetStatusLine, checkReviewRoundCap, checkTaskBudget, checkTierPersonaGate, checkTurnBudget, closeTaskClock, contextOverflowDiagnostic, createTaskClock, isReviewPersona, openTaskClock, remainingTaskResearch, resetTaskClock, resolveTaskBudget, resolveTurnBudget, reviewBudgetClause, reviewRoundCap, shouldRecycleSession, taskClockElapsedMs } from "./run-budget.js";
|
|
97
|
+
import { buildBudgetContinuationAudit, buildHubAuditIdentity, buildTaskResetAudit } from "./hub-state-audit.js";
|
|
95
98
|
import { countReviewFindings, findingBudgetNotice } from "./review-findings.js";
|
|
96
99
|
import { checkDocsLane, docsLaneNotice } from "./docs-lane.js";
|
|
97
100
|
import { checkExternalBlockerGate, externalBlockedProtocol, extractExternalBlockers } from "./external-blocker.js";
|
|
@@ -117,6 +120,13 @@ import { checkScope, diffAgainst, snapshotWorktree } from "./scope-gate.js";
|
|
|
117
120
|
import { validateEvidence } from "./evidence-rules.js";
|
|
118
121
|
import { comsRequiredRefusal, explicitComsRefusal, parseDispatchPolicy, resolveDispatchBackend } from "./backend-policy.js";
|
|
119
122
|
import { NATIVE_ROSTER_ENTRY_TYPE, parsePosture, persistedNativeRosterState, posturePrompt, resolvePostureTools, resolveSessionPosture, resolveSessionRoster, type Posture } from "./posture.ts";
|
|
123
|
+
import {
|
|
124
|
+
compactPosture,
|
|
125
|
+
executionPairBlockedByRoster,
|
|
126
|
+
parseWorkModeArgs,
|
|
127
|
+
posturePickerOptions,
|
|
128
|
+
selectedPickerValue,
|
|
129
|
+
} from "./execution-profile.ts";
|
|
120
130
|
import { CAPABILITY_PACKS, latestPersistedCapabilityState, persistedCapabilityState, resolveCapabilityPacks, type CapabilityPack, type CapabilityResolution, type ContextState, type PendingOperation } from "./capability-packs.ts";
|
|
121
131
|
import { contextPressureDiagnostic, createContextPressureState, transitionContextPressure, type ContextPressureState } from "./context-pressure.ts";
|
|
122
132
|
import { confirmationGate, confirmationOutcome, capabilityConfirmationPack, capabilityConfirmationQuestion, type CapabilityConfirmationState, type ConfirmableCapabilityPack } from "./capability-confirmation.ts";
|
|
@@ -142,7 +152,7 @@ import { createPanelResources } from "../lib/fleet-panel.ts";
|
|
|
142
152
|
import { buildFleetRows, fleetTiming, summarise, unionMs, type DelegateInput, type FleetRow, type FleetSource, type PeerInput, type ResearchInput, type SpecialistInput } from "../lib/fleet-read-model.ts";
|
|
143
153
|
import { attachFleetDashboardTicker, compactWidgetsEnabled, gridColumnsForItems, gridColumnsForSize, liveTimeline, renderCardGrid, resolveFleetKill, resolveFleetRestart } from "../lib/fleet-dashboard-ops.ts";
|
|
144
154
|
import { dashboardTransition, renderFleetDashboard, FLEET_CHROME_ROWS, type DashboardConfirm } from "../lib/fleet-dashboard-view.ts";
|
|
145
|
-
import { detailContent, detailTransition, fleetModelChoices, modelPickerTransition, normalizeFleetDetailInput, renderFleetDetail, renderFleetModelPicker, DETAIL_CHROME_ROWS, type FleetDetailKey, type FleetModelChoice } from "../lib/fleet-detail-view.ts";
|
|
155
|
+
import { detailContent, detailTransition, fleetModelChoices, modelPickerTransition, normalizeFleetDetailInput, renderFleetDetail, renderFleetModelPicker, renderFleetSubstitutionPicker, DETAIL_CHROME_ROWS, type FleetDetailKey, type FleetModelChoice } from "../lib/fleet-detail-view.ts";
|
|
146
156
|
import { reconcileSelection, type Selection } from "../lib/fleet-selection.ts";
|
|
147
157
|
import { collectContextBudgetSnapshot, type LivePlane } from "./context-budget-snapshot.ts";
|
|
148
158
|
import { CONTEXT_BUDGET_CHROME_ROWS, contextBudgetTransition, renderContextBudget, type ContextBudgetViewState } from "../lib/context-budget-view.ts";
|
|
@@ -444,12 +454,10 @@ function extractNeedsResearch(output: string): string[] {
|
|
|
444
454
|
// recon-search-timeout-s: <1..3600>|off — parent-side deadline for each
|
|
445
455
|
// read/grep/find/ls call made by research helpers
|
|
446
456
|
// and read-only delegate children (default 120).
|
|
447
|
-
// mode:
|
|
448
|
-
//
|
|
449
|
-
//
|
|
450
|
-
//
|
|
451
|
-
// max-dispatches-per-turn: <n>|off — dispatch_agent calls allowed per user turn
|
|
452
|
-
// (replaces the mode default; "off" = unlimited).
|
|
457
|
+
// mode: — REMOVED. Ignored with a warning; budgets follow
|
|
458
|
+
// task tier (see run-budget.js).
|
|
459
|
+
// max-dispatches-per-turn: <n>|off — ceiling on dispatch_agent calls per user turn
|
|
460
|
+
// (min with the task-tier envelope; "off" stays at the tier).
|
|
453
461
|
// max-research-per-turn: <n>|off — spawn_research calls allowed per user turn.
|
|
454
462
|
// turn-wall-time-s: <n>|off — active-time budget per user turn (ask_user waits excluded).
|
|
455
463
|
// agent-turn-timeout-s: <n>|off — whole-run deadline for each spawned
|
|
@@ -480,10 +488,8 @@ interface AgentTeamOverrides {
|
|
|
480
488
|
docsPaths: string[];
|
|
481
489
|
researchKeep: number;
|
|
482
490
|
reconSearchTimeoutMs: number | null;
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
// Per-axis turn-budget overrides for run-budget.js resolveTurnBudget():
|
|
486
|
-
// number replaces the mode default, null = "off", undefined = keep default.
|
|
491
|
+
// Per-axis turn-budget ceilings for run-budget.js resolveTurnBudget():
|
|
492
|
+
// number is min()'d with the task tier; null/"off" stays at the tier.
|
|
487
493
|
budgetOverrides: {
|
|
488
494
|
maxDispatches?: number | null;
|
|
489
495
|
maxResearch?: number | null;
|
|
@@ -511,8 +517,6 @@ const DEFAULT_OVERRIDES: AgentTeamOverrides = {
|
|
|
511
517
|
docsPaths: [],
|
|
512
518
|
researchKeep: DEFAULT_RESEARCH_KEEP,
|
|
513
519
|
reconSearchTimeoutMs: 120_000,
|
|
514
|
-
hubMode: DEFAULT_HUB_MODE,
|
|
515
|
-
hubModeSource: "default",
|
|
516
520
|
budgetOverrides: {},
|
|
517
521
|
watchdogSetting: DEFAULT_WATCHDOG_SETTING,
|
|
518
522
|
watchdogJudgeModel: null,
|
|
@@ -595,13 +599,7 @@ function parseAgentTeamOverrides(cwd: string): AgentTeamOverrides {
|
|
|
595
599
|
}
|
|
596
600
|
}
|
|
597
601
|
if (key === "mode" && value) {
|
|
598
|
-
|
|
599
|
-
if (mode) {
|
|
600
|
-
result.hubMode = mode;
|
|
601
|
-
result.hubModeSource = "project-override";
|
|
602
|
-
} else {
|
|
603
|
-
result.warnings.push(`mode "${value}" is not one of ${HUB_MODES.join("|")} — using the default (${DEFAULT_HUB_MODE})`);
|
|
604
|
-
}
|
|
602
|
+
result.warnings.push(`mode "${value}" is ignored — execution modes were removed; budgets follow task tier. Remove this key.`);
|
|
605
603
|
}
|
|
606
604
|
if (key === "watchdog" && value) {
|
|
607
605
|
const setting = normalizeWatchdogSetting(value);
|
|
@@ -612,8 +610,8 @@ function parseAgentTeamOverrides(cwd: string): AgentTeamOverrides {
|
|
|
612
610
|
}
|
|
613
611
|
}
|
|
614
612
|
if (key === "watchdog-judge-model" && value) result.watchdogJudgeModel = value;
|
|
615
|
-
// Turn-budget keys: a positive integer
|
|
616
|
-
//
|
|
613
|
+
// Turn-budget keys: a positive integer is a ceiling (min with the tier);
|
|
614
|
+
// "off" stays at the tier. Counts are unitless; *-s keys are seconds → ms.
|
|
617
615
|
const budgetKeys: Record<string, { field: keyof AgentTeamOverrides["budgetOverrides"]; scaleMs: boolean }> = {
|
|
618
616
|
"max-dispatches-per-turn": { field: "maxDispatches", scaleMs: false },
|
|
619
617
|
"max-research-per-turn": { field: "maxResearch", scaleMs: false },
|
|
@@ -628,7 +626,7 @@ function parseAgentTeamOverrides(cwd: string): AgentTeamOverrides {
|
|
|
628
626
|
} else if (/^\d+$/.test(value) && Number(value) >= 1) {
|
|
629
627
|
result.budgetOverrides[field] = Number(value) * (scaleMs ? 1000 : 1);
|
|
630
628
|
} else {
|
|
631
|
-
result.warnings.push(`${key} "${value}" is not a positive integer or "off" — using the
|
|
629
|
+
result.warnings.push(`${key} "${value}" is not a positive integer or "off" — using the task-tier default`);
|
|
632
630
|
}
|
|
633
631
|
}
|
|
634
632
|
const slug = "[a-z0-9]+(?:-[a-z0-9]+)*";
|
|
@@ -1970,6 +1968,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
1970
1968
|
// One "coms peer missing → native" notice per member per team activation.
|
|
1971
1969
|
const comsMissNotified = new Set<string>();
|
|
1972
1970
|
const modelOverrides = new Map<string, string>();
|
|
1971
|
+
// Session-wide source → target substitutions. Unlike the eager per-persona map,
|
|
1972
|
+
// these are resolved at spawn time, so personas and delegate roles activated or
|
|
1973
|
+
// created later in the same session inherit the substitution automatically.
|
|
1974
|
+
const modelSubstitutions = new Map<string, string>();
|
|
1973
1975
|
// Session-lifetime per-persona thinking-level overrides set by
|
|
1974
1976
|
// /af-agent-model-thinking (lowercase persona name → pi --thinking level). Wins
|
|
1975
1977
|
// over the persona's frontmatter `thinking:`; resets on session_start; takes
|
|
@@ -1978,7 +1980,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
1978
1980
|
// Session-lifetime model overrides for delegate sub-roles, set by
|
|
1979
1981
|
// /af-agent-model <persona>.<role>. Keyed "<persona>.<role>" (lowercase); applied
|
|
1980
1982
|
// when the dispatch serializes AGENT_HUB_DELEGATE_CONFIG, so nested children
|
|
1981
|
-
// inherit them.
|
|
1983
|
+
// inherit them. Session-wide source substitutions are resolved after this map.
|
|
1984
|
+
// Resets on session_start. /af-models profiles never touch these.
|
|
1982
1985
|
const subagentModelOverrides = new Map<string, string>();
|
|
1983
1986
|
let activeTeamName = "";
|
|
1984
1987
|
let gridCols = 2;
|
|
@@ -2090,12 +2093,11 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2090
2093
|
// Per-tool deadline for read/grep/find/ls in research helpers/delegates. The
|
|
2091
2094
|
// whole-run bound is separate: the turn budget's agentTurnMs (run-budget.js).
|
|
2092
2095
|
let reconSearchTimeoutMs: number | null = 120_000;
|
|
2093
|
-
// ──
|
|
2094
|
-
//
|
|
2095
|
-
//
|
|
2096
|
-
//
|
|
2097
|
-
//
|
|
2098
|
-
let hubMode: string = DEFAULT_HUB_MODE;
|
|
2096
|
+
// ── Per-turn budgets (run-budget.js) ──
|
|
2097
|
+
// Envelopes follow task tier. Override keys are a ceiling (min with the tier).
|
|
2098
|
+
// Counters reset in before_agent_start, or after an explicit one-click
|
|
2099
|
+
// continuation. currentTurnStartedAt (above) is the active-time base; ask_user
|
|
2100
|
+
// waits are subtracted.
|
|
2099
2101
|
let budgetOverrides: AgentTeamOverrides["budgetOverrides"] = {};
|
|
2100
2102
|
let turnDispatchCount = 0;
|
|
2101
2103
|
let turnResearchCount = 0;
|
|
@@ -2120,7 +2122,7 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2120
2122
|
// The task clock charges ACTIVE time only — turns that ran, minus the time the
|
|
2121
2123
|
// dispatcher spent blocked on ask_user. Raw wall clock would bill the human's
|
|
2122
2124
|
// lunch break, an overnight pause, and every long answer against the task, and
|
|
2123
|
-
// at
|
|
2125
|
+
// at small tier's 45-minute envelope that hard-stops a task with two dispatches
|
|
2124
2126
|
// spent. A false stop is worse than no stop: it teaches people to reset the
|
|
2125
2127
|
// task window reflexively, which is the one thing that must stay deliberate.
|
|
2126
2128
|
// The explicit clock state makes `active` authoritative: a stale timestamp can
|
|
@@ -2131,7 +2133,7 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2131
2133
|
// Task tier (complexity triage): declared by the dispatcher via set_task_tier.
|
|
2132
2134
|
// TASK-scoped, not turn-scoped, and it moves by ratchet — down freely, up only
|
|
2133
2135
|
// with a stated reason (applyTierChange). Null until declared; the first
|
|
2134
|
-
// dispatch assumes DEFAULT_TASK_TIER
|
|
2136
|
+
// dispatch assumes DEFAULT_TASK_TIER. Caps come from the tier envelope.
|
|
2135
2137
|
let taskTier: string | null = null;
|
|
2136
2138
|
// Was the tier ASSUMED by the hub rather than declared by the dispatcher? The
|
|
2137
2139
|
// distinction matters to the ratchet: an assumed tier must not turn the
|
|
@@ -2152,13 +2154,15 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2152
2154
|
let runHistoryKeep: number | null = DEFAULT_RUN_HISTORY_KEEP;
|
|
2153
2155
|
// ── Drift watchdog (drift-watchdog.js) ──
|
|
2154
2156
|
// Hub-wide setting from the overrides file, live-switchable via /af-watchdog;
|
|
2155
|
-
// per-agent overrides ("on"/"off") win over it
|
|
2156
|
-
// param wins over both.
|
|
2157
|
+
// per-agent overrides ("on"/"off") win over it. In operator posture a
|
|
2158
|
+
// dispatch_agent `watchdog` param wins over both. In orchestrator posture the
|
|
2159
|
+
// watchdog auto-arms unless hub or per-agent is explicitly off; dispatch
|
|
2160
|
+
// `watchdog: false` cannot disarm it.
|
|
2157
2161
|
let watchdogSetting: string = DEFAULT_WATCHDOG_SETTING;
|
|
2158
2162
|
let watchdogJudgeModel: string | null = null;
|
|
2159
2163
|
const watchdogAgentOverrides = new Map<string, "on" | "off">();
|
|
2160
2164
|
function currentBudget() {
|
|
2161
|
-
return resolveTurnBudget(
|
|
2165
|
+
return resolveTurnBudget(taskTier ?? DEFAULT_TASK_TIER, budgetOverrides);
|
|
2162
2166
|
}
|
|
2163
2167
|
function currentTaskBudget() {
|
|
2164
2168
|
return resolveTaskBudget(currentBudget());
|
|
@@ -2244,23 +2248,6 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2244
2248
|
const where = hubAuditIdentity(ctx);
|
|
2245
2249
|
return `\nRepository: ${where.cwd ?? "unknown"}${where.herdr_pane_id ? ` · pane ${where.herdr_pane_id}` : ""}`;
|
|
2246
2250
|
}
|
|
2247
|
-
function appendHubModeEntry(input: {
|
|
2248
|
-
previousMode: string;
|
|
2249
|
-
mode: string;
|
|
2250
|
-
source: "slash-command" | "project-override" | "default";
|
|
2251
|
-
overrideFile?: string | null;
|
|
2252
|
-
ctx?: ExtensionContext;
|
|
2253
|
-
}) {
|
|
2254
|
-
try {
|
|
2255
|
-
pi.appendEntry("agent-hub-mode", buildHubModeAudit({
|
|
2256
|
-
...input,
|
|
2257
|
-
taskTier,
|
|
2258
|
-
turnDispatches: turnDispatchCount,
|
|
2259
|
-
turnResearch: turnResearchCount,
|
|
2260
|
-
identity: hubAuditIdentity(input.ctx),
|
|
2261
|
-
}));
|
|
2262
|
-
} catch { /* diagnostics are best-effort; state changes still succeed */ }
|
|
2263
|
-
}
|
|
2264
2251
|
function taskResetSnapshot(now = Date.now()) {
|
|
2265
2252
|
return {
|
|
2266
2253
|
tier: taskTier,
|
|
@@ -2303,14 +2290,13 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2303
2290
|
function updateModeStatus() {
|
|
2304
2291
|
try {
|
|
2305
2292
|
widgetCtx?.ui?.setStatus(
|
|
2306
|
-
"hub-
|
|
2293
|
+
"hub-tier",
|
|
2307
2294
|
budgetStatusLine(
|
|
2308
|
-
hubMode,
|
|
2309
2295
|
{ dispatches: turnDispatchCount, research: turnResearchCount },
|
|
2310
2296
|
currentBudget(),
|
|
2311
2297
|
// A trailing "?" marks a tier the hub assumed rather than one the
|
|
2312
2298
|
// dispatcher declared — the human can see that triage was skipped.
|
|
2313
|
-
taskTier && taskTierAssumed ? `${taskTier}?` : taskTier,
|
|
2299
|
+
taskTier && taskTierAssumed ? `${taskTier}?` : (taskTier ?? DEFAULT_TASK_TIER),
|
|
2314
2300
|
{ counters: taskCounters(), budget: currentTaskBudget() },
|
|
2315
2301
|
),
|
|
2316
2302
|
);
|
|
@@ -2321,6 +2307,14 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2321
2307
|
* order: an unacknowledged external blocker, then the tier's persona gate.
|
|
2322
2308
|
* Returns the refusal text, or null when the call may proceed.
|
|
2323
2309
|
*/
|
|
2310
|
+
/** Latch the conservative tier before any fleet action can pass a persona gate. */
|
|
2311
|
+
function ensureTaskTier(): void {
|
|
2312
|
+
if (taskTier !== null) return;
|
|
2313
|
+
taskTier = DEFAULT_TASK_TIER;
|
|
2314
|
+
taskTierAssumed = true;
|
|
2315
|
+
turnReport.tier = taskTier;
|
|
2316
|
+
updateModeStatus();
|
|
2317
|
+
}
|
|
2324
2318
|
function preflightGate(persona: string): { reason: string; message: string } | null {
|
|
2325
2319
|
const blocked = checkExternalBlockerGate({
|
|
2326
2320
|
blockers: externalBlockers,
|
|
@@ -2433,10 +2427,20 @@ APIs, commands, structure), say so in your final response so the docs can be upd
|
|
|
2433
2427
|
return out;
|
|
2434
2428
|
}
|
|
2435
2429
|
|
|
2436
|
-
|
|
2437
|
-
|
|
2430
|
+
function substitutedModel(model: string | undefined): string | undefined {
|
|
2431
|
+
return model ? (modelSubstitutions.get(model) ?? model) : undefined;
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
// The model a persona would dispatch on right now: explicit per-persona
|
|
2435
|
+
// override → frontmatter default, then the session-wide source substitution.
|
|
2436
|
+
// Resolving here (rather than eagerly rewriting every loaded def) makes the
|
|
2437
|
+
// mapping apply to agents activated or spawned later in the same session.
|
|
2438
2438
|
function resolvedModel(def: AgentDef): string | undefined {
|
|
2439
|
-
return modelOverrides.get(def.name.toLowerCase()) ?? def.model;
|
|
2439
|
+
return substitutedModel(modelOverrides.get(def.name.toLowerCase()) ?? def.model);
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
function resolvedSubagentModel(persona: string, role: string, declared: string): string {
|
|
2443
|
+
return substitutedModel(subagentModelOverrides.get(`${persona.toLowerCase()}.${role.toLowerCase()}`) ?? declared) ?? declared;
|
|
2440
2444
|
}
|
|
2441
2445
|
|
|
2442
2446
|
// The raw thinking value a persona would dispatch with right now: session
|
|
@@ -3714,7 +3718,8 @@ ${externalBlockedProtocol()}
|
|
|
3714
3718
|
?? (ctx.model
|
|
3715
3719
|
? `${ctx.model.provider}/${ctx.model.id}`
|
|
3716
3720
|
: "openrouter/google/gemini-3-flash-preview");
|
|
3717
|
-
const
|
|
3721
|
+
const fallbackCandidate = substitutedModel(fallbackModelFor(state.def, model));
|
|
3722
|
+
const originalModelFallback = fallbackCandidate === model ? undefined : fallbackCandidate;
|
|
3718
3723
|
|
|
3719
3724
|
// THIS specialist's window, not the dispatcher's. Measuring a 49k local
|
|
3720
3725
|
// model against a hosted model's window is what produced readings like
|
|
@@ -3785,11 +3790,13 @@ ${externalBlockedProtocol()}
|
|
|
3785
3790
|
// delegate config, so nested children inherit the switch for free.
|
|
3786
3791
|
const subagentRoles = state.def.subagents && Object.keys(state.def.subagents).length > 0
|
|
3787
3792
|
? Object.fromEntries(Object.entries(state.def.subagents).map(([role, r]) => {
|
|
3788
|
-
const
|
|
3789
|
-
|
|
3793
|
+
const effective = resolvedSubagentModel(personaKey, role, r.model);
|
|
3794
|
+
const configured = effective !== r.model ? applyModelOverride(r, effective) : r;
|
|
3795
|
+
const fallback = substitutedModel(configured.fallbackModel);
|
|
3796
|
+
return [role, fallback === configured.model ? { ...configured, fallbackModel: undefined } : { ...configured, fallbackModel: fallback }];
|
|
3790
3797
|
}))
|
|
3791
3798
|
: null;
|
|
3792
|
-
//
|
|
3799
|
+
// Nested delegation follows the task-tier envelope (off at trivial/small).
|
|
3793
3800
|
const delegationActive = turnBudget.delegation && !!subagentRoles && !!delegateExtPath;
|
|
3794
3801
|
const safety = requireSafetyHarness(safetyHarnessPath);
|
|
3795
3802
|
if (!safety.ok) return finishRun(safety.error, 1);
|
|
@@ -3849,7 +3856,7 @@ ${externalBlockedProtocol()}
|
|
|
3849
3856
|
|
|
3850
3857
|
// ── Drift watchdog: layer-1 rules on the live stream, judge on escalation ──
|
|
3851
3858
|
// Precedence: dispatch param > per-agent /af-watchdog override > hub setting.
|
|
3852
|
-
const watchdogArmed = resolveWatchdogActive(watchdogParam, watchdogAgentOverrides.get(key), watchdogSetting);
|
|
3859
|
+
const watchdogArmed = resolveWatchdogActive(watchdogParam, watchdogAgentOverrides.get(key), watchdogSetting, posture);
|
|
3853
3860
|
// The hub ORDERS every specialist to write its deliverable under the session
|
|
3854
3861
|
// artifacts tree, which no dispatcher `scope:` ever lists — so those paths are
|
|
3855
3862
|
// implicitly in scope. Both path forms: the specialist may use either.
|
|
@@ -4336,6 +4343,8 @@ ${externalBlockedProtocol()}
|
|
|
4336
4343
|
// READ-ONLY by construction: RESEARCH_TOOLS only, regardless of persona frontmatter.
|
|
4337
4344
|
let fullText = "";
|
|
4338
4345
|
const researchWindow = resolveContextWindow(state.model, { lookup: modelWindowLookup(ctx), fallbackWindow: contextWindow });
|
|
4346
|
+
const researchFallbackCandidate = substitutedModel(fallbackModelFor(state.def, state.model));
|
|
4347
|
+
const researchFallback = researchFallbackCandidate === state.model ? undefined : researchFallbackCandidate;
|
|
4339
4348
|
notifyProviderQueue(state.model, `Research r${state.id}`, ctx);
|
|
4340
4349
|
const res = await providerSemaphore.run(state.model, () => spawnPiAgentWithModelFallback({
|
|
4341
4350
|
model: state.model,
|
|
@@ -4361,7 +4370,7 @@ ${externalBlockedProtocol()}
|
|
|
4361
4370
|
...researchWatchdogSpawnOptions(reconSearchTimeoutMs, signal),
|
|
4362
4371
|
// Whole-run deadline from the active mode's budget (null in strict mode).
|
|
4363
4372
|
turnDeadlineMs: currentBudget().agentTurnMs,
|
|
4364
|
-
},
|
|
4373
|
+
}, researchFallback, {
|
|
4365
4374
|
onProcess: (p) => { state.proc = p; },
|
|
4366
4375
|
onModelFallback: ({ from, to, reason }) => {
|
|
4367
4376
|
state.lastWork = `model fallback: ${shortModel(from)} → ${shortModel(to)}`;
|
|
@@ -5062,15 +5071,9 @@ ${externalBlockedProtocol()}
|
|
|
5062
5071
|
// Display names / underscores resolve to the persona slug key space, so
|
|
5063
5072
|
// `agent: "Test Engineer"` never burns a dispatch on a lookup error.
|
|
5064
5073
|
const agent = normalizeAgentInput((params as { agent: string }).agent);
|
|
5065
|
-
// Unclassified task: assume the default tier
|
|
5066
|
-
//
|
|
5067
|
-
|
|
5068
|
-
if (taskTier === null && hubMode !== "strict") {
|
|
5069
|
-
taskTier = DEFAULT_TASK_TIER;
|
|
5070
|
-
taskTierAssumed = true;
|
|
5071
|
-
turnReport.tier = taskTier;
|
|
5072
|
-
updateModeStatus();
|
|
5073
|
-
}
|
|
5074
|
+
// Unclassified task: assume the default tier. The prompt asks for
|
|
5075
|
+
// set_task_tier FIRST; this is the fail-safe, not the intended path.
|
|
5076
|
+
ensureTaskTier();
|
|
5074
5077
|
// Pre-flight refusals, in severity order, BEFORE anything is charged: an
|
|
5075
5078
|
// unacknowledged external blocker, the tier's persona gate, the review-round
|
|
5076
5079
|
// cap, then the docs-only lane. None of these reached a specialist, so none
|
|
@@ -5112,7 +5115,7 @@ ${externalBlockedProtocol()}
|
|
|
5112
5115
|
{ dispatches: turnDispatchCount, research: turnResearchCount },
|
|
5113
5116
|
currentBudget(),
|
|
5114
5117
|
turnBudgetActiveElapsedMs(),
|
|
5115
|
-
|
|
5118
|
+
taskTier,
|
|
5116
5119
|
);
|
|
5117
5120
|
if (budgetRefusal) {
|
|
5118
5121
|
turnReport.refusals++;
|
|
@@ -5530,6 +5533,9 @@ ${externalBlockedProtocol()}
|
|
|
5530
5533
|
if (confirmationRefusal) return confirmationRefusal;
|
|
5531
5534
|
const { task, persona, model, artifacts } = params as { task: string; persona?: string; model?: string; artifacts?: string[] };
|
|
5532
5535
|
|
|
5536
|
+
// Research is also a fleet action: latch the conservative tier before
|
|
5537
|
+
// its persona gate, so research-first cannot bypass assumed-small.
|
|
5538
|
+
ensureTaskTier();
|
|
5533
5539
|
// Pre-flight refusals before anything is charged: an unacknowledged
|
|
5534
5540
|
// external blocker, then the tier's persona gate (deep-researcher is the
|
|
5535
5541
|
// most expensive helper in the system and is not a trivial-tier tool).
|
|
@@ -5566,7 +5572,7 @@ ${externalBlockedProtocol()}
|
|
|
5566
5572
|
{ dispatches: turnDispatchCount, research: turnResearchCount },
|
|
5567
5573
|
currentBudget(),
|
|
5568
5574
|
turnBudgetActiveElapsedMs(),
|
|
5569
|
-
|
|
5575
|
+
taskTier,
|
|
5570
5576
|
);
|
|
5571
5577
|
if (budgetRefusal) {
|
|
5572
5578
|
turnReport.refusals++;
|
|
@@ -5702,15 +5708,15 @@ ${externalBlockedProtocol()}
|
|
|
5702
5708
|
});
|
|
5703
5709
|
|
|
5704
5710
|
// ── set_task_tier Tool (complexity triage) ──
|
|
5705
|
-
// The dispatcher classifies each
|
|
5706
|
-
//
|
|
5707
|
-
//
|
|
5711
|
+
// The dispatcher classifies each TASK before its first dispatch; the declared
|
|
5712
|
+
// tier *is* the budget envelope (run-budget.js). Skipping it makes the first
|
|
5713
|
+
// dispatch assume DEFAULT_TASK_TIER.
|
|
5708
5714
|
|
|
5709
5715
|
pi.registerTool({
|
|
5710
5716
|
name: "set_task_tier",
|
|
5711
5717
|
label: "Set Task Tier",
|
|
5712
5718
|
description:
|
|
5713
|
-
"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 —
|
|
5719
|
+
"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 — 8 dispatches), project (a large effort — 12 dispatches). Nested delegation is off at trivial/small. 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.",
|
|
5714
5720
|
parameters: Type.Object({
|
|
5715
5721
|
tier: Type.String({ description: "One of: trivial | small | feature | project" }),
|
|
5716
5722
|
reason: Type.Optional(Type.String({ description: "One line on why this tier fits the ask. REQUIRED when raising the tier above the current one." })),
|
|
@@ -5771,15 +5777,16 @@ ${externalBlockedProtocol()}
|
|
|
5771
5777
|
});
|
|
5772
5778
|
|
|
5773
5779
|
// ── team_adjust Tool (dispatcher-driven roster changes, gated) ──
|
|
5774
|
-
// The dispatcher may restructure its own team mid-session — but never
|
|
5775
|
-
//
|
|
5780
|
+
// The dispatcher may restructure its own team mid-session — but never when the
|
|
5781
|
+
// current tier has nested delegation off, never past the roster cap, and the
|
|
5782
|
+
// human is notified of every change.
|
|
5776
5783
|
const TEAM_ADJUST_ROSTER_CAP = 8;
|
|
5777
5784
|
|
|
5778
5785
|
pi.registerTool({
|
|
5779
5786
|
name: "team_adjust",
|
|
5780
5787
|
label: "Team Adjust",
|
|
5781
5788
|
description:
|
|
5782
|
-
"Add or drop a specialist persona in the ACTIVE team (the roster you can dispatch to). Use sparingly, when the current roster genuinely cannot serve the task (e.g. add security-auditor for a security-sensitive change, drop an unused specialist). Not available
|
|
5789
|
+
"Add or drop a specialist persona in the ACTIVE team (the roster you can dispatch to). Use sparingly, when the current roster genuinely cannot serve the task (e.g. add security-auditor for a security-sensitive change, drop an unused specialist). Not available at trivial/small tiers. The human sees every change and can revert with /af-agents-add /af-agents-drop.",
|
|
5783
5790
|
parameters: Type.Object({
|
|
5784
5791
|
action: Type.String({ description: "add | drop" }),
|
|
5785
5792
|
agent: Type.String({ description: "Persona name (case-insensitive), e.g. security-auditor" }),
|
|
@@ -5790,9 +5797,10 @@ ${externalBlockedProtocol()}
|
|
|
5790
5797
|
if (confirmationRefusal) return confirmationRefusal;
|
|
5791
5798
|
const { action, agent, reason } = params as { action: string; agent: string; reason: string };
|
|
5792
5799
|
const act = String(action || "").trim().toLowerCase();
|
|
5793
|
-
if (
|
|
5800
|
+
if (!currentBudget().delegation) {
|
|
5801
|
+
const tier = taskTier ?? DEFAULT_TASK_TIER;
|
|
5794
5802
|
return {
|
|
5795
|
-
content: [{ type: "text" as const, text:
|
|
5803
|
+
content: [{ type: "text" as const, text: `team_adjust is disabled at tier "${tier}" — a single-specialist path never needs roster changes. Raise the task tier with set_task_tier if the work outgrew "${tier}".` }],
|
|
5796
5804
|
details: { status: "refused" },
|
|
5797
5805
|
};
|
|
5798
5806
|
}
|
|
@@ -6888,29 +6896,78 @@ ${externalBlockedProtocol()}
|
|
|
6888
6896
|
return null;
|
|
6889
6897
|
}
|
|
6890
6898
|
const overrideKey = `${delegation.owner.def.name.toLowerCase()}.${role[0].toLowerCase()}`;
|
|
6891
|
-
return { kind: "delegate", current:
|
|
6899
|
+
return { kind: "delegate", current: resolvedSubagentModel(delegation.owner.def.name, role[0], role[1].model), delegation, role, overrideKey };
|
|
6892
6900
|
}
|
|
6893
6901
|
|
|
6894
|
-
|
|
6895
|
-
async function loadFleetDetailModelChoices(row: FleetRow, ctx: any): Promise<{ choices: FleetModelChoice[]; current: string } | null> {
|
|
6896
|
-
const target = resolveFleetDetailModelTarget(row, ctx);
|
|
6897
|
-
if (!target) return null;
|
|
6902
|
+
async function loadAvailableModelChoices(ctx: any, current?: string): Promise<FleetModelChoice[] | null> {
|
|
6898
6903
|
try { await ctx.modelRegistry?.refresh?.(); } catch { /* retain the registry's last-known available list */ }
|
|
6899
|
-
const choices = fleetModelChoices(ctx.modelRegistry?.getAvailable?.() ?? [],
|
|
6904
|
+
const choices = fleetModelChoices(ctx.modelRegistry?.getAvailable?.() ?? [], current);
|
|
6900
6905
|
if (choices.length === 0) {
|
|
6901
6906
|
const diagnostic = ctx.modelRegistry?.getError?.();
|
|
6902
6907
|
ctx.ui.notify(`Pi reports no available models${diagnostic ? `: ${diagnostic}` : "."}`, "warning");
|
|
6903
6908
|
return null;
|
|
6904
6909
|
}
|
|
6905
|
-
return
|
|
6910
|
+
return choices;
|
|
6911
|
+
}
|
|
6912
|
+
|
|
6913
|
+
/** Load every model Pi currently reports as available for the inline picker. */
|
|
6914
|
+
async function loadFleetDetailModelChoices(row: FleetRow, ctx: any): Promise<{ choices: FleetModelChoice[]; current: string } | null> {
|
|
6915
|
+
const target = resolveFleetDetailModelTarget(row, ctx);
|
|
6916
|
+
if (!target) return null;
|
|
6917
|
+
const choices = await loadAvailableModelChoices(ctx, target.current);
|
|
6918
|
+
return choices ? { choices, current: target.current } : null;
|
|
6919
|
+
}
|
|
6920
|
+
|
|
6921
|
+
function substitutionSourceChoices(): FleetModelChoice[] {
|
|
6922
|
+
return allKnownModels().map(spec => {
|
|
6923
|
+
const target = modelSubstitutions.get(spec);
|
|
6924
|
+
return { spec, label: target ? `${spec} → ${target} (active this session)` : spec };
|
|
6925
|
+
});
|
|
6926
|
+
}
|
|
6927
|
+
|
|
6928
|
+
async function applySessionModelSubstitution(source: string, target: string, ctx: any): Promise<boolean> {
|
|
6929
|
+
const known = allKnownModels();
|
|
6930
|
+
if (!known.includes(source)) {
|
|
6931
|
+
ctx.ui.notify(`Unknown configured source model "${source}". Choose one of: ${known.join(", ") || "none"}.`, "error");
|
|
6932
|
+
return false;
|
|
6933
|
+
}
|
|
6934
|
+
const available = await loadAvailableModelChoices(ctx, modelSubstitutions.get(source));
|
|
6935
|
+
if (!available) return false;
|
|
6936
|
+
if (!available.some(choice => choice.spec === target)) {
|
|
6937
|
+
ctx.ui.notify(`Target model "${target}" is not currently available in Pi.`, "error");
|
|
6938
|
+
return false;
|
|
6939
|
+
}
|
|
6940
|
+
if (source === target) {
|
|
6941
|
+
ctx.ui.notify(`Source and target are the same (${source}); the session substitution was not changed.`, "info");
|
|
6942
|
+
return false;
|
|
6943
|
+
}
|
|
6944
|
+
const previous = modelSubstitutions.get(source);
|
|
6945
|
+
if (previous === target) {
|
|
6946
|
+
ctx.ui.notify(`Substitution ${source} → ${target} is already active for this session.`, "info");
|
|
6947
|
+
return false;
|
|
6948
|
+
}
|
|
6949
|
+
modelSubstitutions.set(source, target);
|
|
6950
|
+
const personas = allAgentDefs.filter(def => (modelOverrides.get(def.name.toLowerCase()) ?? def.model) === source);
|
|
6951
|
+
const roles = allAgentDefs.flatMap(def => Object.entries(def.subagents ?? {})
|
|
6952
|
+
.filter(([role, config]) => (subagentModelOverrides.get(`${def.name.toLowerCase()}.${role.toLowerCase()}`) ?? config.model) === source)
|
|
6953
|
+
.map(([role]) => `${def.name}.${role}`));
|
|
6954
|
+
updateWidget();
|
|
6955
|
+
ctx.ui.notify(
|
|
6956
|
+
`${previous ? "Updated" : "Saved"} session substitution ${source} → ${target}. ` +
|
|
6957
|
+
`${personas.length} persona${personas.length === 1 ? "" : "s"} and ${roles.length} sub-role${roles.length === 1 ? "" : "s"} currently resolve through it; ` +
|
|
6958
|
+
`future agents spawned from the same configured source inherit it automatically. Current runs are not interrupted.`,
|
|
6959
|
+
"success",
|
|
6960
|
+
);
|
|
6961
|
+
return true;
|
|
6906
6962
|
}
|
|
6907
6963
|
|
|
6908
6964
|
/** Apply an inline-picker choice to the next run; never interrupt a live child. */
|
|
6909
6965
|
function applyFleetDetailModel(row: FleetRow, picked: string, ctx: any): boolean {
|
|
6910
6966
|
const target = resolveFleetDetailModelTarget(row, ctx);
|
|
6911
6967
|
if (!target) return false;
|
|
6912
|
-
|
|
6913
|
-
|
|
6968
|
+
const effectivePicked = substitutedModel(picked) ?? picked;
|
|
6969
|
+
if (effectivePicked === target.current) {
|
|
6970
|
+
ctx.ui.notify(`${row.name} is already on ${effectivePicked}`, "info");
|
|
6914
6971
|
return false;
|
|
6915
6972
|
}
|
|
6916
6973
|
let applyHint = "applies on the next run";
|
|
@@ -6928,7 +6985,7 @@ ${externalBlockedProtocol()}
|
|
|
6928
6985
|
applyHint = `applies on the next ${displayName(target.delegation.owner.def.name)} dispatch`;
|
|
6929
6986
|
}
|
|
6930
6987
|
updateWidget();
|
|
6931
|
-
ctx.ui.notify(`${row.name} → ${
|
|
6988
|
+
ctx.ui.notify(`${row.name} → ${effectivePicked} (${applyHint}; current runs are not interrupted)`, "success");
|
|
6932
6989
|
if (target.kind === "specialist" && (dispatchPolicy.substitutions[target.state.def.name.toLowerCase()]?.prefer ?? dispatchPolicy.default) === "coms") {
|
|
6933
6990
|
ctx.ui.notify("This specialist prefers a coms peer; the choice applies to native fallback runs, while the peer keeps its own model.", "info");
|
|
6934
6991
|
}
|
|
@@ -6977,7 +7034,8 @@ ${externalBlockedProtocol()}
|
|
|
6977
7034
|
const picked = modelPicker.choices[modelPicker.index]?.spec;
|
|
6978
7035
|
modelPicker = null;
|
|
6979
7036
|
if (picked && applyFleetDetailModel(detailRow, picked, ctx)) {
|
|
6980
|
-
|
|
7037
|
+
const effectivePicked = substitutedModel(picked) ?? picked;
|
|
7038
|
+
detailRow = { ...detailRow, model: detailRow.status === "running" ? `${detailRow.model} → ${shortModel(effectivePicked)} next` : `${shortModel(effectivePicked)} (next)` };
|
|
6981
7039
|
}
|
|
6982
7040
|
}
|
|
6983
7041
|
tui.requestRender();
|
|
@@ -7041,12 +7099,23 @@ ${externalBlockedProtocol()}
|
|
|
7041
7099
|
const result = await dispatchAgent(state.def.name, state.task, ctx);
|
|
7042
7100
|
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 });
|
|
7043
7101
|
}
|
|
7044
|
-
|
|
7102
|
+
type FleetSubstitutionPickerState = {
|
|
7103
|
+
stage: "source" | "target";
|
|
7104
|
+
source?: string;
|
|
7105
|
+
choices: FleetModelChoice[];
|
|
7106
|
+
index: number;
|
|
7107
|
+
scrollOffset: number;
|
|
7108
|
+
};
|
|
7109
|
+
|
|
7110
|
+
async function openFleetDashboard(ctx: any, startSubstitution = false): Promise<void> {
|
|
7045
7111
|
const resources = createPanelResources();
|
|
7046
7112
|
const selection: Selection = { index: 0 };
|
|
7047
7113
|
let scrollOffset = 0;
|
|
7048
7114
|
let filtering = false;
|
|
7049
7115
|
let confirm: DashboardConfirm = null;
|
|
7116
|
+
let substitutionPicker: FleetSubstitutionPickerState | null = startSubstitution
|
|
7117
|
+
? { stage: "source", choices: substitutionSourceChoices(), index: 0, scrollOffset: 0 }
|
|
7118
|
+
: null;
|
|
7050
7119
|
const toInput = (data: string): string => {
|
|
7051
7120
|
if (matchesKey(data, Key.up)) return "\u001b[A";
|
|
7052
7121
|
if (matchesKey(data, Key.down)) return "\u001b[B";
|
|
@@ -7064,6 +7133,12 @@ ${externalBlockedProtocol()}
|
|
|
7064
7133
|
const rows = fleetRows();
|
|
7065
7134
|
reconcileSelection(selection, rows);
|
|
7066
7135
|
const body = bodyRows(tui.terminal?.rows, FLEET_CHROME_ROWS);
|
|
7136
|
+
if (substitutionPicker) {
|
|
7137
|
+
return renderFleetSubstitutionPicker(
|
|
7138
|
+
substitutionPicker.stage, substitutionPicker.source, substitutionPicker.choices,
|
|
7139
|
+
substitutionPicker, w, body, theme,
|
|
7140
|
+
);
|
|
7141
|
+
}
|
|
7067
7142
|
scrollOffset = clampScroll(scrollOffset, rows.length, body);
|
|
7068
7143
|
const summary = summarise(rows);
|
|
7069
7144
|
return renderFleetDashboard({
|
|
@@ -7078,13 +7153,44 @@ ${externalBlockedProtocol()}
|
|
|
7078
7153
|
const rows = fleetRows();
|
|
7079
7154
|
reconcileSelection(selection, rows);
|
|
7080
7155
|
const body = bodyRows(tui.terminal?.rows, FLEET_CHROME_ROWS);
|
|
7156
|
+
const input = toInput(data);
|
|
7157
|
+
if (substitutionPicker) {
|
|
7158
|
+
const action = modelPickerTransition(input, substitutionPicker, substitutionPicker.choices.length, body);
|
|
7159
|
+
if (action === "cancel") {
|
|
7160
|
+
if (substitutionPicker.stage === "target") {
|
|
7161
|
+
const source = substitutionPicker.source;
|
|
7162
|
+
const choices = substitutionSourceChoices();
|
|
7163
|
+
const index = Math.max(0, choices.findIndex(choice => choice.spec === source));
|
|
7164
|
+
substitutionPicker = { stage: "source", choices, index, scrollOffset: index };
|
|
7165
|
+
} else substitutionPicker = null;
|
|
7166
|
+
} else if (action === "select") {
|
|
7167
|
+
const picked = substitutionPicker.choices[substitutionPicker.index]?.spec;
|
|
7168
|
+
if (picked && substitutionPicker.stage === "source") {
|
|
7169
|
+
const targets = await loadAvailableModelChoices(ctx, modelSubstitutions.get(picked));
|
|
7170
|
+
if (targets) {
|
|
7171
|
+
const current = modelSubstitutions.get(picked);
|
|
7172
|
+
const index = Math.max(0, targets.findIndex(choice => choice.spec === current));
|
|
7173
|
+
substitutionPicker = { stage: "target", source: picked, choices: targets, index, scrollOffset: index };
|
|
7174
|
+
}
|
|
7175
|
+
} else if (picked && substitutionPicker.source) {
|
|
7176
|
+
await applySessionModelSubstitution(substitutionPicker.source, picked, ctx);
|
|
7177
|
+
substitutionPicker = null;
|
|
7178
|
+
}
|
|
7179
|
+
}
|
|
7180
|
+
tui.requestRender();
|
|
7181
|
+
return;
|
|
7182
|
+
}
|
|
7081
7183
|
const state = { selection, scrollOffset, filtering, filterQuery: fleetFilter, showFinished: fleetShowFinished, confirm };
|
|
7082
|
-
const intent = dashboardTransition(
|
|
7184
|
+
const intent = dashboardTransition(input, state, rows, body);
|
|
7083
7185
|
({ scrollOffset, filtering, confirm } = state);
|
|
7084
7186
|
fleetFilter = state.filterQuery;
|
|
7085
7187
|
fleetShowFinished = state.showFinished;
|
|
7086
7188
|
if (intent === "close") done();
|
|
7087
|
-
else if (intent
|
|
7189
|
+
else if (intent === "substitute") {
|
|
7190
|
+
const choices = substitutionSourceChoices();
|
|
7191
|
+
if (choices.length === 0) ctx.ui.notify("No configured persona or sub-role models are available as substitution sources.", "warning");
|
|
7192
|
+
else substitutionPicker = { stage: "source", choices, index: 0, scrollOffset: 0 };
|
|
7193
|
+
} else if (intent && typeof intent === "object" && "open" in intent) {
|
|
7088
7194
|
const selected = rows.find(r => r.key === intent.open) ?? rows[selection.index];
|
|
7089
7195
|
if (selected) await openFleetDetail(selected, ctx);
|
|
7090
7196
|
} else if (intent && typeof intent === "object" && "kill" in intent) {
|
|
@@ -7284,6 +7390,64 @@ ${externalBlockedProtocol()}
|
|
|
7284
7390
|
handler: async (_args, ctx) => { widgetCtx = ctx; await openContextBudget(ctx); },
|
|
7285
7391
|
});
|
|
7286
7392
|
|
|
7393
|
+
function rosterRefusalMessage(): string {
|
|
7394
|
+
return "Orchestrator posture requires at least one native specialist. Add one with /af-agents-add or select /af-agents-team first.";
|
|
7395
|
+
}
|
|
7396
|
+
|
|
7397
|
+
function watchdogArmedNote(next: Posture): string {
|
|
7398
|
+
if (next !== "orchestrator") return "";
|
|
7399
|
+
const armed = resolveWatchdogActive(undefined, undefined, watchdogSetting, next);
|
|
7400
|
+
return armed
|
|
7401
|
+
? "\nDrift watchdog: armed (orchestrator auto). /af-watchdog off to disarm."
|
|
7402
|
+
: "\nDrift watchdog: off (explicit hub setting).";
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7405
|
+
async function commitPosture(next: Posture, ctx: ExtensionContext): Promise<"ok" | "unchanged" | "roster"> {
|
|
7406
|
+
if (orchestratorNeedsRoster(next, agentStates.size)) return "roster";
|
|
7407
|
+
if (next === posture) return "unchanged";
|
|
7408
|
+
posture = next;
|
|
7409
|
+
if (posture === "operator") {
|
|
7410
|
+
rosterRecoveryRequired = false;
|
|
7411
|
+
rosterRecoveryDiagnostic = "";
|
|
7412
|
+
setTimeout(replayDeferredRecoveryInputs, 0);
|
|
7413
|
+
}
|
|
7414
|
+
if (posture === "orchestrator" && personaGateEnabled && !personaGateSatisfied) {
|
|
7415
|
+
await pickDispatcherPersona(ctx);
|
|
7416
|
+
}
|
|
7417
|
+
resolveIncomingCapabilities("");
|
|
7418
|
+
applyPostureTools();
|
|
7419
|
+
updatePostureStatus(ctx);
|
|
7420
|
+
pi.appendEntry("agent-hub-posture", { posture });
|
|
7421
|
+
return "ok";
|
|
7422
|
+
}
|
|
7423
|
+
|
|
7424
|
+
async function applyPostureSelection(next: Posture, ctx: ExtensionContext, deprecatedFrom?: string): Promise<void> {
|
|
7425
|
+
if (executionPairBlockedByRoster(posture, next, agentStates.size)) {
|
|
7426
|
+
ctx.ui.notify(rosterRefusalMessage(), "warning");
|
|
7427
|
+
return;
|
|
7428
|
+
}
|
|
7429
|
+
const result = await commitPosture(next, ctx);
|
|
7430
|
+
if (result === "roster") {
|
|
7431
|
+
ctx.ui.notify(rosterRefusalMessage(), "warning");
|
|
7432
|
+
return;
|
|
7433
|
+
}
|
|
7434
|
+
const deprecation = deprecatedFrom
|
|
7435
|
+
? `"${deprecatedFrom}" is no longer an execution mode; mapped to ${next} posture.\n`
|
|
7436
|
+
: "";
|
|
7437
|
+
ctx.ui.notify(
|
|
7438
|
+
`${deprecation}${postureStatusText()}\nPrompt and tools update on the next model call.${watchdogArmedNote(next)}`,
|
|
7439
|
+
result === "ok" ? "success" : "info",
|
|
7440
|
+
);
|
|
7441
|
+
}
|
|
7442
|
+
|
|
7443
|
+
async function openPosturePicker(ctx: ExtensionContext): Promise<void> {
|
|
7444
|
+
const picker = posturePickerOptions(posture);
|
|
7445
|
+
const choice = await ctx.ui.select(picker.title, picker.options);
|
|
7446
|
+
const next = selectedPickerValue(picker.options, choice, picker.postures);
|
|
7447
|
+
if (!next) return;
|
|
7448
|
+
await applyPostureSelection(next, ctx);
|
|
7449
|
+
}
|
|
7450
|
+
|
|
7287
7451
|
// ── /af-posture: direct operator ↔ restricted orchestrator ──
|
|
7288
7452
|
pi.registerCommand("af-posture", {
|
|
7289
7453
|
description: "Show or set the Fleet posture: operator (direct tools) | orchestrator (delegate-only)",
|
|
@@ -7291,6 +7455,10 @@ ${externalBlockedProtocol()}
|
|
|
7291
7455
|
widgetCtx = ctx;
|
|
7292
7456
|
const requested = (args || "").trim();
|
|
7293
7457
|
if (!requested) {
|
|
7458
|
+
if (ctx.hasUI && typeof ctx.ui.select === "function") {
|
|
7459
|
+
await openPosturePicker(ctx);
|
|
7460
|
+
return;
|
|
7461
|
+
}
|
|
7294
7462
|
ctx.ui.notify(`${postureStatusText()}\nSwitch with /af-posture operator|orchestrator`, "info");
|
|
7295
7463
|
return;
|
|
7296
7464
|
}
|
|
@@ -7299,59 +7467,31 @@ ${externalBlockedProtocol()}
|
|
|
7299
7467
|
ctx.ui.notify(`Unknown posture "${requested}" — expected operator|orchestrator.`, "error");
|
|
7300
7468
|
return;
|
|
7301
7469
|
}
|
|
7302
|
-
|
|
7303
|
-
ctx.ui.notify("Orchestrator posture requires at least one native specialist. Add one with /af-agents-add or select /af-agents-team first.", "warning");
|
|
7304
|
-
return;
|
|
7305
|
-
}
|
|
7306
|
-
posture = next;
|
|
7307
|
-
if (posture === "operator") {
|
|
7308
|
-
rosterRecoveryRequired = false;
|
|
7309
|
-
rosterRecoveryDiagnostic = "";
|
|
7310
|
-
setTimeout(replayDeferredRecoveryInputs, 0);
|
|
7311
|
-
}
|
|
7312
|
-
if (posture === "orchestrator" && personaGateEnabled && !personaGateSatisfied) {
|
|
7313
|
-
await pickDispatcherPersona(ctx);
|
|
7314
|
-
}
|
|
7315
|
-
resolveIncomingCapabilities("");
|
|
7316
|
-
applyPostureTools();
|
|
7317
|
-
updatePostureStatus(ctx);
|
|
7318
|
-
pi.appendEntry("agent-hub-posture", { posture });
|
|
7319
|
-
ctx.ui.notify(`${postureStatusText()}\nPrompt and tools update on the next model call.`, "success");
|
|
7470
|
+
await applyPostureSelection(next, ctx);
|
|
7320
7471
|
},
|
|
7321
7472
|
});
|
|
7322
7473
|
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
// the NEXT tool call (counters are per user turn and keep running); the
|
|
7326
|
-
// dispatcher prompt rebuilds with the new mode on the next turn.
|
|
7327
|
-
pi.registerCommand("af-hub-mode", {
|
|
7328
|
-
description: "Show or set the execution mode: fast (single specialist) | standard (batched, default) | strict (full Verification Contract)",
|
|
7474
|
+
pi.registerCommand("af-work-mode", {
|
|
7475
|
+
description: "Show or set Fleet posture (operator | orchestrator). Alt+M opens the picker.",
|
|
7329
7476
|
handler: async (args, ctx) => {
|
|
7330
7477
|
widgetCtx = ctx;
|
|
7331
|
-
const
|
|
7332
|
-
if (!
|
|
7333
|
-
|
|
7334
|
-
|
|
7478
|
+
const parsed = parseWorkModeArgs(args);
|
|
7479
|
+
if (!parsed.ok) {
|
|
7480
|
+
ctx.ui.notify(parsed.error, "error");
|
|
7481
|
+
return;
|
|
7482
|
+
}
|
|
7483
|
+
if (parsed.action === "apply") {
|
|
7484
|
+
await applyPostureSelection(parsed.posture, ctx, parsed.deprecatedFrom);
|
|
7485
|
+
return;
|
|
7486
|
+
}
|
|
7487
|
+
if (!ctx.hasUI || typeof ctx.ui.select !== "function") {
|
|
7335
7488
|
ctx.ui.notify(
|
|
7336
|
-
|
|
7337
|
-
`${turnResearchCount}/${cap(b.maxResearch)} research\nSwitch with /af-hub-mode ${HUB_MODES.join("|")}`,
|
|
7489
|
+
`${postureStatusText()}\nSwitch with /af-work-mode operator|orchestrator`,
|
|
7338
7490
|
"info",
|
|
7339
7491
|
);
|
|
7340
7492
|
return;
|
|
7341
7493
|
}
|
|
7342
|
-
|
|
7343
|
-
if (!mode) {
|
|
7344
|
-
ctx.ui.notify(`Unknown mode "${requested}" — expected one of: ${HUB_MODES.join(", ")}`, "error");
|
|
7345
|
-
return;
|
|
7346
|
-
}
|
|
7347
|
-
const previousMode = hubMode;
|
|
7348
|
-
hubMode = mode;
|
|
7349
|
-
updateModeStatus();
|
|
7350
|
-
appendHubModeEntry({ previousMode, mode, source: "slash-command", ctx });
|
|
7351
|
-
ctx.ui.notify(
|
|
7352
|
-
`Execution mode → ${mode} (budgets apply from the next dispatch; prompt updates next turn)` + hubLocationSuffix(ctx),
|
|
7353
|
-
"success",
|
|
7354
|
-
);
|
|
7494
|
+
await openPosturePicker(ctx);
|
|
7355
7495
|
},
|
|
7356
7496
|
});
|
|
7357
7497
|
|
|
@@ -7514,6 +7654,20 @@ ${externalBlockedProtocol()}
|
|
|
7514
7654
|
void openFleetDashboard(ctx);
|
|
7515
7655
|
},
|
|
7516
7656
|
});
|
|
7657
|
+
pi.registerShortcut("alt+m", {
|
|
7658
|
+
description: "Open posture picker",
|
|
7659
|
+
handler: (ctx) => {
|
|
7660
|
+
widgetCtx = ctx;
|
|
7661
|
+
if (!ctx.hasUI || typeof ctx.ui.select !== "function") {
|
|
7662
|
+
ctx.ui.notify(
|
|
7663
|
+
`${postureStatusText()}\nSwitch with /af-work-mode operator|orchestrator`,
|
|
7664
|
+
"info",
|
|
7665
|
+
);
|
|
7666
|
+
return;
|
|
7667
|
+
}
|
|
7668
|
+
void openPosturePicker(ctx);
|
|
7669
|
+
},
|
|
7670
|
+
});
|
|
7517
7671
|
pi.registerShortcut("alt+shift+a", {
|
|
7518
7672
|
description: "Toggle compact agent widget",
|
|
7519
7673
|
handler: (ctx) => { widgetCtx = ctx; viewMode = viewMode === "compact" ? "off" : "compact"; updateWidget(); updateResearchWidget(); ctx.ui.notify(`Compact agent widget: ${viewMode}`, "info"); },
|
|
@@ -7701,9 +7855,10 @@ ${externalBlockedProtocol()}
|
|
|
7701
7855
|
const roleItems = Array.from(agentStates.values()).flatMap(s =>
|
|
7702
7856
|
Object.entries(s.def.subagents || {}).map(([role, r]) => {
|
|
7703
7857
|
const override = subagentModelOverrides.get(`${s.def.name.toLowerCase()}.${role.toLowerCase()}`);
|
|
7858
|
+
const effective = resolvedSubagentModel(s.def.name, role, r.model);
|
|
7704
7859
|
return {
|
|
7705
7860
|
value: `${s.def.name}.${role}`,
|
|
7706
|
-
label: `${s.def.name}.${role} — ${shortModel(override
|
|
7861
|
+
label: `${s.def.name}.${role} — ${shortModel(effective)}${override || effective !== r.model ? " (switched)" : ""}`,
|
|
7707
7862
|
};
|
|
7708
7863
|
}),
|
|
7709
7864
|
);
|
|
@@ -7750,7 +7905,7 @@ ${externalBlockedProtocol()}
|
|
|
7750
7905
|
for (const m of [role.model, ...allowedModels(parent.def)]) {
|
|
7751
7906
|
if (m && !candidates.includes(m)) candidates.push(m);
|
|
7752
7907
|
}
|
|
7753
|
-
const current =
|
|
7908
|
+
const current = resolvedSubagentModel(parent.def.name, roleKey, role.model);
|
|
7754
7909
|
const options = candidates.map(m => {
|
|
7755
7910
|
const tags = [m === role.model ? "default" : "", m === current ? "current" : ""].filter(Boolean);
|
|
7756
7911
|
return tags.length ? `${m} (${tags.join(", ")})` : m;
|
|
@@ -7759,8 +7914,9 @@ ${externalBlockedProtocol()}
|
|
|
7759
7914
|
const choice = await ctx.ui.select(`Model for ${label}`, options);
|
|
7760
7915
|
if (choice === undefined) return;
|
|
7761
7916
|
const picked = candidates[options.indexOf(choice)];
|
|
7762
|
-
|
|
7763
|
-
|
|
7917
|
+
const effectivePicked = substitutedModel(picked) ?? picked;
|
|
7918
|
+
if (effectivePicked === current) {
|
|
7919
|
+
ctx.ui.notify(`${label} is already on ${effectivePicked}`, "info");
|
|
7764
7920
|
return;
|
|
7765
7921
|
}
|
|
7766
7922
|
if (picked === role.model) {
|
|
@@ -7770,7 +7926,7 @@ ${externalBlockedProtocol()}
|
|
|
7770
7926
|
}
|
|
7771
7927
|
updateWidget();
|
|
7772
7928
|
ctx.ui.notify(
|
|
7773
|
-
`${label} → ${
|
|
7929
|
+
`${label} → ${effectivePicked} (applies on next dispatch of ${parent.def.name})`,
|
|
7774
7930
|
"success",
|
|
7775
7931
|
);
|
|
7776
7932
|
return;
|
|
@@ -7809,9 +7965,10 @@ ${externalBlockedProtocol()}
|
|
|
7809
7965
|
const choice = await ctx.ui.select(`Model for ${displayName(def.name)}`, options);
|
|
7810
7966
|
if (choice === undefined) return;
|
|
7811
7967
|
const picked = candidates[options.indexOf(choice)];
|
|
7812
|
-
const
|
|
7968
|
+
const effectivePicked = picked === DISPATCHER_DEFAULT ? picked : (substitutedModel(picked) ?? picked);
|
|
7969
|
+
const pickedIsCurrent = current ? effectivePicked === current : picked === DISPATCHER_DEFAULT;
|
|
7813
7970
|
if (pickedIsCurrent) {
|
|
7814
|
-
ctx.ui.notify(`${displayName(def.name)} is already on ${
|
|
7971
|
+
ctx.ui.notify(`${displayName(def.name)} is already on ${effectivePicked}`, "info");
|
|
7815
7972
|
return;
|
|
7816
7973
|
}
|
|
7817
7974
|
if (picked === def.model || picked === DISPATCHER_DEFAULT) {
|
|
@@ -7825,7 +7982,7 @@ ${externalBlockedProtocol()}
|
|
|
7825
7982
|
const applyHint = (def.kind || "").toLowerCase() === "research"
|
|
7826
7983
|
? "applies on next /af-research or spawn_research"
|
|
7827
7984
|
: `applies on next dispatch; /af-agents-restart ${def.name} to apply now`;
|
|
7828
|
-
ctx.ui.notify(`${displayName(def.name)} → ${
|
|
7985
|
+
ctx.ui.notify(`${displayName(def.name)} → ${effectivePicked} (${applyHint})`, "success");
|
|
7829
7986
|
if ((dispatchPolicy.substitutions[name]?.prefer ?? dispatchPolicy.default) === "coms") {
|
|
7830
7987
|
ctx.ui.notify(
|
|
7831
7988
|
`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.`,
|
|
@@ -7953,113 +8110,59 @@ ${externalBlockedProtocol()}
|
|
|
7953
8110
|
},
|
|
7954
8111
|
});
|
|
7955
8112
|
|
|
7956
|
-
//
|
|
7957
|
-
//
|
|
8113
|
+
// Every configured model source across persona defaults/candidates, retained
|
|
8114
|
+
// fallbacks, and delegate sub-roles. Active mapping keys remain visible so the
|
|
8115
|
+
// operator can replace a session substitution even if the roster changes.
|
|
7958
8116
|
function allKnownModels(): string[] {
|
|
7959
8117
|
const seen = new Set<string>();
|
|
7960
8118
|
const out: string[] = [];
|
|
8119
|
+
const add = (model: string | undefined) => {
|
|
8120
|
+
if (model && !seen.has(model)) { seen.add(model); out.push(model); }
|
|
8121
|
+
};
|
|
7961
8122
|
for (const def of allAgentDefs) {
|
|
7962
|
-
|
|
7963
|
-
|
|
8123
|
+
add(def.model);
|
|
8124
|
+
add(def.fallbackModel);
|
|
8125
|
+
for (const model of def.models ?? []) add(model);
|
|
8126
|
+
for (const role of Object.values(def.subagents ?? {})) {
|
|
8127
|
+
add(role.model);
|
|
8128
|
+
add(role.fallbackModel);
|
|
7964
8129
|
}
|
|
7965
8130
|
}
|
|
8131
|
+
for (const model of modelOverrides.values()) add(model);
|
|
8132
|
+
for (const model of subagentModelOverrides.values()) add(model);
|
|
8133
|
+
for (const source of modelSubstitutions.keys()) add(source);
|
|
7966
8134
|
return out;
|
|
7967
8135
|
}
|
|
7968
8136
|
|
|
7969
|
-
// Completions for /af-agent-models-substitute: a flat list of known models.
|
|
7970
|
-
// Free text allowed too — we just suggest, never restrict, so ad-hoc targets
|
|
7971
|
-
// (e.g. a model a persona does not declare) still produce a clean "skipped"
|
|
7972
|
-
// report at apply time.
|
|
7973
8137
|
const substituteCompletions = (prefix: string): AutocompleteItem[] | null => {
|
|
7974
|
-
const items =
|
|
8138
|
+
const items = substitutionSourceChoices().map(choice => ({ value: choice.spec, label: choice.label }));
|
|
7975
8139
|
if (items.length === 0) return null;
|
|
7976
8140
|
const p = prefix.toLowerCase();
|
|
7977
8141
|
const filtered = items.filter(i => i.value.toLowerCase().startsWith(p));
|
|
7978
8142
|
return filtered.length > 0 ? filtered : items;
|
|
7979
8143
|
};
|
|
7980
8144
|
|
|
7981
|
-
//
|
|
7982
|
-
//
|
|
7983
|
-
// Per-persona validity: target must be in that persona's allowedModels.
|
|
7984
|
-
// Applies session-lifetime (same lifetime as /af-agent-model); takes effect on
|
|
7985
|
-
// the persona's NEXT dispatch (/af-agents-restart applies it immediately).
|
|
7986
|
-
// One-step flow: dry-run summary is shown up front, then the swap is
|
|
7987
|
-
// applied unconditionally — the operator runs the command to commit.
|
|
8145
|
+
// Bare command opens the exact same source → available-target picker as `m` in
|
|
8146
|
+
// Fleet Dashboard. The two-argument form remains available for scripting.
|
|
7988
8147
|
pi.registerCommand("af-agent-models-substitute", {
|
|
7989
|
-
description: "
|
|
8148
|
+
description: "Save a session-wide model substitution: /af-agent-models-substitute [<source> <target>]",
|
|
7990
8149
|
getArgumentCompletions: substituteCompletions,
|
|
7991
8150
|
handler: async (args, ctx) => {
|
|
7992
8151
|
widgetCtx = ctx;
|
|
7993
8152
|
const tokens = (args || "").trim().split(/\s+/).filter(Boolean);
|
|
7994
|
-
if (tokens.length
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
"error",
|
|
7999
|
-
);
|
|
8000
|
-
return;
|
|
8001
|
-
}
|
|
8002
|
-
const [source, target] = tokens;
|
|
8003
|
-
|
|
8004
|
-
// Build the dry-run. Walk every loaded persona (team + research +
|
|
8005
|
-
// orchestrator all live in allAgentDefs) and decide per-persona:
|
|
8006
|
-
// - "match" : current effective model === source AND target is a
|
|
8007
|
-
// declared candidate → will be switched.
|
|
8008
|
-
// - "skip" : any other case, with a reason.
|
|
8009
|
-
const matches: { def: AgentDef; current: string }[] = [];
|
|
8010
|
-
const skipped: { def: AgentDef; reason: string }[] = [];
|
|
8011
|
-
for (const def of allAgentDefs) {
|
|
8012
|
-
const current = resolvedModel(def);
|
|
8013
|
-
if (!current) {
|
|
8014
|
-
skipped.push({ def, reason: "no default model (runs on dispatcher's model)" });
|
|
8015
|
-
continue;
|
|
8016
|
-
}
|
|
8017
|
-
if (current !== source) {
|
|
8018
|
-
skipped.push({ def, reason: `current is ${current} (not ${source})` });
|
|
8019
|
-
continue;
|
|
8020
|
-
}
|
|
8021
|
-
if (!allowedModels(def).includes(target)) {
|
|
8022
|
-
skipped.push({ def, reason: `target ${target} not in declared candidates (model:/af-models: in ${def.file})` });
|
|
8023
|
-
continue;
|
|
8153
|
+
if (tokens.length === 0) {
|
|
8154
|
+
if (allKnownModels().length === 0) {
|
|
8155
|
+
ctx.ui.notify("No configured persona or sub-role models are available as substitution sources.", "warning");
|
|
8156
|
+
return;
|
|
8024
8157
|
}
|
|
8025
|
-
|
|
8026
|
-
}
|
|
8027
|
-
|
|
8028
|
-
// If target === source, the substitution is a no-op. We still report
|
|
8029
|
-
// it so the operator sees that the request was understood.
|
|
8030
|
-
if (source === target) {
|
|
8031
|
-
ctx.ui.notify(
|
|
8032
|
-
`Source and target are the same (${source}); nothing to do. ` +
|
|
8033
|
-
`Affected: ${matches.length}, skipped: ${skipped.length}.`,
|
|
8034
|
-
"info",
|
|
8035
|
-
);
|
|
8158
|
+
await openFleetDashboard(ctx, true);
|
|
8036
8159
|
return;
|
|
8037
8160
|
}
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
// updates); otherwise record target in modelOverrides. Mirrors
|
|
8042
|
-
// /af-agent-model and /af-models.
|
|
8043
|
-
const applied: string[] = [];
|
|
8044
|
-
for (const { def } of matches) {
|
|
8045
|
-
const key = def.name.toLowerCase();
|
|
8046
|
-
if (def.model === target) {
|
|
8047
|
-
modelOverrides.delete(key);
|
|
8048
|
-
} else {
|
|
8049
|
-
modelOverrides.set(key, target);
|
|
8050
|
-
}
|
|
8051
|
-
applied.push(`${displayName(def.name)}: ${source} → ${target}`);
|
|
8161
|
+
if (tokens.length !== 2) {
|
|
8162
|
+
ctx.ui.notify("Usage: /af-agent-models-substitute [<source> <target>]", "error");
|
|
8163
|
+
return;
|
|
8052
8164
|
}
|
|
8053
|
-
|
|
8054
|
-
const skipDetails = skipped.map(s => `${displayName(s.def.name)}: ${s.reason}`);
|
|
8055
|
-
const summary = [
|
|
8056
|
-
`Substitution ${source} → ${target}:`,
|
|
8057
|
-
` Affected: ${applied.length}${applied.length ? ` (${applied.join(", ")})` : ""}`,
|
|
8058
|
-
` Skipped: ${skipped.length}${skipped.length ? ` (${skipDetails.join("; ")})` : ""}`,
|
|
8059
|
-
` Applies on next dispatch (/af-agents-restart to apply now).`,
|
|
8060
|
-
].join("\n");
|
|
8061
|
-
updateWidget();
|
|
8062
|
-
ctx.ui.notify(summary, applied.length > 0 ? "success" : "info");
|
|
8165
|
+
await applySessionModelSubstitution(tokens[0], tokens[1], ctx);
|
|
8063
8166
|
},
|
|
8064
8167
|
});
|
|
8065
8168
|
|
|
@@ -8842,10 +8945,10 @@ ask the human. You MUST instead:
|
|
|
8842
8945
|
- When a specialist emits an \`ASK_USER:\` line in English, translate it to
|
|
8843
8946
|
${userLanguage} before relaying to the user.${userLanguage.toLowerCase() === "english" ? " (If user-language is English this is a no-op.)" : ""}`;
|
|
8844
8947
|
|
|
8845
|
-
// ──
|
|
8846
|
-
// The
|
|
8847
|
-
//
|
|
8848
|
-
//
|
|
8948
|
+
// ── Task triage + Verification Contract ──
|
|
8949
|
+
// The hub ENFORCES budgets in code (dispatch_agent/spawn_research refuse
|
|
8950
|
+
// past the task-tier envelope); the prompt teaches the dispatcher to plan
|
|
8951
|
+
// within them instead of hitting them.
|
|
8849
8952
|
const budget = currentBudget();
|
|
8850
8953
|
const taskBudget = currentTaskBudget();
|
|
8851
8954
|
const cap = (n: number | null) => (n == null ? "unlimited" : String(n));
|
|
@@ -8853,7 +8956,7 @@ ask the human. You MUST instead:
|
|
|
8853
8956
|
const capabilityState = [...capabilityResolution.active].map(pack => `${pack}:${capabilityResolution.reasons[pack]}`).join(", ");
|
|
8854
8957
|
const provisionalState = capabilityResolution.provisional.map(pack => `${pack}:${capabilityResolution.reasons[pack]}`).join(", ");
|
|
8855
8958
|
const stateCapsule = `## Current task state
|
|
8856
|
-
-
|
|
8959
|
+
- tier: ${taskTier ?? DEFAULT_TASK_TIER}${taskTierAssumed ? "?" : ""}; turn dispatches: ${turnDispatchCount}; research: ${turnResearchCount}
|
|
8857
8960
|
- task dispatches: ${taskDispatchCount}; research: ${taskResearchCount}; review rounds: ${taskReviewRounds}
|
|
8858
8961
|
- packs active: ${capabilityState}; provisional: ${provisionalState || "none"}
|
|
8859
8962
|
- provisional confirmation: ${capabilityResolution.provisional.filter(pack => capabilityConfirmation[pack as ConfirmableCapabilityPack] !== "declined").map(pack => `${pack} (${capabilityResolution.reasons[pack]}) → call ask_user exactly once with ${JSON.stringify(capabilityConfirmationQuestion(pack as ConfirmableCapabilityPack))}`).join("; ") || "none"}
|
|
@@ -8865,13 +8968,7 @@ Call \`set_task_tier\` honestly: trivial/small work uses minimal ceremony; featu
|
|
|
8865
8968
|
const fullVerificationContract = `## Verification Contract
|
|
8866
8969
|
For non-trivial work, record at most ${MAX_OPEN_ASSERTIONS} narrow, sourced assertions before building and pass them verbatim to specialists. Advance only on named evidence; unproven/failed is not done. Runtime-UI claims require runtime observation. Use \`skills/orchestration-verification/SKILL.md\` for formats, parity inventories, and regression resets. After compaction, read the ledger before continuing.`;
|
|
8867
8970
|
|
|
8868
|
-
const verificationSection = !verificationActive ? "" :
|
|
8869
|
-
? `## Verification (fast mode)
|
|
8870
|
-
The assertion ledger is OPTIONAL in fast mode. State what was asked, dispatch the one
|
|
8871
|
-
specialist, and verify from its returned evidence (command output, file:line). If the
|
|
8872
|
-
request carries real acceptance criteria or turns risky, ask the user to switch to
|
|
8873
|
-
standard/strict instead of improvising rigor here.`
|
|
8874
|
-
: fullVerificationContract;
|
|
8971
|
+
const verificationSection = !verificationActive ? "" : fullVerificationContract;
|
|
8875
8972
|
|
|
8876
8973
|
// Peer section only when coms initialised. Decision G4: the coms_* tools are
|
|
8877
8974
|
// already in the active tool surface when ready; here we just teach the
|
|
@@ -9476,8 +9573,6 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
|
|
|
9476
9573
|
userLanguage = overrides.language;
|
|
9477
9574
|
researchKeep = overrides.researchKeep;
|
|
9478
9575
|
reconSearchTimeoutMs = overrides.reconSearchTimeoutMs;
|
|
9479
|
-
const previousMode = hubMode;
|
|
9480
|
-
hubMode = overrides.hubMode;
|
|
9481
9576
|
budgetOverrides = overrides.budgetOverrides;
|
|
9482
9577
|
watchdogSetting = overrides.watchdogSetting;
|
|
9483
9578
|
watchdogJudgeModel = overrides.watchdogJudgeModel;
|
|
@@ -9486,13 +9581,6 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
|
|
|
9486
9581
|
// A new session is a new task by definition.
|
|
9487
9582
|
resetTaskWindow(null);
|
|
9488
9583
|
updateModeStatus();
|
|
9489
|
-
appendHubModeEntry({
|
|
9490
|
-
previousMode,
|
|
9491
|
-
mode: hubMode,
|
|
9492
|
-
source: overrides.hubModeSource,
|
|
9493
|
-
overrideFile: overrides.hubModeSource === "project-override" ? ".ai/agent-fleet-overrides.md" : null,
|
|
9494
|
-
ctx: _ctx,
|
|
9495
|
-
});
|
|
9496
9584
|
if (overrides.warnings.length > 0) {
|
|
9497
9585
|
_ctx.ui.notify(`agent-fleet-overrides warnings:\n${overrides.warnings.join("\n")}`, "warning");
|
|
9498
9586
|
}
|
|
@@ -9516,6 +9604,7 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
|
|
|
9516
9604
|
// Model switching state resets each session; per-project overrides replace
|
|
9517
9605
|
// the persona defs' default model / candidate list before anything reads them.
|
|
9518
9606
|
modelOverrides.clear();
|
|
9607
|
+
modelSubstitutions.clear();
|
|
9519
9608
|
subagentModelOverrides.clear();
|
|
9520
9609
|
thinkingOverrides.clear();
|
|
9521
9610
|
for (const def of allAgentDefs) {
|
|
@@ -9683,7 +9772,8 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
|
|
|
9683
9772
|
`Persona gate: ${personaGateLabel}\n` +
|
|
9684
9773
|
`Coms: ${comsLabel}\n` +
|
|
9685
9774
|
`Fleet: ${fleetLabel}\n\n` +
|
|
9686
|
-
`/af-
|
|
9775
|
+
`/af-work-mode [posture] Operator | Orchestrator (Alt+M)\n` +
|
|
9776
|
+
`/af-posture [posture] Show/switch operator|orchestrator posture\n` +
|
|
9687
9777
|
`/af-agents-team Select a team\n` +
|
|
9688
9778
|
`/af-agents-list Open Fleet Dashboard\n` +
|
|
9689
9779
|
`/af-agents-history Timeline of agent runs — durations, parallel markers, grand total\n` +
|
|
@@ -9691,7 +9781,7 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
|
|
|
9691
9781
|
`/af-agent-model <persona>[.<role>] Switch a persona's or sub-role's model\n` +
|
|
9692
9782
|
`/af-agent-model-thinking <persona> Switch a persona's thinking level\n` +
|
|
9693
9783
|
`/af-models [profile] Apply a named model profile to the team\n` +
|
|
9694
|
-
`/af-agent-models-substitute
|
|
9784
|
+
`/af-agent-models-substitute [src tgt] Pick/save a session-wide source → target model substitution\n` +
|
|
9695
9785
|
`/af-dispatch-policy Show which members route to coms peers (dispatch-policy.yaml)\n` +
|
|
9696
9786
|
`/af-agents-kill <name> SIGTERM a frozen specialist (and its delegate children)\n` +
|
|
9697
9787
|
`/af-agents-restart <name> Kill + re-run its last task fresh\n` +
|
|
@@ -9732,7 +9822,7 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
|
|
|
9732
9822
|
const bar = "#".repeat(filled) + "-".repeat(10 - filled);
|
|
9733
9823
|
|
|
9734
9824
|
const left = renderHubFooterLeft(theme, HARNESS_VERSION, model, think, activeTeamName);
|
|
9735
|
-
const hint = theme.fg("dim", composeFleetFooterHint(viewMode));
|
|
9825
|
+
const hint = theme.fg("dim", composeFleetFooterHint(viewMode, compactPosture(posture)));
|
|
9736
9826
|
// The btw extension flips this global the first time a /af-btw command or
|
|
9737
9827
|
// Alt+' is used; surface its reopen shortcut right next to the Alt+A hint.
|
|
9738
9828
|
const btwHint = (globalThis as { __btwActivated?: boolean }).__btwActivated
|