@chankov/agent-fleet 2.0.17 → 2.0.18
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 +75 -49
- package/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +18 -20
- package/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +3 -1
- package/.pi/agents/model-profiles.yaml +5 -5
- package/.pi/agents/peers.yaml +3 -3
- package/.pi/agents/voices.yaml +1 -1
- package/.pi/harnesses/agent-hub/README.md +35 -8
- package/.pi/harnesses/agent-hub/agentic-sources.ts +29 -5
- package/.pi/harnesses/agent-hub/config/overrides.ts +13 -3
- package/.pi/harnesses/agent-hub/delegate.ts +16 -5
- package/.pi/harnesses/agent-hub/deterministic-fs.ts +7 -4
- package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +13 -2
- package/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +2 -0
- package/.pi/harnesses/agent-hub/dispatch-native-types.ts +7 -0
- package/.pi/harnesses/agent-hub/dispatch-native.ts +1 -1
- package/.pi/harnesses/agent-hub/file-discovery/adapters.ts +82 -0
- package/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +56 -0
- package/.pi/harnesses/agent-hub/file-discovery/broker.ts +125 -0
- package/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +33 -0
- package/.pi/harnesses/agent-hub/file-discovery/descendant.ts +63 -0
- package/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +48 -0
- package/.pi/harnesses/agent-hub/file-discovery/hub.ts +152 -0
- package/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
- package/.pi/harnesses/agent-hub/file-discovery/results.ts +54 -0
- package/.pi/harnesses/agent-hub/file-discovery/runtime.ts +120 -0
- package/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.pi/harnesses/agent-hub/filesystem-tool.ts +74 -26
- package/.pi/harnesses/agent-hub/index.ts +23 -5
- package/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +3 -2
- package/.pi/harnesses/agent-hub/no-progress.ts +45 -15
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/policy/work-mode.ts +2 -1
- package/.pi/harnesses/agent-hub/proactive-config.ts +8 -3
- package/.pi/harnesses/agent-hub/proactive-external-git.ts +59 -0
- package/.pi/harnesses/agent-hub/proactive-external.ts +77 -0
- package/.pi/harnesses/agent-hub/proactive-local.ts +25 -7
- package/.pi/harnesses/agent-hub/proactive-observer.ts +2 -1
- package/.pi/harnesses/agent-hub/proactive-rules.ts +39 -11
- package/.pi/harnesses/agent-hub/proactive-runtime.ts +8 -6
- package/.pi/harnesses/agent-hub/proactive-snapshot.ts +32 -2
- package/.pi/harnesses/agent-hub/proactive-types.ts +5 -1
- package/.pi/harnesses/agent-hub/prompts/fragments.ts +21 -49
- package/.pi/harnesses/agent-hub/prompts/system-prompt.ts +2 -1
- package/.pi/harnesses/agent-hub/research/runtime.ts +7 -3
- package/.pi/harnesses/agent-hub/research/spawn-run.ts +17 -6
- package/.pi/harnesses/agent-hub/spawn.ts +38 -9
- package/.pi/harnesses/agent-hub/system1-communication-store.ts +39 -0
- package/.pi/harnesses/agent-hub/tools/action-executors.ts +6 -1
- package/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.pi/harnesses/agent-hub/tools/ask-system1.ts +1 -1
- package/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +4 -4
- package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +4 -2
- package/.pi/harnesses/agent-hub/tools/set-task-tier.ts +3 -3
- package/.pi/harnesses/agent-hub/tools/spawn-research.ts +3 -1
- package/.pi/harnesses/agent-hub/ui/system1-communication.ts +1 -1
- package/.pi/harnesses/agent-hub/work-mode.ts +3 -0
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/context-budget-child-prompt.ts +3 -2
- package/.pi/harnesses/lib/deterministic-handle-path.ts +2 -0
- package/.pi/harnesses/lib/policy-roots.ts +142 -0
- package/.pi/harnesses/lib/system1/config-agentic.js +2 -1
- package/.pi/harnesses/lib/system1/config-file-discovery.js +21 -0
- package/.pi/harnesses/lib/system1/config-proactive.js +13 -2
- package/.pi/harnesses/lib/system1/config-v2.js +8 -5
- package/.versions/2.0.18/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.18/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.18/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/coms-claude-bridge.ts +437 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/fleet.ts +217 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/flow.ts +157 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +36 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.18/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.18/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.18/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.18/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.18/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.18/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.18/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.18/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.18/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.18/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.18/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.18/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.18/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.18/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.18/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.18/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.18/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.18/.pi/extensions/package.json +9 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.18/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/README.md +1483 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/acceptance.ts +199 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-hub.ts +54 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/context.ts +47 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/config/agents.ts +178 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/config/overrides.ts +165 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context/budgets.ts +206 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/deterministic-fs.ts +169 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +270 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +233 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native-types.ts +267 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-native.ts +234 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/adapters.ts +82 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +56 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/broker.ts +125 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +33 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/descendant.ts +63 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +48 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/hub.ts +152 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +99 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/results.ts +54 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/runtime.ts +120 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/filesystem-tool.ts +185 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/fixtures/registration-surface.json +65 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/index.ts +2625 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +133 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +144 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/no-progress.ts +593 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/orchestration-activation.ts +112 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/orchestration-route.ts +76 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/policy/work-mode.ts +137 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-config.ts +21 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-external-git.ts +59 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-external.ts +77 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-snapshot.ts +258 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/proactive-types.ts +67 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/process-obligations.ts +158 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/prompts/context.ts +56 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/prompts/fragments.ts +95 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/recovery-contract.ts +150 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/research/runtime.ts +201 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/research/spawn-run.ts +194 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/return-contract.js +349 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/review-findings.js +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/run-budget.js +554 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/scope-gate.js +144 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/session-audit.ts +313 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/spawn.ts +563 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/system1-communication-store.ts +190 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/system1-runtime.ts +258 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-authorization.ts +122 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-config.ts +29 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-obligations.ts +104 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-runtime.ts +125 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/action-executors.ts +213 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/context.ts +144 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +560 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/herdr-executors.ts +95 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/work-mode.ts +187 -0
- package/.versions/2.0.18/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.18/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
- package/.versions/2.0.18/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.18/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.18/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.18/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.18/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.18/.pi/harnesses/damage-control-continue/index.ts +533 -0
- package/.versions/2.0.18/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.18/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.18/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.18/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.18/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.18/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.18/.pi/harnesses/lib/context-budget-child-prompt.ts +220 -0
- package/.versions/2.0.18/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.0.18/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.18/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.18/.pi/harnesses/lib/damage-control-shared.ts +226 -0
- package/.versions/2.0.18/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.18/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.18/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.18/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.18/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.18/.pi/harnesses/lib/policy-roots.ts +142 -0
- package/.versions/2.0.18/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.0.18/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-file-discovery.js +21 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-loader.js +44 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config-v2.js +106 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.0.18/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.18/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.18/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.18/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.18/.pi/prompts/af-build.md +27 -0
- package/.versions/2.0.18/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.18/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.18/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.18/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.18/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.18/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.18/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.18/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.18/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.18/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.18/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.18/.version +1 -0
- package/.versions/2.0.18/agents/architect.md +24 -0
- package/.versions/2.0.18/agents/bowser.md +28 -0
- package/.versions/2.0.18/agents/builder.md +55 -0
- package/.versions/2.0.18/agents/code-reviewer.md +209 -0
- package/.versions/2.0.18/agents/deep-researcher.md +32 -0
- package/.versions/2.0.18/agents/documenter.md +22 -0
- package/.versions/2.0.18/agents/orchestrator.md +22 -0
- package/.versions/2.0.18/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.18/agents/planner.md +105 -0
- package/.versions/2.0.18/agents/releaser.md +24 -0
- package/.versions/2.0.18/agents/researcher.md +30 -0
- package/.versions/2.0.18/agents/security-auditor.md +167 -0
- package/.versions/2.0.18/agents/test-engineer.md +153 -0
- package/.versions/2.0.18/agents/web-debugger.md +44 -0
- package/.versions/2.0.18/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.18/bin/catalog/harness-runtime-closure.json +73 -0
- package/.versions/2.0.18/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.18/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.18/docs/ARCHITECTURE.md +874 -0
- package/.versions/2.0.18/docs/agent-fleet-setup.md +1101 -0
- package/.versions/2.0.18/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.0.18/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.18/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.18/docs/getting-started.md +126 -0
- package/.versions/2.0.18/docs/npm-install.md +535 -0
- package/.versions/2.0.18/docs/pi-extensions.md +454 -0
- package/.versions/2.0.18/docs/pi-setup.md +92 -0
- package/.versions/2.0.18/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.18/install-manifest.json +3193 -0
- package/.versions/2.0.18/justfile +247 -0
- package/.versions/2.0.18/manifest-meta.json +1071 -0
- package/.versions/2.0.18/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.18/references/communication-contract.md +26 -0
- package/.versions/2.0.18/references/definition-of-done.md +67 -0
- package/.versions/2.0.18/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.18/references/observability-checklist.md +92 -0
- package/.versions/2.0.18/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.18/references/performance-checklist.md +236 -0
- package/.versions/2.0.18/references/prompting-patterns.md +380 -0
- package/.versions/2.0.18/references/security-checklist.md +245 -0
- package/.versions/2.0.18/references/testing-patterns.md +235 -0
- package/.versions/2.0.18/references/workflow-authoring.md +304 -0
- package/.versions/2.0.18/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.18/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.18/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.18/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.18/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.18/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.18/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.18/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.18/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.18/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.18/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.18/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.18/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.18/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.18/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.18/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.18/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.18/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.18/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.18/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.0.18/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.18/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.18/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.18/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.18/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.0.18/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.18/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.18/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.0.18/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.18/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.18/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.18/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +6 -0
- package/README.md +2 -2
- package/agents/architect.md +2 -2
- package/agents/bowser.md +1 -1
- package/agents/builder.md +5 -5
- package/agents/code-reviewer.md +2 -2
- package/agents/deep-researcher.md +2 -2
- package/agents/documenter.md +3 -3
- package/agents/orchestrator.md +2 -2
- package/agents/plan-reviewer.md +2 -2
- package/agents/planner.md +4 -4
- package/agents/releaser.md +2 -2
- package/agents/researcher.md +2 -2
- package/agents/security-auditor.md +2 -2
- package/agents/test-engineer.md +4 -4
- package/agents/web-debugger.md +2 -2
- package/agents/web-performance-auditor.md +2 -2
- package/bin/cli.js +2 -2
- package/bin/lib/external-content.js +33 -0
- package/bin/lib/project-provenance.js +19 -13
- package/bin/lib/transaction.js +32 -1
- package/docs/ARCHITECTURE.md +42 -2
- package/docs/agent-fleet-setup.md +4 -4
- package/docs/claude-code-coms-bridge.md +17 -4
- package/docs/external-project-ai-content.md +48 -0
- package/docs/npm-install.md +5 -0
- package/docs/system1-agentic.md +27 -0
- package/docs/system1-config.md +23 -1
- package/docs/system1-file-discovery.md +220 -0
- package/install-manifest.json +1 -1
- package/package.json +15 -6
- package/skills/repository-ai-setup/SKILL.md +18 -0
- package/skills/repository-ai-setup.zip +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type {DiscoveryDiagnostic} from '../system1-communication-store.ts';
|
|
2
|
+
import {realpathSync,statSync} from 'node:fs';
|
|
3
|
+
import type {System1Service} from '../../lib/system1/contracts.ts';
|
|
4
|
+
import {sourceHash} from '../agentic-sources.ts';
|
|
5
|
+
import {composeQuestions,evaluateFile,POLICY_VERSION,type FileDiscoveryConfig,type FileEvaluation,type ReadySource} from './evaluate.ts';
|
|
6
|
+
import {rankCandidates} from './sources.ts';
|
|
7
|
+
import {createResult} from './results.ts';
|
|
8
|
+
import {createDiscoveryBudget,type DiscoveryCounter} from './state.ts';
|
|
9
|
+
// Object keys are canonical; arrays (including ordinal levels) retain order.
|
|
10
|
+
export function canonicalHash(value:unknown):string {
|
|
11
|
+
const canonical=(v:any):any=>Array.isArray(v)?v.map(canonical):v&&typeof v==='object'?Object.fromEntries(Object.keys(v).sort().map(k=>[k,canonical(v[k])])):v;
|
|
12
|
+
return sourceHash(JSON.stringify(canonical(value)));
|
|
13
|
+
}
|
|
14
|
+
// Only this causal marker denotes a D9 request deadline; generic aborts remain cancellation.
|
|
15
|
+
export const DISCOVERY_DEADLINE=Object.freeze({type:'file_discovery_deadline'} as const);
|
|
16
|
+
export type DiscoveryDeadlineCause=typeof DISCOVERY_DEADLINE;
|
|
17
|
+
export function isDiscoveryDeadline(reason:unknown):reason is DiscoveryDeadlineCause {return reason===DISCOVERY_DEADLINE;}
|
|
18
|
+
type Score=FileEvaluation & {cached?:boolean};
|
|
19
|
+
type Work={owner:string;key:string;controller:AbortController;waiters:Set<symbol>;run():Promise<Score>;resolve(value:Score):void;promise:Promise<Score>};
|
|
20
|
+
export interface DiscoveryJob {owner:string;attempt?:string;trigger?:string;task:string;query:string;paths:readonly string[];discoveryComplete:boolean;hidden?:number;signal?:AbortSignal;context?():string;customQuestions?:unknown;canDisplay(path:string):boolean;canRead(path:string):boolean;permissionIdentity():string}
|
|
21
|
+
export function createDiscoveryRuntime(options:{root:string;sessionId:string;config:FileDiscoveryConfig;service?:System1Service;provider?:string;model?:string;context():string;persist(s:DiscoveryCounter):void;restored?:DiscoveryCounter|null;observe?(metadata:DiscoveryDiagnostic):(summary:unknown)=>void;clock?:{setTimeout:typeof setTimeout;clearTimeout:typeof clearTimeout}}) {
|
|
22
|
+
const config=options.config,root=realpathSync(options.root),stat=statSync(root),workspace=[root,stat.dev,stat.ino];
|
|
23
|
+
const budget=createDiscoveryBudget(options.sessionId,options.persist,options.restored),lifetime=new AbortController();
|
|
24
|
+
const cache=new Map<string,FileEvaluation>(),inflight=new Map<string,Work>(),queues=new Map<string,Work[]>(),owners:string[]=[];
|
|
25
|
+
const jobs=new Map<AbortController,{context:string;current():string}>();let active=0,lastOwner='',authStopped=false;
|
|
26
|
+
const clock=options.clock??{setTimeout,clearTimeout};
|
|
27
|
+
const unscored=(reason:string):Score=>({status:'unscored',reason});
|
|
28
|
+
const pump=()=>{
|
|
29
|
+
while(active<config.limits.concurrency&&owners.length){
|
|
30
|
+
// Reinsert owners at the tail; never drain one owner's backlog first.
|
|
31
|
+
if(owners.length>1&&owners[0]===lastOwner)owners.push(owners.shift()!);
|
|
32
|
+
const owner=owners.shift()!,queue=queues.get(owner)!,work=queue.shift()!;lastOwner=owner;
|
|
33
|
+
if(queue.length)owners.push(owner);else queues.delete(owner);
|
|
34
|
+
if(work.controller.signal.aborted){work.resolve(unscored('cancelled'));continue;}
|
|
35
|
+
active++;
|
|
36
|
+
let onAbort!:()=>void;
|
|
37
|
+
const cancelled=new Promise<Score>(resolve=>{onAbort=()=>resolve(unscored('cancelled'));work.controller.signal.addEventListener('abort',onAbort,{once:true});});
|
|
38
|
+
void Promise.race([work.run(),cancelled]).catch(()=>unscored('unavailable')).then(result=>{
|
|
39
|
+
if(work.controller.signal.aborted||lifetime.signal.aborted)result=unscored('cancelled');
|
|
40
|
+
if(result.status==='scored'){cache.set(work.key,result);while(cache.size>config.limits.maxCacheEntries)cache.delete(cache.keys().next().value!);}
|
|
41
|
+
work.resolve(result);
|
|
42
|
+
}).finally(()=>{work.controller.signal.removeEventListener('abort',onAbort);active--;if(inflight.get(work.key)===work)inflight.delete(work.key);pump();});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const score=async(job:DiscoveryJob,source:ReadySource,signal:AbortSignal,context:string,permission:string,metrics:{logicalCalls:number;attempts:number|null;usage:{inputTokens:number;outputTokens:number}|null}):Promise<Score>=>{
|
|
46
|
+
const current=async()=>!signal.aborted&&(job.context??options.context)()===context&&job.permissionIdentity()===permission&&await source.current(signal);
|
|
47
|
+
if(!await current())return unscored(signal.aborted?'cancelled':'changed');
|
|
48
|
+
const questions=composeQuestions(job.customQuestions);if(!questions)return unscored('invalid_input');
|
|
49
|
+
const key=canonicalHash({workspace,context,path:source.path,hash:source.hash,task:job.task,query:job.query,questions,policy:POLICY_VERSION,provider:options.provider??'typesafe',model:options.model??'jev-1.13.0',permission,include:config.include});
|
|
50
|
+
const hit=cache.get(key);if(hit)return await current()?{...structuredClone(hit),cached:true}:unscored('changed');
|
|
51
|
+
let work=inflight.get(key);
|
|
52
|
+
if(!work){
|
|
53
|
+
const controller=new AbortController();let resolve!:(s:Score)=>void;
|
|
54
|
+
const promise=new Promise<Score>(r=>resolve=r);
|
|
55
|
+
work={owner:job.owner,key,controller,waiters:new Set(),promise,resolve,async run(){
|
|
56
|
+
if(authStopped)return unscored('auth');
|
|
57
|
+
if(!options.service)return unscored('unavailable');
|
|
58
|
+
if((job.context??options.context)()!==context||job.permissionIdentity()!==permission||!await source.current(controller.signal))return unscored('changed');
|
|
59
|
+
const service:System1Service={async evaluate(request){
|
|
60
|
+
if(controller.signal.aborted)return {status:'cancelled'};
|
|
61
|
+
if(authStopped)return {status:'unavailable',reason:'auth'};
|
|
62
|
+
const reserved=budget.reserve(config.limits.maxCallsPerSession);
|
|
63
|
+
if(reserved!=='ok')throw Error(reserved);
|
|
64
|
+
metrics.logicalCalls++;
|
|
65
|
+
const previousAttempts=metrics.attempts,previousUsage=metrics.usage;metrics.attempts=null;metrics.usage=null;
|
|
66
|
+
const result=await options.service!.evaluate(request);
|
|
67
|
+
if(result.status==='ok'){
|
|
68
|
+
const m=result.evaluation.metadata;
|
|
69
|
+
if(Number.isSafeInteger(m.attempts)&&m.attempts>=0&&previousAttempts!==null)metrics.attempts=previousAttempts+m.attempts;else metrics.attempts=null;
|
|
70
|
+
if(m.usage&&Number.isFinite(m.usage.inputTokens)&&Number.isFinite(m.usage.outputTokens)&&previousUsage){metrics.usage={inputTokens:previousUsage.inputTokens+m.usage.inputTokens,outputTokens:previousUsage.outputTokens+m.usage.outputTokens};}else metrics.usage=null;
|
|
71
|
+
}else{metrics.attempts=null;metrics.usage=null;}
|
|
72
|
+
if(result.status==='unavailable'&&result.reason==='auth')authStopped=true;
|
|
73
|
+
return result;
|
|
74
|
+
}};
|
|
75
|
+
try{const result=await evaluateFile({config,service,source:{...source,current:()=>source.current(controller.signal)},task:job.task,customQuestions:job.customQuestions,signal:controller.signal});
|
|
76
|
+
return (job.context??options.context)()===context&&job.permissionIdentity()===permission?result:unscored('changed');}
|
|
77
|
+
catch(error){return unscored(error instanceof Error?error.message:'unavailable');}
|
|
78
|
+
}};
|
|
79
|
+
inflight.set(key,work);const queue=queues.get(job.owner);if(queue)queue.push(work);else{queues.set(job.owner,[work]);owners.push(job.owner);}
|
|
80
|
+
}
|
|
81
|
+
const shared=work,waiter=Symbol();shared.waiters.add(waiter);
|
|
82
|
+
return new Promise<Score>(resolve=>{
|
|
83
|
+
let done=false;
|
|
84
|
+
const finish=async(value:Score)=>{
|
|
85
|
+
if(done)return;done=true;signal.removeEventListener('abort',abort);shared.waiters.delete(waiter);
|
|
86
|
+
if(!shared.waiters.size){shared.controller.abort();if(inflight.get(key)===shared)inflight.delete(key);}
|
|
87
|
+
resolve(signal.aborted?unscored('cancelled'):await current()?structuredClone(value):unscored('changed'));
|
|
88
|
+
};
|
|
89
|
+
const abort=()=>{void finish(unscored('cancelled'));};signal.addEventListener('abort',abort,{once:true});
|
|
90
|
+
if(signal.aborted)abort();else{void shared.promise.then(finish);pump();}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const dispose=()=>{lifetime.abort();for(const job of jobs.keys())job.abort();for(const work of inflight.values()){work.controller.abort();work.resolve(unscored('cancelled'));}queues.clear();owners.length=0;cache.clear();inflight.clear();};
|
|
94
|
+
return {get enabled(){return config.mode==='active'&&config.remoteContextApproved&&!lifetime.signal.aborted;},get calls(){return budget.calls;},dispose,syncContext(){for(const [job,{context,current}] of jobs)if(context!==current())job.abort();},
|
|
95
|
+
async rank(job:DiscoveryJob){
|
|
96
|
+
const started=Date.now(),metrics={logicalCalls:0,attempts:0 as number|null,usage:{inputTokens:0,outputTokens:0} as {inputTokens:number;outputTokens:number}|null};
|
|
97
|
+
let finish:((summary:unknown)=>void)|undefined;
|
|
98
|
+
try{finish=options.observe?.({owner:job.owner==='hub'?'hub':sourceHash(job.owner),attempt:job.attempt?sourceHash(job.attempt):undefined,trigger:job.trigger,provider:options.provider??'typesafe',model:options.model??'jev-1.13.0'});}catch{/* observer only */}
|
|
99
|
+
const report=(result:ReturnType<typeof createResult>)=>{try{finish?.({...result,elapsedMs:Date.now()-started,...metrics,attempts:metrics.logicalCalls?metrics.attempts:null,usage:metrics.logicalCalls?metrics.usage:null});}catch{/* observer only */}return result;};
|
|
100
|
+
const current=job.context??options.context,context=current(),permission=job.permissionIdentity(),controller=new AbortController();
|
|
101
|
+
const identity={taskHash:sourceHash(job.task),queryHash:sourceHash(job.query),model:options.model??'jev-1.13.0'};
|
|
102
|
+
const refused=(reason:string)=>report(createResult({identity,discoveryComplete:job.discoveryComplete,rows:job.paths.filter(p=>job.canDisplay(root+'/'+p)).map(path=>({path,status:'unscored',reason})),cancelled:reason==='cancelled'}));
|
|
103
|
+
if(lifetime.signal.aborted)return refused('cancelled');
|
|
104
|
+
if(job.signal?.aborted)return refused(isDiscoveryDeadline(job.signal.reason)?'deadline':'cancelled');
|
|
105
|
+
if(jobs.size>=config.limits.maxQueuedJobs+config.limits.concurrency)return refused('queue_full');
|
|
106
|
+
if(!composeQuestions(job.customQuestions))return refused('invalid_input');
|
|
107
|
+
jobs.set(controller,{context,current});const abort=()=>controller.abort(job.signal?.reason);job.signal?.addEventListener('abort',abort,{once:true});
|
|
108
|
+
if(job.signal?.aborted)abort();
|
|
109
|
+
const timer=clock.setTimeout(()=>controller.abort(DISCOVERY_DEADLINE),config.limits.jobTimeoutMs);
|
|
110
|
+
try{
|
|
111
|
+
const ranked=await rankCandidates({root,config,paths:job.paths,task:job.task,customQuestions:job.customQuestions,hidden:job.hidden,service:options.service??{evaluate:async()=>({status:'unavailable',reason:'invalid_config'})},signal:controller.signal,canDisplay:job.canDisplay,canRead:job.canRead,evaluate:source=>score(job,source,controller.signal,context,permission,metrics)});
|
|
112
|
+
if(current()!==context||job.permissionIdentity()!==permission)return refused('changed');
|
|
113
|
+
const deadline=controller.signal.aborted&&isDiscoveryDeadline(controller.signal.reason);
|
|
114
|
+
if(deadline)for(const row of ranked.rows)if(row.status==='unscored'&&row.reason==='cancelled')row.reason='deadline';
|
|
115
|
+
return report(createResult({...ranked,identity,discoveryComplete:job.discoveryComplete,cancelled:controller.signal.aborted&&!deadline}));
|
|
116
|
+
}finally{clock.clearTimeout(timer);job.signal?.removeEventListener('abort',abort);jobs.delete(controller);}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export type DiscoveryRuntime=ReturnType<typeof createDiscoveryRuntime>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {realpathSync} from 'node:fs';
|
|
2
|
+
import {resolve} from 'node:path';
|
|
3
|
+
import {checkedSourcePath} from '../../lib/safe-source-read.js';
|
|
4
|
+
import {currentFileAccessAllowed} from '../../lib/damage-control-shared.ts';
|
|
5
|
+
import {exportPathAllowed, readSourcesWorker, sourceHash} from '../agentic-sources.ts';
|
|
6
|
+
import {containsCommunicationSecret} from '../system1-communication-store.ts';
|
|
7
|
+
import {evaluateFile, type FileDiscoveryConfig, type ReadySource, type FileEvaluation} from './evaluate.ts';
|
|
8
|
+
import type {System1Service} from '../../lib/system1/contracts.ts';
|
|
9
|
+
import type {ResultRow} from './results.ts';
|
|
10
|
+
|
|
11
|
+
export function createDiscoverySources(options:{root:string; config:FileDiscoveryConfig; canRead?(path:string):boolean; read?:typeof readSourcesWorker}) {
|
|
12
|
+
const root=realpathSync(options.root), read=options.read??readSourcesWorker;
|
|
13
|
+
const access=options.canRead??(path=>currentFileAccessAllowed(root,path));
|
|
14
|
+
const approved=(path:string)=>{
|
|
15
|
+
if(!exportPathAllowed(path,options.config.include))throw Error('source_denied');
|
|
16
|
+
const full=resolve(root,path);if(!access(full))throw Error('source_denied');
|
|
17
|
+
return checkedSourcePath(root,full);
|
|
18
|
+
};
|
|
19
|
+
return async(path:string,signal:AbortSignal):Promise<ReadySource>=>{
|
|
20
|
+
const full=approved(path);
|
|
21
|
+
const bytes=(await read(root,[full],options.config.limits.maxFileBytes,signal,options.config.limits.discoveryMs))[0];
|
|
22
|
+
if(containsCommunicationSecret(bytes.toString('utf8')))throw Error('source_denied');
|
|
23
|
+
const hash=sourceHash(bytes);
|
|
24
|
+
return {path,text:bytes.toString('utf8'),hash,async current(currentSignal=signal){
|
|
25
|
+
try {const full=approved(path);const current=(await read(root,[full],options.config.limits.maxFileBytes,currentSignal,options.config.limits.discoveryMs))[0];return sourceHash(current)===hash;}catch{return false;}
|
|
26
|
+
}};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const failure=(error:unknown)=>{
|
|
30
|
+
const reason=error instanceof Error?error.message:'';
|
|
31
|
+
return ({source_denied:'denied',state_too_large:'oversized',source_changed:'changed',cancelled:'cancelled'} as Record<string,string>)[reason]??'unavailable';
|
|
32
|
+
};
|
|
33
|
+
// Metadata permission is distinct from content/export permission. Hidden paths contribute only an aggregate.
|
|
34
|
+
export async function rankCandidates(options:{root:string;config:FileDiscoveryConfig;paths:readonly string[];task:string;service:System1Service;signal:AbortSignal;canDisplay(path:string):boolean;canRead?(path:string):boolean;hidden?:number;customQuestions?:unknown;read?:typeof readSourcesWorker;evaluate?(source:ReadySource):Promise<FileEvaluation & {cached?:boolean}>}) {
|
|
35
|
+
const collect=createDiscoverySources(options),rows:ResultRow[]=[];
|
|
36
|
+
let hidden=options.hidden??0,sourceBytes=0,evaluations=0;
|
|
37
|
+
const paths=[...new Set(options.paths)].sort();
|
|
38
|
+
for(const path of paths){
|
|
39
|
+
// Only canonical relative identities enter the result. Do not disclose arbitrary caller payload.
|
|
40
|
+
if(!path||path.startsWith('/')||/[\\\0]/.test(path)||path.split('/').some(p=>!p||p==='.'||p==='..')){hidden++;continue;}
|
|
41
|
+
if(!options.canDisplay(resolve(options.root,path))){hidden++;continue;}
|
|
42
|
+
const row:ResultRow={path,status:'unscored',reason:'not_evaluated'};rows.push(row);
|
|
43
|
+
if(options.signal.aborted){row.reason='cancelled';continue;}
|
|
44
|
+
if(options.config.mode!=='active'||!options.config.remoteContextApproved){row.reason=options.config.mode==='active'?'not_approved':'consumer_off';continue;}
|
|
45
|
+
if(evaluations>=options.config.limits.maxEvaluationsPerJob||sourceBytes>=options.config.limits.maxSourceBytesPerJob)continue;
|
|
46
|
+
try {
|
|
47
|
+
const source=await collect(path,options.signal);row.hash=source.hash;
|
|
48
|
+
sourceBytes+=Buffer.byteLength(source.text);if(sourceBytes>options.config.limits.maxSourceBytesPerJob)continue;
|
|
49
|
+
evaluations++;
|
|
50
|
+
const result=options.evaluate?await options.evaluate(source):await evaluateFile({...options,source});
|
|
51
|
+
if(result.status==='scored'){
|
|
52
|
+
row.status='cached' in result&&result.cached?'cached':'scored';delete row.reason;row.relevance=result.relevance;row.role=result.role;
|
|
53
|
+
const answer=result.answers.find(a=>a.questionId==='d9_relevance');
|
|
54
|
+
if(answer)row.uncertainty={provenance:answer.uncertainty.provenance,confidence:answer.uncertainty.confidence};
|
|
55
|
+
}else row.reason=result.reason;
|
|
56
|
+
}catch(error){row.reason=failure(error);}
|
|
57
|
+
}
|
|
58
|
+
const visible=rows.filter(row=>{
|
|
59
|
+
const full=resolve(options.root,row.path);
|
|
60
|
+
if(!options.canDisplay(full)){hidden++;return false;}
|
|
61
|
+
// Later evaluations can revoke an earlier row's read/export permission.
|
|
62
|
+
if((row.status!=='unscored'||row.hash)&&(!exportPathAllowed(row.path,options.config.include)||!(options.canRead??(path=>currentFileAccessAllowed(options.root,path)))(full))){
|
|
63
|
+
for(const key of ['hash','relevance','role','uncertainty'] as const)delete row[key];
|
|
64
|
+
row.status='unscored';row.reason='denied';
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
});
|
|
68
|
+
return {rows:visible,hidden};
|
|
69
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const DISCOVERY_COUNTER='agent-hub-file-discovery-counter/v1';
|
|
2
|
+
export interface DiscoveryCounter {schema:typeof DISCOVERY_COUNTER;sessionId:string;calls:number}
|
|
3
|
+
export function restoreDiscoveryCounter(entries:readonly unknown[],sessionId:string):DiscoveryCounter|null {
|
|
4
|
+
let calls=0,found=false;
|
|
5
|
+
for(const row of entries as any[]){
|
|
6
|
+
if((row?.customType??row?.type)!==DISCOVERY_COUNTER)continue;
|
|
7
|
+
const s=row.data;
|
|
8
|
+
if(!s||s.schema!==DISCOVERY_COUNTER||s.sessionId!==sessionId||!Number.isSafeInteger(s.calls)||s.calls<0||s.calls>10000)return null;
|
|
9
|
+
calls=Math.max(calls,s.calls);found=true;
|
|
10
|
+
}
|
|
11
|
+
if(!found&&entries.some((r:any)=>r?.type==='message'&&r.message?.role==='user'))return null;
|
|
12
|
+
return {schema:DISCOVERY_COUNTER,sessionId,calls};
|
|
13
|
+
}
|
|
14
|
+
export function createDiscoveryBudget(sessionId:string,persist:(s:DiscoveryCounter)=>void,restored:DiscoveryCounter|null=restoreDiscoveryCounter([],sessionId)) {
|
|
15
|
+
let state=restored;
|
|
16
|
+
return {get calls(){return state?.calls??null;},reserve(max:number){
|
|
17
|
+
if(!state)return 'counter_restore_ambiguous';
|
|
18
|
+
if(state.calls>=max)return 'budget_exhausted';
|
|
19
|
+
const next={...state,calls:state.calls+1};
|
|
20
|
+
try{persist(next);state=next;return 'ok';}catch{return 'persistence_failed';}
|
|
21
|
+
}};
|
|
22
|
+
}
|
|
@@ -2,14 +2,31 @@ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
|
2
2
|
import { Type } from "@sinclair/typebox";
|
|
3
3
|
import { existsSync, lstatSync, realpathSync, statSync } from "node:fs";
|
|
4
4
|
import { isAbsolute, relative, resolve } from "node:path";
|
|
5
|
-
import { deterministicHandlePath } from "../lib/deterministic-handle-path.ts";
|
|
6
|
-
import {
|
|
5
|
+
import { decodeDeterministicHandle, deterministicHandlePath } from "../lib/deterministic-handle-path.ts";
|
|
6
|
+
import { authorizePolicyPath, resolvePolicyRoots, type PolicyRootTable } from "../lib/policy-roots.ts";
|
|
7
|
+
import { CONTENT_REPLY_BYTES, excerpt, inventory, readback, snapshotSource } from "./deterministic-fs.ts";
|
|
7
8
|
import { readActiveProfile } from "./policy/profile-runtime.ts";
|
|
8
9
|
import { resolveAssist } from "./assist-profile.ts";
|
|
9
10
|
|
|
10
11
|
export const FILESYSTEM_SESSION_DIR_ENV = "AGENT_FLEET_FILESYSTEM_SESSION_DIR";
|
|
12
|
+
export const FILESYSTEM_POLICY_ROOTS_ENV = "AGENT_FLEET_FILESYSTEM_POLICY_ROOTS";
|
|
13
|
+
export function filesystemPolicyRootsFromEnv(env: NodeJS.ProcessEnv = process.env): PolicyRootTable | undefined {
|
|
14
|
+
const raw=env[FILESYSTEM_POLICY_ROOTS_ENV];
|
|
15
|
+
if (!raw) return undefined;
|
|
16
|
+
try {
|
|
17
|
+
if (Buffer.byteLength(raw)>64*1024) throw new Error();
|
|
18
|
+
const table=JSON.parse(raw) as PolicyRootTable;
|
|
19
|
+
if (typeof table.workspace!=="string" || !Array.isArray(table.roots) || table.roots[0]?.role!=="workspace") throw new Error();
|
|
20
|
+
const recreated=resolvePolicyRoots(table.workspace,{
|
|
21
|
+
rulesDirs:table.roots.filter(r=>r.role==="rules").map(r=>r.configuredPath),
|
|
22
|
+
docsPaths:table.roots.filter(r=>r.role==="docs").map(r=>r.configuredPath),
|
|
23
|
+
});
|
|
24
|
+
if (JSON.stringify(recreated.roots)!==JSON.stringify(table.roots)) throw new Error();
|
|
25
|
+
return recreated;
|
|
26
|
+
} catch { throw new Error("Invalid child filesystem policy roots"); }
|
|
27
|
+
}
|
|
11
28
|
|
|
12
|
-
export interface FilesystemToolPorts { enabled(): boolean; sessionDir(): string; readOnly?(): boolean; remainingSelfReadBytes?(): number; noteSelfReadBytes?(bytes: number): void }
|
|
29
|
+
export interface FilesystemToolPorts { enabled(): boolean; sessionDir(): string; readOnly?(): boolean; remainingSelfReadBytes?(): number; noteSelfReadBytes?(bytes: number): void; policyRoots?(): PolicyRootTable | undefined; managedReadbackAllowed?(handle:string):boolean }
|
|
13
30
|
|
|
14
31
|
function workspacePath(path: string, cwd: string): string {
|
|
15
32
|
const target=resolve(cwd,path), rel=relative(cwd,target);
|
|
@@ -25,6 +42,28 @@ function inside(root: string, target: string): boolean {
|
|
|
25
42
|
const rel = relative(resolve(root), resolve(target));
|
|
26
43
|
return rel === "" || (!!rel && !rel.startsWith("..") && !isAbsolute(rel));
|
|
27
44
|
}
|
|
45
|
+
function policyReadPath(path: string, cwd: string, table?: PolicyRootTable, operation: "read" | "inventory" = "read") {
|
|
46
|
+
const workspace = table?.workspace ?? cwd;
|
|
47
|
+
if (inside(workspace, resolve(workspace, path))) return { path: workspacePath(path, workspace), allowedRoot: workspace, rootId: undefined as string | undefined };
|
|
48
|
+
if (!table) return { path: workspacePath(path, cwd), allowedRoot: cwd, rootId: undefined as string | undefined };
|
|
49
|
+
const admitted = authorizePolicyPath(table, path, operation);
|
|
50
|
+
return { path: admitted.path, allowedRoot: admitted.root.canonicalPath, rootId: admitted.root.id };
|
|
51
|
+
}
|
|
52
|
+
function sourceHandle(handle: string | undefined, rootId: string | undefined): string | undefined {
|
|
53
|
+
if (!handle) return undefined;
|
|
54
|
+
const decoded = decodeDeterministicHandle(handle);
|
|
55
|
+
if (decoded.rootId !== rootId) throw new Error("Filesystem handle root grant changed or is missing");
|
|
56
|
+
const { rootId: _rootId, ...source } = decoded;
|
|
57
|
+
return `t5:${Buffer.from(JSON.stringify(source)).toString("base64url")}`;
|
|
58
|
+
}
|
|
59
|
+
function bindHandles<T extends Record<string, any>>(payload: T, rootId: string | undefined): T {
|
|
60
|
+
if (!rootId) return payload;
|
|
61
|
+
const bound = { ...payload } as Record<string, any>;
|
|
62
|
+
for (const key of ["handle", "nextHandle", "onDiskHandle"]) {
|
|
63
|
+
if (typeof bound[key] === "string") bound[key] = `t5:${Buffer.from(JSON.stringify({ ...decodeDeterministicHandle(bound[key]), rootId })).toString("base64url")}`;
|
|
64
|
+
}
|
|
65
|
+
return bound as T;
|
|
66
|
+
}
|
|
28
67
|
function fileBytes(path: string): number | null {
|
|
29
68
|
if (!existsSync(path)) return null;
|
|
30
69
|
const size = statSync(path);
|
|
@@ -59,7 +98,7 @@ export function registerFilesystemTool(pi: ExtensionAPI, ports: FilesystemToolPo
|
|
|
59
98
|
description: "Deterministically stat, inventory, or excerpt repository files, or read back an opaque handle. Orchestrator may use those read-only operations without assist.deterministic-tools. In orchestrator mode, stat before excerpt; files above 64 KiB return no body and must go to spawn_research or dispatch_agent by path. Snapshot into this session's managed artifacts requires that profile. No network, shell, or arbitrary write.",
|
|
60
99
|
parameters: Type.Object({
|
|
61
100
|
operation: Type.Union([Type.Literal("stat"),Type.Literal("inventory"),Type.Literal("excerpt"),Type.Literal("readback"),Type.Literal("snapshot")]),
|
|
62
|
-
path: Type.Optional(Type.String({description:"
|
|
101
|
+
path: Type.Optional(Type.String({description:"Path inside the checkout or an explicitly configured read-only rules/docs grant; required except for readback. Snapshot sources remain checkout-local."})),
|
|
63
102
|
handle: Type.Optional(Type.String({description:"Opaque handle returned by inventory, excerpt, snapshot, or prior readback."})),
|
|
64
103
|
origin: Type.Optional(Type.Literal("file",{description:"Snapshots accept local file sources only."})),
|
|
65
104
|
page_size: Type.Optional(Type.Integer({minimum:1})),
|
|
@@ -69,7 +108,8 @@ export function registerFilesystemTool(pi: ExtensionAPI, ports: FilesystemToolPo
|
|
|
69
108
|
const profileEnabled = ports.enabled();
|
|
70
109
|
const readOnly = ports.readOnly?.() === true;
|
|
71
110
|
if (!profileEnabled && !readOnly) throw new Error("filesystem is disabled by the effective profile; set assist.deterministic-tools=true");
|
|
72
|
-
const params=raw as any, cwd=resolve(ctx.cwd || process.cwd()), sessionValue=ports.sessionDir();
|
|
111
|
+
const params=raw as any, cwd=resolve(ctx.cwd || process.cwd()), sessionValue=ports.sessionDir(), table=ports.policyRoots?.();
|
|
112
|
+
const workspace = table?.workspace ?? cwd;
|
|
73
113
|
if (!sessionValue) throw new Error("filesystem requires a current managed session artifact root");
|
|
74
114
|
const session=resolve(sessionValue);
|
|
75
115
|
if (existsSync(session) && lstatSync(session).isSymbolicLink()) throw new Error("filesystem refuses a symlinked managed session root");
|
|
@@ -77,7 +117,7 @@ export function registerFilesystemTool(pi: ExtensionAPI, ports: FilesystemToolPo
|
|
|
77
117
|
switch(params.operation) {
|
|
78
118
|
case "stat": {
|
|
79
119
|
if(!params.path) throw new Error("stat requires path");
|
|
80
|
-
const target =
|
|
120
|
+
const target = policyReadPath(params.path,cwd,table).path;
|
|
81
121
|
if (!existsSync(target)) throw new Error(`Not found: ${params.path}`);
|
|
82
122
|
const followed = statSync(target);
|
|
83
123
|
const bytes = followed.isFile() ? followed.size : null;
|
|
@@ -85,44 +125,50 @@ export function registerFilesystemTool(pi: ExtensionAPI, ports: FilesystemToolPo
|
|
|
85
125
|
}
|
|
86
126
|
case "inventory": {
|
|
87
127
|
if(!params.path) throw new Error("inventory requires path");
|
|
88
|
-
const
|
|
89
|
-
const listed = inventory({root,handle:params.handle,pageSize:params.page_size,boundedOutput:true
|
|
90
|
-
|
|
128
|
+
const source = policyReadPath(params.path,cwd,table,"inventory");
|
|
129
|
+
const listed = inventory({root:source.path,handle:sourceHandle(params.handle,source.rootId),pageSize:params.page_size,boundedOutput:true,
|
|
130
|
+
...(source.rootId ? { authorizePath: (path: string) => {
|
|
131
|
+
const entry = authorizePolicyPath(table!,path);
|
|
132
|
+
if (entry.root.id !== source.rootId) throw new Error("Inventory entry crosses root grant");
|
|
133
|
+
} } : {}),
|
|
134
|
+
});
|
|
135
|
+
return result(admit(ports, readOnly, source.path, bindHandles(listed,source.rootId)));
|
|
91
136
|
}
|
|
92
137
|
case "excerpt": {
|
|
93
138
|
if(!params.path) throw new Error("excerpt requires path");
|
|
94
|
-
const
|
|
139
|
+
const source = policyReadPath(params.path,cwd,table), target = source.path;
|
|
140
|
+
const handle = sourceHandle(params.handle,source.rootId);
|
|
95
141
|
if (readOnly) {
|
|
96
142
|
const oversized = tooLarge(target);
|
|
97
143
|
if (oversized) return result(tooLargeRefusal(oversized.path, oversized.bytes));
|
|
98
144
|
const bytes = fileBytes(target) ?? 0;
|
|
99
145
|
if (ports.noteSelfReadBytes && bytes > (ports.remainingSelfReadBytes?.() ?? 0)) return result(tooLargeRefusal(target, bytes));
|
|
100
146
|
}
|
|
101
|
-
const body = excerpt({path:target,allowedRoot:
|
|
102
|
-
return result(admit(ports, readOnly, target, body));
|
|
147
|
+
const body = excerpt({path:target,allowedRoot:source.allowedRoot,handle,maxBytes:params.max_bytes,boundedOutput:true});
|
|
148
|
+
return result(admit(ports, readOnly, target, bindHandles(body,source.rootId)));
|
|
103
149
|
}
|
|
104
150
|
case "readback": {
|
|
105
151
|
if(!params.handle) throw new Error("readback requires handle");
|
|
152
|
+
if(ports.managedReadbackAllowed?.(params.handle)===false)throw new Error('Managed readback is stale or denied');
|
|
153
|
+
const decoded = decodeDeterministicHandle(params.handle);
|
|
154
|
+
const bound = deterministicHandlePath(params.handle);
|
|
155
|
+
// Managed artifacts retain their separate session boundary, never a content-root fallback.
|
|
156
|
+
const source = !decoded.rootId && inside(session,bound)
|
|
157
|
+
? { path: workspacePath(bound,session), allowedRoot: session, rootId: undefined }
|
|
158
|
+
: policyReadPath(bound,cwd,table);
|
|
159
|
+
const handle = sourceHandle(params.handle,source.rootId)!;
|
|
106
160
|
if (readOnly) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (oversized) return result(tooLargeRefusal(oversized.path, oversized.bytes));
|
|
112
|
-
const bytes = fileBytes(bound) ?? 0;
|
|
113
|
-
if (ports.noteSelfReadBytes && bytes > (ports.remainingSelfReadBytes?.() ?? 0)) return result(tooLargeRefusal(bound, bytes));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
try { return result(admit(ports, readOnly, cwd, readback({handle:params.handle,allowedRoot:cwd,maxBytes:params.max_bytes,boundedOutput:true}))); }
|
|
117
|
-
catch (error) {
|
|
118
|
-
if (!(error instanceof PathOutsideAllowedRootError)) throw error;
|
|
119
|
-
return result(admit(ports, readOnly, session, readback({handle:params.handle,allowedRoot:session,maxBytes:params.max_bytes,boundedOutput:true})));
|
|
161
|
+
const oversized = tooLarge(source.path);
|
|
162
|
+
if (oversized) return result(tooLargeRefusal(oversized.path, oversized.bytes));
|
|
163
|
+
const bytes = fileBytes(source.path) ?? 0;
|
|
164
|
+
if (ports.noteSelfReadBytes && bytes > (ports.remainingSelfReadBytes?.() ?? 0)) return result(tooLargeRefusal(source.path, bytes));
|
|
120
165
|
}
|
|
166
|
+
return result(admit(ports,readOnly,source.path,bindHandles(readback({handle,allowedRoot:source.allowedRoot,maxBytes:params.max_bytes,boundedOutput:true}),source.rootId)));
|
|
121
167
|
}
|
|
122
168
|
case "snapshot":
|
|
123
169
|
if (!profileEnabled) throw new Error("filesystem snapshot requires assist.deterministic-tools; orchestrator inspection is inventory, excerpt, and readback only");
|
|
124
170
|
if(params.origin!=="file" || !params.path) throw new Error("snapshot accepts a local file origin and path only");
|
|
125
|
-
return result(snapshotSource({origin:"file",path:workspacePath(params.path,
|
|
171
|
+
return result(snapshotSource({origin:"file",path:workspacePath(params.path,workspace),allowedRoot:workspace,sessionDir:session}));
|
|
126
172
|
default: throw new Error("Unsupported filesystem operation");
|
|
127
173
|
}
|
|
128
174
|
},
|
|
@@ -130,7 +176,9 @@ export function registerFilesystemTool(pi: ExtensionAPI, ports: FilesystemToolPo
|
|
|
130
176
|
}
|
|
131
177
|
|
|
132
178
|
export default function deterministicFilesystemExtension(pi: ExtensionAPI): void {
|
|
179
|
+
const roots=filesystemPolicyRootsFromEnv();
|
|
133
180
|
registerFilesystemTool(pi, {
|
|
181
|
+
policyRoots: () => roots,
|
|
134
182
|
enabled: () => resolveAssist(readActiveProfile()?.profile.assist)['deterministic-tools'],
|
|
135
183
|
sessionDir: () => process.env[FILESYSTEM_SESSION_DIR_ENV] || "",
|
|
136
184
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerDiscoveryHub, configureDiscoveryHub, resetDiscoveryHub, discoveryHubEnabled, discoveryManagedReadbackAllowed, prepareDiscoveryNative } from './file-discovery/hub.ts';
|
|
1
2
|
import { registerAgenticHub, configureAgenticHub, agenticHubEnabled, agenticHubRuntime, resetAgenticHub } from './agentic-hub.ts';
|
|
2
3
|
import { loadSystem1Snapshot } from "../lib/system1/config-loader.js";
|
|
3
4
|
import { normalizeSystem1Config } from "../lib/system1/config-v2.js";
|
|
@@ -27,7 +28,7 @@ import { hasExplicitDispatcher, isCompleteProfile, dispatcherSelection, type Mod
|
|
|
27
28
|
import { createProfileActivation } from './policy/profile-activation.ts';
|
|
28
29
|
import { readActiveProfile, profileWorkInFlight, withProfileWork, assertProfileModel, profilePeerGate } from './policy/profile-runtime.ts';
|
|
29
30
|
import { resolveAssist } from './assist-profile.ts';
|
|
30
|
-
import { registerFilesystemTool } from './filesystem-tool.ts';
|
|
31
|
+
import { registerFilesystemTool, FILESYSTEM_POLICY_ROOTS_ENV } from './filesystem-tool.ts';
|
|
31
32
|
/** Agent Hub composition root: constructs mutable state, contexts, registrars, and ordered lifecycle ports. */
|
|
32
33
|
|
|
33
34
|
import type { AgentDef, AgentState, ResearchState } from "./types.ts";
|
|
@@ -500,7 +501,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
500
501
|
let proactiveHubDeliveries = 0;
|
|
501
502
|
const proactiveReportInput = () => proactiveRuntime ? { records: proactiveRuntime.records, history: proactiveRuntime.findings.history, current: proactiveRuntime.findings.current, activity: proactiveRuntime.activity.live(), feedback: { hubDelivered: proactiveHubDeliveries, nativeDelivered: null } } : undefined;
|
|
502
503
|
let hubTaskText: string | undefined;
|
|
503
|
-
const hubCapture = createHubCapture({ root: () => currentCtx?.cwd || process.cwd(), task: () => hubTaskText });
|
|
504
|
+
const hubCapture = createHubCapture({ root: () => currentCtx?.cwd || process.cwd(), task: () => hubTaskText, policyRoots:()=>sessionOverrides?.policyRoots });
|
|
504
505
|
let watchdogActivity: WatchdogActivity | null = null;
|
|
505
506
|
const watchdogAgentOverrides = new Map<string, "on" | "off">();
|
|
506
507
|
// ── Per-turn cost report (/af-hub-report) ──
|
|
@@ -791,6 +792,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
791
792
|
const { dispatchViaComs, runDriftJudge, runReturnExtraction } = dispatchComs;
|
|
792
793
|
|
|
793
794
|
const nativeDispatch = createDispatchNative({
|
|
795
|
+
prepareDiscovery:input=>prepareDiscoveryNative(pi,input),
|
|
796
|
+
launchIdentity:()=>noProgress.taskToken(),
|
|
797
|
+
nativeAdmission:persona=>!processBlock()&&!provisionalCapabilityRefusal('fleet')&&!processPreEffectGate(processState,'child',persona)&&!checkTaskBudget('dispatch',{...taskCounters(),dispatches:Math.max(0,taskDispatchCount-1)},currentTaskBudget(),taskActiveElapsedMs(),taskTier)&&!checkTurnBudget('dispatch',{dispatches:Math.max(0,turnDispatchCount-1),research:turnResearchCount},currentBudget(),turnBudgetActiveElapsedMs(),taskTier),
|
|
794
798
|
getAgentState: key => agentStates.get(key),
|
|
795
799
|
getProcessState: () => processState,
|
|
796
800
|
listAgentStates: () => Array.from(agentStates.values()),
|
|
@@ -826,6 +830,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
826
830
|
getProactiveRuntime: () => proactiveRuntime,
|
|
827
831
|
getProactiveConfig: () => proactiveConfig,
|
|
828
832
|
getProactiveCapture: () => proactiveRuntime ? hubCapture : null,
|
|
833
|
+
getPolicyRoots: () => sessionOverrides?.policyRoots,
|
|
829
834
|
getWorkMode: () => getWorkMode(),
|
|
830
835
|
providerSemaphore,
|
|
831
836
|
executionHistory,
|
|
@@ -858,6 +863,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
858
863
|
// same root-owned exemptions and coms escalation endpoint.
|
|
859
864
|
function guardrailEnv(agentId: string): Record<string, string> {
|
|
860
865
|
const env: Record<string, string> = { [AGENT_ID_ENV]: agentId };
|
|
866
|
+
if (sessionOverrides?.policyRoots) env[FILESYSTEM_POLICY_ROOTS_ENV]=JSON.stringify(sessionOverrides.policyRoots);
|
|
861
867
|
if (exemptionsFile) env[EXEMPTIONS_FILE_ENV] = exemptionsFile;
|
|
862
868
|
if (comsReady && identity) env[ASK_ENDPOINT_ENV] = identity.endpoint;
|
|
863
869
|
return env;
|
|
@@ -867,6 +873,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
867
873
|
// The composition root owns the mutable bindings; the runtime reaches them only
|
|
868
874
|
// through these explicit ports so later controls can keep stable handles.
|
|
869
875
|
const researchRuntime = createResearchRuntime<AgentDef>({
|
|
876
|
+
prepareDiscovery:input=>prepareDiscoveryNative(pi,input),
|
|
877
|
+
launchIdentity:()=>noProgress.taskToken(),
|
|
878
|
+
researchAdmission:()=>!processBlock(),
|
|
870
879
|
getResearchStates: () => researchStates,
|
|
871
880
|
setResearchStates: value => { researchStates = value; },
|
|
872
881
|
getNextResearchId: () => nextResearchId,
|
|
@@ -947,6 +956,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
947
956
|
getBaselineTools: () => baselineTools, getRosterSize: () => agentStates.size,
|
|
948
957
|
getDeterministicToolsEnabled: () => resolveAssist(readActiveProfile()?.profile.assist)['deterministic-tools'],
|
|
949
958
|
getAgenticAskEnabled: () => agenticHubEnabled(pi),
|
|
959
|
+
getFileDiscoveryEnabled: () => discoveryHubEnabled(pi),
|
|
950
960
|
getDispatchTriageEnabled: () => triageRuntime?.available === true,
|
|
951
961
|
activateFallbackRoster: ctx => {
|
|
952
962
|
if (!rosterPolicy.activateFirstValidTeam()) return;
|
|
@@ -1051,6 +1061,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1051
1061
|
return { taskId: noProgress.taskId(), task, scope, language, domain, candidates, constraints: JSON.stringify({ tier: taskTier, process: { risk: processState.risk, scope: processState.scope }, externalBlocked: externalBlockers.length > 0 && !externalBlockerAcknowledged }), complete: !(externalBlockers.length > 0 && !externalBlockerAcknowledged) };
|
|
1052
1062
|
}
|
|
1053
1063
|
registerAgenticHub(pi);
|
|
1064
|
+
registerDiscoveryHub(pi);
|
|
1054
1065
|
registerDispatchTriage(pi, { runtime: () => triageRuntime, input: triageInput, blocked: () => provisionalCapabilityRefusal("fleet") });
|
|
1055
1066
|
|
|
1056
1067
|
// Keep the extracted tool surface flat and greppable in this composition root.
|
|
@@ -1088,7 +1099,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
1088
1099
|
enabled: () => resolveAssist(readActiveProfile()?.profile.assist)['deterministic-tools'],
|
|
1089
1100
|
readOnly: () => getWorkMode() === "orchestrator",
|
|
1090
1101
|
sessionDir: () => sessionDir,
|
|
1091
|
-
|
|
1102
|
+
policyRoots: () => sessionOverrides?.policyRoots,
|
|
1103
|
+
managedReadbackAllowed: handle => discoveryManagedReadbackAllowed(pi,handle),
|
|
1104
|
+
remainingSelfReadBytes: () => Math.max(0, 64 * 1024 - orchestratorSelfReadUsed),
|
|
1092
1105
|
noteSelfReadBytes: bytes => { orchestratorSelfReadUsed += bytes; },
|
|
1093
1106
|
});
|
|
1094
1107
|
|
|
@@ -2313,7 +2326,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2313
2326
|
terminateResearch: () => { for (const st of researchStates.values()) if (st.proc && st.status === "running") { st.killedByOperator = true; st.proc.kill("SIGTERM"); } },
|
|
2314
2327
|
resetResearch: researchRuntime.reset, resetHistory: executionHistory.reset,
|
|
2315
2328
|
resetBudgets: () => { hubCapture.reset(); hubTaskText = undefined; proactiveRuntime = null; proactiveConfig = null; system1Snapshot = normalizeSystem1Config(null);
|
|
2316
|
-
resetAgenticHub(pi); proactiveHubDeliveries = 0; taskClock = createTaskClock(); turnBudgetAskUserWaitMs = 0; turnContinuationCount = 0; taskContinuationCount = 0; budgetRecovery.reset(); noProgress.prepareSessionRestore(); resetUnknownToolCounterForCurrentTask(); toolCatalogRuntime.restore(catalogSnapshot(getWorkMode(), [])); latestToolCatalogDelta = null; },
|
|
2329
|
+
resetAgenticHub(pi); resetDiscoveryHub(pi); proactiveHubDeliveries = 0; taskClock = createTaskClock(); turnBudgetAskUserWaitMs = 0; turnContinuationCount = 0; taskContinuationCount = 0; budgetRecovery.reset(); noProgress.prepareSessionRestore(); resetUnknownToolCounterForCurrentTask(); toolCatalogRuntime.restore(catalogSnapshot(getWorkMode(), [])); latestToolCatalogDelta = null; },
|
|
2317
2330
|
clearWidgets: _ctx => { fleetUiGeneration++; fleetActions?.reset(); gridUI.dispose(); },
|
|
2318
2331
|
closeDelegationWatchers: () => { for (const st of agentStates.values()) { st.delegationsWatcher?.close(); st.delegationsWatcher = undefined; } },
|
|
2319
2332
|
resetSessionState: ctx => { delegatedTokens = 0; hubSpawnedPeers.clear(); widgetCtx = ctx; contextWindow = ctx.model?.contextWindow || 0; gridUI.reset(); },
|
|
@@ -2359,6 +2372,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
2359
2372
|
loadAgents: (_ctx) => {
|
|
2360
2373
|
// Allocate a fresh namespace; shared legacy files belong to prior/live sessions.
|
|
2361
2374
|
sessionOverrides = parseAgentTeamOverrides(_ctx.cwd);
|
|
2375
|
+
try {
|
|
2376
|
+
const config = loadProactiveConfig(_ctx.cwd,system1Snapshot,sessionOverrides.policyRoots);
|
|
2377
|
+
proactiveConfig = isCaptureEnabled(config) ? config : null;
|
|
2378
|
+
} catch { proactiveConfig = null; /* invalid consent fails closed */ }
|
|
2362
2379
|
runHistoryKeep = sessionOverrides.runHistoryKeep;
|
|
2363
2380
|
|
|
2364
2381
|
loadAgents(_ctx.cwd);
|
|
@@ -2402,6 +2419,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2402
2419
|
const taskTriageConfig = loadTaskTriageConfig(_ctx.cwd || process.cwd(), system1Snapshot);
|
|
2403
2420
|
const sharedService = watchdogSystem1?.sharedService;
|
|
2404
2421
|
configureAgenticHub(pi, { snapshot: system1Snapshot, service: sharedService, ctx: _ctx, sessionDir, communicationStore, taskId: () => noProgress.taskId() });
|
|
2422
|
+
configureDiscoveryHub(pi, { snapshot: system1Snapshot, service: sharedService, ctx: _ctx, sessionDir, communicationStore, taskId: () => noProgress.taskId() });
|
|
2405
2423
|
const serviceUnavailableReason = watchdogSystem1?.readiness.status === "ready" ? "unavailable" : watchdogSystem1?.readiness.reason ?? "unavailable";
|
|
2406
2424
|
taskTriageConfigured = taskTriageConfig.status !== "missing";
|
|
2407
2425
|
taskTriageConfigStatus = taskTriageConfig.status === "active" ? "active" : taskTriageConfig.status === "invalid" ? "invalid" : "off";
|
|
@@ -2433,7 +2451,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2433
2451
|
});
|
|
2434
2452
|
if (proactiveConfig && sessionDir) {
|
|
2435
2453
|
try { proactiveRuntime = composeHubProactive({ config: proactiveConfig, root: _ctx.cwd, sessionDir,
|
|
2436
|
-
rulesRoots:
|
|
2454
|
+
rulesRoots: sessionOverrides.rulesDirs, policyRoots: sessionOverrides.policyRoots, service: watchdogSystem1?.sharedService, capture: hubCapture, onChange: updateWidget }); }
|
|
2437
2455
|
catch { proactiveRuntime = null; proactiveConfig = null; } // unavailable composition never reports reviewed
|
|
2438
2456
|
}
|
|
2439
2457
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolvePolicyReferences } from "../../lib/policy-roots.ts";
|
|
1
2
|
import { validateProfile, type ModelProfiles } from '../config/model-profiles.ts';
|
|
2
3
|
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
3
4
|
import { existsSync } from "node:fs";
|
|
@@ -70,9 +71,9 @@ export function applySessionOverrides<TDef extends AgentDef>(ctx: ExtensionConte
|
|
|
70
71
|
ports.resetTaskWindow();
|
|
71
72
|
ports.updateModeStatus();
|
|
72
73
|
if (overrides.warnings.length) ctx.ui.notify(`agent-fleet-overrides warnings:\n${overrides.warnings.join("\n")}`, "warning");
|
|
73
|
-
ports.setProjectRules(overrides.rulesDirs);
|
|
74
|
+
ports.setProjectRules(overrides.policyRoots ? resolvePolicyReferences(overrides.policyRoots,overrides.rulesDirs,"rules") : overrides.rulesDirs);
|
|
74
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");
|
|
75
|
-
ports.setProjectDocs(overrides.docsPaths);
|
|
76
|
+
ports.setProjectDocs(overrides.policyRoots ? resolvePolicyReferences(overrides.policyRoots,overrides.docsPaths,"docs") : overrides.docsPaths);
|
|
76
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");
|
|
77
78
|
|
|
78
79
|
ports.resetModelPolicy();
|