@chankov/agent-fleet 2.0.22 → 2.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/agent-fleet/scripts/coms-claude-bridge.ts +5 -2
- package/.pi/agent-fleet/scripts/coms-cli.ts +9 -4
- package/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +5 -2
- package/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
- package/.pi/agent-fleet/scripts/fleet.ts +32 -4
- package/.pi/agent-fleet/scripts/flow.ts +10 -1
- package/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +1 -1
- package/.pi/agent-fleet/scripts/lib/fleet-command.ts +14 -0
- package/.pi/agent-fleet/scripts/lib/flow-command.ts +9 -0
- package/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +14 -6
- package/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
- package/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
- package/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
- package/.pi/agent-fleet/scripts/lib/team-snapshot.ts +13 -0
- package/.pi/agent-fleet/scripts/peer-launch.ts +17 -11
- package/.pi/agent-fleet/scripts/pi-session.ts +9 -0
- package/.pi/agent-fleet/scripts/team-snapshot.ts +14 -6
- package/.pi/agent-fleet/scripts/team-up.ts +16 -9
- package/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +5 -3
- package/.pi/agent-fleet/scripts/workflows/lib/env.ts +3 -1
- package/.pi/agent-fleet/scripts/workflows/lib/git.ts +4 -1
- package/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +10 -5
- package/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +15 -8
- package/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +5 -4
- package/.pi/agent-fleet/scripts/workflows/lib/quality.ts +3 -2
- package/.pi/agent-fleet/scripts/workflows/lib/run.ts +1 -0
- package/.pi/agent-fleet/scripts/workflows/lib/trace.ts +23 -5
- package/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +59 -23
- package/.pi/agents/model-profiles.yaml +3 -3
- package/.pi/extensions/btw/index.ts +2 -0
- package/.pi/extensions/pi-voice-stt/config.ts +5 -4
- package/.pi/harnesses/agent-hub/agentic-hub.ts +2 -1
- package/.pi/harnesses/agent-hub/config/agents.ts +3 -0
- package/.pi/harnesses/agent-hub/config/overrides.ts +4 -3
- package/.pi/harnesses/agent-hub/context-continuity-broker.ts +7 -5
- package/.pi/harnesses/agent-hub/context-continuity-client.ts +6 -3
- package/.pi/harnesses/agent-hub/context-continuity-owners.ts +5 -3
- package/.pi/harnesses/agent-hub/damage-guard-hub.ts +4 -2
- package/.pi/harnesses/agent-hub/damage-guard-owners.ts +5 -0
- package/.pi/harnesses/agent-hub/dispatch-coms.ts +7 -2
- package/.pi/harnesses/agent-hub/execution-evidence.ts +20 -4
- package/.pi/harnesses/agent-hub/file-discovery/hub.ts +2 -1
- package/.pi/harnesses/agent-hub/file-discovery/owners.ts +7 -3
- package/.pi/harnesses/agent-hub/index.ts +4 -3
- package/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +3 -2
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/presentation.ts +7 -1
- package/.pi/harnesses/agent-hub/proactive-config.ts +2 -1
- package/.pi/harnesses/agent-hub/proactive-rules.ts +1 -1
- package/.pi/harnesses/agent-hub/proactive-snapshot.ts +12 -4
- package/.pi/harnesses/agent-hub/proactive-types.ts +3 -0
- package/.pi/harnesses/agent-hub/safety-routing.ts +7 -1
- package/.pi/harnesses/agent-hub/scope-gate.js +10 -5
- package/.pi/harnesses/agent-hub/spawn.ts +30 -4
- package/.pi/harnesses/agent-hub/system1-runtime.ts +9 -3
- package/.pi/harnesses/agent-hub/task-triage-config.ts +2 -1
- package/.pi/harnesses/agent-hub/tools/fleet-tools.ts +3 -2
- package/.pi/harnesses/agent-hub/tools/herdr-executors.ts +11 -6
- package/.pi/harnesses/agent-hub/tools/run-flow.ts +21 -11
- package/.pi/harnesses/ask-user-remote/index.ts +4 -2
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/index.ts +23 -2
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/coms-core-io.ts +2 -0
- package/.pi/harnesses/lib/coms-core.ts +7 -1
- package/.pi/harnesses/lib/coms-registry-entry.ts +3 -0
- package/.pi/harnesses/lib/damage-control-shared.ts +17 -1
- package/.pi/harnesses/lib/damage-policy.ts +35 -0
- package/.pi/harnesses/lib/peer-target.ts +24 -0
- package/.pi/harnesses/lib/policy-roots.js +20 -9
- package/.pi/harnesses/lib/policy-roots.ts +2 -1
- package/.pi/harnesses/lib/resource-closure.js +26 -0
- package/.pi/harnesses/lib/session-target.ts +62 -0
- package/.pi/harnesses/lib/system1/config-loader.js +12 -3
- package/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
- package/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
- package/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
- package/.pi/harnesses/lib/target-capabilities.js +7 -0
- package/.pi/harnesses/lib/workspace-context.js +115 -0
- package/.pi/harnesses/lib/workspace-context.ts +22 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.23/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.23/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/fleet.ts +245 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/flow.ts +166 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/fleet-command.ts +266 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +238 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/pi-session.ts +9 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/team-up.ts +385 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/git.ts +99 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/quality.ts +65 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.23/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.23/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.23/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.23/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.23/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.23/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.23/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.23/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.23/.pi/extensions/btw/index.ts +916 -0
- package/.versions/2.0.23/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.23/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.23/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.23/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.23/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.23/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.23/.pi/extensions/compact-and-continue/index.ts +136 -0
- package/.versions/2.0.23/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.23/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.23/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.23/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.23/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.23/.pi/extensions/package.json +9 -0
- package/.versions/2.0.23/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.23/.pi/extensions/pi-voice-stt/config.ts +199 -0
- package/.versions/2.0.23/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.23/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.23/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.23/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.23/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/README.md +1527 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/acceptance.ts +200 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/access-approval.ts +141 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/context.ts +46 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/config/agents.ts +181 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/config/model-profiles.ts +237 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-continuity-compat.ts +30 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/damage-guard-approval.ts +59 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/damage-guard-hub.ts +256 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +295 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +255 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-native-types.ts +293 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-native.ts +236 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/external-blocker.js +92 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/fixtures/registration-surface.json +66 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/history-projection.ts +116 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/index.ts +2617 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +145 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/no-progress.ts +622 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/policy/work-mode.ts +142 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/presentation.ts +54 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-snapshot.ts +279 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/process-obligations.ts +159 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/prompts/context.ts +55 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/prompts/fragments.ts +86 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/return-contract.js +349 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/review-continuity.ts +73 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/review-findings.js +96 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/review-reuse.ts +47 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/run-budget.js +342 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/runtime-test-check.ts +68 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/scope-gate.js +233 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/session-audit.ts +331 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/spawn.ts +665 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/specialist-result.ts +69 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/system1-communication-store.ts +217 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-authorization.ts +151 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-runtime.ts +130 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +79 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/action-executors.ts +214 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/context.ts +144 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +641 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/run-flow.ts +146 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/work-mode.ts +186 -0
- package/.versions/2.0.23/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.23/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.23/.pi/harnesses/ask-user-remote/index.ts +571 -0
- package/.versions/2.0.23/.pi/harnesses/ask-user-remote/questions.ts +159 -0
- package/.versions/2.0.23/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.23/.pi/harnesses/ask-user-remote/runtime-ask.ts +83 -0
- package/.versions/2.0.23/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.23/.pi/harnesses/coms/index.ts +285 -0
- package/.versions/2.0.23/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.23/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.23/.pi/harnesses/damage-control-continue/README.md +161 -0
- package/.versions/2.0.23/.pi/harnesses/damage-control-continue/index.ts +621 -0
- package/.versions/2.0.23/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.23/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
- package/.versions/2.0.23/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
- package/.versions/2.0.23/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
- package/.versions/2.0.23/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
- package/.versions/2.0.23/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.23/.pi/harnesses/lib/approval-wait.ts +17 -0
- package/.versions/2.0.23/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
- package/.versions/2.0.23/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.23/.pi/harnesses/lib/clarification-policy.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/lib/coms-core-io.ts +415 -0
- package/.versions/2.0.23/.pi/harnesses/lib/coms-core.ts +686 -0
- package/.versions/2.0.23/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
- package/.versions/2.0.23/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
- package/.versions/2.0.23/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.0.23/.pi/harnesses/lib/context-budget-view.ts +112 -0
- package/.versions/2.0.23/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.23/.pi/harnesses/lib/context-compaction-policy.js +35 -0
- package/.versions/2.0.23/.pi/harnesses/lib/damage-action-hash.ts +28 -0
- package/.versions/2.0.23/.pi/harnesses/lib/damage-control-shared.ts +245 -0
- package/.versions/2.0.23/.pi/harnesses/lib/damage-guard-port.ts +25 -0
- package/.versions/2.0.23/.pi/harnesses/lib/damage-policy.ts +35 -0
- package/.versions/2.0.23/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
- package/.versions/2.0.23/.pi/harnesses/lib/damage-result-view.ts +16 -0
- package/.versions/2.0.23/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.0.23/.pi/harnesses/lib/execution-trace.ts +45 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.23/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.23/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.23/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.23/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.23/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.23/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.23/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.23/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.23/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.23/.pi/harnesses/lib/identical-dialog.ts +27 -0
- package/.versions/2.0.23/.pi/harnesses/lib/installation-state.js +62 -0
- package/.versions/2.0.23/.pi/harnesses/lib/peer-target.ts +24 -0
- package/.versions/2.0.23/.pi/harnesses/lib/policy-roots.js +117 -0
- package/.versions/2.0.23/.pi/harnesses/lib/policy-roots.ts +32 -0
- package/.versions/2.0.23/.pi/harnesses/lib/process-shared.ts +9 -0
- package/.versions/2.0.23/.pi/harnesses/lib/resource-closure.js +26 -0
- package/.versions/2.0.23/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.0.23/.pi/harnesses/lib/semantic-approval.ts +80 -0
- package/.versions/2.0.23/.pi/harnesses/lib/session-target.ts +62 -0
- package/.versions/2.0.23/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config-loader.js +53 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config-v2.js +112 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
- package/.versions/2.0.23/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
- package/.versions/2.0.23/.pi/harnesses/lib/target-capabilities.js +7 -0
- package/.versions/2.0.23/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.23/.pi/harnesses/lib/workspace-context.js +115 -0
- package/.versions/2.0.23/.pi/harnesses/lib/workspace-context.ts +22 -0
- package/.versions/2.0.23/.pi/harnesses/package-lock.json +2121 -0
- package/.versions/2.0.23/.pi/harnesses/package.json +13 -0
- package/.versions/2.0.23/.pi/prompts/af-build.md +27 -0
- package/.versions/2.0.23/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.23/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.23/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.23/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.23/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.23/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.23/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.23/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.23/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.23/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.23/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.23/.version +1 -0
- package/.versions/2.0.23/agents/architect.md +24 -0
- package/.versions/2.0.23/agents/bowser.md +28 -0
- package/.versions/2.0.23/agents/builder.md +55 -0
- package/.versions/2.0.23/agents/code-reviewer.md +209 -0
- package/.versions/2.0.23/agents/deep-researcher.md +32 -0
- package/.versions/2.0.23/agents/documenter.md +22 -0
- package/.versions/2.0.23/agents/orchestrator.md +22 -0
- package/.versions/2.0.23/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.23/agents/planner.md +107 -0
- package/.versions/2.0.23/agents/releaser.md +24 -0
- package/.versions/2.0.23/agents/researcher.md +30 -0
- package/.versions/2.0.23/agents/security-auditor.md +167 -0
- package/.versions/2.0.23/agents/test-engineer.md +153 -0
- package/.versions/2.0.23/agents/web-debugger.md +44 -0
- package/.versions/2.0.23/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.23/bin/catalog/harness-runtime-closure.json +85 -0
- package/.versions/2.0.23/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.23/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.23/docs/ARCHITECTURE.md +1023 -0
- package/.versions/2.0.23/docs/agent-fleet-setup.md +1106 -0
- package/.versions/2.0.23/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.0.23/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.23/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.23/docs/getting-started.md +126 -0
- package/.versions/2.0.23/docs/npm-install.md +535 -0
- package/.versions/2.0.23/docs/pi-extensions.md +455 -0
- package/.versions/2.0.23/docs/pi-setup.md +92 -0
- package/.versions/2.0.23/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.23/install-manifest.json +3251 -0
- package/.versions/2.0.23/justfile +247 -0
- package/.versions/2.0.23/manifest-meta.json +1096 -0
- package/.versions/2.0.23/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.23/references/communication-contract.md +26 -0
- package/.versions/2.0.23/references/definition-of-done.md +67 -0
- package/.versions/2.0.23/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.23/references/observability-checklist.md +92 -0
- package/.versions/2.0.23/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.23/references/performance-checklist.md +236 -0
- package/.versions/2.0.23/references/prompting-patterns.md +380 -0
- package/.versions/2.0.23/references/security-checklist.md +245 -0
- package/.versions/2.0.23/references/testing-patterns.md +235 -0
- package/.versions/2.0.23/references/workflow-authoring.md +304 -0
- package/.versions/2.0.23/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.23/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.23/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.23/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.23/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.23/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.23/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.23/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.23/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.23/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.23/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.23/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.23/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.23/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.23/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.23/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.23/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.23/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.23/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.23/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.0.23/skills/incremental-implementation.zip +0 -0
- package/.versions/2.0.23/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.23/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.23/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.23/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.23/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.0.23/skills/planning-and-task-breakdown.zip +0 -0
- package/.versions/2.0.23/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.0.23/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.23/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.23/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.23/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.23/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.23/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.0.23/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.23/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.23/skills/spec-driven-development.zip +0 -0
- package/.versions/2.0.23/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.23/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +15 -0
- package/README.md +4 -1
- 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/catalog/harness-runtime-closure.json +12 -0
- package/docs/ARCHITECTURE.md +41 -0
- package/docs/agent-fleet-setup.md +5 -2
- package/docs/session-worktree-targeting.md +99 -0
- package/docs/workflows.md +4 -0
- package/install-manifest.json +43 -2
- package/justfile +6 -6
- package/manifest-meta.json +8 -0
- package/package.json +3 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import {createRequire} from 'node:module';
|
|
6
|
+
// Legacy/native adapters can load without optional policy dependencies. Targeted
|
|
7
|
+
// policy evaluation still requires the workspace's installed YAML parser.
|
|
8
|
+
const require=createRequire(import.meta.url);
|
|
9
|
+
import { safeSourceRead } from './safe-source-read.js';
|
|
10
|
+
import { sessionRootsFromEnv } from './workspace-context.ts';
|
|
11
|
+
export interface DamagePolicy {
|
|
12
|
+
bashToolPatterns: {pattern:string;reason:string;ask?:boolean}[];
|
|
13
|
+
zeroAccessPaths:string[];readOnlyPaths:string[];noDeletePaths:string[];
|
|
14
|
+
}
|
|
15
|
+
/** The policy source is workspace-owned; path matching remains execution-relative. */
|
|
16
|
+
export function readDamagePolicy(execution:string,roots=sessionRootsFromEnv()): {path:string;rules:DamagePolicy;digest:string} | undefined {
|
|
17
|
+
const strict=roots?.mode==='targeted';
|
|
18
|
+
const base=roots?.workspaceRoot??execution;
|
|
19
|
+
const project=join(base,'.pi/damage-control-rules.yaml'), global=join(homedir(),'.pi/damage-control-rules.yaml');
|
|
20
|
+
const selected=existsSync(project)?project:!strict&&existsSync(global)?global:undefined;
|
|
21
|
+
if(!selected){if(strict)throw new Error('missing_workspace_damage_policy');return undefined;}
|
|
22
|
+
const bytes=safeSourceRead(selected===project?base:homedir(),selected,1024*1024);
|
|
23
|
+
let value:any;try{value=require('yaml').parse(bytes.toString('utf8'));}catch{throw new Error('invalid_damage_policy:yaml');}
|
|
24
|
+
if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('invalid_damage_policy');
|
|
25
|
+
for(const key of ['bashToolPatterns','zeroAccessPaths','readOnlyPaths','noDeletePaths']) {
|
|
26
|
+
if(value[key]===undefined&&!strict)value[key]=[];
|
|
27
|
+
if(!Array.isArray(value[key]))throw new Error(`invalid_damage_policy:${key}`);
|
|
28
|
+
}
|
|
29
|
+
for(const key of ['zeroAccessPaths','readOnlyPaths','noDeletePaths'])if(value[key].some((p:unknown)=>typeof p!=='string'||!p))throw new Error(`invalid_damage_policy:${key}`);
|
|
30
|
+
for(const rule of value.bashToolPatterns){
|
|
31
|
+
if(!rule||typeof rule.pattern!=='string'||!rule.pattern||typeof rule.reason!=='string'||(rule.ask!==undefined&&typeof rule.ask!=='boolean'))throw new Error('invalid_damage_policy:bashToolPatterns');
|
|
32
|
+
try{new RegExp(rule.pattern);}catch{throw new Error('invalid_damage_policy:pattern');}
|
|
33
|
+
}
|
|
34
|
+
return {path:selected,rules:value as DamagePolicy,digest:createHash('sha256').update(bytes).digest('hex')};
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {join} from 'node:path';
|
|
2
|
+
import type {LayoutNode} from './herdr-client.ts';
|
|
3
|
+
import {sessionRootsFromEnv,validateSessionRoots,projectForSession,targetProject,type SessionRoots} from './workspace-context.ts';
|
|
4
|
+
export function peerTarget(project:string,baseProject?:string){
|
|
5
|
+
const roots=sessionRootsFromEnv();if(roots?.mode!=='targeted')return undefined;
|
|
6
|
+
if(baseProject&&targetProject(baseProject,roots)!==project)throw Error('peer_target_project_mismatch');
|
|
7
|
+
return {roots,...(baseProject?{baseProject,project}:projectForSession(project,roots))};
|
|
8
|
+
}
|
|
9
|
+
export function targetPaneEnv(env:Record<string,string>|undefined,roots:SessionRoots,baseProject:string,project:string){
|
|
10
|
+
validateSessionRoots(roots);
|
|
11
|
+
if(targetProject(baseProject,roots)!==project)throw Error('peer_target_project_mismatch');
|
|
12
|
+
const routing={AF_SESSION_ROOTS:JSON.stringify(roots),AF_TARGET_BASE_PROJECT:baseProject,AF_TARGET_EFFECTIVE_PROJECT:project};
|
|
13
|
+
for(const [key,value] of Object.entries(env??{}))if(key.startsWith('GIT_')||key in routing&&value!==routing[key as keyof typeof routing])throw Error(`peer_context_override:${key}`);
|
|
14
|
+
return {...env,...routing};
|
|
15
|
+
}
|
|
16
|
+
export function targetPeerCommand(command:string[],roots:SessionRoots){
|
|
17
|
+
validateSessionRoots(roots);
|
|
18
|
+
return command[0]==='just'?['just','--justfile',join(roots.workspaceRoot,'justfile'),'--working-directory',roots.workspaceRoot,...command.slice(1)]:command;
|
|
19
|
+
}
|
|
20
|
+
export function bindTargetLayout(node:LayoutNode,target:ReturnType<typeof peerTarget>):LayoutNode {
|
|
21
|
+
if(!target)return node;
|
|
22
|
+
if(node.type==='split')return {...node,first:bindTargetLayout(node.first,target),second:bindTargetLayout(node.second,target)};
|
|
23
|
+
return {...node,cwd:target.roots.executionRoot,command:targetPeerCommand(node.command??[],target.roots),env:targetPaneEnv(node.env,target.roots,target.baseProject,target.project)};
|
|
24
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Shared runtime for Hub and the JavaScript-only CLI. Types live in policy-roots.ts.
|
|
2
|
-
import { realpathSync, statSync } from "node:fs";
|
|
2
|
+
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
3
3
|
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
4
4
|
|
|
5
5
|
const deniedSegment = /^(?:\.git|\.pi|node_modules|vendor|dist|build|coverage|\.env(?:\..*)?|credentials?|secrets?)$/i;
|
|
@@ -21,15 +21,16 @@ function currentRoot(root) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/** Explicit read grants only; not capture consent, registration or write ownership. */
|
|
24
|
-
export function resolvePolicyRoots(checkout, config) {
|
|
24
|
+
export function resolvePolicyRoots(checkout, config, configurationBase = checkout) {
|
|
25
25
|
const workspace = realpathSync(checkout);
|
|
26
|
+
const configBase = realpathSync(configurationBase);
|
|
26
27
|
const roots = [Object.freeze({ id: "workspace", role: "workspace", configuredPath: ".", lexicalPath: resolve(checkout), canonicalPath: workspace, kind: "directory" })];
|
|
27
28
|
const diagnostics = [];
|
|
28
29
|
const note = (code, path) => diagnostics.push(Object.freeze({ code, path, message: `${code}:${path}` }));
|
|
29
30
|
for (const [role, paths] of [["rules", config.rulesDirs ?? []], ["docs", config.docsPaths ?? []]]) {
|
|
30
31
|
for (const configuredPath of paths) {
|
|
31
32
|
if (!configuredPath || isAbsolute(configuredPath) || configuredPath.includes("\\")) { note("invalid_root", configuredPath); continue; }
|
|
32
|
-
const lexicalPath = resolve(
|
|
33
|
+
const lexicalPath = resolve(configurationBase, configuredPath);
|
|
33
34
|
if (denied(configuredPath)) { note("denied_path", configuredPath); continue; }
|
|
34
35
|
let canonicalPath;
|
|
35
36
|
try { canonicalPath = realpathSync(lexicalPath); }
|
|
@@ -46,7 +47,16 @@ export function resolvePolicyRoots(checkout, config) {
|
|
|
46
47
|
roots.push(root);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
+
// Local Fleet rules retain their existing read-only role, without granting the
|
|
51
|
+
// entire configuration workspace or considering target-local rule overrides.
|
|
52
|
+
if (configBase !== workspace) {
|
|
53
|
+
const path = resolve(configBase, '.ai/rules');
|
|
54
|
+
if (existsSync(path) && !roots.some(root => root.role === 'rules' && root.lexicalPath === path)) {
|
|
55
|
+
const canonicalPath=realpathSync(path);
|
|
56
|
+
if (!denied(canonicalPath) && statSync(canonicalPath).isDirectory()) roots.push(Object.freeze({id:`rules:${canonicalPath}`,role:'rules',configuredPath:'.ai/rules',lexicalPath:path,canonicalPath,kind:'directory'}));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return Object.freeze({ workspace, ...(configBase !== workspace ? {configBase} : {}), roots: Object.freeze(roots), diagnostics: Object.freeze(diagnostics) });
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
/** Revalidate lexical/canonical containment and root identity before every access. */
|
|
@@ -68,10 +78,10 @@ export function authorizePolicyPath(table, path, operation = "read") {
|
|
|
68
78
|
}
|
|
69
79
|
export function resolvePolicyReferences(table, paths, role) {
|
|
70
80
|
return paths.map(path => {
|
|
71
|
-
const target = resolve(table.workspace, path);
|
|
72
|
-
if (inside(table.workspace, target)) return path;
|
|
73
|
-
const source = authorizePolicyPath(table,
|
|
74
|
-
if (source.root.role !== role) throw new Error(`ungranted_reference:${path}`);
|
|
81
|
+
const target = resolve(table.configBase ?? table.workspace, path);
|
|
82
|
+
if (!table.configBase && inside(table.workspace, target)) return path;
|
|
83
|
+
const source = authorizePolicyPath(table, target);
|
|
84
|
+
if (source.root.role !== role && source.root.role !== 'workspace') throw new Error(`ungranted_reference:${path}`);
|
|
75
85
|
return source.path;
|
|
76
86
|
});
|
|
77
87
|
}
|
|
@@ -90,8 +100,9 @@ export function resolveRuleBinding(table, logicalPath) {
|
|
|
90
100
|
if (!logicalPath.startsWith(".ai/rules/") || logicalPath.includes("\\") || logicalPath.split("/").some(part => !part || part === "." || part === "..") || denied(logicalPath)) throw new Error(`invalid_binding:${logicalPath}`);
|
|
91
101
|
const suffix = logicalPath.slice(".ai/rules/".length);
|
|
92
102
|
const candidates = [];
|
|
93
|
-
const paths = [resolve(table.workspace, logicalPath), ...table.roots.filter(root => root.role === "rules").map(root => resolve(root.lexicalPath, suffix))];
|
|
103
|
+
const paths = [resolve(table.configBase ?? table.workspace, logicalPath), ...table.roots.filter(root => root.role === "rules").map(root => resolve(root.lexicalPath, suffix))];
|
|
94
104
|
for (const path of paths) {
|
|
105
|
+
if (table.configBase && !existsSync(path)) continue;
|
|
95
106
|
let candidate;
|
|
96
107
|
try { candidate = authorizePolicyPath(table, path); }
|
|
97
108
|
catch (error) {
|
|
@@ -17,6 +17,7 @@ export interface PolicyRootDiagnostic {
|
|
|
17
17
|
}
|
|
18
18
|
export interface PolicyRootTable {
|
|
19
19
|
readonly workspace: string;
|
|
20
|
+
readonly configBase?: string;
|
|
20
21
|
readonly roots: readonly PolicyRoot[];
|
|
21
22
|
readonly diagnostics: readonly PolicyRootDiagnostic[];
|
|
22
23
|
}
|
|
@@ -24,7 +25,7 @@ export interface AuthorizedPolicyPath {
|
|
|
24
25
|
readonly root: PolicyRoot;
|
|
25
26
|
readonly path: string;
|
|
26
27
|
}
|
|
27
|
-
export const resolvePolicyRoots = runtime.resolvePolicyRoots as (checkout: string, config: { rulesDirs?: readonly string[]; docsPaths?: readonly string[] }) => PolicyRootTable;
|
|
28
|
+
export const resolvePolicyRoots = runtime.resolvePolicyRoots as (checkout: string, config: { rulesDirs?: readonly string[]; docsPaths?: readonly string[] }, configurationBase?: string) => PolicyRootTable;
|
|
28
29
|
export const authorizePolicyPath = runtime.authorizePolicyPath as (table: PolicyRootTable, path: string, operation?: "read" | "inventory") => AuthorizedPolicyPath;
|
|
29
30
|
export const resolvePolicyReferences = runtime.resolvePolicyReferences as (table: PolicyRootTable, paths: readonly string[], role: "rules" | "docs") => string[];
|
|
30
31
|
export const policyRootValidationContext = runtime.policyRootValidationContext as (table: PolicyRootTable) => { externalIncludeAllowed(include: string): boolean };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Read-only health preflight for Fleet's workspace-owned local module closure.
|
|
2
|
+
// External package health is checked separately by runtime-dependencies.js.
|
|
3
|
+
import {existsSync,readFileSync,realpathSync,statSync} from 'node:fs';
|
|
4
|
+
import {dirname,isAbsolute,join,resolve} from 'node:path';
|
|
5
|
+
export function resourceClosureGaps(workspace,entries,additionalRoots=[]){
|
|
6
|
+
const root=realpathSync(workspace),allowed=[root,...additionalRoots.map(path=>realpathSync(path))],seen=new Set(),gaps=[];const queue=[...entries];
|
|
7
|
+
while(queue.length){
|
|
8
|
+
if(seen.size>1024){gaps.push('resource_closure_limit');break;}
|
|
9
|
+
const input=queue.pop(),candidate=resolve(root,input);
|
|
10
|
+
if(!existsSync(candidate)){gaps.push(`missing_resource:${input}`);continue;}
|
|
11
|
+
const path=realpathSync(candidate);
|
|
12
|
+
if(!allowed.some(owner=>path.startsWith(owner+'/'))){gaps.push(`foreign_resource:${input}`);continue;}
|
|
13
|
+
if(seen.has(path))continue;seen.add(path);
|
|
14
|
+
const stat=statSync(path);if(!stat.isFile()||stat.size>1024*1024){gaps.push(`invalid_resource:${input}`);continue;}
|
|
15
|
+
if(!/\.[cm]?[jt]s$/.test(path))continue;
|
|
16
|
+
const text=readFileSync(path,'utf8').replace(/\/\*[\s\S]*?\*\/|^\s*\/\/.*$/gm,'');
|
|
17
|
+
const imports=/\b(?:import|export)\s+(?:type\s+)?(?:[^'";]*?\sfrom\s*)?['"]([^'"]+)['"]|\b(?:import|require)\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
18
|
+
for(const match of text.matchAll(imports)){
|
|
19
|
+
const specifier=match[1]??match[2];if(!specifier.startsWith('.')&&!isAbsolute(specifier))continue;
|
|
20
|
+
let target=resolve(dirname(path),specifier);
|
|
21
|
+
if(!existsSync(target))target=[target+'.ts',target+'.js',join(target,'index.ts'),join(target,'index.js')].find(existsSync)??target;
|
|
22
|
+
queue.push(target);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return [...new Set(gaps)].sort();
|
|
26
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {TARGET_CAPABILITIES} from './target-capabilities.js';
|
|
2
|
+
import {realpathSync} from 'node:fs';
|
|
3
|
+
import type {ExtensionAPI} from '@mariozechner/pi-coding-agent';
|
|
4
|
+
import {sessionRootsFromEnv,validateSessionRoots,projectForSession,type SessionRoots} from './workspace-context.ts';
|
|
5
|
+
import {approveWorktreeScope} from './system1/worktree-scopes.ts';
|
|
6
|
+
import {readSystem1Document,loadSystem1Snapshot} from './system1/config-loader.js';
|
|
7
|
+
const ENTRY='fleet-session-roots-v1';
|
|
8
|
+
/** Session metadata binds history to a checkout. It never supplies source consent. */
|
|
9
|
+
export function createSessionTargetGuard(pi:ExtensionAPI){
|
|
10
|
+
let binding:SessionRoots|undefined;let refusal:string|undefined;let initialized=false;
|
|
11
|
+
function current(cwd:string):string|undefined {
|
|
12
|
+
if(refusal)return refusal;
|
|
13
|
+
if(!initialized)return process.env.AF_SESSION_ROOTS?'session_target_not_initialized':undefined;
|
|
14
|
+
try{
|
|
15
|
+
const supplied=sessionRootsFromEnv();
|
|
16
|
+
if(!binding)return supplied?'session_target_changed':undefined;
|
|
17
|
+
validateSessionRoots(binding);
|
|
18
|
+
if(supplied?.targetId!==binding.targetId||realpathSync(cwd)!==binding.executionRoot)return 'session_target_changed';
|
|
19
|
+
return undefined;
|
|
20
|
+
}catch{return 'session_target_stale';}
|
|
21
|
+
}
|
|
22
|
+
async function start(ctx:any){
|
|
23
|
+
refusal=undefined;initialized=true;
|
|
24
|
+
try{
|
|
25
|
+
const supplied=sessionRootsFromEnv();
|
|
26
|
+
if(binding&&supplied?.targetId!==binding.targetId)throw Error('session_target_changed');
|
|
27
|
+
binding??=supplied;
|
|
28
|
+
const branch=ctx.sessionManager?.getBranch?.()??[];
|
|
29
|
+
const saved=branch.filter((entry:any)=>entry.type==='custom'&&entry.customType===ENTRY).at(-1)?.data;
|
|
30
|
+
if(saved){validateSessionRoots(saved);if(!binding||saved.targetId!==binding.targetId)throw Error('resume_target_mismatch');}
|
|
31
|
+
else if(binding){
|
|
32
|
+
if(branch.some((entry:any)=>entry.type==='message'))throw Error('unbound_resume_requires_new_session');
|
|
33
|
+
if(!ctx.sessionManager)throw Error('session_binding_unavailable');
|
|
34
|
+
pi.appendEntry(ENTRY,binding);
|
|
35
|
+
}
|
|
36
|
+
const error=current(ctx.cwd);if(error)throw Error(error);
|
|
37
|
+
}catch(error){refusal=error instanceof Error?error.message:String(error);ctx.ui.notify(`Fleet target refused: ${refusal}. Start a new session from af with the original --worktree.`,'error');}
|
|
38
|
+
}
|
|
39
|
+
pi.registerCommand('af-worktree',{
|
|
40
|
+
description:'Inspect and verify this session’s immutable selected checkout',
|
|
41
|
+
handler:async(args,ctx)=>{
|
|
42
|
+
if(args.trim()&&!['status','verify'].includes(args.trim())){ctx.ui.notify('Usage: /af-worktree [status|verify]. Select another checkout by starting a new just fleet --worktree session.','warning');return;}
|
|
43
|
+
const error=current(ctx.cwd);
|
|
44
|
+
if(error){ctx.ui.notify(`Fleet target refused: ${error}`,'error');return;}
|
|
45
|
+
if(!binding){ctx.ui.notify('Legacy session: no selected worktree');return;}
|
|
46
|
+
const snapshot=loadSystem1Snapshot(binding.executionRoot,binding);
|
|
47
|
+
let flag:string|undefined;try{flag=pi.getFlag('project') as string|undefined;}catch{}
|
|
48
|
+
const project=projectForSession(flag??process.env.AF_TARGET_EFFECTIVE_PROJECT??process.env.AF_TARGET_BASE_PROJECT??'default',binding);
|
|
49
|
+
ctx.ui.notify(JSON.stringify({workspaceRoot:binding.workspaceRoot,resourceRoot:binding.resourceRoot,executionRoot:binding.executionRoot,repositoryRoot:binding.repositoryRoot,targetId:binding.targetId,...project,capabilities:TARGET_CAPABILITIES,configurationStatus:snapshot.status,configurationReason:snapshot.targetReason??null,consumers:Object.fromEntries(Object.entries(snapshot.consumers).map(([name,section]:[string,any])=>[name,{configuredMode:snapshot.document?.consumers?.[name]?.mode??'off',effectiveMode:section.config?.mode??'off',scopeStatus:section.status,reason:section.reason??(section.status==='invalid'?'needs_adaptation':null),providerChecked:false,applicabilityChecked:false}]))},null,2));
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
pi.registerCommand('af-worktree-consent',{
|
|
53
|
+
description:'Fresh, exact per-consumer System 1 source-export approval for this checkout',
|
|
54
|
+
handler:async(args,ctx)=>{
|
|
55
|
+
const error=current(ctx.cwd);if(error||binding?.mode!=='targeted'){ctx.ui.notify(`Worktree approval refused: ${error??'target_required'}`,'error');return;}
|
|
56
|
+
const result=await approveWorktreeScope({binding,consumer:args.trim(),readDocument:()=>readSystem1Document(binding!.workspaceRoot),
|
|
57
|
+
ask:ctx.hasUI?async descriptor=>ctx.ui.confirm('Approve this exact worktree source-export scope?',JSON.stringify(descriptor,null,2)):undefined});
|
|
58
|
+
ctx.ui.notify(result.status==='approved'?'Exact worktree scope approved. Restart Fleet with the same --worktree to activate it; modes, limits and include lists were not changed.':`Worktree scope refused: ${result.reason}`,result.status==='approved'?'info':'warning');
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
return {start,current};
|
|
62
|
+
}
|
|
@@ -5,6 +5,8 @@ import { join } from 'node:path';
|
|
|
5
5
|
import { normalizeSystem1Config } from './config-v2.js';
|
|
6
6
|
import { parseConfigJson } from './config-json.js';
|
|
7
7
|
import { system1SelectedByDesired } from './selection.js';
|
|
8
|
+
import { workspaceRoot, sessionRootsFromEnv } from '../workspace-context.js';
|
|
9
|
+
import { gateWorktreeSnapshot, projectWorktreeDocument } from './worktree-scopes.js';
|
|
8
10
|
const MAX_CONFIG_BYTES = 1024 * 1024;
|
|
9
11
|
const sameFile = (a, b) => a.dev === b.dev && a.ino === b.ino;
|
|
10
12
|
function readWorkspaceJson(root, name) {
|
|
@@ -32,10 +34,17 @@ function readWorkspaceJson(root, name) {
|
|
|
32
34
|
} catch (error) { return error.code === 'ENOENT' ? undefined : null; }
|
|
33
35
|
finally { if (fd !== undefined) closeSync(fd); }
|
|
34
36
|
}
|
|
35
|
-
export function readSystem1Document(root) { return readWorkspaceJson(root, 'system1.json'); }
|
|
36
|
-
export function loadSystem1Snapshot(root
|
|
37
|
+
export function readSystem1Document(root,binding=sessionRootsFromEnv()) { return readWorkspaceJson(binding?.workspaceRoot??root, 'system1.json'); }
|
|
38
|
+
export function loadSystem1Snapshot(root,binding=sessionRootsFromEnv()) {
|
|
39
|
+
const document=readSystem1Document(root,binding);
|
|
40
|
+
try {
|
|
41
|
+
const effectiveDocument=projectWorktreeDocument(document,binding);
|
|
42
|
+
const snapshot=normalizeSystem1Config(effectiveDocument);
|
|
43
|
+
return gateWorktreeSnapshot(effectiveDocument===document?snapshot:Object.freeze({...snapshot,document,effectiveDocument}),binding);
|
|
44
|
+
} catch { return Object.freeze({...normalizeSystem1Config(null),targetReason:'ambiguous_worktree_scope'}); }
|
|
45
|
+
}
|
|
37
46
|
export function readSystem1Selected(root) {
|
|
38
|
-
return system1SelectedByDesired(readWorkspaceJson(root, 'agent-fleet.json'));
|
|
47
|
+
return system1SelectedByDesired(readWorkspaceJson(workspaceRoot(root), 'agent-fleet.json'));
|
|
39
48
|
}
|
|
40
49
|
export function providerDocument(snapshot) {
|
|
41
50
|
if (snapshot.status === 'missing') return undefined;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Root routing is not source-export consent. Only this exact, user-approved
|
|
2
|
+
// descriptor can activate a configured consumer for a physical checkout.
|
|
3
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
4
|
+
import { closeSync, constants, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
6
|
+
import { safeSourceRead } from '../safe-source-read.js';
|
|
7
|
+
import { resolvePolicyRoots, policyRootValidationContext } from '../policy-roots.js';
|
|
8
|
+
import { sessionRootsFromEnv, validateSessionRoots } from '../workspace-context.js';
|
|
9
|
+
import { CONSUMERS, deepFreeze, normalizeSystem1Config } from './config-v2.js';
|
|
10
|
+
const hash=value=>createHash('sha256').update(typeof value==='string'?value:JSON.stringify(value)).digest('hex');
|
|
11
|
+
function policy(roots) {
|
|
12
|
+
const path=join(roots.workspaceRoot,'.ai/agent-fleet-overrides.md');
|
|
13
|
+
const raw=existsSync(path)?safeSourceRead(roots.workspaceRoot,path,1024*1024).toString('utf8'):'';
|
|
14
|
+
const config={rulesDirs:[],docsPaths:[]};let section=false;
|
|
15
|
+
for(const line of raw.split(/\r?\n/)){
|
|
16
|
+
const heading=line.match(/^##\s+(.+?)\s*$/);if(heading){section=['agent-hub','agent-team'].includes(heading[1].trim().toLowerCase());continue;}
|
|
17
|
+
const pair=section&&line.match(/^\s*(rules|docs)\s*:\s*(.+?)\s*$/i);if(pair)config[pair[1].toLowerCase()==='rules'?'rulesDirs':'docsPaths']=pair[2].split(',').map(s=>s.trim()).filter(Boolean);
|
|
18
|
+
}
|
|
19
|
+
const table=resolvePolicyRoots(roots.executionRoot,config,roots.workspaceRoot);
|
|
20
|
+
if(table.diagnostics.length)throw Error('ambiguous_worktree_policy');
|
|
21
|
+
const guardPolicyHash=hash(safeSourceRead(roots.workspaceRoot,join(roots.workspaceRoot,'.pi/damage-control-rules.yaml'),1024*1024).toString('utf8'));
|
|
22
|
+
return {table,guardPolicyHash,configurationHash:hash(raw),roots:table.roots.map(root=>{const s=statSync(root.canonicalPath,{bigint:true});return {role:root.role,path:root.canonicalPath,lexicalPath:root.lexicalPath,kind:root.kind,device:String(s.dev),inode:String(s.ino),birthtime:String(s.birthtimeNs)};})};
|
|
23
|
+
}
|
|
24
|
+
const within=(base,path)=>path===base||path.startsWith(base+sep);
|
|
25
|
+
function projectSection(section,roots,grants){
|
|
26
|
+
const result=JSON.parse(JSON.stringify(section));
|
|
27
|
+
const map=path=>{
|
|
28
|
+
if(path==='git:tracked')return path;
|
|
29
|
+
if(typeof path!=='string'||isAbsolute(path)||path.includes('\\\\')||path.includes('\0'))throw Error('ambiguous_application_scope');
|
|
30
|
+
const absolute=resolve(roots.workspaceRoot,path);
|
|
31
|
+
if(within(roots.repositoryRoot,absolute))return relative(roots.repositoryRoot,absolute).split(sep).join('/')||'git:tracked';
|
|
32
|
+
const grant=grants.find(root=>root.role!=='workspace'&&within(root.lexicalPath??root.path,absolute));
|
|
33
|
+
if(grant){const suffix=relative(grant.lexicalPath??grant.path,absolute);return relative(roots.executionRoot,resolve(grant.path,suffix)).split(sep).join('/');}
|
|
34
|
+
if(path.split('/').includes('..'))throw Error('ambiguous_application_scope');
|
|
35
|
+
return path; // An explicit target-relative scope, shown as such for fresh consent.
|
|
36
|
+
};
|
|
37
|
+
if(Array.isArray(result.include))result.include=result.include.map(map);
|
|
38
|
+
for(const binding of result.localBindings??[]){
|
|
39
|
+
if(Array.isArray(binding.applicability?.paths))binding.applicability.paths=binding.applicability.paths.map(map);
|
|
40
|
+
if(Array.isArray(binding.exceptions?.paths))binding.exceptions.paths=binding.exceptions.paths.map(map);
|
|
41
|
+
if(binding.placement?.prefix)binding.placement.prefix=map(binding.placement.prefix);
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
export function projectWorktreeDocument(document,binding=sessionRootsFromEnv()) {
|
|
46
|
+
if(!binding||binding.mode!=='targeted'||!document?.consumers)return document;
|
|
47
|
+
const roots=validateSessionRoots(binding),grants=policy(roots).roots;
|
|
48
|
+
return {...document,consumers:Object.fromEntries(Object.entries(document.consumers).map(([name,section])=>[name,projectSection(section,roots,grants)]))};
|
|
49
|
+
}
|
|
50
|
+
export function worktreeScopePreview(document,consumer,binding=sessionRootsFromEnv()) {
|
|
51
|
+
if(!binding||binding.mode!=='targeted')return undefined;
|
|
52
|
+
const roots=validateSessionRoots(binding);
|
|
53
|
+
if(!CONSUMERS.includes(consumer))throw Error('unknown_consumer');
|
|
54
|
+
if(!['ready','off'].includes(normalizeSystem1Config(document).status))throw Error('invalid_configuration');
|
|
55
|
+
const section=document?.consumers?.[consumer];
|
|
56
|
+
if(!section)throw Error('consumer_unconfigured');
|
|
57
|
+
const {table,...policyScope}=policy(roots);
|
|
58
|
+
const projected=projectSection(section,roots,policyScope.roots);
|
|
59
|
+
const effective=normalizeSystem1Config({...document,consumers:{[consumer]:projected}},policyRootValidationContext(table)).consumers[consumer];
|
|
60
|
+
if(effective.status==='invalid')throw Error('ambiguous_consumer_scope');
|
|
61
|
+
const dataContracts={watchdog:'bounded progress messages',proactiveReview:'bounded changed-file excerpts and selected rule sections',dispatchTriage:'bounded task and role metadata',taskTriage:'bounded task state',agenticAsk:'explicit included file selections and opt-in tool output references',fileDiscovery:'approved candidate snippets and directory metadata',contextCompaction:'bounded session history',damageGuard:'commands, edits and results selected by remoteScopes'};
|
|
62
|
+
const descriptor={version:1,consumer,dataContract:dataContracts[consumer],targetId:roots.targetId,workspaceRoot:roots.workspaceRoot,executionRoot:roots.executionRoot,
|
|
63
|
+
repositoryRoot:roots.repositoryRoot,provider:document.provider,model:document.model,apiKeyEnv:document.apiKeyEnv,
|
|
64
|
+
configurationHash:hash(document),scope:JSON.parse(JSON.stringify(section)),effectiveScope:effective.config??projected,policy:policyScope};
|
|
65
|
+
return deepFreeze({...descriptor,digest:hash(descriptor)});
|
|
66
|
+
}
|
|
67
|
+
function recordPath(preview){return join(preview.workspaceRoot,'.pi/agent-sessions/worktree-consent',preview.targetId,`${preview.consumer}.json`);}
|
|
68
|
+
export function worktreeScopeApproved(document,consumer,binding=sessionRootsFromEnv()) {
|
|
69
|
+
if(!binding||binding.mode!=='targeted')return true;
|
|
70
|
+
try{
|
|
71
|
+
const preview=worktreeScopePreview(document,consumer,binding),path=recordPath(preview),stat=lstatSync(path);
|
|
72
|
+
if(!stat.isFile()||(stat.mode&0o077)!==0||(process.getuid&&stat.uid!==process.getuid()))return false;
|
|
73
|
+
const record=JSON.parse(safeSourceRead(binding.workspaceRoot,path,65536).toString('utf8'));
|
|
74
|
+
return record.version===1&&record.approved===true&&record.digest===preview.digest&&record.consumer===consumer&&record.targetId===binding.targetId;
|
|
75
|
+
}catch{return false;}
|
|
76
|
+
}
|
|
77
|
+
function privateDirectory(root,parts){
|
|
78
|
+
let path=root;
|
|
79
|
+
for(const part of parts){path=join(path,part);if(!existsSync(path))mkdirSync(path,{mode:0o700});const s=lstatSync(path);if(!s.isDirectory()||realpathSync(path)!==path)throw Error('consent_storage_denied');}
|
|
80
|
+
return path;
|
|
81
|
+
}
|
|
82
|
+
/** The caller supplies a real UI callback, never a Boolean/environment approval. */
|
|
83
|
+
export async function approveWorktreeScope({consumer,readDocument,ask,binding=sessionRootsFromEnv()}) {
|
|
84
|
+
if(!binding||binding.mode!=='targeted')return {status:'refused',reason:'target_required'};
|
|
85
|
+
if(typeof ask!=='function')return {status:'refused',reason:'approval_requires_ui'};
|
|
86
|
+
let before;try{before=worktreeScopePreview(readDocument(),consumer,binding);}catch{return {status:'refused',reason:'scope_unavailable'};}
|
|
87
|
+
if(await ask(before)!==true)return {status:'refused',reason:'scope_not_approved'};
|
|
88
|
+
let after;try{after=worktreeScopePreview(readDocument(),consumer,binding);}catch{return {status:'refused',reason:'scope_changed'};}
|
|
89
|
+
if(after.digest!==before.digest)return {status:'refused',reason:'scope_changed'};
|
|
90
|
+
const directory=privateDirectory(binding.workspaceRoot,['.pi','agent-sessions','worktree-consent',binding.targetId]);
|
|
91
|
+
const path=recordPath(before),temporary=join(directory,`.${randomUUID()}.tmp`);let fd;
|
|
92
|
+
try{
|
|
93
|
+
fd=openSync(temporary,constants.O_WRONLY|constants.O_CREAT|constants.O_EXCL|constants.O_NOFOLLOW,0o600);
|
|
94
|
+
writeFileSync(fd,JSON.stringify({version:1,approved:true,digest:before.digest,consumer,targetId:binding.targetId}));fsyncSync(fd);closeSync(fd);fd=undefined;
|
|
95
|
+
if(worktreeScopePreview(readDocument(),consumer,binding).digest!==before.digest)throw Error('scope_changed');
|
|
96
|
+
renameSync(temporary,path);
|
|
97
|
+
return {status:'approved',digest:before.digest};
|
|
98
|
+
}finally{if(fd!==undefined)closeSync(fd);try{unlinkSync(temporary);}catch{}}
|
|
99
|
+
}
|
|
100
|
+
export function gateWorktreeConsumer(document,consumer,section,binding=sessionRootsFromEnv()) {
|
|
101
|
+
if(!binding||binding.mode!=='targeted'||section?.status!=='ready'||document?.mode==='off')return section;
|
|
102
|
+
if(consumer==='proactiveReview'&§ion.config?.remoteContext==='disabled')return section;
|
|
103
|
+
if(worktreeScopeApproved(document,consumer,binding))return section;
|
|
104
|
+
return Object.freeze({status:'off',reason:'needs_worktree_consent',config:Object.freeze({...section.config,mode:'off'})});
|
|
105
|
+
}
|
|
106
|
+
export function gateWorktreeSnapshot(snapshot,binding=sessionRootsFromEnv()) {
|
|
107
|
+
if(!binding||binding.mode!=='targeted')return snapshot;
|
|
108
|
+
const consumers=Object.fromEntries(Object.entries(snapshot.consumers).map(([name,section])=>[name,gateWorktreeConsumer(snapshot.document,name,section,binding)]));
|
|
109
|
+
return Object.freeze({...snapshot,consumers:Object.freeze(consumers),targetId:binding.targetId});
|
|
110
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as runtime from './worktree-scopes.js';
|
|
2
|
+
import type { SessionRoots } from '../workspace-context.ts';
|
|
3
|
+
export interface WorktreeScopePreview {
|
|
4
|
+
readonly version:1;readonly consumer:string;readonly targetId:string;readonly workspaceRoot:string;readonly executionRoot:string;readonly repositoryRoot:string;
|
|
5
|
+
readonly provider:string;readonly model:string;readonly apiKeyEnv:string;readonly configurationHash:string;readonly scope:unknown;readonly effectiveScope:unknown;
|
|
6
|
+
readonly policy:{readonly configurationHash:string;readonly roots:readonly {role:string;path:string;kind:string;device:string;inode:string}[]};readonly digest:string;
|
|
7
|
+
}
|
|
8
|
+
export const worktreeScopePreview=runtime.worktreeScopePreview as (document:any,consumer:string,binding?:SessionRoots)=>WorktreeScopePreview|undefined;
|
|
9
|
+
export const worktreeScopeApproved=runtime.worktreeScopeApproved as (document:any,consumer:string,binding?:SessionRoots)=>boolean;
|
|
10
|
+
export const approveWorktreeScope=runtime.approveWorktreeScope as (options:{consumer:string;readDocument:()=>any;ask?:(preview:WorktreeScopePreview)=>Promise<boolean>;binding?:SessionRoots})=>Promise<{status:string;reason?:string;digest?:string}>;
|
|
11
|
+
export const gateWorktreeConsumer=runtime.gateWorktreeConsumer as (document:any,consumer:string,section:any,binding?:SessionRoots)=>any;
|
|
12
|
+
export const projectWorktreeDocument=runtime.projectWorktreeDocument as (document:any,binding?:SessionRoots)=>any;
|
|
13
|
+
export const gateWorktreeSnapshot=runtime.gateWorktreeSnapshot as (snapshot:any,binding?:SessionRoots)=>any;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { System1Service } from './contracts.ts';
|
|
2
|
+
import { readSystem1Document } from './config-loader.js';
|
|
3
|
+
import { sessionRootsFromEnv } from '../workspace-context.ts';
|
|
4
|
+
import { worktreeScopeApproved,worktreeScopePreview } from './worktree-scopes.ts';
|
|
5
|
+
/** Revalidate the exact scope at the provider boundary and before accepting a late result. */
|
|
6
|
+
export function worktreeConsumerService(service:System1Service|undefined,document:any,consumer:string):System1Service|undefined {
|
|
7
|
+
if(!service)return undefined;
|
|
8
|
+
const binding=sessionRootsFromEnv();if(!binding||binding.mode!=='targeted')return service;
|
|
9
|
+
let digest:string|undefined;try{digest=worktreeScopePreview(document,consumer,binding)?.digest;}catch{}
|
|
10
|
+
async function current(){
|
|
11
|
+
try{
|
|
12
|
+
if(!digest||sessionRootsFromEnv()?.targetId!==binding!.targetId)return false;
|
|
13
|
+
const {readDamagePolicy}=await import('../damage-policy.ts');
|
|
14
|
+
if(!readDamagePolicy(binding!.executionRoot,binding))return false;
|
|
15
|
+
const latest=readSystem1Document(binding!.workspaceRoot);
|
|
16
|
+
return worktreeScopePreview(latest,consumer,binding)?.digest===digest&&worktreeScopeApproved(latest,consumer,binding);
|
|
17
|
+
}catch{return false;}
|
|
18
|
+
}
|
|
19
|
+
return {async evaluate(request){
|
|
20
|
+
if(!await current())return {status:'unavailable',reason:'invalid_config'};
|
|
21
|
+
const result=await service.evaluate(request);
|
|
22
|
+
return await current()?result:{status:'unavailable',reason:'invalid_config'};
|
|
23
|
+
}};
|
|
24
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// These are integration contracts, not permissions or evidence of a check.
|
|
2
|
+
export const TARGET_CAPABILITIES=Object.freeze({
|
|
3
|
+
btw:Object.freeze({status:'unsupported',reason:'use_guarded_dispatch_agent'}),
|
|
4
|
+
hermesConductor:Object.freeze({status:'unsupported',reason:'external_profile_split_root_contract_unverified; use --hub or a targeted Pi peer'}),
|
|
5
|
+
outputContracts:Object.freeze({status:'not_present_in_runtime'}),
|
|
6
|
+
logSummarizer:Object.freeze({status:'not_present_in_runtime'}),
|
|
7
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Pure root selection shared by the launcher and Hub. This is routing, not consent.
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
4
|
+
const contextKey=Symbol.for('agent-fleet.session-root-context.v1');
|
|
5
|
+
const contexts=globalThis[contextKey]??(globalThis[contextKey]=new AsyncLocalStorage());
|
|
6
|
+
import { execFileSync } from "node:child_process";
|
|
7
|
+
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
8
|
+
import { resolve } from "node:path";
|
|
9
|
+
import { isDeepStrictEqual } from "node:util";
|
|
10
|
+
|
|
11
|
+
function directory(path) {
|
|
12
|
+
const canonical = realpathSync(path);
|
|
13
|
+
const stat = statSync(canonical, { bigint: true });
|
|
14
|
+
if (!stat.isDirectory()) throw new Error(`Not a directory: ${path}`);
|
|
15
|
+
return { path: canonical, device: String(stat.dev), inode: String(stat.ino), birthtime:String(stat.birthtimeNs) };
|
|
16
|
+
}
|
|
17
|
+
export function sessionGitEnv(env = process.env) {
|
|
18
|
+
const clean = { ...env };
|
|
19
|
+
for (const key of Object.keys(clean)) if (key.startsWith("GIT_")) delete clean[key];
|
|
20
|
+
return { ...clean, GIT_OPTIONAL_LOCKS: "0" };
|
|
21
|
+
}
|
|
22
|
+
function git(cwd, args) {
|
|
23
|
+
return execFileSync("git", ["-C", cwd, ...args], { encoding: "utf8", env: { ...sessionGitEnv(), GIT_TERMINAL_PROMPT: "0" }, timeout: 10_000, maxBuffer: 4 * 1024 * 1024, stdio: ["ignore", "pipe", "pipe"] });
|
|
24
|
+
}
|
|
25
|
+
// Remove only Git's record terminator, not whitespace that belongs to a path.
|
|
26
|
+
function gitPath(cwd, option) {
|
|
27
|
+
return git(cwd, ["rev-parse", option]).replace(/\n$/, "");
|
|
28
|
+
}
|
|
29
|
+
function gitDirectory(cwd, name) {
|
|
30
|
+
return realpathSync(resolve(cwd, gitPath(cwd, name)));
|
|
31
|
+
}
|
|
32
|
+
function identity(value) { return createHash("sha256").update(JSON.stringify(value)).digest("hex"); }
|
|
33
|
+
function worktrees(repository) {
|
|
34
|
+
const fields = git(repository, ["worktree", "list", "--porcelain", "-z"]).split("\0");
|
|
35
|
+
return fields.filter(field => field.startsWith("worktree ")).map(field => field.slice(9));
|
|
36
|
+
}
|
|
37
|
+
/** Relative selection is always relative to workspace, never the caller/checkout. */
|
|
38
|
+
export function resolveSessionRoots(workspace, selection, execution = workspace) {
|
|
39
|
+
const workspaceIdentity = directory(workspace);
|
|
40
|
+
// Managed installation symlinks do not relocate human configuration.
|
|
41
|
+
let resourceIdentity=workspaceIdentity;
|
|
42
|
+
for(const entry of ['.pi/agent-fleet/scripts/fleet.ts','.pi/harnesses/damage-control-continue/index.ts']){
|
|
43
|
+
const file=resolve(workspaceIdentity.path,entry);if(!existsSync(file))continue;
|
|
44
|
+
resourceIdentity=directory(resolve(realpathSync(file),'../../../..'));break;
|
|
45
|
+
}
|
|
46
|
+
if (selection === undefined) {
|
|
47
|
+
const root = directory(execution);
|
|
48
|
+
if(root.path!==workspaceIdentity.path)throw new Error('Legacy roots cannot select another execution directory; use an explicit worktree selection');
|
|
49
|
+
return Object.freeze({ version: 1, mode: "legacy", workspaceRoot: workspaceIdentity.path, resourceRoot: resourceIdentity.path, resourceIdentity:Object.freeze(resourceIdentity), executionRoot: root.path,
|
|
50
|
+
workspaceIdentity: Object.freeze(workspaceIdentity), executionIdentity: Object.freeze(root), targetId: identity([workspaceIdentity, resourceIdentity, root]), configBase: workspaceIdentity.path });
|
|
51
|
+
}
|
|
52
|
+
if (!selection || !selection.worktree) throw new Error("Target requires a worktree");
|
|
53
|
+
const target = directory(resolve(workspaceIdentity.path, selection.worktree));
|
|
54
|
+
// Git's registry identifies the owning main checkout; no basename heuristic or search.
|
|
55
|
+
if (selection.repository !== undefined && !selection.repository) throw new Error("Repository path must not be empty");
|
|
56
|
+
const owner = selection.repository ? resolve(workspaceIdentity.path, selection.repository) : worktrees(target.path)[0];
|
|
57
|
+
if (!owner) throw new Error("Cannot identify worktree repository");
|
|
58
|
+
const repository = directory(owner);
|
|
59
|
+
if (realpathSync(gitPath(repository.path, "--show-toplevel")) !== repository.path) throw new Error("Repository must be a checkout root");
|
|
60
|
+
if (realpathSync(gitPath(target.path, "--show-toplevel")) !== target.path) throw new Error("Worktree must be a checkout root");
|
|
61
|
+
if (realpathSync(worktrees(repository.path)[0]) !== repository.path) throw new Error("Repository must identify the registered main checkout");
|
|
62
|
+
if (git(target.path, ["rev-parse", "--is-bare-repository"]).trim() !== "false") throw new Error("Bare target is unsupported");
|
|
63
|
+
const repositoryCommonDir = gitDirectory(repository.path, "--git-common-dir");
|
|
64
|
+
const commonDir = gitDirectory(target.path, "--git-common-dir");
|
|
65
|
+
const gitDir = gitDirectory(target.path, "--git-dir");
|
|
66
|
+
const commonDirectoryIdentity = Object.freeze(directory(commonDir));
|
|
67
|
+
const gitDirectoryIdentity = Object.freeze(directory(gitDir));
|
|
68
|
+
if (commonDir !== repositoryCommonDir) throw new Error("Worktree belongs to a different repository");
|
|
69
|
+
if (!worktrees(repository.path).some(path => { try { return realpathSync(path) === target.path; } catch { return false; } })) throw new Error("Target is not a registered worktree");
|
|
70
|
+
const binding = { version: 1, mode: "targeted", workspaceRoot: workspaceIdentity.path, resourceRoot: resourceIdentity.path, resourceIdentity:Object.freeze(resourceIdentity), executionRoot: target.path,
|
|
71
|
+
repositoryRoot: repository.path, worktreeRoot: target.path, commonDir, gitDir, commonDirectoryIdentity, gitDirectoryIdentity,
|
|
72
|
+
workspaceIdentity: Object.freeze(workspaceIdentity), executionIdentity: Object.freeze(target), repositoryIdentity: Object.freeze(repository), configBase: workspaceIdentity.path };
|
|
73
|
+
return Object.freeze({ ...binding, targetId: identity([workspaceIdentity, resourceIdentity, target, repository, commonDirectoryIdentity, gitDirectoryIdentity]) });
|
|
74
|
+
}
|
|
75
|
+
/** Re-resolve instead of trusting serialized environment/session metadata. */
|
|
76
|
+
export function validateSessionRoots(binding) {
|
|
77
|
+
if (!binding || binding.version !== 1) throw new Error("Invalid session root binding");
|
|
78
|
+
const current = resolveSessionRoots(binding.workspaceRoot, binding.mode === "targeted" ? { repository: binding.repositoryRoot, worktree: binding.executionRoot } : undefined, binding.executionRoot);
|
|
79
|
+
if (current.targetId !== binding.targetId) throw new Error("Session root identity changed; start a new session explicitly");
|
|
80
|
+
// Reject misleading serialized fields instead of silently repairing a corrupt transport.
|
|
81
|
+
if (!isDeepStrictEqual(current, binding)) throw new Error("Invalid session root binding fields");
|
|
82
|
+
return current;
|
|
83
|
+
}
|
|
84
|
+
export function parseWorktreeSelection(args) {
|
|
85
|
+
const rest = []; let worktree; let repository;
|
|
86
|
+
for (let i = 0; i < args.length; i++) {
|
|
87
|
+
const arg = args[i];
|
|
88
|
+
if (arg === "--") { rest.push(...args.slice(i)); break; }
|
|
89
|
+
if (arg === "--worktree" || arg === "--repository") {
|
|
90
|
+
const value = args[++i];
|
|
91
|
+
if (!value || value.startsWith("--")) throw new Error(`${arg} requires a path`);
|
|
92
|
+
if (arg === "--worktree") { if (worktree !== undefined) throw new Error("Duplicate --worktree"); worktree = value; }
|
|
93
|
+
else { if (repository !== undefined) throw new Error("Duplicate --repository"); repository = value; }
|
|
94
|
+
} else if (arg.startsWith("--worktree=") || arg.startsWith("--repository=")) throw new Error("Use --worktree <path> and --repository <path>");
|
|
95
|
+
else rest.push(arg);
|
|
96
|
+
}
|
|
97
|
+
if (repository !== undefined && worktree === undefined) throw new Error("--repository requires --worktree");
|
|
98
|
+
return { rest, ...(worktree !== undefined ? { selection: { worktree, repository } } : {}) };
|
|
99
|
+
}
|
|
100
|
+
export function withSessionRoots(binding,body){return contexts.run(validateSessionRoots(binding),body);}
|
|
101
|
+
export function sessionRootsFromEnv(env = process.env) {
|
|
102
|
+
const scoped=env===process.env?contexts.getStore():undefined;
|
|
103
|
+
if(scoped)return validateSessionRoots(scoped);
|
|
104
|
+
if (!env.AF_SESSION_ROOTS) return undefined;
|
|
105
|
+
let binding; try { binding = JSON.parse(env.AF_SESSION_ROOTS); } catch { throw new Error("Invalid AF_SESSION_ROOTS"); }
|
|
106
|
+
return validateSessionRoots(binding);
|
|
107
|
+
}
|
|
108
|
+
export function targetProject(base,roots) { return roots.mode==='targeted'?`${base}-wt-${roots.targetId.slice(0,32)}`:base; }
|
|
109
|
+
export function projectForSession(base,roots,env=process.env) {
|
|
110
|
+
if(env.AF_TARGET_BASE_PROJECT&&env.AF_TARGET_EFFECTIVE_PROJECT===targetProject(env.AF_TARGET_BASE_PROJECT,roots)&&base===env.AF_TARGET_EFFECTIVE_PROJECT)return {baseProject:env.AF_TARGET_BASE_PROJECT,project:base};
|
|
111
|
+
return {baseProject:base,project:targetProject(base,roots)};
|
|
112
|
+
}
|
|
113
|
+
export function targetEnvironment(roots,env=process.env) { return {...(roots.mode==='targeted'?sessionGitEnv(env):env),AF_SESSION_ROOTS:JSON.stringify(validateSessionRoots(roots))}; }
|
|
114
|
+
export function workspaceRoot(cwd, env = process.env) { return sessionRootsFromEnv(env)?.workspaceRoot ?? cwd; }
|
|
115
|
+
export function executionRoot(cwd, env = process.env) { return sessionRootsFromEnv(env)?.executionRoot ?? cwd; }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as runtime from "./workspace-context.js";
|
|
2
|
+
export interface RootIdentity { readonly path: string; readonly device: string; readonly inode: string; readonly birthtime:string }
|
|
3
|
+
export interface SessionRoots {
|
|
4
|
+
readonly version: 1; readonly mode: "legacy" | "targeted";
|
|
5
|
+
readonly workspaceRoot: string; readonly resourceRoot: string; readonly executionRoot: string;
|
|
6
|
+
readonly repositoryRoot?: string; readonly worktreeRoot?: string; readonly commonDir?: string; readonly gitDir?: string;
|
|
7
|
+
readonly commonDirectoryIdentity?: RootIdentity; readonly gitDirectoryIdentity?: RootIdentity;
|
|
8
|
+
readonly resourceIdentity:RootIdentity; readonly workspaceIdentity: RootIdentity; readonly executionIdentity: RootIdentity;
|
|
9
|
+
readonly repositoryIdentity?: RootIdentity; readonly configBase: string; readonly targetId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface WorktreeSelection { worktree: string; repository?: string }
|
|
12
|
+
export const resolveSessionRoots = runtime.resolveSessionRoots as (workspace: string, selection?: WorktreeSelection, execution?: string) => SessionRoots;
|
|
13
|
+
export const validateSessionRoots = runtime.validateSessionRoots as (binding: SessionRoots) => SessionRoots;
|
|
14
|
+
export const sessionRootsFromEnv = runtime.sessionRootsFromEnv as (env?: NodeJS.ProcessEnv) => SessionRoots | undefined;
|
|
15
|
+
export const workspaceRoot = runtime.workspaceRoot as (cwd: string, env?: NodeJS.ProcessEnv) => string;
|
|
16
|
+
export const executionRoot = runtime.executionRoot as (cwd: string, env?: NodeJS.ProcessEnv) => string;
|
|
17
|
+
export const sessionGitEnv = runtime.sessionGitEnv as (env?: NodeJS.ProcessEnv) => NodeJS.ProcessEnv;
|
|
18
|
+
export const withSessionRoots=runtime.withSessionRoots as <T>(binding:SessionRoots,body:()=>T)=>T;
|
|
19
|
+
export const targetProject=runtime.targetProject as (base:string,roots:SessionRoots)=>string;
|
|
20
|
+
export const projectForSession=runtime.projectForSession as (base:string,roots:SessionRoots,env?:NodeJS.ProcessEnv)=>{baseProject:string;project:string};
|
|
21
|
+
export const targetEnvironment=runtime.targetEnvironment as (roots:SessionRoots,env?:NodeJS.ProcessEnv)=>NodeJS.ProcessEnv;
|
|
22
|
+
export const parseWorktreeSelection = runtime.parseWorktreeSelection as (args: string[]) => { rest: string[]; selection?: WorktreeSelection };
|