@chankov/agent-fleet 2.0.18 → 2.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/proactive-external-git.ts +28 -5
- package/.pi/harnesses/agent-hub/proactive-external.ts +83 -18
- package/.pi/harnesses/agent-hub/proactive-rules.ts +3 -3
- package/.pi/harnesses/agent-hub/proactive-snapshot.ts +23 -10
- package/.pi/harnesses/agent-hub/prompts/fragments.ts +6 -6
- package/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +1 -1
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/policy-roots.js +106 -0
- package/.pi/harnesses/lib/policy-roots.ts +7 -118
- package/.versions/2.0.19/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.19/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-claude-bridge.ts +437 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet.ts +217 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/flow.ts +157 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +36 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.19/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.19/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.19/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.19/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.19/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.19/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.19/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.19/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.19/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.19/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.19/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.19/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.19/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.19/.pi/extensions/package.json +9 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/README.md +1483 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/acceptance.ts +199 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-hub.ts +54 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/context.ts +47 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/config/agents.ts +178 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/config/overrides.ts +165 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/budgets.ts +206 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/deterministic-fs.ts +169 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +270 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +233 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-types.ts +267 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native.ts +234 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/adapters.ts +82 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/broker.ts +125 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +33 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/descendant.ts +63 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +48 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/hub.ts +152 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +99 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/results.ts +54 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/runtime.ts +120 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/filesystem-tool.ts +185 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/fixtures/registration-surface.json +66 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/index.ts +2625 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +133 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +144 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/no-progress.ts +593 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-activation.ts +112 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-route.ts +76 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/work-mode.ts +137 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-config.ts +21 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-snapshot.ts +271 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-types.ts +67 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/process-obligations.ts +158 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/context.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/fragments.ts +95 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/recovery-contract.ts +150 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research/runtime.ts +201 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research/spawn-run.ts +194 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/return-contract.js +349 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/review-findings.js +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/run-budget.js +554 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/scope-gate.js +144 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/session-audit.ts +313 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/spawn.ts +563 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-communication-store.ts +190 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-runtime.ts +258 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-authorization.ts +122 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-config.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-obligations.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-runtime.ts +125 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/action-executors.ts +213 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/context.ts +144 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +560 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/herdr-executors.ts +95 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/work-mode.ts +187 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
- package/.versions/2.0.19/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.19/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.19/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.19/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/index.ts +533 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.19/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.19/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.19/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget-child-prompt.ts +220 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.19/.pi/harnesses/lib/damage-control-shared.ts +226 -0
- package/.versions/2.0.19/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.19/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.19/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.19/.pi/harnesses/lib/policy-roots.js +106 -0
- package/.versions/2.0.19/.pi/harnesses/lib/policy-roots.ts +31 -0
- package/.versions/2.0.19/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.0.19/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-file-discovery.js +21 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-loader.js +44 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-v2.js +106 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.19/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.19/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.19/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.19/.pi/prompts/af-build.md +27 -0
- package/.versions/2.0.19/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.19/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.19/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.19/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.19/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.19/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.19/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.19/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.19/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.19/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.19/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.19/.version +1 -0
- package/.versions/2.0.19/agents/architect.md +24 -0
- package/.versions/2.0.19/agents/bowser.md +28 -0
- package/.versions/2.0.19/agents/builder.md +55 -0
- package/.versions/2.0.19/agents/code-reviewer.md +209 -0
- package/.versions/2.0.19/agents/deep-researcher.md +32 -0
- package/.versions/2.0.19/agents/documenter.md +22 -0
- package/.versions/2.0.19/agents/orchestrator.md +22 -0
- package/.versions/2.0.19/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.19/agents/planner.md +105 -0
- package/.versions/2.0.19/agents/releaser.md +24 -0
- package/.versions/2.0.19/agents/researcher.md +30 -0
- package/.versions/2.0.19/agents/security-auditor.md +167 -0
- package/.versions/2.0.19/agents/test-engineer.md +153 -0
- package/.versions/2.0.19/agents/web-debugger.md +44 -0
- package/.versions/2.0.19/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.19/bin/catalog/harness-runtime-closure.json +73 -0
- package/.versions/2.0.19/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.19/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.19/docs/ARCHITECTURE.md +874 -0
- package/.versions/2.0.19/docs/agent-fleet-setup.md +1101 -0
- package/.versions/2.0.19/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.0.19/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.19/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.19/docs/getting-started.md +126 -0
- package/.versions/2.0.19/docs/npm-install.md +535 -0
- package/.versions/2.0.19/docs/pi-extensions.md +454 -0
- package/.versions/2.0.19/docs/pi-setup.md +92 -0
- package/.versions/2.0.19/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.19/install-manifest.json +3197 -0
- package/.versions/2.0.19/justfile +247 -0
- package/.versions/2.0.19/manifest-meta.json +1075 -0
- package/.versions/2.0.19/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.19/references/communication-contract.md +26 -0
- package/.versions/2.0.19/references/definition-of-done.md +67 -0
- package/.versions/2.0.19/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.19/references/observability-checklist.md +92 -0
- package/.versions/2.0.19/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.19/references/performance-checklist.md +236 -0
- package/.versions/2.0.19/references/prompting-patterns.md +380 -0
- package/.versions/2.0.19/references/security-checklist.md +245 -0
- package/.versions/2.0.19/references/testing-patterns.md +235 -0
- package/.versions/2.0.19/references/workflow-authoring.md +304 -0
- package/.versions/2.0.19/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.19/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.19/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.19/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.19/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.19/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.19/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.19/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.19/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.19/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.19/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.19/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.19/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.19/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.19/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.19/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.19/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.19/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.19/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.19/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.0.19/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.19/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.19/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.19/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.19/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.0.19/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.19/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.0.19/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.19/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.19/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +6 -0
- package/bin/cli.js +1 -1
- package/bin/lib/doctor.js +8 -2
- package/bin/lib/system1-migration.js +17 -8
- package/bin/lib/system1-policy-context.js +57 -0
- package/bin/lib/transaction.js +1 -1
- package/docs/agent-fleet-setup.md +1 -1
- package/docs/external-project-ai-content.md +17 -1
- package/install-manifest.json +5 -1
- package/manifest-meta.json +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Immutable per-run artifact namespaces — the pure policy core behind "a run's
|
|
2
|
+
// artifacts are never overwritten by the next run".
|
|
3
|
+
//
|
|
4
|
+
// The observed failure: `.pi/agent-sessions/artifacts/` was deleted at session
|
|
5
|
+
// start, and specialist returns were named by a per-session counter
|
|
6
|
+
// (`returns/builder-run1.md`). Two consequences, both hit at once: a later
|
|
7
|
+
// session's `builder-run1.md` occupied the same path as an earlier one, and the
|
|
8
|
+
// start-of-session wipe removed eleven implementation returns and two review
|
|
9
|
+
// artifacts that a post-mortem then had to record as NOT RECOVERABLE.
|
|
10
|
+
//
|
|
11
|
+
// The fix is not retention-by-luck: each session archives the previous session's
|
|
12
|
+
// artifacts into `runs/<runId>/`, a namespace that is written once and never
|
|
13
|
+
// reused, and records it in `runs/index.json`. Pruning is explicit and bounded,
|
|
14
|
+
// so the directory cannot grow without limit either.
|
|
15
|
+
|
|
16
|
+
export const DEFAULT_RUN_HISTORY_KEEP = 10;
|
|
17
|
+
export const RUNS_DIRNAME = "runs";
|
|
18
|
+
export const RUN_INDEX_FILENAME = "index.json";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Run id: sortable UTC timestamp + a short random suffix, so two sessions
|
|
22
|
+
* starting in the same second still get distinct namespaces.
|
|
23
|
+
* `2026-08-03T09-10-42-a3f9`
|
|
24
|
+
*/
|
|
25
|
+
export function makeRunId(date = new Date(), suffix = null) {
|
|
26
|
+
const iso = new Date(date).toISOString().replace(/\.\d+Z$/, "").replace(/:/g, "-");
|
|
27
|
+
const tail = suffix ?? Math.random().toString(36).slice(2, 6);
|
|
28
|
+
return `${iso}-${tail}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A run id we generated (used to filter stray directories out of `runs/`). */
|
|
32
|
+
export function isRunId(name) {
|
|
33
|
+
return /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-[a-z0-9]{2,8}$/.test(String(name || ""));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Which run directories to delete so at most `keep` survive.
|
|
38
|
+
* Run ids sort lexicographically by time, so newest = last. `keep: null`
|
|
39
|
+
* ("off") prunes nothing; non-run-id entries are never touched.
|
|
40
|
+
* @param {string[]} names
|
|
41
|
+
* @param {number|null} [keep]
|
|
42
|
+
*/
|
|
43
|
+
export function pruneRunDirs(names, keep = DEFAULT_RUN_HISTORY_KEEP) {
|
|
44
|
+
if (keep == null) return [];
|
|
45
|
+
const runs = (names || []).filter(isRunId).sort();
|
|
46
|
+
const limit = Math.max(0, keep);
|
|
47
|
+
if (runs.length <= limit) return [];
|
|
48
|
+
return runs.slice(0, runs.length - limit);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The metadata written once into `runs/<runId>/meta.json`. Carries the
|
|
53
|
+
* identifiers a post-mortem needs and could not previously recover: which
|
|
54
|
+
* workspace/project/repo the run belonged to, and when it started and ended.
|
|
55
|
+
* @param {{runId: string, startedAt?: string|number|null, archivedAt?: string|number, cwd?: string|null, project?: string|null, workspace?: string|null, artifactCounts?: Record<string,number>|null}} input
|
|
56
|
+
*/
|
|
57
|
+
export function buildRunMeta({ runId, startedAt = null, archivedAt = Date.now(), cwd = null, project = null, workspace = null, artifactCounts = null }) {
|
|
58
|
+
return {
|
|
59
|
+
runId,
|
|
60
|
+
startedAt: startedAt == null ? null : new Date(startedAt).toISOString(),
|
|
61
|
+
archivedAt: new Date(archivedAt).toISOString(),
|
|
62
|
+
cwd,
|
|
63
|
+
project,
|
|
64
|
+
workspace,
|
|
65
|
+
artifactCounts,
|
|
66
|
+
note: "Immutable archive of one agent-hub session's artifacts. Written once; never rewritten.",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Fold a run entry into `runs/index.json`, newest last, capped at `keep`.
|
|
72
|
+
* Re-indexing the same runId replaces its entry rather than duplicating it.
|
|
73
|
+
* @param {any} existing JSON read from disk; its shape is checked before use.
|
|
74
|
+
* @param {{runId: string, [key: string]: unknown}} entry
|
|
75
|
+
* @param {number|null} [keep]
|
|
76
|
+
*/
|
|
77
|
+
export function appendRunIndex(existing, entry, keep = DEFAULT_RUN_HISTORY_KEEP) {
|
|
78
|
+
const runs = Array.isArray(existing?.runs) ? existing.runs.filter((r) => r && r.runId !== entry.runId) : [];
|
|
79
|
+
runs.push(entry);
|
|
80
|
+
runs.sort((a, b) => String(a.runId).localeCompare(String(b.runId)));
|
|
81
|
+
const trimmed = keep == null ? runs : runs.slice(Math.max(0, runs.length - Math.max(0, keep)));
|
|
82
|
+
return { version: 1, updatedAt: new Date().toISOString(), runs: trimmed };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Parse the `run-history-keep:` overrides value → number, null ("off"), or undefined. */
|
|
86
|
+
export function normalizeRunHistoryKeep(value) {
|
|
87
|
+
const raw = String(value ?? "").trim().toLowerCase();
|
|
88
|
+
if (!raw) return undefined;
|
|
89
|
+
if (raw === "off" || raw === "none" || raw === "0") return null;
|
|
90
|
+
const n = Number(raw);
|
|
91
|
+
if (!Number.isFinite(n) || n < 1) return undefined;
|
|
92
|
+
return Math.floor(n);
|
|
93
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { worktreeRevision } from "./scope-gate.js";
|
|
2
|
+
|
|
3
|
+
export interface RuntimeTestRecord {
|
|
4
|
+
producer: "agent-fleet.runtime-test/v1";
|
|
5
|
+
command: string;
|
|
6
|
+
exitCode: number | null;
|
|
7
|
+
beforeRevision: string;
|
|
8
|
+
afterRevision: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Observe the existing bash operation, never execute a second command or parse output. */
|
|
12
|
+
export function instrumentBash(createTool: any, operations: any, cwd: string, revision = () => worktreeRevision(cwd, []), options: any = {}) {
|
|
13
|
+
return async (id: string, params: any, signal: any, update: any, ctx?: any) => {
|
|
14
|
+
let record: RuntimeTestRecord | undefined;
|
|
15
|
+
const tool = createTool(cwd, { ...options, operations: { ...operations, exec: async (...args: any[]) => {
|
|
16
|
+
const beforeRevision = revision();
|
|
17
|
+
const result = await operations.exec(...args);
|
|
18
|
+
if (typeof args[0] === "string" && args[0] === (options.commandPrefix ? `${options.commandPrefix}\n${params.command}` : params.command)) record = { producer: "agent-fleet.runtime-test/v1", command: params.command, exitCode: result.exitCode, beforeRevision, afterRevision: revision() };
|
|
19
|
+
return result;
|
|
20
|
+
} } });
|
|
21
|
+
try {
|
|
22
|
+
const result = await tool.execute(id, params, signal, update, ctx);
|
|
23
|
+
return { ...result, details: { ...result.details, runtimeTest: record } };
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (!record) throw error;
|
|
26
|
+
return { content: [{ type: "text", text: String(error) }], isError: true, details: { runtimeTest: record } };
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Use Pi's tool_result hook: agent-core ignores isError on resolved execute values. */
|
|
32
|
+
export function registerObservedBash(pi: any, api: any, cwd: string, options: any) {
|
|
33
|
+
const tool = api.createBashToolDefinition(cwd, options);
|
|
34
|
+
pi.registerTool({ ...tool, execute: instrumentBash(api.createBashToolDefinition, api.createLocalBashOperations({ shellPath: options.shellPath }), cwd, undefined, options) });
|
|
35
|
+
pi.on("tool_result", (event: any) => {
|
|
36
|
+
if (event.toolName === "bash" && event.details?.runtimeTest?.producer === "agent-fleet.runtime-test/v1" && event.details.runtimeTest.exitCode !== 0)
|
|
37
|
+
return { isError: true };
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Same tool name/schema retains damage-control approval and built-in rendering. */
|
|
42
|
+
export default async function runtimeTestCheck(pi: any) {
|
|
43
|
+
const api = await import("@mariozechner/pi-coding-agent");
|
|
44
|
+
const cwd = process.cwd();
|
|
45
|
+
const settings = api.SettingsManager.create(cwd);
|
|
46
|
+
registerObservedBash(pi, api, cwd, { shellPath: settings.getShellPath(), commandPrefix: settings.getShellCommandPrefix() });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Accept observer events only on the explicitly enabled native transport and a matching tool start. */
|
|
50
|
+
export function runtimeTestFromResult(enabled: boolean | undefined, startedCommand: string | undefined, toolName: string, result: any): RuntimeTestRecord | null {
|
|
51
|
+
const record = result?.details?.runtimeTest;
|
|
52
|
+
if (!enabled || toolName !== "bash" || record?.producer !== "agent-fleet.runtime-test/v1" || typeof record.command !== "string" || !record.command || startedCommand !== record.command || !Number.isInteger(record.exitCode) || !record.beforeRevision || !record.afterRevision || typeof record.beforeRevision !== "string" || typeof record.afterRevision !== "string") return null;
|
|
53
|
+
return { producer: "agent-fleet.runtime-test/v1", command: record.command, exitCode: record.exitCode, beforeRevision: record.beforeRevision, afterRevision: record.afterRevision };
|
|
54
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
|
|
4
|
+
const CONTINUE_ENTRY = /damage-control-continue[/\\]index\.ts$/;
|
|
5
|
+
const MISSING_SAFETY_ERROR = "damage-control-continue harness not found — guarded child dispatch refused";
|
|
6
|
+
|
|
7
|
+
/** Resolve only the surviving continue harness; never downgrade to an unguarded or hard-stop child. */
|
|
8
|
+
export function resolveSafetyHarness(cwd: string, argv: string[] = process.argv): string | null {
|
|
9
|
+
for (let i = 0; i < argv.length - 1; i++) {
|
|
10
|
+
if (argv[i] !== "-e" && argv[i] !== "--extension") continue;
|
|
11
|
+
const candidate = resolve(argv[i + 1]);
|
|
12
|
+
if (CONTINUE_ENTRY.test(candidate) && existsSync(candidate)) return candidate;
|
|
13
|
+
}
|
|
14
|
+
const local = join(cwd, ".pi", "harnesses", "damage-control-continue", "index.ts");
|
|
15
|
+
return existsSync(local) ? local : null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function requireSafetyHarness(path: string | null):
|
|
19
|
+
| { ok: true; extensions: string[] }
|
|
20
|
+
| { ok: false; error: string } {
|
|
21
|
+
return path ? { ok: true, extensions: [path] } : { ok: false, error: MISSING_SAFETY_ERROR };
|
|
22
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { lstatSync, readFileSync, readlinkSync } from "node:fs";
|
|
4
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
5
|
+
|
|
6
|
+
export function snapshotWorktree(cwd) {
|
|
7
|
+
const status = gitStatus(cwd);
|
|
8
|
+
if (status.skipped) return { skipped: true, reason: status.reason, paths: new Set() };
|
|
9
|
+
try {
|
|
10
|
+
const fingerprints = new Map(status.paths.map(path => [path, fileFingerprint(cwd, path)]));
|
|
11
|
+
let head = "";
|
|
12
|
+
try { head = execFileSync("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim(); } catch {}
|
|
13
|
+
return { skipped: false, paths: new Set(status.paths), fingerprints, head };
|
|
14
|
+
} catch (error) { return { skipped: true, reason: String(error), paths: new Set() }; }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function fileFingerprint(cwd, path) {
|
|
18
|
+
try {
|
|
19
|
+
const file = join(cwd, path), stat = lstatSync(file);
|
|
20
|
+
if (!stat.isFile() && !stat.isSymbolicLink()) throw new Error(`Cannot prove file-content delta for ${path}`);
|
|
21
|
+
return createHash("sha256").update(String(stat.mode)).update("\0").update(stat.isSymbolicLink() ? readlinkSync(file) : readFileSync(file)).digest("hex");
|
|
22
|
+
} catch (error) { if (error.code === "ENOENT") return "missing"; throw error; }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function diffAgainst(snapshot, cwd) {
|
|
26
|
+
const current = snapshotWorktree(cwd);
|
|
27
|
+
if (snapshot?.skipped || current.skipped || snapshot?.head !== current.head) {
|
|
28
|
+
return { skipped: true, reason: snapshot?.reason || current.reason || "HEAD changed during observation; content attribution is incomplete", paths: [] };
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const paths = [...new Set([...snapshot.paths, ...current.paths])].filter(path => {
|
|
32
|
+
const before = snapshot.fingerprints.get(path);
|
|
33
|
+
return before === undefined || before !== (current.fingerprints.get(path) ?? fileFingerprint(cwd, path));
|
|
34
|
+
}).sort();
|
|
35
|
+
return { skipped: false, paths };
|
|
36
|
+
} catch (error) { return { skipped: true, reason: String(error), paths: [] }; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const isSessionOutput = path => path.startsWith(".pi/agent-sessions/");
|
|
40
|
+
|
|
41
|
+
/** Review task edits, not outputs created inside this run's own session directory.
|
|
42
|
+
* A declared scope/deliverable under that directory is still a task edit to review.
|
|
43
|
+
* Other sessions' files and all non-session paths remain reviewable.
|
|
44
|
+
*/
|
|
45
|
+
export function reviewableChangedPaths(paths, cwd, sessionDir, scopes = [], deliverables = []) {
|
|
46
|
+
const sessionPath = relative(resolve(cwd), resolve(sessionDir)).replace(/\\/g, "/");
|
|
47
|
+
const ownedSession = /^\.pi\/agent-sessions\/sessions\/[^/]+$/.test(sessionPath) && !isAbsolute(sessionPath);
|
|
48
|
+
// A generic glob (for example **/*.md) does not explicitly select runtime evidence.
|
|
49
|
+
const explicitSessionScopes = scopes.filter(scope => {
|
|
50
|
+
const normalized = normalizePath(scope);
|
|
51
|
+
return normalized === sessionPath || normalized.startsWith(`${sessionPath}/`);
|
|
52
|
+
});
|
|
53
|
+
return paths.filter(path => {
|
|
54
|
+
const output = path.startsWith(`${sessionPath}/`) ? path.slice(sessionPath.length + 1) : "";
|
|
55
|
+
if (!ownedSession || !/^(?:artifacts|dispatches|transcripts|findings|delegations)\/|^(?:session|assertions)\.json$/.test(output)) return true;
|
|
56
|
+
return checkScope([path], explicitSessionScopes).inScope.length > 0 || deliverables.some(file => relative(resolve(cwd), resolve(file)) === path);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Runtime outputs are not input progress. Callers add explicitly supplied evidence separately. */
|
|
61
|
+
export function worktreeRevision(cwd, scopes = []) {
|
|
62
|
+
const snapshot = snapshotWorktree(cwd);
|
|
63
|
+
if (snapshot.skipped) return "unavailable";
|
|
64
|
+
const entries = [...snapshot.fingerprints].filter(([path]) => !isSessionOutput(path) && (!scopes.length || checkScope([path], scopes).inScope.length)).sort(([a], [b]) => a.localeCompare(b));
|
|
65
|
+
return createHash("sha256").update(JSON.stringify([snapshot.head, entries])).digest("hex");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function checkScope(changedPaths, scopeGlobs) {
|
|
69
|
+
const scopes = (scopeGlobs || []).map(normalizePath).filter(Boolean);
|
|
70
|
+
const inScope = [];
|
|
71
|
+
const outOfScope = [];
|
|
72
|
+
for (const rawPath of changedPaths || []) {
|
|
73
|
+
const changed = normalizePath(rawPath);
|
|
74
|
+
if (!changed) continue;
|
|
75
|
+
if (scopes.some((scope) => matchesScope(changed, scope))) inScope.push(changed);
|
|
76
|
+
else outOfScope.push(changed);
|
|
77
|
+
}
|
|
78
|
+
return { inScope: uniqueSorted(inScope), outOfScope: uniqueSorted(outOfScope) };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function gitStatus(cwd) {
|
|
82
|
+
try {
|
|
83
|
+
const output = execFileSync("git", ["-C", cwd, "status", "--porcelain", "-z", "--untracked-files=all"], {
|
|
84
|
+
encoding: "utf-8",
|
|
85
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
86
|
+
});
|
|
87
|
+
return { skipped: false, paths: parsePorcelain(output) };
|
|
88
|
+
} catch (err) {
|
|
89
|
+
return { skipped: true, reason: err?.message || "not a git worktree" };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function parsePorcelain(output) {
|
|
94
|
+
const entries = String(output || "").split("\0"), paths = [];
|
|
95
|
+
for (let i = 0; i < entries.length; i++) {
|
|
96
|
+
const entry = entries[i]; if (!entry) continue;
|
|
97
|
+
paths.push(entry.slice(3));
|
|
98
|
+
if (/[RC]/.test(entry.slice(0, 2)) && entries[i + 1]) paths.push(entries[++i]);
|
|
99
|
+
}
|
|
100
|
+
return uniqueSorted(paths);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function matchesScope(changedPath, scope) {
|
|
104
|
+
if (hasGlob(scope)) return globToRegExp(scope).test(changedPath);
|
|
105
|
+
const dir = scope.endsWith("/") ? scope.slice(0, -1) : scope;
|
|
106
|
+
return changedPath === dir || changedPath.startsWith(`${dir}/`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function hasGlob(scope) {
|
|
110
|
+
return /[*?]/.test(scope);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function globToRegExp(glob) {
|
|
114
|
+
let out = "^";
|
|
115
|
+
for (let i = 0; i < glob.length; i++) {
|
|
116
|
+
const c = glob[i];
|
|
117
|
+
if (c === "*") {
|
|
118
|
+
if (glob[i + 1] === "*") {
|
|
119
|
+
if (glob[i + 2] === "/") { out += "(?:.*/)?"; i += 2; }
|
|
120
|
+
else { out += ".*"; i++; }
|
|
121
|
+
} else {
|
|
122
|
+
out += "[^/]*";
|
|
123
|
+
}
|
|
124
|
+
} else if (c === "?") {
|
|
125
|
+
out += "[^/]";
|
|
126
|
+
} else {
|
|
127
|
+
out += escapeRegExp(c);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
out += "$";
|
|
131
|
+
return new RegExp(out);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function normalizePath(value) {
|
|
135
|
+
return String(value || "").trim().replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+/g, "/");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function uniqueSorted(values) {
|
|
139
|
+
return [...new Set(values)].sort();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function escapeRegExp(value) {
|
|
143
|
+
return value.replace(/[|\\{}()[\]^$+?.]/g, "\\$&");
|
|
144
|
+
}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { basename, join } from "node:path";
|
|
3
|
+
import type { ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
4
|
+
import { redactSecrets } from "../lib/fleet-transcript-store.ts";
|
|
5
|
+
import { RECOVERY_CATEGORIES, type RecoveryCategory } from "./recovery-contract.ts";
|
|
6
|
+
import { readWatchdogEvents, buildProactiveReport, readProactiveReport, readTaskTriageReport, buildTaskTriageReport, type ProactiveReportInput } from "./system1-report.ts";
|
|
7
|
+
import { projectTaskTriage, type TaskTriageProjectionInput, type TaskTriageSessionView } from "../lib/fleet-read-model.ts";
|
|
8
|
+
import { projectWatchdogReadback, type TaskTriageActivity } from "./system1-activity.ts";
|
|
9
|
+
export type TaskTriageAuditInput = Omit<TaskTriageProjectionInput, "process"> & { activity?: ReturnType<TaskTriageActivity["live"]> };
|
|
10
|
+
import { createNoProgressGuard, projectRecoveryRows } from './no-progress.ts';
|
|
11
|
+
import { createHash } from "node:crypto";
|
|
12
|
+
import { taskTriageActionAuditRecord, type TaskTriageActionAuditRecord } from "./task-triage-authorization.ts";
|
|
13
|
+
|
|
14
|
+
const RESULT_SCHEMA = "agent-fleet.runtime-result/v1";
|
|
15
|
+
const PROTOCOL_SCHEMA = "agent-fleet.tool-protocol-diagnostic/v1";
|
|
16
|
+
const AUDIT_STATUSES = new Set(["accepted", "not_accepted", "authorized", "authorized_once", "budget_authorized", "retry_authorized_once", "passed", "failed", "missing", "stale", "unsupported", "busy", "invalid_input", "resource_exhausted", "operator_cancelled", "verification_failed", "tool_protocol_error", "unknown_tool", "indeterminate", "completed_unverified", "unavailable", "cleared", "open", "abandoned", "settled"]);
|
|
17
|
+
type Availability = "available" | "unavailable";
|
|
18
|
+
type AuditKind = "refusal" | "verification" | "tool_protocol" | "budget_permission" | "retry_permission" | "human_intervention" | "process_obligation" | "watchdog" | "recovery";
|
|
19
|
+
|
|
20
|
+
export interface SessionAuditEvent {
|
|
21
|
+
kind: AuditKind;
|
|
22
|
+
rootSessionId: string | null;
|
|
23
|
+
childDispatchId: string | null;
|
|
24
|
+
childSessionId: string | null;
|
|
25
|
+
snapshotId: string | null;
|
|
26
|
+
repeatCount: number;
|
|
27
|
+
category?: RecoveryCategory;
|
|
28
|
+
operationId?: string | null;
|
|
29
|
+
attemptId?: string | null;
|
|
30
|
+
technicalBlock?: 'open' | 'cleared';
|
|
31
|
+
openRequirements?: string[];
|
|
32
|
+
status: string;
|
|
33
|
+
taskId?: string | null;
|
|
34
|
+
requestId?: string | null;
|
|
35
|
+
operation?: string | null;
|
|
36
|
+
evidence: Availability;
|
|
37
|
+
risk?: "unknown" | "low" | "high";
|
|
38
|
+
scope?: "unknown" | "read-only" | "small" | "wide";
|
|
39
|
+
budgetTier?: string | null;
|
|
40
|
+
obligations?: Record<string, "satisfied" | "open" | "unsupported" | "waived">;
|
|
41
|
+
processAdditions?: TaskTriageSessionView["process"]["additions"];
|
|
42
|
+
appliedRuleIds?: string[];
|
|
43
|
+
currentStage?: string;
|
|
44
|
+
admissibleNextAction?: string;
|
|
45
|
+
auditScope?: string[];
|
|
46
|
+
explanation?: string;
|
|
47
|
+
watchdog?: { evaluation: string; llm: string; llmStatus: string; providerStatus: string; reason: string; source: string; applied: string; outcome: string };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface SessionAuditSummary {
|
|
51
|
+
schema: "agent-fleet.session-audit/v1";
|
|
52
|
+
readOnly: true;
|
|
53
|
+
identity: {
|
|
54
|
+
rootSessionId: string | null;
|
|
55
|
+
children: Array<{ dispatchId: string; sessionId: string | null }>;
|
|
56
|
+
snapshots: Array<{ snapshotId: string }>;
|
|
57
|
+
};
|
|
58
|
+
events: SessionAuditEvent[];
|
|
59
|
+
proactive: ReturnType<typeof buildProactiveReport> | ReturnType<typeof readProactiveReport>;
|
|
60
|
+
taskTriage: TaskTriageSessionView & { metrics: ReturnType<typeof readTaskTriageReport>; actions: ReturnType<typeof projectTaskTriageActions> };
|
|
61
|
+
unavailable: string[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const text = (value: unknown, max = 256): string | null => typeof value === "string" && value.trim() ? value.trim().slice(0, max) : null;
|
|
65
|
+
const runtimeId = (value: unknown): string | null => { const normalized = text(value); return normalized && redactSecrets(normalized) === normalized && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/.test(normalized) ? normalized : null; };
|
|
66
|
+
const status = (value: unknown): string => { const normalized = text(value, 64); return normalized && AUDIT_STATUSES.has(normalized) ? normalized : "unavailable"; };
|
|
67
|
+
const operation = (value: unknown): string | null => { const normalized = text(value, 16); return normalized && ["dispatch", "research", "retry"].includes(normalized) ? normalized : null; };
|
|
68
|
+
const object = (value: unknown): Record<string, any> | null => value && typeof value === "object" && !Array.isArray(value) ? value as Record<string, any> : null;
|
|
69
|
+
function readJson(path: string): Record<string, any> | null { try { return object(JSON.parse(readFileSync(path, "utf8"))); } catch { return null; } }
|
|
70
|
+
function recovery(value: unknown): RecoveryCategory | undefined { return RECOVERY_CATEGORIES.includes(value as RecoveryCategory) ? value as RecoveryCategory : undefined; }
|
|
71
|
+
function entryData(entry: unknown): { type: string | null; id: string | null; data: Record<string, any> | null; details: Record<string, any> | null } {
|
|
72
|
+
const row = object(entry), message = object(row?.message);
|
|
73
|
+
return {
|
|
74
|
+
type: text(row?.customType) ?? text(row?.type),
|
|
75
|
+
id: runtimeId(row?.id) ?? runtimeId(message?.id) ?? runtimeId(message?.toolCallId),
|
|
76
|
+
data: object(row?.data),
|
|
77
|
+
details: object(message?.details) ?? object(row?.details),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function runtimeResult(details: Record<string, any> | null): Record<string, any> | null {
|
|
81
|
+
const value = object(details?.runtimeResult) ?? (details?.schema === RESULT_SCHEMA ? details : null);
|
|
82
|
+
return value?.schema === RESULT_SCHEMA ? value : null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Diagnostic joins only: durable consumption is not proof of execution or semantic acceptance. */
|
|
86
|
+
export function projectTaskTriageActions(entries: readonly unknown[], binding?: Pick<TaskTriageProjectionInput, "taskId" | "inputRevision">) {
|
|
87
|
+
type ActionRow = { metadata: TaskTriageActionAuditRecord; requested: boolean; denied: boolean; grant: boolean; consumed: boolean;
|
|
88
|
+
consumptionFailed: boolean; execution: "not_recorded" | "tool_result_ok" | "tool_result_error"; ambiguous: boolean; seen: Set<string> };
|
|
89
|
+
const rows = new Map<string, ActionRow>();
|
|
90
|
+
let invalidRecords = 0, overflow = false;
|
|
91
|
+
const hash = (v: unknown): v is string => typeof v === "string" && /^[a-f0-9]{64}$/.test(v);
|
|
92
|
+
const uuid = (v: unknown): v is string => typeof v === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(v);
|
|
93
|
+
for (const entry of entries) {
|
|
94
|
+
const record = entryData(entry);
|
|
95
|
+
const observation = record.type === "agent-hub-task-triage-action-observation";
|
|
96
|
+
const grant = record.type === "agent-hub-task-triage-action-grant", consumed = record.type === "agent-hub-task-triage-action-consumed";
|
|
97
|
+
if (observation || grant || consumed) {
|
|
98
|
+
const data = record.data;
|
|
99
|
+
let metadata: TaskTriageActionAuditRecord | null = null;
|
|
100
|
+
if (observation && data?.schema === "task-triage-action-audit/v1" && uuid(data.taskId) && hash(data.inputRevision)
|
|
101
|
+
&& hash(data.actionFingerprint) && hash(data.callFingerprint) && ["bash", "edit", "write"].includes(data.operation)
|
|
102
|
+
&& ["requested", "not_granted", "consumption_failed"].includes(data.status)
|
|
103
|
+
&& Object.keys(data).length === 7) metadata = { schema: data.schema, taskId: data.taskId, inputRevision: data.inputRevision,
|
|
104
|
+
actionFingerprint: data.actionFingerprint, callFingerprint: data.callFingerprint, operation: data.operation, status: data.status };
|
|
105
|
+
else if (!observation && data) metadata = taskTriageActionAuditRecord(data as any, "requested");
|
|
106
|
+
if (!metadata) { invalidRecords++; continue; }
|
|
107
|
+
const key = JSON.stringify([metadata.taskId, metadata.inputRevision, metadata.callFingerprint]);
|
|
108
|
+
let row = rows.get(key);
|
|
109
|
+
if (!row) {
|
|
110
|
+
if (rows.size >= 300) { overflow = true; continue; }
|
|
111
|
+
row = { metadata, requested: false, denied: false, grant: false, consumed: false, consumptionFailed: false, execution: "not_recorded", ambiguous: false, seen: new Set() };
|
|
112
|
+
rows.set(key, row);
|
|
113
|
+
}
|
|
114
|
+
const type = grant ? "grant" : consumed ? "consumed" : metadata.status;
|
|
115
|
+
if (row.seen.has(type) || row.metadata.actionFingerprint !== metadata.actionFingerprint || row.metadata.operation !== metadata.operation) row.ambiguous = true;
|
|
116
|
+
row.seen.add(type);
|
|
117
|
+
if (grant) { if (row.denied || row.consumed) row.ambiguous = true; row.grant = true; }
|
|
118
|
+
else if (consumed) { if (!row.grant || row.denied || row.consumptionFailed) row.ambiguous = true; row.consumed = true; }
|
|
119
|
+
else if (metadata.status === "requested") row.requested = true;
|
|
120
|
+
else if (metadata.status === "not_granted") { if (row.grant || row.consumed) row.ambiguous = true; row.denied = true; }
|
|
121
|
+
else { if (row.consumed || !row.grant) row.ambiguous = true; row.consumptionFailed = true; }
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
const message = object(object(entry)?.message);
|
|
125
|
+
if (message?.role !== "toolResult" || typeof message.toolCallId !== "string" || !message.toolCallId || message.toolCallId.length > 512) continue;
|
|
126
|
+
const call = createHash("sha256").update(message.toolCallId).digest("hex");
|
|
127
|
+
const matching = [...rows.values()].filter(row => row.metadata.callFingerprint === call && row.metadata.operation === message.toolName && row.consumed);
|
|
128
|
+
if (matching.length > 1) { matching.forEach(row => { row.ambiguous = true; }); continue; }
|
|
129
|
+
const row = matching[0]; if (!row) continue;
|
|
130
|
+
if (row.execution !== "not_recorded") row.ambiguous = true;
|
|
131
|
+
if (typeof message.isError === "boolean") row.execution = message.isError ? "tool_result_error" : "tool_result_ok";
|
|
132
|
+
}
|
|
133
|
+
const records = [...rows.values()].map(row => ({ taskId: row.metadata.taskId, inputRevision: row.metadata.inputRevision,
|
|
134
|
+
actionFingerprint: row.metadata.actionFingerprint, operation: row.metadata.operation,
|
|
135
|
+
binding: !binding?.taskId || !binding?.inputRevision ? "unbound" : row.metadata.taskId === binding.taskId && row.metadata.inputRevision === binding.inputRevision ? "current" : "stale",
|
|
136
|
+
authorization: row.ambiguous ? "ambiguous" : row.grant ? "recorded_grant" : row.denied ? "not_granted" : "not_recorded",
|
|
137
|
+
consumption: row.ambiguous ? "ambiguous" : row.consumptionFailed ? "persistence_failed" : row.consumed ? "recorded_once" : "not_recorded",
|
|
138
|
+
execution: row.ambiguous ? "not_recorded" : row.denied || row.consumptionFailed ? "blocked" : row.execution }));
|
|
139
|
+
return { availability: records.length ? "recorded" : "unavailable", records, invalidRecords, overflow,
|
|
140
|
+
ambiguous: records.filter(row => row.authorization === "ambiguous").length, completeness: "retained session entries only; no replay authority" };
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Build an allowlisted audit from runtime-owned records. Prompt, output, payload, paths and environment values are never copied. */
|
|
144
|
+
export function buildSessionAudit(input: { entries: readonly unknown[]; sessionDir: string; proactive?: ProactiveReportInput; taskTriage?: TaskTriageAuditInput }): SessionAuditSummary {
|
|
145
|
+
const unavailable = new Set<string>(), meta = readJson(join(input.sessionDir, "session.json"));
|
|
146
|
+
const rootSessionId = runtimeId(meta?.sessionId) ?? runtimeId(basename(input.sessionDir));
|
|
147
|
+
if (!meta) unavailable.add("root_session_metadata");
|
|
148
|
+
const children = new Map<string, string | null>(), snapshots = new Set<string>();
|
|
149
|
+
const rawEvents: Omit<SessionAuditEvent, "repeatCount">[] = [];
|
|
150
|
+
const add = (event: Omit<SessionAuditEvent, "repeatCount">) => rawEvents.push(event);
|
|
151
|
+
const dispatchRoot = join(input.sessionDir, "dispatches");
|
|
152
|
+
if (existsSync(dispatchRoot)) {
|
|
153
|
+
for (const dispatchPathId of readdirSync(dispatchRoot).sort()) {
|
|
154
|
+
const dispatchId = runtimeId(dispatchPathId);
|
|
155
|
+
if (!dispatchId) { unavailable.add("child_identity"); continue; }
|
|
156
|
+
const result = readJson(join(dispatchRoot, dispatchPathId, "result.json"));
|
|
157
|
+
if (!result) { unavailable.add(`child_result:${dispatchId}`); children.set(dispatchId, null); continue; }
|
|
158
|
+
const childSessionId = text(result.sessionPath) ? runtimeId(basename(String(result.sessionPath)).replace(/\.jsonl?$/i, "")) : null;
|
|
159
|
+
children.set(dispatchId, childSessionId);
|
|
160
|
+
const category = recovery(result.recoveryCategory);
|
|
161
|
+
if (category) add({ kind: "refusal", rootSessionId, childDispatchId: dispatchId, childSessionId, snapshotId: null, category, status: status(result.status), evidence: "available" });
|
|
162
|
+
if (object(result.protocolDiagnostic)?.schema === PROTOCOL_SCHEMA) add({ kind: "tool_protocol", rootSessionId, childDispatchId: dispatchId, childSessionId, snapshotId: null, category: "tool_protocol_error", status: "tool_protocol_error", evidence: "available" });
|
|
163
|
+
}
|
|
164
|
+
} else unavailable.add("child_execution_records");
|
|
165
|
+
|
|
166
|
+
// Compaction snapshots contain prior append-only rows; project once from the last snapshot.
|
|
167
|
+
let projected: any[] = [];
|
|
168
|
+
try {
|
|
169
|
+
// The audit must not infer an empty or clean history from an invalid checkpoint.
|
|
170
|
+
createNoProgressGuard().restore(input.entries);
|
|
171
|
+
projected = projectRecoveryRows(input.entries);
|
|
172
|
+
} catch {
|
|
173
|
+
unavailable.add('recovery_history_integrity');
|
|
174
|
+
}
|
|
175
|
+
const attemptDispatch = new Map<string, string>();
|
|
176
|
+
const recoveryDispatch = new Map<string, { operationId: string; attemptId: string }>();
|
|
177
|
+
const attemptCategory = new Map<string, RecoveryCategory>();
|
|
178
|
+
const attemptRequirements = new Map<string, string[]>();
|
|
179
|
+
for (const row of projected) {
|
|
180
|
+
const event = object(row?.event), type = text(event?.type), opId = runtimeId(event?.operationId), attemptId = runtimeId(event?.attemptId);
|
|
181
|
+
if (row?.kind === 'guard' && type === 'evidence') {
|
|
182
|
+
const evidence = object(event?.evidence), id = runtimeId(evidence?.dispatchId);
|
|
183
|
+
if (id && Array.isArray(evidence?.openRequirements)) attemptRequirements.set(id, evidence.openRequirements.map(runtimeId).filter((x: string | null): x is string => !!x).slice(0, 64));
|
|
184
|
+
}
|
|
185
|
+
if (row?.kind !== 'ledger' || !opId || !attemptId) continue;
|
|
186
|
+
const dispatchId = type === 'start' || type === 'dispatch' ? runtimeId(event?.dispatchId) : attemptDispatch.get(attemptId) ?? null;
|
|
187
|
+
if (dispatchId) { attemptDispatch.set(attemptId, dispatchId); recoveryDispatch.set(dispatchId, { operationId: opId, attemptId }); }
|
|
188
|
+
if (type === 'failure') { const category = recovery(event?.category); if (category) attemptCategory.set(attemptId, category); }
|
|
189
|
+
if (!['start','failure','settled','grant','technical','abandon','complete'].includes(type ?? '')) continue;
|
|
190
|
+
const category = attemptCategory.get(attemptId), technicalBlock = type === 'technical' && ['open','cleared'].includes(event?.status) ? event?.status as 'open' | 'cleared' : undefined;
|
|
191
|
+
add({ kind: 'recovery', rootSessionId, childDispatchId: dispatchId, childSessionId: dispatchId ? children.get(dispatchId) ?? null : null, snapshotId: null,
|
|
192
|
+
taskId: runtimeId(event?.taskId), operationId: opId, attemptId, category,
|
|
193
|
+
status: type === 'technical' ? technicalBlock ?? 'unavailable' : type === 'grant' ? 'authorized_once' : type === 'abandon' ? 'abandoned' : type === 'settled' ? 'settled' : type === 'failure' ? 'failed' : 'open',
|
|
194
|
+
technicalBlock, openRequirements: type === 'technical' && dispatchId ? attemptRequirements.get(dispatchId) ?? [] : undefined,
|
|
195
|
+
evidence: type === 'technical' || type === 'settled' ? 'available' : 'available',
|
|
196
|
+
explanation: type === 'grant' ? 'Human-authorized one-use indeterminate retry; partial side effects and duplicate effects were warned; no automatic execution.' : type === 'technical' ? 'Technical assessment only; failed execution and parent acceptance remain independent.' : undefined });
|
|
197
|
+
}
|
|
198
|
+
let latestProcess: unknown;
|
|
199
|
+
for (const entry of input.entries) {
|
|
200
|
+
const record = entryData(entry), snapshotId = record.type === "compaction" || record.type === "session_compact" ? record.id : null;
|
|
201
|
+
if (snapshotId) { snapshots.add(snapshotId); continue; }
|
|
202
|
+
if (record.type === "agent-hub-process-state") {
|
|
203
|
+
latestProcess = record.data;
|
|
204
|
+
if (record.data && Object.hasOwn(record.data, "additions")) {
|
|
205
|
+
const projected = projectTaskTriage({ ...input.taskTriage, process: record.data }).process;
|
|
206
|
+
add({ kind: "process_obligation", rootSessionId, childDispatchId: null, childSessionId: null, snapshotId: null,
|
|
207
|
+
status: projected.completion === "process_complete" ? "accepted" : "not_accepted",
|
|
208
|
+
risk: projected.declaration.risk as SessionAuditEvent["risk"], scope: projected.declaration.scope as SessionAuditEvent["scope"],
|
|
209
|
+
budgetTier: projected.declaration.budgetTier, obligations: projected.obligations ?? undefined, processAdditions: projected.additions,
|
|
210
|
+
currentStage: projected.currentStage, evidence: projected.availability === "available" ? "available" : "unavailable",
|
|
211
|
+
explanation: "Process status only; waivers remain waived and per-effect confirmation is independent of task acceptance." });
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const data = record.data, risk = ["unknown", "low", "high"].includes(data?.risk) ? data!.risk as "unknown" | "low" | "high" : "unknown";
|
|
215
|
+
const budgetTier = ["trivial", "small", "feature", "project"].includes(data?.budgetTier) ? data!.budgetTier : null;
|
|
216
|
+
const scope = ["unknown", "read-only", "small", "wide"].includes(data?.scope) ? data!.scope : "unknown";
|
|
217
|
+
const appliedRuleIds = Array.isArray(data?.appliedRuleIds) ? data.appliedRuleIds.filter((v: unknown) => typeof v === "string").slice(0, 8) : [];
|
|
218
|
+
const currentStage = text(data?.currentStage, 64) ?? "unavailable", admissibleNextAction = text(data?.admissibleNextAction, 160) ?? "unavailable";
|
|
219
|
+
const auditScope = Array.isArray(data?.auditScope) ? data.auditScope.filter((v: unknown) => typeof v === "string").slice(0, 64) : [];
|
|
220
|
+
const raw = object(data?.obligations), obligations: Record<string, "satisfied" | "open" | "unsupported"> = {};
|
|
221
|
+
for (const name of ["risk", "acceptance", "review", "plan"]) {
|
|
222
|
+
const item = object(raw?.[name]), value = item?.status;
|
|
223
|
+
obligations[name] = ["satisfied", "open", "unsupported"].includes(value) ? value : "unsupported";
|
|
224
|
+
}
|
|
225
|
+
add({ kind: "process_obligation", rootSessionId, childDispatchId: null, childSessionId: null, snapshotId: null,
|
|
226
|
+
status: Object.values(obligations).some(value => value !== "satisfied") ? "not_accepted" : "accepted", risk, scope, budgetTier,
|
|
227
|
+
obligations, appliedRuleIds, currentStage, admissibleNextAction, auditScope, explanation: `Risk ${risk}; scope ${scope}; budget tier ${budgetTier ?? "unavailable"} limits spend only. Open obligations: ${Object.entries(obligations).filter(([, value]) => value !== "satisfied").map(([name]) => name).join(", ") || "none"}.`, evidence: "available" });
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (record.type === "agent-hub-budget-continuation") {
|
|
231
|
+
const correlation = object(record.data?.correlation), evidence = correlation ? "available" as const : "unavailable" as const;
|
|
232
|
+
const base = { rootSessionId, childDispatchId: null, childSessionId: null, snapshotId: null, taskId: runtimeId(correlation?.task_id), requestId: runtimeId(correlation?.request_id), operation: operation(correlation?.operation), evidence };
|
|
233
|
+
add({ ...base, kind: "budget_permission", status: "authorized" });
|
|
234
|
+
add({ ...base, kind: "human_intervention", status: "budget_authorized" });
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (record.type === "agent-hub-retry-authorized") {
|
|
238
|
+
const correlation = object(record.data?.correlation), dispatchId = runtimeId(record.data?.dispatchId), evidence = correlation ? "available" as const : "unavailable" as const;
|
|
239
|
+
const base = { rootSessionId, childDispatchId: dispatchId, childSessionId: dispatchId ? children.get(dispatchId) ?? null : null, snapshotId: null, taskId: runtimeId(correlation?.taskId), requestId: runtimeId(correlation?.requestId), operation: operation(correlation?.operation), evidence };
|
|
240
|
+
add({ ...base, kind: "retry_permission", status: "authorized_once" });
|
|
241
|
+
add({ ...base, kind: "human_intervention", status: "retry_authorized_once" });
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
const details = record.details, result = runtimeResult(details);
|
|
245
|
+
if (!result) {
|
|
246
|
+
const category = recovery(details?.recoveryCategory);
|
|
247
|
+
if (category) {
|
|
248
|
+
const dispatchId = runtimeId(details?.dispatchId) ?? runtimeId(details?.previousDispatchId);
|
|
249
|
+
add({ kind: category === "tool_protocol_error" ? "tool_protocol" : "refusal", rootSessionId, childDispatchId: dispatchId, childSessionId: dispatchId ? children.get(dispatchId) ?? null : null, snapshotId: null, category, status: status(details?.status ?? category), evidence: "available" });
|
|
250
|
+
}
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
const execution = object(result.execution), verification = object(result.verification), acceptance = object(result.acceptance), task = object(result.task);
|
|
254
|
+
const dispatchId = runtimeId(execution?.dispatchId), childSessionId = dispatchId ? children.get(dispatchId) ?? null : null;
|
|
255
|
+
if (verification?.status !== "passed") add({ kind: "verification", rootSessionId, childDispatchId: dispatchId, childSessionId, snapshotId: null, status: status(verification?.status), taskId: runtimeId(task?.id), evidence: verification?.status ? "available" : "unavailable" });
|
|
256
|
+
const category = recovery(details?.recoveryCategory);
|
|
257
|
+
if (category) add({ kind: category === "tool_protocol_error" ? "tool_protocol" : "refusal", rootSessionId, childDispatchId: dispatchId, childSessionId, snapshotId: null, category, status: status(details?.status ?? acceptance?.status), taskId: runtimeId(task?.id), evidence: "available" });
|
|
258
|
+
const linked = dispatchId ? recoveryDispatch.get(dispatchId) : undefined;
|
|
259
|
+
if (linked && acceptance?.status === 'accepted' && result.execution?.status === 'completed' && verification?.status === 'passed')
|
|
260
|
+
add({ kind:'recovery', rootSessionId, childDispatchId:dispatchId, childSessionId, snapshotId:null, taskId:runtimeId(task?.id), operationId:linked.operationId, attemptId:linked.attemptId, status:'accepted', evidence:'available' });
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Trace-only, read-only projection: unknown/interrupted is not guessed into a verdict.
|
|
264
|
+
const watchdogTrace = readWatchdogEvents(input.sessionDir);
|
|
265
|
+
if (watchdogTrace.integrity.partialTail || watchdogTrace.integrity.invalidRecords || watchdogTrace.integrity.readError) unavailable.add("watchdog_trace_integrity");
|
|
266
|
+
for (const check of projectWatchdogReadback(watchdogTrace.events)) {
|
|
267
|
+
const dispatchId = runtimeId(check.dispatchId), attemptId = runtimeId(check.attemptId), checkId = runtimeId(check.checkId);
|
|
268
|
+
if (!dispatchId || !attemptId || !checkId) continue;
|
|
269
|
+
const allowed = new Set(["continue", "advisory", "drift_stop", "judge_unavailable", "discard"]);
|
|
270
|
+
add({ kind: "watchdog", rootSessionId, childDispatchId: dispatchId, childSessionId: children.get(dispatchId) ?? null,
|
|
271
|
+
snapshotId: runtimeId(check.snapshotId), requestId: checkId, taskId: attemptId,
|
|
272
|
+
status: allowed.has(check.outcome) ? check.outcome : check.evaluation === "interrupted" || check.llm === "interrupted" ? "indeterminate" : "unavailable",
|
|
273
|
+
watchdog: {
|
|
274
|
+
evaluation: ["finished", "interrupted", "unknown"].includes(check.evaluation) ? check.evaluation : "unknown",
|
|
275
|
+
llm: ["finished", "interrupted", "none"].includes(check.llm) ? check.llm : "unknown",
|
|
276
|
+
llmStatus: ["verdict", "unavailable", "cancelled"].includes(check.llmStatus ?? "") ? check.llmStatus! : "unknown",
|
|
277
|
+
providerStatus: ["ok", "skipped", "unavailable", "unsupported", "cancelled"].includes(check.status) ? check.status : "unknown",
|
|
278
|
+
reason: ["timeout", "network", "auth", "rate_limit", "overloaded", "invalid_config", "invalid_request", "missing_key", "consumer_off", "state_too_large", "disposed", "interrupted", "unknown"].includes(check.reason) ? check.reason : "unknown",
|
|
279
|
+
source: ["llm", "none", "system1"].includes(check.source) ? check.source : "unknown",
|
|
280
|
+
applied: check.applied === "yes" || check.applied === "no" ? check.applied : "unknown",
|
|
281
|
+
outcome: allowed.has(check.outcome) ? check.outcome : "unknown",
|
|
282
|
+
},
|
|
283
|
+
evidence: check.evaluation === "interrupted" || check.llm === "interrupted" ? "unavailable" : "available" });
|
|
284
|
+
}
|
|
285
|
+
const diskMetrics = readTaskTriageReport(input.sessionDir);
|
|
286
|
+
// Disk includes prior session instances. Use bounded live fallback only if this
|
|
287
|
+
// observer lost writes; report the source rather than duplicating its events.
|
|
288
|
+
const liveActivity = input.taskTriage?.activity;
|
|
289
|
+
const metrics = liveActivity?.degraded ? { ...buildTaskTriageReport(liveActivity.events, liveActivity, diskMetrics.observability),
|
|
290
|
+
availability: "session-memory", scope: "bounded-live-observer; durable trace degraded" } : diskMetrics;
|
|
291
|
+
const taskTriage = { ...projectTaskTriage({ ...input.taskTriage, process: latestProcess }), metrics, actions: projectTaskTriageActions(input.entries, input.taskTriage) };
|
|
292
|
+
if (taskTriage.actions.invalidRecords || taskTriage.actions.ambiguous || taskTriage.actions.overflow) unavailable.add("task_triage_action_integrity");
|
|
293
|
+
if (latestProcess !== undefined && taskTriage.process.availability === "unavailable") unavailable.add("task_triage_process_integrity");
|
|
294
|
+
if (taskTriage.metrics.observability.degraded) unavailable.add("task_triage_trace_integrity");
|
|
295
|
+
const deduped = new Map<string, SessionAuditEvent>();
|
|
296
|
+
for (const event of rawEvents) {
|
|
297
|
+
const key = JSON.stringify([event.kind, event.rootSessionId, event.childDispatchId, event.childSessionId, event.snapshotId, event.category ?? null, event.status, event.taskId ?? null, event.requestId ?? null, event.operation ?? null, event.risk ?? null, event.scope ?? null, event.budgetTier ?? null, event.obligations ?? null, event.processAdditions ?? null, event.appliedRuleIds ?? null, event.currentStage ?? null, event.admissibleNextAction ?? null, event.auditScope ?? null, event.watchdog ?? null, event.operationId ?? null, event.attemptId ?? null, event.technicalBlock ?? null, event.openRequirements ?? null]);
|
|
298
|
+
const prior = deduped.get(key);
|
|
299
|
+
if (prior) prior.repeatCount++;
|
|
300
|
+
else deduped.set(key, { ...event, repeatCount: 1 });
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
schema: "agent-fleet.session-audit/v1", readOnly: true,
|
|
304
|
+
identity: { rootSessionId, children: [...children].map(([dispatchId, sessionId]) => ({ dispatchId, sessionId })), snapshots: [...snapshots].map(snapshotId => ({ snapshotId })) },
|
|
305
|
+
events: [...deduped.values()], proactive: input.proactive ? buildProactiveReport(input.proactive) : readProactiveReport(input.sessionDir), taskTriage, unavailable: [...unavailable].sort(),
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export function formatSessionAudit(summary: SessionAuditSummary): string { return JSON.stringify(summary, null, 2); }
|
|
310
|
+
|
|
311
|
+
export async function showSessionAudit(ctx: ExtensionContext, sessionDir: string, proactive?: ProactiveReportInput, taskTriage?: TaskTriageAuditInput): Promise<void> {
|
|
312
|
+
ctx.ui.notify(formatSessionAudit(buildSessionAudit({ entries: ctx.sessionManager.getEntries(), sessionDir, proactive, taskTriage })), "info");
|
|
313
|
+
}
|