@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
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// variable (apiKeyEnv) and the key is read from the process environment (a
|
|
11
11
|
// gitignored .env at the repo root, auto-loaded by the justfile's dotenv-load).
|
|
12
12
|
|
|
13
|
+
import {workspaceRoot} from '../../harnesses/lib/workspace-context.ts';
|
|
13
14
|
import { readFileSync } from "node:fs";
|
|
14
15
|
import { homedir } from "node:os";
|
|
15
16
|
import path from "node:path";
|
|
@@ -103,14 +104,14 @@ function readConfigFile(): { raw: unknown; source: string } | undefined {
|
|
|
103
104
|
if (fromEnv.startsWith("{")) {
|
|
104
105
|
return { raw: JSON.parse(fromEnv), source: "PI_STT_CONFIG (inline)" };
|
|
105
106
|
}
|
|
106
|
-
const resolved = path.resolve(fromEnv);
|
|
107
|
+
const resolved = path.resolve(workspaceRoot(process.cwd()),fromEnv);
|
|
107
108
|
return { raw: JSON.parse(readFileSync(resolved, "utf8")), source: resolved };
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
//
|
|
111
|
-
//
|
|
111
|
+
// Fleet workspace configuration wins over global configuration. A selected
|
|
112
|
+
// application worktree cannot replace the operator's STT provider settings.
|
|
112
113
|
const candidates = [
|
|
113
|
-
path.resolve(process.cwd(), ".ai", "stt.json"),
|
|
114
|
+
path.resolve(workspaceRoot(process.cwd()), ".ai", "stt.json"),
|
|
114
115
|
path.join(homedir(), ".pi", "agent", "stt.json"),
|
|
115
116
|
];
|
|
116
117
|
for (const file of candidates) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {worktreeConsumerService} from '../lib/system1/worktree-service.ts';
|
|
1
2
|
import {resolve} from 'node:path';
|
|
2
3
|
import type {ExtensionAPI,ExtensionContext} from '@mariozechner/pi-coding-agent';
|
|
3
4
|
import type {System1Service} from '../lib/system1/contracts.ts';
|
|
@@ -34,7 +35,7 @@ export function configureAgenticHub(pi:ExtensionAPI,options:{snapshot:ReturnType
|
|
|
34
35
|
// Persist the zero baseline too, so an enabled session with no evaluations
|
|
35
36
|
// resumes unambiguously; a missing historical baseline fails closed.
|
|
36
37
|
if(restored){try{persist(restored);}catch{restored=null;}}
|
|
37
|
-
const runtime=createAgenticRuntime({config,service:options.service,sessionId,context,persist,restored,collect,observe:(id,status)=>options.communicationStore?.finishAgentic(id,status)});
|
|
38
|
+
const runtime=createAgenticRuntime({config,service:worktreeConsumerService(options.service,options.snapshot.document,'agenticAsk'),sessionId,context,persist,restored,collect,observe:(id,status)=>options.communicationStore?.finishAgentic(id,status)});
|
|
38
39
|
sessions.set(pi,{runtime,evidence});
|
|
39
40
|
}
|
|
40
41
|
export function registerAgenticHub(pi:ExtensionAPI):void {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseModelProfiles, type ModelProfiles } from './model-profiles.ts';
|
|
2
|
+
import { workspaceRoot } from '../../lib/workspace-context.ts';
|
|
2
3
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
4
|
import { createEvidenceSession } from "../execution-evidence.ts";
|
|
4
5
|
import { join, resolve } from "node:path";
|
|
@@ -126,6 +127,7 @@ export interface AgentConfigurationPorts {
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
export function loadAgentConfiguration(cwd: string, ports: AgentConfigurationPorts): void {
|
|
130
|
+
cwd = workspaceRoot(cwd);
|
|
129
131
|
ports.setSessionDir(createEvidenceSession(cwd));
|
|
130
132
|
ports.ensureArtifactsLayout();
|
|
131
133
|
ports.resetAssertions();
|
|
@@ -159,6 +161,7 @@ export function loadAgentConfiguration(cwd: string, ports: AgentConfigurationPor
|
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
export function scanAgentDirs(cwd: string): AgentDef[] {
|
|
164
|
+
cwd = workspaceRoot(cwd);
|
|
162
165
|
const agents: AgentDef[] = [];
|
|
163
166
|
const seen = new Set<string>();
|
|
164
167
|
// PERSONA_DIRS fixes the precedence in one place: the user's own `agents/`
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { workspaceRoot } from "../../lib/workspace-context.ts";
|
|
3
4
|
import { resolvePolicyRoots, type PolicyRootTable } from "../../lib/policy-roots.ts";
|
|
4
5
|
import { clampDelegateDepth, MAX_DELEGATE_DEPTH } from "../helpers.ts";
|
|
5
6
|
import { DEFAULT_RUN_HISTORY_KEEP, normalizeRunHistoryKeep } from "../run-namespace.js";
|
|
@@ -67,15 +68,15 @@ function parseSubagentOverride(value: string): { model: string; tools?: string;
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
function resolveOverridesPolicy(cwd: string, overrides: AgentTeamOverrides): AgentTeamOverrides {
|
|
70
|
-
overrides.policyRoots = resolvePolicyRoots(cwd, overrides);
|
|
71
|
+
overrides.policyRoots = resolvePolicyRoots(cwd, overrides, workspaceRoot(cwd));
|
|
71
72
|
for (const diagnostic of overrides.policyRoots.diagnostics) {
|
|
72
|
-
overrides.warnings.push(`policy roots: ${diagnostic.message} — check rules/docs paths relative to the
|
|
73
|
+
overrides.warnings.push(`policy roots: ${diagnostic.message} — check rules/docs paths relative to the Fleet workspace; grants do not authorize writes or remote capture`);
|
|
73
74
|
}
|
|
74
75
|
return overrides;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
export function parseAgentTeamOverrides(cwd: string): AgentTeamOverrides {
|
|
78
|
-
const file = join(cwd, ".ai", "agent-fleet-overrides.md");
|
|
79
|
+
const file = join(workspaceRoot(cwd), ".ai", "agent-fleet-overrides.md");
|
|
79
80
|
if (!existsSync(file)) return resolveOverridesPolicy(cwd, freshOverrides());
|
|
80
81
|
let raw: string;
|
|
81
82
|
try { raw = readFileSync(file, "utf-8"); } catch { return resolveOverridesPolicy(cwd, freshOverrides()); }
|
|
@@ -6,7 +6,7 @@ import {join} from "node:path";
|
|
|
6
6
|
import {admittedContextOwner,validContextStatus,type ContextOwner} from "./context-continuity-owners.ts";
|
|
7
7
|
import {ContextCompactionRuntime} from "./context-compaction-runtime.ts";
|
|
8
8
|
import {getContextCompactionService} from "./system1-runtime.ts";
|
|
9
|
-
export interface ContextChannelAssignment {socket:string;owner:string;attempt:string;token:string}
|
|
9
|
+
export interface ContextChannelAssignment {targetId?:string;socket:string;owner:string;attempt:string;token:string}
|
|
10
10
|
export async function createContextContinuityBroker() {
|
|
11
11
|
const dir=mkdtempSync(join(tmpdir(),"af-context-")),socket=join(dir,"broker.sock");
|
|
12
12
|
const assessors=new Map<string,ContextCompactionRuntime>();let closed=false;
|
|
@@ -18,9 +18,9 @@ export async function createContextContinuityBroker() {
|
|
|
18
18
|
let raw="",handled=false;connection.setTimeout(1000,()=>connection.destroy());connection.on("error",()=>{});
|
|
19
19
|
connection.on("data",async chunk=>{if(handled)return;raw+=chunk.toString();if(Buffer.byteLength(raw)>16384){handled=true;return send(413,{status:"denied"});}if(!raw.includes("\n"))return;handled=true;
|
|
20
20
|
try{const body=JSON.parse(raw.trim());
|
|
21
|
-
if(!body || Object.keys(body).some(k=>!["owner","attempt","token","operation","payload"].includes(k)))return send(400,{status:"denied"});
|
|
21
|
+
if(!body || Object.keys(body).some(k=>!["owner","attempt","token","operation","payload","targetId"].includes(k)))return send(400,{status:"denied"});
|
|
22
22
|
const token=typeof body.token==="string"?body.token:"";
|
|
23
|
-
const owner=admittedContextOwner(body.attempt,body.owner,token);if(!owner)return send(403,{status:"denied"});
|
|
23
|
+
const owner=admittedContextOwner(body.attempt,body.owner,token);if(!owner||body.targetId!==owner.sessionRoots?.targetId)return send(403,{status:"denied"});
|
|
24
24
|
if(body.operation==="context_status") {
|
|
25
25
|
if(!validContextStatus(body.payload) || body.payload.episode<owner.status.episode)return send(400,{status:"denied"});
|
|
26
26
|
owner.status={...body.payload};
|
|
@@ -31,12 +31,14 @@ export async function createContextContinuityBroker() {
|
|
|
31
31
|
const p=body.payload;
|
|
32
32
|
if(!p || Object.keys(p).some(k=>!["identity","task","revision","turn","tokens","window","historyTokens","keepRecentTokens","responseTokens","unsafe"].includes(k)) || typeof p.task!=="string" || typeof p.identity!=="string" || p.identity.length>256 || p.task.length>8192 || typeof p.unsafe!=="boolean" || !["revision","turn","historyTokens","keepRecentTokens","responseTokens"].every(k=>Number.isSafeInteger(p[k]) && p[k]>=0) || !["tokens","window"].every(k=>p[k]===null || typeof p[k]==="number" && Number.isFinite(p[k]) && p[k]>=0))return send(400,{status:"denied"});
|
|
33
33
|
let assessor=assessors.get(owner.attempt);if(!assessor){assessor=new ContextCompactionRuntime();assessors.set(owner.attempt,assessor);}
|
|
34
|
-
const
|
|
34
|
+
const configured=getContextCompactionService();
|
|
35
|
+
const consumer=configured?.targetId===owner.sessionRoots?.targetId?configured:undefined;
|
|
36
|
+
const result=await assessor.assess({...p,identity:`${owner.owner}:${owner.attempt}:${p.identity}`},consumer?.service,consumer?.config);
|
|
35
37
|
if(!admittedContextOwner(body.attempt,body.owner,token))return send(403,{status:"denied"});
|
|
36
38
|
send(200,{status:"ok",assessment:result,owner:owner.owner,attempt:owner.attempt});
|
|
37
39
|
}catch{send(400,{status:"denied"});}
|
|
38
40
|
});
|
|
39
41
|
});
|
|
40
42
|
await new Promise<void>((resolve,reject)=>{server.once("error",reject);server.listen(socket,()=>{chmodSync(socket,0o600);resolve();});});server.unref();
|
|
41
|
-
return {assignment:(owner:ContextOwner):ContextChannelAssignment=>({socket,owner:owner.owner,attempt:owner.attempt,token:owner.token}),async close(){closed=true;for(const connection of connections)connection.destroy();for(const assessor of assessors.values())assessor.fence();await new Promise<void>(resolve=>server.close(()=>resolve()));rmSync(dir,{recursive:true,force:true});}};
|
|
43
|
+
return {assignment:(owner:ContextOwner):ContextChannelAssignment=>({...(owner.sessionRoots?{targetId:owner.sessionRoots.targetId}:{}),socket,owner:owner.owner,attempt:owner.attempt,token:owner.token}),async close(){closed=true;for(const connection of connections)connection.destroy();for(const assessor of assessors.values())assessor.fence();await new Promise<void>(resolve=>server.close(()=>resolve()));rmSync(dir,{recursive:true,force:true});}};
|
|
42
44
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import {sessionRootsFromEnv} from '../lib/workspace-context.ts';
|
|
1
2
|
import {createConnection} from "node:net";
|
|
2
3
|
import type {ContextChannelAssignment} from "./context-continuity-broker.ts";
|
|
3
4
|
export const CONTEXT_CHANNEL_ENV="AF_D7_CONTEXT_CHANNEL";
|
|
4
5
|
export function parseContextChannel(value:string|undefined):ContextChannelAssignment|undefined {
|
|
5
|
-
try{const a=JSON.parse(value??"");if(a && Object.keys(a).length===4 && typeof a.socket==="string" && a.socket.startsWith("/") && typeof a.owner==="string" && /^[a-f0-9]{64}$/.test(a.owner) && typeof a.attempt==="string" && /^[a-f0-9-]{36}$/.test(a.attempt) && typeof a.token==="string" && a.token.length===72)return a;}catch{}return undefined;
|
|
6
|
+
try{const a=JSON.parse(value??"");if(a && Object.keys(a).every(key=>['socket','owner','attempt','token','targetId'].includes(key)) && (Object.keys(a).length===4||Object.keys(a).length===5) && (a.targetId===undefined||typeof a.targetId==='string'&&/^[a-f0-9]{64}$/.test(a.targetId)) && typeof a.socket==="string" && a.socket.startsWith("/") && typeof a.owner==="string" && /^[a-f0-9]{64}$/.test(a.owner) && typeof a.attempt==="string" && /^[a-f0-9-]{36}$/.test(a.attempt) && typeof a.token==="string" && a.token.length===72)return a;}catch{}return undefined;
|
|
6
7
|
}
|
|
7
8
|
export function contextChannelCall(assignment:ContextChannelAssignment,operation:"context_status"|"context_assessment",payload:unknown,timeoutMs=1000,signal?:AbortSignal):Promise<any> {
|
|
8
|
-
const
|
|
9
|
+
const current=()=>{try{const roots=sessionRootsFromEnv();return (roots?.mode==='targeted'?roots.targetId:undefined)===assignment.targetId;}catch{return false;}};
|
|
10
|
+
if(!current())return Promise.resolve({status:'unavailable'});
|
|
11
|
+
const body=JSON.stringify({...(assignment.targetId?{targetId:assignment.targetId}:{}),owner:assignment.owner,attempt:assignment.attempt,token:assignment.token,operation,payload});
|
|
9
12
|
if(Buffer.byteLength(body)>16384 || signal?.aborted)return Promise.resolve({status:"unavailable"});
|
|
10
13
|
return new Promise(resolve=>{
|
|
11
14
|
let done=false;let raw="";
|
|
12
15
|
const req=createConnection(assignment.socket);
|
|
13
|
-
const finish=(result:any)=>{if(done)return;done=true;clearTimeout(timer);signal?.removeEventListener("abort",cancel);req.destroy();resolve(result);};
|
|
16
|
+
const finish=(result:any)=>{if(done)return;done=true;clearTimeout(timer);signal?.removeEventListener("abort",cancel);req.destroy();resolve(current()?result:{status:'unavailable'});};
|
|
14
17
|
const cancel=()=>finish({status:"unavailable"});const timer=setTimeout(cancel,timeoutMs);
|
|
15
18
|
req.on("connect",()=>req.write(body+"\n"));
|
|
16
19
|
req.on("data",chunk=>{raw+=chunk.toString();if(Buffer.byteLength(raw)>16384)return finish({status:"unavailable"});if(raw.includes("\n")){try{finish(JSON.parse(raw.trim()));}catch{finish({status:"unavailable"});}}});
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import {sessionRootsFromEnv,validateSessionRoots,type SessionRoots} from '../lib/workspace-context.ts';
|
|
1
2
|
import {randomUUID,createHash} from "node:crypto";
|
|
2
3
|
export interface ContextOwnerStatus {phase:"running"|"pending"|"compacting"|"recovered"|"continued"|"failed"|"cancelled";episode:number;tokens:number|null;window:number|null;cacheRead:number|null;cacheWrite:number|null;input:number|null;output:number|null}
|
|
3
|
-
export interface ContextOwner {owner:string;attempt:string;parent:string|null;status:ContextOwnerStatus;active:boolean;token:string}
|
|
4
|
+
export interface ContextOwner {readonly sessionRoots?:SessionRoots;readonly owner:string;readonly attempt:string;readonly parent:string|null;status:ContextOwnerStatus;active:boolean;readonly token:string}
|
|
4
5
|
const records=new Map<string,ContextOwner>();
|
|
5
6
|
export function openContextOwner(session:string,parent:string|null=null):ContextOwner {
|
|
6
7
|
const owner=createHash("sha256").update(session).digest("hex"),attempt=randomUUID();
|
|
7
|
-
const
|
|
8
|
+
const roots=sessionRootsFromEnv();
|
|
9
|
+
const entry:ContextOwner={...(roots?.mode==='targeted'?{sessionRoots:roots}:{}),owner,attempt,parent,token:randomUUID()+randomUUID(),active:true,status:{phase:"running",episode:0,tokens:null,window:null,cacheRead:null,cacheWrite:null,input:null,output:null}};for(const key of ['owner','attempt','parent','token',...(roots?.mode==='targeted'?['sessionRoots']:[])])Object.defineProperty(entry,key,{writable:false,configurable:false});records.set(attempt,entry);if(records.size>256){for(const [id,record] of records){if(!record.active){records.delete(id);if(records.size<=256)break;}}}return entry;
|
|
8
10
|
}
|
|
9
11
|
export function revokeContextOwner(attempt:string):void {const owner=records.get(attempt);if(owner)owner.active=false;}
|
|
10
12
|
export function contextOwners():Omit<ContextOwner,"token">[] {return [...records.values()].map(({token,...record})=>({...record,status:{...record.status}}));}
|
|
11
|
-
export function admittedContextOwner(attempt:string,owner:string,token:string):ContextOwner|undefined {const entry=records.get(attempt);return entry?.active && entry.owner===owner && entry.token===token?entry:undefined;}
|
|
13
|
+
export function admittedContextOwner(attempt:string,owner:string,token:string):ContextOwner|undefined {const entry=records.get(attempt);try{if(entry?.sessionRoots)validateSessionRoots(entry.sessionRoots);}catch{if(entry)entry.active=false;return undefined;}return entry?.active && entry.owner===owner && entry.token===token?entry:undefined;}
|
|
12
14
|
export function validContextStatus(value:any):value is ContextOwnerStatus {
|
|
13
15
|
if(!value || typeof value!=="object" || Array.isArray(value) || Object.keys(value).some(k=>!["phase","episode","tokens","window","cacheRead","cacheWrite","input","output"].includes(k)) || !["running","pending","compacting","recovered","continued","failed","cancelled"].includes(value.phase) || !Number.isSafeInteger(value.episode) || value.episode<0)return false;
|
|
14
16
|
return ["tokens","window","cacheRead","cacheWrite","input","output"].every(k=>value[k]===null || typeof value[k]==="number" && Number.isFinite(value[k]) && value[k]>=0);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {worktreeConsumerService} from '../lib/system1/worktree-service.ts';
|
|
1
2
|
import {randomUUID} from 'node:crypto';
|
|
2
3
|
import {beginRuntimeTrace,type TraceBus} from '../lib/execution-trace.ts';
|
|
3
4
|
import {realpathSync} from 'node:fs';
|
|
@@ -63,9 +64,10 @@ export function createDamageHubSession(options:HubSessionOptions){
|
|
|
63
64
|
return owners.validate(owner,tool,cwd);
|
|
64
65
|
},revoke:owners.revoke,
|
|
65
66
|
};
|
|
66
|
-
const
|
|
67
|
+
const scopedService=worktreeConsumerService(options.service,options.snapshot.document,'damageGuard');
|
|
68
|
+
const sharedService: System1Service|undefined=enabled&&scopedService?{evaluate:async request=>{
|
|
67
69
|
if(Date.now()<backoff)return {status:'unavailable',reason:'network'};
|
|
68
|
-
try{const result=await
|
|
70
|
+
try{const result=await scopedService!.evaluate(request);if(result.status!=='ok')backoff=Date.now()+config.limits.outageBackoffMs;return result;}catch(error){backoff=Date.now()+config.limits.outageBackoffMs;throw error;}
|
|
69
71
|
}}:undefined;
|
|
70
72
|
const latestActions=new Map<string,string>();
|
|
71
73
|
function noteAction(action:DamageAction){const key=overrideKey(action),prior=latestActions.get(action.owner);if(prior&&prior!==key)overrides.delete(prior);latestActions.set(action.owner,key);}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {randomUUID} from 'node:crypto';
|
|
2
|
+
import {sessionRootsFromEnv,validateSessionRoots} from '../lib/workspace-context.ts';
|
|
2
3
|
import {realpathSync} from 'node:fs';
|
|
3
4
|
import {validDamageAssignment, type DamageAssignment} from './damage-guard-broker.ts';
|
|
4
5
|
import {DAMAGE_ASSIGNMENT_ENV} from '../lib/damage-guard-port.ts';
|
|
@@ -29,11 +30,14 @@ export type DamagePhysicalIdentity=Readonly<{owner:string;attempt:string;tools:r
|
|
|
29
30
|
export type DamageOwnerIdentity=Readonly<DamageOwnerAuthority & DamagePhysicalIdentity>;
|
|
30
31
|
/** In-process parent capabilities, not launch permission or serializable credentials. */
|
|
31
32
|
export function createDamageOwners(deps:{current():DamageOwnerAuthority;admit(identity:DamageOwnerIdentity):boolean}){
|
|
33
|
+
const binding=sessionRootsFromEnv();
|
|
34
|
+
const targetCurrent=()=>{if(!binding)return !sessionRootsFromEnv();try{return validateSessionRoots(binding).targetId===sessionRootsFromEnv()?.targetId;}catch{return false;}};
|
|
32
35
|
const records=new Map<DamageOwnerIdentity,{controller:AbortController;parent?:DamageOwnerIdentity}>();let disposed=false;
|
|
33
36
|
const valid=(identity:DamageOwnerIdentity):boolean=>{
|
|
34
37
|
const row=records.get(identity);if(disposed||!row||identity.signal.aborted)return false;
|
|
35
38
|
try {
|
|
36
39
|
const current=deps.current();
|
|
40
|
+
if(!targetCurrent()||binding?.mode==='targeted'&&identity.cwd!==binding.executionRoot){revoke(identity);return false;}
|
|
37
41
|
if(['session','taskToken','taskId','inputRevision'].some(k=>identity[k as keyof DamageOwnerAuthority]!==current[k as keyof DamageOwnerAuthority])||row.parent&&!valid(row.parent)||deps.admit(identity)!==true){revoke(identity);return false;}
|
|
38
42
|
return true;
|
|
39
43
|
} catch {revoke(identity);return false;}
|
|
@@ -42,6 +46,7 @@ export function createDamageOwners(deps:{current():DamageOwnerAuthority;admit(id
|
|
|
42
46
|
return {
|
|
43
47
|
register(spec:DamageOwnerSpec,parent?:DamageOwnerIdentity):DamageOwnerIdentity{
|
|
44
48
|
const current=deps.current(),cwd=realpathSync(spec.cwd);
|
|
49
|
+
if(!targetCurrent()||binding?.mode==='targeted'&&cwd!==binding.executionRoot)throw Error('damage_owner_target_mismatch');
|
|
45
50
|
if(disposed||!spec.owner||spec.owner==='hub'||!spec.tools.length||spec.tools.some(t=>!['bash','write','edit','read','filesystem'].includes(t))||Object.values(current).some(v=>typeof v!=='string'||!v))throw Error('damage_owner_authority_unavailable');
|
|
46
51
|
if(parent&&(!valid(parent)||parent.cwd!==cwd||spec.tools.some(t=>!parent.tools.includes(t))))throw Error('damage_owner_scope_widening');
|
|
47
52
|
const controller=new AbortController(),identity=Object.freeze({...current,owner:`${spec.owner}:${randomUUID()}`,attempt:randomUUID(),tools:Object.freeze([...new Set(spec.tools)]),cwd,signal:controller.signal});
|
|
@@ -2,7 +2,8 @@ import { SPECIALIST_CLARIFICATION } from "../lib/clarification-policy.ts";
|
|
|
2
2
|
import { profileService } from './policy/profile-runtime.ts';
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { buildDeliverableProtocol } from "../lib/context-budget-child-prompt.ts";
|
|
5
|
-
import { unlinkSync } from "node:fs";
|
|
5
|
+
import { unlinkSync,realpathSync } from "node:fs";
|
|
6
|
+
import {sessionRootsFromEnv,validateSessionRoots,targetProject} from '../lib/workspace-context.ts';
|
|
6
7
|
import type { ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
7
8
|
import type { ComsIdentity, ComsSendParams, ComsSendResult, PendingReply, RegistryEntry } from "../lib/coms-core.ts";
|
|
8
9
|
import { judgeSessionFileName, type DriftJudgeOutcome } from "./drift-runtime.ts";
|
|
@@ -93,8 +94,11 @@ async function dispatchViaComs(
|
|
|
93
94
|
inputArtifacts: DispatchInputArtifactPreview[],
|
|
94
95
|
scopeGlobs: string[],
|
|
95
96
|
): Promise<ComsDispatchResult | null> {
|
|
97
|
+
const binding=sessionRootsFromEnv();
|
|
98
|
+
const targetCurrent=()=>{try{return sessionRootsFromEnv()?.targetId===binding?.targetId&&(!binding||validateSessionRoots(binding).targetId===binding.targetId);}catch{return false;}};
|
|
99
|
+
const verified=(entry:RegistryEntry|null)=>{if(!targetCurrent())return false;if(binding?.mode!=='targeted')return true;try{const identity=deps.getIdentity();return entry?.targetId===binding.targetId&&identity?.targetId===binding.targetId&&typeof identity.baseProject==='string'&&identity.project===targetProject(identity.baseProject,binding)&&realpathSync(entry.cwd)===binding.executionRoot;}catch{return false;}};
|
|
96
100
|
const peer = deps.resolveTarget(peerName);
|
|
97
|
-
if (!peer || !deps.getIdentity()) {
|
|
101
|
+
if (!peer || !deps.getIdentity() || !verified(peer)) {
|
|
98
102
|
if (allowNativeFallback) return null;
|
|
99
103
|
return { output: `coms dispatch failed: peer "${peerName}" left the pool (fallback: none).`, exitCode: 1, elapsed: 0 };
|
|
100
104
|
}
|
|
@@ -154,6 +158,7 @@ ${buildDeliverableProtocol(agentKey, runNumber, deps.safePathWithin(deps.getSess
|
|
|
154
158
|
if (outcome.error !== "timeout") deps.deletePendingReply(msgId);
|
|
155
159
|
|
|
156
160
|
const after = deps.resolveTarget(peer.name);
|
|
161
|
+
if(binding?.mode==='targeted'&&(!verified(after)||after?.session_id!==peer.session_id))return {output:'coms result refused: target or peer ownership changed; no result was accepted.',exitCode:1,elapsed:0};
|
|
157
162
|
if (after?.context_used_pct != null) state.contextPct = after.context_used_pct;
|
|
158
163
|
if (abandoned) {
|
|
159
164
|
return {
|
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { constants, copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname } from "node:path";
|
|
4
|
+
import {sessionRootsFromEnv,validateSessionRoots} from '../lib/workspace-context.ts';
|
|
5
|
+
import {safeSourceRead} from '../lib/safe-source-read.js';
|
|
4
6
|
import { safePathWithin } from "./helpers.ts";
|
|
5
7
|
|
|
6
8
|
/** Allocate rather than clear: another live session may own any existing directory. */
|
|
7
9
|
export function createEvidenceSession(cwd: string): string {
|
|
8
10
|
const sessionId = randomUUID();
|
|
9
|
-
const
|
|
11
|
+
const roots=sessionRootsFromEnv();
|
|
12
|
+
if(roots?.mode==='targeted')cwd=roots.workspaceRoot;
|
|
13
|
+
const dir = roots?.mode==='targeted'?safePathWithin(cwd,'.pi','agent-sessions','targets',roots.targetId,'sessions',sessionId):safePathWithin(cwd, ".pi", "agent-sessions", "sessions", sessionId);
|
|
10
14
|
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
11
|
-
writeFileSync(safePathWithin(dir, "session.json"), JSON.stringify({ sessionId, cwd, pid: process.pid, startedAt: new Date().toISOString() }, null, 2), { flag: "wx", mode: 0o600 });
|
|
15
|
+
writeFileSync(safePathWithin(dir, "session.json"), JSON.stringify({ sessionId, cwd:roots?.executionRoot??cwd, ...(roots?.mode==='targeted'?{workspaceRoot:roots.workspaceRoot,executionRoot:roots.executionRoot,targetId:roots.targetId,roots}:{}), pid: process.pid, startedAt: new Date().toISOString() }, null, 2), { flag: "wx", mode: 0o600 });
|
|
12
16
|
return dir;
|
|
13
17
|
}
|
|
14
18
|
|
|
19
|
+
function evidenceTarget(sessionDir:string){
|
|
20
|
+
const path=safePathWithin(sessionDir,'session.json');if(!existsSync(path))return undefined;
|
|
21
|
+
const metadata=JSON.parse(safeSourceRead(sessionDir,path,65536).toString('utf8'));
|
|
22
|
+
if(!metadata.roots)return undefined;
|
|
23
|
+
const roots=validateSessionRoots(metadata.roots);
|
|
24
|
+
if(sessionRootsFromEnv()?.targetId!==roots.targetId)throw Error('evidence_target_mismatch');
|
|
25
|
+
return {targetId:roots.targetId,workspaceRoot:roots.workspaceRoot,executionRoot:roots.executionRoot,repositoryRoot:roots.repositoryRoot};
|
|
26
|
+
}
|
|
27
|
+
|
|
15
28
|
/** Request/result are separate create-exclusive records; even failed and resumed runs survive. */
|
|
16
29
|
export function beginExecutionEvidence(sessionDir: string, dispatchId: string, request: object, inputs: { path: string }[] = []): string {
|
|
30
|
+
const target=evidenceTarget(sessionDir);
|
|
17
31
|
const dir = safePathWithin(sessionDir, "dispatches", dispatchId);
|
|
18
32
|
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
19
33
|
const retainedInputs = inputs.map((input, i) => {
|
|
@@ -21,13 +35,14 @@ export function beginExecutionEvidence(sessionDir: string, dispatchId: string, r
|
|
|
21
35
|
copyFileSync(input.path, retainedPath, constants.COPYFILE_EXCL);
|
|
22
36
|
return { path: input.path, retainedPath };
|
|
23
37
|
});
|
|
24
|
-
writeFileSync(safePathWithin(dir, "request.json"), JSON.stringify({ ...request, dispatchId, inputs: retainedInputs }, null, 2), { flag: "wx", mode: 0o600 });
|
|
38
|
+
writeFileSync(safePathWithin(dir, "request.json"), JSON.stringify({ ...request, dispatchId, ...(target?{sessionTarget:target}:{}), inputs: retainedInputs }, null, 2), { flag: "wx", mode: 0o600 });
|
|
25
39
|
return dir;
|
|
26
40
|
}
|
|
27
41
|
|
|
28
42
|
export function finishExecutionEvidence<T extends object>(dir: string, result: T): T & { evidencePath: string } {
|
|
29
43
|
const evidencePath = safePathWithin(dir, "result.json");
|
|
30
|
-
const
|
|
44
|
+
const target=evidenceTarget(dirname(dirname(dir)));
|
|
45
|
+
const recorded = { ...result, evidencePath, ...(target?{sessionTarget:target}:{}) };
|
|
31
46
|
writeFileSync(evidencePath, JSON.stringify(recorded, null, 2), { flag: "wx", mode: 0o600 });
|
|
32
47
|
return recorded;
|
|
33
48
|
}
|
|
@@ -72,6 +87,7 @@ export function pruneEvidenceSessions(sessionDir: string, keep: number | null, a
|
|
|
72
87
|
}
|
|
73
88
|
|
|
74
89
|
export function retainDeliverable(sessionDir: string, dispatchId: string, index: number, bytes: Buffer): string {
|
|
90
|
+
evidenceTarget(sessionDir);
|
|
75
91
|
const dir = safePathWithin(sessionDir, "dispatches", dispatchId, "deliverables");
|
|
76
92
|
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
77
93
|
const path = safePathWithin(dir, String(index));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {worktreeConsumerService} from '../../lib/system1/worktree-service.ts';
|
|
1
2
|
import type {CommunicationStore} from '../system1-communication-store.ts';
|
|
2
3
|
import {originalDamageResult} from '../../lib/damage-result-evidence.ts';
|
|
3
4
|
import {damageResultView} from '../../lib/damage-result-view.ts';
|
|
@@ -40,7 +41,7 @@ export function configureDiscoveryHub(pi:ExtensionAPI,options:{snapshot:ReturnTy
|
|
|
40
41
|
const context=()=>sourceHash(JSON.stringify([options.taskId(),task()]));
|
|
41
42
|
let restored=restoreDiscoveryCounter(entries(),sessionId);const persist=(s:any)=>pi.appendEntry(DISCOVERY_COUNTER,s);
|
|
42
43
|
if(restored){try{persist(restored);}catch{restored=null;}}
|
|
43
|
-
const runtime=createDiscoveryRuntime({root:options.ctx.cwd,sessionId,config,service:options.service,context,persist,restored,observe:metadata=>options.communicationStore?.beginDiscovery(metadata)??(()=>{})});
|
|
44
|
+
const runtime=createDiscoveryRuntime({root:options.ctx.cwd,sessionId,config,service:worktreeConsumerService(options.service,options.snapshot.document,'fileDiscovery'),context,persist,restored,observe:metadata=>options.communicationStore?.beginDiscovery(metadata)??(()=>{})});
|
|
44
45
|
// Latest user text revises Hub advice/cache, not the task bound to a live child.
|
|
45
46
|
const owners=createDiscoveryOwners(sessionId,options.taskId);
|
|
46
47
|
const session:Session={runtime,config,root:options.ctx.cwd,sessionDir:options.sessionDir,task,context,taskId:options.taskId,results:new Map(),events:new Map(),owners,broker:Promise.resolve(null)};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {randomBytes,randomUUID,timingSafeEqual} from 'node:crypto';
|
|
2
|
+
import {sessionRootsFromEnv,validateSessionRoots} from '../../lib/workspace-context.ts';
|
|
2
3
|
import {realpathSync} from 'node:fs';
|
|
3
4
|
import {resolve} from 'node:path';
|
|
4
5
|
import {sourceHash,exportPathAllowed} from '../agentic-sources.ts';
|
|
@@ -11,6 +12,8 @@ export interface DiscoveryOwner {
|
|
|
11
12
|
export interface DiscoveryAssignment {endpoint:string;capability:string;sessionId:string;taskId:string;ownerId:string;attemptId:string;queryHash:string}
|
|
12
13
|
export interface OwnerLease extends DiscoveryOwner {sessionId:string;capability:string;queryHash:string;signal:AbortSignal;attemptSignal:AbortSignal;expiresAt:number}
|
|
13
14
|
export function createDiscoveryOwners(sessionId:string,currentTaskId:()=>string,options:{maxOwners?:number;now?():number;ttlMs?:number;currentContext?():string}={}) {
|
|
15
|
+
const binding=sessionRootsFromEnv();
|
|
16
|
+
const targetCurrent=()=>{try{return sessionRootsFromEnv()?.targetId===binding?.targetId&&(!binding||validateSessionRoots(binding).targetId===binding.targetId);}catch{return false;}};
|
|
14
17
|
const leases=new Map<string,{lease:OwnerLease;controller:AbortController;attemptController:AbortController;timer:ReturnType<typeof setTimeout>;requests:Set<string>;context:string}>();
|
|
15
18
|
const parents=new Map<string,string>(),launches=new Map<string,Map<string,{identity:string;attempts:number;capability:string}>>();
|
|
16
19
|
const now=options.now??Date.now;let closed=false;
|
|
@@ -18,11 +21,12 @@ export function createDiscoveryOwners(sessionId:string,currentTaskId:()=>string,
|
|
|
18
21
|
// authoritative revocation so a later task switch/dispose can still terminate it.
|
|
19
22
|
const expire=(capability:string)=>{const row=leases.get(capability);if(!row)return;row.controller.abort();clearTimeout(row.timer);for(const [child,parent]of parents)if(parent===capability)expire(child);};
|
|
20
23
|
const revoke=(capability:string)=>{const row=leases.get(capability);if(!row)return;expire(capability);for(const [child,parent]of parents)if(parent===capability)revoke(child);row.attemptController.abort();leases.delete(capability);parents.delete(capability);launches.delete(capability);};
|
|
21
|
-
const active=(lease:OwnerLease)
|
|
22
|
-
const fresh=(lease:OwnerLease)
|
|
24
|
+
const active=(lease:OwnerLease)=>targetCurrent()&&!closed&&lease.sessionId===sessionId&&lease.taskId===currentTaskId();
|
|
25
|
+
const fresh=(lease:OwnerLease)=>targetCurrent()&&!closed&&!lease.signal.aborted&&lease.sessionId===sessionId&&lease.taskId===currentTaskId()&&lease.expiresAt>now()&&leases.get(lease.capability)?.context===(options.currentContext?.()??currentTaskId());
|
|
23
26
|
return {
|
|
24
|
-
admitted(owner:Pick<DiscoveryOwner,'taskId'>){return
|
|
27
|
+
admitted(owner:Pick<DiscoveryOwner,'taskId'>){return targetCurrent()&&!closed&&owner.taskId===currentTaskId();},
|
|
25
28
|
register(owner:DiscoveryOwner,ttlMs=options.ttlMs??1200000):OwnerLease {
|
|
29
|
+
if(!targetCurrent()||binding?.mode==='targeted'&&realpathSync(owner.cwd)!==binding.executionRoot)throw Error('owner_target_mismatch');
|
|
26
30
|
if(closed||owner.taskId!==currentTaskId()||!owner.task.trim()||!owner.query.trim()||![sessionId,owner.taskId,owner.ownerId,owner.attemptId].every(v=>typeof v==='string'&&v.length>0&&v.length<=128)||leases.size>=(options.maxOwners??128)||!Number.isSafeInteger(ttlMs)||ttlMs<1||ttlMs>3600000)throw Error('owner_registration_denied');
|
|
27
31
|
if([...leases.values()].some(({lease})=>lease.ownerId===owner.ownerId&&lease.attemptId===owner.attemptId))throw Error('attempt_already_registered');
|
|
28
32
|
const capability=randomBytes(32).toString('hex'),controller=new AbortController(),attemptController=new AbortController();
|
|
@@ -2,6 +2,7 @@ import { registerDiscoveryHub, configureDiscoveryHub, resetDiscoveryHub, discove
|
|
|
2
2
|
import { registerDamageGuardHub, configureDamageGuardHub, resetDamageGuardHub, acceptDamageGuardInput, prepareDamageGuardNative } from './damage-guard-hub.ts';
|
|
3
3
|
import { bindSemanticScope } from '../lib/semantic-approval.ts';
|
|
4
4
|
import { registerAgenticHub, configureAgenticHub, agenticHubEnabled, agenticHubRuntime, resetAgenticHub } from './agentic-hub.ts';
|
|
5
|
+
import {worktreeConsumerService} from '../lib/system1/worktree-service.ts';
|
|
5
6
|
import { loadSystem1Snapshot } from "../lib/system1/config-loader.js";
|
|
6
7
|
import { normalizeSystem1Config } from "../lib/system1/config-v2.js";
|
|
7
8
|
import { registerDispatchTriage } from "./tools/dispatch-triage.ts";
|
|
@@ -2412,7 +2413,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2412
2413
|
taskTriageConfigured = taskTriageConfig.status !== "missing";
|
|
2413
2414
|
taskTriageConfigStatus = taskTriageConfig.status === "active" ? "active" : taskTriageConfig.status === "invalid" ? "invalid" : "off";
|
|
2414
2415
|
taskTriageActivity = taskTriageConfig.status === "active" ? createTaskTriageActivity({ directory: sessionDir ? path.join(sessionDir, "artifacts/task-triage-activity") : undefined }) : null;
|
|
2415
|
-
taskTriage = taskTriageConfig.status === "active" ? createTaskTriageRuntime({ root: _ctx.cwd || process.cwd(), service: sharedService, serviceUnavailableReason, persist: state => pi.appendEntry(TASK_TRIAGE_RUNTIME_ENTRY, state), observer: taskTriageActivity! }) : null;
|
|
2416
|
+
taskTriage = taskTriageConfig.status === "active" ? createTaskTriageRuntime({ root: _ctx.cwd || process.cwd(), service: worktreeConsumerService(sharedService,system1Snapshot.document,'taskTriage'), serviceUnavailableReason, persist: state => pi.appendEntry(TASK_TRIAGE_RUNTIME_ENTRY, state), observer: taskTriageActivity! }) : null;
|
|
2416
2417
|
if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
|
|
2417
2418
|
try { fs.appendFileSync(process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD, JSON.stringify({ pid: process.pid, phase: "service_init", configStatus: taskTriageConfig.status, consumerPresent: !!taskTriage, fakeTransportActive: taskTriageTestTransportActive, sharedServiceReady: !!sharedService, serviceUnavailableReason }) + "\n"); } catch { /* diagnostic only */ }
|
|
2418
2419
|
}
|
|
@@ -2420,7 +2421,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2420
2421
|
try { _ctx.ui.notify(`Task triage is enabled but unavailable (${serviceUnavailableReason}); no inference or new requirements will be added. Existing process obligations remain enforced.`, "warning"); }
|
|
2421
2422
|
catch { /* Optional UI must not change process enforcement. The prompt retains the status. */ }
|
|
2422
2423
|
}
|
|
2423
|
-
triageRuntime = createTriageRuntime({ config: triageConfig, service: watchdogSystem1?.sharedService,
|
|
2424
|
+
triageRuntime = createTriageRuntime({ config: triageConfig, service: worktreeConsumerService(watchdogSystem1?.sharedService,system1Snapshot.document,'dispatchTriage'),
|
|
2424
2425
|
current: input => triageInput(input.task,input.scope,input.language,input.domain),
|
|
2425
2426
|
trace: event => pi.appendEntry("agent-hub-triage", event),
|
|
2426
2427
|
});
|
|
@@ -2439,7 +2440,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2439
2440
|
});
|
|
2440
2441
|
if (proactiveConfig && sessionDir) {
|
|
2441
2442
|
try { proactiveRuntime = composeHubProactive({ config: proactiveConfig, root: _ctx.cwd, sessionDir,
|
|
2442
|
-
rulesRoots: sessionOverrides.rulesDirs, policyRoots: sessionOverrides.policyRoots, service: watchdogSystem1?.sharedService, capture: hubCapture, onChange: updateWidget }); }
|
|
2443
|
+
rulesRoots: sessionOverrides.rulesDirs, policyRoots: sessionOverrides.policyRoots, service: worktreeConsumerService(watchdogSystem1?.sharedService,system1Snapshot.document,'proactiveReview'), capture: hubCapture, onChange: updateWidget }); }
|
|
2443
2444
|
catch { proactiveRuntime = null; proactiveConfig = null; } // unavailable composition never reports reviewed
|
|
2444
2445
|
}
|
|
2445
2446
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { workspaceRoot } from '../../lib/workspace-context.ts';
|
|
1
2
|
import { resolvePolicyReferences } from "../../lib/policy-roots.ts";
|
|
2
3
|
import { validateProfile, type ModelProfiles } from '../config/model-profiles.ts';
|
|
3
4
|
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
@@ -72,9 +73,9 @@ export function applySessionOverrides<TDef extends AgentDef>(ctx: ExtensionConte
|
|
|
72
73
|
ports.updateModeStatus();
|
|
73
74
|
if (overrides.warnings.length) ctx.ui.notify(`agent-fleet-overrides warnings:\n${overrides.warnings.join("\n")}`, "warning");
|
|
74
75
|
ports.setProjectRules(overrides.policyRoots ? resolvePolicyReferences(overrides.policyRoots,overrides.rulesDirs,"rules") : overrides.rulesDirs);
|
|
75
|
-
for (const dir of overrides.rulesDirs) if (!existsSync(join(ctx.cwd, dir))) ctx.ui.notify(`agent-fleet-overrides: rules folder "${dir}" not found in ${ctx.cwd}`, "warning");
|
|
76
|
+
for (const dir of overrides.rulesDirs) if (!existsSync(join(workspaceRoot(ctx.cwd), dir))) ctx.ui.notify(`agent-fleet-overrides: rules folder "${dir}" not found in ${ctx.cwd}`, "warning");
|
|
76
77
|
ports.setProjectDocs(overrides.policyRoots ? resolvePolicyReferences(overrides.policyRoots,overrides.docsPaths,"docs") : overrides.docsPaths);
|
|
77
|
-
for (const entry of overrides.docsPaths) if (!existsSync(join(ctx.cwd, entry))) ctx.ui.notify(`agent-fleet-overrides: docs entry point "${entry}" not found in ${ctx.cwd}`, "warning");
|
|
78
|
+
for (const entry of overrides.docsPaths) if (!existsSync(join(workspaceRoot(ctx.cwd), entry))) ctx.ui.notify(`agent-fleet-overrides: docs entry point "${entry}" not found in ${ctx.cwd}`, "warning");
|
|
78
79
|
|
|
79
80
|
ports.resetModelPolicy();
|
|
80
81
|
const defs = ports.getAgentDefs();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
1
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
2
|
+
import { sessionRootsFromEnv } from '../lib/workspace-context.ts';
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { join } from "node:path";
|
|
4
5
|
|
|
@@ -39,6 +40,11 @@ export function abbrevThinking(level: string): string {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export function resolveDelegateExtension(cwd: string): string | null {
|
|
43
|
+
const roots=sessionRootsFromEnv();
|
|
44
|
+
if(roots?.mode==='targeted'){
|
|
45
|
+
const candidate=join(roots.resourceRoot,'.pi/harnesses/agent-hub/delegate.ts');
|
|
46
|
+
return existsSync(candidate)&&realpathSync(candidate).startsWith(roots.resourceRoot+'/')?realpathSync(candidate):null;
|
|
47
|
+
}
|
|
42
48
|
try {
|
|
43
49
|
const extension = fileURLToPath(new URL("./delegate.ts", import.meta.url));
|
|
44
50
|
if (existsSync(extension)) return extension;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { gateWorktreeSnapshot } from '../lib/system1/worktree-scopes.ts';
|
|
1
2
|
import { policyRootValidationContext, type PolicyRootTable } from "../lib/policy-roots.ts";
|
|
2
3
|
import { normalizeSystem1Config } from "../lib/system1/config-v2.js";
|
|
3
4
|
import { loadSystem1Snapshot } from "../lib/system1/config-loader.js";
|
|
@@ -13,7 +14,7 @@ export function parseProactiveConfig(value: unknown, roots?: PolicyRootTable): L
|
|
|
13
14
|
}
|
|
14
15
|
/** Missing or invalid section cannot authorize capture; shared snapshot is optional for standalone callers. */
|
|
15
16
|
export function loadProactiveConfig(repo: string, snapshot = loadSystem1Snapshot(repo), roots?: PolicyRootTable): LocalProactiveConfig {
|
|
16
|
-
const contextual = roots && snapshot.document ? normalizeSystem1Config(snapshot.document,policyRootValidationContext(roots)) : snapshot;
|
|
17
|
+
const contextual = gateWorktreeSnapshot(roots && snapshot.document ? normalizeSystem1Config(snapshot.effectiveDocument ?? snapshot.document,policyRootValidationContext(roots)) : snapshot);
|
|
17
18
|
const section = contextual.consumers.proactiveReview;
|
|
18
19
|
if (section.status === "invalid") throw new Error("Invalid $.consumers.proactiveReview");
|
|
19
20
|
return section.config as LocalProactiveConfig ?? OFF;
|
|
@@ -32,7 +32,7 @@ export function discoverRules(repo: string, roots: readonly string[], policyRoot
|
|
|
32
32
|
for (const root of roots) {
|
|
33
33
|
// Match against the lexical checkout used to create the grant, not its realpath
|
|
34
34
|
// (macOS /var aliases and symlinked checkout parents differ from repoReal).
|
|
35
|
-
const checkoutLexical = policyRoots?.roots.find(r => r.role === "workspace")?.lexicalPath ?? repo;
|
|
35
|
+
const checkoutLexical = policyRoots?.configBase ?? policyRoots?.roots.find(r => r.role === "workspace")?.lexicalPath ?? repo;
|
|
36
36
|
const grant = policyRoots?.roots.find(r => r.role === "rules" && r.lexicalPath === resolve(checkoutLexical, root));
|
|
37
37
|
const external = !!grant && !inside(repoReal, grant.canonicalPath);
|
|
38
38
|
if (!root || isAbsolute(root) || (!grant && root.split(/[\\/]/).some(s => !s || s === ".." || s === "." || denied.test(s)))) { gaps.push(policyRoots ? `ungranted_root:${root}` : "invalid_root"); continue; }
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {sessionRootsFromEnv,validateSessionRoots,sessionGitEnv,type SessionRoots} from '../lib/workspace-context.ts';
|
|
1
2
|
import { captureExternal, type ExternalBaseline } from "./proactive-external.ts";
|
|
2
3
|
import type { PolicyRootTable } from "../lib/policy-roots.ts";
|
|
3
4
|
import { safeSourceRead } from "../lib/safe-source-read.js";
|
|
@@ -33,7 +34,7 @@ function remaining(start: number, now: () => number): number {
|
|
|
33
34
|
function git(root: string, args: string[], start: number, now: () => number, maxBuffer = 1024 * 1024): Buffer {
|
|
34
35
|
remaining(start, now);
|
|
35
36
|
// The enclosing process-group deadline owns cancellation; this is only a backup.
|
|
36
|
-
const bytes = execFileSync("git", ["-C", root, ...args], { timeout: PROACTIVE_LIMITS.captureMs + 200, maxBuffer, stdio: ["ignore", "pipe", "pipe"] });
|
|
37
|
+
const bytes = execFileSync("git", ["-C", root, ...args], { env:process.env.AF_SESSION_ROOTS?sessionGitEnv():process.env, timeout: PROACTIVE_LIMITS.captureMs + 200, maxBuffer, stdio: ["ignore", "pipe", "pipe"] });
|
|
37
38
|
remaining(start, now);
|
|
38
39
|
return bytes;
|
|
39
40
|
}
|
|
@@ -64,6 +65,7 @@ function excerpt(bytes: Buffer, secrets: readonly string[]): SourceExcerpt {
|
|
|
64
65
|
return Object.freeze({ hash: hash(text), offset: 0, endOffset: bytes.length, startLine: 1, endLine: Math.max(1, source.split("\n").length - (source.endsWith("\n") ? 1 : 0)), text, truncated: false });
|
|
65
66
|
}
|
|
66
67
|
export interface TurnBaseline {
|
|
68
|
+
readonly sessionRoots?:SessionRoots;
|
|
67
69
|
readonly root: string;
|
|
68
70
|
readonly head: string;
|
|
69
71
|
readonly dirty: ReadonlyMap<string, Buffer | null>;
|
|
@@ -83,6 +85,8 @@ const code = (e: unknown): string => {
|
|
|
83
85
|
/** Worker-only synchronous core. Never call on the agent's event loop. */
|
|
84
86
|
export function beginTurnCore(input: { root: string; config: ProactiveConfig; turnId: string; context: TaskContext; knownTargets?: readonly string[]; now?: () => number; policyRoots?: PolicyRootTable }): TurnBaseline | null {
|
|
85
87
|
if (!isCaptureEnabled(input.config)) return null;
|
|
88
|
+
let sessionRoots:SessionRoots|undefined;
|
|
89
|
+
try{sessionRoots=sessionRootsFromEnv();if(sessionRoots&&realpathSync(input.root)!==sessionRoots.executionRoot)return null;}catch{return null;}
|
|
86
90
|
const now = input.now ?? Date.now, startedAt = now();
|
|
87
91
|
let head = "";
|
|
88
92
|
let initialPaths = new Set<string>();
|
|
@@ -114,9 +118,11 @@ export function beginTurnCore(input: { root: string; config: ProactiveConfig; tu
|
|
|
114
118
|
const index = gaps.indexOf("git_unavailable");
|
|
115
119
|
if (index >= 0) gaps.splice(index, 1);
|
|
116
120
|
}
|
|
117
|
-
return { independentWorkspace, root: input.root, head, dirty, initialPaths, config: input.config, turnId: input.turnId, context: structuredClone(input.context), gaps, startedAt, ...(external ? {external} : {}) };
|
|
121
|
+
return { ...(sessionRoots?{sessionRoots}:{}), independentWorkspace, root: input.root, head, dirty, initialPaths, config: input.config, turnId: input.turnId, context: structuredClone(input.context), gaps, startedAt, ...(external ? {external} : {}) };
|
|
118
122
|
}
|
|
119
123
|
export function finishTurnCore(baseline: TurnBaseline | null, input: { assistantText?: string; knownTargets?: readonly string[]; secrets?: readonly string[]; overlap?: boolean; now?: () => number; afterFirstRead?: () => void } = {}): TurnSnapshot | null {
|
|
124
|
+
const targetCurrent=()=>{try{if(baseline?.sessionRoots)validateSessionRoots(baseline.sessionRoots);return baseline?.sessionRoots?.targetId===sessionRootsFromEnv()?.targetId;}catch{return false;}};
|
|
125
|
+
if(!targetCurrent())return null;
|
|
120
126
|
if (!baseline) return null;
|
|
121
127
|
const now = input.now ?? Date.now, started = now();
|
|
122
128
|
const gaps = [...baseline.gaps];
|
|
@@ -196,17 +202,19 @@ export function finishTurnCore(baseline: TurnBaseline | null, input: { assistant
|
|
|
196
202
|
else { units.push(Object.freeze({ id: hash(`${baseline.turnId}:assistant`), path: "assistant", kind: "text", after: redacted, attribution: "observed_only" })); retained += size; }
|
|
197
203
|
}
|
|
198
204
|
const statusValue = gaps.some(g => g.includes("unstable_snapshot")) ? "unstable_snapshot" : gaps.length ? "partial" : "complete";
|
|
199
|
-
|
|
205
|
+
if(!targetCurrent())return null;
|
|
206
|
+
const snapshotId = hash(JSON.stringify([...(baseline.sessionRoots?[baseline.sessionRoots.targetId]:[]),baseline.turnId, baseline.head, baseline.context, units.map(u => [u.id, u.before?.hash, u.after?.hash]), gaps]));
|
|
200
207
|
const context = structuredClone(baseline.context);
|
|
201
208
|
Object.freeze(context.task);
|
|
202
209
|
if (context.plan) Object.freeze(context.plan);
|
|
203
210
|
for (const rule of context.rules) Object.freeze(rule);
|
|
204
211
|
Object.freeze(context.rules); Object.freeze(context.exceptions); Object.freeze(context);
|
|
205
|
-
return Object.freeze({ snapshotId, turnId: baseline.turnId, head: baseline.head, context, planStatus: baseline.context.plan ? "bound" : "task_only", status: statusValue, gaps: Object.freeze(gaps), units: Object.freeze(units), observedPaths: observedPaths.size, coverage: Object.freeze({ retainedUnits: units.length, omittedPaths: omitted, retainedBytes: retained }) });
|
|
212
|
+
return Object.freeze({ ...(baseline.sessionRoots?{targetId:baseline.sessionRoots.targetId,workspaceRoot:baseline.sessionRoots.workspaceRoot,executionRoot:baseline.sessionRoots.executionRoot}:{}), snapshotId, turnId: baseline.turnId, head: baseline.head, context, planStatus: baseline.context.plan ? "bound" : "task_only", status: statusValue, gaps: Object.freeze(gaps), units: Object.freeze(units), observedPaths: observedPaths.size, coverage: Object.freeze({ retainedUnits: units.length, omittedPaths: omitted, retainedBytes: retained }) });
|
|
206
213
|
}
|
|
207
214
|
/** Immutable in-memory readback: never opens the source path. */
|
|
208
215
|
export function readSnapshotUnit(snapshot: TurnSnapshot, snapshotId: string, unitId: string, contentHash: string): string | null {
|
|
209
216
|
if (snapshot.snapshotId !== snapshotId) return null;
|
|
217
|
+
if(snapshot.targetId){try{if(sessionRootsFromEnv()?.targetId!==snapshot.targetId)return null;}catch{return null;}}
|
|
210
218
|
const unit = snapshot.units.find(u => u.id === unitId);
|
|
211
219
|
const excerpt = [unit?.before, unit?.after].find(e => e?.hash === contentHash);
|
|
212
220
|
return excerpt?.text ?? null;
|
|
@@ -44,6 +44,9 @@ export interface TurnUnit {
|
|
|
44
44
|
readonly sourceRootId?: string;
|
|
45
45
|
}
|
|
46
46
|
export interface TurnSnapshot {
|
|
47
|
+
readonly targetId?:string;
|
|
48
|
+
readonly workspaceRoot?:string;
|
|
49
|
+
readonly executionRoot?:string;
|
|
47
50
|
readonly snapshotId: string;
|
|
48
51
|
readonly turnId: string;
|
|
49
52
|
readonly head: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
1
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
2
|
+
import { sessionRootsFromEnv } from '../lib/workspace-context.ts';
|
|
2
3
|
import { join, resolve } from "node:path";
|
|
3
4
|
|
|
4
5
|
const CONTINUE_ENTRY = /damage-control-continue[/\\]index\.ts$/;
|
|
@@ -6,6 +7,11 @@ const MISSING_SAFETY_ERROR = "damage-control-continue harness not found — guar
|
|
|
6
7
|
|
|
7
8
|
/** Resolve only the surviving continue harness; never downgrade to an unguarded or hard-stop child. */
|
|
8
9
|
export function resolveSafetyHarness(cwd: string, argv: string[] = process.argv): string | null {
|
|
10
|
+
const roots=sessionRootsFromEnv();
|
|
11
|
+
if(roots?.mode==='targeted'){
|
|
12
|
+
const candidate=join(roots.resourceRoot,'.pi/harnesses/damage-control-continue/index.ts');
|
|
13
|
+
return existsSync(candidate)&&realpathSync(candidate).startsWith(roots.resourceRoot+'/')?realpathSync(candidate):null;
|
|
14
|
+
}
|
|
9
15
|
for (let i = 0; i < argv.length - 1; i++) {
|
|
10
16
|
if (argv[i] !== "-e" && argv[i] !== "--extension") continue;
|
|
11
17
|
const candidate = resolve(argv[i + 1]);
|