@chankov/agent-fleet 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/harnesses/agent-hub/README.md +74 -10
- package/.pi/harnesses/agent-hub/acceptance.ts +62 -0
- package/.pi/harnesses/agent-hub/artifacts.js +1 -1
- package/.pi/harnesses/agent-hub/budget-continuation.ts +0 -60
- package/.pi/harnesses/agent-hub/budget-recovery.ts +97 -0
- package/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.pi/harnesses/agent-hub/commands/context.ts +2 -0
- package/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.pi/harnesses/agent-hub/config/agents.ts +3 -9
- package/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +7 -5
- package/.pi/harnesses/agent-hub/context/budgets.ts +8 -14
- package/.pi/harnesses/agent-hub/debate-command.ts +2 -2
- package/.pi/harnesses/agent-hub/dispatch-coms.ts +4 -1
- package/.pi/harnesses/agent-hub/dispatch-native-complete.ts +37 -18
- package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +5 -5
- package/.pi/harnesses/agent-hub/dispatch-native-types.ts +22 -0
- package/.pi/harnesses/agent-hub/dispatch-native.ts +25 -11
- package/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.pi/harnesses/agent-hub/hub-state-audit.js +5 -0
- package/.pi/harnesses/agent-hub/index.ts +79 -43
- package/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +2 -0
- package/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +9 -30
- package/.pi/harnesses/agent-hub/monitor-control.ts +1 -1
- package/.pi/harnesses/agent-hub/no-progress.ts +76 -0
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/policy/roster.ts +16 -1
- package/.pi/harnesses/agent-hub/policy/work-mode.ts +3 -2
- package/.pi/harnesses/agent-hub/poll-command.ts +2 -2
- package/.pi/harnesses/agent-hub/prompts/context.ts +1 -0
- package/.pi/harnesses/agent-hub/prompts/system-prompt.ts +3 -1
- package/.pi/harnesses/agent-hub/research/runtime.ts +17 -2
- package/.pi/harnesses/agent-hub/research/spawn-run.ts +14 -6
- package/.pi/harnesses/agent-hub/scope-gate.js +50 -30
- package/.pi/harnesses/agent-hub/tools/context.ts +2 -0
- package/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +6 -3
- package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +65 -24
- package/.pi/harnesses/agent-hub/types.ts +1 -0
- package/.pi/harnesses/agent-hub/ui/pool.ts +6 -1
- package/.pi/harnesses/agent-hub/work-mode-controls.ts +1 -1
- package/.pi/harnesses/ask-user-remote/README.md +8 -2
- package/.pi/harnesses/ask-user-remote/index.ts +40 -14
- package/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.pi/harnesses/ask-user-remote/race-core.js +23 -5
- package/.pi/harnesses/ask-user-remote/runtime-ask.ts +43 -0
- package/.pi/harnesses/coms/README.md +1 -1
- package/.pi/harnesses/coms/index.ts +7 -1
- 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 +5 -4
- package/.pi/harnesses/lib/fleet-dashboard-view.ts +1 -1
- package/.versions/2.0.6/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.6/.pi/agents/model-profiles.yaml +83 -0
- package/.versions/2.0.6/.pi/agents/peers.yaml +145 -0
- package/.versions/2.0.6/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.6/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.6/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.6/.pi/extensions/agent-fleet-update-check/README.md +57 -0
- package/.versions/2.0.6/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
- package/.versions/2.0.6/.pi/extensions/agent-fleet-update-check/package.json +6 -0
- package/.versions/2.0.6/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.6/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.6/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.6/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.6/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.6/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.6/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.6/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.6/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.6/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.6/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.6/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.6/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.6/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.6/.pi/extensions/package.json +9 -0
- package/.versions/2.0.6/.pi/extensions/pi-voice-stt/README.md +205 -0
- package/.versions/2.0.6/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.6/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.6/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.6/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.6/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.6/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/README.md +1203 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/acceptance.ts +62 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/budget-recovery.ts +97 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/context.ts +43 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/config/agents.ts +173 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/config/model-profiles.ts +216 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/config/overrides.ts +153 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +213 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/context/budgets.ts +202 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/context-window.js +106 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/delegate.ts +446 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/dispatch-coms.ts +237 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/dispatch-native-complete.ts +154 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +156 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +193 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/dispatch-native-types.ts +230 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/dispatch-native.ts +213 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/docs-lane.js +122 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/drift-watchdog.js +218 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/fixtures/registration-surface.json +57 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/helpers.ts +266 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/hub-state-audit.js +64 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/index.ts +2151 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/input/completions.ts +76 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/input/shortcuts.ts +18 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +123 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/no-progress.ts +76 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/policy/work-mode.ts +119 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/prompts/context.ts +47 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/prompts/fragments.ts +115 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/prompts/system-prompt.ts +112 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/research/runtime.ts +192 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/research/spawn-run.ts +156 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/return-contract.js +293 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/return-extract.js +75 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/review-findings.js +102 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/run-budget.js +537 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/run-namespace.js +87 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/scope-gate.js +123 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/spawn.ts +404 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/timeline.ts +54 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/action-executors.ts +149 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/context.ts +134 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +82 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +273 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/fleet-tools.ts +202 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/herdr-executors.ts +86 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/set-task-tier.ts +29 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/spawn-research.ts +62 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/tools/verification-contract.ts +77 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/types.ts +63 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/activity-dots.ts +16 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/context-budget.ts +86 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/detail-panel.ts +178 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +125 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/grid.ts +42 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/running-strip.ts +139 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/ui/zoom.ts +204 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.6/.pi/harnesses/agent-hub/work-mode.ts +167 -0
- package/.versions/2.0.6/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.6/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.6/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.6/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.6/.pi/harnesses/ask-user-remote/runtime-ask.ts +43 -0
- package/.versions/2.0.6/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.6/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.6/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.6/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.6/.pi/harnesses/damage-control-continue/README.md +124 -0
- package/.versions/2.0.6/.pi/harnesses/damage-control-continue/index.ts +536 -0
- package/.versions/2.0.6/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.6/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.6/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.6/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.6/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.6/.pi/harnesses/lib/context-budget-child-prompt.ts +180 -0
- package/.versions/2.0.6/.pi/harnesses/lib/context-budget-hub-prompt.ts +114 -0
- package/.versions/2.0.6/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.6/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.6/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fleet-dashboard-ops.ts +161 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fleet-dashboard-view.ts +148 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fleet-detail-view.ts +247 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fleet-read-model.ts +131 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.6/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.6/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.6/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.6/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.6/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.6/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.6/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.6/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.6/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.6/.pi/harnesses/lib/spawned-peers.js +190 -0
- package/.versions/2.0.6/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.6/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.6/.pi/prompts/af-build.md +24 -0
- package/.versions/2.0.6/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.6/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.6/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.6/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.6/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.6/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.6/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.6/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.6/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.6/.version +1 -0
- package/.versions/2.0.6/agents/architect.md +25 -0
- package/.versions/2.0.6/agents/bowser.md +28 -0
- package/.versions/2.0.6/agents/builder.md +56 -0
- package/.versions/2.0.6/agents/code-reviewer.md +210 -0
- package/.versions/2.0.6/agents/deep-researcher.md +33 -0
- package/.versions/2.0.6/agents/documenter.md +23 -0
- package/.versions/2.0.6/agents/orchestrator.md +23 -0
- package/.versions/2.0.6/agents/plan-reviewer.md +84 -0
- package/.versions/2.0.6/agents/planner.md +106 -0
- package/.versions/2.0.6/agents/releaser.md +25 -0
- package/.versions/2.0.6/agents/researcher.md +31 -0
- package/.versions/2.0.6/agents/security-auditor.md +168 -0
- package/.versions/2.0.6/agents/test-engineer.md +154 -0
- package/.versions/2.0.6/agents/web-debugger.md +44 -0
- package/.versions/2.0.6/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.6/bin/catalog/harness-runtime-closure.json +31 -0
- package/.versions/2.0.6/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.6/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.6/docs/ARCHITECTURE.md +407 -0
- package/.versions/2.0.6/docs/agent-fleet-setup.md +561 -0
- package/.versions/2.0.6/docs/claude-code-coms-bridge.md +133 -0
- package/.versions/2.0.6/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.6/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.6/docs/getting-started.md +126 -0
- package/.versions/2.0.6/docs/npm-install.md +301 -0
- package/.versions/2.0.6/docs/pi-extensions.md +446 -0
- package/.versions/2.0.6/docs/pi-setup.md +76 -0
- package/.versions/2.0.6/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.6/hermes/README.md +347 -0
- package/.versions/2.0.6/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.6/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.6/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.6/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.6/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.6/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.6/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.6/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.6/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.6/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.6/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.6/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.6/install-manifest.json +2924 -0
- package/.versions/2.0.6/justfile +247 -0
- package/.versions/2.0.6/manifest-meta.json +976 -0
- package/.versions/2.0.6/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.6/references/communication-contract.md +26 -0
- package/.versions/2.0.6/references/definition-of-done.md +67 -0
- package/.versions/2.0.6/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.6/references/observability-checklist.md +91 -0
- package/.versions/2.0.6/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.6/references/performance-checklist.md +153 -0
- package/.versions/2.0.6/references/prompting-patterns.md +380 -0
- package/.versions/2.0.6/references/security-checklist.md +179 -0
- package/.versions/2.0.6/references/testing-patterns.md +236 -0
- package/.versions/2.0.6/references/workflow-authoring.md +304 -0
- package/.versions/2.0.6/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.6/scripts/coms-claude-bridge.ts +411 -0
- package/.versions/2.0.6/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.6/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.6/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.6/scripts/fleet-codex-read.py +146 -0
- package/.versions/2.0.6/scripts/fleet.ts +216 -0
- package/.versions/2.0.6/scripts/flow.ts +137 -0
- package/.versions/2.0.6/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.6/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.6/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.6/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.6/scripts/lib/claude-bridge-core.ts +210 -0
- package/.versions/2.0.6/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.6/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.6/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.6/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.6/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.6/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.6/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.6/scripts/lib/flow-command.ts +93 -0
- package/.versions/2.0.6/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.6/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.6/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.6/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.6/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.6/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.6/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.6/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.6/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.6/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.6/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.6/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.6/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.6/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.6/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.6/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.6/scripts/package-lock.json +35 -0
- package/.versions/2.0.6/scripts/package.json +9 -0
- package/.versions/2.0.6/scripts/peer-banner.ts +40 -0
- package/.versions/2.0.6/scripts/peer-launch.ts +285 -0
- package/.versions/2.0.6/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.6/scripts/team-up.ts +378 -0
- package/.versions/2.0.6/scripts/workflows/lib/agent-phase.ts +133 -0
- package/.versions/2.0.6/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.6/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.6/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.6/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.6/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.6/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.6/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.6/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.6/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.6/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.6/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.6/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.6/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.6/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.6/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.6/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.6/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.6/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.6/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.6/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.6/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.6/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.6/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.6/scripts/workflows/wf-scout.ts +38 -0
- package/.versions/2.0.6/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.6/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.6/skills/code-review-and-quality/SKILL.md +381 -0
- package/.versions/2.0.6/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.6/skills/context-engineering/SKILL.md +291 -0
- package/.versions/2.0.6/skills/deprecation-and-migration/SKILL.md +206 -0
- package/.versions/2.0.6/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.6/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.6/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.6/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.6/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.6/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.6/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.6/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.6/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.6/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.6/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.6/skills/incremental-implementation/SKILL.md +298 -0
- package/.versions/2.0.6/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.6/skills/orchestration-verification/SKILL.md +181 -0
- package/.versions/2.0.6/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.6/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/2.0.6/skills/planning-and-task-breakdown/SKILL.md +265 -0
- package/.versions/2.0.6/skills/security-and-hardening/SKILL.md +461 -0
- package/.versions/2.0.6/skills/spec-driven-development/SKILL.md +256 -0
- package/.versions/2.0.6/skills/using-agent-skills/SKILL.md +197 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/README.md +11 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
- package/.versions/2.0.6/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
- package/CHANGELOG.md +23 -0
- package/README.md +12 -14
- package/bin/catalog/harness-runtime-closure.json +1 -6
- package/bin/lib/desired.js +2 -2
- package/bin/lib/features.js +8 -1
- package/bin/snapshot-version.js +1 -2
- package/codex/fleet-session-client/SKILL.md +34 -0
- package/codex/fleet-session-client.zip +0 -0
- package/docs/ARCHITECTURE.md +4 -4
- package/docs/MIGRATION-agent-fleet.md +2 -2
- package/docs/assets/branding/README.md +33 -0
- package/docs/assets/branding/agent-fleet-logo-v1.png +0 -0
- package/docs/assets/branding/agent-fleet-logo-white-v1.png +0 -0
- package/docs/codex-session-bridge.md +219 -0
- package/docs/coms-hermes-bridge.md +4 -5
- package/docs/getting-started.md +2 -0
- package/docs/npm-install.md +3 -1
- package/docs/pi-setup.md +2 -0
- package/hermes/README.md +1 -1
- package/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +19 -16
- package/install-manifest.json +54 -72
- package/justfile +0 -42
- package/manifest-meta.json +50 -43
- package/package.json +10 -7
- package/scripts/coms-cli.ts +2 -61
- package/scripts/fleet-codex-client.ts +69 -0
- package/scripts/fleet-codex-read.py +146 -0
- package/scripts/fleet.ts +0 -6
- package/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/scripts/lib/fleet-codex-operations.ts +190 -0
- package/scripts/lib/fleet-codex-session.ts +166 -0
- package/scripts/lib/fleet-codex-transport.ts +124 -0
- package/scripts/lib/fleet-command.ts +5 -23
- package/scripts/lib/team-project.ts +15 -50
- package/scripts/team-up.ts +6 -34
- package/codex/CONDUCTOR.md +0 -148
- package/docs/codex-remote-conductor.md +0 -170
- package/scripts/codex-conductor.ts +0 -41
- package/scripts/codex-remote-control.ts +0 -167
- package/scripts/lib/codex-conductor.ts +0 -88
- package/scripts/lib/codex-remote-control.ts +0 -482
- package/systemd/user/agent-fleet-codex-remote-control.service.in +0 -23
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import type { FleetRow } from "./fleet-read-model.ts";
|
|
2
|
+
import type { ThemeLike } from "./fleet-dashboard-view.ts";
|
|
3
|
+
|
|
4
|
+
export interface TimelineEntry {
|
|
5
|
+
kind: "text" | "tool" | "thinking" | "tool-start" | "tool-result";
|
|
6
|
+
title: string;
|
|
7
|
+
content: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
callId?: string;
|
|
10
|
+
status?: "success" | "error";
|
|
11
|
+
durationMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface PiModelSummary { provider?: unknown; id?: unknown; name?: unknown; }
|
|
14
|
+
export interface FleetModelChoice { spec: string; label: string; }
|
|
15
|
+
export interface FleetModelPickerState { index: number; scrollOffset: number; }
|
|
16
|
+
export const DETAIL_CHROME_ROWS = 4;
|
|
17
|
+
const trim = (s: string, n: number) => Array.from(s).length <= n ? s : n <= 1 ? Array.from(s).slice(0, n).join("") : `${Array.from(s).slice(0, n - 1).join("")}…`;
|
|
18
|
+
|
|
19
|
+
/** Convert Pi's available model registry into stable, deduplicated picker rows. */
|
|
20
|
+
export function fleetModelChoices(models: readonly PiModelSummary[], current?: string): FleetModelChoice[] {
|
|
21
|
+
const bySpec = new Map<string, FleetModelChoice>();
|
|
22
|
+
for (const model of models) {
|
|
23
|
+
const provider = typeof model?.provider === "string" ? model.provider.trim() : "";
|
|
24
|
+
const id = typeof model?.id === "string" ? model.id.trim() : "";
|
|
25
|
+
if (!provider || !id) continue;
|
|
26
|
+
const spec = `${provider}/${id}`;
|
|
27
|
+
if (bySpec.has(spec)) continue;
|
|
28
|
+
const name = typeof model.name === "string" ? model.name.trim() : "";
|
|
29
|
+
const detail = name && name !== id ? ` — ${name}` : "";
|
|
30
|
+
bySpec.set(spec, { spec, label: `${spec}${detail}${spec === current ? " (current)" : ""}` });
|
|
31
|
+
}
|
|
32
|
+
return Array.from(bySpec.values()).sort((a, b) => a.spec.localeCompare(b.spec));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Render the model picker in the same full-screen layer as Fleet Detail. */
|
|
36
|
+
function renderChoicePicker(
|
|
37
|
+
heading: string,
|
|
38
|
+
footer: string,
|
|
39
|
+
choices: readonly FleetModelChoice[],
|
|
40
|
+
state: FleetModelPickerState,
|
|
41
|
+
width: number,
|
|
42
|
+
bodyHeight: number,
|
|
43
|
+
theme: ThemeLike,
|
|
44
|
+
): string[] {
|
|
45
|
+
const w = Math.max(1, width), body = Math.max(0, bodyHeight);
|
|
46
|
+
const maxOffset = Math.max(0, choices.length - body);
|
|
47
|
+
const offset = Math.max(0, Math.min(state.scrollOffset, maxOffset));
|
|
48
|
+
const rows = choices.slice(offset, offset + body).map((choice, visibleIndex) => {
|
|
49
|
+
const selected = offset + visibleIndex === state.index;
|
|
50
|
+
const line = trim(`${selected ? " ›" : " "} ${choice.label}`, w);
|
|
51
|
+
return selected ? theme.fg("accent", theme.bold(line)) : line;
|
|
52
|
+
});
|
|
53
|
+
const lines = [
|
|
54
|
+
theme.bold(trim(heading, w)),
|
|
55
|
+
theme.fg("dim", "╭" + "─".repeat(Math.max(0, w - 2)) + "╮"),
|
|
56
|
+
...rows,
|
|
57
|
+
...Array(Math.max(0, body - rows.length)).fill(""),
|
|
58
|
+
theme.fg("dim", "╰" + "─".repeat(Math.max(0, w - 2)) + "╯"),
|
|
59
|
+
theme.fg("dim", footer),
|
|
60
|
+
];
|
|
61
|
+
return lines.slice(0, body + DETAIL_CHROME_ROWS).concat(Array(Math.max(0, body + DETAIL_CHROME_ROWS - lines.length)).fill(""));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function renderFleetModelPicker(
|
|
65
|
+
title: string,
|
|
66
|
+
choices: readonly FleetModelChoice[],
|
|
67
|
+
state: FleetModelPickerState,
|
|
68
|
+
width: number,
|
|
69
|
+
bodyHeight: number,
|
|
70
|
+
theme: ThemeLike,
|
|
71
|
+
): string[] {
|
|
72
|
+
return renderChoicePicker(
|
|
73
|
+
` Model for ${title} · next run · ${choices.length} available`,
|
|
74
|
+
"↑↓ select · PgUp/PgDn page · Home/End · Enter apply · Esc cancel",
|
|
75
|
+
choices, state, width, bodyHeight, theme,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Render either step of the session-wide source → target substitution flow. */
|
|
80
|
+
export function renderFleetSubstitutionPicker(
|
|
81
|
+
stage: "source" | "target",
|
|
82
|
+
source: string | undefined,
|
|
83
|
+
choices: readonly FleetModelChoice[],
|
|
84
|
+
state: FleetModelPickerState,
|
|
85
|
+
width: number,
|
|
86
|
+
bodyHeight: number,
|
|
87
|
+
theme: ThemeLike,
|
|
88
|
+
): string[] {
|
|
89
|
+
const heading = stage === "source"
|
|
90
|
+
? ` Substitute model · 1/2 choose configured source · ${choices.length} known`
|
|
91
|
+
: ` Substitute ${source ?? "model"} · 2/2 choose available target · ${choices.length} available`;
|
|
92
|
+
const footer = stage === "source"
|
|
93
|
+
? "↑↓ select · PgUp/PgDn page · Home/End · Enter next · Esc cancel"
|
|
94
|
+
: "↑↓ select · PgUp/PgDn page · Home/End · Enter apply · Esc back";
|
|
95
|
+
return renderChoicePicker(heading, footer, choices, state, width, bodyHeight, theme);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type FleetDetailKey = "up" | "down" | "pageUp" | "pageDown" | "home" | "end" | "enter" | "escape" | "copy";
|
|
99
|
+
|
|
100
|
+
/** Convert a key identified by Pi's matcher into the detail controller's stable input. */
|
|
101
|
+
export function normalizeFleetDetailInput(data: string, key?: FleetDetailKey): string {
|
|
102
|
+
if (key === "up") return "\u001b[A";
|
|
103
|
+
if (key === "down") return "\u001b[B";
|
|
104
|
+
if (key === "pageUp") return "\u001b[5~";
|
|
105
|
+
if (key === "pageDown") return "\u001b[6~";
|
|
106
|
+
if (key === "home") return "\u001b[H";
|
|
107
|
+
if (key === "end") return "\u001b[F";
|
|
108
|
+
if (key === "enter") return "\r";
|
|
109
|
+
if (key === "escape") return "\u001b";
|
|
110
|
+
if (key === "copy") return "\u0003";
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Pure navigation for the inline model picker. */
|
|
115
|
+
export function modelPickerTransition(
|
|
116
|
+
input: string,
|
|
117
|
+
state: FleetModelPickerState,
|
|
118
|
+
choiceCount: number,
|
|
119
|
+
bodyHeight: number,
|
|
120
|
+
): "cancel" | "select" | null {
|
|
121
|
+
if (input === "\u001b" || input === "q" || input === "m") return "cancel";
|
|
122
|
+
if (input === "\r") return choiceCount > 0 ? "select" : null;
|
|
123
|
+
const page = Math.max(1, bodyHeight);
|
|
124
|
+
let next = state.index;
|
|
125
|
+
if (input === "\u001b[A" || input === "k") next--;
|
|
126
|
+
else if (input === "\u001b[B" || input === "j") next++;
|
|
127
|
+
else if (input === "\u001b[5~") next -= page;
|
|
128
|
+
else if (input === "\u001b[6~") next += page;
|
|
129
|
+
else if (input === "\u001b[H") next = 0;
|
|
130
|
+
else if (input === "\u001b[F") next = Math.max(0, choiceCount - 1);
|
|
131
|
+
else return null;
|
|
132
|
+
state.index = Math.max(0, Math.min(Math.max(0, choiceCount - 1), next));
|
|
133
|
+
if (state.index < state.scrollOffset) state.scrollOffset = state.index;
|
|
134
|
+
else if (state.index >= state.scrollOffset + page) state.scrollOffset = state.index - page + 1;
|
|
135
|
+
state.scrollOffset = Math.max(0, Math.min(state.scrollOffset, Math.max(0, choiceCount - page)));
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const isToolEntry = (entry: TimelineEntry | undefined) => entry?.kind === "tool" || entry?.kind === "tool-start" || entry?.kind === "tool-result";
|
|
140
|
+
|
|
141
|
+
function wrapPlainText(value: string, width: number): string[] {
|
|
142
|
+
const max = Math.max(1, width);
|
|
143
|
+
const output: string[] = [];
|
|
144
|
+
for (const sourceLine of value.split(/\r?\n/)) {
|
|
145
|
+
if (!sourceLine) { output.push(""); continue; }
|
|
146
|
+
let rest = sourceLine;
|
|
147
|
+
while (Array.from(rest).length > max) {
|
|
148
|
+
const chars = Array.from(rest);
|
|
149
|
+
let cut = max;
|
|
150
|
+
for (let i = max; i > Math.floor(max / 2); i--) if (/\s/.test(chars[i] ?? "")) { cut = i; break; }
|
|
151
|
+
output.push(chars.slice(0, cut).join("").trimEnd());
|
|
152
|
+
rest = chars.slice(cut).join("").trimStart();
|
|
153
|
+
}
|
|
154
|
+
output.push(rest);
|
|
155
|
+
}
|
|
156
|
+
return output;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function durationLabel(ms: number | undefined): string {
|
|
160
|
+
if (ms == null || !Number.isFinite(ms)) return "";
|
|
161
|
+
return ms < 1000 ? `${Math.max(0, Math.round(ms))}ms` : `${(Math.max(0, ms) / 1000).toFixed(2).replace(/0+$/, "").replace(/\.$/, "")}s`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function detailEntryLines(entry: TimelineEntry, index: number, width: number, expandedIndex: number | null, verbose: boolean, selectedIndex?: number): string[] {
|
|
165
|
+
const w = Math.max(1, width);
|
|
166
|
+
const icon = isToolEntry(entry) ? (entry.kind === "tool-result" ? "◂" : "▸") : entry.kind === "thinking" ? "·" : "•";
|
|
167
|
+
const selected = index === selectedIndex ? "›" : " ";
|
|
168
|
+
const meta = entry.kind === "tool-result"
|
|
169
|
+
? ` [${[entry.status, durationLabel(entry.durationMs)].filter(Boolean).join(" · ")}]`
|
|
170
|
+
: "";
|
|
171
|
+
if (!verbose) {
|
|
172
|
+
if (index === expandedIndex && isToolEntry(entry)) return [trim(`${selected}${icon} ${entry.title}${meta}`, w), ...entry.content.split(/\r?\n/).map(line => ` ${trim(line, Math.max(0, w - 3))}`)];
|
|
173
|
+
return [trim(`${selected}${icon} ${entry.title}${meta} ${entry.content.replace(/\s+/g, " ")}`, w)];
|
|
174
|
+
}
|
|
175
|
+
const heading = trim(`${selected}${icon} ${entry.title}`, w);
|
|
176
|
+
const metadata = meta ? wrapPlainText(meta.trim(), Math.max(1, w - 3)).map(line => trim(` ${line}`, w)) : [];
|
|
177
|
+
const payload = wrapPlainText(entry.content, Math.max(1, w - 3)).map(line => trim(` ${line}`, w));
|
|
178
|
+
return [heading, ...metadata, ...payload];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface DetailEntryOffset { index: number; start: number; end: number; }
|
|
182
|
+
|
|
183
|
+
/** Locate each logical event inside its wrapped visual lines. */
|
|
184
|
+
export function detailEntryOffsets(timeline: readonly TimelineEntry[], width: number, expandedIndex: number | null, verbose: boolean): DetailEntryOffset[] {
|
|
185
|
+
const offsets: DetailEntryOffset[] = [];
|
|
186
|
+
let cursor = 0;
|
|
187
|
+
for (let index = 0; index < timeline.length; index++) {
|
|
188
|
+
const length = detailEntryLines(timeline[index], index, width, expandedIndex, verbose).length;
|
|
189
|
+
offsets.push({ index, start: cursor, end: cursor + length });
|
|
190
|
+
cursor += length;
|
|
191
|
+
}
|
|
192
|
+
return offsets;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function detailContent(timeline: readonly TimelineEntry[], width: number, expandedIndex: number | null, verbose = false, selectedIndex?: number): string[] {
|
|
196
|
+
return timeline.flatMap((entry, index) => detailEntryLines(entry, index, width, expandedIndex, verbose, selectedIndex));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** Render a constant-height transcript detail screen, including the no-local-peer notice. */
|
|
200
|
+
export function renderFleetDetail(row: FleetRow, timeline: readonly TimelineEntry[], scrollOffset: number, width: number, bodyHeight: number, theme: ThemeLike, expandedIndex: number | null = null, verbose = false, selectedIndex?: number): string[] {
|
|
201
|
+
const w = Math.max(1, width), body = Math.max(0, bodyHeight);
|
|
202
|
+
const mode = verbose ? "Verbose" : "Compact";
|
|
203
|
+
const header = trim(` ${row.name} · ${mode} · ${row.status} · ${row.kind} · ${row.model} · ${row.backend} · ${row.contextPct == null ? "context automatic" : `${Math.round(row.contextPct)}%`} · ${Math.round(row.elapsed / 1000)}s · ${row.toolCount ?? "—"} tools`, w);
|
|
204
|
+
const lines = [theme.bold(header), theme.fg("dim", "╭" + "─".repeat(Math.max(0, w - 2)) + "╮")];
|
|
205
|
+
if (!row.hasTimeline) lines.push(...Array.from({ length: body }, (_, i) => i === 0 ? theme.fg("dim", " no local transcript for this coms peer") : ""));
|
|
206
|
+
else {
|
|
207
|
+
const content = detailContent(timeline, w, expandedIndex, verbose, selectedIndex);
|
|
208
|
+
const offset = Math.max(0, Math.min(scrollOffset, Math.max(0, content.length - body)));
|
|
209
|
+
lines.push(...content.slice(offset, offset + body), ...Array(Math.max(0, body - content.slice(offset, offset + body).length)).fill(""));
|
|
210
|
+
}
|
|
211
|
+
lines.push(theme.fg("dim", "╰" + "─".repeat(Math.max(0, w - 2)) + "╯"));
|
|
212
|
+
const modelHint = row.kind === "peer" ? "" : " · m model";
|
|
213
|
+
lines.push(theme.fg("dim", `↑↓ scroll · PgUp/PgDn page · End tail · Enter expand tool · v ${verbose ? "compact" : "verbose"} · Ctrl+C copy${modelHint} · Esc dashboard`));
|
|
214
|
+
return lines.slice(0, body + DETAIL_CHROME_ROWS).concat(Array(Math.max(0, body + DETAIL_CHROME_ROWS - lines.length)).fill(""));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Pure state transitions used by the harness detail controller. */
|
|
218
|
+
export function detailTransition(
|
|
219
|
+
input: string,
|
|
220
|
+
state: { scrollOffset: number; selectedIndex: number; expandedIndex: number | null; followTail: boolean; verbose?: boolean },
|
|
221
|
+
timeline: readonly TimelineEntry[],
|
|
222
|
+
bodyHeight: number,
|
|
223
|
+
contentLength = timeline.length,
|
|
224
|
+
offsets?: readonly DetailEntryOffset[],
|
|
225
|
+
): "close" | "copy" | "model" | null {
|
|
226
|
+
const viewport = Math.max(1, bodyHeight);
|
|
227
|
+
const max = Math.max(0, contentLength - viewport);
|
|
228
|
+
if (input === "\u001b" || input === "q") return "close";
|
|
229
|
+
if (input === "\u0003") return "copy";
|
|
230
|
+
if (input === "m") return "model";
|
|
231
|
+
if (input === "v") { state.verbose = !state.verbose; state.followTail = true; return null; }
|
|
232
|
+
if (input === "\u001b[F") { state.followTail = true; state.scrollOffset = max; state.selectedIndex = Math.max(0, timeline.length - 1); return null; }
|
|
233
|
+
if (input === "\u001b[H") { state.followTail = false; state.scrollOffset = 0; state.selectedIndex = 0; return null; }
|
|
234
|
+
if (input === "\r") { if (isToolEntry(timeline[state.selectedIndex])) state.expandedIndex = state.expandedIndex === state.selectedIndex ? null : state.selectedIndex; return null; }
|
|
235
|
+
const delta = input === "\u001b[A" || input === "k" ? -1 : input === "\u001b[B" || input === "j" ? 1 : input === "\u001b[5~" ? -bodyHeight : input === "\u001b[6~" ? bodyHeight : 0;
|
|
236
|
+
if (delta) {
|
|
237
|
+
state.followTail = false;
|
|
238
|
+
state.selectedIndex = Math.max(0, Math.min(Math.max(0, timeline.length - 1), state.selectedIndex + delta));
|
|
239
|
+
const selected = offsets?.[state.selectedIndex];
|
|
240
|
+
if (selected) {
|
|
241
|
+
if (selected.start < state.scrollOffset) state.scrollOffset = selected.start;
|
|
242
|
+
else if (selected.start >= state.scrollOffset + viewport) state.scrollOffset = selected.start - viewport + 1;
|
|
243
|
+
} else state.scrollOffset += delta;
|
|
244
|
+
state.scrollOffset = Math.max(0, Math.min(max, state.scrollOffset));
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Overlay options for a full-screen pi overlay. */
|
|
2
|
+
export const FULLSCREEN_OVERLAY = {
|
|
3
|
+
overlay: true as const,
|
|
4
|
+
overlayOptions: { anchor: "center", width: "100%", maxHeight: "100%" },
|
|
5
|
+
} as const;
|
|
6
|
+
|
|
7
|
+
/** Minimum body height below which an overlay degrades rather than breaks. */
|
|
8
|
+
export const MIN_BODY_ROWS = 6;
|
|
9
|
+
|
|
10
|
+
/** Return the fixed scrolling-body budget for a terminal. */
|
|
11
|
+
export function bodyRows(terminalRows: number | undefined, chromeRows: number, min = MIN_BODY_ROWS): number {
|
|
12
|
+
const rows = terminalRows && terminalRows > 0 ? terminalRows : 30;
|
|
13
|
+
return Math.max(min, rows - 1 - Math.max(0, chromeRows));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Pad with empty strings or truncate to exactly n lines. */
|
|
17
|
+
export function fitToHeight(lines: readonly string[], n: number): string[] {
|
|
18
|
+
const height = Math.max(0, n);
|
|
19
|
+
return [...lines.slice(0, height), ...Array(Math.max(0, height - lines.length)).fill("")];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Clamp a scroll offset to the available content window. */
|
|
23
|
+
export function clampScroll(offset: number, contentLength: number, viewport: number): number {
|
|
24
|
+
const max = Math.max(0, contentLength - Math.max(0, viewport));
|
|
25
|
+
return Math.max(0, Math.min(offset, max));
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface PanelResources {
|
|
2
|
+
every(ms: number, fn: () => void): void;
|
|
3
|
+
onDispose(fn: () => void): void;
|
|
4
|
+
dispose(): void;
|
|
5
|
+
readonly closed: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Own timers and cleanup callbacks for one disposable overlay component. */
|
|
9
|
+
export function createPanelResources(): PanelResources {
|
|
10
|
+
let closed = false;
|
|
11
|
+
const teardowns: Array<() => void> = [];
|
|
12
|
+
return {
|
|
13
|
+
every(ms, fn) {
|
|
14
|
+
if (closed) return;
|
|
15
|
+
const timer = setInterval(fn, ms);
|
|
16
|
+
teardowns.push(() => clearInterval(timer));
|
|
17
|
+
},
|
|
18
|
+
onDispose(fn) {
|
|
19
|
+
if (closed) {
|
|
20
|
+
fn();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
teardowns.push(fn);
|
|
24
|
+
},
|
|
25
|
+
dispose() {
|
|
26
|
+
if (closed) return;
|
|
27
|
+
closed = true;
|
|
28
|
+
for (const teardown of teardowns.splice(0)) {
|
|
29
|
+
try { teardown(); } catch {}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
get closed() { return closed; },
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export type FleetKind = "specialist" | "research" | "delegate" | "peer";
|
|
2
|
+
export type FleetStatus = "idle" | "running" | "done" | "error" | "pending" | "stale";
|
|
3
|
+
|
|
4
|
+
export interface FleetRow {
|
|
5
|
+
key: string;
|
|
6
|
+
kind: FleetKind;
|
|
7
|
+
name: string;
|
|
8
|
+
parentKey?: string;
|
|
9
|
+
depth: number;
|
|
10
|
+
status: FleetStatus;
|
|
11
|
+
model: string;
|
|
12
|
+
backend: "native" | "coms";
|
|
13
|
+
contextPct: number | null;
|
|
14
|
+
contextTokens: number | null;
|
|
15
|
+
elapsed: number;
|
|
16
|
+
startedAt?: number;
|
|
17
|
+
toolCount: number | null;
|
|
18
|
+
lastWork: string;
|
|
19
|
+
hasTimeline: boolean;
|
|
20
|
+
colorHex?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface DelegateInput extends Omit<FleetRow, "kind" | "parentKey" | "depth" | "backend" | "hasTimeline"> {
|
|
24
|
+
children?: readonly DelegateInput[];
|
|
25
|
+
}
|
|
26
|
+
export interface SpecialistInput extends Omit<FleetRow, "kind" | "parentKey" | "depth"> {
|
|
27
|
+
delegates?: readonly DelegateInput[];
|
|
28
|
+
}
|
|
29
|
+
export interface ResearchInput extends Omit<FleetRow, "kind" | "parentKey" | "depth"> {}
|
|
30
|
+
export interface PeerInput extends Omit<FleetRow, "kind" | "parentKey" | "depth" | "backend" | "hasTimeline" | "status" | "contextPct" | "contextTokens" | "toolCount" | "elapsed"> {
|
|
31
|
+
/** Registry-only entries have not answered a ping. */
|
|
32
|
+
pending?: boolean;
|
|
33
|
+
staleCount?: number;
|
|
34
|
+
status?: FleetStatus;
|
|
35
|
+
elapsed?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface FleetSource {
|
|
38
|
+
specialists: readonly SpecialistInput[];
|
|
39
|
+
research: readonly ResearchInput[];
|
|
40
|
+
peers: readonly PeerInput[];
|
|
41
|
+
}
|
|
42
|
+
export interface FleetFilter { showFinished: boolean; query?: string; }
|
|
43
|
+
|
|
44
|
+
/** Convert an authoritative run interval into row timing without re-anchoring completed work. */
|
|
45
|
+
export function fleetTiming(interval: { startedAt: number; endedAt: number | null } | undefined, now = Date.now()): Pick<FleetRow, "startedAt" | "elapsed"> {
|
|
46
|
+
if (!interval) return { startedAt: undefined, elapsed: 0 };
|
|
47
|
+
const endedAt = interval.endedAt ?? now;
|
|
48
|
+
return { startedAt: interval.startedAt, elapsed: Math.max(0, endedAt - interval.startedAt) };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const statusOrder: Record<FleetStatus, number> = { running: 0, pending: 1, error: 2, done: 3, idle: 3, stale: 3 };
|
|
52
|
+
// A roster member is idle until dispatched, not finished; keep it visible by default.
|
|
53
|
+
const hiddenWhenFinished = new Set<FleetStatus>(["done", "stale"]);
|
|
54
|
+
|
|
55
|
+
function compareRows(a: FleetRow, b: FleetRow): number {
|
|
56
|
+
return statusOrder[a.status] - statusOrder[b.status]
|
|
57
|
+
|| (a.startedAt ?? Number.MAX_SAFE_INTEGER) - (b.startedAt ?? Number.MAX_SAFE_INTEGER)
|
|
58
|
+
|| a.key.localeCompare(b.key);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function matches(row: FleetRow, query: string): boolean {
|
|
62
|
+
return `${row.name} ${row.model} ${row.lastWork}`.toLowerCase().includes(query);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface FleetNode { row: FleetRow; children: FleetNode[]; }
|
|
66
|
+
|
|
67
|
+
/** Collapse local specialists, delegate trees, research, and coms peers into stable display rows. */
|
|
68
|
+
export function buildFleetRows(src: FleetSource, filter: FleetFilter): FleetRow[] {
|
|
69
|
+
const query = filter.query?.trim().toLowerCase() ?? "";
|
|
70
|
+
const roots: FleetNode[] = [];
|
|
71
|
+
const delegate = (input: DelegateInput, parentKey: string, depth: number): FleetNode => ({
|
|
72
|
+
row: { ...input, kind: "delegate", parentKey, depth, backend: "native", hasTimeline: true },
|
|
73
|
+
children: (input.children ?? []).map(child => delegate(child, input.key, depth + 1)).sort((a, b) => compareRows(a.row, b.row)),
|
|
74
|
+
});
|
|
75
|
+
for (const input of src.specialists) roots.push({
|
|
76
|
+
row: { ...input, kind: "specialist", depth: 0 },
|
|
77
|
+
children: (input.delegates ?? []).map(child => delegate(child, input.key, 1)).sort((a, b) => compareRows(a.row, b.row)),
|
|
78
|
+
});
|
|
79
|
+
for (const input of src.research) roots.push({ row: { ...input, kind: "research", depth: 0 }, children: [] });
|
|
80
|
+
for (const input of src.peers) {
|
|
81
|
+
const status: FleetStatus = input.pending ? "pending" : (input.staleCount ?? 0) >= 3 ? "stale" : (input.status ?? "idle");
|
|
82
|
+
roots.push({ row: { ...input, kind: "peer", depth: 0, status, backend: "coms", contextPct: null, contextTokens: null, toolCount: null, elapsed: input.elapsed ?? 0, hasTimeline: false }, children: [] });
|
|
83
|
+
}
|
|
84
|
+
roots.sort((a, b) => compareRows(a.row, b.row));
|
|
85
|
+
const visible = (node: FleetNode): boolean => {
|
|
86
|
+
const children = node.children.filter(visible);
|
|
87
|
+
node.children = children;
|
|
88
|
+
const own = (filter.showFinished || !hiddenWhenFinished.has(node.row.status)) && (!query || matches(node.row, query));
|
|
89
|
+
return own || children.length > 0;
|
|
90
|
+
};
|
|
91
|
+
const out: FleetRow[] = [];
|
|
92
|
+
const emit = (node: FleetNode) => {
|
|
93
|
+
out.push(node.row);
|
|
94
|
+
for (const child of node.children) emit(child);
|
|
95
|
+
};
|
|
96
|
+
for (const root of roots) if (visible(root)) emit(root);
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Total covered length of possibly overlapping intervals. */
|
|
101
|
+
export function unionMs(intervals: readonly [number, number][]): number {
|
|
102
|
+
if (intervals.length === 0) return 0;
|
|
103
|
+
const sorted = intervals.slice().sort((a, b) => a[0] - b[0]);
|
|
104
|
+
let total = 0;
|
|
105
|
+
let start = sorted[0][0];
|
|
106
|
+
let end = sorted[0][1];
|
|
107
|
+
for (let i = 1; i < sorted.length; i++) {
|
|
108
|
+
const [nextStart, nextEnd] = sorted[i];
|
|
109
|
+
if (nextStart > end) {
|
|
110
|
+
total += end - start;
|
|
111
|
+
[start, end] = [nextStart, nextEnd];
|
|
112
|
+
} else if (nextEnd > end) {
|
|
113
|
+
end = nextEnd;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return total + end - start;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Aggregate visible rows; callers use unionMs(intervals) for overlap-aware wall time. */
|
|
120
|
+
export function summarise(rows: readonly FleetRow[]): { running: number; done: number; failed: number; totalTokens: number; intervals: Array<[number, number]> } {
|
|
121
|
+
const intervals: Array<[number, number]> = [];
|
|
122
|
+
let running = 0, done = 0, failed = 0, totalTokens = 0;
|
|
123
|
+
for (const row of rows) {
|
|
124
|
+
if (row.status === "running") running++;
|
|
125
|
+
if (row.status === "done") done++;
|
|
126
|
+
if (row.status === "error") failed++;
|
|
127
|
+
if (row.contextTokens != null) totalTokens += row.contextTokens;
|
|
128
|
+
if (row.startedAt != null) intervals.push([row.startedAt, row.startedAt + Math.max(0, row.elapsed)]);
|
|
129
|
+
}
|
|
130
|
+
return { running, done, failed, totalTokens, intervals };
|
|
131
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface Selection {
|
|
2
|
+
key?: string;
|
|
3
|
+
index: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** Keep selection on its stable key where possible, otherwise clamp its index. */
|
|
7
|
+
export function reconcileSelection(sel: Selection, rows: readonly { key: string }[]): void {
|
|
8
|
+
if (rows.length === 0) {
|
|
9
|
+
sel.index = 0;
|
|
10
|
+
sel.key = undefined;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const keyedIndex = sel.key === undefined ? -1 : rows.findIndex((row) => row.key === sel.key);
|
|
14
|
+
sel.index = keyedIndex >= 0 ? keyedIndex : Math.max(0, Math.min(sel.index, rows.length - 1));
|
|
15
|
+
sel.key = rows[sel.index].key;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Move selection by delta, clamped without wraparound. */
|
|
19
|
+
export function moveSelection(sel: Selection, rows: readonly { key: string }[], delta: number): void {
|
|
20
|
+
reconcileSelection(sel, rows);
|
|
21
|
+
if (rows.length === 0) return;
|
|
22
|
+
sel.index = Math.max(0, Math.min(rows.length - 1, sel.index + delta));
|
|
23
|
+
sel.key = rows[sel.index].key;
|
|
24
|
+
}
|