@chankov/agent-fleet 2.0.17 → 2.0.18
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/agent-fleet/scripts/coms-claude-bridge.ts +75 -49
- package/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +18 -20
- package/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +3 -1
- package/.pi/agents/model-profiles.yaml +5 -5
- package/.pi/agents/peers.yaml +3 -3
- package/.pi/agents/voices.yaml +1 -1
- package/.pi/harnesses/agent-hub/README.md +35 -8
- package/.pi/harnesses/agent-hub/agentic-sources.ts +29 -5
- package/.pi/harnesses/agent-hub/config/overrides.ts +13 -3
- package/.pi/harnesses/agent-hub/delegate.ts +16 -5
- package/.pi/harnesses/agent-hub/deterministic-fs.ts +7 -4
- package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +13 -2
- package/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +2 -0
- package/.pi/harnesses/agent-hub/dispatch-native-types.ts +7 -0
- package/.pi/harnesses/agent-hub/dispatch-native.ts +1 -1
- package/.pi/harnesses/agent-hub/file-discovery/adapters.ts +82 -0
- package/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +56 -0
- package/.pi/harnesses/agent-hub/file-discovery/broker.ts +125 -0
- package/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +33 -0
- package/.pi/harnesses/agent-hub/file-discovery/descendant.ts +63 -0
- package/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +48 -0
- package/.pi/harnesses/agent-hub/file-discovery/hub.ts +152 -0
- package/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
- package/.pi/harnesses/agent-hub/file-discovery/results.ts +54 -0
- package/.pi/harnesses/agent-hub/file-discovery/runtime.ts +120 -0
- package/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.pi/harnesses/agent-hub/filesystem-tool.ts +74 -26
- package/.pi/harnesses/agent-hub/index.ts +23 -5
- package/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +3 -2
- package/.pi/harnesses/agent-hub/no-progress.ts +45 -15
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/policy/work-mode.ts +2 -1
- package/.pi/harnesses/agent-hub/proactive-config.ts +8 -3
- package/.pi/harnesses/agent-hub/proactive-external-git.ts +59 -0
- package/.pi/harnesses/agent-hub/proactive-external.ts +77 -0
- package/.pi/harnesses/agent-hub/proactive-local.ts +25 -7
- package/.pi/harnesses/agent-hub/proactive-observer.ts +2 -1
- package/.pi/harnesses/agent-hub/proactive-rules.ts +39 -11
- package/.pi/harnesses/agent-hub/proactive-runtime.ts +8 -6
- package/.pi/harnesses/agent-hub/proactive-snapshot.ts +32 -2
- package/.pi/harnesses/agent-hub/proactive-types.ts +5 -1
- package/.pi/harnesses/agent-hub/prompts/fragments.ts +21 -49
- package/.pi/harnesses/agent-hub/prompts/system-prompt.ts +2 -1
- package/.pi/harnesses/agent-hub/research/runtime.ts +7 -3
- package/.pi/harnesses/agent-hub/research/spawn-run.ts +17 -6
- package/.pi/harnesses/agent-hub/spawn.ts +38 -9
- package/.pi/harnesses/agent-hub/system1-communication-store.ts +39 -0
- package/.pi/harnesses/agent-hub/tools/action-executors.ts +6 -1
- package/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.pi/harnesses/agent-hub/tools/ask-system1.ts +1 -1
- package/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +4 -4
- package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +4 -2
- package/.pi/harnesses/agent-hub/tools/set-task-tier.ts +3 -3
- package/.pi/harnesses/agent-hub/tools/spawn-research.ts +3 -1
- package/.pi/harnesses/agent-hub/ui/system1-communication.ts +1 -1
- package/.pi/harnesses/agent-hub/work-mode.ts +3 -0
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/context-budget-child-prompt.ts +3 -2
- package/.pi/harnesses/lib/deterministic-handle-path.ts +2 -0
- package/.pi/harnesses/lib/policy-roots.ts +142 -0
- package/.pi/harnesses/lib/system1/config-agentic.js +2 -1
- package/.pi/harnesses/lib/system1/config-file-discovery.js +21 -0
- package/.pi/harnesses/lib/system1/config-proactive.js +13 -2
- package/.pi/harnesses/lib/system1/config-v2.js +8 -5
- package/.versions/2.0.18/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.18/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/coms-claude-bridge.ts +437 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/fleet.ts +217 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/flow.ts +157 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +36 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.18/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.18/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.18/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.18/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.18/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.18/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.18/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.18/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.18/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.18/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.18/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.18/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.18/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.18/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.18/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.18/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.18/.pi/extensions/package.json +9 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/README.md +1483 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/acceptance.ts +199 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-hub.ts +54 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/context.ts +47 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/config/agents.ts +178 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/config/overrides.ts +165 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context/budgets.ts +206 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/deterministic-fs.ts +169 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +270 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +233 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native-types.ts +267 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native.ts +234 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/adapters.ts +82 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +56 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/broker.ts +125 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +33 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/descendant.ts +63 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +48 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/hub.ts +152 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +99 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/results.ts +54 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/runtime.ts +120 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/filesystem-tool.ts +185 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/fixtures/registration-surface.json +65 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/index.ts +2625 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +133 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +144 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/no-progress.ts +593 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/orchestration-activation.ts +112 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/orchestration-route.ts +76 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/work-mode.ts +137 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-config.ts +21 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-external-git.ts +59 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-external.ts +77 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-snapshot.ts +258 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-types.ts +67 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/process-obligations.ts +158 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/prompts/context.ts +56 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/prompts/fragments.ts +95 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/recovery-contract.ts +150 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/research/runtime.ts +201 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/research/spawn-run.ts +194 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/return-contract.js +349 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/review-findings.js +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/run-budget.js +554 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/scope-gate.js +144 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/session-audit.ts +313 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/spawn.ts +563 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/system1-communication-store.ts +190 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/system1-runtime.ts +258 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-authorization.ts +122 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-config.ts +29 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-obligations.ts +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-runtime.ts +125 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/action-executors.ts +213 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/context.ts +144 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +560 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/herdr-executors.ts +95 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/work-mode.ts +187 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
- package/.versions/2.0.18/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.18/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.18/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.18/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.18/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.18/.pi/harnesses/damage-control-continue/index.ts +533 -0
- package/.versions/2.0.18/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.18/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.18/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.18/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.18/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.18/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.18/.pi/harnesses/lib/context-budget-child-prompt.ts +220 -0
- package/.versions/2.0.18/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.0.18/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.18/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.18/.pi/harnesses/lib/damage-control-shared.ts +226 -0
- package/.versions/2.0.18/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.18/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.18/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.18/.pi/harnesses/lib/policy-roots.ts +142 -0
- package/.versions/2.0.18/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.0.18/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-file-discovery.js +21 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-loader.js +44 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-v2.js +106 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.18/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.18/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.18/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.18/.pi/prompts/af-build.md +27 -0
- package/.versions/2.0.18/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.18/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.18/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.18/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.18/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.18/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.18/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.18/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.18/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.18/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.18/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.18/.version +1 -0
- package/.versions/2.0.18/agents/architect.md +24 -0
- package/.versions/2.0.18/agents/bowser.md +28 -0
- package/.versions/2.0.18/agents/builder.md +55 -0
- package/.versions/2.0.18/agents/code-reviewer.md +209 -0
- package/.versions/2.0.18/agents/deep-researcher.md +32 -0
- package/.versions/2.0.18/agents/documenter.md +22 -0
- package/.versions/2.0.18/agents/orchestrator.md +22 -0
- package/.versions/2.0.18/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.18/agents/planner.md +105 -0
- package/.versions/2.0.18/agents/releaser.md +24 -0
- package/.versions/2.0.18/agents/researcher.md +30 -0
- package/.versions/2.0.18/agents/security-auditor.md +167 -0
- package/.versions/2.0.18/agents/test-engineer.md +153 -0
- package/.versions/2.0.18/agents/web-debugger.md +44 -0
- package/.versions/2.0.18/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.18/bin/catalog/harness-runtime-closure.json +73 -0
- package/.versions/2.0.18/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.18/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.18/docs/ARCHITECTURE.md +874 -0
- package/.versions/2.0.18/docs/agent-fleet-setup.md +1101 -0
- package/.versions/2.0.18/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.0.18/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.18/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.18/docs/getting-started.md +126 -0
- package/.versions/2.0.18/docs/npm-install.md +535 -0
- package/.versions/2.0.18/docs/pi-extensions.md +454 -0
- package/.versions/2.0.18/docs/pi-setup.md +92 -0
- package/.versions/2.0.18/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.18/install-manifest.json +3193 -0
- package/.versions/2.0.18/justfile +247 -0
- package/.versions/2.0.18/manifest-meta.json +1071 -0
- package/.versions/2.0.18/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.18/references/communication-contract.md +26 -0
- package/.versions/2.0.18/references/definition-of-done.md +67 -0
- package/.versions/2.0.18/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.18/references/observability-checklist.md +92 -0
- package/.versions/2.0.18/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.18/references/performance-checklist.md +236 -0
- package/.versions/2.0.18/references/prompting-patterns.md +380 -0
- package/.versions/2.0.18/references/security-checklist.md +245 -0
- package/.versions/2.0.18/references/testing-patterns.md +235 -0
- package/.versions/2.0.18/references/workflow-authoring.md +304 -0
- package/.versions/2.0.18/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.18/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.18/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.18/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.18/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.18/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.18/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.18/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.18/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.18/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.18/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.18/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.18/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.18/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.18/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.18/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.18/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.18/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.18/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.18/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.0.18/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.18/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.18/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.18/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.18/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.0.18/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.18/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.0.18/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.18/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.18/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +6 -0
- package/README.md +2 -2
- package/agents/architect.md +2 -2
- package/agents/bowser.md +1 -1
- package/agents/builder.md +5 -5
- package/agents/code-reviewer.md +2 -2
- package/agents/deep-researcher.md +2 -2
- package/agents/documenter.md +3 -3
- package/agents/orchestrator.md +2 -2
- package/agents/plan-reviewer.md +2 -2
- package/agents/planner.md +4 -4
- package/agents/releaser.md +2 -2
- package/agents/researcher.md +2 -2
- package/agents/security-auditor.md +2 -2
- package/agents/test-engineer.md +4 -4
- package/agents/web-debugger.md +2 -2
- package/agents/web-performance-auditor.md +2 -2
- package/bin/cli.js +2 -2
- package/bin/lib/external-content.js +33 -0
- package/bin/lib/project-provenance.js +19 -13
- package/bin/lib/transaction.js +32 -1
- package/docs/ARCHITECTURE.md +42 -2
- package/docs/agent-fleet-setup.md +4 -4
- package/docs/claude-code-coms-bridge.md +17 -4
- package/docs/external-project-ai-content.md +48 -0
- package/docs/npm-install.md +5 -0
- package/docs/system1-agentic.md +27 -0
- package/docs/system1-config.md +23 -1
- package/docs/system1-file-discovery.md +220 -0
- package/install-manifest.json +1 -1
- package/package.json +15 -6
- package/skills/repository-ai-setup/SKILL.md +18 -0
- package/skills/repository-ai-setup.zip +0 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
export interface FleetInvocation {
|
|
2
|
+
recipe: string;
|
|
3
|
+
args: string[];
|
|
4
|
+
warnings?: string[];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface Capabilities {
|
|
8
|
+
browser: boolean;
|
|
9
|
+
voice: boolean;
|
|
10
|
+
allExtensions: boolean;
|
|
11
|
+
rest: string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function capabilities(args: string[]): Capabilities {
|
|
15
|
+
const rest: string[] = [];
|
|
16
|
+
let browser = false;
|
|
17
|
+
let voice = false;
|
|
18
|
+
let allExtensions = false;
|
|
19
|
+
for (const arg of args) {
|
|
20
|
+
if (arg === "--browser") browser = true;
|
|
21
|
+
else if (arg === "--voice") voice = true;
|
|
22
|
+
else if (arg === "--all-extensions") allExtensions = true;
|
|
23
|
+
else rest.push(arg);
|
|
24
|
+
}
|
|
25
|
+
return { browser, voice, allExtensions, rest };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function bool(value: boolean): string {
|
|
29
|
+
return value ? "true" : "false";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function requireValue(value: string | undefined, message: string): string {
|
|
33
|
+
if (!value || value.startsWith("--")) throw new Error(message);
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function withoutFlag(args: string[], flag: string): { present: boolean; rest: string[] } {
|
|
38
|
+
return { present: args.includes(flag), rest: args.filter((arg) => arg !== flag) };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface HubParseDefaults {
|
|
42
|
+
defaultAgents?: string;
|
|
43
|
+
forceHerdr?: boolean;
|
|
44
|
+
forcedPeers?: string;
|
|
45
|
+
legacyAgents?: boolean;
|
|
46
|
+
warnings?: string[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function parseHubInvocation(args: string[], defaults: HubParseDefaults = {}): FleetInvocation {
|
|
50
|
+
if (args.some(arg => arg === "--posture" || arg.startsWith("--posture="))) {
|
|
51
|
+
throw new Error("--posture was removed; use --work-mode operator|orchestrator.");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let workMode: "operator" | "orchestrator" | undefined;
|
|
55
|
+
let agents = defaults.defaultAgents;
|
|
56
|
+
let peers = defaults.forcedPeers;
|
|
57
|
+
let herdr = defaults.forceHerdr ?? false;
|
|
58
|
+
let noComs = false;
|
|
59
|
+
let browser = false;
|
|
60
|
+
let voice = false;
|
|
61
|
+
let allExtensions = false;
|
|
62
|
+
let dryRun = false;
|
|
63
|
+
let projectSeen = false;
|
|
64
|
+
let agentsSeen = false;
|
|
65
|
+
let peersSeen = false;
|
|
66
|
+
let workModeSeen = false;
|
|
67
|
+
let herdrSeen = false;
|
|
68
|
+
let noComsSeen = false;
|
|
69
|
+
let browserSeen = false;
|
|
70
|
+
let voiceSeen = false;
|
|
71
|
+
let allExtensionsSeen = false;
|
|
72
|
+
let dryRunSeen = false;
|
|
73
|
+
const rest: string[] = [];
|
|
74
|
+
const warnings = [...(defaults.warnings ?? [])];
|
|
75
|
+
|
|
76
|
+
for (let i = 0; i < args.length; i++) {
|
|
77
|
+
const arg = args[i];
|
|
78
|
+
if (arg === "--") {
|
|
79
|
+
rest.push(...args.slice(i));
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
switch (arg) {
|
|
83
|
+
case "--work-mode": {
|
|
84
|
+
if (workModeSeen) throw new Error("--work-mode may only be provided once");
|
|
85
|
+
workModeSeen = true;
|
|
86
|
+
const value = requireValue(args[++i], "--work-mode requires operator or orchestrator");
|
|
87
|
+
if (value !== "operator" && value !== "orchestrator") throw new Error("--work-mode requires operator or orchestrator");
|
|
88
|
+
workMode = value;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case "--agents":
|
|
92
|
+
if (agentsSeen) throw new Error("--agents may only be provided once");
|
|
93
|
+
agentsSeen = true;
|
|
94
|
+
agents = requireValue(args[++i], "--agents requires a native roster name");
|
|
95
|
+
break;
|
|
96
|
+
case "--peers": {
|
|
97
|
+
if (peersSeen) throw new Error("--peers may only be provided once");
|
|
98
|
+
peersSeen = true;
|
|
99
|
+
const value = requireValue(args[++i], "--peers requires a peer preset name");
|
|
100
|
+
if (defaults.forcedPeers && value !== defaults.forcedPeers) {
|
|
101
|
+
throw new Error(`Compatibility team preset ${defaults.forcedPeers} cannot combine with --peers ${value}`);
|
|
102
|
+
}
|
|
103
|
+
peers = value;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case "--herdr":
|
|
107
|
+
if (herdrSeen) throw new Error("--herdr may only be provided once");
|
|
108
|
+
herdrSeen = true;
|
|
109
|
+
herdr = true;
|
|
110
|
+
break;
|
|
111
|
+
case "--no-coms":
|
|
112
|
+
case "--solo":
|
|
113
|
+
if (noComsSeen) throw new Error("--no-coms/--solo may only be provided once");
|
|
114
|
+
noComsSeen = true;
|
|
115
|
+
noComs = true;
|
|
116
|
+
if (arg === "--solo") warnings.push("`--solo` is deprecated; use `--no-coms`.");
|
|
117
|
+
break;
|
|
118
|
+
case "--browser":
|
|
119
|
+
if (browserSeen) throw new Error("--browser may only be provided once");
|
|
120
|
+
browserSeen = true;
|
|
121
|
+
browser = true;
|
|
122
|
+
break;
|
|
123
|
+
case "--voice":
|
|
124
|
+
if (voiceSeen) throw new Error("--voice may only be provided once");
|
|
125
|
+
voiceSeen = true;
|
|
126
|
+
voice = true;
|
|
127
|
+
break;
|
|
128
|
+
case "--all-extensions":
|
|
129
|
+
if (allExtensionsSeen) throw new Error("--all-extensions may only be provided once");
|
|
130
|
+
allExtensionsSeen = true;
|
|
131
|
+
allExtensions = true;
|
|
132
|
+
break;
|
|
133
|
+
case "--dry-run":
|
|
134
|
+
if (dryRunSeen) throw new Error("--dry-run may only be provided once");
|
|
135
|
+
dryRunSeen = true;
|
|
136
|
+
dryRun = true;
|
|
137
|
+
break;
|
|
138
|
+
case "--project":
|
|
139
|
+
if (projectSeen) throw new Error("--project may only be provided once");
|
|
140
|
+
projectSeen = true;
|
|
141
|
+
rest.push(arg, requireValue(args[++i], "--project requires a name"));
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
rest.push(arg);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (workMode === "orchestrator" && !agents) throw new Error("--work-mode orchestrator requires --agents <roster>");
|
|
149
|
+
const topology = herdr || peers !== undefined;
|
|
150
|
+
if (dryRun && !topology) throw new Error("--dry-run requires --herdr or --peers");
|
|
151
|
+
|
|
152
|
+
let invocation: FleetInvocation;
|
|
153
|
+
if (topology) {
|
|
154
|
+
const forwarded = [
|
|
155
|
+
...(workMode ? ["--work-mode", workMode] : []),
|
|
156
|
+
...(agents ? [defaults.legacyAgents ? "--legacy-agents" : "--agents", agents] : []),
|
|
157
|
+
...(noComs ? ["--no-coms"] : []),
|
|
158
|
+
...(browser ? ["--browser"] : []),
|
|
159
|
+
...(voice ? ["--voice"] : []),
|
|
160
|
+
...(allExtensions ? ["--all-extensions"] : []),
|
|
161
|
+
...rest,
|
|
162
|
+
];
|
|
163
|
+
invocation = { recipe: dryRun ? "_fleet-hub-team-dry" : "_fleet-hub-team", args: [peers ?? "base", ...forwarded] };
|
|
164
|
+
} else {
|
|
165
|
+
invocation = {
|
|
166
|
+
recipe: "_fleet-hub",
|
|
167
|
+
args: [
|
|
168
|
+
bool(noComs),
|
|
169
|
+
bool(browser),
|
|
170
|
+
bool(voice),
|
|
171
|
+
bool(allExtensions),
|
|
172
|
+
...(workMode ? ["--work-mode", workMode] : []),
|
|
173
|
+
...(agents ? ["--agent-team", agents] : []),
|
|
174
|
+
...rest,
|
|
175
|
+
],
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
if (warnings.length > 0) invocation.warnings = warnings;
|
|
179
|
+
return invocation;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function parseFleetCommand(argv: string[]): FleetInvocation {
|
|
183
|
+
if (argv.length === 0 || argv[0].startsWith("--")) {
|
|
184
|
+
return parseHubInvocation(argv);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const [mode, ...tail] = argv;
|
|
188
|
+
if (mode === "install") {
|
|
189
|
+
throw new Error("just fleet install was removed; use `just fleet setup` for lifecycle setup or `just fleet deps` for runtime dependencies");
|
|
190
|
+
}
|
|
191
|
+
if (mode === "deps") return { recipe: "_fleet-deps", args: tail };
|
|
192
|
+
if (["setup", "doctor"].includes(mode)) return { recipe: "_fleet-lifecycle", args: [mode, ...tail] };
|
|
193
|
+
if (mode === "uninstall") return { recipe: "_fleet-lifecycle", args: ["uninstall", ...tail] };
|
|
194
|
+
|
|
195
|
+
// One addressable peer, in a pane of its own unless --here. peer-launch.ts
|
|
196
|
+
// owns the whole flag set (including `--` passthrough to pi), so the tail is
|
|
197
|
+
// forwarded verbatim rather than pre-chewed the way core/hub capabilities are.
|
|
198
|
+
if (mode === "peer") {
|
|
199
|
+
requireValue(tail[0], "fleet peer requires a peer name");
|
|
200
|
+
return { recipe: "_fleet-peer-launch", args: tail };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (mode === "hub") {
|
|
204
|
+
return parseHubInvocation(tail, {
|
|
205
|
+
defaultAgents: "default",
|
|
206
|
+
warnings: ["`just fleet hub` is a compatibility alias; use `just fleet` with canonical flags."],
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (mode === "team") {
|
|
211
|
+
const team = requireValue(tail[0], "fleet team requires a team preset");
|
|
212
|
+
const noHub = withoutFlag(tail.slice(1), "--no-hub");
|
|
213
|
+
if (!noHub.present) {
|
|
214
|
+
return parseHubInvocation(noHub.rest, {
|
|
215
|
+
defaultAgents: team === "base" ? undefined : team,
|
|
216
|
+
forceHerdr: true,
|
|
217
|
+
forcedPeers: team,
|
|
218
|
+
legacyAgents: team !== "base",
|
|
219
|
+
warnings: [team === "base"
|
|
220
|
+
? "`just fleet team base` is a compatibility alias; use `just fleet --herdr`."
|
|
221
|
+
: `\`just fleet team ${team}\` is a compatibility alias; use \`just fleet --agents <roster> --peers ${team}\`.`],
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
const dry = withoutFlag(noHub.rest, "--dry-run");
|
|
225
|
+
const c = capabilities(dry.rest);
|
|
226
|
+
if (c.browser || c.allExtensions) {
|
|
227
|
+
throw new Error("--browser/--all-extensions requires the hub; peer capabilities belong in .pi/agents/peers.yaml");
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
recipe: dry.present ? "_fleet-team-up-dry" : "_fleet-team-up",
|
|
231
|
+
args: [team, ...c.rest],
|
|
232
|
+
warnings: [`\`just fleet team ${team} --no-hub\` is a compatibility alias; prefer \`just fleet peer\` or a canonical Hub topology.`],
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (mode === "snapshot" || mode === "down" || mode === "resume") {
|
|
237
|
+
const team = requireValue(tail[0], `fleet ${mode} requires a team preset`);
|
|
238
|
+
return { recipe: `_fleet-team-${mode === "snapshot" ? "snapshot" : mode}`, args: [team, ...tail.slice(1)] };
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (mode === "conductor") {
|
|
242
|
+
const backend = requireValue(tail[0], "fleet conductor requires hermes");
|
|
243
|
+
if (backend !== "hermes") throw new Error(`Unknown conductor backend: ${backend}`);
|
|
244
|
+
const rest = tail.slice(1);
|
|
245
|
+
const team = rest[0] && !rest[0].startsWith("--") ? rest[0] : "full";
|
|
246
|
+
const afterTeam = rest[0] === team ? rest.slice(1) : rest;
|
|
247
|
+
const dry = withoutFlag(afterTeam, "--dry-run");
|
|
248
|
+
return { recipe: dry.present ? "_fleet-conductor-dry" : "_fleet-conductor", args: [team, ...dry.rest] };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
throw new Error(`Unknown fleet mode: ${mode}`);
|
|
252
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export interface FlowCommand {
|
|
2
|
+
/** Explicit opt-in; otherwise execute on the caller's current branch. */
|
|
3
|
+
branch?: boolean;
|
|
4
|
+
name: string;
|
|
5
|
+
args: string[];
|
|
6
|
+
allowDirty: boolean;
|
|
7
|
+
dryRun: boolean;
|
|
8
|
+
runId?: string;
|
|
9
|
+
panel?: string;
|
|
10
|
+
rounds?: number;
|
|
11
|
+
apply?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface FlowMaintenanceCommand {
|
|
15
|
+
action: "cleanup" | "merge";
|
|
16
|
+
selector?: string;
|
|
17
|
+
target?: string;
|
|
18
|
+
discard: boolean;
|
|
19
|
+
yes: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const FLOW_NAME = /^[a-z][a-z0-9-]*$/;
|
|
23
|
+
const RUN_ID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
24
|
+
const SAFE_REF = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
25
|
+
|
|
26
|
+
function safeRef(value: string): boolean {
|
|
27
|
+
return SAFE_REF.test(value) && !value.includes("..") && !value.includes("//") && !value.includes("@{") && !value.endsWith("/") && !value.endsWith(".");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function parseFlowMaintenanceCommand(argv: string[]): FlowMaintenanceCommand {
|
|
31
|
+
const action = argv[0];
|
|
32
|
+
if (action !== "cleanup" && action !== "merge") throw new Error("Usage: flow <cleanup|merge> [number|flow/branch] [options]");
|
|
33
|
+
let selector: string | undefined, target: string | undefined, discard = false, yes = false;
|
|
34
|
+
for (let i = 1; i < argv.length; i++) {
|
|
35
|
+
const arg = argv[i];
|
|
36
|
+
if (arg === "--discard") {
|
|
37
|
+
if (discard) throw new Error("--discard may only be provided once");
|
|
38
|
+
discard = true;
|
|
39
|
+
} else if (arg === "--yes") {
|
|
40
|
+
if (yes) throw new Error("--yes may only be provided once");
|
|
41
|
+
yes = true;
|
|
42
|
+
} else if (arg === "--target") {
|
|
43
|
+
if (target) throw new Error("--target may only be provided once");
|
|
44
|
+
const value = argv[++i];
|
|
45
|
+
if (!value || value.startsWith("--") || !safeRef(value)) throw new Error("--target requires a safe local branch name");
|
|
46
|
+
target = value;
|
|
47
|
+
} else if (arg.startsWith("--")) throw new Error(`Unknown flow maintenance option: ${arg}`);
|
|
48
|
+
else {
|
|
49
|
+
if (selector) throw new Error("Only one flow branch selector may be provided");
|
|
50
|
+
if (!/^\d+$/.test(arg) && (!arg.startsWith("flow/") || !safeRef(arg))) throw new Error("Selector must be a list number or a full flow/* branch name");
|
|
51
|
+
selector = arg;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (action === "cleanup" && target) throw new Error("--target is valid only with flow merge");
|
|
55
|
+
if (action === "merge" && discard) throw new Error("--discard is valid only with flow cleanup");
|
|
56
|
+
return { action, ...(selector ? { selector } : {}), ...(target ? { target } : {}), discard, yes };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function parseFlowCommand(argv: string[]): FlowCommand {
|
|
60
|
+
if (argv.length === 0) throw new Error("Usage: flow <name> [args] [--branch] [--allow-dirty] [--run-id <id>] [--dry-run] [--panel <name>] [--rounds <n>] [--apply]");
|
|
61
|
+
const name = argv[0];
|
|
62
|
+
if (!FLOW_NAME.test(name)) throw new Error(`Invalid flow name: ${name}`);
|
|
63
|
+
let branch = false, allowDirty = false, dryRun = false, apply = false, runId: string | undefined, panel: string | undefined, rounds: number | undefined;
|
|
64
|
+
const args: string[] = [];
|
|
65
|
+
for (let i = 1; i < argv.length; i++) {
|
|
66
|
+
const arg = argv[i];
|
|
67
|
+
if (arg === "--branch") {
|
|
68
|
+
if (branch) throw new Error("--branch may only be provided once");
|
|
69
|
+
branch = true;
|
|
70
|
+
} else if (arg === "--allow-dirty") {
|
|
71
|
+
if (allowDirty) throw new Error("--allow-dirty may only be provided once");
|
|
72
|
+
allowDirty = true;
|
|
73
|
+
} else if (arg === "--dry-run") {
|
|
74
|
+
if (dryRun) throw new Error("--dry-run may only be provided once");
|
|
75
|
+
dryRun = true;
|
|
76
|
+
} else if (arg === "--apply") {
|
|
77
|
+
if (apply) throw new Error("--apply may only be provided once");
|
|
78
|
+
apply = true;
|
|
79
|
+
} else if (arg === "--run-id") {
|
|
80
|
+
if (runId) throw new Error("--run-id may only be provided once");
|
|
81
|
+
const value = argv[++i];
|
|
82
|
+
if (!value || value.startsWith("--") || !RUN_ID.test(value)) throw new Error("--run-id requires a safe identifier");
|
|
83
|
+
runId = value;
|
|
84
|
+
} else if (arg === "--panel") {
|
|
85
|
+
if (panel) throw new Error("--panel may only be provided once");
|
|
86
|
+
const value = argv[++i];
|
|
87
|
+
if (!value || value.startsWith("--")) throw new Error("--panel requires a panel name");
|
|
88
|
+
panel = value;
|
|
89
|
+
} else if (arg === "--rounds") {
|
|
90
|
+
if (rounds !== undefined) throw new Error("--rounds may only be provided once");
|
|
91
|
+
const value = argv[++i];
|
|
92
|
+
if (!value || value.startsWith("--") || !/^\d+$/.test(value)) throw new Error("--rounds requires an integer");
|
|
93
|
+
rounds = Number(value);
|
|
94
|
+
} else if (arg.startsWith("--")) throw new Error(`Unknown flow option: ${arg}`);
|
|
95
|
+
else args.push(arg);
|
|
96
|
+
}
|
|
97
|
+
return { name, args, allowDirty, dryRun, ...(branch ? { branch } : {}), ...(runId ? { runId } : {}), ...(panel ? { panel } : {}), ...(rounds !== undefined ? { rounds } : {}), ...(apply ? { apply } : {}) };
|
|
98
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { createInterface } from "node:readline/promises";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
import { readFlowBranchMetadata, type FlowBranchMetadata } from "../workflows/lib/git.ts";
|
|
6
|
+
import type { FlowMaintenanceCommand } from "./flow-command.ts";
|
|
7
|
+
|
|
8
|
+
export interface FlowBranchInfo {
|
|
9
|
+
branch: string;
|
|
10
|
+
head: string;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
metadata: FlowBranchMetadata;
|
|
13
|
+
runId?: string;
|
|
14
|
+
result: "accepted" | "rejected" | "unknown";
|
|
15
|
+
target?: string;
|
|
16
|
+
worktreePath?: string;
|
|
17
|
+
dirty: boolean;
|
|
18
|
+
ahead?: number;
|
|
19
|
+
behind?: number;
|
|
20
|
+
diffSummary?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface CommandResult { status: number | null; stdout: string; stderr: string; error?: Error; streamed?: boolean }
|
|
24
|
+
type CommandRunner = (command: string, args: string[], cwd: string) => CommandResult | Promise<CommandResult>;
|
|
25
|
+
export interface FlowMaintenanceOptions {
|
|
26
|
+
cwd?: string;
|
|
27
|
+
interactive?: boolean;
|
|
28
|
+
taskRunner?: CommandRunner;
|
|
29
|
+
taskPrompt?: (question: string) => Promise<string>;
|
|
30
|
+
writeOut?: (text: string) => void;
|
|
31
|
+
writeError?: (text: string) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class FlowMaintenanceError extends Error {
|
|
35
|
+
readonly exitCode: number;
|
|
36
|
+
constructor(message: string, exitCode = 3) { super(message); this.exitCode = exitCode; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function run(command: string, args: string[], cwd: string): CommandResult {
|
|
40
|
+
const result = spawnSync(command, args, { cwd, encoding: "utf8" });
|
|
41
|
+
return { status: result.status, stdout: result.stdout ?? "", stderr: result.stderr ?? "", ...(result.error ? { error: result.error } : {}) };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function runTask(command: string, args: string[], cwd: string): Promise<CommandResult> {
|
|
45
|
+
return new Promise(resolveTask => {
|
|
46
|
+
const visible = !(command === "wt" && args[0] === "--version");
|
|
47
|
+
let stdout = "", stderr = "", spawnError: Error | undefined;
|
|
48
|
+
const child = spawn(command, args, { cwd, stdio: ["inherit", "pipe", "pipe"] });
|
|
49
|
+
child.stdout.on("data", chunk => { const text = chunk.toString(); stdout += text; if (visible) process.stdout.write(text); });
|
|
50
|
+
child.stderr.on("data", chunk => { const text = chunk.toString(); stderr += text; if (visible) process.stderr.write(text); });
|
|
51
|
+
child.on("error", error => { spawnError = error; });
|
|
52
|
+
child.on("close", status => resolveTask({ status, stdout, stderr, ...(spawnError ? { error: spawnError } : {}), streamed: visible }));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function git(cwd: string, args: string[]): string {
|
|
57
|
+
const result = run("git", args, cwd);
|
|
58
|
+
if (result.status !== 0) throw new FlowMaintenanceError((result.stderr || result.stdout || `git ${args.join(" ")} failed`).trim(), 1);
|
|
59
|
+
return result.stdout.trim();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function localBranchExists(cwd: string, branch: string): boolean {
|
|
63
|
+
return run("git", ["show-ref", "--verify", "--quiet", `refs/heads/${branch}`], cwd).status === 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function worktrees(cwd: string): Map<string, string> {
|
|
67
|
+
const output = git(cwd, ["worktree", "list", "--porcelain"]);
|
|
68
|
+
const result = new Map<string, string>();
|
|
69
|
+
let path: string | undefined;
|
|
70
|
+
for (const line of output.split("\n")) {
|
|
71
|
+
if (line.startsWith("worktree ")) path = line.slice("worktree ".length);
|
|
72
|
+
else if (line.startsWith("branch refs/heads/") && path) result.set(line.slice("branch refs/heads/".length), path);
|
|
73
|
+
else if (!line) path = undefined;
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function inferRunId(branch: string, cwd: string): string | undefined {
|
|
79
|
+
const sessions = resolve(cwd, ".pi", "flow-sessions");
|
|
80
|
+
if (!existsSync(sessions)) return undefined;
|
|
81
|
+
return readdirSync(sessions, { withFileTypes: true })
|
|
82
|
+
.filter(entry => entry.isDirectory() && branch.endsWith(`-${entry.name}`))
|
|
83
|
+
.map(entry => entry.name)
|
|
84
|
+
.sort((a, b) => b.length - a.length || a.localeCompare(b))[0];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function traceResult(cwd: string, runId?: string): "accepted" | "rejected" | undefined {
|
|
88
|
+
if (!runId) return undefined;
|
|
89
|
+
try {
|
|
90
|
+
const lines = readFileSync(resolve(cwd, ".pi", "flow-sessions", runId, "trace.jsonl"), "utf8").trim().split("\n").filter(Boolean);
|
|
91
|
+
for (let index = lines.length - 1; index >= 0; index--) {
|
|
92
|
+
const event = JSON.parse(lines[index]) as { type?: string; status?: string };
|
|
93
|
+
if (event.type === "run_end" && (event.status === "accepted" || event.status === "rejected")) return event.status;
|
|
94
|
+
}
|
|
95
|
+
} catch {}
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function dirtyWorktree(path: string | undefined): boolean {
|
|
100
|
+
if (!path) return false;
|
|
101
|
+
const result = run("git", ["status", "--porcelain", "--untracked-files=all"], path);
|
|
102
|
+
if (result.status !== 0) throw new FlowMaintenanceError(`Could not inspect flow worktree ${path}: ${(result.stderr || result.error?.message || "git status failed").trim()}`);
|
|
103
|
+
return result.stdout.trim() !== "";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function listFlowBranches(cwd = process.cwd()): FlowBranchInfo[] {
|
|
107
|
+
const refs = git(cwd, ["for-each-ref", "--format=%(refname:short)%09%(objectname:short)%09%(committerdate:unix)", "refs/heads/flow/"]);
|
|
108
|
+
if (!refs) return [];
|
|
109
|
+
const paths = worktrees(cwd);
|
|
110
|
+
return refs.split("\n").filter(Boolean).map(line => {
|
|
111
|
+
const [branch, head, rawTimestamp] = line.split("\t");
|
|
112
|
+
const metadata = readFlowBranchMetadata(branch, cwd);
|
|
113
|
+
const runId = metadata.runId ?? inferRunId(branch, cwd);
|
|
114
|
+
const result: FlowBranchInfo["result"] = metadata.result ?? traceResult(cwd, runId) ?? "unknown";
|
|
115
|
+
const target = metadata.baseBranch;
|
|
116
|
+
const worktreePath = paths.get(branch);
|
|
117
|
+
let ahead: number | undefined, behind: number | undefined, diffSummary: string | undefined;
|
|
118
|
+
if (target && localBranchExists(cwd, target)) {
|
|
119
|
+
const counts = git(cwd, ["rev-list", "--left-right", "--count", `${target}...${branch}`]).split(/\s+/).map(Number);
|
|
120
|
+
behind = counts[0]; ahead = counts[1];
|
|
121
|
+
diffSummary = git(cwd, ["diff", "--shortstat", `${target}...${branch}`]) || "no file changes";
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
branch, head, timestamp: Number(rawTimestamp) || 0, metadata,
|
|
125
|
+
...(runId ? { runId } : {}), result, ...(target ? { target } : {}), ...(worktreePath ? { worktreePath } : {}),
|
|
126
|
+
dirty: dirtyWorktree(worktreePath), ...(ahead === undefined ? {} : { ahead }), ...(behind === undefined ? {} : { behind }), ...(diffSummary ? { diffSummary } : {}),
|
|
127
|
+
};
|
|
128
|
+
}).sort((a, b) => b.timestamp - a.timestamp || a.branch.localeCompare(b.branch));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function renderFlowBranches(branches: FlowBranchInfo[]): string {
|
|
132
|
+
if (!branches.length) return "No local flow/* branches found.\n";
|
|
133
|
+
const rows = branches.map((info, index) => {
|
|
134
|
+
const relation = info.ahead === undefined ? "relation unknown" : `↑${info.ahead} ↓${info.behind ?? 0}`;
|
|
135
|
+
return ` ${index + 1}. ${info.branch} ${info.result} ${info.dirty ? "dirty" : "clean"} ${relation} target: ${info.target ?? "unknown"}`;
|
|
136
|
+
});
|
|
137
|
+
return `Flow branches:\n${rows.join("\n")}\n\nSelect with a number or full branch name.\n`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function selectFlowBranch(branches: FlowBranchInfo[], selector: string): FlowBranchInfo {
|
|
141
|
+
if (/^\d+$/.test(selector)) {
|
|
142
|
+
const index = Number(selector) - 1;
|
|
143
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= branches.length) throw new FlowMaintenanceError(`Flow branch number is out of range: ${selector}`, 2);
|
|
144
|
+
return branches[index];
|
|
145
|
+
}
|
|
146
|
+
const match = branches.find(info => info.branch === selector);
|
|
147
|
+
if (!match) throw new FlowMaintenanceError(`Flow branch was not found: ${selector}`, 2);
|
|
148
|
+
return match;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function defaultPrompt(question: string): Promise<string> {
|
|
152
|
+
const prompt = createInterface({ input: process.stdin, output: process.stdout });
|
|
153
|
+
try { return (await prompt.question(question)).trim(); }
|
|
154
|
+
finally { prompt.close(); }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async function requireWorktrunk(cwd: string, taskRunner: CommandRunner): Promise<void> {
|
|
158
|
+
const result = await taskRunner("wt", ["--version"], cwd);
|
|
159
|
+
if (result.status !== 0) throw new FlowMaintenanceError(`Worktrunk is required for flow maintenance: ${(result.error?.message || result.stderr || "wt was not found").trim()}`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function printTaskResult(result: CommandResult, out: (text: string) => void, error: (text: string) => void): void {
|
|
163
|
+
if (result.streamed) return;
|
|
164
|
+
if (result.stdout.trim()) out(`${result.stdout.trim()}\n`);
|
|
165
|
+
if (result.stderr.trim()) error(`${result.stderr.trim()}\n`);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function requireClean(info: FlowBranchInfo): void {
|
|
169
|
+
if (info.dirty) throw new FlowMaintenanceError(`Flow branch ${info.branch} has uncommitted changes; commit or stash them before maintenance.`);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
async function selectedWorktree(info: FlowBranchInfo, cwd: string, taskRunner: CommandRunner): Promise<string> {
|
|
173
|
+
if (info.worktreePath) return info.worktreePath;
|
|
174
|
+
const switched = await taskRunner("wt", ["-C", cwd, "-y", "switch", info.branch, "--no-cd", "--format=json"], cwd);
|
|
175
|
+
if (switched.status !== 0) throw new FlowMaintenanceError((switched.stderr || switched.stdout || `Worktrunk could not create a worktree for ${info.branch}`).trim(), 1);
|
|
176
|
+
const path = worktrees(cwd).get(info.branch);
|
|
177
|
+
if (!path) throw new FlowMaintenanceError(`Worktrunk did not expose a worktree for ${info.branch}.`, 1);
|
|
178
|
+
return path;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export async function runFlowMaintenance(command: FlowMaintenanceCommand, options: FlowMaintenanceOptions = {}): Promise<number> {
|
|
182
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
183
|
+
const interactive = options.interactive ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
184
|
+
const taskRunner = options.taskRunner ?? runTask;
|
|
185
|
+
const ask = options.taskPrompt ?? defaultPrompt;
|
|
186
|
+
const out = options.writeOut ?? (text => process.stdout.write(text));
|
|
187
|
+
const error = options.writeError ?? (text => process.stderr.write(text));
|
|
188
|
+
const branches = listFlowBranches(cwd);
|
|
189
|
+
out(renderFlowBranches(branches));
|
|
190
|
+
if (!branches.length) return 0;
|
|
191
|
+
|
|
192
|
+
let selector = command.selector;
|
|
193
|
+
if (!selector) {
|
|
194
|
+
if (!interactive) return 0;
|
|
195
|
+
selector = await ask(`${command.action === "cleanup" ? "Clean up" : "Merge"} which flow branch? `);
|
|
196
|
+
if (!selector) return 0;
|
|
197
|
+
}
|
|
198
|
+
let info = selectFlowBranch(branches, selector);
|
|
199
|
+
if (!command.yes) {
|
|
200
|
+
if (!interactive) throw new FlowMaintenanceError("Confirmation requires an interactive terminal; rerun with --yes.");
|
|
201
|
+
const answer = (await ask(`${command.action === "cleanup" ? command.discard ? "Discard" : "Clean up" : "Squash-merge"} ${info.branch}? [y/N] `)).toLowerCase();
|
|
202
|
+
if (answer !== "y" && answer !== "yes") { out("Cancelled.\n"); return 0; }
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const refreshed = listFlowBranches(cwd).find(candidate => candidate.branch === info.branch);
|
|
206
|
+
if (!refreshed) throw new FlowMaintenanceError(`Flow branch disappeared before ${command.action}: ${info.branch}`, 1);
|
|
207
|
+
info = refreshed;
|
|
208
|
+
requireClean(info);
|
|
209
|
+
if (command.action === "cleanup") {
|
|
210
|
+
await requireWorktrunk(cwd, taskRunner);
|
|
211
|
+
const args = ["-C", cwd, "-y", "remove", info.branch, "--foreground", "--format=json", ...(command.discard ? ["-D"] : [])];
|
|
212
|
+
const result = await taskRunner("wt", args, cwd);
|
|
213
|
+
printTaskResult(result, out, error);
|
|
214
|
+
if (result.status !== 0) throw new FlowMaintenanceError(`Worktrunk did not remove ${info.branch}. Use flow merge, or review before --discard.`, 1);
|
|
215
|
+
return 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (info.result !== "accepted") throw new FlowMaintenanceError(`Flow branch ${info.branch} is ${info.result}; only accepted runs may be merged.`);
|
|
219
|
+
const target = command.target ?? info.target;
|
|
220
|
+
if (!target) throw new FlowMaintenanceError(`Flow branch ${info.branch} has no recorded source branch; rerun with --target <branch>.`);
|
|
221
|
+
if (target === info.branch) throw new FlowMaintenanceError("A flow branch cannot be merged into itself.", 2);
|
|
222
|
+
if (!localBranchExists(cwd, target)) throw new FlowMaintenanceError(`Merge target is not a local branch: ${target}`);
|
|
223
|
+
await requireWorktrunk(cwd, taskRunner);
|
|
224
|
+
const path = await selectedWorktree(info, cwd, taskRunner);
|
|
225
|
+
if (dirtyWorktree(path)) throw new FlowMaintenanceError(`Flow worktree ${path} became dirty before merge; merge was refused.`);
|
|
226
|
+
const result = await taskRunner("wt", ["-C", path, "-y", "merge", target, "--format=json"], path);
|
|
227
|
+
printTaskResult(result, out, error);
|
|
228
|
+
if (result.status !== 0) throw new FlowMaintenanceError(`Worktrunk could not merge ${info.branch} into ${target}.`, 1);
|
|
229
|
+
return 0;
|
|
230
|
+
}
|