@chankov/agent-fleet 2.0.3 → 2.0.4
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/agents/model-profiles.yaml +64 -13
- package/.pi/agents/peers.yaml +11 -8
- package/.pi/harnesses/agent-hub/README.md +4 -2
- package/.pi/harnesses/agent-hub/config/agents.ts +13 -14
- package/.pi/harnesses/agent-hub/config/model-profiles.ts +216 -0
- package/.pi/harnesses/agent-hub/dispatch-coms.ts +6 -4
- package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +6 -3
- package/.pi/harnesses/agent-hub/dispatch-native.ts +4 -1
- package/.pi/harnesses/agent-hub/index.ts +61 -9
- package/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +7 -7
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/policy/models.ts +35 -8
- package/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.pi/harnesses/agent-hub/policy/profile-runtime.ts +64 -0
- package/.pi/harnesses/agent-hub/provider-semaphore.js +1 -1
- package/.pi/harnesses/agent-hub/research/spawn-run.ts +2 -1
- package/.pi/harnesses/agent-hub/spawn.ts +17 -1
- package/.pi/harnesses/agent-hub/tools/action-executors.ts +2 -0
- package/.pi/harnesses/agent-hub/tools/herdr-executors.ts +2 -0
- package/.pi/harnesses/agent-hub/ui/detail-panel.ts +4 -1
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.versions/2.0.4/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.4/.pi/agents/model-profiles.yaml +78 -0
- package/.versions/2.0.4/.pi/agents/peers.yaml +145 -0
- package/.versions/2.0.4/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.4/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.4/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.4/.pi/extensions/agent-fleet-update-check/README.md +57 -0
- package/.versions/2.0.4/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
- package/.versions/2.0.4/.pi/extensions/agent-fleet-update-check/package.json +6 -0
- package/.versions/2.0.4/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.4/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.4/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.4/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.4/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.4/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.4/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.4/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.4/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.4/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.4/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.4/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.4/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.4/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.4/.pi/extensions/package.json +9 -0
- package/.versions/2.0.4/.pi/extensions/pi-voice-stt/README.md +205 -0
- package/.versions/2.0.4/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.4/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.4/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.4/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.4/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.4/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/README.md +1160 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/budget-continuation.ts +73 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/context.ts +41 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/config/agents.ts +179 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/config/model-profiles.ts +216 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/config/overrides.ts +153 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +211 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/context/budgets.ts +208 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/context-window.js +106 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/delegate.ts +446 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/dispatch-coms.ts +234 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/dispatch-native-complete.ts +135 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +156 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +191 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/dispatch-native-types.ts +207 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/dispatch-native.ts +187 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/dispatch-observability.ts +220 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/docs-lane.js +122 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/drift-watchdog.js +218 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/fixtures/registration-surface.json +55 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/helpers.ts +266 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/hub-state-audit.js +59 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/index.ts +2088 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/input/completions.ts +76 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/input/shortcuts.ts +47 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +123 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +141 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +95 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/policy/profile-runtime.ts +64 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/policy/roster.ts +79 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/policy/work-mode.ts +118 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/prompts/context.ts +46 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/prompts/fragments.ts +115 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/prompts/system-prompt.ts +110 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/research/runtime.ts +175 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/research/spawn-run.ts +144 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/return-contract.js +293 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/return-extract.js +75 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/review-findings.js +102 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/run-budget.js +537 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/run-namespace.js +87 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/scope-gate.js +103 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/spawn.ts +404 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/timeline.ts +54 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/action-executors.ts +148 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/context.ts +132 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +79 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +199 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/fleet-tools.ts +202 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/herdr-executors.ts +84 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/set-task-tier.ts +29 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/spawn-research.ts +62 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/tools/verification-contract.ts +77 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/types.ts +61 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/ui/context-budget.ts +86 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/ui/detail-panel.ts +178 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +123 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/ui/grid.ts +144 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/ui/zoom.ts +204 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.4/.pi/harnesses/agent-hub/work-mode.ts +167 -0
- package/.versions/2.0.4/.pi/harnesses/ask-user-remote/README.md +53 -0
- package/.versions/2.0.4/.pi/harnesses/ask-user-remote/index.ts +532 -0
- package/.versions/2.0.4/.pi/harnesses/ask-user-remote/race-core.js +106 -0
- package/.versions/2.0.4/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.4/.pi/harnesses/coms/index.ts +276 -0
- package/.versions/2.0.4/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.4/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.4/.pi/harnesses/damage-control-continue/README.md +124 -0
- package/.versions/2.0.4/.pi/harnesses/damage-control-continue/index.ts +536 -0
- package/.versions/2.0.4/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.4/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.4/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.4/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.4/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.4/.pi/harnesses/lib/context-budget-child-prompt.ts +179 -0
- package/.versions/2.0.4/.pi/harnesses/lib/context-budget-hub-prompt.ts +114 -0
- package/.versions/2.0.4/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.4/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.4/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fleet-dashboard-ops.ts +166 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fleet-dashboard-view.ts +142 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fleet-detail-view.ts +247 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fleet-read-model.ts +131 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.4/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.4/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.4/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.4/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.4/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.4/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.4/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.4/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.4/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.4/.pi/harnesses/lib/spawned-peers.js +190 -0
- package/.versions/2.0.4/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.4/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.4/.pi/prompts/af-build.md +24 -0
- package/.versions/2.0.4/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.4/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.4/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.4/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.4/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.4/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.4/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.4/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.4/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.4/.version +1 -0
- package/.versions/2.0.4/agents/architect.md +25 -0
- package/.versions/2.0.4/agents/bowser.md +28 -0
- package/.versions/2.0.4/agents/builder.md +56 -0
- package/.versions/2.0.4/agents/code-reviewer.md +210 -0
- package/.versions/2.0.4/agents/deep-researcher.md +33 -0
- package/.versions/2.0.4/agents/documenter.md +22 -0
- package/.versions/2.0.4/agents/orchestrator.md +23 -0
- package/.versions/2.0.4/agents/plan-reviewer.md +84 -0
- package/.versions/2.0.4/agents/planner.md +105 -0
- package/.versions/2.0.4/agents/releaser.md +25 -0
- package/.versions/2.0.4/agents/researcher.md +31 -0
- package/.versions/2.0.4/agents/security-auditor.md +168 -0
- package/.versions/2.0.4/agents/test-engineer.md +154 -0
- package/.versions/2.0.4/agents/web-debugger.md +44 -0
- package/.versions/2.0.4/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.4/bin/catalog/harness-runtime-closure.json +36 -0
- package/.versions/2.0.4/codex/CONDUCTOR.md +148 -0
- package/.versions/2.0.4/docs/ARCHITECTURE.md +407 -0
- package/.versions/2.0.4/docs/agent-fleet-setup.md +547 -0
- package/.versions/2.0.4/docs/claude-code-coms-bridge.md +133 -0
- package/.versions/2.0.4/docs/codex-remote-conductor.md +170 -0
- package/.versions/2.0.4/docs/coms-hermes-bridge.md +189 -0
- package/.versions/2.0.4/docs/getting-started.md +124 -0
- package/.versions/2.0.4/docs/npm-install.md +299 -0
- package/.versions/2.0.4/docs/pi-extensions.md +447 -0
- package/.versions/2.0.4/docs/pi-setup.md +74 -0
- package/.versions/2.0.4/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.4/hermes/README.md +347 -0
- package/.versions/2.0.4/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.4/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.4/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.4/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.4/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.4/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.4/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.4/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.4/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.4/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.4/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.4/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.4/install-manifest.json +2942 -0
- package/.versions/2.0.4/justfile +289 -0
- package/.versions/2.0.4/manifest-meta.json +969 -0
- package/.versions/2.0.4/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.4/references/communication-contract.md +26 -0
- package/.versions/2.0.4/references/definition-of-done.md +67 -0
- package/.versions/2.0.4/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.4/references/observability-checklist.md +91 -0
- package/.versions/2.0.4/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.4/references/performance-checklist.md +153 -0
- package/.versions/2.0.4/references/prompting-patterns.md +380 -0
- package/.versions/2.0.4/references/security-checklist.md +179 -0
- package/.versions/2.0.4/references/testing-patterns.md +236 -0
- package/.versions/2.0.4/references/workflow-authoring.md +304 -0
- package/.versions/2.0.4/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.4/scripts/codex-conductor.ts +41 -0
- package/.versions/2.0.4/scripts/codex-remote-control.ts +167 -0
- package/.versions/2.0.4/scripts/coms-claude-bridge.ts +411 -0
- package/.versions/2.0.4/scripts/coms-cli.ts +484 -0
- package/.versions/2.0.4/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.4/scripts/fleet.ts +222 -0
- package/.versions/2.0.4/scripts/flow.ts +137 -0
- package/.versions/2.0.4/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.4/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.4/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.4/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.4/scripts/lib/claude-bridge-core.ts +210 -0
- package/.versions/2.0.4/scripts/lib/codex-conductor.ts +88 -0
- package/.versions/2.0.4/scripts/lib/codex-remote-control.ts +482 -0
- package/.versions/2.0.4/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.4/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.4/scripts/lib/fleet-command.ts +270 -0
- package/.versions/2.0.4/scripts/lib/flow-command.ts +93 -0
- package/.versions/2.0.4/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.4/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.4/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.4/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.4/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.4/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.4/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.4/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.4/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.4/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.4/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.4/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.4/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.4/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.4/scripts/lib/team-project.ts +213 -0
- package/.versions/2.0.4/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.4/scripts/package-lock.json +35 -0
- package/.versions/2.0.4/scripts/package.json +9 -0
- package/.versions/2.0.4/scripts/peer-banner.ts +40 -0
- package/.versions/2.0.4/scripts/peer-launch.ts +285 -0
- package/.versions/2.0.4/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.4/scripts/team-up.ts +406 -0
- package/.versions/2.0.4/scripts/workflows/lib/agent-phase.ts +133 -0
- package/.versions/2.0.4/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.4/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.4/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.4/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.4/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.4/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.4/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.4/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.4/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.4/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.4/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.4/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.4/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.4/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.4/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.4/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.4/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.4/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.4/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.4/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.4/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.4/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.4/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.4/scripts/workflows/wf-scout.ts +38 -0
- package/.versions/2.0.4/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.4/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.4/skills/code-review-and-quality/SKILL.md +381 -0
- package/.versions/2.0.4/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.4/skills/context-engineering/SKILL.md +291 -0
- package/.versions/2.0.4/skills/deprecation-and-migration/SKILL.md +206 -0
- package/.versions/2.0.4/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.4/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.4/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.4/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.4/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.4/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.4/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.4/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.4/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.4/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.4/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.4/skills/incremental-implementation/SKILL.md +298 -0
- package/.versions/2.0.4/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.4/skills/orchestration-verification/SKILL.md +181 -0
- package/.versions/2.0.4/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.4/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/2.0.4/skills/planning-and-task-breakdown/SKILL.md +265 -0
- package/.versions/2.0.4/skills/security-and-hardening/SKILL.md +461 -0
- package/.versions/2.0.4/skills/spec-driven-development/SKILL.md +256 -0
- package/.versions/2.0.4/skills/using-agent-skills/SKILL.md +197 -0
- package/.versions/2.0.4/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/README.md +11 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
- package/.versions/2.0.4/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
- package/CHANGELOG.md +7 -0
- package/bin/catalog/harness-runtime-closure.json +2 -0
- package/bin/cli.js +47 -9
- package/bin/lib/doctor.js +35 -2
- package/bin/lib/reconcile.js +3 -2
- package/docs/agent-fleet-setup.md +74 -0
- package/docs/claude-code-coms-bridge.md +5 -0
- package/docs/getting-started.md +5 -0
- package/docs/npm-install.md +12 -5
- package/install-manifest.json +3 -1
- package/justfile +1 -1
- package/package.json +5 -3
- package/scripts/claude-code-preflight.ts +70 -0
- package/scripts/fleet.ts +23 -0
- package/scripts/lib/runtime-dependencies.js +124 -0
- package/scripts/peer-launch.ts +27 -1
- package/scripts/workflows/lib/agent-phase.ts +2 -1
- package/scripts/workflows/lib/model-profile.ts +22 -0
- package/scripts/workflows/lib/personas.ts +6 -3
- package/scripts/workflows/lib/voices.ts +3 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"""Source D — the subagents a hub is running, from the agent-fleet-monitor.
|
|
2
|
+
|
|
3
|
+
This is the half Phase 3's activity tail cannot reach. A transcript says what
|
|
4
|
+
the hub itself did; it says nothing about the child processes the hub spawned,
|
|
5
|
+
carries no way to stop one, and has no raw stdout. The monitor has all three and
|
|
6
|
+
was simply never started (no launcher exported its two variables) and never
|
|
7
|
+
joined to anything a human was already looking at.
|
|
8
|
+
|
|
9
|
+
The join, and why it is exact
|
|
10
|
+
-----------------------------
|
|
11
|
+
A monitor CHILD task records `hubPaneId` — literally `env.HERDR_PANE_ID` of the
|
|
12
|
+
hub that spawned it (hermes-monitor-herdr.correlateHubPane). The herdr pane
|
|
13
|
+
snapshot this panel already takes for every session records `pane_id`. So a
|
|
14
|
+
session owns a task when its pane id equals the task's `hubPaneId`: one
|
|
15
|
+
identifier, written by one process, read on both sides. No cwd guessing, no
|
|
16
|
+
"newest hub wins" — the same rule Phase 3 refused to relax.
|
|
17
|
+
|
|
18
|
+
The consequence is stated rather than hidden: the correlation runs THROUGH the
|
|
19
|
+
pane, so a `detached` hub has no task tree here, exactly as a detached Claude
|
|
20
|
+
Code peer has no activity tail. Parent tasks carry no pane id at all, so they
|
|
21
|
+
are reached only via a child's `parentId`.
|
|
22
|
+
|
|
23
|
+
Why the monitor's own adapter is imported instead of copied
|
|
24
|
+
-----------------------------------------------------------
|
|
25
|
+
`adapter.py` is ~60 lines of security-critical discovery: 0700 root, 0600
|
|
26
|
+
discovery and token files, a recomputed socket hash the discovery file must
|
|
27
|
+
agree with, lease expiry, and the unlink of what has expired. A second copy in
|
|
28
|
+
this plugin would be a second thing to get wrong. Both plugins ship from the
|
|
29
|
+
same checkout and install as siblings under `<hermes home>/plugins/`, so the
|
|
30
|
+
sibling path resolves in either shape. When it does not resolve — the monitor
|
|
31
|
+
plugin was archived, or only this one was installed — that is `available:
|
|
32
|
+
False` with a reason, never an exception.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
import importlib.util
|
|
36
|
+
import sys
|
|
37
|
+
from pathlib import Path
|
|
38
|
+
|
|
39
|
+
# Everything a task is allowed to tell the renderer. `ownerSessionId` and
|
|
40
|
+
# `ownerLeaseExpiresAt` are the monitor's own lease bookkeeping, `checkoutId`
|
|
41
|
+
# and `workspaceId` are correlation the panel already knows by other means:
|
|
42
|
+
# none of them belong in a file that runs with the full privileges of the app.
|
|
43
|
+
# `hubInstanceId` DOES travel, because cancel has to be addressed to one hub and
|
|
44
|
+
# it is a sha256 digest rather than a path.
|
|
45
|
+
_TASK_FIELDS = (
|
|
46
|
+
"id",
|
|
47
|
+
"generation",
|
|
48
|
+
"kind",
|
|
49
|
+
"state",
|
|
50
|
+
"specialist",
|
|
51
|
+
"parentId",
|
|
52
|
+
"parentGeneration",
|
|
53
|
+
"hubInstanceId",
|
|
54
|
+
"updatedAt",
|
|
55
|
+
"outputSequence",
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Per-task stdout carried inline. The monitor stores up to 256 KB per task and
|
|
59
|
+
# serves it behind a cursor; this panel is a viewer, not an archive, so it takes
|
|
60
|
+
# a bounded tail with no cursor at all. That trade removes an entire per-task
|
|
61
|
+
# cursor protocol from the herdr side, and what it costs is history the monitor
|
|
62
|
+
# pane still has if anyone needs it.
|
|
63
|
+
MAX_OUTPUT_CHARS = 2048
|
|
64
|
+
|
|
65
|
+
# How many tasks get an output read on one request. Each is its own round trip
|
|
66
|
+
# over the hub's UDS, and a runaway hub with fifty children must not turn one
|
|
67
|
+
# modal poll into fifty socket connections.
|
|
68
|
+
MAX_OUTPUT_READS = 8
|
|
69
|
+
|
|
70
|
+
# Live states, in the monitor's vocabulary (hermes-monitor-model.ts). Only these
|
|
71
|
+
# can be cancelled, and only these are worth spending an output read on.
|
|
72
|
+
ACTIVE_STATES = ("starting", "running", "cancelling", "recovering")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class MonitorMissing(Exception):
|
|
76
|
+
"""The monitor plugin is not installed beside this one."""
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _load_adapter():
|
|
80
|
+
"""Import the monitor plugin's adapter from the sibling plugin directory.
|
|
81
|
+
|
|
82
|
+
`__file__` is resolved first, so an installed tree that reaches this file
|
|
83
|
+
through a symlink into a checkout finds the sibling in that checkout rather
|
|
84
|
+
than looking for it under the Hermes profile.
|
|
85
|
+
"""
|
|
86
|
+
here = Path(__file__).resolve()
|
|
87
|
+
candidate = here.parent.parent.parent / "agent-fleet-monitor" / "dashboard" / "adapter.py"
|
|
88
|
+
if not candidate.is_file():
|
|
89
|
+
raise MonitorMissing(f"no monitor adapter at {candidate}")
|
|
90
|
+
# Loaded under its own module name and cached, because `adapter` is a name
|
|
91
|
+
# this plugin does not otherwise own and re-importing per request would
|
|
92
|
+
# re-read the file on every poll.
|
|
93
|
+
cached = sys.modules.get("_agent_fleet_monitor_adapter")
|
|
94
|
+
if cached is not None:
|
|
95
|
+
return cached
|
|
96
|
+
spec = importlib.util.spec_from_file_location("_agent_fleet_monitor_adapter", candidate)
|
|
97
|
+
if spec is None or spec.loader is None:
|
|
98
|
+
raise MonitorMissing(f"{candidate} is not importable")
|
|
99
|
+
module = importlib.util.module_from_spec(spec)
|
|
100
|
+
sys.modules["_agent_fleet_monitor_adapter"] = module
|
|
101
|
+
spec.loader.exec_module(module)
|
|
102
|
+
|
|
103
|
+
return module
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def unavailable(reason: str) -> dict:
|
|
107
|
+
"""The shape every failure takes. Never an exception past this module.
|
|
108
|
+
|
|
109
|
+
A fleet with no monitor is the ORDINARY case — the variables are opt-in and
|
|
110
|
+
a plain `just fleet` hub has no subagents to report — so the panel says so
|
|
111
|
+
in a sentence and shows the rest of the session.
|
|
112
|
+
"""
|
|
113
|
+
return {"available": False, "reason": reason, "tasks": []}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def adapter(env: dict[str, str] | None = None):
|
|
117
|
+
"""The live monitor, or `MonitorMissing`/`MonitorUnavailable`."""
|
|
118
|
+
module = _load_adapter()
|
|
119
|
+
|
|
120
|
+
return module.MonitorAdapter.from_profile_environment(env)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _truncate(text) -> str:
|
|
124
|
+
if not isinstance(text, str) or not text:
|
|
125
|
+
return ""
|
|
126
|
+
if len(text) <= MAX_OUTPUT_CHARS:
|
|
127
|
+
return text
|
|
128
|
+
# The tail, not the head: what a subagent is doing now is at the end.
|
|
129
|
+
return text[-MAX_OUTPUT_CHARS:]
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def project_task(task: dict) -> dict:
|
|
133
|
+
"""One monitor task through the allowlist."""
|
|
134
|
+
row = {field: task[field] for field in _TASK_FIELDS if field in task and task[field] is not None}
|
|
135
|
+
if task.get("truncated"):
|
|
136
|
+
row["truncated"] = True
|
|
137
|
+
|
|
138
|
+
return row
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def build_tree(tasks: list[dict], pane_id: str) -> list[dict]:
|
|
142
|
+
"""The task forest belonging to one hub pane, parents first.
|
|
143
|
+
|
|
144
|
+
Children are matched on `hubPaneId`; a parent joins because one of its
|
|
145
|
+
children named it. A child whose parent is not in the snapshot (pruned by
|
|
146
|
+
retention while the child still runs) is kept as its own root rather than
|
|
147
|
+
dropped — an orphan that is still running is exactly what somebody opening
|
|
148
|
+
this panel needs to see.
|
|
149
|
+
"""
|
|
150
|
+
if not pane_id:
|
|
151
|
+
return []
|
|
152
|
+
|
|
153
|
+
mine = [t for t in tasks if isinstance(t, dict) and t.get("hubPaneId") == pane_id]
|
|
154
|
+
# `hubInstanceId` is part of the key, not just the id and generation: the
|
|
155
|
+
# snapshot merges every hub registered under the profile (FleetMonitorAdapter),
|
|
156
|
+
# and two hubs are perfectly free to number their turns the same way. Without
|
|
157
|
+
# it, a colliding turn id would hang one hub's specialists under another
|
|
158
|
+
# hub's parent — the exact class of wrong-row error this panel refuses.
|
|
159
|
+
wanted_parents = {(t.get("hubInstanceId"), t.get("parentId"), t.get("parentGeneration")) for t in mine}
|
|
160
|
+
parents = [
|
|
161
|
+
t
|
|
162
|
+
for t in tasks
|
|
163
|
+
if isinstance(t, dict)
|
|
164
|
+
and t.get("kind") == "parent"
|
|
165
|
+
and (t.get("hubInstanceId"), t.get("id"), t.get("generation")) in wanted_parents
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
by_parent: dict[tuple, list[dict]] = {}
|
|
169
|
+
for child in mine:
|
|
170
|
+
by_parent.setdefault(
|
|
171
|
+
(child.get("hubInstanceId"), child.get("parentId"), child.get("parentGeneration")), []
|
|
172
|
+
).append(child)
|
|
173
|
+
|
|
174
|
+
roots: list[dict] = []
|
|
175
|
+
claimed: set[tuple] = set()
|
|
176
|
+
for parent in parents:
|
|
177
|
+
key = (parent.get("hubInstanceId"), parent.get("id"), parent.get("generation"))
|
|
178
|
+
claimed.add(key)
|
|
179
|
+
row = project_task(parent)
|
|
180
|
+
row["children"] = [project_task(c) for c in by_parent.get(key, [])]
|
|
181
|
+
roots.append(row)
|
|
182
|
+
|
|
183
|
+
for key, children in by_parent.items():
|
|
184
|
+
if key in claimed:
|
|
185
|
+
continue
|
|
186
|
+
for child in children:
|
|
187
|
+
row = project_task(child)
|
|
188
|
+
row["children"] = []
|
|
189
|
+
# Said out loud rather than silently reparented: the hierarchy is
|
|
190
|
+
# missing a level and the reader should know which one.
|
|
191
|
+
row["orphaned_parent"] = True
|
|
192
|
+
roots.append(row)
|
|
193
|
+
|
|
194
|
+
return roots
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def attach_output(monitor, roots: list[dict]) -> list[dict]:
|
|
198
|
+
"""Fill in each live task's stdout tail, best effort, bounded.
|
|
199
|
+
|
|
200
|
+
A read that fails leaves the task without output rather than failing the
|
|
201
|
+
request: a child that finished between the snapshot and this call is normal,
|
|
202
|
+
and the tree is still the answer.
|
|
203
|
+
"""
|
|
204
|
+
reads = 0
|
|
205
|
+
for row in roots:
|
|
206
|
+
for task in [row, *row.get("children", [])]:
|
|
207
|
+
if reads >= MAX_OUTPUT_READS:
|
|
208
|
+
return roots
|
|
209
|
+
if task.get("state") not in ACTIVE_STATES or not task.get("outputSequence"):
|
|
210
|
+
continue
|
|
211
|
+
reads += 1
|
|
212
|
+
try:
|
|
213
|
+
result = monitor.output(task["id"], task["generation"], 0, task.get("hubInstanceId"))
|
|
214
|
+
except Exception:
|
|
215
|
+
continue
|
|
216
|
+
text = _truncate(result.get("text") if isinstance(result, dict) else "")
|
|
217
|
+
if text:
|
|
218
|
+
task["output"] = text
|
|
219
|
+
if isinstance(result, dict) and result.get("truncated"):
|
|
220
|
+
task["truncated"] = True
|
|
221
|
+
|
|
222
|
+
return roots
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def tasks_for_pane(pane_id, env: dict[str, str] | None = None, monitor=None) -> dict:
|
|
226
|
+
"""`{available, reason, tasks}` for the hub occupying `pane_id`."""
|
|
227
|
+
if not pane_id:
|
|
228
|
+
return unavailable("no herdr pane is hosting this agent — the monitor correlates through the pane")
|
|
229
|
+
|
|
230
|
+
module = None
|
|
231
|
+
if monitor is None:
|
|
232
|
+
try:
|
|
233
|
+
module = _load_adapter()
|
|
234
|
+
monitor = module.MonitorAdapter.from_profile_environment(env)
|
|
235
|
+
except MonitorMissing as error:
|
|
236
|
+
return unavailable(str(error))
|
|
237
|
+
except Exception:
|
|
238
|
+
# MonitorUnavailable and anything else discovery can raise: no hub
|
|
239
|
+
# registered under this profile, an expired lease, a runtime dir
|
|
240
|
+
# that is not 0700. All one answer to a reader.
|
|
241
|
+
return unavailable("no monitored hub is registered for this profile")
|
|
242
|
+
|
|
243
|
+
try:
|
|
244
|
+
snapshot = monitor.snapshot()
|
|
245
|
+
except Exception:
|
|
246
|
+
return unavailable("the monitor is not answering")
|
|
247
|
+
|
|
248
|
+
tasks = snapshot.get("tasks") if isinstance(snapshot, dict) else None
|
|
249
|
+
if not isinstance(tasks, list):
|
|
250
|
+
return unavailable("the monitor returned no task list")
|
|
251
|
+
|
|
252
|
+
roots = build_tree(tasks, pane_id)
|
|
253
|
+
if not roots:
|
|
254
|
+
return {"available": True, "reason": "", "tasks": []}
|
|
255
|
+
|
|
256
|
+
return {"available": True, "reason": "", "tasks": attach_output(monitor, roots)}
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def cancel_task(pane_id, task_id, generation, hub_instance_id=None, env: dict[str, str] | None = None, monitor=None) -> dict:
|
|
260
|
+
"""Cancel one generation of one task — after proving the caller owns it.
|
|
261
|
+
|
|
262
|
+
The renderer names a task id it read from `tasks_for_pane`, but a renderer
|
|
263
|
+
is not a trusted source, so the id is looked up in a FRESH snapshot scoped
|
|
264
|
+
to this pane before it reaches the socket. Without that check the route
|
|
265
|
+
would cancel any task in any hub on the machine for anyone who could guess
|
|
266
|
+
an id.
|
|
267
|
+
"""
|
|
268
|
+
if monitor is None:
|
|
269
|
+
try:
|
|
270
|
+
module = _load_adapter()
|
|
271
|
+
monitor = module.MonitorAdapter.from_profile_environment(env)
|
|
272
|
+
except MonitorMissing as error:
|
|
273
|
+
raise LookupError(str(error)) from error
|
|
274
|
+
except Exception as error:
|
|
275
|
+
raise LookupError("no monitored hub is registered for this profile") from error
|
|
276
|
+
|
|
277
|
+
try:
|
|
278
|
+
snapshot = monitor.snapshot()
|
|
279
|
+
except Exception as error:
|
|
280
|
+
raise LookupError("the monitor is not answering") from error
|
|
281
|
+
|
|
282
|
+
owned = None
|
|
283
|
+
for row in build_tree(snapshot.get("tasks", []) if isinstance(snapshot, dict) else [], pane_id):
|
|
284
|
+
for task in [row, *row.get("children", [])]:
|
|
285
|
+
if str(task.get("id")) == str(task_id) and int(task.get("generation", 0)) == int(generation):
|
|
286
|
+
owned = task
|
|
287
|
+
break
|
|
288
|
+
if owned:
|
|
289
|
+
break
|
|
290
|
+
if owned is None:
|
|
291
|
+
raise LookupError("that task does not belong to this agent")
|
|
292
|
+
if owned.get("state") not in ACTIVE_STATES:
|
|
293
|
+
raise LookupError(f"the task is already {owned.get('state')}")
|
|
294
|
+
|
|
295
|
+
# The hub comes from the snapshot, never from the request: `hub_instance_id`
|
|
296
|
+
# is accepted so an older renderer's call still parses, and then ignored in
|
|
297
|
+
# favour of what the monitor itself just said owns this task.
|
|
298
|
+
result = monitor.cancel(owned["id"], owned["generation"], owned.get("hubInstanceId"))
|
|
299
|
+
|
|
300
|
+
return result if isinstance(result, dict) else {"cancelled": False}
|