@chankov/agent-fleet 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/extensions/pi-voice-stt/README.md +24 -5
- package/.pi/extensions/pi-voice-stt/examples/stt.json +4 -4
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/return-contract.js +34 -0
- package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +80 -18
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.10/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/coms-claude-bridge.ts +411 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/fleet.ts +216 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/flow.ts +137 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +210 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/flow-command.ts +93 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +133 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-scout.ts +38 -0
- package/.versions/2.0.10/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.10/.pi/agents/model-profiles.yaml +83 -0
- package/.versions/2.0.10/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.10/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.10/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.10/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.10/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.10/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.10/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.10/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.10/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.10/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.10/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.10/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.10/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.10/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.10/.pi/extensions/package.json +9 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/README.md +1217 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/acceptance.ts +62 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/budget-recovery.ts +97 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/context.ts +43 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/config/agents.ts +177 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/config/model-profiles.ts +216 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/config/overrides.ts +153 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +213 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context/budgets.ts +202 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context-window.js +106 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/delegate.ts +446 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-coms.ts +237 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native-complete.ts +154 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +156 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +193 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native-types.ts +230 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native.ts +213 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/docs-lane.js +122 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/drift-watchdog.js +218 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/fixtures/registration-surface.json +57 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/helpers.ts +266 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/hub-state-audit.js +64 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/index.ts +2132 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/input/completions.ts +76 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +123 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/no-progress.ts +76 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/work-mode.ts +119 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/prompts/context.ts +47 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/prompts/fragments.ts +115 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/prompts/system-prompt.ts +112 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/research/runtime.ts +192 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/research/spawn-run.ts +156 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/return-contract.js +327 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/return-extract.js +75 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/review-findings.js +102 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/run-budget.js +537 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/run-namespace.js +87 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/scope-gate.js +123 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/spawn.ts +404 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/timeline.ts +54 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/action-executors.ts +149 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/context.ts +134 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +82 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +335 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/herdr-executors.ts +86 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/set-task-tier.ts +29 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/spawn-research.ts +62 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/verification-contract.ts +77 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/types.ts +63 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/activity-dots.ts +16 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/context-budget.ts +86 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/detail-panel.ts +178 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/fleet-actions.ts +76 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +99 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/fleet-source.ts +157 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/grid.ts +154 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/zoom.ts +204 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/work-mode.ts +167 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/runtime-ask.ts +43 -0
- package/.versions/2.0.10/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.10/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.10/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.10/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.10/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.10/.pi/harnesses/damage-control-continue/index.ts +541 -0
- package/.versions/2.0.10/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.10/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.10/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.10/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.10/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.10/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.10/.pi/harnesses/lib/context-budget-child-prompt.ts +180 -0
- package/.versions/2.0.10/.pi/harnesses/lib/context-budget-hub-prompt.ts +114 -0
- package/.versions/2.0.10/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.10/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.10/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-dashboard-view.ts +134 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-detail-view.ts +247 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-read-model.ts +213 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-strip-controller.ts +74 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-strip-view.ts +132 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.10/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.10/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.10/.pi/harnesses/lib/spawned-peers.js +190 -0
- package/.versions/2.0.10/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.10/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.10/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.10/.pi/prompts/af-build.md +24 -0
- package/.versions/2.0.10/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.10/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.10/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.10/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.10/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.10/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.10/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.10/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.10/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.10/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.10/.version +1 -0
- package/.versions/2.0.10/agents/architect.md +25 -0
- package/.versions/2.0.10/agents/bowser.md +28 -0
- package/.versions/2.0.10/agents/builder.md +56 -0
- package/.versions/2.0.10/agents/code-reviewer.md +210 -0
- package/.versions/2.0.10/agents/deep-researcher.md +33 -0
- package/.versions/2.0.10/agents/documenter.md +23 -0
- package/.versions/2.0.10/agents/orchestrator.md +23 -0
- package/.versions/2.0.10/agents/plan-reviewer.md +84 -0
- package/.versions/2.0.10/agents/planner.md +106 -0
- package/.versions/2.0.10/agents/releaser.md +25 -0
- package/.versions/2.0.10/agents/researcher.md +31 -0
- package/.versions/2.0.10/agents/security-auditor.md +168 -0
- package/.versions/2.0.10/agents/test-engineer.md +154 -0
- package/.versions/2.0.10/agents/web-debugger.md +44 -0
- package/.versions/2.0.10/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.10/bin/catalog/harness-runtime-closure.json +32 -0
- package/.versions/2.0.10/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.10/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.10/docs/ARCHITECTURE.md +416 -0
- package/.versions/2.0.10/docs/agent-fleet-setup.md +586 -0
- package/.versions/2.0.10/docs/claude-code-coms-bridge.md +134 -0
- package/.versions/2.0.10/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.10/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.10/docs/getting-started.md +126 -0
- package/.versions/2.0.10/docs/npm-install.md +383 -0
- package/.versions/2.0.10/docs/pi-extensions.md +449 -0
- package/.versions/2.0.10/docs/pi-setup.md +92 -0
- package/.versions/2.0.10/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.10/install-manifest.json +2991 -0
- package/.versions/2.0.10/justfile +247 -0
- package/.versions/2.0.10/manifest-meta.json +970 -0
- package/.versions/2.0.10/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.10/references/communication-contract.md +26 -0
- package/.versions/2.0.10/references/definition-of-done.md +67 -0
- package/.versions/2.0.10/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.10/references/observability-checklist.md +92 -0
- package/.versions/2.0.10/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.10/references/performance-checklist.md +236 -0
- package/.versions/2.0.10/references/prompting-patterns.md +380 -0
- package/.versions/2.0.10/references/security-checklist.md +245 -0
- package/.versions/2.0.10/references/testing-patterns.md +235 -0
- package/.versions/2.0.10/references/workflow-authoring.md +304 -0
- package/.versions/2.0.10/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.10/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.10/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.10/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.10/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.10/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.10/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.10/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.10/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.10/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.10/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.10/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.10/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.10/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.10/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.10/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.10/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.10/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.10/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.10/skills/incremental-implementation/SKILL.md +302 -0
- package/.versions/2.0.10/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.10/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.10/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.10/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.10/skills/planning-and-task-breakdown/SKILL.md +289 -0
- package/.versions/2.0.10/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.10/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.10/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +11 -0
- package/agents/architect.md +1 -1
- package/agents/bowser.md +1 -1
- package/agents/builder.md +1 -1
- package/agents/code-reviewer.md +1 -1
- package/agents/deep-researcher.md +1 -1
- package/agents/documenter.md +1 -1
- package/agents/orchestrator.md +1 -1
- package/agents/plan-reviewer.md +1 -1
- package/agents/planner.md +1 -1
- package/agents/releaser.md +1 -1
- package/agents/researcher.md +1 -1
- package/agents/security-auditor.md +1 -1
- package/agents/test-engineer.md +1 -1
- package/agents/web-debugger.md +1 -1
- package/agents/web-performance-auditor.md +1 -1
- package/bin/cli.js +8 -5
- package/bin/lib/path-boundaries.js +5 -6
- package/bin/lib/stt-wizard.js +154 -23
- package/docs/agent-fleet-setup.md +26 -8
- package/docs/npm-install.md +29 -2
- package/docs/pi-setup.md +16 -0
- package/install-manifest.json +1 -1
- package/package.json +13 -3
- package/skills/orchestration-verification/SKILL.md +1 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two variables that decide whether a hub is monitored at all.
|
|
3
|
+
*
|
|
4
|
+
* `monitorLifecycleConfig()` (.pi/harnesses/agent-hub/monitor-lifecycle.ts)
|
|
5
|
+
* returns `null` unless BOTH `AGENT_FLEET_PROFILE_ID` and an absolute
|
|
6
|
+
* `AGENT_FLEET_MONITOR_RUNTIME_DIR` are in the hub's environment. Until this
|
|
7
|
+
* module existed the only thing that set them was a manual `export` copied out
|
|
8
|
+
* of .pi/agent-fleet/hermes/README.md, so in practice the monitor never started and its whole
|
|
9
|
+
* transport — task tree, live output, per-generation cancel — was dead code
|
|
10
|
+
* with a test suite.
|
|
11
|
+
*
|
|
12
|
+
* Two rules the rest of the file exists to hold:
|
|
13
|
+
*
|
|
14
|
+
* 1. An operator who already exported the variables wins. This never
|
|
15
|
+
* overwrites a value that is already set, so the README recipe and a
|
|
16
|
+
* systemd unit keep working exactly as documented.
|
|
17
|
+
* 2. A runtime directory we cannot make private is not used. The Python
|
|
18
|
+
* reader refuses any root that is not mode 0700 (adapter.py), and it is
|
|
19
|
+
* right to: the directory holds one bearer token per live hub. Rather
|
|
20
|
+
* than hand it a path it will reject, `resolveMonitorEnv` returns null
|
|
21
|
+
* and the hub runs unmonitored — the pre-existing behaviour, reached
|
|
22
|
+
* honestly.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import * as fs from "node:fs";
|
|
26
|
+
import * as os from "node:os";
|
|
27
|
+
import * as path from "node:path";
|
|
28
|
+
|
|
29
|
+
/** Mirrors the profile-ID class in monitor-lifecycle.ts and adapter.py. All
|
|
30
|
+
* three must agree, because the runtime namespace is `sha256(profileId)` and a
|
|
31
|
+
* value one end accepts and another rejects is an empty directory listing with
|
|
32
|
+
* no error anywhere. */
|
|
33
|
+
export const PROFILE_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
34
|
+
|
|
35
|
+
/** The Hermes profile the fleet plugins are installed in. `dev` rather than
|
|
36
|
+
* `default` by the 2026-07-27 decision recorded in the observability plan —
|
|
37
|
+
* the panel is a dev-profile tool, and the monitor has to land in the same
|
|
38
|
+
* profile or the discovery glob looks in the wrong namespace. */
|
|
39
|
+
export const DEFAULT_PROFILE_ID = "dev";
|
|
40
|
+
|
|
41
|
+
export const RUNTIME_DIR_NAME = "agent-fleet-monitor";
|
|
42
|
+
export const MAX_MONITOR_SOCKET_PATH_BYTES = 103;
|
|
43
|
+
|
|
44
|
+
const SOCKET_NAMESPACE_BYTES = 32;
|
|
45
|
+
|
|
46
|
+
function monitorSocketPathFits(runtimeDir: string): boolean {
|
|
47
|
+
const longestSocketPath = path.join(runtimeDir, "s", "a".repeat(SOCKET_NAMESPACE_BYTES), "s");
|
|
48
|
+
return Buffer.byteLength(longestSocketPath) <= MAX_MONITOR_SOCKET_PATH_BYTES;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface MonitorEnv {
|
|
52
|
+
AGENT_FLEET_PROFILE_ID: string;
|
|
53
|
+
AGENT_FLEET_MONITOR_RUNTIME_DIR: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Where the runtime root goes, before anything is created.
|
|
57
|
+
*
|
|
58
|
+
* `XDG_RUNTIME_DIR` is the right answer and the one the README documents: it
|
|
59
|
+
* is already per-user, already 0700, and already cleaned up at logout. The
|
|
60
|
+
* tmpdir fallback exists for the sessions that have no such variable (a bare
|
|
61
|
+
* ssh login, a container), and carries the uid in its name so two users on one
|
|
62
|
+
* machine never race for the same path. */
|
|
63
|
+
export function monitorRuntimeRoot(env: NodeJS.ProcessEnv = process.env): string {
|
|
64
|
+
const xdg = env.XDG_RUNTIME_DIR;
|
|
65
|
+
if (xdg && path.isAbsolute(xdg)) return path.join(xdg, RUNTIME_DIR_NAME);
|
|
66
|
+
const uid = typeof process.getuid === "function" ? process.getuid() : 0;
|
|
67
|
+
|
|
68
|
+
return path.join(socketTempRoot(), `${RUNTIME_DIR_NAME}-${uid}`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** A temp root short enough to still hold a unix socket path underneath it.
|
|
72
|
+
*
|
|
73
|
+
* macOS gives each process a long /var/folders/... temp path. Adding the
|
|
74
|
+
* monitor's 32-byte namespace to it exceeds sockaddr_un.sun_path (104 bytes,
|
|
75
|
+
* including its terminator), so libuv binds a truncated name that chmod cannot
|
|
76
|
+
* find. The child under /tmp is still created and verified mode 0700.
|
|
77
|
+
*
|
|
78
|
+
* Exported because every test that binds a unix socket needs its fixture root
|
|
79
|
+
* built the same way — the monitor's, and ask-user-remote's per-question coms
|
|
80
|
+
* endpoints. Reaching for `os.tmpdir()` directly contradicts this rule and the
|
|
81
|
+
* failure does not look like a path-length problem from the test: the bind
|
|
82
|
+
* half-succeeds at a truncated name, so the chmod that follows throws ENOENT
|
|
83
|
+
* out of an already-listening handle and the process never exits. */
|
|
84
|
+
export function socketTempRoot(): string {
|
|
85
|
+
return process.platform === "darwin" ? "/tmp" : os.tmpdir();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Create the runtime root 0700, or say why it cannot be trusted.
|
|
89
|
+
*
|
|
90
|
+
* The mode is re-asserted on a directory that already exists because the
|
|
91
|
+
* `mode` argument to mkdir is a no-op for an existing path and is masked by
|
|
92
|
+
* umask for a new one — checking after the fact is the only way to know. A
|
|
93
|
+
* symlink is refused outright rather than followed: the whole point of the
|
|
94
|
+
* directory is that its contents are only reachable by this user, and a
|
|
95
|
+
* symlink means somebody else chose the destination. */
|
|
96
|
+
export function ensureMonitorRuntimeDir(dir: string, io: {
|
|
97
|
+
mkdirSync?: typeof fs.mkdirSync;
|
|
98
|
+
lstatSync?: typeof fs.lstatSync;
|
|
99
|
+
chmodSync?: typeof fs.chmodSync;
|
|
100
|
+
} = {}): string | null {
|
|
101
|
+
const mkdir = io.mkdirSync ?? fs.mkdirSync;
|
|
102
|
+
const lstat = io.lstatSync ?? fs.lstatSync;
|
|
103
|
+
const chmod = io.chmodSync ?? fs.chmodSync;
|
|
104
|
+
if (!path.isAbsolute(dir)) return null;
|
|
105
|
+
try {
|
|
106
|
+
mkdir(dir, { recursive: true, mode: 0o700 });
|
|
107
|
+
const stat = lstat(dir);
|
|
108
|
+
if (stat.isSymbolicLink() || !stat.isDirectory()) return null;
|
|
109
|
+
if ((stat.mode & 0o777) !== 0o700) {
|
|
110
|
+
chmod(dir, 0o700);
|
|
111
|
+
if ((lstat(dir).mode & 0o777) !== 0o700) return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return dir;
|
|
115
|
+
} catch {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** The variables to add to a hub's environment, or null to leave it unmonitored.
|
|
121
|
+
*
|
|
122
|
+
* Null is a normal outcome, not a failure: `AGENT_FLEET_MONITOR=0` is the
|
|
123
|
+
* documented opt-out, and an unusable runtime directory reaches the same
|
|
124
|
+
* result. Callers merge the answer and carry on either way — a hub that
|
|
125
|
+
* cannot be monitored still orchestrates. */
|
|
126
|
+
export function resolveMonitorEnv(
|
|
127
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
128
|
+
ensure: (dir: string) => string | null = ensureMonitorRuntimeDir,
|
|
129
|
+
): MonitorEnv | null {
|
|
130
|
+
if (env.AGENT_FLEET_MONITOR === "0") return null;
|
|
131
|
+
|
|
132
|
+
const profileId = env.AGENT_FLEET_PROFILE_ID?.trim() || DEFAULT_PROFILE_ID;
|
|
133
|
+
if (!PROFILE_ID_RE.test(profileId) || profileId.includes("..")) return null;
|
|
134
|
+
|
|
135
|
+
const requested = env.AGENT_FLEET_MONITOR_RUNTIME_DIR?.trim();
|
|
136
|
+
// An explicit path is honoured as given — including a rejection, which is
|
|
137
|
+
// louder than silently relocating somebody's deliberate choice.
|
|
138
|
+
const root = requested ? (path.isAbsolute(requested) ? requested : null) : monitorRuntimeRoot(env);
|
|
139
|
+
if (!root) return null;
|
|
140
|
+
if (!monitorSocketPathFits(root)) return null;
|
|
141
|
+
|
|
142
|
+
const runtimeDir = ensure(root);
|
|
143
|
+
if (!runtimeDir) return null;
|
|
144
|
+
|
|
145
|
+
return { AGENT_FLEET_PROFILE_ID: profileId, AGENT_FLEET_MONITOR_RUNTIME_DIR: runtimeDir };
|
|
146
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
// .pi/agent-fleet/scripts/lib/peer-launch.ts
|
|
2
|
+
//
|
|
3
|
+
// Pure logic for `just fleet peer <name>` — ONE addressable coms peer, in its
|
|
4
|
+
// own herdr pane by default, with no peers.yaml team involved.
|
|
5
|
+
//
|
|
6
|
+
// One verb, three shapes of peer, two placements:
|
|
7
|
+
//
|
|
8
|
+
// runner: claude-code → `just _claude-peer …` (Claude + its coms bridge)
|
|
9
|
+
// runner: pi, persona resolved → `just _peer[-plus] …` (guarded reusable persona peer)
|
|
10
|
+
// runner: pi, no persona → `just _fleet-peer …` (Fleet Core + coms, no persona)
|
|
11
|
+
//
|
|
12
|
+
// default → the command runs in a pane of its own
|
|
13
|
+
// --here → the command takes over the CALLING terminal
|
|
14
|
+
//
|
|
15
|
+
// The third shape is what `just fleet peer <name>` meant before pane placement
|
|
16
|
+
// existed, so `--here` reproduces the old behavior exactly while the same
|
|
17
|
+
// invocation without it now opens a pane.
|
|
18
|
+
//
|
|
19
|
+
// Resolution order for every field: explicit CLI flag → the peers.yaml
|
|
20
|
+
// declaration for that NAME (searched across all teams, see findPeerByName) →
|
|
21
|
+
// a convention default. So `just fleet peer code-reviewer` gets the
|
|
22
|
+
// `runner: claude-code` the fleet declares, and `--runner claude-code` needs no
|
|
23
|
+
// manifest entry at all.
|
|
24
|
+
//
|
|
25
|
+
// No sockets, no process.exit, no fs — callers supply the manifest text and a
|
|
26
|
+
// persona-existence probe, and every failure is a plain Error.
|
|
27
|
+
|
|
28
|
+
import { findPeerByName, parsePeersYaml, peerCommand, type Peer } from "./herdr-layout.ts";
|
|
29
|
+
import { DEFAULT_PROJECT, teamWorkspaceLabel, validateProject } from "./team-project.ts";
|
|
30
|
+
|
|
31
|
+
/** Synthetic team name used in peerCommand errors for a peer that has no team. */
|
|
32
|
+
export const ADHOC_TEAM = "ad-hoc";
|
|
33
|
+
|
|
34
|
+
/** The extension `--browser` adds to a pi persona peer (the `_peer-plus` route). */
|
|
35
|
+
export const BROWSER_EXTENSION = "chrome-devtools-mcp";
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Pane label + coms identity charset. Stricter than herdr-layout's SAFE, which
|
|
39
|
+
* also permits `.`, `/` and `,` — fine inside a model spec, wrong for a name
|
|
40
|
+
* that becomes a pane label, a workspace label segment, and a coms address.
|
|
41
|
+
*/
|
|
42
|
+
export const PEER_NAME_SAFE = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
43
|
+
|
|
44
|
+
export type PeerRunner = "pi" | "claude-code";
|
|
45
|
+
/** Which hidden recipe launches this peer — see the header table. */
|
|
46
|
+
export type PeerKind = "persona-peer" | "core-peer" | "claude-peer";
|
|
47
|
+
|
|
48
|
+
export interface PeerLaunchOptions {
|
|
49
|
+
name: string;
|
|
50
|
+
/** --runner; omit to inherit the peers.yaml declaration, else defaults to pi. */
|
|
51
|
+
runner?: string;
|
|
52
|
+
/** --persona; omit to inherit the declaration, else the same-named persona. */
|
|
53
|
+
persona?: string;
|
|
54
|
+
/**
|
|
55
|
+
* --no-persona: force the identity-only Fleet Core peer even when the name
|
|
56
|
+
* resolves to a persona. The escape hatch for raw pi arguments and
|
|
57
|
+
* --all-extensions under a name that happens to match a persona file.
|
|
58
|
+
*/
|
|
59
|
+
noPersona?: boolean;
|
|
60
|
+
model?: string;
|
|
61
|
+
project?: string;
|
|
62
|
+
extensions?: string;
|
|
63
|
+
/** --browser: an extra extension for a persona peer, a capability flag for a core peer. */
|
|
64
|
+
browser?: boolean;
|
|
65
|
+
/** --all-extensions: core peers only — persona peers are deliberately deterministic. */
|
|
66
|
+
allExtensions?: boolean;
|
|
67
|
+
/** Raw pi arguments after `--`; core peers only. */
|
|
68
|
+
piArgs?: string[];
|
|
69
|
+
direction?: "right" | "down";
|
|
70
|
+
/** --here: run in the calling terminal instead of a pane. */
|
|
71
|
+
here?: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface PeerLaunchContext {
|
|
75
|
+
/** Raw .pi/agents/peers.yaml, or "" when the repo has none. */
|
|
76
|
+
peersYaml: string;
|
|
77
|
+
/** True when `agents/<persona>.md` or `.pi/agents/<persona>.md` exists. */
|
|
78
|
+
personaExists(persona: string): boolean;
|
|
79
|
+
/** worktreeTag(REPO_ROOT) — scopes the standalone workspace label. */
|
|
80
|
+
worktreeTag: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface PeerLaunchPlan {
|
|
84
|
+
name: string;
|
|
85
|
+
runner: PeerRunner;
|
|
86
|
+
kind: PeerKind;
|
|
87
|
+
persona?: string;
|
|
88
|
+
model?: string;
|
|
89
|
+
extensions?: string;
|
|
90
|
+
/** Repo-relative env_file inherited from the declaration, if any. */
|
|
91
|
+
envFile?: string;
|
|
92
|
+
project: string;
|
|
93
|
+
/** argv for the pane (or for this terminal under --here). */
|
|
94
|
+
command: string[];
|
|
95
|
+
placement: "pane" | "here";
|
|
96
|
+
direction: "right" | "down";
|
|
97
|
+
/** Workspace label used only when launching a pane outside a herdr pane. */
|
|
98
|
+
workspaceLabel: string;
|
|
99
|
+
/** True when peers.yaml declares this name (its fields seeded the plan). */
|
|
100
|
+
declared: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function validateName(name: string): string {
|
|
104
|
+
if (!PEER_NAME_SAFE.test(name)) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
`Invalid peer name: ${JSON.stringify(name)} (letters, numbers, underscores and hyphens; must start alphanumeric)`,
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return name;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function normalizeRunner(runner: string | undefined, source: string): PeerRunner | undefined {
|
|
113
|
+
if (runner === undefined) return undefined;
|
|
114
|
+
if (runner === "pi" || runner === "claude-code") return runner;
|
|
115
|
+
throw new Error(`Unknown runner ${JSON.stringify(runner)} from ${source} (supported: pi, claude-code)`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function mergeExtensions(...values: (string | undefined)[]): string | undefined {
|
|
119
|
+
const names = values
|
|
120
|
+
.flatMap((v) => (v ?? "").split(","))
|
|
121
|
+
.map((v) => v.trim())
|
|
122
|
+
.filter((v) => v !== "");
|
|
123
|
+
return names.length > 0 ? [...new Set(names)].join(",") : undefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The pre-pane-placement `just fleet peer <name>` command: Fleet Core + coms
|
|
128
|
+
* under the given identity, with no persona and arbitrary pi arguments. Its
|
|
129
|
+
* positionals are `<name> <browser> <all_extensions>` followed by raw pi args,
|
|
130
|
+
* so `--project` travels as an ordinary pi flag rather than a placeholder slot.
|
|
131
|
+
*/
|
|
132
|
+
function corePeerCommand(name: string, opts: PeerLaunchOptions, project: string, model?: string): string[] {
|
|
133
|
+
const command = ["just", "_fleet-peer", name, opts.browser ? "true" : "false", opts.allExtensions ? "true" : "false"];
|
|
134
|
+
if (model !== undefined) {
|
|
135
|
+
if (/[\r\n]/.test(model)) throw new Error(`model contains a line break: ${JSON.stringify(model)}`);
|
|
136
|
+
command.push("--model", model);
|
|
137
|
+
}
|
|
138
|
+
if (project !== DEFAULT_PROJECT) command.push("--project", project);
|
|
139
|
+
for (const arg of opts.piArgs ?? []) {
|
|
140
|
+
// A pane launch types this argv at a shell prompt one line at a time, so
|
|
141
|
+
// an embedded newline would execute half of it as a separate command.
|
|
142
|
+
if (/[\r\n]/.test(arg)) throw new Error(`pi argument contains a line break: ${JSON.stringify(arg)}`);
|
|
143
|
+
command.push(arg);
|
|
144
|
+
}
|
|
145
|
+
return command;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Merge CLI options with the peers.yaml declaration for the same name and
|
|
150
|
+
* produce the launch argv. Nothing is silently dropped: a flag that cannot
|
|
151
|
+
* apply to the resolved runner is an error, not a no-op.
|
|
152
|
+
*/
|
|
153
|
+
export function buildPeerLaunchPlan(opts: PeerLaunchOptions, ctx: PeerLaunchContext): PeerLaunchPlan {
|
|
154
|
+
const name = validateName(opts.name);
|
|
155
|
+
const project = validateProject(opts.project ?? DEFAULT_PROJECT);
|
|
156
|
+
const teams = ctx.peersYaml ? parsePeersYaml(ctx.peersYaml) : {};
|
|
157
|
+
const declared: Peer | undefined = findPeerByName(teams, name);
|
|
158
|
+
|
|
159
|
+
const runner =
|
|
160
|
+
normalizeRunner(opts.runner, "--runner") ??
|
|
161
|
+
normalizeRunner(declared?.runner, `peers.yaml peer "${name}"`) ??
|
|
162
|
+
"pi";
|
|
163
|
+
|
|
164
|
+
const model = opts.model ?? declared?.model;
|
|
165
|
+
const common = {
|
|
166
|
+
name,
|
|
167
|
+
runner,
|
|
168
|
+
...(model ? { model } : {}),
|
|
169
|
+
...(declared?.env_file ? { envFile: declared.env_file } : {}),
|
|
170
|
+
project,
|
|
171
|
+
placement: (opts.here ? "here" : "pane") as "here" | "pane",
|
|
172
|
+
direction: opts.direction ?? ("right" as const),
|
|
173
|
+
workspaceLabel: teamWorkspaceLabel("peer", name, project, ctx.worktreeTag),
|
|
174
|
+
declared: declared !== undefined,
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
if (runner === "claude-code") {
|
|
178
|
+
if (opts.persona) throw new Error("--persona is pi-only; a claude-code peer carries no pi persona.");
|
|
179
|
+
if (opts.extensions || opts.browser || opts.allExtensions) {
|
|
180
|
+
throw new Error("--extensions/--browser/--all-extensions are pi-only and cannot combine with --runner claude-code.");
|
|
181
|
+
}
|
|
182
|
+
if (opts.piArgs?.length) throw new Error("arguments after `--` are pi arguments and cannot combine with --runner claude-code.");
|
|
183
|
+
return {
|
|
184
|
+
...common,
|
|
185
|
+
kind: "claude-peer",
|
|
186
|
+
command: peerCommand({ name, ...(model ? { model } : {}), runner }, ADHOC_TEAM, undefined, project),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (opts.noPersona && opts.persona) throw new Error("--no-persona and --persona are contradictory.");
|
|
191
|
+
const persona = opts.noPersona
|
|
192
|
+
? undefined
|
|
193
|
+
: opts.persona ?? declared?.persona ?? (ctx.personaExists(name) ? name : undefined);
|
|
194
|
+
|
|
195
|
+
// No persona anywhere → the identity-only Fleet Core peer, which is exactly
|
|
196
|
+
// what this command did before pane placement existed. Not an error: it is
|
|
197
|
+
// the third shape of peer, and the only one that takes raw pi arguments.
|
|
198
|
+
if (!persona) {
|
|
199
|
+
if (opts.extensions) {
|
|
200
|
+
throw new Error(
|
|
201
|
+
`--extensions needs a persona peer. Pass --persona <name>, add .pi/agents/personas/${name}.md, ` +
|
|
202
|
+
"or use --all-extensions / raw pi flags after `--`.",
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
return { ...common, kind: "core-peer", command: corePeerCommand(name, opts, project, model) };
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!ctx.personaExists(persona)) throw new Error(`Persona "${persona}" not found under agents/ or .pi/agents/.`);
|
|
209
|
+
if (opts.allExtensions) {
|
|
210
|
+
throw new Error(
|
|
211
|
+
`--all-extensions is not available to persona peer "${name}": reusable peers load a deterministic set. ` +
|
|
212
|
+
"Use --extensions <names>, declare extensions: in .pi/agents/peers.yaml, or --no-persona for a plain Fleet Core peer.",
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
if (opts.piArgs?.length) {
|
|
216
|
+
throw new Error(
|
|
217
|
+
`arguments after \`--\` need a personaless core peer; persona peer "${name}" builds its own pi command line. ` +
|
|
218
|
+
`Add --no-persona to launch "${name}" as a plain Fleet Core peer instead.`,
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
const extensions = mergeExtensions(opts.extensions ?? declared?.extensions, opts.browser ? BROWSER_EXTENSION : undefined);
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
...common,
|
|
225
|
+
kind: "persona-peer",
|
|
226
|
+
persona,
|
|
227
|
+
...(extensions ? { extensions } : {}),
|
|
228
|
+
command: peerCommand(
|
|
229
|
+
{ name, persona, ...(model ? { model } : {}), ...(extensions ? { extensions } : {}) },
|
|
230
|
+
ADHOC_TEAM,
|
|
231
|
+
undefined,
|
|
232
|
+
project,
|
|
233
|
+
),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface ParsedPeerArgs extends PeerLaunchOptions {
|
|
238
|
+
dryRun: boolean;
|
|
239
|
+
/** --peers: alternate manifest path (tests use it). */
|
|
240
|
+
peersYaml?: string;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function takeValue(argv: string[], i: number, flag: string): string {
|
|
244
|
+
const value = argv[i + 1];
|
|
245
|
+
if (value === undefined || value.startsWith("--")) throw new Error(`${flag} requires a value`);
|
|
246
|
+
return value;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* `<name> [--runner r] [--persona p|--no-persona] [--model m] [--project p]
|
|
251
|
+
* [--extensions a,b] [--browser] [--all-extensions] [--direction right|down]
|
|
252
|
+
* [--here] [--dry-run] [--peers path] [-- PI_ARGS…]`
|
|
253
|
+
*
|
|
254
|
+
* The peer name is the only positional and everything after `--` goes to pi
|
|
255
|
+
* verbatim. An unrecognized flag BEFORE `--` is an error rather than silently
|
|
256
|
+
* dropped argv — the failure mode `project=af` already taught this fleet about.
|
|
257
|
+
*/
|
|
258
|
+
export function parsePeerArgs(argv: string[]): ParsedPeerArgs {
|
|
259
|
+
const out: ParsedPeerArgs = { name: "", dryRun: false };
|
|
260
|
+
let name: string | undefined;
|
|
261
|
+
for (let i = 0; i < argv.length; i++) {
|
|
262
|
+
const arg = argv[i];
|
|
263
|
+
if (arg === "--") {
|
|
264
|
+
out.piArgs = argv.slice(i + 1);
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
switch (arg) {
|
|
268
|
+
case "--dry-run":
|
|
269
|
+
out.dryRun = true;
|
|
270
|
+
break;
|
|
271
|
+
case "--here":
|
|
272
|
+
out.here = true;
|
|
273
|
+
break;
|
|
274
|
+
case "--browser":
|
|
275
|
+
out.browser = true;
|
|
276
|
+
break;
|
|
277
|
+
case "--all-extensions":
|
|
278
|
+
out.allExtensions = true;
|
|
279
|
+
break;
|
|
280
|
+
case "--runner":
|
|
281
|
+
out.runner = takeValue(argv, i++, arg);
|
|
282
|
+
break;
|
|
283
|
+
case "--persona":
|
|
284
|
+
out.persona = takeValue(argv, i++, arg);
|
|
285
|
+
break;
|
|
286
|
+
case "--no-persona":
|
|
287
|
+
out.noPersona = true;
|
|
288
|
+
break;
|
|
289
|
+
case "--model":
|
|
290
|
+
out.model = takeValue(argv, i++, arg);
|
|
291
|
+
break;
|
|
292
|
+
case "--project":
|
|
293
|
+
out.project = takeValue(argv, i++, arg);
|
|
294
|
+
break;
|
|
295
|
+
case "--extensions":
|
|
296
|
+
out.extensions = takeValue(argv, i++, arg);
|
|
297
|
+
break;
|
|
298
|
+
case "--peers":
|
|
299
|
+
out.peersYaml = takeValue(argv, i++, arg);
|
|
300
|
+
break;
|
|
301
|
+
case "--direction": {
|
|
302
|
+
const value = takeValue(argv, i++, arg);
|
|
303
|
+
if (value !== "right" && value !== "down") throw new Error(`--direction expects right or down, got ${JSON.stringify(value)}`);
|
|
304
|
+
out.direction = value;
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
default:
|
|
308
|
+
if (arg.startsWith("-")) {
|
|
309
|
+
throw new Error(`Unknown flag: ${arg} — pass pi flags after \`--\` (e.g. just fleet peer ${name ?? "<name>"} -- ${arg})`);
|
|
310
|
+
}
|
|
311
|
+
if (name !== undefined) throw new Error(`fleet peer takes one peer name, got ${JSON.stringify(name)} and ${JSON.stringify(arg)}`);
|
|
312
|
+
name = arg;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (!name) throw new Error("fleet peer requires a peer name");
|
|
316
|
+
out.name = name;
|
|
317
|
+
return out;
|
|
318
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// .pi/agent-fleet/scripts/lib/persona-banner.ts
|
|
2
|
+
//
|
|
3
|
+
// Pure logic for the per-pane identity banner (`just _peer`/`_peer-plus`
|
|
4
|
+
// print it before exec'ing pi): persona frontmatter → colored ANSI banner.
|
|
5
|
+
// Frontmatter parsing mirrors the coms harness convention (name /
|
|
6
|
+
// description / color, quoted values allowed). Backend-agnostic — works in
|
|
7
|
+
// any terminal, inside or outside herdr.
|
|
8
|
+
|
|
9
|
+
export interface PersonaMeta {
|
|
10
|
+
name?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
color?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function parsePersonaFrontmatter(raw: string): PersonaMeta {
|
|
16
|
+
const match = raw.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
17
|
+
if (!match) return {};
|
|
18
|
+
const fm: Record<string, string> = {};
|
|
19
|
+
for (const line of match[1].split("\n")) {
|
|
20
|
+
const idx = line.indexOf(":");
|
|
21
|
+
if (idx > 0) {
|
|
22
|
+
const key = line.slice(0, idx).trim();
|
|
23
|
+
let val = line.slice(idx + 1).trim();
|
|
24
|
+
if ((val.startsWith('"') && val.endsWith('"')) || (val.startsWith("'") && val.endsWith("'"))) {
|
|
25
|
+
val = val.slice(1, -1);
|
|
26
|
+
}
|
|
27
|
+
fm[key] = val;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return { name: fm.name, description: fm.description, color: fm.color };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function isValidHex(hex: string): boolean {
|
|
34
|
+
return /^#[0-9a-fA-F]{6}$/.test(hex);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function hexFg(hex: string, s: string): string {
|
|
38
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
39
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
40
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
41
|
+
return `\x1b[38;2;${r};${g};${b}m${s}\x1b[0m`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const DEFAULT_COLOR = "#36F9F6";
|
|
45
|
+
|
|
46
|
+
// Colored banner lines for a peer pane: name in the persona color, purpose
|
|
47
|
+
// dimmed below, framed by a rule in the same color. `width` caps the rule so
|
|
48
|
+
// narrow panes don't wrap.
|
|
49
|
+
export function renderBanner(
|
|
50
|
+
peerName: string,
|
|
51
|
+
meta: PersonaMeta,
|
|
52
|
+
width = 60,
|
|
53
|
+
): string[] {
|
|
54
|
+
const color = meta.color && isValidHex(meta.color) ? meta.color : DEFAULT_COLOR;
|
|
55
|
+
const purpose = (meta.description ?? "").trim();
|
|
56
|
+
const rule = hexFg(color, "━".repeat(Math.max(8, Math.min(width, 100))));
|
|
57
|
+
const title = hexFg(color, `● ${peerName}`);
|
|
58
|
+
const lines = [rule, title];
|
|
59
|
+
if (purpose) lines.push(`\x1b[2m${purpose}\x1b[0m`);
|
|
60
|
+
lines.push(rule);
|
|
61
|
+
return lines;
|
|
62
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// persona-dirs.ts — where a persona markdown file may live in a workspace.
|
|
2
|
+
//
|
|
3
|
+
// One list, imported by every persona lookup (the hub's scanAgentDirs, the
|
|
4
|
+
// peer launcher, the banner) so they cannot disagree about precedence:
|
|
5
|
+
//
|
|
6
|
+
// agents/ the user's own convention — wins, and is never
|
|
7
|
+
// .claude/agents/ written by the installer
|
|
8
|
+
// .pi/agents/personas/ where agent-fleet installs its 15 personas
|
|
9
|
+
// .pi/agents/ hand-placed files beside the fleet YAML config
|
|
10
|
+
//
|
|
11
|
+
// The installer moved out of `agents/` so a workspace keeps a clean root; the
|
|
12
|
+
// first two entries stay because a project that writes its own personas there
|
|
13
|
+
// must keep overriding ours.
|
|
14
|
+
|
|
15
|
+
export const PERSONA_DIRS: readonly (readonly string[])[] = Object.freeze([
|
|
16
|
+
Object.freeze(["agents"]),
|
|
17
|
+
Object.freeze([".claude", "agents"]),
|
|
18
|
+
Object.freeze([".pi", "agents", "personas"]),
|
|
19
|
+
Object.freeze([".pi", "agents"]),
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
/** The same list as workspace-relative POSIX paths, for messages and docs. */
|
|
23
|
+
export const PERSONA_DIR_PATHS: readonly string[] = Object.freeze(
|
|
24
|
+
PERSONA_DIRS.map((parts) => `${parts.join("/")}/`),
|
|
25
|
+
);
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Shared runtime dependency health check for lifecycle diagnostics and launchers.
|
|
2
|
+
// Keep this module plain JavaScript with builtin-only imports: the launcher must
|
|
3
|
+
// be able to load it precisely when the workspace's npm dependencies are broken.
|
|
4
|
+
|
|
5
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { spawnSync as nodeSpawnSync } from "node:child_process";
|
|
8
|
+
|
|
9
|
+
export const RUNTIME_DEPENDENCY_ROOTS = Object.freeze([
|
|
10
|
+
Object.freeze({ root: ".pi/extensions", label: "Pi extensions" }),
|
|
11
|
+
Object.freeze({ root: ".pi/harnesses", label: "Pi harnesses" }),
|
|
12
|
+
Object.freeze({ root: ".pi/agent-fleet/scripts", label: "workflow runtime" }),
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
export const RUNTIME_DEPENDENCY_REMEDIATION =
|
|
16
|
+
"run `just fleet deps`, or rerun setup with `just fleet setup --allow-exec`, then retry";
|
|
17
|
+
|
|
18
|
+
function parsePackage(file) {
|
|
19
|
+
try {
|
|
20
|
+
return { value: JSON.parse(readFileSync(file, "utf8")), error: null };
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return { value: null, error: error instanceof Error ? error.message : String(error) };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function compactProblems(stdout, workspace) {
|
|
27
|
+
try {
|
|
28
|
+
const parsed = JSON.parse(stdout || "{}");
|
|
29
|
+
if (!Array.isArray(parsed.problems) || parsed.problems.length === 0) return null;
|
|
30
|
+
return parsed.problems
|
|
31
|
+
.slice(0, 3)
|
|
32
|
+
.map((problem) => String(problem).replaceAll(workspace, "."))
|
|
33
|
+
.join("; ");
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check every installed Agent Fleet npm root with `npm ls`.
|
|
41
|
+
* A root without package.json was not selected/installed and is skipped.
|
|
42
|
+
*
|
|
43
|
+
* @param {object} opts
|
|
44
|
+
* @param {string} opts.workspace
|
|
45
|
+
* @param {typeof nodeSpawnSync} [opts.run]
|
|
46
|
+
* @returns {{healthy: boolean, checks: Array<object>, failures: Array<object>}}
|
|
47
|
+
*/
|
|
48
|
+
export function checkRuntimeDependencies({ workspace, run = nodeSpawnSync } = {}) {
|
|
49
|
+
if (!workspace) throw new Error("runtime dependency check requires a workspace");
|
|
50
|
+
const checks = [];
|
|
51
|
+
|
|
52
|
+
for (const spec of RUNTIME_DEPENDENCY_ROOTS) {
|
|
53
|
+
const packagePath = join(workspace, spec.root, "package.json");
|
|
54
|
+
if (!existsSync(packagePath)) continue;
|
|
55
|
+
|
|
56
|
+
const parsedPackage = parsePackage(packagePath);
|
|
57
|
+
const nodeModulesPath = join(spec.root, "node_modules");
|
|
58
|
+
if (parsedPackage.error) {
|
|
59
|
+
checks.push({
|
|
60
|
+
...spec,
|
|
61
|
+
path: `${spec.root}/package.json`,
|
|
62
|
+
healthy: false,
|
|
63
|
+
reason: `package.json is unreadable: ${parsedPackage.error}`,
|
|
64
|
+
});
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const dependencies = Object.keys(parsedPackage.value?.dependencies ?? {});
|
|
69
|
+
const args = ["ls", "--prefix", spec.root, "--depth=0", "--json"];
|
|
70
|
+
const result = run("npm", args, {
|
|
71
|
+
cwd: workspace,
|
|
72
|
+
encoding: "utf8",
|
|
73
|
+
stdio: "pipe",
|
|
74
|
+
timeout: 30_000,
|
|
75
|
+
});
|
|
76
|
+
const missingRoot = dependencies.length > 0 && !existsSync(join(workspace, nodeModulesPath));
|
|
77
|
+
const problems = compactProblems(result.stdout, workspace);
|
|
78
|
+
const healthy = !result.error && result.status === 0 && !missingRoot;
|
|
79
|
+
let reason = null;
|
|
80
|
+
if (result.error) reason = `could not run npm ls: ${result.error.message}`;
|
|
81
|
+
else if (missingRoot) reason = `${nodeModulesPath} is missing`;
|
|
82
|
+
else if (problems) reason = problems;
|
|
83
|
+
else if (result.status !== 0) reason = `npm ls exited ${result.status ?? "without a status"}`;
|
|
84
|
+
|
|
85
|
+
checks.push({
|
|
86
|
+
...spec,
|
|
87
|
+
path: nodeModulesPath,
|
|
88
|
+
healthy,
|
|
89
|
+
dependencies,
|
|
90
|
+
command: `npm ${args.join(" ")}`,
|
|
91
|
+
...(reason ? { reason } : {}),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const failures = checks.filter((check) => !check.healthy);
|
|
96
|
+
return { healthy: failures.length === 0, checks, failures };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Doctor-shaped findings for every unhealthy installed dependency root. */
|
|
100
|
+
export function runtimeDependencyFindings({ workspace, run } = {}) {
|
|
101
|
+
return checkRuntimeDependencies({ workspace, run }).failures.map((failure) => ({
|
|
102
|
+
type: "runtime-dependencies",
|
|
103
|
+
path: failure.path,
|
|
104
|
+
issue: `${failure.label} dependencies are incomplete — ${failure.reason}`,
|
|
105
|
+
fix: RUNTIME_DEPENDENCY_REMEDIATION,
|
|
106
|
+
root: failure.root,
|
|
107
|
+
...(failure.command ? { check: failure.command } : {}),
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Fail a launcher before Pi imports an incomplete Agent Fleet runtime. */
|
|
112
|
+
export function assertRuntimeDependencies(workspace, options = {}) {
|
|
113
|
+
const report = checkRuntimeDependencies({ workspace, ...options });
|
|
114
|
+
if (report.healthy) return report;
|
|
115
|
+
const details = report.failures.map((failure) => ` - ${failure.root}: ${failure.reason}`).join("\n");
|
|
116
|
+
const error = new Error(
|
|
117
|
+
`Agent Fleet runtime dependencies are incomplete:\n${details}\n` +
|
|
118
|
+
`Remediation: ${RUNTIME_DEPENDENCY_REMEDIATION}.\n` +
|
|
119
|
+
"This preflight stopped before Pi startup so extension-load failures are not misreported as unknown flags.",
|
|
120
|
+
);
|
|
121
|
+
error.name = "RuntimeDependencyError";
|
|
122
|
+
error.report = report;
|
|
123
|
+
throw error;
|
|
124
|
+
}
|