@chankov/agent-fleet 2.0.18 → 2.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/proactive-external-git.ts +28 -5
- package/.pi/harnesses/agent-hub/proactive-external.ts +83 -18
- package/.pi/harnesses/agent-hub/proactive-rules.ts +3 -3
- package/.pi/harnesses/agent-hub/proactive-snapshot.ts +23 -10
- package/.pi/harnesses/agent-hub/prompts/fragments.ts +6 -6
- package/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +1 -1
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/policy-roots.js +106 -0
- package/.pi/harnesses/lib/policy-roots.ts +7 -118
- package/.versions/2.0.19/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.19/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-claude-bridge.ts +437 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet.ts +217 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/flow.ts +157 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +36 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.19/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.19/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.19/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.19/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.19/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.19/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.19/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.19/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.19/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.19/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.19/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.19/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.19/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.19/.pi/extensions/package.json +9 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/README.md +1483 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/acceptance.ts +199 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-hub.ts +54 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/context.ts +47 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/config/agents.ts +178 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/config/overrides.ts +165 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/budgets.ts +206 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/deterministic-fs.ts +169 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +270 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +233 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-types.ts +267 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native.ts +234 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/adapters.ts +82 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/broker.ts +125 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +33 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/descendant.ts +63 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +48 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/hub.ts +152 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +99 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/results.ts +54 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/runtime.ts +120 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/filesystem-tool.ts +185 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/fixtures/registration-surface.json +66 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/index.ts +2625 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +133 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +144 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/no-progress.ts +593 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-activation.ts +112 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-route.ts +76 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/work-mode.ts +137 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-config.ts +21 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-snapshot.ts +271 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-types.ts +67 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/process-obligations.ts +158 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/context.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/fragments.ts +95 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/recovery-contract.ts +150 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research/runtime.ts +201 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research/spawn-run.ts +194 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/return-contract.js +349 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/review-findings.js +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/run-budget.js +554 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/scope-gate.js +144 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/session-audit.ts +313 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/spawn.ts +563 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-communication-store.ts +190 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-runtime.ts +258 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-authorization.ts +122 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-config.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-obligations.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-runtime.ts +125 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/action-executors.ts +213 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/context.ts +144 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +560 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/herdr-executors.ts +95 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/work-mode.ts +187 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
- package/.versions/2.0.19/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.19/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.19/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.19/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/index.ts +533 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.19/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.19/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.19/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget-child-prompt.ts +220 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.19/.pi/harnesses/lib/damage-control-shared.ts +226 -0
- package/.versions/2.0.19/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.19/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.19/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.19/.pi/harnesses/lib/policy-roots.js +106 -0
- package/.versions/2.0.19/.pi/harnesses/lib/policy-roots.ts +31 -0
- package/.versions/2.0.19/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.0.19/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-file-discovery.js +21 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-loader.js +44 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-v2.js +106 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.19/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.19/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.19/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.19/.pi/prompts/af-build.md +27 -0
- package/.versions/2.0.19/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.19/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.19/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.19/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.19/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.19/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.19/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.19/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.19/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.19/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.19/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.19/.version +1 -0
- package/.versions/2.0.19/agents/architect.md +24 -0
- package/.versions/2.0.19/agents/bowser.md +28 -0
- package/.versions/2.0.19/agents/builder.md +55 -0
- package/.versions/2.0.19/agents/code-reviewer.md +209 -0
- package/.versions/2.0.19/agents/deep-researcher.md +32 -0
- package/.versions/2.0.19/agents/documenter.md +22 -0
- package/.versions/2.0.19/agents/orchestrator.md +22 -0
- package/.versions/2.0.19/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.19/agents/planner.md +105 -0
- package/.versions/2.0.19/agents/releaser.md +24 -0
- package/.versions/2.0.19/agents/researcher.md +30 -0
- package/.versions/2.0.19/agents/security-auditor.md +167 -0
- package/.versions/2.0.19/agents/test-engineer.md +153 -0
- package/.versions/2.0.19/agents/web-debugger.md +44 -0
- package/.versions/2.0.19/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.19/bin/catalog/harness-runtime-closure.json +73 -0
- package/.versions/2.0.19/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.19/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.19/docs/ARCHITECTURE.md +874 -0
- package/.versions/2.0.19/docs/agent-fleet-setup.md +1101 -0
- package/.versions/2.0.19/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.0.19/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.19/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.19/docs/getting-started.md +126 -0
- package/.versions/2.0.19/docs/npm-install.md +535 -0
- package/.versions/2.0.19/docs/pi-extensions.md +454 -0
- package/.versions/2.0.19/docs/pi-setup.md +92 -0
- package/.versions/2.0.19/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.19/install-manifest.json +3197 -0
- package/.versions/2.0.19/justfile +247 -0
- package/.versions/2.0.19/manifest-meta.json +1075 -0
- package/.versions/2.0.19/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.19/references/communication-contract.md +26 -0
- package/.versions/2.0.19/references/definition-of-done.md +67 -0
- package/.versions/2.0.19/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.19/references/observability-checklist.md +92 -0
- package/.versions/2.0.19/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.19/references/performance-checklist.md +236 -0
- package/.versions/2.0.19/references/prompting-patterns.md +380 -0
- package/.versions/2.0.19/references/security-checklist.md +245 -0
- package/.versions/2.0.19/references/testing-patterns.md +235 -0
- package/.versions/2.0.19/references/workflow-authoring.md +304 -0
- package/.versions/2.0.19/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.19/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.19/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.19/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.19/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.19/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.19/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.19/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.19/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.19/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.19/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.19/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.19/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.19/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.19/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.19/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.19/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.19/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.19/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.19/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.0.19/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.19/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.19/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.19/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.19/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.0.19/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.19/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.0.19/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.19/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.19/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +6 -0
- package/bin/cli.js +1 -1
- package/bin/lib/doctor.js +8 -2
- package/bin/lib/system1-migration.js +17 -8
- package/bin/lib/system1-policy-context.js +57 -0
- package/bin/lib/transaction.js +1 -1
- package/docs/agent-fleet-setup.md +1 -1
- package/docs/external-project-ai-content.md +17 -1
- package/install-manifest.json +5 -1
- package/manifest-meta.json +4 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { checkScope } from "./scope-gate.js";
|
|
1
2
|
import { execFileSync } from "node:child_process";
|
|
2
3
|
import { existsSync, lstatSync, realpathSync } from "node:fs";
|
|
3
4
|
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
@@ -9,7 +10,7 @@ const forbidden = /^(?:\..*|node_modules|vendor|dist|build|coverage|artifacts|se
|
|
|
9
10
|
export interface ExternalGitScope { readonly root: string; readonly head: string; readonly identity: string }
|
|
10
11
|
function git(root: string, args: string[], check: () => void, maxBuffer = 4096): Buffer {
|
|
11
12
|
check();
|
|
12
|
-
const result = execFileSync("git",["-C",root,...args],{timeout:200,maxBuffer,stdio:["ignore","pipe","ignore"]});
|
|
13
|
+
const result = execFileSync("git",["-C",root,...args],{timeout:200,maxBuffer,stdio:["ignore","pipe","ignore"],env:{...process.env,GIT_OPTIONAL_LOCKS:"0"}});
|
|
13
14
|
check(); return result;
|
|
14
15
|
}
|
|
15
16
|
export function identifyExternalGit(directory: string, workspace: string, check: () => void): ExternalGitScope | null {
|
|
@@ -21,12 +22,32 @@ export function identifyExternalGit(directory: string, workspace: string, check:
|
|
|
21
22
|
return {root,head,identity:`${root}:${head}`};
|
|
22
23
|
} catch { return null; }
|
|
23
24
|
}
|
|
25
|
+
/** Changed paths only, bounded to one repository; status never authorizes content reads. */
|
|
26
|
+
export function externalChangedPaths(source: ExternalGitScope, check: () => void, scopes: readonly string[]): string[] {
|
|
27
|
+
if (!scopes.length) return [];
|
|
28
|
+
const pathspecs = scopes.map(scope => {
|
|
29
|
+
const path = relative(source.root, scope).split(sep).join("/");
|
|
30
|
+
if (path === ".." || path.startsWith("../") || isAbsolute(path)) throw new Error("external_git_scope");
|
|
31
|
+
return `:(literal)${path || "."}`;
|
|
32
|
+
});
|
|
33
|
+
const rows = git(source.root, ["status", "--porcelain", "-z", "--untracked-files=all", "--", ...pathspecs], check, 1024 * 1024).toString("utf8").split("\0");
|
|
34
|
+
const paths = new Set<string>();
|
|
35
|
+
for (let i = 0; i < rows.length; i++) {
|
|
36
|
+
const row = rows[i]; if (!row) continue;
|
|
37
|
+
paths.add(resolve(source.root, row.slice(3)));
|
|
38
|
+
if (/[RC]/.test(row.slice(0, 2)) && rows[i + 1]) paths.add(resolve(source.root, rows[++i]!));
|
|
39
|
+
}
|
|
40
|
+
return [...paths].sort();
|
|
41
|
+
}
|
|
24
42
|
/** Only HEAD blobs below the admitted scope. Never read checkout extraction deletions or sibling content. */
|
|
25
|
-
export function readExternalHead(input: { git: ExternalGitScope; scope: string; grant: PolicyRoot; roots: PolicyRootTable; maxFiles: number; maxBytes: number; check(): void }): Map<string,Buffer> {
|
|
43
|
+
export function readExternalHead(input: { git: ExternalGitScope; scope: string; grant: PolicyRoot; roots: PolicyRootTable; maxFiles: number; maxBytes: number; check(): void; include?: readonly string[]; existing?: ReadonlyMap<string, Buffer>; paths?: readonly string[] }): Map<string,Buffer> {
|
|
26
44
|
const result=new Map<string,Buffer>();
|
|
45
|
+
const workspaceLexical = input.roots.roots.find(root => root.role === "workspace")?.lexicalPath ?? input.roots.workspace;
|
|
27
46
|
const scopeRelative=relative(input.git.root,input.scope).split(sep).join("/");
|
|
28
47
|
if (scopeRelative===".." || scopeRelative.startsWith("../") || isAbsolute(scopeRelative)) throw new Error("external_git_scope");
|
|
29
|
-
|
|
48
|
+
if (input.paths?.length === 0) return result;
|
|
49
|
+
const pathspecs = input.paths ? input.paths.map(path => `:(literal)${relative(input.git.root, path).split(sep).join("/")}`) : [`:(literal)${scopeRelative || "."}`];
|
|
50
|
+
const listing=git(input.git.root,["ls-tree","-r","-z",input.git.head,"--",...pathspecs],input.check,64*1024).toString("utf8").split("\0");
|
|
30
51
|
let bytes=0;
|
|
31
52
|
for (const row of listing) {
|
|
32
53
|
if (!row) continue;
|
|
@@ -47,12 +68,14 @@ export function readExternalHead(input: { git: ExternalGitScope; scope: string;
|
|
|
47
68
|
const grantRel=relative(input.grant.canonicalPath,path);
|
|
48
69
|
if (input.grant.kind==="directory" && (isAbsolute(grantRel)||grantRel===".."||grantRel.startsWith(`..${sep}`))) throw new Error("external_git_escape");
|
|
49
70
|
}
|
|
71
|
+
const lexical=resolve(input.grant.lexicalPath,relative(input.grant.canonicalPath,path));
|
|
72
|
+
const logical=relative(workspaceLexical,lexical).split(sep).join("/");
|
|
73
|
+
if ((input.include && !checkScope([logical],input.include).inScope.length) || input.existing?.has(logical)) continue;
|
|
50
74
|
if (result.size>=input.maxFiles) throw new Error("external_capture_limit");
|
|
51
75
|
const content=git(input.git.root,["cat-file","blob",match[2]!],input.check,PROACTIVE_LIMITS.maxFileBytes+1);
|
|
52
76
|
if (content.length>PROACTIVE_LIMITS.maxFileBytes || bytes+content.length>input.maxBytes || content.includes(0)) throw new Error("external_capture_limit");
|
|
53
77
|
new TextDecoder("utf-8",{fatal:true}).decode(content);
|
|
54
|
-
|
|
55
|
-
result.set(relative(input.roots.workspace,lexical).split(sep).join("/"),content); bytes+=content.length;
|
|
78
|
+
result.set(logical,content); bytes+=content.length;
|
|
56
79
|
}
|
|
57
80
|
if (identifyExternalGit(input.scope===input.grant.canonicalPath && input.grant.kind==="file" ? dirname(input.scope) : input.git.root,input.roots.workspace,input.check)?.identity!==input.git.identity) throw new Error("external_head_changed");
|
|
58
81
|
return result;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { checkScope } from "./scope-gate.js";
|
|
2
|
+
import { externalChangedPaths, identifyExternalGit, readExternalHead } from "./proactive-external-git.ts";
|
|
3
|
+
import { existsSync, lstatSync, opendirSync } from "node:fs";
|
|
4
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
5
|
import { authorizePolicyPath, type PolicyRootTable } from "../lib/policy-roots.ts";
|
|
5
6
|
import { safeSourceRead } from "../lib/safe-source-read.js";
|
|
6
7
|
import { PROACTIVE_LIMITS } from "./proactive-config.ts";
|
|
7
8
|
|
|
9
|
+
const coverageGap = (error: unknown): string => {
|
|
10
|
+
const message = (error as Error)?.message;
|
|
11
|
+
if (["capture_timeout", "external_capture_limit", "external_head_changed"].includes(message)) return message;
|
|
12
|
+
if (message === "source_changed") return "external_unstable_snapshot";
|
|
13
|
+
if (message === "state_too_large" || (error as NodeJS.ErrnoException)?.code === "ENOBUFS") return "external_capture_limit";
|
|
14
|
+
return "external_evidence_unavailable";
|
|
15
|
+
};
|
|
8
16
|
const forbidden = /^(?:\..*|node_modules|vendor|dist|build|coverage|artifacts|sessions?|transcripts?|credentials?(?:\..*)?|secrets?(?:\..*)?|id_(?:rsa|ed25519)|.*\.(?:pem|key|p12|pfx|sqlite|db|lock))$/i;
|
|
9
17
|
export interface ExternalBaseline {
|
|
10
18
|
readonly roots: PolicyRootTable;
|
|
@@ -14,35 +22,92 @@ export interface ExternalBaseline {
|
|
|
14
22
|
readonly headFiles: ReadonlyMap<string, Buffer>;
|
|
15
23
|
readonly gaps: readonly string[];
|
|
16
24
|
}
|
|
17
|
-
/** Capture only consented
|
|
18
|
-
export function captureExternal(input: { roots: PolicyRootTable; include: readonly string[]; maxFiles: number; maxBytes: number; check(): void }): ExternalBaseline {
|
|
25
|
+
/** Capture only consented scopes in independent repositories. Never discover repositories recursively. */
|
|
26
|
+
export function captureExternal(input: { roots: PolicyRootTable; include: readonly string[]; maxFiles: number; maxBytes: number; check(): void; includeWorkspace?: boolean; knownPaths?: readonly string[] }): ExternalBaseline {
|
|
19
27
|
const files = new Map<string,Buffer>(), identities = new Map<string,string>(), gitHeads = new Map<string,string>(), headFiles = new Map<string,Buffer>(), gaps: string[] = [];
|
|
20
28
|
let bytes = 0, entries = 0;
|
|
21
|
-
|
|
29
|
+
// Logical identities use the same lexical checkout as the grants, even through an alias.
|
|
30
|
+
const workspaceLexical = input.roots.roots.find(root => root.role === "workspace")?.lexicalPath ?? input.roots.workspace;
|
|
31
|
+
const visited = new Set<string>(), changedByRepository = new Map<string, string[]>();
|
|
22
32
|
const read = (path: string) => {
|
|
23
33
|
input.check();
|
|
24
34
|
const admitted = authorizePolicyPath(input.roots,path);
|
|
25
35
|
const lexical = resolve(admitted.root.lexicalPath,relative(admitted.root.canonicalPath,admitted.path));
|
|
26
|
-
const logical = relative(
|
|
27
|
-
if (files.has(logical)) return;
|
|
28
|
-
if (files.size >= input.maxFiles) { gaps.push("external_capture_limit"); return; }
|
|
36
|
+
const logical = relative(workspaceLexical,lexical).split(sep).join("/");
|
|
37
|
+
if (!checkScope([logical], input.include).inScope.length || files.has(logical)) return;
|
|
38
|
+
if (!headFiles.has(logical) && new Set([...files.keys(), ...headFiles.keys()]).size >= input.maxFiles) { gaps.push("external_capture_limit"); return; }
|
|
29
39
|
const content = safeSourceRead(admitted.root.kind === "file" ? dirname(admitted.path) : admitted.root.canonicalPath,admitted.path,PROACTIVE_LIMITS.maxFileBytes,input.check);
|
|
30
40
|
if (bytes + content.length > input.maxBytes) { gaps.push("external_capture_limit"); return; }
|
|
31
41
|
files.set(logical,content); identities.set(logical,admitted.root.id); bytes += content.length;
|
|
32
42
|
};
|
|
33
|
-
|
|
43
|
+
const scopes = [...new Set(input.include.filter(path => input.includeWorkspace || path.startsWith("../")).map(include => {
|
|
44
|
+
const parts = include.split("/"), glob = parts.findIndex(part => /[*?]/.test(part));
|
|
45
|
+
return glob < 0 ? include : parts.slice(0, glob).join("/");
|
|
46
|
+
}))].sort((a, b) => a.length - b.length || a.localeCompare(b));
|
|
47
|
+
const selected = scopes.filter((scope, index) => !scopes.slice(0, index).some(parent => scope.startsWith(parent + "/")));
|
|
48
|
+
// Group only approved scopes for status, not the entire repository inventory.
|
|
49
|
+
const statusScopes = input.includeWorkspace ? selected.flatMap(scope => {
|
|
50
|
+
if (!scope || scope === "..") return [];
|
|
51
|
+
try {
|
|
52
|
+
const source = authorizePolicyPath(input.roots, scope);
|
|
53
|
+
if (source.root.role === "workspace" && resolve(input.roots.workspace, scope) !== source.path) return [];
|
|
54
|
+
return [source.path];
|
|
55
|
+
} catch { return []; }
|
|
56
|
+
}) : [];
|
|
57
|
+
for (const scope of selected) {
|
|
34
58
|
try {
|
|
35
59
|
input.check();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
if (!scope || scope === "..") throw new Error("unbounded_capture_scope");
|
|
61
|
+
let admitted;
|
|
62
|
+
try { admitted = authorizePolicyPath(input.roots,scope); }
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (!input.includeWorkspace || !(error instanceof Error) || !error.message.startsWith("missing_path:")) throw error;
|
|
65
|
+
// A deleted consented descendant can use HEAD, but only below a live directory grant.
|
|
66
|
+
// Never recover a changed/missing grant itself by falling back to the workspace.
|
|
67
|
+
const target = resolve(input.roots.workspace, scope);
|
|
68
|
+
let parent = dirname(target);
|
|
69
|
+
while (!existsSync(parent) && dirname(parent) !== parent) { input.check(); parent = dirname(parent); }
|
|
70
|
+
const ancestor = authorizePolicyPath(input.roots, parent, "inventory");
|
|
71
|
+
admitted = { root: ancestor.root, path: resolve(ancestor.path, relative(parent, target)) };
|
|
72
|
+
}
|
|
73
|
+
if (admitted.root.role === "workspace" && (!input.includeWorkspace || resolve(input.roots.workspace, scope) !== admitted.path)) throw new Error("unsafe_capture_scope");
|
|
74
|
+
const stat = existsSync(admitted.path) ? lstatSync(admitted.path) : undefined;
|
|
75
|
+
let directory = stat?.isDirectory() ? admitted.path : dirname(admitted.path);
|
|
76
|
+
while (!existsSync(directory) && dirname(directory) !== directory) { input.check(); directory = dirname(directory); }
|
|
77
|
+
const head = identifyExternalGit(directory,input.roots.workspace,input.check);
|
|
78
|
+
let paths: string[] | undefined;
|
|
79
|
+
if (head && input.includeWorkspace) {
|
|
80
|
+
const approved = [...new Set([...statusScopes.filter(path => {
|
|
81
|
+
const rel = relative(head.root, path);
|
|
82
|
+
return rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
83
|
+
}), admitted.path])].sort();
|
|
84
|
+
const statusKey = JSON.stringify([head.identity, approved]);
|
|
85
|
+
let changed = changedByRepository.get(statusKey);
|
|
86
|
+
if (!changed) { changed = externalChangedPaths(head, input.check, approved); changedByRepository.set(statusKey, changed); }
|
|
87
|
+
paths = [...new Set([...changed, ...(input.knownPaths ?? []).map(path => resolve(input.roots.workspace, path))])].filter(path => {
|
|
88
|
+
const rel = relative(admitted.path, path);
|
|
89
|
+
const logical = relative(input.roots.workspace, path).split(sep).join("/");
|
|
90
|
+
return (rel === "" || (!rel.startsWith(`..${sep}`) && rel !== ".." && !isAbsolute(rel))) &&
|
|
91
|
+
!relative(head.root, path).split(sep).some(part => forbidden.test(part)) && checkScope([logical], input.include).inScope.length;
|
|
92
|
+
});
|
|
93
|
+
if (paths.length > input.maxFiles) throw new Error("external_capture_limit");
|
|
94
|
+
}
|
|
41
95
|
if (head) {
|
|
42
96
|
gitHeads.set(scope,head.identity);
|
|
43
|
-
const retainedHead = readExternalHead({git:head,scope:admitted.path,grant:admitted.root,roots:input.roots,maxFiles:input.maxFiles-headFiles.size,maxBytes:input.maxBytes-bytes,check:input.check});
|
|
97
|
+
const retainedHead = readExternalHead({git:head,scope:admitted.path,grant:admitted.root,roots:input.roots,maxFiles:input.maxFiles-new Set([...files.keys(), ...headFiles.keys()]).size,maxBytes:input.maxBytes-bytes,check:input.check,include:input.include,existing:headFiles,paths});
|
|
44
98
|
for (const [path,content] of retainedHead) if (!headFiles.has(path)) { headFiles.set(path,content); identities.set(path,admitted.root.id); bytes+=content.length; }
|
|
45
99
|
} else gaps.push("external_history_unavailable");
|
|
100
|
+
if (paths) {
|
|
101
|
+
for (const path of paths) {
|
|
102
|
+
try {
|
|
103
|
+
if (lstatSync(path).isSymbolicLink()) throw new Error("unsafe_capture_source");
|
|
104
|
+
read(path);
|
|
105
|
+
}
|
|
106
|
+
catch (error) { if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; }
|
|
107
|
+
}
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (!stat) throw new Error("missing_capture_scope");
|
|
46
111
|
if (stat.isFile()) { read(admitted.path); continue; }
|
|
47
112
|
const queue = [admitted.path];
|
|
48
113
|
while (queue.length) {
|
|
@@ -67,11 +132,11 @@ export function captureExternal(input: { roots: PolicyRootTable; include: readon
|
|
|
67
132
|
try {
|
|
68
133
|
authorizePolicyPath(input.roots,path);
|
|
69
134
|
if (stat.isDirectory()) queue.push(path); else if (stat.isFile()) read(path);
|
|
70
|
-
} catch { gaps.push(
|
|
135
|
+
} catch (error) { gaps.push(coverageGap(error)); }
|
|
71
136
|
}
|
|
72
137
|
if (entries > PROACTIVE_LIMITS.maxUnits * 16) break;
|
|
73
138
|
}
|
|
74
|
-
} catch { gaps.push(
|
|
139
|
+
} catch (error) { gaps.push(coverageGap(error)); }
|
|
75
140
|
}
|
|
76
141
|
return { roots:input.roots,files,identities,gitHeads,headFiles,gaps:[...new Set(gaps)] };
|
|
77
142
|
}
|
|
@@ -40,7 +40,7 @@ export function discoverRules(repo: string, roots: readonly string[], policyRoot
|
|
|
40
40
|
try { rootReal = grant ? authorizePolicyPath(policyRoots!,grant.lexicalPath,"inventory").path : realpathSync(resolve(repoReal, root)); }
|
|
41
41
|
catch (error) { gaps.push(grant ? `${error instanceof Error ? error.message : "unsafe_root"}:${root}` : `missing_root:${root}`); continue; }
|
|
42
42
|
if ((!grant && !inside(repoReal, rootReal)) || !statSync(rootReal).isDirectory()) { gaps.push(`unsafe_root:${root}`); continue; }
|
|
43
|
-
const sourcePath = (p: string) =>
|
|
43
|
+
const sourcePath = (p: string) => grant ? `.ai/rules/${relative(rootReal,p).split(sep).join("/")}` : relativePath(p);
|
|
44
44
|
const queue: string[] = [];
|
|
45
45
|
const enqueue = (p: string) => { if (!queued.has(p)) { queued.add(p); queue.push(p); } };
|
|
46
46
|
const safe = (p: string): string | null => {
|
|
@@ -127,7 +127,7 @@ export function discoverRules(repo: string, roots: readonly string[], policyRoot
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
const source: BoundReference = { path, hash: digest, revision: digest,
|
|
130
|
-
...(
|
|
130
|
+
...(grant ? { rootId: grant.id, physicalPath: real } : {}), ...(bindingAmbiguous ? { bindingAmbiguous: true } : {}) };
|
|
131
131
|
files.push(source);
|
|
132
132
|
const lines = text.split(/(?<=\n)/), starts: number[] = [], headings: { index: number; level: number; title: string; occurrence: number }[] = [];
|
|
133
133
|
const occurrences = new Map<string, number>();
|
|
@@ -152,7 +152,7 @@ export function discoverRules(repo: string, roots: readonly string[], policyRoot
|
|
|
152
152
|
const next = headings.find(y => y.index > x.index && y.level > x.level);
|
|
153
153
|
return text.slice(starts[x.index], next ? starts[next.index] : text.length);
|
|
154
154
|
}).join("\n");
|
|
155
|
-
const label = `${
|
|
155
|
+
const label = `${grant ? `${grant.id}:` : ""}${path}#${h.title}@${h.occurrence}`;
|
|
156
156
|
const kind = /default/i.test(path + " " + h.title) ? "default" : /shared/i.test(path + " " + h.title) ? "shared" : /conditional|when|if\b/i.test(h.title) ? "conditional" : "reference";
|
|
157
157
|
sections.push({ id: `${label}:${hash(own)}`, source, heading: h.title, occurrence: h.occurrence, text: own, context, kind });
|
|
158
158
|
}
|
|
@@ -74,6 +74,7 @@ export interface TurnBaseline {
|
|
|
74
74
|
readonly gaps: readonly string[];
|
|
75
75
|
readonly startedAt: number;
|
|
76
76
|
readonly external?: ExternalBaseline;
|
|
77
|
+
readonly independentWorkspace?: boolean;
|
|
77
78
|
}
|
|
78
79
|
const code = (e: unknown): string => {
|
|
79
80
|
const message = (e as Error)?.message;
|
|
@@ -103,9 +104,17 @@ export function beginTurnCore(input: { root: string; config: ProactiveConfig; tu
|
|
|
103
104
|
dirty.set(path, bytes); retained += bytes?.length ?? 0; count++;
|
|
104
105
|
} catch (e) { gaps.push(code(e)); }
|
|
105
106
|
}
|
|
106
|
-
const external = input.policyRoots ? captureExternal({roots:input.policyRoots,include:input.config.include,maxFiles:PROACTIVE_LIMITS.maxUnits-count,maxBytes:PROACTIVE_LIMITS.maxRetainedBytes-retained,check:()=>{remaining(startedAt,now);}}) : undefined;
|
|
107
|
+
const external = input.policyRoots ? captureExternal({roots:input.policyRoots,include:input.config.include,maxFiles:PROACTIVE_LIMITS.maxUnits-count,maxBytes:PROACTIVE_LIMITS.maxRetainedBytes-retained,check:()=>{remaining(startedAt,now);},includeWorkspace:!head,knownPaths:input.knownTargets}) : undefined;
|
|
107
108
|
if (external) gaps.push(...external.gaps);
|
|
108
|
-
|
|
109
|
+
// A non-Git parent is supported only when every local include has independent history.
|
|
110
|
+
// Missing/unsupported scopes keep the original Git gap; no synthetic clean baseline.
|
|
111
|
+
const independentWorkspace = !head && !!external && input.config.include.some(path => !path.startsWith("../")) && input.config.include.filter(path => !path.startsWith("../")).every(path =>
|
|
112
|
+
[...external.gitHeads.keys()].some(scope => path === scope || path.startsWith(scope + "/")));
|
|
113
|
+
if (independentWorkspace) {
|
|
114
|
+
const index = gaps.indexOf("git_unavailable");
|
|
115
|
+
if (index >= 0) gaps.splice(index, 1);
|
|
116
|
+
}
|
|
117
|
+
return { independentWorkspace, root: input.root, head, dirty, initialPaths, config: input.config, turnId: input.turnId, context: structuredClone(input.context), gaps, startedAt, ...(external ? {external} : {}) };
|
|
109
118
|
}
|
|
110
119
|
export function finishTurnCore(baseline: TurnBaseline | null, input: { assistantText?: string; knownTargets?: readonly string[]; secrets?: readonly string[]; overlap?: boolean; now?: () => number; afterFirstRead?: () => void } = {}): TurnSnapshot | null {
|
|
111
120
|
if (!baseline) return null;
|
|
@@ -113,15 +122,16 @@ export function finishTurnCore(baseline: TurnBaseline | null, input: { assistant
|
|
|
113
122
|
const gaps = [...baseline.gaps];
|
|
114
123
|
let current: Set<string>;
|
|
115
124
|
try {
|
|
116
|
-
current = status(baseline.root, started, now);
|
|
117
|
-
if (git(baseline.root, ["rev-parse", "HEAD"], started, now).toString("utf8").trim() !== baseline.head) gaps.push("head_changed");
|
|
125
|
+
current = baseline.independentWorkspace ? new Set() : status(baseline.root, started, now);
|
|
126
|
+
if (!baseline.independentWorkspace && git(baseline.root, ["rev-parse", "HEAD"], started, now).toString("utf8").trim() !== baseline.head) gaps.push("head_changed");
|
|
118
127
|
} catch (e) { current = new Set(); gaps.push((e as Error).message === "capture_timeout" ? "capture_timeout" : "git_unavailable"); }
|
|
119
128
|
if (input.overlap) gaps.push("concurrent_writer_attribution_uncertain");
|
|
120
129
|
const paths = [...new Set([...baseline.initialPaths, ...current, ...baseline.dirty.keys(), ...(input.knownTargets ?? [])])].sort();
|
|
121
130
|
const units: TurnUnit[] = [];
|
|
131
|
+
const observedPaths = new Set(paths);
|
|
122
132
|
let retained = 0, omitted = 0;
|
|
123
133
|
const secrets = input.secrets ?? [];
|
|
124
|
-
for (const path of paths) {
|
|
134
|
+
for (const path of baseline.independentWorkspace ? [] : paths) {
|
|
125
135
|
if (!checkScope([path], baseline.config.include).inScope.length) continue;
|
|
126
136
|
if (now() - started >= PROACTIVE_LIMITS.captureMs) { gaps.push("capture_timeout"); omitted++; continue; }
|
|
127
137
|
if (units.length >= PROACTIVE_LIMITS.maxUnits) { omitted++; continue; }
|
|
@@ -152,18 +162,21 @@ export function finishTurnCore(baseline: TurnBaseline | null, input: { assistant
|
|
|
152
162
|
}
|
|
153
163
|
if (baseline.external) {
|
|
154
164
|
const before = baseline.external;
|
|
155
|
-
const after = captureExternal({roots:before.roots,include:baseline.config.include,maxFiles:PROACTIVE_LIMITS.maxUnits,maxBytes:PROACTIVE_LIMITS.maxRetainedBytes,check:()=>{remaining(started,now);}});
|
|
165
|
+
const after = captureExternal({roots:before.roots,include:baseline.config.include,maxFiles:PROACTIVE_LIMITS.maxUnits-units.length,maxBytes:PROACTIVE_LIMITS.maxRetainedBytes-retained,check:()=>{remaining(started,now);},includeWorkspace:!baseline.head,knownPaths:[...before.files.keys(),...before.headFiles.keys(),...(input.knownTargets ?? [])]});
|
|
156
166
|
gaps.push(...after.gaps);
|
|
157
|
-
|
|
167
|
+
const headsChanged = JSON.stringify([...before.gitHeads]) !== JSON.stringify([...after.gitHeads]);
|
|
168
|
+
if (headsChanged) gaps.push("external_head_changed");
|
|
158
169
|
const unavailable = (g: string) => !["external_history_unavailable","external_prior_edits_not_reviewed"].includes(g);
|
|
159
|
-
const incomplete = before.gaps.some(unavailable) || after.gaps.some(unavailable);
|
|
170
|
+
const incomplete = headsChanged || before.gaps.some(unavailable) || after.gaps.some(unavailable);
|
|
160
171
|
const externalPaths = [...new Set([...before.files.keys(),...after.files.keys(),...before.headFiles.keys(),...after.headFiles.keys()])].sort();
|
|
161
172
|
for (const path of externalPaths) {
|
|
173
|
+
observedPaths.add(path);
|
|
162
174
|
const independentlyTracked = [...before.gitHeads.keys()].some(scope => {
|
|
163
175
|
const normalized = scope.endsWith("/**") ? scope.slice(0,-3) : scope;
|
|
164
176
|
return path===normalized || path.startsWith(normalized+"/");
|
|
165
177
|
});
|
|
166
|
-
const priorBytes = independentlyTracked ? before.headFiles.get(path) : before.files.get(path), nextBytes = after.files.get(path);
|
|
178
|
+
const priorBytes = independentlyTracked ? before.headFiles.get(path) ?? (baseline.independentWorkspace ? after.headFiles.get(path) : undefined) : before.files.get(path), nextBytes = after.files.get(path);
|
|
179
|
+
if (priorBytes === undefined && nextBytes === undefined) continue;
|
|
167
180
|
if (priorBytes?.equals(nextBytes ?? Buffer.alloc(0)) && nextBytes !== undefined) continue;
|
|
168
181
|
if (incomplete) { gaps.push("external_evidence_unavailable"); omitted++; continue; }
|
|
169
182
|
const prior = priorBytes === undefined ? undefined : excerpt(priorBytes,secrets);
|
|
@@ -189,7 +202,7 @@ export function finishTurnCore(baseline: TurnBaseline | null, input: { assistant
|
|
|
189
202
|
if (context.plan) Object.freeze(context.plan);
|
|
190
203
|
for (const rule of context.rules) Object.freeze(rule);
|
|
191
204
|
Object.freeze(context.rules); Object.freeze(context.exceptions); Object.freeze(context);
|
|
192
|
-
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:
|
|
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 }) });
|
|
193
206
|
}
|
|
194
207
|
/** Immutable in-memory readback: never opens the source path. */
|
|
195
208
|
export function readSnapshotUnit(snapshot: TurnSnapshot, snapshotId: string, unitId: string, contentHash: string): string | null {
|
|
@@ -85,11 +85,11 @@ export const COMPACTION_FRAGMENT = `
|
|
|
85
85
|
- \`request_compaction\` is available for explicit recovery. Automatic recovery preserves task state and continues from the compaction summary.
|
|
86
86
|
`;
|
|
87
87
|
export const FILE_DISCOVERY_FRAGMENT = `## File discovery advice
|
|
88
|
-
|
|
88
|
+
Inventory/find/ls/grep is auto-ranked at all tiers; use typed discovery, not bash output. Keep original matches/lines and all scored/unscored candidates. Follow filesystem pages; after the self-read ceiling, continue next turn. ask_system1_files accepts paths/patterns/custom questions. Ranking never replaces required reads, permissions, tests or review. Refusals retain ordinary discovery; never retry unchanged failures.`;
|
|
89
89
|
export const ASK_SYSTEM1_RECOMMENDED_FRAGMENT = `## Recommended System 1 usage
|
|
90
|
-
|
|
91
|
-
Select permitted paths/ranges
|
|
92
|
-
|
|
93
|
-
On refusal
|
|
94
|
-
Advice never grants authority or replaces required reading before editing, tests, independent review,
|
|
90
|
+
Call \`ask_system1\` first in both modes/all tiers, including trivial and small tasks, before reasoning/research; never rubber-stamp.
|
|
91
|
+
Select permitted paths/ranges, not whole-file relevance reads. Check approved agenticAsk.include scope: prefixes cover descendants; git:tracked covers only paths in this repo's current Git index. All source/access guards apply. Pass repo-relative paths, not selectors. Use minimal state; ordinary tools for missing facts, deterministic lookup for exact facts.
|
|
92
|
+
System 1 is free and fast for routing decisions (not measured); no arbitrary per-task quota or financial rationing. Batch/reuse; byte/time/call limits apply.
|
|
93
|
+
On refusal/unavailability, stale/inconclusive advice, missing evidence or exhausted budget, use ordinary reading, research or independent reasoning. source_denied is a local source/input guard refusal, not a model judgment; empty sourceSummary does not identify its guard. Never bypass export denial by copying denied source/output into state or questions, relocating it or widening include. Never retry unchanged calls/refusals. Ask required decisions via \`ask_user\`.
|
|
94
|
+
Advice never grants authority or replaces required reading before editing, tests, independent review, permissions or gates. Never expand consent/include/output settings for a call. Triage/review retain their workflows.
|
|
95
95
|
`;
|
|
@@ -10,6 +10,6 @@ export const ASK_SYSTEM1_FILES_PARAMETERS=Type.Object({
|
|
|
10
10
|
},{additionalProperties:false});
|
|
11
11
|
export function registerAskSystem1Files(pi:ExtensionAPI,deps:{execute(params:unknown,signal:AbortSignal|undefined):Promise<unknown>}){
|
|
12
12
|
pi.registerTool({name:'ask_system1_files',label:'Rank files with System 1',parameters:ASK_SYSTEM1_FILES_PARAMETERS,
|
|
13
|
-
description:'Parent-only approved
|
|
13
|
+
description:'Parent-only approved file judgments via paths/patterns/directories: relevance, role and up to 14 custom questions. All scored/unscored rows remain available via filesystem pages. Never grants rights, replaces reading or proves correctness. Discovery auto-ranking needs no call.',
|
|
14
14
|
async execute(_id,params,signal){const result=await deps.execute(params,signal);return {content:[{type:'text',text:JSON.stringify(result)}],details:result};}});
|
|
15
15
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Shared runtime for Hub and the JavaScript-only CLI. Types live in policy-roots.ts.
|
|
2
|
+
import { realpathSync, statSync } from "node:fs";
|
|
3
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
4
|
+
|
|
5
|
+
const deniedSegment = /^(?:\.git|\.pi|node_modules|vendor|dist|build|coverage|\.env(?:\..*)?|credentials?|secrets?)$/i;
|
|
6
|
+
const denied = path => path.split(/[\\/]/).some(part => deniedSegment.test(part));
|
|
7
|
+
function inside(root, target) {
|
|
8
|
+
const rel = relative(root, target);
|
|
9
|
+
return rel === "" || (!isAbsolute(rel) && rel !== ".." && !rel.startsWith(`..${sep}`));
|
|
10
|
+
}
|
|
11
|
+
function covers(root, target, base = root.canonicalPath) {
|
|
12
|
+
return root.kind === "file" ? target === base : inside(base, target);
|
|
13
|
+
}
|
|
14
|
+
function currentRoot(root) {
|
|
15
|
+
let canonical;
|
|
16
|
+
try { canonical = realpathSync(root.lexicalPath); }
|
|
17
|
+
catch { throw new Error(`root_changed:${root.configuredPath}`); }
|
|
18
|
+
if (canonical !== root.canonicalPath) throw new Error(`root_changed:${root.configuredPath}`);
|
|
19
|
+
const stat = statSync(root.lexicalPath);
|
|
20
|
+
if (root.kind === "directory" ? !stat.isDirectory() : !stat.isFile()) throw new Error(`root_changed:${root.configuredPath}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Explicit read grants only; not capture consent, registration or write ownership. */
|
|
24
|
+
export function resolvePolicyRoots(checkout, config) {
|
|
25
|
+
const workspace = realpathSync(checkout);
|
|
26
|
+
const roots = [Object.freeze({ id: "workspace", role: "workspace", configuredPath: ".", lexicalPath: resolve(checkout), canonicalPath: workspace, kind: "directory" })];
|
|
27
|
+
const diagnostics = [];
|
|
28
|
+
const note = (code, path) => diagnostics.push(Object.freeze({ code, path, message: `${code}:${path}` }));
|
|
29
|
+
for (const [role, paths] of [["rules", config.rulesDirs ?? []], ["docs", config.docsPaths ?? []]]) {
|
|
30
|
+
for (const configuredPath of paths) {
|
|
31
|
+
if (!configuredPath || isAbsolute(configuredPath) || configuredPath.includes("\\")) { note("invalid_root", configuredPath); continue; }
|
|
32
|
+
const lexicalPath = resolve(checkout, configuredPath);
|
|
33
|
+
if (denied(configuredPath)) { note("denied_path", configuredPath); continue; }
|
|
34
|
+
let canonicalPath;
|
|
35
|
+
try { canonicalPath = realpathSync(lexicalPath); }
|
|
36
|
+
catch { note("missing_root", configuredPath); continue; }
|
|
37
|
+
if (denied(canonicalPath)) { note("denied_path", configuredPath); continue; }
|
|
38
|
+
if (canonicalPath !== workspace && inside(canonicalPath, workspace)) { note("unsafe_root", configuredPath); continue; }
|
|
39
|
+
const stat = statSync(canonicalPath);
|
|
40
|
+
if ((!stat.isDirectory() && !stat.isFile()) || (role === "rules" && !stat.isDirectory())) { note("invalid_root_type", configuredPath); continue; }
|
|
41
|
+
if (roots.some(root => root.role === role && root.canonicalPath === canonicalPath)) { note("duplicate_root", configuredPath); continue; }
|
|
42
|
+
const root = Object.freeze({ id: `${role}:${canonicalPath}`, role, configuredPath, lexicalPath, canonicalPath, kind: stat.isDirectory() ? "directory" : "file" });
|
|
43
|
+
for (const existing of roots.filter(r => r.role !== "workspace")) {
|
|
44
|
+
if (covers(existing, canonicalPath) || covers(root, existing.canonicalPath)) note("overlapping_roots", configuredPath);
|
|
45
|
+
}
|
|
46
|
+
roots.push(root);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return Object.freeze({ workspace, roots: Object.freeze(roots), diagnostics: Object.freeze(diagnostics) });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Revalidate lexical/canonical containment and root identity before every access. */
|
|
53
|
+
export function authorizePolicyPath(table, path, operation = "read") {
|
|
54
|
+
const target = resolve(table.workspace, path);
|
|
55
|
+
if (denied(path)) throw new Error(`denied_path:${path}`);
|
|
56
|
+
const candidates = table.roots.filter(root => covers(root, target, root.lexicalPath) || covers(root, target));
|
|
57
|
+
candidates.sort((a, b) => (a.role === "workspace" ? 1 : 0) - (b.role === "workspace" ? 1 : 0) || b.canonicalPath.length - a.canonicalPath.length || a.id.localeCompare(b.id));
|
|
58
|
+
const root = candidates[0];
|
|
59
|
+
if (!root) throw new Error(`ungranted_path:${path}`);
|
|
60
|
+
currentRoot(root);
|
|
61
|
+
let canonical;
|
|
62
|
+
try { canonical = realpathSync(target); }
|
|
63
|
+
catch { throw new Error(`missing_path:${path}`); }
|
|
64
|
+
if (!covers(root, canonical)) throw new Error(`canonical_escape:${path}`);
|
|
65
|
+
if (denied(canonical)) throw new Error(`denied_path:${path}`);
|
|
66
|
+
if (operation === "inventory" && (root.kind !== "directory" || !statSync(canonical).isDirectory())) throw new Error(`inventory_requires_directory:${path}`);
|
|
67
|
+
return { root, path: canonical };
|
|
68
|
+
}
|
|
69
|
+
export function resolvePolicyReferences(table, paths, role) {
|
|
70
|
+
return paths.map(path => {
|
|
71
|
+
const target = resolve(table.workspace, path);
|
|
72
|
+
if (inside(table.workspace, target)) return path;
|
|
73
|
+
const source = authorizePolicyPath(table, path);
|
|
74
|
+
if (source.root.role !== role) throw new Error(`ungranted_reference:${path}`);
|
|
75
|
+
return source.path;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export function policyRootValidationContext(table) {
|
|
79
|
+
return { externalIncludeAllowed: include => {
|
|
80
|
+
const subtree = include.endsWith("/**");
|
|
81
|
+
const path = subtree ? include.slice(0, -3) : include;
|
|
82
|
+
try {
|
|
83
|
+
const source = authorizePolicyPath(table, path, subtree ? "inventory" : "read");
|
|
84
|
+
return source.root.role !== "workspace";
|
|
85
|
+
} catch { return false; }
|
|
86
|
+
} };
|
|
87
|
+
}
|
|
88
|
+
/** Legacy logical identities never select ambiguous sources or approve a changed pin. */
|
|
89
|
+
export function resolveRuleBinding(table, logicalPath) {
|
|
90
|
+
if (!logicalPath.startsWith(".ai/rules/") || logicalPath.includes("\\") || logicalPath.split("/").some(part => !part || part === "." || part === "..") || denied(logicalPath)) throw new Error(`invalid_binding:${logicalPath}`);
|
|
91
|
+
const suffix = logicalPath.slice(".ai/rules/".length);
|
|
92
|
+
const candidates = [];
|
|
93
|
+
const paths = [resolve(table.workspace, logicalPath), ...table.roots.filter(root => root.role === "rules").map(root => resolve(root.lexicalPath, suffix))];
|
|
94
|
+
for (const path of paths) {
|
|
95
|
+
let candidate;
|
|
96
|
+
try { candidate = authorizePolicyPath(table, path); }
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (error instanceof Error && error.message.startsWith("missing_path:")) continue;
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
if (!statSync(candidate.path).isFile()) throw new Error(`invalid_binding_type:${logicalPath}`);
|
|
102
|
+
if (!candidates.some(item => item.path === candidate.path)) candidates.push(candidate);
|
|
103
|
+
}
|
|
104
|
+
if (candidates.length !== 1) throw new Error(`${candidates.length ? "ambiguous_binding" : "missing_binding"}:${logicalPath}`);
|
|
105
|
+
return candidates[0];
|
|
106
|
+
}
|