@chankov/agent-fleet 0.0.4 → 0.0.6
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-telegram.md +15 -0
- package/.opencode/commands/af-set-hermes-telegram.md +15 -0
- package/.pi/agents/dispatch-policy.yaml +1 -1
- package/.pi/agents/peers.yaml +4 -4
- package/.pi/extensions/agent-fleet-update-check/README.md +4 -4
- package/.pi/extensions/btw/README.md +10 -10
- package/.pi/extensions/btw/index.ts +11 -11
- package/.pi/extensions/chrome-devtools-mcp/README.md +3 -3
- package/.pi/extensions/chrome-devtools-mcp/index.ts +1 -0
- package/.pi/extensions/compact-and-continue/README.md +2 -2
- package/.pi/extensions/mcp-bridge/README.md +1 -1
- package/.pi/extensions/pi-voice-stt/README.md +7 -7
- package/.pi/extensions/pi-voice-stt/index.ts +4 -4
- package/.pi/harnesses/agent-hub/README.md +84 -84
- package/.pi/harnesses/agent-hub/backend-policy.js +1 -1
- package/.pi/harnesses/agent-hub/delegate.ts +3 -3
- package/.pi/harnesses/agent-hub/drift-watchdog.js +1 -1
- package/.pi/harnesses/agent-hub/index.ts +254 -254
- package/.pi/harnesses/agent-hub/monitor-lifecycle.ts +1 -1
- package/.pi/harnesses/agent-hub/monitor-publisher.ts +3 -3
- package/.pi/harnesses/agent-hub/monitor-session-bridge.ts +1 -1
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/run-budget.js +1 -1
- package/.pi/harnesses/ask-user-remote/README.md +1 -0
- package/.pi/harnesses/ask-user-remote/index.ts +36 -8
- package/.pi/harnesses/coms/README.md +7 -7
- package/.pi/harnesses/coms/index.ts +13 -13
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/README.md +16 -16
- package/.pi/harnesses/damage-control-continue/index.ts +11 -11
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.pi/harnesses/lib/hermes-monitor-model.ts +9 -0
- package/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.pi/harnesses/lib/hermes-monitor-socket.ts +118 -0
- package/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.pi/prompts/af-doctor-agent-fleet.md +15 -0
- package/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.pi/prompts/af-setup-agent-fleet.md +27 -0
- package/.versions/0.0.5/.claude/commands/build.md +44 -0
- package/.versions/0.0.5/.claude/commands/code-simplify.md +22 -0
- package/.versions/0.0.5/.claude/commands/design-agent.md +14 -0
- package/.versions/0.0.5/.claude/commands/doctor-agent-fleet.md +17 -0
- package/.versions/0.0.5/.claude/commands/orchestrate.md +112 -0
- package/.versions/0.0.5/.claude/commands/plan.md +16 -0
- package/.versions/0.0.5/.claude/commands/prime.md +22 -0
- package/.versions/0.0.5/.claude/commands/review.md +16 -0
- package/.versions/0.0.5/.claude/commands/set-hermes-telegram.md +15 -0
- package/.versions/0.0.5/.claude/commands/setup-agent-fleet.md +25 -0
- package/.versions/0.0.5/.claude/commands/ship.md +72 -0
- package/.versions/0.0.5/.claude/commands/spec.md +15 -0
- package/.versions/0.0.5/.claude/commands/test.md +19 -0
- package/.versions/0.0.5/.claude/commands/webperf.md +32 -0
- package/.versions/0.0.5/.claude/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.5/.opencode/commands/af-build.md +17 -0
- package/.versions/0.0.5/.opencode/commands/af-code-simplify.md +16 -0
- package/.versions/0.0.5/.opencode/commands/af-compound.md +16 -0
- package/.versions/0.0.5/.opencode/commands/af-design-agent.md +15 -0
- package/.versions/0.0.5/.opencode/commands/af-doctor-agent-fleet.md +17 -0
- package/.versions/0.0.5/.opencode/commands/af-orchestrate.md +112 -0
- package/.versions/0.0.5/.opencode/commands/af-plan.md +16 -0
- package/.versions/0.0.5/.opencode/commands/af-prime.md +22 -0
- package/.versions/0.0.5/.opencode/commands/af-review.md +15 -0
- package/.versions/0.0.5/.opencode/commands/af-set-hermes-telegram.md +15 -0
- package/.versions/0.0.5/.opencode/commands/af-setup-agent-fleet.md +15 -0
- package/.versions/0.0.5/.opencode/commands/af-ship.md +16 -0
- package/.versions/0.0.5/.opencode/commands/af-spec.md +16 -0
- package/.versions/0.0.5/.opencode/commands/af-test.md +21 -0
- package/.versions/0.0.5/.opencode/commands/af-webperf.md +32 -0
- package/.versions/0.0.5/.opencode/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.5/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/0.0.5/.pi/agents/model-profiles.yaml +20 -0
- package/.versions/0.0.5/.pi/agents/peers.yaml +146 -0
- package/.versions/0.0.5/.pi/agents/teams.yaml +39 -0
- package/.versions/0.0.5/.pi/damage-control-rules.yaml +297 -0
- package/.versions/0.0.5/.pi/extensions/agent-fleet-update-check/README.md +58 -0
- package/.versions/0.0.5/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
- package/.versions/0.0.5/.pi/extensions/agent-fleet-update-check/package.json +6 -0
- package/.versions/0.0.5/.pi/extensions/btw/README.md +118 -0
- package/.versions/0.0.5/.pi/extensions/btw/index.ts +917 -0
- package/.versions/0.0.5/.pi/extensions/btw/package.json +6 -0
- package/.versions/0.0.5/.pi/extensions/btw/state.js +179 -0
- package/.versions/0.0.5/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
- package/.versions/0.0.5/.pi/extensions/chrome-devtools-mcp/index.ts +92 -0
- package/.versions/0.0.5/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/0.0.5/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/0.0.5/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/0.0.5/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/0.0.5/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/0.0.5/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/0.0.5/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/0.0.5/.pi/extensions/package-lock.json +1143 -0
- package/.versions/0.0.5/.pi/extensions/package.json +9 -0
- package/.versions/0.0.5/.pi/extensions/pi-voice-stt/README.md +201 -0
- package/.versions/0.0.5/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/0.0.5/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/0.0.5/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/0.0.5/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/0.0.5/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/0.0.5/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/README.md +798 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/artifacts.js +92 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/backend-policy.js +153 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/delegate.ts +386 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/drift-watchdog.js +165 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/footer.ts +29 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/helpers.ts +214 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/index.ts +8045 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-session-bridge.ts +11 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/research-retention.js +34 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/return-contract.js +215 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/run-budget.js +155 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/scope-gate.js +103 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/spawn.ts +246 -0
- package/.versions/0.0.5/.pi/harnesses/agent-hub/version.ts +18 -0
- package/.versions/0.0.5/.pi/harnesses/ask-user-remote/README.md +19 -0
- package/.versions/0.0.5/.pi/harnesses/ask-user-remote/index.ts +321 -0
- package/.versions/0.0.5/.pi/harnesses/ask-user-remote/race-core.js +106 -0
- package/.versions/0.0.5/.pi/harnesses/coms/README.md +92 -0
- package/.versions/0.0.5/.pi/harnesses/coms/index.ts +1745 -0
- package/.versions/0.0.5/.pi/harnesses/coms/package.json +7 -0
- package/.versions/0.0.5/.pi/harnesses/coms/version.ts +18 -0
- package/.versions/0.0.5/.pi/harnesses/damage-control-continue/README.md +117 -0
- package/.versions/0.0.5/.pi/harnesses/damage-control-continue/index.ts +536 -0
- package/.versions/0.0.5/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/0.0.5/.pi/harnesses/damage-control-continue/version.ts +18 -0
- package/.versions/0.0.5/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/0.0.5/.pi/harnesses/lib/herdr-client.ts +458 -0
- package/.versions/0.0.5/.pi/harnesses/lib/herdr-presence.ts +288 -0
- package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-model.ts +9 -0
- package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-socket.ts +118 -0
- package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/0.0.5/.pi/harnesses/package-lock.json +35 -0
- package/.versions/0.0.5/.pi/harnesses/package.json +9 -0
- package/.versions/0.0.5/.pi/prompts/build.md +24 -0
- package/.versions/0.0.5/.pi/prompts/code-simplify.md +22 -0
- package/.versions/0.0.5/.pi/prompts/plan.md +16 -0
- package/.versions/0.0.5/.pi/prompts/review.md +16 -0
- package/.versions/0.0.5/.pi/prompts/set-hermes-telegram.md +15 -0
- package/.versions/0.0.5/.pi/prompts/ship.md +17 -0
- package/.versions/0.0.5/.pi/prompts/spec.md +15 -0
- package/.versions/0.0.5/.pi/prompts/test.md +19 -0
- package/.versions/0.0.5/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/0.0.5/.version +1 -0
- package/.versions/0.0.5/agents/architect.md +23 -0
- package/.versions/0.0.5/agents/bowser.md +26 -0
- package/.versions/0.0.5/agents/builder.md +53 -0
- package/.versions/0.0.5/agents/code-reviewer.md +205 -0
- package/.versions/0.0.5/agents/deep-researcher.md +31 -0
- package/.versions/0.0.5/agents/documenter.md +18 -0
- package/.versions/0.0.5/agents/orchestrator.md +54 -0
- package/.versions/0.0.5/agents/plan-reviewer.md +60 -0
- package/.versions/0.0.5/agents/planner.md +69 -0
- package/.versions/0.0.5/agents/releaser.md +24 -0
- package/.versions/0.0.5/agents/researcher.md +28 -0
- package/.versions/0.0.5/agents/security-auditor.md +166 -0
- package/.versions/0.0.5/agents/test-engineer.md +151 -0
- package/.versions/0.0.5/agents/web-debugger.md +42 -0
- package/.versions/0.0.5/agents/web-performance-auditor.md +192 -0
- package/.versions/0.0.5/codex/CONDUCTOR.md +148 -0
- package/.versions/0.0.5/docs/ARCHITECTURE.md +210 -0
- package/.versions/0.0.5/docs/agent-fleet-setup.md +366 -0
- package/.versions/0.0.5/docs/claude-code-coms-bridge.md +103 -0
- package/.versions/0.0.5/docs/codex-remote-conductor.md +170 -0
- package/.versions/0.0.5/docs/coms-hermes-bridge.md +179 -0
- package/.versions/0.0.5/docs/getting-started.md +183 -0
- package/.versions/0.0.5/docs/npm-install.md +337 -0
- package/.versions/0.0.5/docs/opencode-setup.md +249 -0
- package/.versions/0.0.5/docs/pi-extensions.md +293 -0
- package/.versions/0.0.5/docs/pi-setup.md +472 -0
- package/.versions/0.0.5/docs/skill-anatomy.md +150 -0
- package/.versions/0.0.5/hermes/README.md +231 -0
- package/.versions/0.0.5/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/0.0.5/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/0.0.5/hooks/SIMPLIFY-IGNORE.md +90 -0
- package/.versions/0.0.5/hooks/coms-stop-hook.mjs +73 -0
- package/.versions/0.0.5/hooks/hooks.json +14 -0
- package/.versions/0.0.5/hooks/session-start.sh +74 -0
- package/.versions/0.0.5/hooks/simplify-ignore.sh +302 -0
- package/.versions/0.0.5/justfile +245 -0
- package/.versions/0.0.5/references/accessibility-checklist.md +160 -0
- package/.versions/0.0.5/references/definition-of-done.md +67 -0
- package/.versions/0.0.5/references/fleet-coordination-patterns.md +151 -0
- package/.versions/0.0.5/references/observability-checklist.md +91 -0
- package/.versions/0.0.5/references/orchestration-patterns.md +370 -0
- package/.versions/0.0.5/references/performance-checklist.md +153 -0
- package/.versions/0.0.5/references/prompting-patterns.md +380 -0
- package/.versions/0.0.5/references/security-checklist.md +179 -0
- package/.versions/0.0.5/references/testing-patterns.md +236 -0
- package/.versions/0.0.5/scripts/codex-conductor.ts +41 -0
- package/.versions/0.0.5/scripts/codex-remote-control.ts +167 -0
- package/.versions/0.0.5/scripts/coms-claude-bridge.ts +286 -0
- package/.versions/0.0.5/scripts/coms-cli.ts +484 -0
- package/.versions/0.0.5/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/0.0.5/scripts/fleet.ts +141 -0
- package/.versions/0.0.5/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/0.0.5/scripts/hermes-monitor-scenario.ts +7 -0
- package/.versions/0.0.5/scripts/lib/claude-bridge-core.ts +100 -0
- package/.versions/0.0.5/scripts/lib/codex-conductor.ts +88 -0
- package/.versions/0.0.5/scripts/lib/codex-remote-control.ts +480 -0
- package/.versions/0.0.5/scripts/lib/coms-envelope.ts +539 -0
- package/.versions/0.0.5/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/0.0.5/scripts/lib/fleet-command.ts +109 -0
- package/.versions/0.0.5/scripts/lib/herdr-layout.ts +263 -0
- package/.versions/0.0.5/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/0.0.5/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/0.0.5/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/0.0.5/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/0.0.5/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/0.0.5/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/0.0.5/scripts/lib/persona-banner.ts +62 -0
- package/.versions/0.0.5/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/0.0.5/scripts/lib/team-project.ts +191 -0
- package/.versions/0.0.5/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/0.0.5/scripts/peer-banner.ts +40 -0
- package/.versions/0.0.5/scripts/team-snapshot.ts +237 -0
- package/.versions/0.0.5/scripts/team-up.ts +351 -0
- package/.versions/0.0.5/skills/_internal/grilling.md +11 -0
- package/.versions/0.0.5/skills/browser-testing-with-devtools/SKILL.md +352 -0
- package/.versions/0.0.5/skills/code-review-and-quality/SKILL.md +381 -0
- package/.versions/0.0.5/skills/compound-learning/SKILL.md +137 -0
- package/.versions/0.0.5/skills/context-engineering/SKILL.md +291 -0
- package/.versions/0.0.5/skills/deprecation-and-migration/SKILL.md +206 -0
- package/.versions/0.0.5/skills/designing-agents/SKILL.md +394 -0
- package/.versions/0.0.5/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/0.0.5/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.5/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/0.0.5/skills/guided-workspace-setup/SKILL.md +542 -0
- package/.versions/0.0.5/skills/guided-workspace-setup/companion-manifest.json +35 -0
- package/.versions/0.0.5/skills/idea-refine/SKILL.md +182 -0
- package/.versions/0.0.5/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.5/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.5/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.5/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.5/skills/incremental-implementation/SKILL.md +287 -0
- package/.versions/0.0.5/skills/interview-me/SKILL.md +226 -0
- package/.versions/0.0.5/skills/orchestration-verification/SKILL.md +181 -0
- package/.versions/0.0.5/skills/peer-coms/SKILL.md +90 -0
- package/.versions/0.0.5/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.5/skills/planning-and-task-breakdown/SKILL.md +236 -0
- package/.versions/0.0.5/skills/security-and-hardening/SKILL.md +461 -0
- package/.versions/0.0.5/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/0.0.5/skills/using-agent-skills/SKILL.md +199 -0
- package/.versions/0.0.5/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/README.md +11 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
- package/.versions/0.0.5/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
- package/.versions/0.0.6/.claude/commands/build.md +44 -0
- package/.versions/0.0.6/.claude/commands/code-simplify.md +22 -0
- package/.versions/0.0.6/.claude/commands/design-agent.md +14 -0
- package/.versions/0.0.6/.claude/commands/doctor-agent-fleet.md +17 -0
- package/.versions/0.0.6/.claude/commands/orchestrate.md +112 -0
- package/.versions/0.0.6/.claude/commands/plan.md +16 -0
- package/.versions/0.0.6/.claude/commands/prime.md +22 -0
- package/.versions/0.0.6/.claude/commands/review.md +16 -0
- package/.versions/0.0.6/.claude/commands/set-hermes-telegram.md +15 -0
- package/.versions/0.0.6/.claude/commands/setup-agent-fleet.md +25 -0
- package/.versions/0.0.6/.claude/commands/ship.md +72 -0
- package/.versions/0.0.6/.claude/commands/spec.md +15 -0
- package/.versions/0.0.6/.claude/commands/test.md +19 -0
- package/.versions/0.0.6/.claude/commands/webperf.md +32 -0
- package/.versions/0.0.6/.claude/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.6/.opencode/commands/af-build.md +17 -0
- package/.versions/0.0.6/.opencode/commands/af-code-simplify.md +16 -0
- package/.versions/0.0.6/.opencode/commands/af-compound.md +16 -0
- package/.versions/0.0.6/.opencode/commands/af-design-agent.md +15 -0
- package/.versions/0.0.6/.opencode/commands/af-doctor-agent-fleet.md +17 -0
- package/.versions/0.0.6/.opencode/commands/af-orchestrate.md +112 -0
- package/.versions/0.0.6/.opencode/commands/af-plan.md +16 -0
- package/.versions/0.0.6/.opencode/commands/af-prime.md +22 -0
- package/.versions/0.0.6/.opencode/commands/af-review.md +15 -0
- package/.versions/0.0.6/.opencode/commands/af-set-hermes-telegram.md +15 -0
- package/.versions/0.0.6/.opencode/commands/af-setup-agent-fleet.md +15 -0
- package/.versions/0.0.6/.opencode/commands/af-ship.md +16 -0
- package/.versions/0.0.6/.opencode/commands/af-spec.md +16 -0
- package/.versions/0.0.6/.opencode/commands/af-test.md +21 -0
- package/.versions/0.0.6/.opencode/commands/af-webperf.md +32 -0
- package/.versions/0.0.6/.opencode/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.6/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/0.0.6/.pi/agents/model-profiles.yaml +20 -0
- package/.versions/0.0.6/.pi/agents/peers.yaml +146 -0
- package/.versions/0.0.6/.pi/agents/teams.yaml +39 -0
- package/.versions/0.0.6/.pi/damage-control-rules.yaml +297 -0
- package/.versions/0.0.6/.pi/extensions/agent-fleet-update-check/README.md +58 -0
- package/.versions/0.0.6/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
- package/.versions/0.0.6/.pi/extensions/agent-fleet-update-check/package.json +6 -0
- package/.versions/0.0.6/.pi/extensions/btw/README.md +118 -0
- package/.versions/0.0.6/.pi/extensions/btw/index.ts +917 -0
- package/.versions/0.0.6/.pi/extensions/btw/package.json +6 -0
- package/.versions/0.0.6/.pi/extensions/btw/state.js +179 -0
- package/.versions/0.0.6/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
- package/.versions/0.0.6/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/0.0.6/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/0.0.6/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/0.0.6/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/0.0.6/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/0.0.6/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/0.0.6/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/0.0.6/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/0.0.6/.pi/extensions/package-lock.json +1143 -0
- package/.versions/0.0.6/.pi/extensions/package.json +9 -0
- package/.versions/0.0.6/.pi/extensions/pi-voice-stt/README.md +201 -0
- package/.versions/0.0.6/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/0.0.6/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/0.0.6/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/0.0.6/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/0.0.6/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/0.0.6/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/README.md +798 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/artifacts.js +92 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/backend-policy.js +153 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/delegate.ts +386 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/drift-watchdog.js +165 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/footer.ts +29 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/helpers.ts +214 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/index.ts +8045 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/monitor-session-bridge.ts +11 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/research-retention.js +34 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/return-contract.js +215 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/run-budget.js +155 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/scope-gate.js +103 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/spawn.ts +246 -0
- package/.versions/0.0.6/.pi/harnesses/agent-hub/version.ts +18 -0
- package/.versions/0.0.6/.pi/harnesses/ask-user-remote/README.md +19 -0
- package/.versions/0.0.6/.pi/harnesses/ask-user-remote/index.ts +321 -0
- package/.versions/0.0.6/.pi/harnesses/ask-user-remote/race-core.js +106 -0
- package/.versions/0.0.6/.pi/harnesses/coms/README.md +92 -0
- package/.versions/0.0.6/.pi/harnesses/coms/index.ts +1745 -0
- package/.versions/0.0.6/.pi/harnesses/coms/package.json +7 -0
- package/.versions/0.0.6/.pi/harnesses/coms/version.ts +18 -0
- package/.versions/0.0.6/.pi/harnesses/damage-control-continue/README.md +117 -0
- package/.versions/0.0.6/.pi/harnesses/damage-control-continue/index.ts +536 -0
- package/.versions/0.0.6/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/0.0.6/.pi/harnesses/damage-control-continue/version.ts +18 -0
- package/.versions/0.0.6/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/0.0.6/.pi/harnesses/lib/herdr-client.ts +458 -0
- package/.versions/0.0.6/.pi/harnesses/lib/herdr-presence.ts +288 -0
- package/.versions/0.0.6/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/0.0.6/.pi/harnesses/lib/hermes-monitor-model.ts +9 -0
- package/.versions/0.0.6/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/0.0.6/.pi/harnesses/lib/hermes-monitor-socket.ts +118 -0
- package/.versions/0.0.6/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/0.0.6/.pi/harnesses/package-lock.json +35 -0
- package/.versions/0.0.6/.pi/harnesses/package.json +9 -0
- package/.versions/0.0.6/.pi/prompts/af-build.md +24 -0
- package/.versions/0.0.6/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/0.0.6/.pi/prompts/af-doctor-agent-fleet.md +15 -0
- package/.versions/0.0.6/.pi/prompts/af-plan.md +16 -0
- package/.versions/0.0.6/.pi/prompts/af-review.md +16 -0
- package/.versions/0.0.6/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/0.0.6/.pi/prompts/af-setup-agent-fleet.md +27 -0
- package/.versions/0.0.6/.pi/prompts/af-ship.md +17 -0
- package/.versions/0.0.6/.pi/prompts/af-spec.md +15 -0
- package/.versions/0.0.6/.pi/prompts/af-test.md +19 -0
- package/.versions/0.0.6/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/0.0.6/.version +1 -0
- package/.versions/0.0.6/agents/architect.md +23 -0
- package/.versions/0.0.6/agents/bowser.md +26 -0
- package/.versions/0.0.6/agents/builder.md +53 -0
- package/.versions/0.0.6/agents/code-reviewer.md +205 -0
- package/.versions/0.0.6/agents/deep-researcher.md +31 -0
- package/.versions/0.0.6/agents/documenter.md +18 -0
- package/.versions/0.0.6/agents/orchestrator.md +54 -0
- package/.versions/0.0.6/agents/plan-reviewer.md +60 -0
- package/.versions/0.0.6/agents/planner.md +69 -0
- package/.versions/0.0.6/agents/releaser.md +24 -0
- package/.versions/0.0.6/agents/researcher.md +28 -0
- package/.versions/0.0.6/agents/security-auditor.md +166 -0
- package/.versions/0.0.6/agents/test-engineer.md +151 -0
- package/.versions/0.0.6/agents/web-debugger.md +42 -0
- package/.versions/0.0.6/agents/web-performance-auditor.md +192 -0
- package/.versions/0.0.6/codex/CONDUCTOR.md +148 -0
- package/.versions/0.0.6/docs/ARCHITECTURE.md +210 -0
- package/.versions/0.0.6/docs/agent-fleet-setup.md +366 -0
- package/.versions/0.0.6/docs/claude-code-coms-bridge.md +103 -0
- package/.versions/0.0.6/docs/codex-remote-conductor.md +170 -0
- package/.versions/0.0.6/docs/coms-hermes-bridge.md +179 -0
- package/.versions/0.0.6/docs/getting-started.md +183 -0
- package/.versions/0.0.6/docs/npm-install.md +337 -0
- package/.versions/0.0.6/docs/opencode-setup.md +249 -0
- package/.versions/0.0.6/docs/pi-extensions.md +293 -0
- package/.versions/0.0.6/docs/pi-setup.md +476 -0
- package/.versions/0.0.6/docs/skill-anatomy.md +150 -0
- package/.versions/0.0.6/hermes/README.md +231 -0
- package/.versions/0.0.6/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/0.0.6/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-cap.test.py +15 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-discovery.test.py +19 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-envelope.test.py +13 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-forged-owner.test.py +11 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-lease-list.test.py +9 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-multihub.test.py +17 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter-output.test.py +34 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +151 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter.test.py +39 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/plugin-api-validation.test.py +12 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/0.0.6/hermes/plugins/agent-fleet-monitor/dashboard/review-live-wiring.red.test.py +22 -0
- package/.versions/0.0.6/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/0.0.6/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/0.0.6/hooks/SIMPLIFY-IGNORE.md +90 -0
- package/.versions/0.0.6/hooks/coms-stop-hook.mjs +73 -0
- package/.versions/0.0.6/hooks/hooks.json +14 -0
- package/.versions/0.0.6/hooks/session-start.sh +74 -0
- package/.versions/0.0.6/hooks/simplify-ignore.sh +302 -0
- package/.versions/0.0.6/justfile +245 -0
- package/.versions/0.0.6/references/accessibility-checklist.md +160 -0
- package/.versions/0.0.6/references/definition-of-done.md +67 -0
- package/.versions/0.0.6/references/fleet-coordination-patterns.md +151 -0
- package/.versions/0.0.6/references/observability-checklist.md +91 -0
- package/.versions/0.0.6/references/orchestration-patterns.md +370 -0
- package/.versions/0.0.6/references/performance-checklist.md +153 -0
- package/.versions/0.0.6/references/prompting-patterns.md +380 -0
- package/.versions/0.0.6/references/security-checklist.md +179 -0
- package/.versions/0.0.6/references/testing-patterns.md +236 -0
- package/.versions/0.0.6/scripts/codex-conductor.ts +41 -0
- package/.versions/0.0.6/scripts/codex-remote-control.ts +167 -0
- package/.versions/0.0.6/scripts/coms-claude-bridge.ts +286 -0
- package/.versions/0.0.6/scripts/coms-cli.ts +484 -0
- package/.versions/0.0.6/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/0.0.6/scripts/fleet.ts +141 -0
- package/.versions/0.0.6/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/0.0.6/scripts/hermes-monitor-scenario.ts +7 -0
- package/.versions/0.0.6/scripts/lib/claude-bridge-core.ts +100 -0
- package/.versions/0.0.6/scripts/lib/codex-conductor.ts +88 -0
- package/.versions/0.0.6/scripts/lib/codex-remote-control.ts +480 -0
- package/.versions/0.0.6/scripts/lib/coms-envelope.ts +539 -0
- package/.versions/0.0.6/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/0.0.6/scripts/lib/fleet-command.ts +109 -0
- package/.versions/0.0.6/scripts/lib/herdr-layout.ts +263 -0
- package/.versions/0.0.6/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/0.0.6/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/0.0.6/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/0.0.6/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/0.0.6/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/0.0.6/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/0.0.6/scripts/lib/persona-banner.ts +62 -0
- package/.versions/0.0.6/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/0.0.6/scripts/lib/team-project.ts +191 -0
- package/.versions/0.0.6/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/0.0.6/scripts/peer-banner.ts +40 -0
- package/.versions/0.0.6/scripts/team-snapshot.ts +237 -0
- package/.versions/0.0.6/scripts/team-up.ts +351 -0
- package/.versions/0.0.6/skills/_internal/grilling.md +11 -0
- package/.versions/0.0.6/skills/browser-testing-with-devtools/SKILL.md +352 -0
- package/.versions/0.0.6/skills/code-review-and-quality/SKILL.md +381 -0
- package/.versions/0.0.6/skills/compound-learning/SKILL.md +137 -0
- package/.versions/0.0.6/skills/context-engineering/SKILL.md +291 -0
- package/.versions/0.0.6/skills/deprecation-and-migration/SKILL.md +206 -0
- package/.versions/0.0.6/skills/designing-agents/SKILL.md +394 -0
- package/.versions/0.0.6/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/0.0.6/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.6/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/0.0.6/skills/guided-workspace-setup/SKILL.md +544 -0
- package/.versions/0.0.6/skills/guided-workspace-setup/companion-manifest.json +35 -0
- package/.versions/0.0.6/skills/idea-refine/SKILL.md +182 -0
- package/.versions/0.0.6/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.6/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.6/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.6/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.6/skills/incremental-implementation/SKILL.md +287 -0
- package/.versions/0.0.6/skills/interview-me/SKILL.md +226 -0
- package/.versions/0.0.6/skills/orchestration-verification/SKILL.md +181 -0
- package/.versions/0.0.6/skills/peer-coms/SKILL.md +90 -0
- package/.versions/0.0.6/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.6/skills/planning-and-task-breakdown/SKILL.md +236 -0
- package/.versions/0.0.6/skills/security-and-hardening/SKILL.md +461 -0
- package/.versions/0.0.6/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/0.0.6/skills/using-agent-skills/SKILL.md +199 -0
- package/.versions/0.0.6/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/README.md +11 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
- package/.versions/0.0.6/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
- package/CHANGELOG.md +15 -0
- package/README.md +38 -36
- package/agents/documenter.md +1 -1
- package/agents/releaser.md +1 -1
- package/bin/cli.js +103 -21
- package/bin/lib/bootstrap.js +16 -16
- package/bin/lib/doctor.js +1 -1
- package/bin/lib/set-hermes-telegram.js +323 -0
- package/docs/ARCHITECTURE.md +8 -8
- package/docs/agent-fleet-setup.md +12 -12
- package/docs/claude-code-coms-bridge.md +4 -4
- package/docs/codex-remote-conductor.md +12 -12
- package/docs/coms-hermes-bridge.md +62 -4
- package/docs/getting-started.md +4 -4
- package/docs/npm-install.md +21 -21
- package/docs/opencode-setup.md +1 -0
- package/docs/pi-extensions.md +36 -31
- package/docs/pi-setup.md +66 -53
- package/hermes/README.md +14 -11
- package/justfile +141 -152
- package/package.json +6 -3
- package/references/fleet-coordination-patterns.md +3 -3
- package/scripts/coms-hermes-bridge.ts +18 -8
- package/scripts/fleet.ts +141 -0
- package/scripts/lib/fleet-command.ts +109 -0
- package/scripts/lib/hermes-bridge-core.ts +5 -2
- package/scripts/lib/hermes-monitor-herdr.ts +2 -28
- package/scripts/lib/hermes-monitor-model.ts +3 -9
- package/scripts/lib/hermes-monitor-registry.ts +2 -6
- package/scripts/lib/hermes-monitor-socket.ts +2 -118
- package/scripts/lib/hermes-monitor-store.ts +2 -31
- package/scripts/lib/team-project.ts +10 -3
- package/scripts/team-snapshot.ts +4 -5
- package/scripts/team-up.ts +24 -6
- package/skills/browser-testing-with-devtools/SKILL.md +1 -1
- package/skills/compound-learning/SKILL.md +3 -3
- package/skills/guided-workspace-setup/SKILL.md +27 -18
- package/skills/guided-workspace-setup/companion-manifest.json +3 -1
- package/skills/peer-coms/SKILL.md +1 -1
- package/hermes/plugins/agent-fleet-monitor/dashboard/dist/index.js +0 -10
- /package/.pi/prompts/{build.md → af-build.md} +0 -0
- /package/.pi/prompts/{code-simplify.md → af-code-simplify.md} +0 -0
- /package/.pi/prompts/{plan.md → af-plan.md} +0 -0
- /package/.pi/prompts/{review.md → af-review.md} +0 -0
- /package/.pi/prompts/{ship.md → af-ship.md} +0 -0
- /package/.pi/prompts/{spec.md → af-spec.md} +0 -0
- /package/.pi/prompts/{test.md → af-test.md} +0 -0
- /package/{.pi → .versions/0.0.5/.pi}/prompts/doctor-agent-fleet.md +0 -0
- /package/{.pi → .versions/0.0.5/.pi}/prompts/setup-agent-fleet.md +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/desktop-plugins/agent-fleet-monitor/plugin.js +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/desktop-plugins/agent-fleet-monitor/state.js +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/adapter-cap.test.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/adapter-discovery.test.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/adapter-envelope.test.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/adapter-forged-owner.test.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/adapter-lease-list.test.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/adapter-multihub.test.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/adapter-output.test.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/adapter.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/adapter.test.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/manifest.json +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/plugin-api-validation.test.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/plugin_api.py +0 -0
- /package/{hermes → .versions/0.0.5/hermes}/plugins/agent-fleet-monitor/dashboard/review-live-wiring.red.test.py +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
|
-
import { MonitorSocketServer } from "
|
|
2
|
+
import { MonitorSocketServer } from "../lib/hermes-monitor-socket.ts";
|
|
3
3
|
import { createOwnedHandleRegistry, recordWaitOnlyCancellation } from "./monitor-control.ts";
|
|
4
4
|
export interface MonitorLifecycleConfig { runtimeDir:string; profileId:string; profilePath:string; }
|
|
5
5
|
export function monitorLifecycleConfig(env:NodeJS.ProcessEnv):MonitorLifecycleConfig|null{const profileId=env.AGENT_FLEET_PROFILE_ID,runtimeDir=env.AGENT_FLEET_MONITOR_RUNTIME_DIR;if(!profileId||!runtimeDir||!path.isAbsolute(runtimeDir)||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(profileId)||profileId.includes(".."))return null;return{runtimeDir,profileId,profilePath:path.join(runtimeDir,"profiles",profileId)};}
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
type CreateChildTaskInput,
|
|
3
3
|
type CreateParentTaskInput,
|
|
4
4
|
type MonitorTask,
|
|
5
|
-
} from "
|
|
6
|
-
import { MonitorStore, type MonitorOutput } from "
|
|
7
|
-
import { correlateHubPane } from "
|
|
5
|
+
} from "../lib/hermes-monitor-model.ts";
|
|
6
|
+
import { MonitorStore, type MonitorOutput } from "../lib/hermes-monitor-store.ts";
|
|
7
|
+
import { correlateHubPane } from "../lib/hermes-monitor-herdr.ts";
|
|
8
8
|
|
|
9
9
|
export interface ViewerGatedMonitor {
|
|
10
10
|
setViewers(count: number): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MonitorStore } from '
|
|
1
|
+
import { MonitorStore } from '../lib/hermes-monitor-store.ts'; import { MonitorPublisher } from './monitor-publisher.ts';
|
|
2
2
|
const terminal=(state:any)=>["completed","blocked","failed","cancelled","orphaned","done"].includes(state);
|
|
3
3
|
export function createMonitorSessionBridge(deps:any={}){const store=deps.store??new MonitorStore({now:deps.now}),pub=deps.publisher??new MonitorPublisher(store),keys=new Map(),ready=new Map(),late=new Map(),finalized=new Map(),cancellable=new Set(),waitAborts=new Map(),recovering=new Map(),monitorKeyByTask=new Map(),lateByGeneration=new Map();let currentOwner:any=deps.currentOwner??{};const runtime=deps.runtime;try{if(runtime){const restored=runtime.load().tasks??[];store.restore(restored);for(const task of restored){if(task.monitorKey){const id=`${task.id}:${task.generation}`;monitorKeyByTask.set(id,task.monitorKey);if(task.lateHistory)lateByGeneration.set(`${task.monitorKey}:${task.generation}`,task.lateHistory);const prior=keys.get(task.monitorKey);if(!prior||prior.generation<task.generation){keys.set(task.monitorKey,{id:task.id,generation:task.generation});ready.set(task.monitorKey,Promise.resolve(task));}}}}}catch(error){throw error}const persist=()=>runtime?.save({tasks:(store.durableSnapshot?.().tasks??records()).map((task:any)=>({...task,monitorKey:monitorKeyByTask.get(`${task.id}:${task.generation}`),lateHistory:lateByGeneration.get(`${monitorKeyByTask.get(`${task.id}:${task.generation}`)}:${task.generation}`)??[]}))});const records=()=>store.snapshot().tasks as any[];const lateEvent=(key:string,event:any,generation?:number)=>{generation??=keys.get(key)?.generation;const lateKey=generation===undefined?key:`${key}:${generation}`;const h=lateByGeneration.get(lateKey)??[];h.push(event);if(h.length>200)h.splice(0,h.length-200);lateByGeneration.set(lateKey,h);late.set(key,h);persist();return{state:'cancelled',history:h};};const after=(key:string,work:(v:any)=>any)=>{const pending=ready.get(key);if(!pending)return Promise.reject(new Error(`child ${key} is not registered`));const chained=pending.then(()=>{const v:any=keys.get(key);return work(v);}).then(value=>{persist();return value;});ready.set(key,chained.catch(()=>undefined));return chained;};return{
|
|
4
4
|
setCurrentOwner(owner:any){currentOwner={...owner};if(owner.updateActive){for(const task of records())if(!terminal(task.state)){if(!task.ownerSessionId)store.patch(task.id,task.generation,{ownerSessionId:owner.ownerSessionId,ownerLeaseExpiresAt:owner.ownerLeaseExpiresAt});else if(task.ownerSessionId===owner.ownerSessionId)store.patch(task.id,task.generation,{ownerLeaseExpiresAt:owner.ownerLeaseExpiresAt});}persist();}}, startParent(v:any){const task=pub.publishParent({...v,...currentOwner,generation:v.generation??1});keys.set(`parent:${task.id}`,{id:task.id,generation:task.generation});monitorKeyByTask.set(`${task.id}:${task.generation}`,`parent:${task.id}`);persist();return task},
|
|
@@ -100,7 +100,7 @@ function refusalTail(mode) {
|
|
|
100
100
|
return "Do NOT retry this call in this turn. Summarize progress so far (including " +
|
|
101
101
|
"unproven assertions and artifact paths), then ask the user whether to continue — " +
|
|
102
102
|
"the next user message starts a fresh budget window. The user can widen budgets " +
|
|
103
|
-
`with /hub-mode (current: ${mode}) or the max-*-per-turn / turn-wall-time-s keys ` +
|
|
103
|
+
`with /af-hub-mode (current: ${mode}) or the max-*-per-turn / turn-wall-time-s keys ` +
|
|
104
104
|
"in .ai/agent-fleet-overrides.md.";
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -6,6 +6,7 @@ The experimental Codex Remote-Control conductor is **not** an inbound `ask_user`
|
|
|
6
6
|
|
|
7
7
|
- The stock `pi-ask-user` extension is loaded through a capture proxy; its `ask_user` tool is not registered directly.
|
|
8
8
|
- If no live `user-remote` peer is present at call time, the wrapper calls stock `execute` with the original arguments and signal unchanged.
|
|
9
|
+
- Remote lookup follows the explicit Pi `--project <name>` flag at tool-execution time (then `pi.getFlag`, `PI_COMS_PROJECT`, and finally `default`), so a hub and bridge in the same non-default pool can race correctly even though Pi finishes CLI parsing after extension factories load.
|
|
9
10
|
- If `user-remote` is present, the wrapper races local stock UI against the remote coms request using `race-core.js`; first answer wins and local-first emits one best-effort cancel.
|
|
10
11
|
- If another extension already registered `ask_user`, registration failure is caught and logged as a warning instead of crashing the session.
|
|
11
12
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import * as fs from "node:fs";
|
|
9
9
|
import * as os from "node:os";
|
|
10
10
|
import * as path from "node:path";
|
|
11
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
11
12
|
|
|
12
13
|
import { raceAskUser } from "./race-core.js";
|
|
13
14
|
|
|
@@ -29,6 +30,7 @@ interface InstallOptions {
|
|
|
29
30
|
warn?: (message: string) => void;
|
|
30
31
|
createAbortController?: () => AbortController;
|
|
31
32
|
settingsPaths?: string[];
|
|
33
|
+
remoteProject?: string | (() => string);
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
// A stock `pi-ask-user` package listed in pi settings is loaded by pi core
|
|
@@ -99,6 +101,20 @@ function warn(pi: ExtensionLike, options: InstallOptions, message: string): void
|
|
|
99
101
|
console.warn(message);
|
|
100
102
|
}
|
|
101
103
|
|
|
104
|
+
export function resolveRemoteProject(pi: ExtensionLike, argv: string[] = process.argv): string {
|
|
105
|
+
for (let i = argv.length - 2; i >= 0; i--) {
|
|
106
|
+
if (argv[i] === "--project" && typeof argv[i + 1] === "string" && argv[i + 1].trim()) {
|
|
107
|
+
return argv[i + 1].trim();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const inlineProject = [...argv].reverse().find((arg) => arg.startsWith("--project="))?.slice("--project=".length).trim();
|
|
111
|
+
if (inlineProject) return inlineProject;
|
|
112
|
+
const cliProject = typeof pi.getFlag === "function" ? pi.getFlag("project") : undefined;
|
|
113
|
+
if (typeof cliProject === "string" && cliProject.trim()) return cliProject.trim();
|
|
114
|
+
const envProject = process.env.PI_COMS_PROJECT;
|
|
115
|
+
return envProject?.trim() || "default";
|
|
116
|
+
}
|
|
117
|
+
|
|
102
118
|
function linkAbortSignal(parent: AbortSignal | undefined, child: AbortController): void {
|
|
103
119
|
if (!parent) return;
|
|
104
120
|
if (parent.aborted) {
|
|
@@ -151,9 +167,8 @@ export function activeRemoteCount(): number {
|
|
|
151
167
|
return activeRemote.size;
|
|
152
168
|
}
|
|
153
169
|
|
|
154
|
-
async function defaultStartRemote(params: any): Promise<{ qid: string; result: Promise<any> } | null> {
|
|
170
|
+
async function defaultStartRemote(params: any, project: string): Promise<{ qid: string; result: Promise<any> } | null> {
|
|
155
171
|
const coms = await import("../../../scripts/lib/coms-envelope.ts");
|
|
156
|
-
const project = process.env.PI_COMS_PROJECT || "default";
|
|
157
172
|
const peerName = process.env.PI_ASK_USER_REMOTE_PEER || "user-remote";
|
|
158
173
|
const peer = coms.pruneDeadEntries(project).find((entry: any) => entry.name === peerName);
|
|
159
174
|
if (!peer) return null;
|
|
@@ -209,10 +224,9 @@ async function defaultStartRemote(params: any): Promise<{ qid: string; result: P
|
|
|
209
224
|
return { qid: env.msg_id, result };
|
|
210
225
|
}
|
|
211
226
|
|
|
212
|
-
async function defaultCancelRemote(qid: string, reason: string): Promise<void> {
|
|
227
|
+
async function defaultCancelRemote(qid: string, reason: string, project: string): Promise<void> {
|
|
213
228
|
try {
|
|
214
229
|
const coms = await import("../../../scripts/lib/coms-envelope.ts");
|
|
215
|
-
const project = process.env.PI_COMS_PROJECT || "default";
|
|
216
230
|
const peerName = process.env.PI_ASK_USER_REMOTE_PEER || "user-remote";
|
|
217
231
|
const peer = coms.pruneDeadEntries(project).find((entry: any) => entry.name === peerName);
|
|
218
232
|
if (peer) {
|
|
@@ -233,7 +247,9 @@ export function wrapAskUserTool(stockTool: ToolRegistration, options: InstallOpt
|
|
|
233
247
|
return {
|
|
234
248
|
...stockTool,
|
|
235
249
|
async execute(toolCallId: string, params: any, signal?: AbortSignal, onUpdate?: any, ctx?: any) {
|
|
236
|
-
const
|
|
250
|
+
const configuredProject = typeof options.remoteProject === "function" ? options.remoteProject() : options.remoteProject;
|
|
251
|
+
const remoteProject = configuredProject ?? process.env.PI_COMS_PROJECT?.trim() ?? "default";
|
|
252
|
+
const startRemote = options.startRemote ?? ((remoteParams: any) => defaultStartRemote(remoteParams, remoteProject));
|
|
237
253
|
let remoteStart: { qid: string; result: Promise<any> } | null = null;
|
|
238
254
|
try {
|
|
239
255
|
remoteStart = await startRemote(params, ctx);
|
|
@@ -248,7 +264,7 @@ export function wrapAskUserTool(stockTool: ToolRegistration, options: InstallOpt
|
|
|
248
264
|
return await raceAskUser({
|
|
249
265
|
runLocal: (localSignal: AbortSignal) => stockTool.execute?.(toolCallId, params, localSignal, onUpdate, ctx),
|
|
250
266
|
startRemote: () => remoteStart,
|
|
251
|
-
cancelRemote: options.cancelRemote ?? defaultCancelRemote,
|
|
267
|
+
cancelRemote: options.cancelRemote ?? ((qid: string, reason: string) => defaultCancelRemote(qid, reason, remoteProject)),
|
|
252
268
|
createAbortController: () => {
|
|
253
269
|
const controller = options.createAbortController?.() ?? new AbortController();
|
|
254
270
|
linkAbortSignal(signal, controller);
|
|
@@ -270,7 +286,10 @@ export function installAskUserRemote(pi: ExtensionLike, options: InstallOptions
|
|
|
270
286
|
}
|
|
271
287
|
if (!options.stockFactory) throw new Error("ask-user-remote: stockFactory is required for synchronous install");
|
|
272
288
|
const stockTool = captureAskUserTool(options.stockFactory, pi);
|
|
273
|
-
const wrapped = wrapAskUserTool(stockTool,
|
|
289
|
+
const wrapped = wrapAskUserTool(stockTool, {
|
|
290
|
+
...options,
|
|
291
|
+
remoteProject: options.remoteProject ?? (() => resolveRemoteProject(pi)),
|
|
292
|
+
});
|
|
274
293
|
try {
|
|
275
294
|
pi.registerTool(wrapped);
|
|
276
295
|
return { registered: true, tool: wrapped };
|
|
@@ -281,8 +300,17 @@ export function installAskUserRemote(pi: ExtensionLike, options: InstallOptions
|
|
|
281
300
|
}
|
|
282
301
|
}
|
|
283
302
|
|
|
303
|
+
export function resolveStockAskUserModule(moduleUrl: string = import.meta.url): string {
|
|
304
|
+
// Pi's jiti loader preserves the workspace-facing path of a symlinked
|
|
305
|
+
// harness. Canonicalize this module first so the bundled dependency is
|
|
306
|
+
// resolved beside the actual Agent Fleet package, not at workspace root.
|
|
307
|
+
const realModulePath = fs.realpathSync(fileURLToPath(moduleUrl));
|
|
308
|
+
const stockModulePath = path.resolve(path.dirname(realModulePath), "../../../node_modules/pi-ask-user/index.ts");
|
|
309
|
+
return pathToFileURL(stockModulePath).href;
|
|
310
|
+
}
|
|
311
|
+
|
|
284
312
|
async function loadStockFactory(): Promise<(pi: ExtensionLike) => void> {
|
|
285
|
-
const mod = await import(
|
|
313
|
+
const mod = await import(resolveStockAskUserModule());
|
|
286
314
|
return mod.default as (pi: ExtensionLike) => void;
|
|
287
315
|
}
|
|
288
316
|
|
|
@@ -46,7 +46,7 @@ when you are on the herdr backend.
|
|
|
46
46
|
|
|
47
47
|
## Commands & tools
|
|
48
48
|
|
|
49
|
-
- `/coms` — open the coms control surface; `--project <name>` retargets the pool (use `*` for
|
|
49
|
+
- `/af-coms` — open the coms control surface; `--project <name>` retargets the pool (use `*` for
|
|
50
50
|
every project) and `--all` toggles private (`--explicit`) peers into view
|
|
51
51
|
- `coms_list` / `coms_send` / `coms_get` / `coms_await` tools — discover peers and
|
|
52
52
|
exchange messages
|
|
@@ -67,7 +67,7 @@ Standalone `coms-cli` queues are project-scoped under `~/.pi/coms/cli/projects/<
|
|
|
67
67
|
The pool widget defines who you can reach: `coms_list` and `coms_send` resolve targets through one
|
|
68
68
|
`peersInScope()` helper, so a peer is reachable only if it is in the pool. By default the
|
|
69
69
|
pool is your own project and excludes `--explicit` peers. **Widening is a human-only action** — the
|
|
70
|
-
`coms_list` tool cannot widen scope; only `/coms --project` / `/coms --all` can. This prevents an
|
|
70
|
+
`coms_list` tool cannot widen scope; only `/af-coms --project` / `/af-coms --all` can. This prevents an
|
|
71
71
|
agent from messaging a cross-project peer that the widget never showed.
|
|
72
72
|
|
|
73
73
|
## Requires
|
|
@@ -80,11 +80,11 @@ Nothing in-repo — the peer registry lives at `~/.pi/coms/` and is created at r
|
|
|
80
80
|
pi -e .pi/harnesses/coms/index.ts
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
For a guarded coms node
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
For a guarded coms node, use `just fleet peer <name>`. It loads Fleet Core plus `coms`
|
|
84
|
+
with deterministic extension discovery. Add `--browser` for Chrome DevTools or
|
|
85
|
+
`--all-extensions` when the peer intentionally needs arbitrary project/global extensions;
|
|
86
|
+
those tools stay scoped to that process and never leak into Agent Hub's
|
|
87
|
+
`--no-extensions` specialists.
|
|
88
88
|
|
|
89
89
|
## Upstream changes
|
|
90
90
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Phase A (foundation): identity resolution, registry I/O, transport bind/send,
|
|
9
9
|
* connection handlers. Phase B: tools (coms_list/send/get/await), agent_end
|
|
10
|
-
* response capture. Phase C: live pool widget, ping + keepalive cycles, /coms
|
|
10
|
+
* response capture. Phase C: live pool widget, ping + keepalive cycles, /af-coms
|
|
11
11
|
* slash command, clean shutdown lifecycle.
|
|
12
12
|
*
|
|
13
13
|
* Usage: pi -e extensions/coms.ts
|
|
@@ -1279,7 +1279,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1279
1279
|
// Scoped to the connected pool only (peersInScope): you can reach exactly the
|
|
1280
1280
|
// peers the widget shows. Match by name first (preferred, human-facing), then by
|
|
1281
1281
|
// session_id. A peer outside the current scope is intentionally NOT resolved — the
|
|
1282
|
-
// human must widen scope via /coms --project / --all first. This closes the old
|
|
1282
|
+
// human must widen scope via /af-coms --project / --all first. This closes the old
|
|
1283
1283
|
// cross-project leak where a name match fell through to scanning every project.
|
|
1284
1284
|
const scope = peersInScope();
|
|
1285
1285
|
const byName = scope.find((e) => e.name === target);
|
|
@@ -1295,10 +1295,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
1295
1295
|
description:
|
|
1296
1296
|
"List the peer agents in your current coms pool — the ones shown in the pool widget. Returns " +
|
|
1297
1297
|
"names, models, and live context-window usage. Discovery is scoped to what the human displays " +
|
|
1298
|
-
"via /coms; you CANNOT widen it to other projects or reveal --explicit peers yourself.",
|
|
1298
|
+
"via /af-coms; you CANNOT widen it to other projects or reveal --explicit peers yourself.",
|
|
1299
1299
|
parameters: Type.Object({
|
|
1300
|
-
project: Type.Optional(Type.String({ description: "Narrow to a project WITHIN the current pool scope. Cannot widen beyond what /coms displays — a widening request is ignored." })),
|
|
1301
|
-
include_explicit: Type.Optional(Type.Boolean({ description: "Only narrows: pass false to hide explicit peers. Cannot reveal them unless the human ran /coms --all." })),
|
|
1300
|
+
project: Type.Optional(Type.String({ description: "Narrow to a project WITHIN the current pool scope. Cannot widen beyond what /af-coms displays — a widening request is ignored." })),
|
|
1301
|
+
include_explicit: Type.Optional(Type.Boolean({ description: "Only narrows: pass false to hide explicit peers. Cannot reveal them unless the human ran /af-coms --all." })),
|
|
1302
1302
|
}),
|
|
1303
1303
|
async execute(_callId, params) {
|
|
1304
1304
|
if (!identity) {
|
|
@@ -1308,9 +1308,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
1308
1308
|
};
|
|
1309
1309
|
}
|
|
1310
1310
|
// Clamp discovery to the human-set pool scope (displayProject + includeExplicit,
|
|
1311
|
-
// driven by /coms). The LLM's project/include_explicit may NARROW within that
|
|
1311
|
+
// driven by /af-coms). The LLM's project/include_explicit may NARROW within that
|
|
1312
1312
|
// scope but can never widen it — cross-project or explicit discovery requires a
|
|
1313
|
-
// deliberate /coms --project / --all from the human. So coms_list returns exactly
|
|
1313
|
+
// deliberate /af-coms --project / --all from the human. So coms_list returns exactly
|
|
1314
1314
|
// the pool, the same boundary coms_send enforces.
|
|
1315
1315
|
const scopeProject = displayProject ?? identity.project;
|
|
1316
1316
|
let projects: string[];
|
|
@@ -1322,7 +1322,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1322
1322
|
if (params.project && params.project !== scopeProject) widened = true;
|
|
1323
1323
|
}
|
|
1324
1324
|
// include_explicit may only narrow (turn OFF); it cannot reveal explicit peers
|
|
1325
|
-
// unless the human already did via /coms --all.
|
|
1325
|
+
// unless the human already did via /af-coms --all.
|
|
1326
1326
|
const includeExp = includeExplicit && params.include_explicit !== false;
|
|
1327
1327
|
if (params.include_explicit === true && !includeExplicit) widened = true;
|
|
1328
1328
|
|
|
@@ -1357,7 +1357,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1357
1357
|
const notice = widened
|
|
1358
1358
|
? `\n\n(Discovery is scoped to "${scopeProject}"${includeExplicit ? "" : ", explicit peers hidden"}. ` +
|
|
1359
1359
|
`Widening to other projects or revealing --explicit peers is a human action via ` +
|
|
1360
|
-
`/coms --project <name> or /coms --all.)`
|
|
1360
|
+
`/af-coms --project <name> or /af-coms --all.)`
|
|
1361
1361
|
: "";
|
|
1362
1362
|
|
|
1363
1363
|
const lines = agents.length === 0
|
|
@@ -1405,7 +1405,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1405
1405
|
"Use coms_get (non-blocking) or coms_await (blocking) with the msg_id to retrieve the response. " +
|
|
1406
1406
|
"Throws if the receiver is unreachable or rejects the envelope.",
|
|
1407
1407
|
parameters: Type.Object({
|
|
1408
|
-
target: Type.String({ description: "Peer name (preferred) or session_id — must be a peer currently in your coms pool (shown in the widget). Out-of-pool targets are refused; ask the human to widen scope with /coms --project or /coms --all." }),
|
|
1408
|
+
target: Type.String({ description: "Peer name (preferred) or session_id — must be a peer currently in your coms pool (shown in the widget). Out-of-pool targets are refused; ask the human to widen scope with /af-coms --project or /af-coms --all." }),
|
|
1409
1409
|
prompt: Type.String({ description: "The prompt to send." }),
|
|
1410
1410
|
conversation_id: Type.Optional(Type.String()),
|
|
1411
1411
|
response_schema: Type.Optional(Type.Any({ description: "Optional JSON Schema describing the expected response shape." })),
|
|
@@ -1423,7 +1423,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1423
1423
|
throw new Error(
|
|
1424
1424
|
`coms: no connected peer "${params.target}" in your pool (project ${scope}). ` +
|
|
1425
1425
|
`Only peers shown in the coms pool are reachable. If you expected this peer, ask the ` +
|
|
1426
|
-
`human to widen scope with /coms --project <name> or /coms --all, then retry.`,
|
|
1426
|
+
`human to widen scope with /af-coms --project <name> or /af-coms --all, then retry.`,
|
|
1427
1427
|
);
|
|
1428
1428
|
}
|
|
1429
1429
|
const hops = currentInbound ? currentInbound.hops + 1 : 0;
|
|
@@ -1690,8 +1690,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
1690
1690
|
}
|
|
1691
1691
|
});
|
|
1692
1692
|
|
|
1693
|
-
// ━━ /coms slash command ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1694
|
-
pi.registerCommand("coms", {
|
|
1693
|
+
// ━━ /af-coms slash command ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1694
|
+
pi.registerCommand("af-coms", {
|
|
1695
1695
|
description: "Force-refresh the coms pool widget (or filter with --all / --project <name>)",
|
|
1696
1696
|
handler: async (args, ctx) => {
|
|
1697
1697
|
const trimmed = (args ?? "").trim();
|
|
@@ -37,10 +37,10 @@ They apply to the **path categories only** — `zeroAccessPaths`, `readOnlyPaths
|
|
|
37
37
|
**Pre-authorize** (when you know the agent will need it):
|
|
38
38
|
|
|
39
39
|
```
|
|
40
|
-
/allow .env # exempt for the rest of the session (default)
|
|
41
|
-
/allow .env turn # exempt until the end of the current/next turn
|
|
42
|
-
/allowed # list active exemptions
|
|
43
|
-
/revoke .env # remove an exemption
|
|
40
|
+
/af-allow .env # exempt for the rest of the session (default)
|
|
41
|
+
/af-allow .env turn # exempt until the end of the current/next turn
|
|
42
|
+
/af-allowed # list active exemptions
|
|
43
|
+
/af-revoke .env # remove an exemption
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
**Block-time dialog** (when you forgot): in an interactive session a path block
|
|
@@ -60,7 +60,7 @@ timeout. At most 3 escalations per child run; denials are cached.
|
|
|
60
60
|
|
|
61
61
|
**Shared exemptions file**: agent-hub keeps one session-scoped file
|
|
62
62
|
(`~/.pi/coms/exemptions/<session>.json`, deleted on shutdown) and passes it to
|
|
63
|
-
every spawned child via `AGENT_HUB_EXEMPTIONS_FILE`. `/allow <pattern> session`
|
|
63
|
+
every spawned child via `AGENT_HUB_EXEMPTIONS_FILE`. `/af-allow <pattern> session`
|
|
64
64
|
in the hub lands there, so it covers the whole team. Every native specialist,
|
|
65
65
|
research helper, and nested delegate uses this harness and re-reads the file on
|
|
66
66
|
every block, so mid-session grants reach already-running children. Everything
|
|
@@ -69,16 +69,16 @@ outcomes) is logged to the `damage-control-log` session entries.
|
|
|
69
69
|
|
|
70
70
|
## When it's used (this repo)
|
|
71
71
|
|
|
72
|
-
`just
|
|
73
|
-
|
|
74
|
-
helper, and nested delegate**. If the harness cannot be resolved, Agent Hub
|
|
72
|
+
Every `just fleet` Pi mode loads this harness: the default interactive session,
|
|
73
|
+
standalone peers, Hub, and Herdr Pi peers. Agent Hub additionally re-loads it into
|
|
74
|
+
every native **specialist, research helper, and nested delegate**. If the harness cannot be resolved, Agent Hub
|
|
75
75
|
refuses guarded child dispatch rather than launching an unprotected process.
|
|
76
76
|
|
|
77
77
|
## Commands & tools
|
|
78
78
|
|
|
79
|
-
- `/allow <pattern> [turn|session]` — exempt a protected path pattern
|
|
80
|
-
- `/allowed` — list active exemptions
|
|
81
|
-
- `/revoke <pattern>` — remove an exemption
|
|
79
|
+
- `/af-allow <pattern> [turn|session]` — exempt a protected path pattern
|
|
80
|
+
- `/af-allowed` — list active exemptions
|
|
81
|
+
- `/af-revoke <pattern>` — remove an exemption
|
|
82
82
|
|
|
83
83
|
Blocking itself runs passively on the `tool_call` event.
|
|
84
84
|
|
|
@@ -94,12 +94,12 @@ Blocking itself runs passively on the `tool_call` event.
|
|
|
94
94
|
|
|
95
95
|
```bash
|
|
96
96
|
# standalone continue-mode guardrail session
|
|
97
|
-
just
|
|
97
|
+
just fleet
|
|
98
98
|
pi -e .pi/harnesses/damage-control-continue/index.ts
|
|
99
99
|
|
|
100
|
-
#
|
|
101
|
-
just hub
|
|
102
|
-
just hub
|
|
100
|
+
# Hub variants
|
|
101
|
+
just fleet hub
|
|
102
|
+
just fleet hub --solo
|
|
103
103
|
|
|
104
104
|
# direct continue-guarded hub launch
|
|
105
105
|
pi -e .pi/harnesses/damage-control-continue/index.ts -e .pi/harnesses/agent-hub/index.ts
|
|
@@ -111,7 +111,7 @@ pi -e .pi/harnesses/damage-control-continue/index.ts -e .pi/harnesses/agent-hub/
|
|
|
111
111
|
call were stripped (this repo does not ship pi themes).
|
|
112
112
|
- The `find` tool's `pattern` is matched against `zeroAccessPaths`, closing a gap
|
|
113
113
|
where `find` could still locate secret files.
|
|
114
|
-
- Exemption layer added (not in upstream): `/allow`/`/allowed`/`/revoke`,
|
|
114
|
+
- Exemption layer added (not in upstream): `/af-allow`/`/af-allowed`/`/af-revoke`,
|
|
115
115
|
block-time approval dialog, and escalation from headless agent-hub children to
|
|
116
116
|
the dispatcher — see the Exemptions section above. Shared plumbing lives in
|
|
117
117
|
[`../lib/damage-control-shared.ts`](../lib/damage-control-shared.ts).
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* On top of the rule engine this variant supports runtime EXEMPTIONS for the
|
|
13
13
|
* path categories (zeroAccessPaths / readOnlyPaths / noDeletePaths) — never
|
|
14
14
|
* for the destructive bashToolPatterns:
|
|
15
|
-
* - /allow <pattern> [turn|session] pre-authorizes a protected pattern
|
|
16
|
-
* (/allowed lists, /revoke removes). Session grants are mirrored into the
|
|
15
|
+
* - /af-allow <pattern> [turn|session] pre-authorizes a protected pattern
|
|
16
|
+
* (/af-allowed lists, /af-revoke removes). Session grants are mirrored into the
|
|
17
17
|
* shared exemptions file when agent-hub provides one, so spawned children
|
|
18
18
|
* inherit them.
|
|
19
19
|
* - In interactive sessions a path block opens a dialog (keep blocked /
|
|
@@ -191,8 +191,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
191
191
|
: `🛡️ Damage-Control (continue): ${total} Rules`;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
pi.registerCommand("allow", {
|
|
195
|
-
description: "Damage-control: exempt a protected path pattern — /allow <pattern> [turn|session]",
|
|
194
|
+
pi.registerCommand("af-allow", {
|
|
195
|
+
description: "Damage-control: exempt a protected path pattern — /af-allow <pattern> [turn|session]",
|
|
196
196
|
handler: async (args, ctx) => {
|
|
197
197
|
const parts = args.trim().split(/\s+/).filter(Boolean);
|
|
198
198
|
let scope: ExemptionScope = "session";
|
|
@@ -203,7 +203,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
203
203
|
}
|
|
204
204
|
const pattern = parts.join(" ");
|
|
205
205
|
if (!pattern) {
|
|
206
|
-
ctx.ui.notify("Usage: /allow <pattern> [turn|session] — e.g. /allow .env turn", "warning");
|
|
206
|
+
ctx.ui.notify("Usage: /af-allow <pattern> [turn|session] — e.g. /af-allow .env turn", "warning");
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
209
|
const already = activeExemptions().some((e) => e.pattern === pattern && (e.scope === scope || e.scope === "session"));
|
|
@@ -217,7 +217,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
217
217
|
},
|
|
218
218
|
});
|
|
219
219
|
|
|
220
|
-
pi.registerCommand("allowed", {
|
|
220
|
+
pi.registerCommand("af-allowed", {
|
|
221
221
|
description: "Damage-control: list active exemptions",
|
|
222
222
|
handler: async (_args, ctx) => {
|
|
223
223
|
const lines: string[] = [];
|
|
@@ -230,12 +230,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
230
230
|
},
|
|
231
231
|
});
|
|
232
232
|
|
|
233
|
-
pi.registerCommand("revoke", {
|
|
234
|
-
description: "Damage-control: revoke an exemption — /revoke <pattern>",
|
|
233
|
+
pi.registerCommand("af-revoke", {
|
|
234
|
+
description: "Damage-control: revoke an exemption — /af-revoke <pattern>",
|
|
235
235
|
handler: async (args, ctx) => {
|
|
236
236
|
const pattern = args.trim();
|
|
237
237
|
if (!pattern) {
|
|
238
|
-
ctx.ui.notify("Usage: /revoke <pattern>", "warning");
|
|
238
|
+
ctx.ui.notify("Usage: /af-revoke <pattern>", "warning");
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
241
|
let removed = false;
|
|
@@ -458,7 +458,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
458
458
|
}
|
|
459
459
|
const note = choice === KEEP
|
|
460
460
|
? `The user reviewed this call and kept the block in place.`
|
|
461
|
-
: `The user did not answer the approval dialog in time (auto-kept blocked). They can pre-authorize with /allow ${matchedPattern} [turn|session].`;
|
|
461
|
+
: `The user did not answer the approval dialog in time (auto-kept blocked). They can pre-authorize with /af-allow ${matchedPattern} [turn|session].`;
|
|
462
462
|
if (choice === KEEP) deniedThisTurn.add(matchedPattern);
|
|
463
463
|
ctx.ui.setStatus("damage-control", `⚠️ Last Violation: ${violationReason.slice(0, 30)}...`);
|
|
464
464
|
pi.appendEntry("damage-control-log", { tool: event.toolName, input: event.input, rule: violationReason, action: choice === KEEP ? "blocked_by_user" : "blocked_prompt_timeout" });
|
|
@@ -525,7 +525,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
525
525
|
}
|
|
526
526
|
} else {
|
|
527
527
|
const note = matchedPattern
|
|
528
|
-
? `The user can pre-authorize this path with /allow ${matchedPattern} [turn|session] in a damage-control-continue session.`
|
|
528
|
+
? `The user can pre-authorize this path with /af-allow ${matchedPattern} [turn|session] in a damage-control-continue session.`
|
|
529
529
|
: undefined;
|
|
530
530
|
ctx.ui.notify(`🛑 Damage-Control: Blocked ${event.toolName} (${violationReason}) — agent will adapt and continue.`);
|
|
531
531
|
ctx.ui.setStatus("damage-control", `⚠️ Last Violation: ${violationReason.slice(0, 30)}...`);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { herdr, subscribe, type HerdrClientOptions, type SubscribeHandle } from "./herdr-client.ts";
|
|
2
|
+
|
|
3
|
+
export interface HubCorrelation { workspaceId?: string; hubPaneId?: string; status: "correlated" | "uncorrelated" | "reconnecting"; }
|
|
4
|
+
|
|
5
|
+
export async function correlateHubPane(env: NodeJS.ProcessEnv = process.env, opts: HerdrClientOptions = {}): Promise<HubCorrelation> {
|
|
6
|
+
const hubPaneId = env.HERDR_PANE_ID;
|
|
7
|
+
if (env.HERDR_ENV !== "1" || !hubPaneId) return { status: "uncorrelated" };
|
|
8
|
+
try { const { pane } = await herdr.paneGet(hubPaneId, { socketPath: env.HERDR_SOCKET_PATH, ...opts }); return { workspaceId: pane.workspace_id, hubPaneId, status: "correlated" }; }
|
|
9
|
+
catch { return { hubPaneId, status: "reconnecting" }; }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function watchHubMonitor(options: { env?: NodeJS.ProcessEnv; onStatus: (value: HubCorrelation) => void; onOutput?: (output: { sequence: number; text: string }) => void; initialCursor?: number; reconnectDelayMs?: number }): SubscribeHandle | null {
|
|
13
|
+
const env = options.env ?? process.env;
|
|
14
|
+
const paneId = env.HERDR_PANE_ID;
|
|
15
|
+
if (env.HERDR_ENV !== "1" || !paneId) { options.onStatus({ status: "uncorrelated" }); return null; }
|
|
16
|
+
let cursor = options.initialCursor ?? 0;
|
|
17
|
+
const refresh = async () => {
|
|
18
|
+
try {
|
|
19
|
+
const { pane } = await herdr.paneGet(paneId, { socketPath: env.HERDR_SOCKET_PATH });
|
|
20
|
+
options.onStatus({ workspaceId: pane.workspace_id, hubPaneId: paneId, status: "correlated" });
|
|
21
|
+
const output = (pane as { monitor_resync_output?: { sequence?: number; text?: string } }).monitor_resync_output;
|
|
22
|
+
if (output && typeof output.sequence === "number" && output.sequence > cursor && typeof output.text === "string") { cursor = output.sequence; options.onOutput?.({ sequence: output.sequence, text: output.text }); }
|
|
23
|
+
} catch { options.onStatus({ hubPaneId: paneId, status: "reconnecting" }); }
|
|
24
|
+
};
|
|
25
|
+
void refresh();
|
|
26
|
+
let connected = false;
|
|
27
|
+
return subscribe([{ type: "pane.agent_status_changed", pane_id: paneId }], () => void refresh(), { socketPath: env.HERDR_SOCKET_PATH, reconnectDelayMs: options.reconnectDelayMs, onConnect: () => { if (connected) options.onStatus({ hubPaneId: paneId, status: "reconnecting" }); connected = true; void refresh(); }, onError: () => options.onStatus({ hubPaneId: paneId, status: "reconnecting" }) });
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type MonitorTaskState = "starting" | "running" | "cancelling" | "completed" | "blocked" | "failed" | "cancelled" | "orphaned" | "recovering";
|
|
2
|
+
export const TERMINAL_TASK_STATES = new Set<MonitorTaskState>(["completed","blocked","failed","cancelled","orphaned"]);export type MonitorTaskKind="parent"|"child";
|
|
3
|
+
export interface MonitorTask{id:string;generation:number;kind:MonitorTaskKind;state:MonitorTaskState;parentId?:string;parentGeneration?:number;hubInstanceId?:string;checkoutId?:string;specialist?:string;workspaceId?:string;hubPaneId?:string;ownerSessionId?:string;ownerLeaseExpiresAt?:string;}
|
|
4
|
+
export interface CreateParentTaskInput{id:string;generation:number;hubInstanceId:string;checkoutId:string;ownerSessionId?:string;ownerLeaseExpiresAt?:string;}
|
|
5
|
+
export interface CreateChildTaskInput{id:string;generation:number;parentId:string;parentGeneration:number;specialist:string;workspaceId?:string;hubPaneId?:string;ownerSessionId?:string;ownerLeaseExpiresAt?:string;}
|
|
6
|
+
function requireStableIdentity(id:string,generation:number){if(!id)throw Error("task id is required");if(!Number.isInteger(generation)||generation<1)throw Error("task generation must be a positive integer");}const owner=(i:any)=>({...((i.ownerSessionId)?{ownerSessionId:i.ownerSessionId}:{}),...((i.ownerLeaseExpiresAt)?{ownerLeaseExpiresAt:i.ownerLeaseExpiresAt}:{})});
|
|
7
|
+
export function createParentTask(input:CreateParentTaskInput):MonitorTask{requireStableIdentity(input.id,input.generation);if(!input.hubInstanceId||!input.checkoutId)throw Error("parent correlation is required");return{id:input.id,generation:input.generation,kind:"parent",state:"starting",hubInstanceId:input.hubInstanceId,checkoutId:input.checkoutId,...owner(input)};}
|
|
8
|
+
export function createChildTask(input:CreateChildTaskInput):MonitorTask{requireStableIdentity(input.id,input.generation);if(!input.parentId||!Number.isInteger(input.parentGeneration)||input.parentGeneration<1||!input.specialist)throw Error("child hierarchy is required");return{id:input.id,generation:input.generation,kind:"child",state:"starting",parentId:input.parentId,parentGeneration:input.parentGeneration,specialist:input.specialist,...(input.workspaceId?{workspaceId:input.workspaceId}:{}),...(input.hubPaneId?{hubPaneId:input.hubPaneId}:{}),...owner(input)};}
|
|
9
|
+
export function transitionTask(task:MonitorTask,state:MonitorTaskState):MonitorTask{if(TERMINAL_TASK_STATES.has(task.state))throw Error(`terminal task ${task.id} cannot mutate`);if(state==="starting")throw Error("tasks cannot transition back to starting");return{...task,state};}export function continueTask(task:MonitorTask):MonitorTask{if(task.state!=="blocked")throw Error(`only blocked task ${task.id} can continue`);return{...task,generation:task.generation+1,state:"starting"};}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as crypto from "node:crypto"; import * as fs from "node:fs"; import * as path from "node:path";
|
|
2
|
+
export interface MonitorRegistration {profileKey:string;namespacePath:string;socketPath:string;socketDir:string;token:string;namespaceMode:number;tokenMode:number;discoveryPath:string;snapshot():unknown;cancel?(r:{taskId:string;generation:number}):unknown|Promise<unknown>;output?(r:{taskId:string;generation:number;afterSequence:number}):unknown|Promise<unknown>;cleanup():void;renew():void;leaseMs:number;ownerId?:string;leaseExpiresAt?:string;}
|
|
3
|
+
export interface MonitorRegistryOptions {runtimeDir:string;now?:()=>Date;pid?:number;leaseMs?:number;beforeRenewPublish?:()=>void;} export interface RegisterMonitorInput {profilePath:string;profileId?:string;hubInstanceId:string;snapshot:()=>unknown;}
|
|
4
|
+
const D=0o700,F=0o600;const validDiscovery=(d:any)=>typeof d?.owner==="string"&&/^[0-9a-f-]{36}$/i.test(d.owner)&&typeof d.token==="string"&&/^token-[0-9a-f-]{36}$/i.test(d.token)&&typeof d.socket==="string"&&/^@runtime\/s\/[a-f0-9]+\/s$/.test(d.socket)&&typeof d.lease?.hub==="string"&&/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(d.lease.hub)&&Number.isInteger(d.lease?.pid)&&d.lease.pid>0&&typeof d.lease?.startedAt==="string"&&!Number.isNaN(Date.parse(d.lease.startedAt))&&typeof d.lease?.expiresAt==="string"&&!Number.isNaN(Date.parse(d.lease.expiresAt));const mode=(p:string)=>fs.statSync(p).mode&0o777;function dir(p:string){if(!path.isAbsolute(p))throw Error("monitor runtime directory must be absolute");fs.mkdirSync(p,{recursive:true,mode:D});if(fs.lstatSync(p).isSymbolicLink())throw Error("monitor runtime directory must not be a symlink");fs.chmodSync(p,D);}export function canonicalMonitorProfileId(id:string){if(!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(id)||id.includes(".."))throw Error("monitor profile id is unsafe");return crypto.createHash("sha256").update(id).digest("hex");}function profile(p:string,id?:string){if(id)return canonicalMonitorProfileId(id);const real=fs.realpathSync(p);if(!fs.statSync(real).isDirectory())throw Error("monitor profile path must be a directory");return crypto.createHash("sha256").update(real).digest("hex");}function hub(id:string){if(!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(id)||id.includes(".."))throw Error("hub instance id is unsafe");return crypto.createHash("sha256").update(id).digest("hex");}function atomic(p:string,s:string){const t=`${p}.${process.pid}.${crypto.randomBytes(4).toString("hex")}.tmp`;fs.writeFileSync(t,s,{mode:F,flag:"wx"});fs.chmodSync(t,F);fs.renameSync(t,p);}
|
|
5
|
+
export class MonitorRegistry {private runtimeDir:string;private now:()=>Date;private pid:number;private leaseMs:number;private beforeRenewPublish?:()=>void;constructor(o:MonitorRegistryOptions){this.runtimeDir=o.runtimeDir;this.now=o.now??(()=>new Date());this.pid=o.pid??process.pid;this.leaseMs=o.leaseMs??30_000;this.beforeRenewPublish=o.beforeRenewPublish;dir(this.runtimeDir);}register(input:RegisterMonitorInput):MonitorRegistration{const key=profile(input.profilePath,input.profileId),h=hub(input.hubInstanceId),ns=path.join(this.runtimeDir,key,h);dir(path.join(this.runtimeDir,key));dir(ns);for(const file of fs.readdirSync(ns).filter(x=>x.startsWith("discovery-"))){const discoveryPath=path.join(ns,file);try{const d=JSON.parse(fs.readFileSync(discoveryPath,"utf8"));if(!validDiscovery(d)||d.token!==`token-${d.owner}`||d.socket!==`@runtime/s/${crypto.createHash("sha256").update(`${key}:${h}:${d.owner}`).digest("hex").slice(0,32)}/s`)throw new Error("monitor discovery metadata is malformed");if(new Date(d.lease?.expiresAt).getTime()>this.now().getTime()){const error:any=Error("monitor namespace is owned by an active lease");error.leaseExpiresAt=d.lease.expiresAt;throw error;}const tokenName=d.token;if(typeof tokenName==="string"&&/^token-[0-9a-f-]+$/.test(tokenName))try{fs.unlinkSync(path.join(ns,tokenName))}catch(e:any){if(e?.code!=="ENOENT")throw e;}fs.unlinkSync(discoveryPath);const socket=typeof d.socket==="string"?d.socket:"";if(socket.startsWith("@runtime/s/")&&socket.endsWith("/s")){const socketDir=path.join(this.runtimeDir,socket.slice("@runtime/".length,-2));if(socketDir.startsWith(path.join(this.runtimeDir,"s")+path.sep))try{fs.rmSync(socketDir,{recursive:true,force:true})}catch{}}}catch(e:any){if(/active lease|malformed/.test(String(e)))throw e;if(e instanceof SyntaxError||e instanceof TypeError||e instanceof RangeError)throw new Error("monitor discovery metadata is malformed");}}
|
|
6
|
+
const owner=crypto.randomUUID(),socketDir=path.join(this.runtimeDir,"s",crypto.createHash("sha256").update(`${key}:${h}:${owner}`).digest("hex").slice(0,32));dir(socketDir);const tokenPath=path.join(ns,`token-${owner}`),discoveryPath=path.join(ns,`discovery-${owner}.json`),socketPath=path.join(socketDir,"s"),token=crypto.randomBytes(32).toString("hex"),started=this.now();atomic(tokenPath,token);const tokenFd=fs.openSync(tokenPath,"r");const write=(issued:Date)=>atomic(discoveryPath,JSON.stringify({owner,socket:`@runtime/s/${path.basename(socketDir)}/s`,token:path.basename(tokenPath),lease:{hub:input.hubInstanceId,pid:this.pid,startedAt:started.toISOString(),expiresAt:new Date(issued.getTime()+this.leaseMs).toISOString()}}));write(started);const owns=()=>{try{return fs.fstatSync(tokenFd).nlink===1&&fs.readFileSync(tokenPath,"utf8")===token&&JSON.parse(fs.readFileSync(discoveryPath,"utf8")).owner===owner;}catch{return false;}};const cleanup=()=>{if(!owns())return;for(const p of [tokenPath,discoveryPath])try{fs.unlinkSync(p)}catch(e:any){if(e?.code!=="ENOENT")throw e;}finally{try{fs.closeSync(tokenFd)}catch{}}};return{profileKey:key,ownerId:owner,leaseExpiresAt:new Date(started.getTime()+this.leaseMs).toISOString(),namespacePath:ns,socketPath,socketDir,token,namespaceMode:mode(ns),tokenMode:mode(tokenPath),discoveryPath,snapshot:input.snapshot,cleanup,renew:()=>{if(!owns())throw Error("monitor ownership lost");this.beforeRenewPublish?.();if(!owns())throw Error("monitor ownership lost");const renewedAt=this.now();write(renewedAt);if(!owns()){try{if(JSON.parse(fs.readFileSync(discoveryPath,"utf8")).owner===owner)fs.unlinkSync(discoveryPath)}catch{}throw Error("monitor ownership lost");}return{leaseExpiresAt:new Date(renewedAt.getTime()+this.leaseMs).toISOString()};},leaseMs:this.leaseMs};} evidenceForOwner(ownerId:string,hubInstanceId:string){try{if(!/^[0-9a-f-]{36}$/i.test(ownerId))throw Error("malformed");const h=hub(hubInstanceId);for(const profileKey of fs.readdirSync(this.runtimeDir)){const p=path.join(this.runtimeDir,profileKey,h,`discovery-${ownerId}.json`);if(!fs.existsSync(p))continue;const d=JSON.parse(fs.readFileSync(p,"utf8"));if(!validDiscovery(d)||d.owner!==ownerId||d.token!==`token-${ownerId}`)throw Error("malformed");const token=path.join(path.dirname(p),d.token),socket=path.join(this.runtimeDir,d.socket.slice("@runtime/".length));return{owner:fs.existsSync(token),socket:fs.existsSync(socket),session:fs.existsSync(token),expired:new Date(d.lease.expiresAt).getTime()<=this.now().getTime()};}return{owner:false,socket:false,session:false,expired:true};}catch(error){return{transient:true,error};}}}
|