@chankov/agent-fleet 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/set-hermes-watchdog.md +6 -0
- package/.opencode/commands/af-set-hermes-watchdog.md +6 -0
- package/.pi/harnesses/agent-hub/README.md +75 -16
- package/.pi/harnesses/agent-hub/artifacts.js +56 -2
- package/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
- package/.pi/harnesses/agent-hub/context-window.js +106 -0
- package/.pi/harnesses/agent-hub/delegate.ts +58 -9
- package/.pi/harnesses/agent-hub/drift-watchdog.js +54 -8
- package/.pi/harnesses/agent-hub/helpers.ts +34 -0
- package/.pi/harnesses/agent-hub/index.ts +723 -159
- package/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.pi/harnesses/agent-hub/monitor-lifecycle.ts +2 -2
- package/.pi/harnesses/agent-hub/monitor-session-bridge.ts +257 -11
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.pi/harnesses/agent-hub/return-contract.js +78 -0
- package/.pi/harnesses/agent-hub/return-extract.js +75 -0
- package/.pi/harnesses/agent-hub/run-budget.js +29 -3
- package/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.pi/harnesses/agent-hub/spawn.ts +109 -1
- package/.pi/harnesses/agent-hub/spawned-peers.js +74 -0
- package/.pi/harnesses/coms/README.md +4 -3
- package/.pi/harnesses/coms/index.ts +80 -58
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.pi/harnesses/lib/herdr-client.ts +7 -2
- package/.pi/harnesses/lib/herdr-presence.ts +141 -30
- package/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.pi/harnesses/lib/hermes-monitor-model.ts +9 -0
- package/.pi/harnesses/lib/hermes-monitor-registry.ts +1 -1
- package/.pi/harnesses/lib/hermes-monitor-socket.ts +47 -2
- package/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/0.0.7/.claude/commands/build.md +44 -0
- package/.versions/0.0.7/.claude/commands/code-simplify.md +22 -0
- package/.versions/0.0.7/.claude/commands/design-agent.md +14 -0
- package/.versions/0.0.7/.claude/commands/doctor-agent-fleet.md +17 -0
- package/.versions/0.0.7/.claude/commands/orchestrate.md +112 -0
- package/.versions/0.0.7/.claude/commands/plan.md +16 -0
- package/.versions/0.0.7/.claude/commands/prime.md +22 -0
- package/.versions/0.0.7/.claude/commands/review.md +16 -0
- package/.versions/0.0.7/.claude/commands/set-hermes-telegram.md +15 -0
- package/.versions/0.0.7/.claude/commands/set-hermes-watchdog.md +6 -0
- package/.versions/0.0.7/.claude/commands/setup-agent-fleet.md +25 -0
- package/.versions/0.0.7/.claude/commands/ship.md +72 -0
- package/.versions/0.0.7/.claude/commands/spec.md +15 -0
- package/.versions/0.0.7/.claude/commands/test.md +19 -0
- package/.versions/0.0.7/.claude/commands/webperf.md +32 -0
- package/.versions/0.0.7/.claude/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.7/.opencode/commands/af-build.md +17 -0
- package/.versions/0.0.7/.opencode/commands/af-code-simplify.md +16 -0
- package/.versions/0.0.7/.opencode/commands/af-compound.md +16 -0
- package/.versions/0.0.7/.opencode/commands/af-design-agent.md +15 -0
- package/.versions/0.0.7/.opencode/commands/af-doctor-agent-fleet.md +17 -0
- package/.versions/0.0.7/.opencode/commands/af-orchestrate.md +112 -0
- package/.versions/0.0.7/.opencode/commands/af-plan.md +16 -0
- package/.versions/0.0.7/.opencode/commands/af-prime.md +22 -0
- package/.versions/0.0.7/.opencode/commands/af-review.md +15 -0
- package/.versions/0.0.7/.opencode/commands/af-set-hermes-telegram.md +15 -0
- package/.versions/0.0.7/.opencode/commands/af-set-hermes-watchdog.md +6 -0
- package/.versions/0.0.7/.opencode/commands/af-setup-agent-fleet.md +15 -0
- package/.versions/0.0.7/.opencode/commands/af-ship.md +16 -0
- package/.versions/0.0.7/.opencode/commands/af-spec.md +16 -0
- package/.versions/0.0.7/.opencode/commands/af-test.md +21 -0
- package/.versions/0.0.7/.opencode/commands/af-webperf.md +32 -0
- package/.versions/0.0.7/.opencode/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.7/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/0.0.7/.pi/agents/model-profiles.yaml +20 -0
- package/.versions/0.0.7/.pi/agents/peers.yaml +146 -0
- package/.versions/0.0.7/.pi/agents/teams.yaml +39 -0
- package/.versions/0.0.7/.pi/damage-control-rules.yaml +297 -0
- package/.versions/0.0.7/.pi/extensions/agent-fleet-update-check/README.md +58 -0
- package/.versions/0.0.7/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
- package/.versions/0.0.7/.pi/extensions/agent-fleet-update-check/package.json +6 -0
- package/.versions/0.0.7/.pi/extensions/btw/README.md +118 -0
- package/.versions/0.0.7/.pi/extensions/btw/index.ts +917 -0
- package/.versions/0.0.7/.pi/extensions/btw/package.json +6 -0
- package/.versions/0.0.7/.pi/extensions/btw/state.js +179 -0
- package/.versions/0.0.7/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
- package/.versions/0.0.7/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/0.0.7/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/0.0.7/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/0.0.7/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/0.0.7/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/0.0.7/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/0.0.7/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/0.0.7/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/0.0.7/.pi/extensions/package-lock.json +1143 -0
- package/.versions/0.0.7/.pi/extensions/package.json +9 -0
- package/.versions/0.0.7/.pi/extensions/pi-voice-stt/README.md +201 -0
- package/.versions/0.0.7/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/0.0.7/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/0.0.7/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/0.0.7/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/0.0.7/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/0.0.7/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/README.md +857 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/backend-policy.js +153 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/context-window.js +106 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/delegate.ts +435 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/drift-watchdog.js +211 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/footer.ts +29 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/helpers.ts +248 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/index.ts +8609 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/monitor-session-bridge.ts +257 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/research-retention.js +34 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/return-contract.js +293 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/return-extract.js +75 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/run-budget.js +181 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/scope-gate.js +103 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/spawn.ts +354 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/spawned-peers.js +74 -0
- package/.versions/0.0.7/.pi/harnesses/agent-hub/version.ts +18 -0
- package/.versions/0.0.7/.pi/harnesses/ask-user-remote/README.md +19 -0
- package/.versions/0.0.7/.pi/harnesses/ask-user-remote/index.ts +321 -0
- package/.versions/0.0.7/.pi/harnesses/ask-user-remote/race-core.js +106 -0
- package/.versions/0.0.7/.pi/harnesses/coms/README.md +93 -0
- package/.versions/0.0.7/.pi/harnesses/coms/index.ts +1767 -0
- package/.versions/0.0.7/.pi/harnesses/coms/package.json +7 -0
- package/.versions/0.0.7/.pi/harnesses/coms/version.ts +18 -0
- package/.versions/0.0.7/.pi/harnesses/damage-control-continue/README.md +117 -0
- package/.versions/0.0.7/.pi/harnesses/damage-control-continue/index.ts +536 -0
- package/.versions/0.0.7/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/0.0.7/.pi/harnesses/damage-control-continue/version.ts +18 -0
- package/.versions/0.0.7/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/0.0.7/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/0.0.7/.pi/harnesses/lib/herdr-client.ts +463 -0
- package/.versions/0.0.7/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/0.0.7/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/0.0.7/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/0.0.7/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/0.0.7/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/0.0.7/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/0.0.7/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/0.0.7/.pi/harnesses/package-lock.json +35 -0
- package/.versions/0.0.7/.pi/harnesses/package.json +9 -0
- package/.versions/0.0.7/.pi/prompts/af-build.md +24 -0
- package/.versions/0.0.7/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/0.0.7/.pi/prompts/af-doctor-agent-fleet.md +15 -0
- package/.versions/0.0.7/.pi/prompts/af-plan.md +16 -0
- package/.versions/0.0.7/.pi/prompts/af-review.md +16 -0
- package/.versions/0.0.7/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/0.0.7/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/0.0.7/.pi/prompts/af-setup-agent-fleet.md +27 -0
- package/.versions/0.0.7/.pi/prompts/af-ship.md +17 -0
- package/.versions/0.0.7/.pi/prompts/af-spec.md +15 -0
- package/.versions/0.0.7/.pi/prompts/af-test.md +19 -0
- package/.versions/0.0.7/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/0.0.7/.version +1 -0
- package/.versions/0.0.7/agents/architect.md +23 -0
- package/.versions/0.0.7/agents/bowser.md +26 -0
- package/.versions/0.0.7/agents/builder.md +53 -0
- package/.versions/0.0.7/agents/code-reviewer.md +205 -0
- package/.versions/0.0.7/agents/deep-researcher.md +31 -0
- package/.versions/0.0.7/agents/documenter.md +18 -0
- package/.versions/0.0.7/agents/orchestrator.md +65 -0
- package/.versions/0.0.7/agents/plan-reviewer.md +60 -0
- package/.versions/0.0.7/agents/planner.md +69 -0
- package/.versions/0.0.7/agents/releaser.md +24 -0
- package/.versions/0.0.7/agents/researcher.md +28 -0
- package/.versions/0.0.7/agents/security-auditor.md +166 -0
- package/.versions/0.0.7/agents/test-engineer.md +151 -0
- package/.versions/0.0.7/agents/web-debugger.md +42 -0
- package/.versions/0.0.7/agents/web-performance-auditor.md +192 -0
- package/.versions/0.0.7/codex/CONDUCTOR.md +148 -0
- package/.versions/0.0.7/docs/ARCHITECTURE.md +262 -0
- package/.versions/0.0.7/docs/agent-fleet-setup.md +366 -0
- package/.versions/0.0.7/docs/claude-code-coms-bridge.md +109 -0
- package/.versions/0.0.7/docs/codex-remote-conductor.md +170 -0
- package/.versions/0.0.7/docs/coms-hermes-bridge.md +189 -0
- package/.versions/0.0.7/docs/getting-started.md +231 -0
- package/.versions/0.0.7/docs/npm-install.md +337 -0
- package/.versions/0.0.7/docs/opencode-setup.md +249 -0
- package/.versions/0.0.7/docs/pi-extensions.md +293 -0
- package/.versions/0.0.7/docs/pi-setup.md +476 -0
- package/.versions/0.0.7/docs/skill-anatomy.md +150 -0
- package/.versions/0.0.7/hermes/README.md +347 -0
- package/.versions/0.0.7/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/0.0.7/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/0.0.7/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/0.0.7/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/0.0.7/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/0.0.7/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/0.0.7/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/0.0.7/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/0.0.7/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/0.0.7/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/0.0.7/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/0.0.7/hooks/SIMPLIFY-IGNORE.md +90 -0
- package/.versions/0.0.7/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/0.0.7/hooks/hooks.json +14 -0
- package/.versions/0.0.7/hooks/session-start.sh +74 -0
- package/.versions/0.0.7/hooks/simplify-ignore.sh +302 -0
- package/.versions/0.0.7/justfile +245 -0
- package/.versions/0.0.7/references/accessibility-checklist.md +160 -0
- package/.versions/0.0.7/references/definition-of-done.md +67 -0
- package/.versions/0.0.7/references/fleet-coordination-patterns.md +151 -0
- package/.versions/0.0.7/references/observability-checklist.md +91 -0
- package/.versions/0.0.7/references/orchestration-patterns.md +370 -0
- package/.versions/0.0.7/references/performance-checklist.md +153 -0
- package/.versions/0.0.7/references/prompting-patterns.md +380 -0
- package/.versions/0.0.7/references/security-checklist.md +179 -0
- package/.versions/0.0.7/references/testing-patterns.md +236 -0
- package/.versions/0.0.7/scripts/codex-conductor.ts +41 -0
- package/.versions/0.0.7/scripts/codex-remote-control.ts +167 -0
- package/.versions/0.0.7/scripts/coms-claude-bridge.ts +401 -0
- package/.versions/0.0.7/scripts/coms-cli.ts +484 -0
- package/.versions/0.0.7/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/0.0.7/scripts/fleet.ts +149 -0
- package/.versions/0.0.7/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/0.0.7/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/0.0.7/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/0.0.7/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/0.0.7/scripts/lib/claude-bridge-core.ts +165 -0
- package/.versions/0.0.7/scripts/lib/codex-conductor.ts +88 -0
- package/.versions/0.0.7/scripts/lib/codex-remote-control.ts +480 -0
- package/.versions/0.0.7/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/0.0.7/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/0.0.7/scripts/lib/fleet-command.ts +109 -0
- package/.versions/0.0.7/scripts/lib/herdr-layout.ts +263 -0
- package/.versions/0.0.7/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/0.0.7/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/0.0.7/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/0.0.7/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/0.0.7/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/0.0.7/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/0.0.7/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/0.0.7/scripts/lib/monitor-env.ts +120 -0
- package/.versions/0.0.7/scripts/lib/persona-banner.ts +62 -0
- package/.versions/0.0.7/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/0.0.7/scripts/lib/team-project.ts +191 -0
- package/.versions/0.0.7/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/0.0.7/scripts/peer-banner.ts +40 -0
- package/.versions/0.0.7/scripts/team-snapshot.ts +237 -0
- package/.versions/0.0.7/scripts/team-up.ts +360 -0
- package/.versions/0.0.7/skills/_internal/grilling.md +11 -0
- package/.versions/0.0.7/skills/browser-testing-with-devtools/SKILL.md +352 -0
- package/.versions/0.0.7/skills/code-review-and-quality/SKILL.md +381 -0
- package/.versions/0.0.7/skills/compound-learning/SKILL.md +137 -0
- package/.versions/0.0.7/skills/context-engineering/SKILL.md +291 -0
- package/.versions/0.0.7/skills/deprecation-and-migration/SKILL.md +206 -0
- package/.versions/0.0.7/skills/designing-agents/SKILL.md +394 -0
- package/.versions/0.0.7/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/0.0.7/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.7/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/0.0.7/skills/guided-workspace-setup/SKILL.md +544 -0
- package/.versions/0.0.7/skills/guided-workspace-setup/companion-manifest.json +35 -0
- package/.versions/0.0.7/skills/idea-refine/SKILL.md +182 -0
- package/.versions/0.0.7/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.7/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.7/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.7/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.7/skills/incremental-implementation/SKILL.md +287 -0
- package/.versions/0.0.7/skills/interview-me/SKILL.md +226 -0
- package/.versions/0.0.7/skills/orchestration-verification/SKILL.md +181 -0
- package/.versions/0.0.7/skills/peer-coms/SKILL.md +90 -0
- package/.versions/0.0.7/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.7/skills/planning-and-task-breakdown/SKILL.md +236 -0
- package/.versions/0.0.7/skills/security-and-hardening/SKILL.md +461 -0
- package/.versions/0.0.7/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/0.0.7/skills/using-agent-skills/SKILL.md +199 -0
- package/.versions/0.0.7/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/README.md +11 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
- package/.versions/0.0.7/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
- package/CHANGELOG.md +134 -0
- package/README.md +175 -18
- package/agents/code-reviewer.md +2 -2
- package/agents/orchestrator.md +11 -0
- package/agents/plan-reviewer.md +1 -1
- package/agents/planner.md +1 -1
- package/agents/security-auditor.md +1 -1
- package/bin/cli.js +40 -1
- package/bin/lib/hermes-profile-artifact.js +144 -0
- package/bin/lib/set-hermes-watchdog.js +173 -0
- package/bin/set-hermes-watchdog.js +26 -0
- package/docs/ARCHITECTURE.md +64 -12
- package/docs/agent-fleet-setup.md +2 -2
- package/docs/claude-code-coms-bridge.md +7 -1
- package/docs/coms-hermes-bridge.md +10 -0
- package/docs/getting-started.md +48 -0
- package/docs/hermes-watchdog-supervisor.md +140 -0
- package/hermes/README.md +135 -19
- package/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
- package/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/hermes/plugins/agent-fleet-monitor/dashboard/dist/index.js +10 -0
- package/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/hooks/coms-stop-hook.mjs +12 -1
- package/package.json +11 -2
- package/scripts/coms-claude-bridge.ts +154 -39
- package/scripts/fleet.ts +9 -1
- package/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/scripts/lib/claude-bridge-core.ts +65 -0
- package/scripts/lib/coms-envelope.ts +44 -1
- package/scripts/lib/hermes-monitor-events.ts +1 -0
- package/scripts/lib/monitor-env.ts +120 -0
- package/scripts/team-snapshot.ts +1 -1
- package/scripts/team-up.ts +10 -1
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-cap.test.py +0 -15
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-discovery.test.py +0 -19
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-envelope.test.py +0 -13
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-forged-owner.test.py +0 -11
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-lease-list.test.py +0 -9
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-multihub.test.py +0 -17
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-output.test.py +0 -34
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter.test.py +0 -39
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/plugin-api-validation.test.py +0 -12
- package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/review-live-wiring.red.test.py +0 -22
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-cap.test.py +0 -15
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-discovery.test.py +0 -19
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-envelope.test.py +0 -13
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-forged-owner.test.py +0 -11
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-lease-list.test.py +0 -9
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-multihub.test.py +0 -17
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-output.test.py +0 -34
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter.test.py +0 -39
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/plugin-api-validation.test.py +0 -12
- package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/review-live-wiring.red.test.py +0 -22
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-cap.test.py +0 -15
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-discovery.test.py +0 -19
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-envelope.test.py +0 -13
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-forged-owner.test.py +0 -11
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-lease-list.test.py +0 -9
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-multihub.test.py +0 -17
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-output.test.py +0 -34
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter.test.py +0 -39
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/plugin-api-validation.test.py +0 -12
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/review-live-wiring.red.test.py +0 -22
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""Owner-safe, stdlib-only monitor discovery and newline JSON UDS transport."""
|
|
2
|
+
import json
|
|
3
|
+
import socket
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from watchdog_contract import MAX_FRAME, safe_file, validate_discovery
|
|
7
|
+
|
|
8
|
+
MAX_RESPONSE = 2 * 1024 * 1024
|
|
9
|
+
|
|
10
|
+
class TransportError(RuntimeError):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
def discover(runtime_dir, profile_key, hub_key, now):
|
|
14
|
+
"""Read exactly one registry discovery entry; never scan arbitrary runtime roots."""
|
|
15
|
+
root = Path(runtime_dir)
|
|
16
|
+
if not root.is_absolute() or root.is_symlink() or not root.is_dir() or root.stat().st_mode & 0o077:
|
|
17
|
+
raise TransportError('unsafe_runtime')
|
|
18
|
+
if not all(isinstance(key, str) and len(key) == 64 and all(char in '0123456789abcdef' for char in key) for key in (profile_key, hub_key)):
|
|
19
|
+
raise TransportError('discovery')
|
|
20
|
+
namespace = root / profile_key / hub_key
|
|
21
|
+
try:
|
|
22
|
+
if namespace.is_symlink() or not namespace.is_dir() or namespace.stat().st_mode & 0o077:
|
|
23
|
+
raise ValueError('discovery')
|
|
24
|
+
entries = sorted(namespace.glob('discovery-*.json'))
|
|
25
|
+
if len(entries) != 1:
|
|
26
|
+
raise ValueError('discovery')
|
|
27
|
+
metadata = safe_file(entries[0], root)
|
|
28
|
+
value = validate_discovery(root, json.loads(metadata.read_text()), now)
|
|
29
|
+
token_path = safe_file(namespace / value['token'], root)
|
|
30
|
+
token = token_path.read_text().strip()
|
|
31
|
+
if not token:
|
|
32
|
+
raise ValueError('discovery')
|
|
33
|
+
prefix = '@runtime/'
|
|
34
|
+
if not value['socket'].startswith(prefix):
|
|
35
|
+
raise ValueError('discovery')
|
|
36
|
+
socket_path = root / value['socket'][len(prefix):]
|
|
37
|
+
if socket_path.parent.is_symlink() or socket_path.parent.parent != root / 's':
|
|
38
|
+
raise ValueError('discovery')
|
|
39
|
+
return {**value, 'token': token, 'socketPath': str(socket_path), 'namespacePath': str(namespace),
|
|
40
|
+
'profileKey': profile_key, 'hubKey': hub_key}
|
|
41
|
+
except (OSError, ValueError, json.JSONDecodeError) as error:
|
|
42
|
+
raise TransportError(str(error) if str(error) in ('expired', 'unsafe_file', 'path_escape') else 'discovery') from error
|
|
43
|
+
|
|
44
|
+
def request(socket_path, token, payload, timeout=5):
|
|
45
|
+
if not isinstance(token, str) or not token:
|
|
46
|
+
raise TransportError('token')
|
|
47
|
+
data = json.dumps({**payload, 'token': token}, separators=(',', ':')).encode() + b'\n'
|
|
48
|
+
if len(data) > MAX_FRAME:
|
|
49
|
+
raise TransportError('frame_too_large')
|
|
50
|
+
client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
51
|
+
client.settimeout(timeout)
|
|
52
|
+
try:
|
|
53
|
+
client.connect(socket_path)
|
|
54
|
+
client.sendall(data)
|
|
55
|
+
chunks, total = [], 0
|
|
56
|
+
while True:
|
|
57
|
+
block = client.recv(4096)
|
|
58
|
+
if not block:
|
|
59
|
+
break
|
|
60
|
+
total += len(block)
|
|
61
|
+
if total > MAX_RESPONSE:
|
|
62
|
+
raise TransportError('response_too_large')
|
|
63
|
+
chunks.append(block)
|
|
64
|
+
if b'\n' in block:
|
|
65
|
+
break
|
|
66
|
+
try:
|
|
67
|
+
response = json.loads(b''.join(chunks).split(b'\n', 1)[0])
|
|
68
|
+
except Exception as error:
|
|
69
|
+
raise TransportError('malformed_response') from error
|
|
70
|
+
if not response.get('ok'):
|
|
71
|
+
raise TransportError(response.get('error', 'monitor_unavailable'))
|
|
72
|
+
return response
|
|
73
|
+
except OSError as error:
|
|
74
|
+
raise TransportError('offline') from error
|
|
75
|
+
finally:
|
|
76
|
+
client.close()
|
|
77
|
+
|
|
78
|
+
class MonitorTransport:
|
|
79
|
+
"""Bounded, authenticated UDS adapter; token is retained only in this instance."""
|
|
80
|
+
def __init__(self, discovery, timeout=5):
|
|
81
|
+
self.owner = discovery['owner']
|
|
82
|
+
# Identity comes from validated discovery so admission can cross-check
|
|
83
|
+
# a request against the Hub it actually reached, not a config copy.
|
|
84
|
+
self.profile_key = discovery.get('profileKey')
|
|
85
|
+
self.hub_instance_id = (discovery.get('lease') or {}).get('hub')
|
|
86
|
+
self.socket_path = discovery['socketPath']
|
|
87
|
+
self._token = discovery['token']
|
|
88
|
+
self.timeout = timeout
|
|
89
|
+
|
|
90
|
+
def _call(self, payload, timeout=None):
|
|
91
|
+
return request(self.socket_path, self._token, payload, self.timeout if timeout is None else timeout)
|
|
92
|
+
|
|
93
|
+
def events(self, cursor, limit=50, wait_ms=2000):
|
|
94
|
+
"""
|
|
95
|
+
Long-poll for events. The read timeout must cover the wait window the
|
|
96
|
+
Hub was asked to hold, otherwise every poll would expire locally and be
|
|
97
|
+
journaled as an outage. The window stays short so a foreground SIGINT
|
|
98
|
+
is observed promptly.
|
|
99
|
+
"""
|
|
100
|
+
wait_ms = min(max(0, wait_ms), 25000)
|
|
101
|
+
response = self._call({'type': 'events', 'afterSequence': cursor, 'limit': min(max(1, limit), 100),
|
|
102
|
+
'waitMs': wait_ms}, timeout=self.timeout + wait_ms / 1000)
|
|
103
|
+
return response.get('events', response)
|
|
104
|
+
|
|
105
|
+
def snapshot(self, task_id=None):
|
|
106
|
+
response = self._call({'type': 'snapshot'})
|
|
107
|
+
if task_id is None:
|
|
108
|
+
return response
|
|
109
|
+
snapshot = response.get('snapshot', response)
|
|
110
|
+
tasks = snapshot.get('tasks', []) if isinstance(snapshot, dict) else []
|
|
111
|
+
return [item for item in tasks if isinstance(item, dict) and item.get('id') == task_id]
|
|
112
|
+
|
|
113
|
+
def invoke(self, payload):
|
|
114
|
+
return self._call({**payload, 'type': 'invoke'})
|
|
115
|
+
|
|
116
|
+
def cancel(self, task_id, generation):
|
|
117
|
+
return self._call({'type': 'cancel', 'taskId': task_id, 'generation': generation})
|
|
118
|
+
|
|
119
|
+
def invoke_recovery(self, task_id, generation):
|
|
120
|
+
request = {'taskId': task_id, 'generation': generation, 'action': 'request_status',
|
|
121
|
+
'profileKey': self.profile_key, 'ownerSessionId': self.owner,
|
|
122
|
+
'hubInstanceId': self.hub_instance_id,
|
|
123
|
+
'parameters': {'assertionIds': [], 'evidenceEventIds': [],
|
|
124
|
+
'instruction': 'Изпълни ограничено безопасно възстановяване и докладвай доказателства.'},
|
|
125
|
+
'basis': {'deviation': 'stalled_progress', 'judgment': 'confirmed'}}
|
|
126
|
+
canonical = json.dumps(request, sort_keys=True, separators=(',', ':')).encode()
|
|
127
|
+
request['requestId'] = 'recovery:' + __import__('hashlib').sha256(canonical).hexdigest()
|
|
128
|
+
return self.invoke(request)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def reconcile(transport, cursor):
|
|
132
|
+
try:
|
|
133
|
+
return transport.events(cursor)
|
|
134
|
+
except TransportError as error:
|
|
135
|
+
if str(error) not in ('cursor_too_old', 'owner_changed'):
|
|
136
|
+
raise
|
|
137
|
+
snapshot = transport.snapshot()
|
|
138
|
+
return {'snapshot': snapshot, 'events': [], 'cursor': 0, 'reconciled': True}
|
package/hooks/coms-stop-hook.mjs
CHANGED
|
@@ -62,9 +62,20 @@ try {
|
|
|
62
62
|
fs.mkdirSync(dir, { recursive: true });
|
|
63
63
|
const file = path.join(dir, "last-message.json");
|
|
64
64
|
const tmp = `${file}.tmp-${process.pid}`;
|
|
65
|
+
// `transcript_path` is written for the Hermes fleet panel, which reads this
|
|
66
|
+
// file to find which ~/.claude/projects/*.jsonl belongs to a bridged peer.
|
|
67
|
+
// The bridge mints its own coms session id and has no other link to Claude
|
|
68
|
+
// Code's, so without this the panel could only guess by cwd — and a cwd
|
|
69
|
+
// routinely holds several transcripts. The bridge ignores the extra key
|
|
70
|
+
// (HookRecord carries an index signature).
|
|
65
71
|
fs.writeFileSync(
|
|
66
72
|
tmp,
|
|
67
|
-
JSON.stringify({
|
|
73
|
+
JSON.stringify({
|
|
74
|
+
text,
|
|
75
|
+
session_id: input.session_id ?? null,
|
|
76
|
+
transcript_path: transcriptPath,
|
|
77
|
+
written_at: new Date().toISOString(),
|
|
78
|
+
}),
|
|
68
79
|
);
|
|
69
80
|
fs.renameSync(tmp, file);
|
|
70
81
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chankov/agent-fleet",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Multi-agent fleet orchestration for coding agents. Pi as the primary runtime, Herdr as the workspace control plane, coms as the peer data plane, and Hermes for remote control — plus skills, personas, harnesses, and a guided setup CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -66,6 +66,11 @@
|
|
|
66
66
|
"codex/",
|
|
67
67
|
"hermes/README.md",
|
|
68
68
|
"hermes/skills/",
|
|
69
|
+
"hermes/plugins/",
|
|
70
|
+
"hermes/desktop-plugins/",
|
|
71
|
+
"!hermes/watchdog-tests/",
|
|
72
|
+
"!hermes/**/__pycache__/",
|
|
73
|
+
"!hermes/**/*.pyc",
|
|
69
74
|
"systemd/",
|
|
70
75
|
"justfile",
|
|
71
76
|
"references/",
|
|
@@ -79,6 +84,7 @@
|
|
|
79
84
|
"docs/npm-install.md",
|
|
80
85
|
"docs/skill-anatomy.md",
|
|
81
86
|
"docs/getting-started.md",
|
|
87
|
+
"docs/hermes-watchdog-supervisor.md",
|
|
82
88
|
"docs/opencode-setup.md",
|
|
83
89
|
"docs/pi-setup.md",
|
|
84
90
|
".versions/",
|
|
@@ -89,6 +95,8 @@
|
|
|
89
95
|
"!**/*.test.js",
|
|
90
96
|
"!**/*.test.mjs",
|
|
91
97
|
"!**/*.test.ts",
|
|
98
|
+
"!**/*.test.py",
|
|
99
|
+
"!**/test_*.py",
|
|
92
100
|
"!**/*-test.sh",
|
|
93
101
|
"!**/.DS_Store"
|
|
94
102
|
],
|
|
@@ -99,7 +107,8 @@
|
|
|
99
107
|
"access": "public"
|
|
100
108
|
},
|
|
101
109
|
"scripts": {
|
|
102
|
-
"test": "node bin/cli.js --version && node bin/cli.js --help && node bin/cli.js transform-persona --list --agent claude-code && node --test \"bin/test/*.test.js\" scripts/agent-hub-helpers.test.mjs scripts/agent-hub-spawn.test.mjs scripts/agent-hub-delegate.test.mjs scripts/agent-hub-research.test.mjs .pi/harnesses/lib/herdr-client.test.ts .pi/harnesses/lib/herdr-presence.test.ts scripts/coms-cli.test.ts scripts/lib/codex-conductor.test.ts scripts/lib/codex-remote-control.test.ts scripts/lib/fleet-command.test.ts scripts/lib/team-project.test.ts scripts/lib/herdr-layout.test.ts scripts/lib/spawn-stagger.test.ts scripts/lib/fleet-extras.test.ts scripts/lib/team-snapshot.test.ts scripts/lib/coms-envelope.test.ts scripts/lib/claude-bridge-core.test.ts scripts/lib/hermes-bridge-core.test.ts scripts/coms-hermes-bridge.test.ts .pi/harnesses/ask-user-remote/race-core.test.js .pi/harnesses/ask-user-remote/index.test.ts .pi/harnesses/agent-hub/extension-loader.test.ts .pi/extensions/btw/state.test.js .pi/harnesses/agent-hub/footer.test.ts .pi/harnesses/agent-hub/safety-routing.test.ts .pi/harnesses/agent-hub/approval-routing.integration.test.ts .pi/harnesses/agent-hub/run-budget.test.js .pi/harnesses/agent-hub/drift-watchdog.test.js .pi/harnesses/agent-hub/return-contract.test.js .pi/harnesses/agent-hub/backend-policy.test.js .pi/harnesses/agent-hub/artifacts.test.js .pi/harnesses/agent-hub/scope-gate.test.js .pi/harnesses/agent-hub/evidence-rules.test.js .pi/harnesses/agent-hub/research-retention.test.js .pi/harnesses/lib/damage-control-shared.test.ts .pi/harnesses/damage-control-continue/herdr-rules.test.js .pi/harnesses/damage-control-continue/exemptions.test.js scripts/lib/hermes-monitor-model.test.ts scripts/lib/hermes-monitor-store.test.ts scripts/lib/hermes-monitor-retention.integration.test.ts scripts/lib/hermes-monitor-registry.test.ts scripts/lib/hermes-monitor-socket.test.ts scripts/lib/hermes-monitor-data-path.test.ts scripts/lib/hermes-monitor-slice7-9-backend.test.ts scripts/lib/hermes-monitor-control-socket.test.ts scripts/lib/hermes-monitor-e2e.test.ts scripts/hermes-monitor-capability-runner.test.ts scripts/hermes-monitor-scenario.test.ts .pi/harnesses/agent-hub/monitor-control.test.ts .pi/harnesses/agent-hub/monitor-live-bridge-gaps.test.ts .pi/harnesses/agent-hub/monitor-review-live-wiring.red.test.ts .pi/harnesses/agent-hub/monitor-runtime.test.ts .pi/harnesses/agent-hub/monitor-bridge-runtime.test.ts .pi/harnesses/agent-hub/monitor-reconcile.test.ts .pi/harnesses/agent-hub/monitor-recovery.test.ts .pi/harnesses/agent-hub/monitor-lifecycle-lease.test.ts .pi/harnesses/agent-hub/monitor-session-bridge-race.test.ts .pi/harnesses/agent-hub/monitor-session-bridge.test.ts .pi/harnesses/agent-hub/monitor-cancel-race.test.ts .pi/harnesses/agent-hub/monitor-wait-only.test.ts .pi/harnesses/agent-hub/monitor-index.integration.test.ts",
|
|
110
|
+
"test": "node bin/cli.js --version && node bin/cli.js --help && node bin/cli.js transform-persona --list --agent claude-code && node --test \"bin/test/*.test.js\" scripts/agent-hub-helpers.test.mjs scripts/agent-hub-spawn.test.mjs scripts/agent-hub-delegate.test.mjs scripts/agent-hub-research.test.mjs .pi/harnesses/lib/herdr-client.test.ts .pi/harnesses/lib/herdr-presence.test.ts .pi/harnesses/lib/coms-registry-entry.test.ts scripts/coms-cli.test.ts scripts/lib/codex-conductor.test.ts scripts/lib/codex-remote-control.test.ts scripts/lib/fleet-command.test.ts scripts/lib/team-project.test.ts scripts/lib/herdr-layout.test.ts scripts/lib/spawn-stagger.test.ts scripts/lib/monitor-env.test.ts scripts/lib/fleet-extras.test.ts scripts/lib/team-snapshot.test.ts scripts/team-snapshot.command.test.ts scripts/lib/coms-envelope.test.ts scripts/lib/claude-bridge-core.test.ts scripts/lib/hermes-bridge-core.test.ts scripts/coms-hermes-bridge.test.ts .pi/harnesses/ask-user-remote/race-core.test.js .pi/harnesses/ask-user-remote/index.test.ts .pi/harnesses/agent-hub/extension-loader.test.ts .pi/extensions/btw/state.test.js .pi/harnesses/agent-hub/footer.test.ts .pi/harnesses/agent-hub/view-default.test.ts .pi/harnesses/agent-hub/safety-routing.test.ts .pi/harnesses/agent-hub/approval-routing.integration.test.ts .pi/harnesses/agent-hub/run-budget.test.js .pi/harnesses/agent-hub/assertion-ledger.test.js .pi/harnesses/agent-hub/provider-semaphore.test.js .pi/harnesses/agent-hub/spawned-peers.test.js .pi/harnesses/agent-hub/context-window.test.js .pi/harnesses/agent-hub/drift-watchdog.test.js .pi/harnesses/agent-hub/session-health.test.js .pi/harnesses/agent-hub/return-contract.test.js .pi/harnesses/agent-hub/return-extract.test.js .pi/harnesses/agent-hub/backend-policy.test.js .pi/harnesses/agent-hub/artifacts.test.js .pi/harnesses/agent-hub/scope-gate.test.js .pi/harnesses/agent-hub/evidence-rules.test.js .pi/harnesses/agent-hub/research-retention.test.js .pi/harnesses/lib/damage-control-shared.test.ts .pi/harnesses/damage-control-continue/herdr-rules.test.js .pi/harnesses/damage-control-continue/exemptions.test.js scripts/lib/hermes-monitor-model.test.ts scripts/lib/hermes-monitor-events.test.ts scripts/lib/hermes-monitor-store.test.ts scripts/lib/hermes-monitor-retention.integration.test.ts scripts/lib/hermes-monitor-registry.test.ts scripts/lib/hermes-monitor-socket.test.ts scripts/lib/hermes-monitor-data-path.test.ts scripts/lib/hermes-monitor-slice7-9-backend.test.ts scripts/lib/hermes-monitor-control-socket.test.ts scripts/lib/hermes-monitor-e2e.test.ts scripts/lib/hermes-monitor-plugin-handshake.test.ts scripts/hermes-monitor-capability-runner.test.ts scripts/hermes-monitor-scenario.test.ts scripts/hermes-watchdog-capability-probe.test.ts .pi/harnesses/agent-hub/monitor-invoke.test.ts .pi/harnesses/agent-hub/monitor-invoke-journal.test.ts .pi/harnesses/agent-hub/monitor-control.test.ts .pi/harnesses/agent-hub/monitor-live-bridge-gaps.test.ts .pi/harnesses/agent-hub/monitor-review-live-wiring.red.test.ts .pi/harnesses/agent-hub/monitor-runtime.test.ts .pi/harnesses/agent-hub/monitor-bridge-runtime.test.ts .pi/harnesses/agent-hub/monitor-reconcile.test.ts .pi/harnesses/agent-hub/monitor-recovery.test.ts .pi/harnesses/agent-hub/monitor-lifecycle-lease.test.ts .pi/harnesses/agent-hub/monitor-session-bridge-race.test.ts .pi/harnesses/agent-hub/monitor-session-bridge.test.ts .pi/harnesses/agent-hub/monitor-cancel-race.test.ts .pi/harnesses/agent-hub/monitor-wait-only.test.ts .pi/harnesses/agent-hub/monitor-publisher.test.ts .pi/harnesses/agent-hub/monitor-index.integration.test.ts hermes/desktop-plugins/agent-fleet-herdr/presentation.test.js scripts/docs-links.test.mjs && npm run test:watchdog-py",
|
|
111
|
+
"test:watchdog-py": "PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s hermes/watchdog-tests -p 'test_*.py'",
|
|
103
112
|
"pack:dry": "npm pack --dry-run",
|
|
104
113
|
"changeset": "changeset",
|
|
105
114
|
"version:changeset": "node bin/force-patch-changesets.js && changeset version && node bin/sync-harness-versions.js && npm install --package-lock-only --ignore-scripts --no-audit --no-fund && node bin/snapshot-version.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// (e) a `blocked` agent status returns a readable error envelope instead of
|
|
19
19
|
// hanging until timeout;
|
|
20
20
|
// (f) prompts are strictly serialized per pane; queue depth is reported in
|
|
21
|
-
// the agent card + herdr
|
|
21
|
+
// the agent card + the pane's herdr peer annotation.
|
|
22
22
|
//
|
|
23
23
|
// usage: coms-claude-bridge.ts --name <peer-name> [--pane <pane_id>]
|
|
24
24
|
// [--project <p>] [--reply-timeout <ms>]
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
makeEndpoint,
|
|
38
38
|
makeResponseEnvelope,
|
|
39
39
|
nowIso,
|
|
40
|
+
paneAgentStatusToPeerStatus,
|
|
40
41
|
removeRegistryEntry,
|
|
41
42
|
resolveUniqueName,
|
|
42
43
|
sendEnvelope,
|
|
@@ -45,6 +46,7 @@ import {
|
|
|
45
46
|
writeNack,
|
|
46
47
|
writeRegistryAtomic,
|
|
47
48
|
type AgentCard,
|
|
49
|
+
type PeerStatus,
|
|
48
50
|
type PromptEnvelope,
|
|
49
51
|
type RegistryEntry,
|
|
50
52
|
type SenderIdentity,
|
|
@@ -52,15 +54,27 @@ import {
|
|
|
52
54
|
import {
|
|
53
55
|
extractSentinelReply,
|
|
54
56
|
formatPanePrompt,
|
|
57
|
+
idleWaitBudgetMs,
|
|
58
|
+
idleWaitDelayMs,
|
|
59
|
+
isReplyPendingError,
|
|
55
60
|
parseHookRecord,
|
|
56
61
|
PromptQueue,
|
|
62
|
+
REPLY_TIMEOUT_HARD_CAP_MS,
|
|
63
|
+
ReplyPendingError,
|
|
64
|
+
replyDeadlineAt,
|
|
65
|
+
resolveReplyTimeoutMs,
|
|
57
66
|
} from "./lib/claude-bridge-core.ts";
|
|
58
67
|
import { herdr, requireHerdr, HerdrUnavailableError } from "../.pi/harnesses/lib/herdr-client.ts";
|
|
68
|
+
import { HerdrPresence } from "../.pi/harnesses/lib/herdr-presence.ts";
|
|
69
|
+
import { buildLiveRegistryEntry, type ComsIdentity } from "../.pi/harnesses/lib/coms-registry-entry.ts";
|
|
59
70
|
|
|
60
71
|
const KEEPALIVE_MS = 30_000;
|
|
61
72
|
const ENTER_DELAY_MS = 1_500;
|
|
62
73
|
const POLL_MS = 1_000;
|
|
63
|
-
|
|
74
|
+
// 30 minutes, matching coms_await's own default (PI_COMS_TIMEOUT_MS). The old
|
|
75
|
+
// 10-minute default silently truncated every longer request: a caller asking for
|
|
76
|
+
// 1_800_000ms was still failed at 600_000ms.
|
|
77
|
+
const DEFAULT_REPLY_TIMEOUT_MS = 1_800_000;
|
|
64
78
|
const COLOR = "#FF8B39";
|
|
65
79
|
|
|
66
80
|
function flagValue(argv: string[], flag: string): string | null {
|
|
@@ -77,6 +91,53 @@ export function hookWatchDir(paneId: string): string {
|
|
|
77
91
|
return path.join(os.homedir(), ".pi", "coms", "claude-bridge", paneId.replace(/[^A-Za-z0-9_-]/g, "_"));
|
|
78
92
|
}
|
|
79
93
|
|
|
94
|
+
// ── registry record ──
|
|
95
|
+
//
|
|
96
|
+
// Split in two on purpose. The identity is built ONCE, at registration, and
|
|
97
|
+
// holds `started_at`; the entry is rebuilt on every 30s keepalive from that
|
|
98
|
+
// same identity. The bridge used to rebuild the whole record inline with
|
|
99
|
+
// `started_at: nowIso()`, so the field never held the start of anything and
|
|
100
|
+
// every bridged Claude peer reported an uptime of at most one tick — the bug
|
|
101
|
+
// the pi harnesses fixed by centralising on buildLiveRegistryEntry. Reusing it
|
|
102
|
+
// here rather than keeping a third copy is the point.
|
|
103
|
+
|
|
104
|
+
export function bridgeRegistryIdentity(reg: {
|
|
105
|
+
sessionId: string;
|
|
106
|
+
name: string;
|
|
107
|
+
purpose: string;
|
|
108
|
+
endpoint: string;
|
|
109
|
+
cwd: string;
|
|
110
|
+
startedAt: string;
|
|
111
|
+
}): ComsIdentity {
|
|
112
|
+
return {
|
|
113
|
+
session_id: reg.sessionId,
|
|
114
|
+
name: reg.name,
|
|
115
|
+
purpose: reg.purpose,
|
|
116
|
+
// A bridged pane is Claude Code by construction — there is no live ctx to
|
|
117
|
+
// re-read a model from, so the registered one is the only one.
|
|
118
|
+
model: "claude-code",
|
|
119
|
+
color: COLOR,
|
|
120
|
+
endpoint: reg.endpoint,
|
|
121
|
+
cwd: reg.cwd,
|
|
122
|
+
explicit: false,
|
|
123
|
+
started_at: reg.startedAt,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function bridgeRegistryEntry(
|
|
128
|
+
identity: ComsIdentity,
|
|
129
|
+
live: { now: string; pid: number; queueDepth: number },
|
|
130
|
+
): RegistryEntry {
|
|
131
|
+
return buildLiveRegistryEntry(identity, {
|
|
132
|
+
now: live.now,
|
|
133
|
+
pid: live.pid,
|
|
134
|
+
// context_used_pct is not observable from outside a Claude pane; 0 is what
|
|
135
|
+
// the agent card and the herdr annotation carry too, so they all agree.
|
|
136
|
+
contextUsedPct: 0,
|
|
137
|
+
queueDepth: live.queueDepth,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
80
141
|
async function main(): Promise<void> {
|
|
81
142
|
const argv = process.argv.slice(2);
|
|
82
143
|
const name = flagValue(argv, "--name") ?? die("--name <peer-name> is required");
|
|
@@ -104,23 +165,23 @@ async function main(): Promise<void> {
|
|
|
104
165
|
const queue = new PromptQueue<PromptEnvelope>();
|
|
105
166
|
const purpose = "Claude Code (bridged pane)";
|
|
106
167
|
|
|
168
|
+
// Built once — `started_at` is registration time and stays put across every
|
|
169
|
+
// keepalive rebuild below.
|
|
170
|
+
const registryIdentity = bridgeRegistryIdentity({
|
|
171
|
+
sessionId,
|
|
172
|
+
name: uniqueName,
|
|
173
|
+
purpose,
|
|
174
|
+
endpoint: id.endpoint,
|
|
175
|
+
cwd: id.cwd,
|
|
176
|
+
startedAt: nowIso(),
|
|
177
|
+
});
|
|
178
|
+
|
|
107
179
|
function registryEntry(): RegistryEntry {
|
|
108
|
-
return {
|
|
109
|
-
|
|
110
|
-
name: uniqueName,
|
|
111
|
-
purpose,
|
|
112
|
-
model: "claude-code",
|
|
113
|
-
color: COLOR,
|
|
180
|
+
return bridgeRegistryEntry(registryIdentity, {
|
|
181
|
+
now: nowIso(),
|
|
114
182
|
pid: process.pid,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
started_at: nowIso(),
|
|
118
|
-
explicit: false,
|
|
119
|
-
version: 1,
|
|
120
|
-
context_used_pct: 0,
|
|
121
|
-
queue_depth: queue.depth,
|
|
122
|
-
heartbeat_at: nowIso(),
|
|
123
|
-
};
|
|
183
|
+
queueDepth: queue.depth,
|
|
184
|
+
});
|
|
124
185
|
}
|
|
125
186
|
|
|
126
187
|
const hookDir = hookWatchDir(paneId);
|
|
@@ -130,6 +191,14 @@ async function main(): Promise<void> {
|
|
|
130
191
|
// this pane; until then prompts carry the sentinel instruction.
|
|
131
192
|
let hookSeen = fs.existsSync(hookFile);
|
|
132
193
|
|
|
194
|
+
// Latest known pane state. The ping handler is synchronous — a pool refresh
|
|
195
|
+
// must not block on a herdr round trip per peer — so it answers from this
|
|
196
|
+
// cache, which `paneStatus()` refreshes on the keepalive and on every poll
|
|
197
|
+
// during a turn. Starts at "booting": registered, nothing observed yet.
|
|
198
|
+
let lastPaneState: PeerStatus = "booting";
|
|
199
|
+
/** What this bridge reports to a sender: a queued prompt already means busy. */
|
|
200
|
+
const peerStatus = (): PeerStatus => (queue.depth > 0 ? "working" : lastPaneState);
|
|
201
|
+
|
|
133
202
|
// ── envelope server ──
|
|
134
203
|
const server = await bindEndpoint(
|
|
135
204
|
id.endpoint,
|
|
@@ -150,6 +219,8 @@ async function main(): Promise<void> {
|
|
|
150
219
|
color: COLOR,
|
|
151
220
|
context_used_pct: 0,
|
|
152
221
|
queue_depth: queue.depth,
|
|
222
|
+
pane_id: paneId,
|
|
223
|
+
status: peerStatus(),
|
|
153
224
|
};
|
|
154
225
|
try {
|
|
155
226
|
socket.write(JSON.stringify({ type: "pong", msg_id: (env as { msg_id?: string }).msg_id ?? "", agent_card: card }) + "\n");
|
|
@@ -164,25 +235,36 @@ async function main(): Promise<void> {
|
|
|
164
235
|
console.error(`coms-claude-bridge: ${uniqueName}@${project} bridging pane ${paneId}`);
|
|
165
236
|
|
|
166
237
|
// ── presence ──
|
|
238
|
+
// Annotation ONLY, never pane.report_agent: this pane's `agent_status` is
|
|
239
|
+
// herdr's own Claude detection, and driveClaude() polls it back to decide a
|
|
240
|
+
// turn is over. A state we reported ourselves would be us answering our own
|
|
241
|
+
// question. Dialect negotiation (tokens on herdr >= 0.7.4, one latched
|
|
242
|
+
// fallback to custom_status) is HerdrPresence's job — a second copy here is
|
|
243
|
+
// how the bridge stayed on the removed field while the pi path was fixed.
|
|
244
|
+
const presence = new HerdrPresence({
|
|
245
|
+
paneId,
|
|
246
|
+
source: `coms-bridge:${sessionId}`,
|
|
247
|
+
agentLabel: "claude",
|
|
248
|
+
onError: (err, dialect) =>
|
|
249
|
+
console.error(`coms-claude-bridge: herdr rejected the ${dialect} annotation: ${err.message}`),
|
|
250
|
+
});
|
|
167
251
|
async function reportPresence(): Promise<void> {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
source: `coms-bridge:${sessionId}`,
|
|
172
|
-
agent: "claude",
|
|
173
|
-
custom_status: `${uniqueName} q${queue.depth}`.slice(0, 32),
|
|
174
|
-
ttl_ms: 90_000,
|
|
175
|
-
});
|
|
176
|
-
} catch { /* best-effort */ }
|
|
252
|
+
// context_used_pct is not observable from outside a Claude pane; 0 is
|
|
253
|
+
// what the agent card carries too, so the sidebar and the card agree.
|
|
254
|
+
await presence.annotate({ name: uniqueName, project, contextUsedPct: 0, queueDepth: queue.depth });
|
|
177
255
|
}
|
|
178
256
|
const keepalive = setInterval(() => {
|
|
179
257
|
try {
|
|
180
258
|
writeRegistryAtomic(registryEntry(), project);
|
|
181
259
|
} catch { /* best-effort */ }
|
|
182
260
|
void reportPresence();
|
|
261
|
+
// Keep the ping cache warm between turns, so an idle pane is reported as
|
|
262
|
+
// idle rather than staying "booting" until someone sends to it.
|
|
263
|
+
void paneStatus();
|
|
183
264
|
}, KEEPALIVE_MS);
|
|
184
265
|
keepalive.unref?.();
|
|
185
266
|
void reportPresence();
|
|
267
|
+
void paneStatus();
|
|
186
268
|
|
|
187
269
|
// ── prompt processing (strictly serial) ──
|
|
188
270
|
async function pump(): Promise<void> {
|
|
@@ -194,10 +276,16 @@ async function main(): Promise<void> {
|
|
|
194
276
|
await sendEnvelope(env.sender_endpoint, makeResponseEnvelope(id, env.msg_id, reply));
|
|
195
277
|
} catch (err) {
|
|
196
278
|
const message = err instanceof Error ? err.message : String(err);
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
console.error(`coms-claude-bridge:
|
|
279
|
+
if (isReplyPendingError(err)) {
|
|
280
|
+
// No response envelope: the sender's wait expires as `pending`, and may
|
|
281
|
+
// await/get again without treating unfinished work as a failed result.
|
|
282
|
+
console.error(`coms-claude-bridge: ${env.msg_id} remains pending: ${message}`);
|
|
283
|
+
} else {
|
|
284
|
+
try {
|
|
285
|
+
await sendEnvelope(env.sender_endpoint, makeResponseEnvelope(id, env.msg_id, null, message));
|
|
286
|
+
} catch {
|
|
287
|
+
console.error(`coms-claude-bridge: could not deliver error for ${env.msg_id}: ${message}`);
|
|
288
|
+
}
|
|
201
289
|
}
|
|
202
290
|
} finally {
|
|
203
291
|
queue.done();
|
|
@@ -209,7 +297,9 @@ async function main(): Promise<void> {
|
|
|
209
297
|
async function paneStatus(): Promise<string> {
|
|
210
298
|
try {
|
|
211
299
|
const { pane } = await herdr.paneGet(paneId);
|
|
212
|
-
|
|
300
|
+
const status = (pane.agent_status as string) ?? "unknown";
|
|
301
|
+
lastPaneState = paneAgentStatusToPeerStatus(status);
|
|
302
|
+
return status;
|
|
213
303
|
} catch {
|
|
214
304
|
return "unknown";
|
|
215
305
|
}
|
|
@@ -218,21 +308,46 @@ async function main(): Promise<void> {
|
|
|
218
308
|
async function driveClaude(env: PromptEnvelope): Promise<string> {
|
|
219
309
|
const sentinelMode = !hookSeen;
|
|
220
310
|
const hookMtimeBefore = fs.existsSync(hookFile) ? fs.statSync(hookFile).mtimeMs : 0;
|
|
311
|
+
// The caller's declared deadline wins over the bridge default (clamped).
|
|
312
|
+
// One absolute deadline covers BOTH idle waiting and the reply; otherwise a
|
|
313
|
+
// two-minute busy wait silently extends the caller's budget.
|
|
314
|
+
const effectiveTimeoutMs = resolveReplyTimeoutMs(env.reply_timeout_ms, replyTimeoutMs);
|
|
315
|
+
const startedAt = Date.now();
|
|
316
|
+
const replyDeadline = replyDeadlineAt(startedAt, effectiveTimeoutMs);
|
|
221
317
|
|
|
222
|
-
// Claude Code must be idle-ish before we type into its input box
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
318
|
+
// Claude Code must be idle-ish before we type into its input box — but a busy
|
|
319
|
+
// pane is a wait, not a failure. Throwing here made every mid-turn moment a
|
|
320
|
+
// hard error and pushed callers into hot-retry loops.
|
|
321
|
+
const waitDeadline = Math.min(replyDeadline, startedAt + idleWaitBudgetMs(effectiveTimeoutMs));
|
|
322
|
+
const waitStarted = startedAt;
|
|
323
|
+
for (let attempt = 0; ; attempt++) {
|
|
324
|
+
if (await paneStatus() !== "working") break;
|
|
325
|
+
const remaining = waitDeadline - Date.now();
|
|
326
|
+
if (remaining <= 0) {
|
|
327
|
+
throw new Error(
|
|
328
|
+
`Claude Code in pane ${paneId} is still mid-turn after waiting ` +
|
|
329
|
+
`${Math.round((Date.now() - waitStarted) / 1000)}s — try again shortly`,
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
await new Promise((r) => setTimeout(r, Math.min(idleWaitDelayMs(attempt), remaining)));
|
|
226
333
|
}
|
|
227
334
|
|
|
228
335
|
await herdr.paneSendText(paneId, formatPanePrompt(env, sentinelMode));
|
|
229
336
|
await new Promise((r) => setTimeout(r, ENTER_DELAY_MS));
|
|
230
337
|
await herdr.paneSendKeys(paneId, ["enter"]);
|
|
231
338
|
|
|
232
|
-
|
|
339
|
+
// The sender's local await returns `pending` at replyDeadline, but the
|
|
340
|
+
// bridge keeps watching the already-running turn up to the hard cap so a
|
|
341
|
+
// late completion can still resolve the original msg_id.
|
|
342
|
+
const monitorDeadline = replyDeadlineAt(startedAt, REPLY_TIMEOUT_HARD_CAP_MS);
|
|
343
|
+
let pendingLogged = false;
|
|
233
344
|
let sawWorking = false;
|
|
234
|
-
while (Date.now() <
|
|
345
|
+
while (Date.now() < monitorDeadline) {
|
|
235
346
|
await new Promise((r) => setTimeout(r, POLL_MS));
|
|
347
|
+
if (!pendingLogged && Date.now() >= replyDeadline) {
|
|
348
|
+
pendingLogged = true;
|
|
349
|
+
console.error(`coms-claude-bridge: ${env.msg_id} exceeded its reply budget and remains pending`);
|
|
350
|
+
}
|
|
236
351
|
|
|
237
352
|
// primary: Stop hook wrote a new record
|
|
238
353
|
if (fs.existsSync(hookFile)) {
|
|
@@ -261,8 +376,8 @@ async function main(): Promise<void> {
|
|
|
261
376
|
// sentinel not visible yet — keep polling until deadline
|
|
262
377
|
}
|
|
263
378
|
}
|
|
264
|
-
throw new
|
|
265
|
-
`no reply from Claude Code
|
|
379
|
+
throw new ReplyPendingError(
|
|
380
|
+
`no reply from Claude Code before the ${REPLY_TIMEOUT_HARD_CAP_MS}ms hard monitoring cap (requested ${effectiveTimeoutMs}ms)` +
|
|
266
381
|
(sentinelMode ? " (Stop hook not installed? see hooks/coms-stop-hook.mjs)" : ""),
|
|
267
382
|
);
|
|
268
383
|
}
|
package/scripts/fleet.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
import { parseFleetCommand } from "./lib/fleet-command.ts";
|
|
7
|
+
import { resolveMonitorEnv } from "./lib/monitor-env.ts";
|
|
7
8
|
|
|
8
9
|
const HELP = `Agent Fleet — unified Pi runtime
|
|
9
10
|
|
|
@@ -126,9 +127,16 @@ function main(): void {
|
|
|
126
127
|
process.exitCode = 2;
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
130
|
+
// Every mode gets the monitor variables, not just `hub`: a plain `just fleet`
|
|
131
|
+
// or a `peer` loads no agent-hub and so reads them never, while `hub` and
|
|
132
|
+
// `team` both reach the hub through a Just recipe that inherits this
|
|
133
|
+
// environment. Deciding here rather than per recipe keeps it one line of
|
|
134
|
+
// truth; a null answer (opted out, or no directory we can make private)
|
|
135
|
+
// leaves the environment untouched and the hub unmonitored, exactly as
|
|
136
|
+
// before this existed.
|
|
129
137
|
const result = spawnSync("just", [invocation.recipe, ...invocation.args], {
|
|
130
138
|
stdio: "inherit",
|
|
131
|
-
env: process.env,
|
|
139
|
+
env: { ...process.env, ...(resolveMonitorEnv() ?? {}) },
|
|
132
140
|
});
|
|
133
141
|
if (result.error) {
|
|
134
142
|
console.error(`fleet: could not run just: ${result.error.message}`);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface GateOArtifact {
|
|
2
|
+
api?: { kind?: string; name?: string; argumentShape?: string };
|
|
3
|
+
observations?: Record<string, unknown>;
|
|
4
|
+
evidenceIds?: unknown;
|
|
5
|
+
unsupported?: unknown;
|
|
6
|
+
synthetic?: unknown;
|
|
7
|
+
/** Set only by a disposable live run; schema validation never derives this. */
|
|
8
|
+
originDelivery?: unknown;
|
|
9
|
+
liveRunId?: unknown;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface GateOValidation {
|
|
13
|
+
artifactValid: boolean;
|
|
14
|
+
originDelivery: boolean;
|
|
15
|
+
disposition: "origin-delivery-enabled" | "journal-only-no-steering";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const SECRET = /(?:token|bearer|secret|password|authorization|api[_-]?key)\s*[=:]/i;
|
|
19
|
+
const safeText = (value: unknown, maximum: number) => typeof value === "string" && value === value.trim() && value.length > 0 && value.length <= maximum && !SECRET.test(value);
|
|
20
|
+
const REQUIRED_OBSERVATIONS = ["opaqueOrigin", "threeIncrementalUpdates", "wakeReconnect", "profileIsolation", "twoChatIsolation", "structuredInvocation"];
|
|
21
|
+
|
|
22
|
+
/** Validates a sanitized *live* artifact. It never probes, sends, or enables a route itself. */
|
|
23
|
+
export function validateGateOArtifact(value: unknown): GateOValidation {
|
|
24
|
+
const artifact = value as GateOArtifact | null;
|
|
25
|
+
const api = artifact?.api;
|
|
26
|
+
const observations = artifact?.observations;
|
|
27
|
+
const evidenceIds = artifact?.evidenceIds;
|
|
28
|
+
const evidenceSafe = Array.isArray(evidenceIds) && evidenceIds.length >= 2 && evidenceIds.every(id => safeText(id, 256));
|
|
29
|
+
const apiSafe = safeText(api?.kind, 64) && safeText(api?.name, 128) && !/\bsend\s+--to\b/i.test(api.name) && safeText(api?.argumentShape, 256);
|
|
30
|
+
const observed = !!observations && REQUIRED_OBSERVATIONS.every(key => observations[key] === true);
|
|
31
|
+
const artifactValid = !!artifact && artifact.unsupported !== true && artifact.synthetic !== true && apiSafe && observed && evidenceSafe;
|
|
32
|
+
// This assertion is recorded by a disposable live run. A valid document alone is never capability proof.
|
|
33
|
+
const originDelivery = artifactValid && artifact?.originDelivery === true && safeText(artifact.liveRunId, 256);
|
|
34
|
+
return { artifactValid, originDelivery, disposition: originDelivery ? "origin-delivery-enabled" : "journal-only-no-steering" };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (process.argv[1] && import.meta.url === new URL(`file://${process.argv[1]}`).href) {
|
|
38
|
+
let input = "";
|
|
39
|
+
process.stdin.setEncoding("utf8");
|
|
40
|
+
process.stdin.on("data", chunk => { input += chunk; });
|
|
41
|
+
process.stdin.on("end", () => {
|
|
42
|
+
try { console.log(JSON.stringify(validateGateOArtifact(JSON.parse(input)))); }
|
|
43
|
+
catch { console.log(JSON.stringify(validateGateOArtifact(undefined))); process.exitCode = 2; }
|
|
44
|
+
});
|
|
45
|
+
}
|