@chankov/agent-fleet 2.0.12 → 2.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/agent-fleet/scripts/flow.ts +5 -3
- package/.pi/agent-fleet/scripts/lib/flow-command.ts +9 -4
- package/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +3 -1
- package/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +34 -0
- package/.pi/agents/model-profiles.yaml +80 -29
- package/.pi/agents/peers.yaml +18 -18
- package/.pi/agents/voices.yaml +2 -2
- package/.pi/harnesses/agent-hub/README.md +55 -4
- package/.pi/harnesses/agent-hub/commands/audit.ts +1 -1
- package/.pi/harnesses/agent-hub/commands/context.ts +1 -1
- package/.pi/harnesses/agent-hub/config/model-profiles.ts +1 -0
- package/.pi/harnesses/agent-hub/delegate.ts +5 -3
- package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +27 -2
- package/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +29 -0
- package/.pi/harnesses/agent-hub/dispatch-native-types.ts +6 -0
- package/.pi/harnesses/agent-hub/index.ts +75 -40
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/policy/profile-activation.ts +2 -2
- package/.pi/harnesses/agent-hub/proactive-config.ts +40 -0
- package/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.pi/harnesses/agent-hub/proactive-local.ts +88 -0
- package/.pi/harnesses/agent-hub/proactive-observer.ts +105 -0
- package/.pi/harnesses/agent-hub/proactive-rules.ts +143 -0
- package/.pi/harnesses/agent-hub/proactive-runtime.ts +316 -0
- package/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.pi/harnesses/agent-hub/proactive-snapshot.ts +243 -0
- package/.pi/harnesses/agent-hub/proactive-types.ts +63 -0
- package/.pi/harnesses/agent-hub/prompts/context.ts +2 -0
- package/.pi/harnesses/agent-hub/prompts/system-prompt.ts +3 -0
- package/.pi/harnesses/agent-hub/research/runtime.ts +3 -1
- package/.pi/harnesses/agent-hub/research/spawn-run.ts +4 -1
- package/.pi/harnesses/agent-hub/return-extract.js +1 -1
- package/.pi/harnesses/agent-hub/session-audit.ts +6 -5
- package/.pi/harnesses/agent-hub/system1-activity.ts +67 -0
- package/.pi/harnesses/agent-hub/system1-report.ts +142 -1
- package/.pi/harnesses/agent-hub/system1-runtime.ts +3 -0
- package/.pi/harnesses/agent-hub/tools/run-flow.ts +16 -2
- package/.pi/harnesses/agent-hub/ui/detail-panel.ts +26 -5
- package/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +30 -5
- package/.pi/harnesses/agent-hub/ui/fleet-source.ts +7 -2
- package/.pi/harnesses/agent-hub/ui/grid.ts +12 -7
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/context-budget-child-prompt.ts +41 -2
- package/.pi/harnesses/lib/context-budget-hub-prompt.ts +4 -2
- package/.pi/harnesses/lib/fleet-dashboard-view.ts +14 -3
- package/.pi/harnesses/lib/fleet-detail-view.ts +68 -7
- package/.pi/harnesses/lib/fleet-read-model.ts +131 -0
- package/.pi/harnesses/lib/fleet-strip-view.ts +44 -9
- package/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.13/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.13/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/coms-claude-bridge.ts +411 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/fleet.ts +216 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/flow.ts +157 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +210 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +34 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.13/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.13/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.13/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.13/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.13/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.13/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.13/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.13/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.13/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.13/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.13/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.13/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.13/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.13/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.13/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.13/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.13/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.13/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.13/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.13/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.13/.pi/extensions/package.json +9 -0
- package/.versions/2.0.13/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.13/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.13/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.13/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.13/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.13/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.13/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/README.md +1360 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/acceptance.ts +199 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/context.ts +45 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/recover.ts +52 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/config/agents.ts +178 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/config/overrides.ts +160 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/context/budgets.ts +204 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/delegate.ts +467 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/deterministic-fs.ts +127 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native-complete.ts +169 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +248 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +231 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native-types.ts +257 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native.ts +226 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/docs-lane.js +122 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/filesystem-tool.ts +73 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/fixtures/registration-surface.json +61 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/index.ts +2336 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +125 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/no-progress.ts +359 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/work-mode.ts +126 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-config.ts +40 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-local.ts +88 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-observer.ts +105 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-rules.ts +143 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-runtime.ts +316 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-snapshot.ts +243 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-types.ts +63 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/process-obligations.ts +57 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/prompts/context.ts +53 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/prompts/fragments.ts +118 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/prompts/system-prompt.ts +115 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/recover-policy.ts +27 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/recovery-contract.ts +80 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/research/runtime.ts +195 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/research/spawn-run.ts +174 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/return-contract.js +327 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/review-findings.js +104 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/run-budget.js +542 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/scope-gate.js +123 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/session-audit.ts +227 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/spawn.ts +526 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/system1-activity.ts +510 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/system1-report.ts +225 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/system1-runtime.ts +276 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/action-executors.ts +185 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/context.ts +142 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +82 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +498 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/herdr-executors.ts +86 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/spawn-research.ts +65 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +124 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/fleet-source.ts +175 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/work-mode.ts +173 -0
- package/.versions/2.0.13/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.13/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.13/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.13/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.13/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.13/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
- package/.versions/2.0.13/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.13/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.13/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.13/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.13/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.13/.pi/harnesses/damage-control-continue/index.ts +550 -0
- package/.versions/2.0.13/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.13/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.13/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.13/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.13/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.13/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.13/.pi/harnesses/lib/context-budget-child-prompt.ts +219 -0
- package/.versions/2.0.13/.pi/harnesses/lib/context-budget-hub-prompt.ts +116 -0
- package/.versions/2.0.13/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.13/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.13/.pi/harnesses/lib/damage-control-shared.ts +197 -0
- package/.versions/2.0.13/.pi/harnesses/lib/deterministic-handle-path.ts +23 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-dashboard-view.ts +147 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-read-model.ts +536 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-strip-controller.ts +74 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.13/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.13/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.13/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.13/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.13/.pi/harnesses/lib/system1/config.js +61 -0
- package/.versions/2.0.13/.pi/harnesses/lib/system1/contracts.ts +152 -0
- package/.versions/2.0.13/.pi/harnesses/lib/system1/demo.ts +106 -0
- package/.versions/2.0.13/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.13/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.13/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.13/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.13/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.13/.pi/prompts/af-build.md +24 -0
- package/.versions/2.0.13/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.13/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.13/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.13/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.13/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.13/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.13/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.13/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.13/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.13/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.13/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.13/.version +1 -0
- package/.versions/2.0.13/agents/architect.md +24 -0
- package/.versions/2.0.13/agents/bowser.md +28 -0
- package/.versions/2.0.13/agents/builder.md +55 -0
- package/.versions/2.0.13/agents/code-reviewer.md +209 -0
- package/.versions/2.0.13/agents/deep-researcher.md +32 -0
- package/.versions/2.0.13/agents/documenter.md +22 -0
- package/.versions/2.0.13/agents/orchestrator.md +22 -0
- package/.versions/2.0.13/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.13/agents/planner.md +105 -0
- package/.versions/2.0.13/agents/releaser.md +24 -0
- package/.versions/2.0.13/agents/researcher.md +30 -0
- package/.versions/2.0.13/agents/security-auditor.md +167 -0
- package/.versions/2.0.13/agents/test-engineer.md +153 -0
- package/.versions/2.0.13/agents/web-debugger.md +44 -0
- package/.versions/2.0.13/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.13/bin/catalog/harness-runtime-closure.json +73 -0
- package/.versions/2.0.13/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.13/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.13/docs/ARCHITECTURE.md +753 -0
- package/.versions/2.0.13/docs/agent-fleet-setup.md +900 -0
- package/.versions/2.0.13/docs/claude-code-coms-bridge.md +134 -0
- package/.versions/2.0.13/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.13/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.13/docs/getting-started.md +126 -0
- package/.versions/2.0.13/docs/npm-install.md +468 -0
- package/.versions/2.0.13/docs/pi-extensions.md +454 -0
- package/.versions/2.0.13/docs/pi-setup.md +92 -0
- package/.versions/2.0.13/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.13/install-manifest.json +3175 -0
- package/.versions/2.0.13/justfile +247 -0
- package/.versions/2.0.13/manifest-meta.json +1057 -0
- package/.versions/2.0.13/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.13/references/communication-contract.md +26 -0
- package/.versions/2.0.13/references/definition-of-done.md +67 -0
- package/.versions/2.0.13/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.13/references/observability-checklist.md +92 -0
- package/.versions/2.0.13/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.13/references/performance-checklist.md +236 -0
- package/.versions/2.0.13/references/prompting-patterns.md +380 -0
- package/.versions/2.0.13/references/security-checklist.md +245 -0
- package/.versions/2.0.13/references/testing-patterns.md +235 -0
- package/.versions/2.0.13/references/workflow-authoring.md +304 -0
- package/.versions/2.0.13/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.13/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.13/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.13/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.13/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.13/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.13/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.13/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.13/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.13/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.13/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.13/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.13/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.13/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.13/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.13/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.13/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.13/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.13/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.13/skills/incremental-implementation/SKILL.md +302 -0
- package/.versions/2.0.13/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.13/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.13/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.13/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.13/skills/planning-and-task-breakdown/SKILL.md +289 -0
- package/.versions/2.0.13/skills/repository-ai-setup/SKILL.md +117 -0
- package/.versions/2.0.13/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.13/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.13/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.13/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.13/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.13/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.13/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.13/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.13/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +10 -0
- package/README.md +3 -3
- package/agents/architect.md +2 -3
- package/agents/bowser.md +2 -2
- package/agents/builder.md +2 -3
- package/agents/code-reviewer.md +7 -8
- package/agents/deep-researcher.md +3 -4
- package/agents/documenter.md +2 -3
- package/agents/orchestrator.md +2 -3
- package/agents/plan-reviewer.md +5 -6
- package/agents/planner.md +5 -6
- package/agents/releaser.md +2 -3
- package/agents/researcher.md +4 -5
- package/agents/security-auditor.md +6 -7
- package/agents/test-engineer.md +3 -4
- package/agents/web-debugger.md +3 -3
- package/agents/web-performance-auditor.md +3 -3
- package/bin/catalog/harness-runtime-closure.json +30 -18
- package/bin/cli.js +47 -1
- package/bin/lib/apply.js +16 -0
- package/bin/lib/overrides.js +37 -1
- package/bin/lib/project-provenance.js +119 -0
- package/bin/lib/scan.js +1 -1
- package/bin/lib/transaction.js +1 -1
- package/bin/lib/validate-overrides.js +37 -3
- package/catalog/agent-prompts/README.md +12 -0
- package/catalog/agent-prompts/architecture-decision-author.md +24 -0
- package/catalog/agent-prompts/requirements-author.md +21 -0
- package/catalog/commands/README.md +13 -0
- package/catalog/commands/assess-change-impact.md +19 -0
- package/catalog/commands/audit-documentation.md +19 -0
- package/catalog/rules/README.md +33 -0
- package/catalog/rules/ai/policy-authoring.md +22 -0
- package/catalog/rules/architecture/behavior-preserving-refactoring.md +25 -0
- package/catalog/rules/architecture/public-contracts.md +22 -0
- package/catalog/rules/architecture/repository-boundaries.md +21 -0
- package/catalog/rules/architecture/structural-change-registration.md +25 -0
- package/catalog/rules/backend/notification-date-time.md +25 -0
- package/catalog/rules/bundles/README.md +16 -0
- package/catalog/rules/data/enum-semantics.md +25 -0
- package/catalog/rules/data/mixed-ownership-data.md +22 -0
- package/catalog/rules/data/reporting-queries.md +34 -0
- package/catalog/rules/docs/docs-maintenance.md +25 -0
- package/catalog/rules/frameworks/vue.md +25 -0
- package/catalog/rules/frontend/async-ui-states.md +26 -0
- package/catalog/rules/frontend/established-ui-primitives.md +25 -0
- package/catalog/rules/frontend/form-validation.md +26 -0
- package/catalog/rules/frontend/navigation-contracts.md +25 -0
- package/catalog/rules/languages/csharp.md +25 -0
- package/catalog/rules/languages/javascript.md +25 -0
- package/catalog/rules/languages/sql.md +24 -0
- package/catalog/rules/security/authorization-before-effects.md +26 -0
- package/catalog/rules/security/diagnostic-data-safety.md +22 -0
- package/catalog/rules/security/response-data-minimization.md +25 -0
- package/catalog/rules/security/trusted-tenant-scope.md +26 -0
- package/catalog/rules/testing/shared-package-consumers.md +25 -0
- package/catalog/rules/testing/verification-conventions.md +24 -0
- package/docs/ARCHITECTURE.md +50 -2
- package/docs/agent-fleet-setup.md +246 -28
- package/docs/codex-session-bridge.md +1 -1
- package/docs/pi-extensions.md +10 -5
- package/docs/workflows.md +4 -3
- package/install-manifest.json +125 -3
- package/manifest-meta.json +77 -15
- package/package.json +5 -3
- package/skills/repository-ai-setup/SKILL.md +117 -0
- package/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/skills/repository-ai-setup/references/verify-setup.md +20 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { execFileSync, fork } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, realpathSync } from "node:fs";
|
|
4
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { isCaptureEnabled, PROACTIVE_LIMITS } from "./proactive-config.ts";
|
|
7
|
+
import { checkScope } from "./scope-gate.js";
|
|
8
|
+
import type { ProactiveConfig, SourceExcerpt, TaskContext, TurnSnapshot, TurnUnit } from "./proactive-types.ts";
|
|
9
|
+
|
|
10
|
+
const hash = (value: Buffer | string) => createHash("sha256").update(value).digest("hex");
|
|
11
|
+
const forbidden = /^(?:\.env(?:\..*)?|\.git|\.pi|\.ssh|\.aws|\.npmrc|\.netrc|node_modules|vendor|dist|build|coverage|\.next|\.cache|artifacts|sessions?|transcripts?|credentials?(?:\..*)?|secrets?(?:\..*)?|id_(?:rsa|ed25519)|.*\.(?:pem|key|p12|pfx|sqlite|db|lock))$/i;
|
|
12
|
+
function allowed(root: string, path: string): string {
|
|
13
|
+
if (!path || isAbsolute(path) || path.includes("\\") || path.includes("\0") || path.split("/").some(s => !s || s === "." || s === ".." || forbidden.test(s))) throw new Error("forbidden_path");
|
|
14
|
+
const rootReal = realpathSync(root), full = resolve(rootReal, path);
|
|
15
|
+
const rel = relative(rootReal, full);
|
|
16
|
+
if (rel.startsWith("..") || isAbsolute(rel)) throw new Error("escape");
|
|
17
|
+
let cursor = rootReal;
|
|
18
|
+
for (const part of path.split("/")) {
|
|
19
|
+
cursor = join(cursor, part);
|
|
20
|
+
try { if (lstatSync(cursor).isSymbolicLink()) throw new Error("symlink"); }
|
|
21
|
+
catch (e) { if ((e as NodeJS.ErrnoException).code === "ENOENT") break; throw e; }
|
|
22
|
+
}
|
|
23
|
+
return full;
|
|
24
|
+
}
|
|
25
|
+
function remaining(start: number, now: () => number): number {
|
|
26
|
+
const ms = PROACTIVE_LIMITS.captureMs - (now() - start);
|
|
27
|
+
if (ms <= 0) throw new Error("capture_timeout");
|
|
28
|
+
return Math.min(300, Math.max(1, Math.floor(ms)));
|
|
29
|
+
}
|
|
30
|
+
function git(root: string, args: string[], start: number, now: () => number, maxBuffer = 1024 * 1024): Buffer {
|
|
31
|
+
remaining(start, now);
|
|
32
|
+
// The enclosing process-group deadline owns cancellation; this is only a backup.
|
|
33
|
+
const bytes = execFileSync("git", ["-C", root, ...args], { timeout: PROACTIVE_LIMITS.captureMs + 200, maxBuffer, stdio: ["ignore", "pipe", "pipe"] });
|
|
34
|
+
remaining(start, now);
|
|
35
|
+
return bytes;
|
|
36
|
+
}
|
|
37
|
+
function status(root: string, start: number, now: () => number): Set<string> {
|
|
38
|
+
const rows = git(root, ["status", "--porcelain", "-z", "--untracked-files=all"], start, now).toString("utf8").split("\0");
|
|
39
|
+
const paths = new Set<string>();
|
|
40
|
+
for (let i = 0; i < rows.length; i++) {
|
|
41
|
+
const row = rows[i]; if (!row) continue;
|
|
42
|
+
paths.add(row.slice(3));
|
|
43
|
+
if (/[RC]/.test(row.slice(0, 2)) && rows[i + 1]) paths.add(rows[++i]);
|
|
44
|
+
}
|
|
45
|
+
return paths;
|
|
46
|
+
}
|
|
47
|
+
function read(root: string, path: string, start: number, now: () => number, afterFirstRead?: () => void): Buffer | null {
|
|
48
|
+
remaining(start, now);
|
|
49
|
+
const full = allowed(root, path);
|
|
50
|
+
let fd: number;
|
|
51
|
+
try { fd = openSync(full, constants.O_RDONLY | constants.O_NOFOLLOW); }
|
|
52
|
+
catch (e) { if ((e as NodeJS.ErrnoException).code === "ENOENT") return null; throw e; }
|
|
53
|
+
try {
|
|
54
|
+
const before = fstatSync(fd);
|
|
55
|
+
if (!before.isFile() || before.size > PROACTIVE_LIMITS.maxFileBytes) throw new Error("oversized_or_nonfile");
|
|
56
|
+
const bytes = Buffer.alloc(before.size);
|
|
57
|
+
let offset = 0;
|
|
58
|
+
while (offset < bytes.length) { remaining(start, now); const n = readSync(fd, bytes, offset, bytes.length - offset, offset); if (!n) throw new Error("unstable_snapshot"); offset += n; }
|
|
59
|
+
afterFirstRead?.();
|
|
60
|
+
const confirm = Buffer.alloc(before.size);
|
|
61
|
+
let checked = 0;
|
|
62
|
+
while (checked < confirm.length) { remaining(start, now); const n = readSync(fd, confirm, checked, confirm.length - checked, checked); if (!n) throw new Error("unstable_snapshot"); checked += n; }
|
|
63
|
+
const after = fstatSync(fd);
|
|
64
|
+
if (!bytes.equals(confirm)) throw new Error("unstable_snapshot");
|
|
65
|
+
if (before.size !== after.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs || before.ino !== after.ino || !after.isFile()) throw new Error("unstable_snapshot");
|
|
66
|
+
const final = lstatSync(full);
|
|
67
|
+
if (final.isSymbolicLink() || final.ino !== after.ino) throw new Error("unstable_snapshot");
|
|
68
|
+
if (bytes.includes(0) || !new TextDecoder("utf-8", { fatal: true }).decode(bytes)) { if (bytes.length) throw new Error("binary_or_invalid_utf8"); }
|
|
69
|
+
remaining(start, now);
|
|
70
|
+
return bytes;
|
|
71
|
+
} finally { closeSync(fd); }
|
|
72
|
+
}
|
|
73
|
+
function excerpt(bytes: Buffer, secrets: readonly string[]): SourceExcerpt {
|
|
74
|
+
let text = bytes.toString("utf8");
|
|
75
|
+
for (const secret of secrets) if (secret) text = text.replaceAll(secret, "[REDACTED]");
|
|
76
|
+
const source = bytes.toString("utf8");
|
|
77
|
+
return Object.freeze({ hash: hash(text), offset: 0, endOffset: bytes.length, startLine: 1, endLine: Math.max(1, source.split("\n").length - (source.endsWith("\n") ? 1 : 0)), text, truncated: false });
|
|
78
|
+
}
|
|
79
|
+
export interface TurnBaseline {
|
|
80
|
+
readonly root: string;
|
|
81
|
+
readonly head: string;
|
|
82
|
+
readonly dirty: ReadonlyMap<string, Buffer | null>;
|
|
83
|
+
readonly initialPaths: ReadonlySet<string>;
|
|
84
|
+
readonly config: ProactiveConfig;
|
|
85
|
+
readonly turnId: string;
|
|
86
|
+
readonly context: TaskContext;
|
|
87
|
+
readonly gaps: readonly string[];
|
|
88
|
+
readonly startedAt: number;
|
|
89
|
+
}
|
|
90
|
+
const code = (e: unknown): string => {
|
|
91
|
+
const message = (e as Error)?.message;
|
|
92
|
+
return typeof message === "string" && ["capture_timeout", "forbidden_path", "escape", "symlink", "oversized_or_nonfile", "unstable_snapshot", "binary_or_invalid_utf8", "missing_baseline", "oversized_baseline"].includes(message) ? message : "read_unavailable";
|
|
93
|
+
};
|
|
94
|
+
/** Worker-only synchronous core. Never call on the agent's event loop. */
|
|
95
|
+
export function beginTurnCore(input: { root: string; config: ProactiveConfig; turnId: string; context: TaskContext; knownTargets?: readonly string[]; now?: () => number }): TurnBaseline | null {
|
|
96
|
+
if (!isCaptureEnabled(input.config)) return null;
|
|
97
|
+
const now = input.now ?? Date.now, startedAt = now();
|
|
98
|
+
let head = "";
|
|
99
|
+
let initialPaths = new Set<string>();
|
|
100
|
+
const dirty = new Map<string, Buffer | null>(), gaps: string[] = [];
|
|
101
|
+
try {
|
|
102
|
+
head = git(input.root, ["rev-parse", "HEAD"], startedAt, now).toString("utf8").trim();
|
|
103
|
+
initialPaths = status(input.root, startedAt, now);
|
|
104
|
+
} catch (e) { head = ""; gaps.push((e as Error).message === "capture_timeout" ? "capture_timeout" : "git_unavailable"); }
|
|
105
|
+
let retained = 0, count = 0;
|
|
106
|
+
for (const path of [...new Set([...initialPaths, ...(input.knownTargets ?? [])])].sort()) {
|
|
107
|
+
if (now() - startedAt >= PROACTIVE_LIMITS.captureMs) { gaps.push("capture_timeout"); break; }
|
|
108
|
+
if (!checkScope([path], input.config.include).inScope.length) continue;
|
|
109
|
+
if (!head) break;
|
|
110
|
+
if (count >= PROACTIVE_LIMITS.maxUnits || retained >= PROACTIVE_LIMITS.maxRetainedBytes) { gaps.push("baseline_limit"); break; }
|
|
111
|
+
try {
|
|
112
|
+
const bytes = read(input.root, path, startedAt, now);
|
|
113
|
+
if (retained + (bytes?.length ?? 0) > PROACTIVE_LIMITS.maxRetainedBytes) { gaps.push("baseline_limit"); break; }
|
|
114
|
+
dirty.set(path, bytes); retained += bytes?.length ?? 0; count++;
|
|
115
|
+
} catch (e) { gaps.push(code(e)); }
|
|
116
|
+
}
|
|
117
|
+
return { root: input.root, head, dirty, initialPaths, config: input.config, turnId: input.turnId, context: structuredClone(input.context), gaps, startedAt };
|
|
118
|
+
}
|
|
119
|
+
export function finishTurnCore(baseline: TurnBaseline | null, input: { assistantText?: string; knownTargets?: readonly string[]; secrets?: readonly string[]; overlap?: boolean; now?: () => number; afterFirstRead?: () => void } = {}): TurnSnapshot | null {
|
|
120
|
+
if (!baseline) return null;
|
|
121
|
+
const now = input.now ?? Date.now, started = now();
|
|
122
|
+
const gaps = [...baseline.gaps];
|
|
123
|
+
let current: Set<string>;
|
|
124
|
+
try {
|
|
125
|
+
current = status(baseline.root, started, now);
|
|
126
|
+
if (git(baseline.root, ["rev-parse", "HEAD"], started, now).toString("utf8").trim() !== baseline.head) gaps.push("head_changed");
|
|
127
|
+
} catch (e) { current = new Set(); gaps.push((e as Error).message === "capture_timeout" ? "capture_timeout" : "git_unavailable"); }
|
|
128
|
+
if (input.overlap) gaps.push("concurrent_writer_attribution_uncertain");
|
|
129
|
+
const paths = [...new Set([...baseline.initialPaths, ...current, ...baseline.dirty.keys(), ...(input.knownTargets ?? [])])].sort();
|
|
130
|
+
const units: TurnUnit[] = [];
|
|
131
|
+
let retained = 0, omitted = 0;
|
|
132
|
+
const secrets = input.secrets ?? [];
|
|
133
|
+
for (const path of paths) {
|
|
134
|
+
if (!checkScope([path], baseline.config.include).inScope.length) continue;
|
|
135
|
+
if (now() - started >= PROACTIVE_LIMITS.captureMs) { gaps.push("capture_timeout"); omitted++; continue; }
|
|
136
|
+
if (units.length >= PROACTIVE_LIMITS.maxUnits) { omitted++; continue; }
|
|
137
|
+
try {
|
|
138
|
+
// Deny both lexical and symlink/realpath escapes before path-specific Git reads.
|
|
139
|
+
allowed(baseline.root, path);
|
|
140
|
+
let before = baseline.dirty.get(path);
|
|
141
|
+
if (!baseline.dirty.has(path)) {
|
|
142
|
+
if (!baseline.head || baseline.initialPaths.has(path) || (input.knownTargets ?? []).includes(path)) throw new Error("missing_baseline");
|
|
143
|
+
// A clean tracked path can use HEAD; only a path absent from HEAD is a genuine addition.
|
|
144
|
+
const tracked = git(baseline.root, ["ls-tree", "-z", "--name-only", baseline.head, "--", path], started, now).length > 0;
|
|
145
|
+
before = tracked ? git(baseline.root, ["show", `${baseline.head}:${path}`], started, now, PROACTIVE_LIMITS.maxFileBytes + 1) : null;
|
|
146
|
+
if (before && before.length > PROACTIVE_LIMITS.maxFileBytes) throw new Error("oversized_baseline");
|
|
147
|
+
}
|
|
148
|
+
const after = read(baseline.root, path, started, now, input.afterFirstRead);
|
|
149
|
+
remaining(started, now);
|
|
150
|
+
if (before && (before.includes(0) || !new TextDecoder("utf-8", { fatal: true }).decode(before))) { if (before.length) throw new Error("binary_or_invalid_utf8"); }
|
|
151
|
+
if (before !== null && after !== null && before?.equals(after)) continue;
|
|
152
|
+
if (before == null && after == null) continue;
|
|
153
|
+
const prior = before == null ? undefined : excerpt(before, secrets);
|
|
154
|
+
const next = after == null ? undefined : excerpt(after, secrets);
|
|
155
|
+
const size = Buffer.byteLength(prior?.text ?? "") + Buffer.byteLength(next?.text ?? "");
|
|
156
|
+
remaining(started, now);
|
|
157
|
+
if (retained + size > PROACTIVE_LIMITS.maxRetainedBytes) { omitted++; continue; }
|
|
158
|
+
const unit: TurnUnit = Object.freeze({ id: hash(`${baseline.turnId}:${path}`), path, kind: before == null ? "added" : after == null ? "deleted" : "modified", before: prior, after: next, attribution: "uncertain" });
|
|
159
|
+
units.push(unit); retained += size;
|
|
160
|
+
} catch (e) { gaps.push(code(e)); omitted++; }
|
|
161
|
+
}
|
|
162
|
+
if (omitted) gaps.push(`omitted_paths:${omitted}`);
|
|
163
|
+
if (baseline.config.remoteContext === "selected-excerpts" && input.assistantText) {
|
|
164
|
+
const text = Buffer.from(input.assistantText);
|
|
165
|
+
const redacted = text.length <= PROACTIVE_LIMITS.maxFileBytes ? excerpt(text, secrets) : null;
|
|
166
|
+
const size = Buffer.byteLength(redacted?.text ?? "");
|
|
167
|
+
if (units.length >= PROACTIVE_LIMITS.maxUnits || !redacted || retained + size > PROACTIVE_LIMITS.maxRetainedBytes) gaps.push("assistant_text_omitted");
|
|
168
|
+
else { units.push(Object.freeze({ id: hash(`${baseline.turnId}:assistant`), path: "assistant", kind: "text", after: redacted, attribution: "observed_only" })); retained += size; }
|
|
169
|
+
}
|
|
170
|
+
const statusValue = gaps.some(g => g.includes("unstable_snapshot")) ? "unstable_snapshot" : gaps.length ? "partial" : "complete";
|
|
171
|
+
const snapshotId = hash(JSON.stringify([baseline.turnId, baseline.head, baseline.context, units.map(u => [u.id, u.before?.hash, u.after?.hash]), gaps]));
|
|
172
|
+
const context = structuredClone(baseline.context);
|
|
173
|
+
Object.freeze(context.task);
|
|
174
|
+
if (context.plan) Object.freeze(context.plan);
|
|
175
|
+
for (const rule of context.rules) Object.freeze(rule);
|
|
176
|
+
Object.freeze(context.rules); Object.freeze(context.exceptions); Object.freeze(context);
|
|
177
|
+
return Object.freeze({ snapshotId, turnId: baseline.turnId, head: baseline.head, context, planStatus: baseline.context.plan ? "bound" : "task_only", status: statusValue, gaps: Object.freeze(gaps), units: Object.freeze(units), observedPaths: paths.length, coverage: Object.freeze({ retainedUnits: units.length, omittedPaths: omitted, retainedBytes: retained }) });
|
|
178
|
+
}
|
|
179
|
+
/** Immutable in-memory readback: never opens the source path. */
|
|
180
|
+
export function readSnapshotUnit(snapshot: TurnSnapshot, snapshotId: string, unitId: string, contentHash: string): string | null {
|
|
181
|
+
if (snapshot.snapshotId !== snapshotId) return null;
|
|
182
|
+
const unit = snapshot.units.find(u => u.id === unitId);
|
|
183
|
+
const excerpt = [unit?.before, unit?.after].find(e => e?.hash === contentHash);
|
|
184
|
+
return excerpt?.text ?? null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Each phase runs in a disposable process group. The parent fences IPC after deadline
|
|
188
|
+
* and kills the entire group (including any Git descendants) before settling. */
|
|
189
|
+
function capture<T>(phase: "begin" | "finish", payload: unknown): Promise<T> {
|
|
190
|
+
return new Promise((resolve, reject) => {
|
|
191
|
+
const child = fork(fileURLToPath(new URL("./proactive-snapshot-worker.mjs", import.meta.url)), [], {
|
|
192
|
+
detached: true, stdio: ["ignore", "ignore", "ignore", "ipc"], serialization: "advanced", execArgv: [],
|
|
193
|
+
});
|
|
194
|
+
let settled = false;
|
|
195
|
+
const killGroup = () => {
|
|
196
|
+
if (child.pid) {
|
|
197
|
+
try { process.kill(-child.pid, "SIGKILL"); } catch { /* exited */ }
|
|
198
|
+
try { child.kill("SIGKILL"); } catch { /* exited */ }
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
const settle = (error?: Error, result?: T) => {
|
|
202
|
+
if (settled) return;
|
|
203
|
+
settled = true;
|
|
204
|
+
clearTimeout(timer);
|
|
205
|
+
killGroup();
|
|
206
|
+
if (error) reject(error); else resolve(result as T);
|
|
207
|
+
};
|
|
208
|
+
const timer = setTimeout(() => settle(new Error("capture_timeout")), PROACTIVE_LIMITS.captureMs);
|
|
209
|
+
child.on("message", (message: { ok?: boolean; result?: T; code?: string }) => {
|
|
210
|
+
if (!message?.ok) settle(new Error(message?.code === "capture_timeout" ? "capture_timeout" : "capture_unavailable"));
|
|
211
|
+
else settle(undefined, message.result);
|
|
212
|
+
});
|
|
213
|
+
child.on("error", () => settle(new Error("capture_unavailable")));
|
|
214
|
+
// Let a queued IPC result win if the process exits immediately after sending.
|
|
215
|
+
child.on("exit", () => setImmediate(() => settle(new Error("capture_unavailable"))));
|
|
216
|
+
child.send({ phase, payload }, error => { if (error) settle(new Error("capture_unavailable")); });
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
export function beginTurn(input: Parameters<typeof beginTurnCore>[0]): Promise<TurnBaseline | null> {
|
|
220
|
+
if (!isCaptureEnabled(input.config)) return Promise.resolve(null);
|
|
221
|
+
const { now: _now, ...payload } = input;
|
|
222
|
+
return capture<TurnBaseline | null>("begin", payload).then(baseline => {
|
|
223
|
+
if (baseline) {
|
|
224
|
+
Object.freeze(baseline.context.task); if (baseline.context.plan) Object.freeze(baseline.context.plan);
|
|
225
|
+
for (const rule of baseline.context.rules) Object.freeze(rule);
|
|
226
|
+
Object.freeze(baseline.context.rules); Object.freeze(baseline.context.exceptions); Object.freeze(baseline.context);
|
|
227
|
+
}
|
|
228
|
+
return baseline;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
export function finishTurn(baseline: TurnBaseline | null, input: Parameters<typeof finishTurnCore>[1] = {}): Promise<TurnSnapshot | null> {
|
|
232
|
+
if (!baseline) return Promise.resolve(null);
|
|
233
|
+
const { now: _now, afterFirstRead: _hook, assistantText, ...options } = input;
|
|
234
|
+
return capture<TurnSnapshot>("finish", { baseline, input: baseline.config.remoteContext === "selected-excerpts" ? { ...options, assistantText } : options }).then(snapshot => {
|
|
235
|
+
// IPC cloning loses Object.freeze; reapply it before exposing private evidence.
|
|
236
|
+
for (const unit of snapshot.units) { if (unit.before) Object.freeze(unit.before); if (unit.after) Object.freeze(unit.after); Object.freeze(unit); }
|
|
237
|
+
Object.freeze(snapshot.units); Object.freeze(snapshot.gaps); Object.freeze(snapshot.coverage);
|
|
238
|
+
Object.freeze(snapshot.context.task); if (snapshot.context.plan) Object.freeze(snapshot.context.plan);
|
|
239
|
+
for (const rule of snapshot.context.rules) Object.freeze(rule);
|
|
240
|
+
Object.freeze(snapshot.context.rules); Object.freeze(snapshot.context.exceptions); Object.freeze(snapshot.context);
|
|
241
|
+
return Object.freeze(snapshot);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type ReviewMode = "off" | "shadow" | "advisory";
|
|
2
|
+
export type RemoteContext = "disabled" | "selected-excerpts";
|
|
3
|
+
export type EvidenceStatus = "complete" | "partial" | "unstable_snapshot" | "not_checked";
|
|
4
|
+
export type Attribution = "uncertain" | "observed_only";
|
|
5
|
+
export type SemanticVerdict = "aligned" | "possible_deviation" | "insufficient_evidence" | "not_checked";
|
|
6
|
+
export type RuleVerdict = "no_observed_violation" | "potential_violation" | "not_applicable" | "insufficient_evidence" | "rule_conflict" | "not_checked";
|
|
7
|
+
export type FindingSource = "deterministic" | "system1";
|
|
8
|
+
export type FeedbackDelivery = "not_applicable" | "pending" | "delivered" | "stale";
|
|
9
|
+
|
|
10
|
+
export interface ProactiveConfig {
|
|
11
|
+
readonly version: 1;
|
|
12
|
+
readonly mode: ReviewMode;
|
|
13
|
+
readonly remoteContext: RemoteContext;
|
|
14
|
+
readonly include: readonly string[];
|
|
15
|
+
readonly maxEvaluationsPerSession: number;
|
|
16
|
+
}
|
|
17
|
+
export interface BoundReference { readonly path: string; readonly revision: string; readonly hash: string }
|
|
18
|
+
export interface TaskContext {
|
|
19
|
+
readonly task: BoundReference;
|
|
20
|
+
readonly plan?: BoundReference;
|
|
21
|
+
readonly rules: readonly BoundReference[];
|
|
22
|
+
readonly exceptions: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
export interface SourceExcerpt {
|
|
25
|
+
readonly hash: string;
|
|
26
|
+
readonly offset: number;
|
|
27
|
+
readonly endOffset: number;
|
|
28
|
+
readonly startLine: number;
|
|
29
|
+
readonly endLine: number;
|
|
30
|
+
readonly text: string;
|
|
31
|
+
readonly truncated: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface TurnUnit {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly path: string;
|
|
36
|
+
readonly kind: "added" | "modified" | "deleted" | "renamed" | "text";
|
|
37
|
+
readonly before?: SourceExcerpt;
|
|
38
|
+
readonly after?: SourceExcerpt;
|
|
39
|
+
readonly attribution: Attribution;
|
|
40
|
+
readonly previousPath?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface TurnSnapshot {
|
|
43
|
+
readonly snapshotId: string;
|
|
44
|
+
readonly turnId: string;
|
|
45
|
+
readonly head: string;
|
|
46
|
+
readonly context: TaskContext;
|
|
47
|
+
readonly planStatus: "bound" | "task_only";
|
|
48
|
+
readonly status: EvidenceStatus;
|
|
49
|
+
readonly gaps: readonly string[];
|
|
50
|
+
readonly units: readonly TurnUnit[];
|
|
51
|
+
readonly observedPaths: number;
|
|
52
|
+
readonly coverage: { readonly retainedUnits: number; readonly omittedPaths: number; readonly retainedBytes: number };
|
|
53
|
+
}
|
|
54
|
+
export interface RuleSection { readonly id: string; readonly source: BoundReference; readonly heading: string; readonly occurrence: number }
|
|
55
|
+
export interface ReviewFinding {
|
|
56
|
+
readonly source: FindingSource;
|
|
57
|
+
readonly snapshotId: string;
|
|
58
|
+
readonly unitId: string;
|
|
59
|
+
readonly reference: string;
|
|
60
|
+
readonly verdict: RuleVerdict | SemanticVerdict;
|
|
61
|
+
readonly evidenceStatus: EvidenceStatus;
|
|
62
|
+
readonly delivery: FeedbackDelivery;
|
|
63
|
+
}
|
|
@@ -44,6 +44,8 @@ export interface HubPromptContext {
|
|
|
44
44
|
getWorkMode(): WorkMode;
|
|
45
45
|
getActiveTeamName(): string;
|
|
46
46
|
getUserLanguage(): string;
|
|
47
|
+
getRulesProtocol(): string;
|
|
48
|
+
getDocsProtocol(): string;
|
|
47
49
|
isAskUserAvailable(): boolean;
|
|
48
50
|
isComsReady(): boolean;
|
|
49
51
|
getIdentity(): { name: string; project: string } | null;
|
|
@@ -63,6 +63,7 @@ export function buildHubSystemPrompt(ctx: HubPromptContext): BuiltHubSystemPromp
|
|
|
63
63
|
const artifactRoot = ctx.getArtifactRoot?.();
|
|
64
64
|
const verificationSection = (verificationActive ? verificationFragment(MAX_OPEN_ASSERTIONS) : "") +
|
|
65
65
|
(artifactRoot && (verificationActive || fleetActive) ? `\n\nSession artifact root: ${artifactRoot}. Use this absolute root for read/write tools. Handoff paths artifacts/<kind>/... are relative to this root, not the repository. Legacy shared .pi/agent-sessions/artifacts paths belong to other sessions; do not overwrite them.` : "");
|
|
66
|
+
const projectPolicySection = ctx.getRulesProtocol() + ctx.getDocsProtocol();
|
|
66
67
|
const comsSection = comsFragment(peerActive, ctx.isComsReady(), ctx.getIdentity());
|
|
67
68
|
const workModeText = workModePrompt(ctx.getWorkMode());
|
|
68
69
|
const herdrSection = workspaceActive && ctx.isHerdrFleetReady() ? HUB_HERDR_SECTION : "";
|
|
@@ -78,6 +79,7 @@ export function buildHubSystemPrompt(ctx: HubPromptContext): BuiltHubSystemPromp
|
|
|
78
79
|
askUserBlock,
|
|
79
80
|
modeSection: stableModeSection,
|
|
80
81
|
verificationSection,
|
|
82
|
+
projectPolicySection,
|
|
81
83
|
stateCapsule,
|
|
82
84
|
comsSection,
|
|
83
85
|
herdrSection,
|
|
@@ -95,6 +97,7 @@ export function buildHubSystemPrompt(ctx: HubPromptContext): BuiltHubSystemPromp
|
|
|
95
97
|
dispatchSection,
|
|
96
98
|
modeSection: stableModeSection,
|
|
97
99
|
verificationSection,
|
|
100
|
+
projectPolicySection,
|
|
98
101
|
stateCapsule,
|
|
99
102
|
researchCards,
|
|
100
103
|
researchCatalog,
|
|
@@ -101,7 +101,9 @@ export interface ResearchRuntimeDeps<TDef extends ResearchAgentDef> extends Rese
|
|
|
101
101
|
guardrailEnv(agentId: string): Record<string, string>;
|
|
102
102
|
notifyProviderQueue(model: string, label: string, ctx: ExtensionContext): void;
|
|
103
103
|
spawnPiAgentWithModelFallback: typeof spawnPiAgentWithModelFallback;
|
|
104
|
-
|
|
104
|
+
getProjectPolicyPaths(cwd: string): string[];
|
|
105
|
+
getProjectDocsPaths(): string[];
|
|
106
|
+
nativeResearchSystemPrompt(input: { personaName?: string; personaPath?: string; cwd: string; rulesPaths?: readonly string[]; docsPaths?: readonly string[] }): string;
|
|
105
107
|
requireSafetyHarness(path: string | null): { ok: true; extensions: string[] } | { ok: false; error: string };
|
|
106
108
|
shortModel(model: string): string;
|
|
107
109
|
displayName(name: string): string;
|
|
@@ -88,11 +88,14 @@ export async function runResearchSpawn<TDef extends ResearchAgentDef>(
|
|
|
88
88
|
const deterministicTools = assist['deterministic-tools'] && (state.def.toolsExplicit !== true || declaredTools.includes("filesystem"));
|
|
89
89
|
const boundedOutputDir = safePathWithin(state.evidenceDir, "bounded-output");
|
|
90
90
|
const researchTools = deterministicTools && !deps.researchTools.split(",").includes("filesystem") ? `${deps.researchTools},filesystem` : deps.researchTools;
|
|
91
|
+
const cwd = ctx.cwd || process.cwd();
|
|
91
92
|
const res = await deps.providerSemaphore.run(state.model, () => deps.spawnPiAgentWithModelFallback({
|
|
92
93
|
model: state.model, tools: researchTools, thinking: thinkingLevel,
|
|
93
94
|
systemPrompt: deps.nativeResearchSystemPrompt({
|
|
94
95
|
...(state.persona ? { personaName: state.def.name, personaPath: state.def.file } : {}),
|
|
95
|
-
cwd
|
|
96
|
+
cwd,
|
|
97
|
+
rulesPaths: deps.getProjectPolicyPaths(cwd),
|
|
98
|
+
docsPaths: deps.getProjectDocsPaths(),
|
|
96
99
|
}),
|
|
97
100
|
noSkills: true, noContextFiles: true, sessionFile: sessionPath, resume: false,
|
|
98
101
|
prompt: deps.artifacts.appendInputArtifacts(prompt, inputArtifacts), cwd: ctx.cwd || process.cwd(),
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// visibly weaker than evidence the specialist declared itself.
|
|
14
14
|
|
|
15
15
|
/** The dedicated cheap model required by the recovery contract. */
|
|
16
|
-
export const EXTRACTION_MODEL = "openai-codex/gpt-
|
|
16
|
+
export const EXTRACTION_MODEL = "openai-codex/gpt-6-luna";
|
|
17
17
|
|
|
18
18
|
/** Two minutes: the pass must read a file, but it may never become a real run. */
|
|
19
19
|
export const EXTRACTION_DEADLINE_MS = 120_000;
|
|
@@ -3,7 +3,7 @@ import { basename, join } from "node:path";
|
|
|
3
3
|
import type { ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
4
4
|
import { redactSecrets } from "../lib/fleet-transcript-store.ts";
|
|
5
5
|
import { RECOVERY_CATEGORIES, type RecoveryCategory } from "./recovery-contract.ts";
|
|
6
|
-
import { readWatchdogEvents } from "./system1-report.ts";
|
|
6
|
+
import { readWatchdogEvents, buildProactiveReport, readProactiveReport, type ProactiveReportInput } from "./system1-report.ts";
|
|
7
7
|
import { projectWatchdogReadback } from "./system1-activity.ts";
|
|
8
8
|
import { createNoProgressGuard, projectRecoveryRows } from './no-progress.ts';
|
|
9
9
|
|
|
@@ -51,6 +51,7 @@ export interface SessionAuditSummary {
|
|
|
51
51
|
snapshots: Array<{ snapshotId: string }>;
|
|
52
52
|
};
|
|
53
53
|
events: SessionAuditEvent[];
|
|
54
|
+
proactive: ReturnType<typeof buildProactiveReport> | ReturnType<typeof readProactiveReport>;
|
|
54
55
|
unavailable: string[];
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -76,7 +77,7 @@ function runtimeResult(details: Record<string, any> | null): Record<string, any>
|
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
/** Build an allowlisted audit from runtime-owned records. Prompt, output, payload, paths and environment values are never copied. */
|
|
79
|
-
export function buildSessionAudit(input: { entries: readonly unknown[]; sessionDir: string }): SessionAuditSummary {
|
|
80
|
+
export function buildSessionAudit(input: { entries: readonly unknown[]; sessionDir: string; proactive?: ProactiveReportInput }): SessionAuditSummary {
|
|
80
81
|
const unavailable = new Set<string>(), meta = readJson(join(input.sessionDir, "session.json"));
|
|
81
82
|
const rootSessionId = runtimeId(meta?.sessionId) ?? runtimeId(basename(input.sessionDir));
|
|
82
83
|
if (!meta) unavailable.add("root_session_metadata");
|
|
@@ -215,12 +216,12 @@ export function buildSessionAudit(input: { entries: readonly unknown[]; sessionD
|
|
|
215
216
|
return {
|
|
216
217
|
schema: "agent-fleet.session-audit/v1", readOnly: true,
|
|
217
218
|
identity: { rootSessionId, children: [...children].map(([dispatchId, sessionId]) => ({ dispatchId, sessionId })), snapshots: [...snapshots].map(snapshotId => ({ snapshotId })) },
|
|
218
|
-
events: [...deduped.values()], unavailable: [...unavailable].sort(),
|
|
219
|
+
events: [...deduped.values()], proactive: input.proactive ? buildProactiveReport(input.proactive) : readProactiveReport(input.sessionDir), unavailable: [...unavailable].sort(),
|
|
219
220
|
};
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
export function formatSessionAudit(summary: SessionAuditSummary): string { return JSON.stringify(summary, null, 2); }
|
|
223
224
|
|
|
224
|
-
export async function showSessionAudit(ctx: ExtensionContext, sessionDir: string): Promise<void> {
|
|
225
|
-
ctx.ui.notify(formatSessionAudit(buildSessionAudit({ entries: ctx.sessionManager.getEntries(), sessionDir })), "info");
|
|
225
|
+
export async function showSessionAudit(ctx: ExtensionContext, sessionDir: string, proactive?: ProactiveReportInput): Promise<void> {
|
|
226
|
+
ctx.ui.notify(formatSessionAudit(buildSessionAudit({ entries: ctx.sessionManager.getEntries(), sessionDir, proactive })), "info");
|
|
226
227
|
}
|
|
@@ -441,3 +441,70 @@ export function projectWatchdogReadback(events: readonly WatchdogTraceRecord[]):
|
|
|
441
441
|
}
|
|
442
442
|
return [...checks.values()];
|
|
443
443
|
}
|
|
444
|
+
|
|
445
|
+
/** Separate proactive consumer in the existing session activity store; never stores evidence payloads. */
|
|
446
|
+
export const PROACTIVE_TRACE_SCHEMA = "proactive-review-trace/v1";
|
|
447
|
+
export interface ProactiveTraceRecord {
|
|
448
|
+
readonly schema: typeof PROACTIVE_TRACE_SCHEMA;
|
|
449
|
+
readonly consumer: "proactive-review";
|
|
450
|
+
readonly type: "job_started" | "job_finished" | "evaluation_started" | "evaluation_finished";
|
|
451
|
+
readonly sessionId: string; readonly jobId: string; readonly evaluationId?: string;
|
|
452
|
+
readonly sequence: number; readonly at: number;
|
|
453
|
+
readonly status?: "reviewed" | "not_checked" | "superseded" | "queue_timeout" | "backlog_full" | "session_budget" | "cancelled" | "unavailable" | "no_new_evidence" | "not_instrumented" | "ok";
|
|
454
|
+
}
|
|
455
|
+
export function createProactiveActivity(options: { directory?: string; sessionId?: string; now?: () => number; write?: (line: string) => void } = {}) {
|
|
456
|
+
const path = options.directory ? join(options.directory, "proactive-events.jsonl") : null;
|
|
457
|
+
const sessionId = randomUUID(); // Never copy a caller-supplied session/task string into metadata.
|
|
458
|
+
const jobs = new Map<string, boolean>();
|
|
459
|
+
const evaluations = new Map<string, boolean>();
|
|
460
|
+
const events: ProactiveTraceRecord[] = [];
|
|
461
|
+
let sequence = 0, degraded = false;
|
|
462
|
+
const append = (type: ProactiveTraceRecord["type"], jobId: string, evaluationId?: string, status?: ProactiveTraceRecord["status"]) => {
|
|
463
|
+
const safe = new Set(["reviewed", "not_checked", "superseded", "queue_timeout", "backlog_full", "session_budget", "cancelled", "unavailable", "no_new_evidence", "not_instrumented", "ok"]);
|
|
464
|
+
const record: ProactiveTraceRecord = { schema: PROACTIVE_TRACE_SCHEMA, consumer: "proactive-review", type, sessionId, jobId, ...(evaluationId ? { evaluationId } : {}), sequence: ++sequence, at: (options.now ?? Date.now)(), ...(status ? { status: safe.has(status) ? status : "unavailable" } : {}) };
|
|
465
|
+
events.push(record); if (events.length > COMPLETED_LIMIT * 4) events.shift();
|
|
466
|
+
try { if (options.write) options.write(`${JSON.stringify(record)}\n`); else if (path) secureAppend(path, `${JSON.stringify(record)}\n`); } catch { degraded = true; }
|
|
467
|
+
};
|
|
468
|
+
const valid = (id: string) => /^[a-f0-9]{64}$/.test(id);
|
|
469
|
+
return {
|
|
470
|
+
get path() { return path; }, get degraded() { return degraded; },
|
|
471
|
+
live() { return events.slice(); },
|
|
472
|
+
jobStarted(id: string) { if (!valid(id) || jobs.has(id)) return; jobs.set(id, false); append("job_started", id); },
|
|
473
|
+
jobFinished(id: string, status: ProactiveTraceRecord["status"]) { if (!jobs.has(id) || jobs.get(id)) return; jobs.set(id, true); append("job_finished", id, undefined, status); },
|
|
474
|
+
evaluationStarted(jobId: string, id: string) { if (!jobs.has(jobId) || jobs.get(jobId) || !valid(id) || evaluations.has(id)) return; evaluations.set(id, false); append("evaluation_started", jobId, id); },
|
|
475
|
+
evaluationFinished(jobId: string, id: string, status: ProactiveTraceRecord["status"]) { if (!evaluations.has(id) || evaluations.get(id)) return; evaluations.set(id, true); append("evaluation_finished", jobId, id, status); },
|
|
476
|
+
dispose() { for (const [id, done] of evaluations) if (!done) { const job = events.find(e => e.evaluationId === id)?.jobId; if (job) this.evaluationFinished(job, id, "cancelled"); } for (const [id, done] of jobs) if (!done) this.jobFinished(id, "cancelled"); jobs.clear(); evaluations.clear(); },
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
/** Crash readback treats open spans as unavailable, never as a passed review. */
|
|
480
|
+
export function projectProactiveReadback(events: readonly ProactiveTraceRecord[]) {
|
|
481
|
+
const jobs = new Map<string, { jobId: string; status: string; evaluations: { id: string; status: string }[] }>();
|
|
482
|
+
for (const event of events) {
|
|
483
|
+
if (event.schema !== PROACTIVE_TRACE_SCHEMA || event.consumer !== "proactive-review" || !/^[a-f0-9]{64}$/.test(event.jobId)) continue;
|
|
484
|
+
const job = jobs.get(event.jobId) ?? { jobId: event.jobId, status: "unavailable", evaluations: [] };
|
|
485
|
+
if (event.type === "job_finished") job.status = event.status ?? "unavailable";
|
|
486
|
+
if (event.type === "evaluation_started" && event.evaluationId) job.evaluations.push({ id: event.evaluationId, status: "unavailable" });
|
|
487
|
+
if (event.type === "evaluation_finished" && event.evaluationId) { const slot = job.evaluations.find(e => e.id === event.evaluationId); if (slot) slot.status = event.status ?? "unavailable"; }
|
|
488
|
+
jobs.set(event.jobId, job);
|
|
489
|
+
}
|
|
490
|
+
return [...jobs.values()].slice(-COMPLETED_LIMIT);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** Durable metadata only; incomplete tail and malformed records cannot manufacture completion. */
|
|
494
|
+
export function readProactiveTrace(path: string, options: { after?: number; limit?: number } = {}) {
|
|
495
|
+
let text = "";
|
|
496
|
+
try { text = readFileSync(path, "utf8"); } catch { return { events: [] as ProactiveTraceRecord[], nextOffset: options.after ?? 0, invalidRecords: 0, partialTail: false, readError: true }; }
|
|
497
|
+
const lines = text.split("\n").slice(0, -1);
|
|
498
|
+
const after = Math.max(0, options.after ?? 0), page = lines.slice(after, after + Math.min(100, Math.max(1, options.limit ?? 100)));
|
|
499
|
+
const events: ProactiveTraceRecord[] = []; let invalidRecords = 0;
|
|
500
|
+
const types = new Set(["job_started", "job_finished", "evaluation_started", "evaluation_finished"]);
|
|
501
|
+
const statuses = new Set(["reviewed", "not_checked", "superseded", "queue_timeout", "backlog_full", "session_budget", "cancelled", "unavailable", "no_new_evidence", "not_instrumented", "ok"]);
|
|
502
|
+
for (const line of page) {
|
|
503
|
+
try {
|
|
504
|
+
const v: unknown = JSON.parse(line);
|
|
505
|
+
if (!isRecord(v) || Object.keys(v).some(k => !["schema", "consumer", "type", "sessionId", "jobId", "evaluationId", "sequence", "at", "status"].includes(k)) || v.schema !== PROACTIVE_TRACE_SCHEMA || v.consumer !== "proactive-review" || !types.has(v.type as string) || typeof v.sessionId !== "string" || !/^[a-f0-9-]{36}$/.test(v.sessionId) || typeof v.jobId !== "string" || !/^[a-f0-9]{64}$/.test(v.jobId) || (v.evaluationId !== undefined && (typeof v.evaluationId !== "string" || !/^[a-f0-9]{64}$/.test(v.evaluationId))) || !Number.isSafeInteger(v.sequence) || typeof v.at !== "number" || !Number.isFinite(v.at) || (v.status !== undefined && !statuses.has(v.status as string))) { invalidRecords++; continue; }
|
|
506
|
+
events.push(v as unknown as ProactiveTraceRecord);
|
|
507
|
+
} catch { invalidRecords++; }
|
|
508
|
+
}
|
|
509
|
+
return { events, nextOffset: after + page.length, invalidRecords, partialTail: text.length > 0 && !text.endsWith("\n"), readError: false };
|
|
510
|
+
}
|