@chankov/agent-fleet 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/extensions/pi-voice-stt/README.md +24 -5
- package/.pi/extensions/pi-voice-stt/examples/stt.json +4 -4
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/return-contract.js +34 -0
- package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +80 -18
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.10/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.10/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/coms-claude-bridge.ts +411 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/fleet.ts +216 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/flow.ts +137 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +210 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/flow-command.ts +93 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +133 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.10/.pi/agent-fleet/scripts/workflows/wf-scout.ts +38 -0
- package/.versions/2.0.10/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.10/.pi/agents/model-profiles.yaml +83 -0
- package/.versions/2.0.10/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.10/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.10/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.10/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.10/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.10/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.10/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.10/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.10/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.10/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.10/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.10/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.10/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.10/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.10/.pi/extensions/package.json +9 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.10/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/README.md +1217 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/acceptance.ts +62 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/budget-recovery.ts +97 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/context.ts +43 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/config/agents.ts +177 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/config/model-profiles.ts +216 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/config/overrides.ts +153 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +213 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context/budgets.ts +202 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/context-window.js +106 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/delegate.ts +446 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-coms.ts +237 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native-complete.ts +154 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +156 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +193 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native-types.ts +230 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-native.ts +213 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/docs-lane.js +122 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/drift-watchdog.js +218 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/fixtures/registration-surface.json +57 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/helpers.ts +266 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/hub-state-audit.js +64 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/index.ts +2132 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/input/completions.ts +76 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +123 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/no-progress.ts +76 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/policy/work-mode.ts +119 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/prompts/context.ts +47 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/prompts/fragments.ts +115 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/prompts/system-prompt.ts +112 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/research/runtime.ts +192 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/research/spawn-run.ts +156 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/return-contract.js +327 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/return-extract.js +75 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/review-findings.js +102 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/run-budget.js +537 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/run-namespace.js +87 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/scope-gate.js +123 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/spawn.ts +404 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/timeline.ts +54 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/action-executors.ts +149 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/context.ts +134 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +82 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +335 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/herdr-executors.ts +86 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/set-task-tier.ts +29 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/spawn-research.ts +62 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/tools/verification-contract.ts +77 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/types.ts +63 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/activity-dots.ts +16 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/context-budget.ts +86 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/detail-panel.ts +178 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/fleet-actions.ts +76 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +99 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/fleet-source.ts +157 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/grid.ts +154 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/ui/zoom.ts +204 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.10/.pi/harnesses/agent-hub/work-mode.ts +167 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.10/.pi/harnesses/ask-user-remote/runtime-ask.ts +43 -0
- package/.versions/2.0.10/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.10/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.10/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.10/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.10/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.10/.pi/harnesses/damage-control-continue/index.ts +541 -0
- package/.versions/2.0.10/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.10/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.10/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.10/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.10/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.10/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.10/.pi/harnesses/lib/context-budget-child-prompt.ts +180 -0
- package/.versions/2.0.10/.pi/harnesses/lib/context-budget-hub-prompt.ts +114 -0
- package/.versions/2.0.10/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.10/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.10/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-dashboard-view.ts +134 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-detail-view.ts +247 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-read-model.ts +213 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-strip-controller.ts +74 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-strip-view.ts +132 -0
- package/.versions/2.0.10/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.10/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.10/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.10/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.10/.pi/harnesses/lib/spawned-peers.js +190 -0
- package/.versions/2.0.10/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.10/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.10/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.10/.pi/prompts/af-build.md +24 -0
- package/.versions/2.0.10/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.10/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.10/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.10/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.10/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.10/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.10/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.10/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.10/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.10/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.10/.version +1 -0
- package/.versions/2.0.10/agents/architect.md +25 -0
- package/.versions/2.0.10/agents/bowser.md +28 -0
- package/.versions/2.0.10/agents/builder.md +56 -0
- package/.versions/2.0.10/agents/code-reviewer.md +210 -0
- package/.versions/2.0.10/agents/deep-researcher.md +33 -0
- package/.versions/2.0.10/agents/documenter.md +23 -0
- package/.versions/2.0.10/agents/orchestrator.md +23 -0
- package/.versions/2.0.10/agents/plan-reviewer.md +84 -0
- package/.versions/2.0.10/agents/planner.md +106 -0
- package/.versions/2.0.10/agents/releaser.md +25 -0
- package/.versions/2.0.10/agents/researcher.md +31 -0
- package/.versions/2.0.10/agents/security-auditor.md +168 -0
- package/.versions/2.0.10/agents/test-engineer.md +154 -0
- package/.versions/2.0.10/agents/web-debugger.md +44 -0
- package/.versions/2.0.10/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.10/bin/catalog/harness-runtime-closure.json +32 -0
- package/.versions/2.0.10/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.10/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.10/docs/ARCHITECTURE.md +416 -0
- package/.versions/2.0.10/docs/agent-fleet-setup.md +586 -0
- package/.versions/2.0.10/docs/claude-code-coms-bridge.md +134 -0
- package/.versions/2.0.10/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.10/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.10/docs/getting-started.md +126 -0
- package/.versions/2.0.10/docs/npm-install.md +383 -0
- package/.versions/2.0.10/docs/pi-extensions.md +449 -0
- package/.versions/2.0.10/docs/pi-setup.md +92 -0
- package/.versions/2.0.10/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.10/install-manifest.json +2991 -0
- package/.versions/2.0.10/justfile +247 -0
- package/.versions/2.0.10/manifest-meta.json +970 -0
- package/.versions/2.0.10/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.10/references/communication-contract.md +26 -0
- package/.versions/2.0.10/references/definition-of-done.md +67 -0
- package/.versions/2.0.10/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.10/references/observability-checklist.md +92 -0
- package/.versions/2.0.10/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.10/references/performance-checklist.md +236 -0
- package/.versions/2.0.10/references/prompting-patterns.md +380 -0
- package/.versions/2.0.10/references/security-checklist.md +245 -0
- package/.versions/2.0.10/references/testing-patterns.md +235 -0
- package/.versions/2.0.10/references/workflow-authoring.md +304 -0
- package/.versions/2.0.10/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.10/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.10/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.10/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.10/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.10/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.10/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.10/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.10/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.10/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.10/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.10/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.10/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.10/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.10/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.10/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.10/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.10/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.10/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.10/skills/incremental-implementation/SKILL.md +302 -0
- package/.versions/2.0.10/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.10/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.10/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.10/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.10/skills/planning-and-task-breakdown/SKILL.md +289 -0
- package/.versions/2.0.10/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.10/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.10/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.10/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +11 -0
- package/agents/architect.md +1 -1
- package/agents/bowser.md +1 -1
- package/agents/builder.md +1 -1
- package/agents/code-reviewer.md +1 -1
- package/agents/deep-researcher.md +1 -1
- package/agents/documenter.md +1 -1
- package/agents/orchestrator.md +1 -1
- package/agents/plan-reviewer.md +1 -1
- package/agents/planner.md +1 -1
- package/agents/releaser.md +1 -1
- package/agents/researcher.md +1 -1
- package/agents/security-auditor.md +1 -1
- package/agents/test-engineer.md +1 -1
- package/agents/web-debugger.md +1 -1
- package/agents/web-performance-auditor.md +1 -1
- package/bin/cli.js +8 -5
- package/bin/lib/path-boundaries.js +5 -6
- package/bin/lib/stt-wizard.js +154 -23
- package/docs/agent-fleet-setup.md +26 -8
- package/docs/npm-install.md +29 -2
- package/docs/pi-setup.md +16 -0
- package/install-manifest.json +1 -1
- package/package.json +13 -3
- package/skills/orchestration-verification/SKILL.md +1 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// Pure state helpers for the btw extension. Keep this file free of pi runtime imports so
|
|
2
|
+
// behavior that affects retention, elapsed timing, and transcript bounds stays testable
|
|
3
|
+
// with `node --test .pi/extensions/btw/state.test.js`.
|
|
4
|
+
|
|
5
|
+
export const MAX_RETAINED_TERMINAL_THREADS = 12;
|
|
6
|
+
export const MAX_TIMELINE_ENTRIES = 200;
|
|
7
|
+
export const MAX_TIMELINE_ENTRY_CHARS = 12_000;
|
|
8
|
+
export const MAX_SELECTED_MARKDOWN_CHARS = 20_000;
|
|
9
|
+
export const CARD_PREVIEW_LINES = 6;
|
|
10
|
+
export const CARD_PREVIEW_LINE_CHARS = 240;
|
|
11
|
+
|
|
12
|
+
export const TIMELINE_TRUNCATION_MARKER = "\n… [truncated]";
|
|
13
|
+
export const MODAL_TRUNCATION_MARKER = "\n… [truncated for modal]";
|
|
14
|
+
|
|
15
|
+
export function isTerminalStatus(status) {
|
|
16
|
+
return status === "done" || status === "error";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function beginTurn(thread, now) {
|
|
20
|
+
return {
|
|
21
|
+
...thread,
|
|
22
|
+
status: "running",
|
|
23
|
+
turnStartedAt: now,
|
|
24
|
+
turnFinishedAt: undefined,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function steerTurn(thread) {
|
|
29
|
+
return {
|
|
30
|
+
...thread,
|
|
31
|
+
status: "running",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function finishTurn(thread, now, status = thread.status) {
|
|
36
|
+
return {
|
|
37
|
+
...thread,
|
|
38
|
+
status,
|
|
39
|
+
turnFinishedAt: now,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function turnElapsedMs(thread, now = Date.now()) {
|
|
44
|
+
if (typeof thread.turnStartedAt !== "number") return 0;
|
|
45
|
+
const end = typeof thread.turnFinishedAt === "number" ? thread.turnFinishedAt : now;
|
|
46
|
+
return Math.max(0, end - thread.turnStartedAt);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function truncateText(text, maxChars, marker = TIMELINE_TRUNCATION_MARKER) {
|
|
50
|
+
const value = typeof text === "string" ? text : text == null ? "" : String(text);
|
|
51
|
+
if (value.length <= maxChars) return value;
|
|
52
|
+
if (maxChars <= 0) return "";
|
|
53
|
+
if (marker.length >= maxChars) return marker.slice(0, maxChars);
|
|
54
|
+
return value.slice(0, maxChars - marker.length) + marker;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function formatBtwCardPreview(text, lines = CARD_PREVIEW_LINES, maxLineChars = CARD_PREVIEW_LINE_CHARS) {
|
|
58
|
+
const value = typeof text === "string" ? text : text == null ? "" : String(text);
|
|
59
|
+
const parts = value.split("\n");
|
|
60
|
+
const head = parts
|
|
61
|
+
.slice(0, lines)
|
|
62
|
+
.map((line) => truncateText(line, maxLineChars, "…"))
|
|
63
|
+
.join("\n");
|
|
64
|
+
return parts.length > lines ? `${head}\n…` : head;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function formatBtwResultMarkdown({ note, ok, elapsedMs, sessionFile, answer }) {
|
|
68
|
+
return `# btw result\n\n- task: ${note}\n- ok: ${ok}\n- elapsed: ${Math.round(elapsedMs / 1000)}s\n- session: ${sessionFile}\n\n---\n\n${answer}\n`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function capTimelineContent(content) {
|
|
72
|
+
return truncateText(content, MAX_TIMELINE_ENTRY_CHARS, TIMELINE_TRUNCATION_MARKER);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function capSelectedMarkdown(content) {
|
|
76
|
+
return truncateText(content, MAX_SELECTED_MARKDOWN_CHARS, MODAL_TRUNCATION_MARKER);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function normalizeEntry(entry, now) {
|
|
80
|
+
return {
|
|
81
|
+
...entry,
|
|
82
|
+
content: capTimelineContent(entry.content ?? ""),
|
|
83
|
+
timestamp: typeof entry.timestamp === "number" ? entry.timestamp : now,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function pruneTimeline(timeline, maxEntries = MAX_TIMELINE_ENTRIES) {
|
|
88
|
+
const overflow = Math.max(0, timeline.length - maxEntries);
|
|
89
|
+
return {
|
|
90
|
+
timeline: overflow > 0 ? timeline.slice(overflow) : timeline,
|
|
91
|
+
prunedCount: overflow,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function appendTimelineEntry(timeline, entry, now = Date.now(), maxEntries = MAX_TIMELINE_ENTRIES) {
|
|
96
|
+
return pruneTimeline([...timeline, normalizeEntry(entry, now)], maxEntries);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function appendTimelineDelta(timeline, kind, delta, now = Date.now(), maxEntries = MAX_TIMELINE_ENTRIES) {
|
|
100
|
+
if (!delta) return { timeline, prunedCount: 0 };
|
|
101
|
+
const next = timeline.slice();
|
|
102
|
+
const last = next[next.length - 1];
|
|
103
|
+
if (last && last.kind === kind) {
|
|
104
|
+
next[next.length - 1] = {
|
|
105
|
+
...last,
|
|
106
|
+
content: capTimelineContent(`${last.content ?? ""}${delta}`),
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
next.push(normalizeEntry({ kind, title: kind === "text" ? "Assistant" : "Thinking", content: delta }, now));
|
|
110
|
+
}
|
|
111
|
+
return pruneTimeline(next, maxEntries);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function statusFor(statusById, id) {
|
|
115
|
+
if (statusById instanceof Map) return statusById.get(id);
|
|
116
|
+
return statusById?.[id];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function planTerminalRetention(order, statusById, maxRetained = MAX_RETAINED_TERMINAL_THREADS) {
|
|
120
|
+
const terminalIds = order.filter((id) => isTerminalStatus(statusFor(statusById, id)));
|
|
121
|
+
const evictCount = Math.max(0, terminalIds.length - maxRetained);
|
|
122
|
+
const evictedIds = terminalIds.slice(0, evictCount);
|
|
123
|
+
if (evictedIds.length === 0) return { evictedIds, order: order.slice() };
|
|
124
|
+
const evicted = new Set(evictedIds);
|
|
125
|
+
return {
|
|
126
|
+
evictedIds,
|
|
127
|
+
order: order.filter((id) => !evicted.has(id)),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function mostRecentThreadId(order) {
|
|
132
|
+
return order.length > 0 ? order[order.length - 1] : undefined;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function resolveThreadId(preferredId, order) {
|
|
136
|
+
return preferredId && order.includes(preferredId) ? preferredId : mostRecentThreadId(order);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function reconcileThreadView({ order, lastViewedId, currentId }) {
|
|
140
|
+
return {
|
|
141
|
+
lastViewedId: resolveThreadId(lastViewedId, order),
|
|
142
|
+
currentId: currentId === undefined ? undefined : resolveThreadId(currentId, order),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function clamp(value, min, max) {
|
|
147
|
+
return Math.min(max, Math.max(min, Number.isFinite(value) ? Math.trunc(value) : min));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function clampModalView(view, itemCount, rows) {
|
|
151
|
+
const count = Math.max(0, Math.trunc(itemCount || 0));
|
|
152
|
+
const page = Math.max(1, Math.floor((rows || 1) / 3));
|
|
153
|
+
const maxIndex = Math.max(0, count - 1);
|
|
154
|
+
const followTail = Boolean(view.followTail);
|
|
155
|
+
let selectedIndex = followTail && count > 0 ? maxIndex : clamp(view.selectedIndex ?? 0, 0, maxIndex);
|
|
156
|
+
let scrollOffset = clamp(view.scrollOffset ?? 0, 0, Math.max(0, count - page));
|
|
157
|
+
|
|
158
|
+
if (count === 0) {
|
|
159
|
+
return { ...view, selectedIndex: 0, scrollOffset: 0, followTail };
|
|
160
|
+
}
|
|
161
|
+
if (selectedIndex < scrollOffset) scrollOffset = selectedIndex;
|
|
162
|
+
else if (selectedIndex >= scrollOffset + page) scrollOffset = selectedIndex - page + 1;
|
|
163
|
+
scrollOffset = clamp(scrollOffset, 0, Math.max(0, count - page));
|
|
164
|
+
|
|
165
|
+
return { ...view, selectedIndex, scrollOffset, followTail };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function shiftModalViewForPrunedEntries(view, prunedCount, itemCount, rows) {
|
|
169
|
+
const n = Math.max(0, Math.trunc(prunedCount || 0));
|
|
170
|
+
return clampModalView(
|
|
171
|
+
{
|
|
172
|
+
...view,
|
|
173
|
+
selectedIndex: Math.max(0, (view.selectedIndex ?? 0) - n),
|
|
174
|
+
scrollOffset: Math.max(0, (view.scrollOffset ?? 0) - n),
|
|
175
|
+
},
|
|
176
|
+
itemCount,
|
|
177
|
+
rows,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# chrome-devtools-mcp
|
|
2
|
+
|
|
3
|
+
A pi extension that bridges the [`chrome-devtools-mcp`](https://www.npmjs.com/package/chrome-devtools-mcp) server into pi as native tools.
|
|
4
|
+
|
|
5
|
+
Built on top of `../mcp-bridge/` — this file is a thin wrapper that supplies Chrome-specific config.
|
|
6
|
+
|
|
7
|
+
## What you get
|
|
8
|
+
|
|
9
|
+
After installing, pi exposes the full Chrome DevTools MCP toolset under the `chrome_devtools__` prefix (e.g. `chrome_devtools__navigate`, `chrome_devtools__click`, etc.). A status command `/af-chrome-devtools-status` reports whether the bridge connected.
|
|
10
|
+
|
|
11
|
+
This unlocks the workflow described in `skills/browser-testing-with-devtools/` for pi users.
|
|
12
|
+
|
|
13
|
+
## When to use this vs `bowser`
|
|
14
|
+
|
|
15
|
+
These tools are the **interactive** browser stack — a live headful Chrome with `chrome_devtools__*` DOM/console/network/performance tools, driven by the `web-debugger` persona (run it as a coms peer so the extension loads into its process — see `.pi/agents/peers.yaml`). For **automated, headless, parallel** browser work that can run as a dispatched `--no-extensions` subagent, use the `bowser` persona / `.pi/skills/bowser/` instead (it drives `playwright-cli` over Bash). They are complementary; the full decision lives in [docs/pi-extensions.md](../../../docs/pi-extensions.md#two-browser-stacks--when-to-use-which).
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
The bridge launches headed (interactive) by default. Override via env vars before starting pi (the MCP server starts once at extension load, so a change needs a pi restart / `/reload` to take effect):
|
|
20
|
+
|
|
21
|
+
| Variable | Effect |
|
|
22
|
+
|----------|--------|
|
|
23
|
+
| `PI_CHROME_DEVTOOLS_MODE` | `headless` runs Chrome with no UI (background / CI); anything else (default) is headed. |
|
|
24
|
+
| `PI_CHROME_DEVTOOLS_BROWSER_URL` | Attach to an already-running Chrome (e.g. `http://127.0.0.1:9222`) instead of launching one. When set, mode/profile flags are governed by that instance. |
|
|
25
|
+
| `PI_CHROME_DEVTOOLS_USER_DATA_DIR` | Use a persistent Chrome profile at this path (cookies/storage survive restarts). Mutually exclusive with the default ephemeral `--isolated` profile. |
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
PI_CHROME_DEVTOOLS_MODE=headless pi # background/headless
|
|
29
|
+
PI_CHROME_DEVTOOLS_MODE=headed pi # interactive (default)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx @chankov/agent-fleet install --agent pi --allow-exec --yes \
|
|
36
|
+
--items pi-extension:mcp-bridge,pi-extension:chrome-devtools-mcp
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Select both: `mcp-bridge` is a sibling library that `chrome-devtools-mcp` imports via a relative path, so it must sit beside it under `.pi/extensions/`. Runtime dependencies live in `.pi/extensions/package.json`, which is copied in with the extensions; `--allow-exec` runs `npm ci --prefix .pi/extensions` as part of the install, and without it that step is printed and left for you (see [docs/pi-setup.md](../../../docs/pi-setup.md#optional-pi-extensions)). They are also root production dependencies of the published package, so a pi-package install resolves them from the package root.
|
|
40
|
+
|
|
41
|
+
## Verify
|
|
42
|
+
|
|
43
|
+
Run `pi` from the project, then:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
/af-chrome-devtools-status
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Expect: `Chrome DevTools MCP connected. Registered N tool(s).`
|
|
50
|
+
|
|
51
|
+
Type `chrome_devtools__` in tool autocomplete to see the wrapped tools.
|
|
52
|
+
|
|
53
|
+
## Note
|
|
54
|
+
|
|
55
|
+
This extension exists because pi does not yet have first-class MCP infrastructure. Once pi supports MCP servers natively, this wrapper will be retired in favor of the native mechanism.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { createMcpBridgeExtension } from "../mcp-bridge/index.js";
|
|
3
|
+
|
|
4
|
+
const GUI_ENV_KEYS = [
|
|
5
|
+
"DISPLAY",
|
|
6
|
+
"XAUTHORITY",
|
|
7
|
+
"WAYLAND_DISPLAY",
|
|
8
|
+
"XDG_RUNTIME_DIR",
|
|
9
|
+
"XDG_SESSION_TYPE",
|
|
10
|
+
"XDG_CURRENT_DESKTOP",
|
|
11
|
+
"DBUS_SESSION_BUS_ADDRESS",
|
|
12
|
+
] as const;
|
|
13
|
+
|
|
14
|
+
const NODE_WEBSTORAGE_DISABLE_OPTION = "--no-experimental-webstorage";
|
|
15
|
+
|
|
16
|
+
function appendNodeOption(current: string | undefined, option: string): string {
|
|
17
|
+
const parts = current?.trim() ? current.trim().split(/\s+/) : [];
|
|
18
|
+
if (!parts.includes(option)) parts.push(option);
|
|
19
|
+
return parts.join(" ");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function supportsNoExperimentalWebStorage(): boolean {
|
|
23
|
+
const major = Number.parseInt(process.versions.node.split(".")[0] ?? "0", 10);
|
|
24
|
+
return major >= 25;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Build the chrome-devtools-mcp CLI args from env, so the same always-on extension
|
|
28
|
+
// can run headed (default, for interactive debugging) or headless (for background /
|
|
29
|
+
// CI runs), and can attach to or persist a profile:
|
|
30
|
+
//
|
|
31
|
+
// PI_CHROME_DEVTOOLS_MODE=headless|headed (default: headed) → adds --headless
|
|
32
|
+
// PI_CHROME_DEVTOOLS_BROWSER_URL=http://127.0.0.1:9222 → attaches via --browserUrl
|
|
33
|
+
// PI_CHROME_DEVTOOLS_USER_DATA_DIR=/path/to/profile → persistent --userDataDir
|
|
34
|
+
//
|
|
35
|
+
// The MCP server is launched once at extension load, so changing these requires a
|
|
36
|
+
// pi reload (restart / `/reload`) to take effect.
|
|
37
|
+
function buildChromeDevToolsArgs(): string[] {
|
|
38
|
+
const args = ["-y", "chrome-devtools-mcp@latest", "--no-usage-statistics", "--no-performance-crux"];
|
|
39
|
+
|
|
40
|
+
const browserUrl = process.env.PI_CHROME_DEVTOOLS_BROWSER_URL?.trim();
|
|
41
|
+
if (browserUrl) {
|
|
42
|
+
// Attaching to an already-running Chrome — launch-time flags (headless, profile)
|
|
43
|
+
// are governed by that instance, so don't pass them.
|
|
44
|
+
args.push("--browserUrl", browserUrl);
|
|
45
|
+
return args;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (process.env.PI_CHROME_DEVTOOLS_MODE?.trim().toLowerCase() === "headless") {
|
|
49
|
+
args.push("--headless");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const userDataDir = process.env.PI_CHROME_DEVTOOLS_USER_DATA_DIR?.trim();
|
|
53
|
+
if (userDataDir) {
|
|
54
|
+
// A persistent profile is mutually exclusive with --isolated (which forces an
|
|
55
|
+
// ephemeral temp dir cleaned up on close).
|
|
56
|
+
args.push("--userDataDir", userDataDir);
|
|
57
|
+
} else {
|
|
58
|
+
args.push("--isolated");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return args;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function buildChromeDevToolsEnv(): Record<string, string> {
|
|
65
|
+
const env: Record<string, string> = {};
|
|
66
|
+
|
|
67
|
+
for (const key of GUI_ENV_KEYS) {
|
|
68
|
+
const value = process.env[key];
|
|
69
|
+
if (value) env[key] = value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Avoid unsolicited update-check output in the MCP child process.
|
|
73
|
+
env.CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS = "1";
|
|
74
|
+
|
|
75
|
+
// Node 25 exposes experimental Web Storage. A bundled chrome-devtools-mcp
|
|
76
|
+
// dependency probes localStorage at startup, which emits a
|
|
77
|
+
// `--localstorage-file` warning unless Web Storage is disabled for this child.
|
|
78
|
+
if (supportsNoExperimentalWebStorage()) {
|
|
79
|
+
env.NODE_OPTIONS = appendNodeOption(process.env.NODE_OPTIONS, NODE_WEBSTORAGE_DISABLE_OPTION);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return env;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default createMcpBridgeExtension({
|
|
86
|
+
prefix: "chrome_devtools__",
|
|
87
|
+
command: "npx",
|
|
88
|
+
args: buildChromeDevToolsArgs(),
|
|
89
|
+
env: buildChromeDevToolsEnv(),
|
|
90
|
+
stderr: "pipe",
|
|
91
|
+
labelPrefix: "Chrome DevTools",
|
|
92
|
+
statusCommandName: "af-chrome-devtools-status",
|
|
93
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# compact-and-continue
|
|
2
|
+
|
|
3
|
+
A pi extension that registers a single tool, `request_compaction`, for queueing pi context compaction at a safe checkpoint and (optionally) resuming work from a self-contained continuation prompt afterward.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
`request_compaction` does **not** compact immediately. It queues the request, lets the current agent turn finish, then runs compaction on `agent_end`. If a `continuationPrompt` is provided, the extension re-injects it as a new user message after compaction finishes — pi picks up exactly where the summarized plan says to continue.
|
|
8
|
+
|
|
9
|
+
This keeps the user in control: compaction never interrupts a tool call mid-flight, and resumption is explicit (you decide what survives the compaction by what you put in `continuationPrompt`).
|
|
10
|
+
|
|
11
|
+
## Tool: `request_compaction`
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Required | Description |
|
|
14
|
+
|---|---|---|---|
|
|
15
|
+
| `customInstructions` | string | no | Instructions for the compaction summary. Defaults to: *"Preserve task goal, completed work, changed/read files, decisions, blockers, and next steps."* |
|
|
16
|
+
| `reason` | string | no | Short explanation recorded in tool details. |
|
|
17
|
+
| `continuationPrompt` | string | no | Self-contained summary of the remaining plan. If provided, pi auto-resumes from this message after compaction. **Do not copy the original prompt verbatim** — restate the next concrete actions. |
|
|
18
|
+
|
|
19
|
+
The tool does not ask for confirmation. Workflows that need confirmation (e.g. `/af-build`) must ask the user **before** calling it.
|
|
20
|
+
|
|
21
|
+
## When to use
|
|
22
|
+
|
|
23
|
+
Use only when explicitly requested by the user, a skill, or a prompt template. Do not call it pre-emptively or on a hunch that context is "getting long" — pi has its own autocompaction for that.
|
|
24
|
+
|
|
25
|
+
The canonical usage point in this repo is `/af-build`: at slice-approval time, the user can pick "Compact & continue" to compact between slices and resume from a summarized remaining plan. See `.pi/prompts/af-build.md` and `skills/incremental-implementation/SKILL.md`.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
Installs alongside the other extensions (see [docs/pi-setup.md](../../../docs/pi-setup.md#optional-pi-extensions)):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx @chankov/agent-fleet install --agent pi --items pi-extension:compact-and-continue --yes
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
It also comes in with the `pi-fleet-core` profile. The only runtime dep (`typebox`) is declared in `.pi/extensions/package.json` alongside the other extensions, so no extra `npm ci` is needed if you have already installed those.
|
|
36
|
+
|
|
37
|
+
## Behavior notes
|
|
38
|
+
|
|
39
|
+
- Multiple queued requests in the same turn are coalesced into one compaction with all reasons concatenated.
|
|
40
|
+
- Only the latest `continuationPrompt` (last queued) is honored.
|
|
41
|
+
- If compaction fails, the error is surfaced via `ctx.ui.notify` and the queue is drained — pi does not auto-retry.
|
|
42
|
+
- The tool returns `terminate: true`, ending the current turn so `agent_end` can fire and the queued compaction can run.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { CompactionResult, ExtensionAPI, ExtensionContext } from '@mariozechner/pi-coding-agent';
|
|
2
|
+
import { Type } from 'typebox';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_COMPACTION_INSTRUCTIONS = 'Preserve task goal, completed work, changed/read files, decisions, blockers, and next steps.';
|
|
5
|
+
|
|
6
|
+
const RequestCompactionParams = Type.Object({
|
|
7
|
+
customInstructions: Type.Optional(Type.String({
|
|
8
|
+
description: 'Instructions for the compaction summary. Include what must be preserved for continuing safely.',
|
|
9
|
+
})),
|
|
10
|
+
reason: Type.Optional(Type.String({
|
|
11
|
+
description: 'Short explanation recorded in tool details for why immediate compaction was requested.',
|
|
12
|
+
})),
|
|
13
|
+
continuationPrompt: Type.Optional(Type.String({
|
|
14
|
+
description: 'Self-contained summary of the remaining plan to execute after compaction. Do not copy the original prompt verbatim. Include the next concrete actions. If the original plan explicitly requires later compaction checkpoints, include them; otherwise do not repeat the same compaction request.',
|
|
15
|
+
})),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
function compact(ctx: ExtensionContext, customInstructions: string): Promise<CompactionResult> {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
ctx.compact({
|
|
21
|
+
customInstructions,
|
|
22
|
+
onComplete: resolve,
|
|
23
|
+
onError: reject,
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function compactAndContinueExtension(pi: ExtensionAPI) {
|
|
29
|
+
type PendingCompaction = {
|
|
30
|
+
customInstructions: string;
|
|
31
|
+
reason: string;
|
|
32
|
+
continuationPrompt?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const pendingCompactions: PendingCompaction[] = [];
|
|
36
|
+
let compactionRunning = false;
|
|
37
|
+
|
|
38
|
+
async function runQueuedCompactions(ctx: ExtensionContext): Promise<void> {
|
|
39
|
+
if (compactionRunning || pendingCompactions.length === 0) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
compactionRunning = true;
|
|
44
|
+
const pending = pendingCompactions.splice(0);
|
|
45
|
+
const customInstructions = pending
|
|
46
|
+
.map((item, index) => [
|
|
47
|
+
`Queued compaction request ${index + 1}/${pending.length}.`,
|
|
48
|
+
`Reason: ${item.reason}`,
|
|
49
|
+
item.customInstructions,
|
|
50
|
+
].join(' '))
|
|
51
|
+
.join('\n\n');
|
|
52
|
+
const continuationRequest = [...pending].reverse().find(item => item.continuationPrompt !== undefined);
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
ctx.ui.notify('Compacting queued context request.', 'info');
|
|
56
|
+
await compact(ctx, customInstructions);
|
|
57
|
+
ctx.ui.notify('Queued compaction finished.', 'info');
|
|
58
|
+
|
|
59
|
+
if (continuationRequest?.continuationPrompt) {
|
|
60
|
+
ctx.ui.notify('Continuing summarized plan after compaction.', 'info');
|
|
61
|
+
setTimeout(() => pi.sendUserMessage(continuationRequest.continuationPrompt!), 0);
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
65
|
+
ctx.ui.notify(`Queued compaction failed: ${message}`, 'error');
|
|
66
|
+
} finally {
|
|
67
|
+
compactionRunning = false;
|
|
68
|
+
if (pendingCompactions.length > 0) {
|
|
69
|
+
setTimeout(() => void runQueuedCompactions(ctx), 0);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
pi.on('agent_end', async (_event, ctx) => {
|
|
75
|
+
if (pendingCompactions.length > 0 && !compactionRunning) {
|
|
76
|
+
setTimeout(() => void runQueuedCompactions(ctx), 0);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
pi.registerTool({
|
|
81
|
+
name: 'request_compaction',
|
|
82
|
+
label: 'Request Compaction',
|
|
83
|
+
description: 'Queue pi context compaction to run as soon as the current agent turn finishes. Use only when the user, a skill, or a prompt explicitly asks for compaction. If more work should continue after compaction, provide continuationPrompt as a concise summary of the remaining plan rather than the original prompt verbatim. This tool does not ask for confirmation; workflows that need confirmation must ask the user before calling it.',
|
|
84
|
+
promptSnippet: 'request_compaction(customInstructions?, reason?, continuationPrompt?) - queue context compaction after the current turn, then optionally continue from a summarized remaining plan.',
|
|
85
|
+
promptGuidelines: [
|
|
86
|
+
'Use request_compaction only when compaction was explicitly requested by the user, skill, or prompt.',
|
|
87
|
+
'If user confirmation is required, ask the user before calling request_compaction; this tool does not ask for confirmation.',
|
|
88
|
+
'Use request_compaction when the user asks to compact now or before continuing to later steps in the same task.',
|
|
89
|
+
'Provide customInstructions that preserve goals, decisions, files read/modified, blockers, and next steps.',
|
|
90
|
+
'When work should continue after compaction, provide continuationPrompt as a concise, self-contained summary of the remaining plan; do not copy the original prompt verbatim.',
|
|
91
|
+
'If the original plan explicitly requires later compaction checkpoints, include those checkpoints in continuationPrompt so request_compaction can be called again later; otherwise do not repeat the same compaction request.',
|
|
92
|
+
],
|
|
93
|
+
parameters: RequestCompactionParams,
|
|
94
|
+
executionMode: 'sequential',
|
|
95
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
96
|
+
const customInstructions = params.customInstructions?.trim() || DEFAULT_COMPACTION_INSTRUCTIONS;
|
|
97
|
+
const reason = params.reason?.trim() || 'The current instructions requested immediate context compaction.';
|
|
98
|
+
const continuationPrompt = params.continuationPrompt?.trim() || undefined;
|
|
99
|
+
|
|
100
|
+
pendingCompactions.push({ customInstructions, reason, continuationPrompt });
|
|
101
|
+
ctx.ui.notify(
|
|
102
|
+
continuationPrompt
|
|
103
|
+
? 'Compaction queued after the current turn. The summarized remaining plan will continue after compaction.'
|
|
104
|
+
: 'Compaction queued after the current turn.',
|
|
105
|
+
'info',
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
content: [{
|
|
110
|
+
type: 'text',
|
|
111
|
+
text: continuationPrompt
|
|
112
|
+
? 'Compaction queued. It will run after this agent turn finishes, then the summarized remaining plan will continue.'
|
|
113
|
+
: 'Compaction queued. It will run after this agent turn finishes.',
|
|
114
|
+
}],
|
|
115
|
+
details: { queued: true, continueAfterCompaction: continuationPrompt !== undefined, customInstructions, reason, continuationPrompt },
|
|
116
|
+
terminate: true,
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# mcp-bridge
|
|
2
|
+
|
|
3
|
+
A reusable factory for turning any stdio MCP server into a pi extension.
|
|
4
|
+
|
|
5
|
+
This is a **library**, not a standalone pi extension. It is consumed by other extensions in `.pi/extensions/` (for example, `chrome-devtools-mcp/`). pi will not load it directly.
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
Given a config describing how to spawn an MCP server, the factory returns a pi extension that:
|
|
10
|
+
|
|
11
|
+
1. Spawns the MCP server over stdio (`StdioClientTransport`).
|
|
12
|
+
2. Lists the server's tools via `listTools`.
|
|
13
|
+
3. Registers each tool with pi under a configurable prefix.
|
|
14
|
+
4. Forwards calls and normalizes MCP content (`text`, `image`, `resource`) back to pi.
|
|
15
|
+
5. Registers a status command and cleans up on `session_shutdown`.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createMcpBridgeExtension } from "../mcp-bridge/index.js";
|
|
21
|
+
|
|
22
|
+
export default createMcpBridgeExtension({
|
|
23
|
+
prefix: "my_server__",
|
|
24
|
+
command: "npx",
|
|
25
|
+
args: ["-y", "some-mcp-server@latest"],
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Config
|
|
30
|
+
|
|
31
|
+
| Field | Required | Default | Description |
|
|
32
|
+
|---|---|---|---|
|
|
33
|
+
| `prefix` | yes | — | Prefix prepended to every registered pi tool name (e.g. `chrome_devtools__`). |
|
|
34
|
+
| `command` | yes | — | Executable used to spawn the MCP server (e.g. `npx`, `node`, an absolute path). |
|
|
35
|
+
| `args` | yes | — | Arguments passed to `command`. |
|
|
36
|
+
| `clientName` | no | `pi-<prefix>` | Identifier sent to the MCP server during connection. |
|
|
37
|
+
| `labelPrefix` | no | humanized `prefix` | Shown in pi tool labels and status messages. |
|
|
38
|
+
| `statusCommandName` | no | `<prefix>-status` | Slash command that reports bridge status. |
|
|
39
|
+
|
|
40
|
+
## Why this exists
|
|
41
|
+
|
|
42
|
+
pi does not yet have first-class MCP support. This bridge is a **stopgap**: it lets pi consume MCP servers today. When pi gains native MCP support, individual wrapper extensions can be retired or replaced; this library will then be deprecated.
|
|
43
|
+
|
|
44
|
+
## Dependencies
|
|
45
|
+
|
|
46
|
+
Runtime dependencies (`@modelcontextprotocol/sdk`, `typebox`) are declared at `.pi/extensions/package.json` — copied into the workspace with the extensions — and duplicated in the root package's production `dependencies`. The duplication is intentional: npm does not install dependencies from a nested `.pi/extensions/package.json`, so a pi-package install needs them at package root. In a workspace install, `agent-fleet install --allow-exec` runs `npm ci --prefix .pi/extensions` for you; otherwise run it yourself. No per-wrapper install is required. `@mariozechner/pi-coding-agent` is supplied by the pi runtime that loads the extension.
|