@chankov/agent-fleet 2.0.19 → 2.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/agent-fleet/scripts/coms-claude-bridge.ts +5 -5
- package/.pi/extensions/compact-and-continue/index.ts +18 -2
- package/.pi/harnesses/agent-hub/README.md +163 -130
- package/.pi/harnesses/agent-hub/access-approval.ts +15 -9
- package/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
- package/.pi/harnesses/agent-hub/agentic-sources.ts +1 -1
- package/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
- package/.pi/harnesses/agent-hub/assist-profile.ts +3 -0
- package/.pi/harnesses/agent-hub/budget-recovery.ts +4 -95
- package/.pi/harnesses/agent-hub/commands/context.ts +0 -1
- package/.pi/harnesses/agent-hub/config/model-profiles.ts +3 -2
- package/.pi/harnesses/agent-hub/config/overrides.ts +2 -2
- package/.pi/harnesses/agent-hub/context/budgets.ts +12 -66
- package/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
- package/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
- package/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
- package/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
- package/.pi/harnesses/agent-hub/context-continuity-broker.ts +42 -0
- package/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
- package/.pi/harnesses/agent-hub/context-continuity-client.ts +19 -0
- package/.pi/harnesses/agent-hub/context-continuity-compat.ts +30 -0
- package/.pi/harnesses/agent-hub/context-continuity-owners.ts +15 -0
- package/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
- package/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
- package/.pi/harnesses/agent-hub/context-pressure.ts +37 -6
- package/.pi/harnesses/agent-hub/damage-guard-approval.ts +59 -0
- package/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
- package/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
- package/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
- package/.pi/harnesses/agent-hub/damage-guard-hub.ts +249 -0
- package/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
- package/.pi/harnesses/agent-hub/damage-guard-owners.ts +54 -0
- package/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
- package/.pi/harnesses/agent-hub/delegate.ts +4 -4
- package/.pi/harnesses/agent-hub/deterministic-fs.ts +33 -7
- package/.pi/harnesses/agent-hub/dispatch-coms.ts +3 -2
- package/.pi/harnesses/agent-hub/dispatch-native-complete.ts +1 -1
- package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +32 -7
- package/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +24 -4
- package/.pi/harnesses/agent-hub/dispatch-native-types.ts +26 -0
- package/.pi/harnesses/agent-hub/dispatch-native.ts +2 -0
- package/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
- package/.pi/harnesses/agent-hub/file-discovery/adapters.ts +9 -3
- package/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +10 -4
- package/.pi/harnesses/agent-hub/file-discovery/broker.ts +8 -5
- package/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +17 -8
- package/.pi/harnesses/agent-hub/file-discovery/descendant.ts +5 -1
- package/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +1 -1
- package/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +14 -5
- package/.pi/harnesses/agent-hub/file-discovery/hub.ts +33 -16
- package/.pi/harnesses/agent-hub/file-discovery/results.ts +7 -6
- package/.pi/harnesses/agent-hub/file-discovery/runtime.ts +21 -11
- package/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
- package/.pi/harnesses/agent-hub/file-discovery/sources.ts +2 -2
- package/.pi/harnesses/agent-hub/filesystem-tool.ts +6 -25
- package/.pi/harnesses/agent-hub/history-projection.ts +116 -0
- package/.pi/harnesses/agent-hub/hub-state-audit.js +0 -24
- package/.pi/harnesses/agent-hub/index.ts +102 -113
- package/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +122 -24
- package/.pi/harnesses/agent-hub/no-progress.ts +42 -15
- package/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
- package/.pi/harnesses/agent-hub/orchestration-activation.ts +18 -21
- package/.pi/harnesses/agent-hub/orchestration-route.ts +8 -16
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/policy/work-mode.ts +8 -3
- package/.pi/harnesses/agent-hub/proactive-runtime.ts +1 -1
- package/.pi/harnesses/agent-hub/process-obligations.ts +23 -22
- package/.pi/harnesses/agent-hub/prompts/context.ts +1 -2
- package/.pi/harnesses/agent-hub/prompts/fragments.ts +21 -30
- package/.pi/harnesses/agent-hub/prompts/session-start.ts +1 -1
- package/.pi/harnesses/agent-hub/recovery-contract.ts +2 -1
- package/.pi/harnesses/agent-hub/research/runtime.ts +14 -0
- package/.pi/harnesses/agent-hub/research/spawn-run.ts +41 -14
- package/.pi/harnesses/agent-hub/review-continuity.ts +73 -0
- package/.pi/harnesses/agent-hub/review-findings.js +2 -10
- package/.pi/harnesses/agent-hub/review-reuse.ts +47 -0
- package/.pi/harnesses/agent-hub/run-budget.js +17 -229
- package/.pi/harnesses/agent-hub/scope-gate.js +99 -15
- package/.pi/harnesses/agent-hub/session-audit.ts +22 -4
- package/.pi/harnesses/agent-hub/spawn.ts +87 -11
- package/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
- package/.pi/harnesses/agent-hub/specialist-result.ts +69 -0
- package/.pi/harnesses/agent-hub/system1-communication-store.ts +29 -2
- package/.pi/harnesses/agent-hub/system1-runtime.ts +7 -0
- package/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
- package/.pi/harnesses/agent-hub/task-triage-authorization.ts +43 -14
- package/.pi/harnesses/agent-hub/task-triage-config.ts +5 -14
- package/.pi/harnesses/agent-hub/task-triage-obligations.ts +17 -1
- package/.pi/harnesses/agent-hub/task-triage-runtime.ts +15 -10
- package/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +1 -1
- package/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +18 -7
- package/.pi/harnesses/agent-hub/tools/action-executors.ts +11 -10
- package/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +2 -2
- package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +144 -64
- package/.pi/harnesses/agent-hub/ui/context-budget.ts +5 -3
- package/.pi/harnesses/agent-hub/ui/grid.ts +1 -1
- package/.pi/harnesses/agent-hub/work-mode.ts +3 -4
- package/.pi/harnesses/ask-user-remote/index.ts +13 -2
- package/.pi/harnesses/ask-user-remote/questions.ts +4 -6
- package/.pi/harnesses/ask-user-remote/runtime-ask.ts +16 -1
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/README.md +26 -0
- package/.pi/harnesses/damage-control-continue/index.ts +87 -20
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
- package/.pi/harnesses/damage-control-continue/system1-child.ts +35 -0
- package/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
- package/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
- package/.pi/harnesses/lib/approval-wait.ts +17 -0
- package/.pi/harnesses/lib/bash-policy-analysis.ts +155 -0
- package/.pi/harnesses/lib/clarification-policy.ts +9 -0
- package/.pi/harnesses/lib/coms-core-io.ts +2 -1
- package/.pi/harnesses/lib/coms-core.ts +3 -2
- package/.pi/harnesses/lib/coms-registry-entry.ts +4 -2
- package/.pi/harnesses/lib/context-budget-child-prompt.ts +8 -14
- package/.pi/harnesses/lib/context-budget-view.ts +5 -0
- package/.pi/harnesses/lib/context-compaction-policy.js +35 -0
- package/.pi/harnesses/lib/damage-action-hash.ts +28 -0
- package/.pi/harnesses/lib/damage-control-shared.ts +3 -0
- package/.pi/harnesses/lib/damage-guard-port.ts +25 -0
- package/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
- package/.pi/harnesses/lib/damage-result-view.ts +16 -0
- package/.pi/harnesses/lib/execution-trace.ts +45 -0
- package/.pi/harnesses/lib/herdr-presence.ts +4 -4
- package/.pi/harnesses/lib/identical-dialog.ts +27 -0
- package/.pi/harnesses/lib/installation-state.js +62 -0
- package/.pi/harnesses/lib/process-shared.ts +9 -0
- package/.pi/harnesses/lib/semantic-approval.ts +80 -0
- package/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
- package/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
- package/.pi/harnesses/lib/system1/config-file-discovery.js +4 -2
- package/.pi/harnesses/lib/system1/config-v2.js +11 -5
- package/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
- package/.pi/harnesses/lib/system1/service.ts +1 -1
- package/.pi/harnesses/package-lock.json +1041 -959
- package/.pi/harnesses/package.json +3 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.20/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.20/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/coms-claude-bridge.ts +437 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/fleet.ts +217 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/flow.ts +157 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +36 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.20/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.20/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.20/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.20/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.20/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.20/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.20/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.20/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.20/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.20/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.20/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.20/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.20/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.20/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.20/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.20/.pi/extensions/compact-and-continue/index.ts +136 -0
- package/.versions/2.0.20/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.20/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.20/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.20/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.20/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.20/.pi/extensions/package.json +9 -0
- package/.versions/2.0.20/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.20/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.20/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.20/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.20/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.20/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.20/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/README.md +1516 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/acceptance.ts +199 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/access-approval.ts +141 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/agentic-hub.ts +54 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/context.ts +46 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/config/agents.ts +178 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/config/model-profiles.ts +237 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/config/overrides.ts +165 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-continuity-broker.ts +42 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-continuity-client.ts +19 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-continuity-compat.ts +30 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-continuity-owners.ts +15 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/damage-guard-approval.ts +59 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/damage-guard-hub.ts +249 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/damage-guard-owners.ts +54 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-coms.ts +253 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +295 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +253 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-native-types.ts +293 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-native.ts +236 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/hub.ts +169 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/fixtures/registration-surface.json +66 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/history-projection.ts +116 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/index.ts +2614 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +144 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/no-progress.ts +620 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/policy/work-mode.ts +142 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-config.ts +21 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-snapshot.ts +271 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/proactive-types.ts +67 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/process-obligations.ts +159 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/prompts/context.ts +55 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/prompts/fragments.ts +86 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/return-contract.js +349 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/review-continuity.ts +73 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/review-findings.js +96 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/review-reuse.ts +47 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/run-budget.js +342 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/scope-gate.js +228 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/session-audit.ts +331 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/spawn.ts +639 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/specialist-result.ts +69 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/system1-communication-store.ts +217 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/system1-runtime.ts +265 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-authorization.ts +151 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-config.ts +20 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-runtime.ts +130 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +79 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/action-executors.ts +214 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/context.ts +144 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +640 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/herdr-executors.ts +95 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/work-mode.ts +186 -0
- package/.versions/2.0.20/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.20/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.20/.pi/harnesses/ask-user-remote/index.ts +569 -0
- package/.versions/2.0.20/.pi/harnesses/ask-user-remote/questions.ts +159 -0
- package/.versions/2.0.20/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.20/.pi/harnesses/ask-user-remote/runtime-ask.ts +83 -0
- package/.versions/2.0.20/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.20/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.20/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.20/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.20/.pi/harnesses/damage-control-continue/README.md +161 -0
- package/.versions/2.0.20/.pi/harnesses/damage-control-continue/index.ts +600 -0
- package/.versions/2.0.20/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.20/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
- package/.versions/2.0.20/.pi/harnesses/damage-control-continue/system1-child.ts +35 -0
- package/.versions/2.0.20/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
- package/.versions/2.0.20/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
- package/.versions/2.0.20/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.20/.pi/harnesses/lib/approval-wait.ts +17 -0
- package/.versions/2.0.20/.pi/harnesses/lib/bash-policy-analysis.ts +155 -0
- package/.versions/2.0.20/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.20/.pi/harnesses/lib/clarification-policy.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/lib/coms-core-io.ts +386 -0
- package/.versions/2.0.20/.pi/harnesses/lib/coms-core.ts +578 -0
- package/.versions/2.0.20/.pi/harnesses/lib/coms-registry-entry.ts +96 -0
- package/.versions/2.0.20/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
- package/.versions/2.0.20/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.0.20/.pi/harnesses/lib/context-budget-view.ts +112 -0
- package/.versions/2.0.20/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.20/.pi/harnesses/lib/context-compaction-policy.js +35 -0
- package/.versions/2.0.20/.pi/harnesses/lib/damage-action-hash.ts +28 -0
- package/.versions/2.0.20/.pi/harnesses/lib/damage-control-shared.ts +229 -0
- package/.versions/2.0.20/.pi/harnesses/lib/damage-guard-port.ts +25 -0
- package/.versions/2.0.20/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
- package/.versions/2.0.20/.pi/harnesses/lib/damage-result-view.ts +16 -0
- package/.versions/2.0.20/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.0.20/.pi/harnesses/lib/execution-trace.ts +45 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.20/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.20/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.20/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.20/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.20/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.20/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.20/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.20/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.20/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.20/.pi/harnesses/lib/identical-dialog.ts +27 -0
- package/.versions/2.0.20/.pi/harnesses/lib/installation-state.js +62 -0
- package/.versions/2.0.20/.pi/harnesses/lib/policy-roots.js +106 -0
- package/.versions/2.0.20/.pi/harnesses/lib/policy-roots.ts +31 -0
- package/.versions/2.0.20/.pi/harnesses/lib/process-shared.ts +9 -0
- package/.versions/2.0.20/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.0.20/.pi/harnesses/lib/semantic-approval.ts +80 -0
- package/.versions/2.0.20/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config-loader.js +44 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config-v2.js +112 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.0.20/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.20/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.20/.pi/harnesses/package-lock.json +2121 -0
- package/.versions/2.0.20/.pi/harnesses/package.json +13 -0
- package/.versions/2.0.20/.pi/prompts/af-build.md +27 -0
- package/.versions/2.0.20/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.20/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.20/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.20/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.20/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.20/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.20/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.20/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.20/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.20/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.20/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.20/.version +1 -0
- package/.versions/2.0.20/agents/architect.md +24 -0
- package/.versions/2.0.20/agents/bowser.md +28 -0
- package/.versions/2.0.20/agents/builder.md +55 -0
- package/.versions/2.0.20/agents/code-reviewer.md +209 -0
- package/.versions/2.0.20/agents/deep-researcher.md +32 -0
- package/.versions/2.0.20/agents/documenter.md +22 -0
- package/.versions/2.0.20/agents/orchestrator.md +22 -0
- package/.versions/2.0.20/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.20/agents/planner.md +107 -0
- package/.versions/2.0.20/agents/releaser.md +24 -0
- package/.versions/2.0.20/agents/researcher.md +30 -0
- package/.versions/2.0.20/agents/security-auditor.md +167 -0
- package/.versions/2.0.20/agents/test-engineer.md +153 -0
- package/.versions/2.0.20/agents/web-debugger.md +44 -0
- package/.versions/2.0.20/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.20/bin/catalog/harness-runtime-closure.json +73 -0
- package/.versions/2.0.20/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.20/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.20/docs/ARCHITECTURE.md +977 -0
- package/.versions/2.0.20/docs/agent-fleet-setup.md +1103 -0
- package/.versions/2.0.20/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.0.20/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.20/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.20/docs/getting-started.md +126 -0
- package/.versions/2.0.20/docs/npm-install.md +535 -0
- package/.versions/2.0.20/docs/pi-extensions.md +455 -0
- package/.versions/2.0.20/docs/pi-setup.md +92 -0
- package/.versions/2.0.20/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.20/install-manifest.json +3210 -0
- package/.versions/2.0.20/justfile +247 -0
- package/.versions/2.0.20/manifest-meta.json +1088 -0
- package/.versions/2.0.20/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.20/references/communication-contract.md +26 -0
- package/.versions/2.0.20/references/definition-of-done.md +67 -0
- package/.versions/2.0.20/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.20/references/observability-checklist.md +92 -0
- package/.versions/2.0.20/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.20/references/performance-checklist.md +236 -0
- package/.versions/2.0.20/references/prompting-patterns.md +380 -0
- package/.versions/2.0.20/references/security-checklist.md +245 -0
- package/.versions/2.0.20/references/testing-patterns.md +235 -0
- package/.versions/2.0.20/references/workflow-authoring.md +304 -0
- package/.versions/2.0.20/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.20/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.20/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.20/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.20/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.20/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.20/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.20/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.20/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.20/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.20/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.20/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.20/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.20/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.20/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.20/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.20/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.20/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.20/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.20/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.0.20/skills/incremental-implementation.zip +0 -0
- package/.versions/2.0.20/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.20/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.20/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.20/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.20/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.0.20/skills/planning-and-task-breakdown.zip +0 -0
- package/.versions/2.0.20/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.0.20/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.20/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.20/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.20/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.20/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.20/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.0.20/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.20/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.20/skills/spec-driven-development.zip +0 -0
- package/.versions/2.0.20/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.20/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +32 -0
- package/README.md +3 -2
- package/agents/builder.md +1 -1
- package/agents/planner.md +6 -4
- package/bin/cli.js +9 -2
- package/bin/lib/apply.js +4 -0
- package/bin/lib/desired.js +2 -0
- package/bin/lib/doctor.js +13 -7
- package/bin/lib/state.js +7 -4
- package/bin/lib/transaction.js +6 -1
- package/bin/lib/validate-overrides.js +7 -3
- package/bin/lib/verify.js +9 -2
- package/docs/ARCHITECTURE.md +177 -74
- package/docs/agent-fleet-setup.md +10 -8
- package/docs/external-project-ai-content.md +17 -2
- package/docs/pi-extensions.md +7 -6
- package/docs/system1-agentic.md +4 -4
- package/docs/system1-config.md +144 -1
- package/docs/system1-context-continuity.md +224 -0
- package/docs/system1-damage-guard.md +172 -0
- package/docs/system1-dispatch-triage.md +169 -0
- package/docs/system1-file-discovery.md +16 -4
- package/docs/system1.example.json +102 -0
- package/install-manifest.json +17 -4
- package/manifest-meta.json +14 -1
- package/package.json +21 -9
- package/skills/_internal/grilling.md +54 -54
- package/skills/incremental-implementation/SKILL.md +8 -8
- package/skills/incremental-implementation.zip +0 -0
- package/skills/planning-and-task-breakdown/SKILL.md +7 -7
- package/skills/planning-and-task-breakdown.zip +0 -0
- package/skills/spec-driven-development/SKILL.md +1 -1
- package/skills/spec-driven-development.zip +0 -0
- package/.pi/harnesses/agent-hub/budget-continuation.ts +0 -13
- package/.pi/harnesses/agent-hub/commands/budget-continue.ts +0 -10
|
@@ -63,6 +63,7 @@ export function createWorkModePolicy(ports: WorkModePolicyPorts, initial: WorkMo
|
|
|
63
63
|
let provisionalPacks: CapabilityPack[] = [];
|
|
64
64
|
let confirmation: CapabilityConfirmationState = {};
|
|
65
65
|
let currentExplicitCompaction = false;
|
|
66
|
+
let persistedState: string | null = null;
|
|
66
67
|
let resolution = resolveCapabilityPacks({ workMode, userText: "", taskPacks: [], comsReady: false, herdrReady: false, pendingOperations: [], contextState: "normal" });
|
|
67
68
|
|
|
68
69
|
function resolveIncomingCapabilities(userText: string, newTask = false, refresh = false): void {
|
|
@@ -87,7 +88,11 @@ export function createWorkModePolicy(ports: WorkModePolicyPorts, initial: WorkMo
|
|
|
87
88
|
}
|
|
88
89
|
taskPacks = resolution.nextTaskPacks = CAPABILITY_PACKS.filter(pack => pack !== "core" && pack !== "compaction" && resolution.active.includes(pack));
|
|
89
90
|
provisionalPacks = resolution.provisional.filter(pack => confirmation[pack as ConfirmableCapabilityPack] !== "declined");
|
|
90
|
-
|
|
91
|
+
const snapshot = persistedCapabilityState(resolution, confirmation);
|
|
92
|
+
const key = JSON.stringify(snapshot);
|
|
93
|
+
if (key !== persistedState) {
|
|
94
|
+
try { ports.persist("agent-hub-capability-packs", snapshot); persistedState = key; } catch { /* retry next refresh */ }
|
|
95
|
+
}
|
|
91
96
|
}
|
|
92
97
|
function applyWorkModeTools(fromMode: WorkMode = workMode, reason: "refresh" | "mode_switch" = "refresh"): void {
|
|
93
98
|
const previous = [...(ports.getActiveTools?.() ?? [])];
|
|
@@ -125,8 +130,8 @@ export function createWorkModePolicy(ports: WorkModePolicyPorts, initial: WorkMo
|
|
|
125
130
|
getWorkMode: () => workMode, setRestoredWorkMode: mode => { workMode = mode; },
|
|
126
131
|
getCapabilityResolution: () => resolution, getCapabilityConfirmation: () => confirmation,
|
|
127
132
|
setCapabilityConfirmation: (pack, status) => { if (status) confirmation[pack] = status; else delete confirmation[pack]; },
|
|
128
|
-
restoreCapabilities: state => { taskPacks = [...state.taskPacks]; provisionalPacks = [...state.provisional]; confirmation = { ...state.confirmation }; currentExplicitCompaction = false; },
|
|
129
|
-
resetCapabilities: () => { taskPacks = []; provisionalPacks = []; confirmation = {}; currentExplicitCompaction = false; },
|
|
133
|
+
restoreCapabilities: state => { persistedState = null; taskPacks = [...state.taskPacks]; provisionalPacks = [...state.provisional]; confirmation = { ...state.confirmation }; currentExplicitCompaction = false; },
|
|
134
|
+
resetCapabilities: () => { persistedState = null; taskPacks = []; provisionalPacks = []; confirmation = {}; currentExplicitCompaction = false; },
|
|
130
135
|
resolveIncomingCapabilities, refreshCapabilities: () => resolveIncomingCapabilities("", false, true),
|
|
131
136
|
provisionalCapabilityRefusal: pack => { const gate = confirmationGate(confirmation, pack, resolution.provisional.includes(pack)); return gate.allowed ? null : { content: [{ type: "text", text: gate.message }], details: { status: "provisional_confirmation_required", confirmation: gate.status, pack } }; },
|
|
132
137
|
applyWorkModeTools, updateStatus: ctx => ctx.ui.setStatus("hub-work-mode", `Work Mode: ${workMode}`), statusText,
|
|
@@ -43,7 +43,7 @@ function paths(snapshot: TurnSnapshot): string[] { return [...new Set(snapshot.u
|
|
|
43
43
|
interface Entry { owner: string; attempt: string; snapshot: TurnSnapshot; queued: number; controller: AbortController; carry: string[]; jobId: string; evaluationIds: string[]; closed: boolean }
|
|
44
44
|
export function createProactiveRuntime(options: ReviewRuntimeOptions) {
|
|
45
45
|
const now = options.now ?? Date.now;
|
|
46
|
-
const setTimer = options.setTimer ?? setTimeout;
|
|
46
|
+
const setTimer = options.setTimer ?? ((fn:()=>void,ms:number)=>setTimeout(fn,ms));
|
|
47
47
|
const clearTimer = options.clearTimer ?? clearTimeout;
|
|
48
48
|
const enabled = options.config.mode !== "off";
|
|
49
49
|
const pending: Entry[] = [];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeReviewEvidence, type ReviewEvidence } from "./review-reuse.ts";
|
|
1
2
|
import { consumeActionGrant, type ActionContract, type ActionGrant } from "./task-triage-authorization.ts";
|
|
2
3
|
|
|
3
4
|
export const PROCESS_OBLIGATIONS_SCHEMA = "agent-fleet.process-obligations/v1" as const;
|
|
@@ -13,6 +14,8 @@ export interface ProcessObligationState {
|
|
|
13
14
|
acceptance: ProcessStageState; review: ProcessStageState; plan: ProcessStageState;
|
|
14
15
|
reassessments: number; lastReason: string | null; appliedRuleIds: string[]; changedFiles: string[];
|
|
15
16
|
additions?: ProcessAddition[];
|
|
17
|
+
reviews?: ReviewEvidence[];
|
|
18
|
+
reviewHistory?: ReviewEvidence[];
|
|
16
19
|
}
|
|
17
20
|
export interface ProcessClassificationInput { risk?: string; scope?: string; reason?: string; newTask?: boolean; }
|
|
18
21
|
export interface ProcessVerdict {
|
|
@@ -29,17 +32,19 @@ export function createProcessState(): ProcessObligationState { return { schema:
|
|
|
29
32
|
export function normalizeProcessState(value: unknown): ProcessObligationState {
|
|
30
33
|
const row = value && typeof value === "object" ? value as any : {}, state = createProcessState();
|
|
31
34
|
if (RISKS.has(row.risk)) state.risk = row.risk; if (SCOPES.has(row.scope)) state.scope = row.scope;
|
|
32
|
-
for (const key of ["acceptance", "review", "plan"] as const) { const stage = row[key] && typeof row[key] === "object" ? row[key] : {}; state[key] = { required: key === "acceptance" || stage.required === true || key === "review" && (state.risk === "high" || state.scope === "wide")
|
|
33
|
-
//
|
|
35
|
+
for (const key of ["acceptance", "review", "plan"] as const) { const stage = row[key] && typeof row[key] === "object" ? row[key] : {}; state[key] = { required: key !== "plan" && (key === "acceptance" || stage.required === true || key === "review" && (state.risk === "high" || state.scope === "wide")), evidenceRef: typeof stage.evidenceRef === "string" && stage.evidenceRef ? stage.evidenceRef : null, revision: typeof stage.revision === "string" && stage.revision ? stage.revision : null }; }
|
|
36
|
+
// Review/acceptance remain independent of S1. Planning is optional under the current policy; retain old evidence and source additions.
|
|
34
37
|
if (Array.isArray(row.additions) && (row.additions.length > 300 || Buffer.byteLength(JSON.stringify(row.additions)) > 64 * 1024)) throw new Error("Process additions exceed the persistence limit; dependent effects are blocked.");
|
|
38
|
+
if(Array.isArray(row.reviews))state.reviews=normalizeReviewEvidence(row.reviews);
|
|
39
|
+
if(Array.isArray(row.reviewHistory))state.reviewHistory=normalizeReviewEvidence(row.reviewHistory);
|
|
35
40
|
state.additions = Array.isArray(row.additions) ? row.additions.map((a: any) => {
|
|
36
41
|
if (!a || a.source !== "system1" || typeof a.id !== "string" || !a.id || !["taskId", "evaluationId", "inputRevision", "policyVersion", "questionVersion", "provider", "model"].every(k => typeof a[k] === "string" && a[k]) || !["security_change", "wide_change", "irreversible_execution"].includes(a.reason) || !["active", "waived"].includes(a.status) || a.status === "waived" && (typeof a.waiverReason !== "string" || !a.waiverReason)) throw new Error("Invalid process addition; dependent effects are blocked.");
|
|
37
42
|
return { id: a.id, source: "system1" as const, taskId: a.taskId, evaluationId: a.evaluationId, inputRevision: a.inputRevision, policyVersion: a.policyVersion, questionVersion: a.questionVersion, provider: a.provider, model: a.model, reason: a.reason, status: a.status, waiverReason: a.status === "waived" ? a.waiverReason : null };
|
|
38
43
|
}) : [];
|
|
39
44
|
state.reassessments = Number.isSafeInteger(row.reassessments) && row.reassessments >= 0 ? row.reassessments : 0; state.lastReason = cleanReason(row.lastReason);
|
|
40
|
-
state.appliedRuleIds = strings(row.appliedRuleIds); state.changedFiles = strings(row.changedFiles); return state;
|
|
45
|
+
state.appliedRuleIds = strings(row.appliedRuleIds).map(id => id === "scope-wide-plan-review" ? "scope-wide-independent-review" : id); state.changedFiles = strings(row.changedFiles); return state;
|
|
41
46
|
}
|
|
42
|
-
function rules(risk: TaskRisk, scope: TaskScope): string[] { return [...new Set([risk === "unknown" ? "risk-unknown-fail-closed" : risk === "high" ? "risk-high-independent-review" : "risk-low-minimal-acceptance", scope === "wide" ? "scope-wide-
|
|
47
|
+
function rules(risk: TaskRisk, scope: TaskScope): string[] { return [...new Set([risk === "unknown" ? "risk-unknown-fail-closed" : risk === "high" ? "risk-high-independent-review" : "risk-low-minimal-acceptance", scope === "wide" ? "scope-wide-independent-review" : scope === "read-only" ? "scope-read-only-lightweight" : "scope-changed-task", "budget-tier-spend-only"])]; }
|
|
43
48
|
export function applyProcessClassification(current: ProcessObligationState, input: ProcessClassificationInput): { ok: true; state: ProcessObligationState; message: string } | { ok: false; state: ProcessObligationState; message: string } {
|
|
44
49
|
const reason = cleanReason(input.reason); if (input.newTask && !reason) return { ok: false, state: normalizeProcessState(current), message: "A genuine new task requires a non-empty reason." };
|
|
45
50
|
const base = input.newTask ? createProcessState() : normalizeProcessState(current), risk = input.risk === undefined ? base.risk : String(input.risk).trim().toLowerCase() as TaskRisk, scope = input.scope === undefined ? base.scope : String(input.scope).trim().toLowerCase() as TaskScope;
|
|
@@ -48,20 +53,18 @@ export function applyProcessClassification(current: ProcessObligationState, inpu
|
|
|
48
53
|
if ((riskChanged || scopeExpanded) && !reason) return { ok: false, state: base, message: `${riskChanged ? "Risk change" : "Scope expansion"} requires a non-empty reason.` }; if (scopeExpanded && base.scope !== "unknown" && !riskWasExplicit) return { ok: false, state: base, message: "Scope expansion requires explicit risk reassessment in the same set_task_tier call." };
|
|
49
54
|
const next = normalizeProcessState(base); next.risk = risk; next.scope = scope; next.lastReason = reason ?? next.lastReason; next.appliedRuleIds = rules(risk, scope);
|
|
50
55
|
if (riskWasExplicit && (riskChanged || scopeExpanded || !!reason) || scopeExpanded) next.reassessments++;
|
|
51
|
-
if (risk === "high" || scope === "wide") next.review.required = true;
|
|
52
|
-
if (scopeExpanded) { next.acceptance = { required: true, evidenceRef: null, revision: null }; if (effectiveProcessStage(next, "review")) next.review = { ...next.review, evidenceRef: null, revision: null };
|
|
56
|
+
if (risk === "high" || scope === "wide") next.review.required = true;
|
|
57
|
+
if (scopeExpanded) { next.acceptance = { required: true, evidenceRef: null, revision: null }; if (effectiveProcessStage(next, "review")) next.review = { ...next.review, evidenceRef: null, revision: null }; }
|
|
53
58
|
return { ok: true, state: next, message: `Process classified: risk ${next.risk}, scope ${next.scope}.` };
|
|
54
59
|
}
|
|
55
|
-
export function effectiveProcessStage(state: ProcessObligationState, stage: "plan" | "review" | "confirmation"): boolean { const s = normalizeProcessState(state); return (stage !== "confirmation" && s[stage].required) || !!s.additions?.some(a => a.status === "active" && (stage === "confirmation" ? a.reason === "irreversible_execution" :
|
|
56
|
-
export function noteProcessStage(state: ProcessObligationState, stage: "acceptance" | "plan" | "review", evidence: { evidenceRef: string; revision: string; changedFiles?: string[] }): ProcessObligationState { const next = normalizeProcessState(state); if ((stage === "acceptance" || effectiveProcessStage(next, stage)) && evidence.evidenceRef && evidence.revision) next[stage] = { ...next[stage], evidenceRef: evidence.evidenceRef, revision: evidence.revision }; if (stage === "acceptance" && evidence.changedFiles) next.changedFiles = strings(evidence.changedFiles); return next; }
|
|
57
|
-
export function processOpenObligations(state: ProcessObligationState, revision?: string): string[] { const s = normalizeProcessState(state); return [s.risk === "unknown" ? "risk" : "",
|
|
60
|
+
export function effectiveProcessStage(state: ProcessObligationState, stage: "plan" | "review" | "confirmation"): boolean { if (stage === "plan") return false; const s = normalizeProcessState(state); return (stage !== "confirmation" && s[stage].required) || !!s.additions?.some(a => a.status === "active" && (stage === "confirmation" ? a.reason === "irreversible_execution" : a.reason === "wide_change" || a.reason === "security_change")); }
|
|
61
|
+
export function noteProcessStage(state: ProcessObligationState, stage: "acceptance" | "plan" | "review", evidence: { evidenceRef: string; revision: string; changedFiles?: string[] }): ProcessObligationState { const next = normalizeProcessState(state); if ((stage === "plan" || stage === "acceptance" || effectiveProcessStage(next, stage)) && evidence.evidenceRef && evidence.revision) next[stage] = { ...next[stage], evidenceRef: evidence.evidenceRef, revision: evidence.revision }; if (stage === "acceptance" && evidence.changedFiles) next.changedFiles = strings(evidence.changedFiles); return next; }
|
|
62
|
+
export function processOpenObligations(state: ProcessObligationState, revision?: string): string[] { const s = normalizeProcessState(state); return [s.risk === "unknown" ? "risk" : "", s.acceptance.required && (!s.acceptance.evidenceRef || revision && s.acceptance.revision !== revision) ? "acceptance" : "", effectiveProcessStage(s, "review") && (!s.review.evidenceRef || revision && s.review.revision !== revision) ? "review" : "", effectiveProcessStage(s, "confirmation") ? "action_confirmation" : ""].filter(Boolean); }
|
|
58
63
|
// Recovery guidance is derived from effective obligations, not roster size or model advice.
|
|
59
64
|
export function missingProcessRoleRecoveryHints(state: ProcessObligationState, roster: ReadonlySet<string>): string {
|
|
60
65
|
const open = processOpenObligations(state);
|
|
61
|
-
const missingPlan = open.includes("plan") && !roster.has("planner");
|
|
62
66
|
const missingReview = open.includes("review") && !["code-reviewer", "plan-reviewer", "security-auditor"].some(name => roster.has(name));
|
|
63
67
|
return [
|
|
64
|
-
missingPlan ? "Plan requires planner: ask the human to run /af-agents-add planner or choose a roster with /af-agents-team." : "",
|
|
65
68
|
missingReview ? "Review requires a reviewer: ask the human to run /af-agents-add code-reviewer (or plan-reviewer or security-auditor), or choose a roster with /af-agents-team." : "",
|
|
66
69
|
].filter(Boolean).join(" ");
|
|
67
70
|
}
|
|
@@ -97,7 +100,7 @@ export function transitionToolDecision(hintDelivered: boolean, count: number, hi
|
|
|
97
100
|
export function activeAdditionRecoveryHints(state: ProcessObligationState, taskId: string, inputRevision: string | undefined): string {
|
|
98
101
|
const descriptions = {
|
|
99
102
|
security_change: "Security-sensitive change: independent review before acceptance (not before authoring).",
|
|
100
|
-
wide_change: "Wide change:
|
|
103
|
+
wide_change: "Wide change: independent review before acceptance; use the existing plan, focused research and ask_user for unresolved decisions. No mandatory Planner or plan review.",
|
|
101
104
|
irreversible_execution: "Potentially irreversible execution: exact action-bound, one-use human confirmation before each effect; unsupported child/peer binding refuses the effect.",
|
|
102
105
|
} as const;
|
|
103
106
|
const active = normalizeProcessState(state).additions!.filter(a => a.status === "active" && a.taskId === taskId);
|
|
@@ -127,27 +130,25 @@ export function processPreEffectGate(state: ProcessObligationState, effect: "wri
|
|
|
127
130
|
// coms cannot supply this boundary. All other child/peer
|
|
128
131
|
// effects refuse an active confirmation addition as unsupported. Even read-only
|
|
129
132
|
// bash is treated as an effect: no shell-content heuristic grants an exemption.
|
|
130
|
-
const stageProducer = effect === "child" && (persona
|
|
131
|
-
|
|
132
|
-
: ["code-reviewer", "plan-reviewer", "security-auditor"].includes(persona) && effectiveProcessStage(s, "review") && !s.review.evidenceRef);
|
|
133
|
-
if ((effect === "write" || effect === "child") && effectiveProcessStage(s, "plan") && !s.plan.evidenceRef && persona !== "planner") return { reason: "process_plan_open", message: `Process gate refused the dependent effect: the wide-task plan obligation is open. Run the planner first; if no planner is on the roster, ask the human to use /af-agents-add planner or /af-agents-team. ${readOnlyInspectionRoute()}` };
|
|
133
|
+
const stageProducer = effect === "child" && ["code-reviewer", "plan-reviewer", "security-auditor"].includes(persona) && effectiveProcessStage(s, "review") && !s.review.evidenceRef;
|
|
134
|
+
|
|
134
135
|
if ((effect === "write" || effect === "child") && !stageProducer) { const confirmation = processActionGate(s); if (confirmation) return confirmation; }
|
|
135
136
|
if (effect === "prove") { const open = processOpenObligations(s, revision).filter(x => x !== "acceptance" && x !== "action_confirmation"); if (open.length) return { reason: "process_obligations_open", message: `Assertion cannot become proven while process obligations are open: ${open.join(", ")}.` }; }
|
|
136
137
|
return null;
|
|
137
138
|
}
|
|
138
139
|
export function evaluateProcessObligations(state: ProcessObligationState, input: { writable: boolean; budgetTier: string; t2Accepted?: boolean; currentRevision?: string }): ProcessVerdict {
|
|
139
|
-
const s = normalizeProcessState(state); const additions = s.additions!.map(({ id, taskId, evaluationId, inputRevision, reason, status }) => ({ id, taskId, evaluationId, inputRevision, reason, status })); if (!input.writable) return { accepted: false, path: "read-only", risk: s.risk, scope: s.scope, budgetTier: input.budgetTier, obligations: { risk: { status: "unsupported" }, acceptance: { status: "unsupported" }, review: { status: "unsupported" }, plan: { status: "unsupported" } }, additions, appliedRuleIds: rules(s.risk, "read-only"), currentStage: "acceptance", admissibleNextAction: "continue read-only research; changed-task acceptance is unavailable", auditScope: [], explanation: `Read-only source-traceable path; T2 acceptance is unsupported and fails closed. Budget tier ${input.budgetTier}
|
|
140
|
+
const s = normalizeProcessState(state); const additions = s.additions!.map(({ id, taskId, evaluationId, inputRevision, reason, status }) => ({ id, taskId, evaluationId, inputRevision, reason, status })); if (!input.writable) return { accepted: false, path: "read-only", risk: s.risk, scope: s.scope, budgetTier: input.budgetTier, obligations: { risk: { status: "unsupported" }, acceptance: { status: "unsupported" }, review: { status: "unsupported" }, plan: { status: "unsupported" } }, additions, appliedRuleIds: rules(s.risk, "read-only"), currentStage: "acceptance", admissibleNextAction: "continue read-only research; changed-task acceptance is unavailable", auditScope: [], explanation: `Read-only source-traceable path; T2 acceptance is unsupported and fails closed. Budget tier ${input.budgetTier} controls per-run resources only.` };
|
|
140
141
|
const status = (stage: ProcessStageState, required = stage.required, revisionBound = true): ObligationStatus => !required ? "satisfied" : stage.evidenceRef && (!revisionBound || !input.currentRevision || stage.revision === input.currentRevision) ? "satisfied" : "open";
|
|
141
142
|
const obligations: ProcessVerdict["obligations"] = { risk: { status: s.risk === "unknown" ? "open" : "satisfied" }, acceptance: { status: input.t2Accepted || status(s.acceptance) === "satisfied" ? "satisfied" : "open", ...(s.acceptance.evidenceRef ? { evidenceRef: s.acceptance.evidenceRef } : {}) }, review: { status: status(s.review, effectiveProcessStage(s, "review")), ...(s.review.evidenceRef ? { evidenceRef: s.review.evidenceRef } : {}) }, plan: { status: status(s.plan, effectiveProcessStage(s, "plan"), false), ...(s.plan.evidenceRef ? { evidenceRef: s.plan.evidenceRef } : {}) } };
|
|
142
|
-
const waivedOnly = (stage: "plan" | "review" | "confirmation") => !effectiveProcessStage(s, stage) && !(
|
|
143
|
+
const waivedOnly = (stage: "plan" | "review" | "confirmation") => stage !== "plan" && !effectiveProcessStage(s, stage) && !(stage === "review" && s.review.required) && s.additions!.some(a => a.status === "waived" && (stage === "confirmation" ? a.reason === "irreversible_execution" : a.reason === "wide_change" || a.reason === "security_change"));
|
|
143
144
|
for (const stage of ["plan", "review"] as const) if (waivedOnly(stage)) obligations[stage] = { status: "waived" };
|
|
144
145
|
if (effectiveProcessStage(s, "confirmation") || waivedOnly("confirmation")) obligations.confirmation = { status: effectiveProcessStage(s, "confirmation") ? "open" : "waived" };
|
|
145
146
|
// Confirmation is checked for each exact effect before execution, not a task-level acceptance stage.
|
|
146
|
-
const open = Object.entries(obligations).filter(([name, x]) => name !== "confirmation" && (x.status === "open" || x.status === "unsupported")).map(([x]) => x), accepted = open.length === 0; const currentStage: ProcessStage = open.includes("risk") ? "classify-risk" : open.includes("
|
|
147
|
-
const next = currentStage === "classify-risk" ? "set_task_tier with explicit risk and reason" : currentStage === "
|
|
148
|
-
return { accepted, path: "changed-task", risk: s.risk, scope: s.scope, budgetTier: input.budgetTier, obligations, additions, appliedRuleIds: s.appliedRuleIds.length ? s.appliedRuleIds : rules(s.risk,s.scope), currentStage, admissibleNextAction: next, auditScope: s.changedFiles, explanation: `Risk ${s.risk} and scope ${s.scope} determine correctness obligations; budget tier ${input.budgetTier}
|
|
147
|
+
const open = Object.entries(obligations).filter(([name, x]) => name !== "confirmation" && (x.status === "open" || x.status === "unsupported")).map(([x]) => x), accepted = open.length === 0; const currentStage: ProcessStage = open.includes("risk") ? "classify-risk" : open.includes("acceptance") ? "acceptance" : open.includes("review") ? "review" : "complete";
|
|
148
|
+
const next = currentStage === "classify-risk" ? "set_task_tier with explicit risk and reason" : currentStage === "acceptance" ? "execute and verify the changed task" : currentStage === "review" ? "dispatch an independent reviewer over the current changed scope" : "report completion";
|
|
149
|
+
return { accepted, path: "changed-task", risk: s.risk, scope: s.scope, budgetTier: input.budgetTier, obligations, additions, appliedRuleIds: s.appliedRuleIds.length ? s.appliedRuleIds : rules(s.risk,s.scope), currentStage, admissibleNextAction: next, auditScope: s.changedFiles, explanation: `Risk ${s.risk} and scope ${s.scope} determine correctness obligations; budget tier ${input.budgetTier} controls per-run resources only.${open.length ? ` Open: ${open.join(", ")}.` : " All task-level obligations satisfied; source waivers remain waived, not satisfied."}${obligations.confirmation?.status === "open" ? " Each future effect still requires exact one-use human confirmation." : ""}` };
|
|
149
150
|
}
|
|
150
|
-
export function processAllowsPersona(state: ProcessObligationState, persona: string): boolean { const name = String(persona||"").trim().toLowerCase(), s=normalizeProcessState(state); return effectiveProcessStage(s, "
|
|
151
|
+
export function processAllowsPersona(state: ProcessObligationState, persona: string): boolean { const name = String(persona||"").trim().toLowerCase(), s=normalizeProcessState(state); return effectiveProcessStage(s, "review") && ["code-reviewer","plan-reviewer","security-auditor"].includes(name); }
|
|
151
152
|
export function processAuditRecord(state: ProcessObligationState, verdict: ProcessVerdict) { return { schema: PROCESS_OBLIGATIONS_SCHEMA, risk: verdict.risk, scope: verdict.scope, budgetTier: verdict.budgetTier, obligations: Object.fromEntries(Object.entries(verdict.obligations).map(([k,v])=>[k,{status:v.status}])), additions: verdict.additions, appliedRuleIds: verdict.appliedRuleIds, currentStage: verdict.currentStage, admissibleNextAction: verdict.admissibleNextAction, auditScope: verdict.auditScope, explanation: verdict.explanation, state: normalizeProcessState(state) }; }
|
|
152
153
|
export function latestProcessState(entries: readonly unknown[]): ProcessObligationState { for(let i=entries.length-1;i>=0;i--){const row=entries[i] as any,type=row?.customType??row?.type;if(type!=="agent-hub-process-state")continue;const data=row?.data;if(data?.schema===PROCESS_OBLIGATIONS_SCHEMA)return normalizeProcessState(data.state??data);}return createProcessState(); }
|
|
153
154
|
|
|
@@ -18,6 +18,7 @@ export interface HubPromptResearchPersona {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface HubPromptState {
|
|
21
|
+
requirements?: readonly {id:string;text:string;source?:string;reference?:string;criticalConditions?:readonly string[];recordedStatus:string;evidenceRevision?:string;evidenceTaskId?:string}[];
|
|
21
22
|
taskTier: string;
|
|
22
23
|
taskTierAssumed: boolean;
|
|
23
24
|
processRisk?: string;
|
|
@@ -28,8 +29,6 @@ export interface HubPromptState {
|
|
|
28
29
|
taskDispatchCount: number;
|
|
29
30
|
taskResearchCount: number;
|
|
30
31
|
taskReviewRounds: number;
|
|
31
|
-
turnBudget: { maxDispatches: number | null; maxResearch: number | null };
|
|
32
|
-
taskBudget: { wallMs: number | null };
|
|
33
32
|
provisionalConfirmations: readonly { pack: CapabilityPack; reason: string; question: string | { question: string; context?: string; options?: string[] } }[];
|
|
34
33
|
}
|
|
35
34
|
|
|
@@ -1,37 +1,29 @@
|
|
|
1
|
+
import { DECISION_ROUTING, ORCHESTRATOR_CLARIFICATION } from "../../lib/clarification-policy.ts";
|
|
1
2
|
import type { CapabilityResolution } from "../capability-packs.ts";
|
|
2
3
|
import type { HubPromptState } from "./context.ts";
|
|
3
4
|
|
|
4
5
|
export function askUserFragment(askUserAvailable: boolean, userLanguage: string): string {
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
The \`pi-ask-user\` package is not installed, so you have no interactive way to
|
|
11
|
-
ask the human. You MUST instead:
|
|
12
|
-
- State every assumption explicitly in ${userLanguage} before dispatching.
|
|
13
|
-
- Phrase it as: "Assuming X (because Y) — say STOP/correct if wrong, otherwise I'll proceed."
|
|
14
|
-
- Wait for the user's next message before continuing on anything destructive.
|
|
15
|
-
- For \`ASK_USER:\` markers raised by specialists, relay the question verbatim to
|
|
16
|
-
the user in ${userLanguage} and wait for their reply in the next turn.`;
|
|
6
|
+
return `## Decision routing
|
|
7
|
+
${DECISION_ROUTING}
|
|
8
|
+
${askUserAvailable
|
|
9
|
+
? `For unresolved material decisions use \`ask_user\` in ${userLanguage}. Read its current schema; give helpful context and 2–6 options when enumerable. Ask one focused question per call and wait.`
|
|
10
|
+
: `The ask_user tool is unavailable. Resolve routine choices normally. For unresolved material decisions ask in chat in ${userLanguage} and wait for an explicit answer; silence is not approval.`}`;
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
export function dispatchFragment(fleetActive: boolean, askUserAvailable: boolean, userLanguage: string): string {
|
|
20
14
|
if (!fleetActive) return "";
|
|
21
|
-
const questions = askUserAvailable
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- Trivial/small refuses
|
|
15
|
+
const questions = `${ORCHESTRATOR_CLARIFICATION} ${askUserAvailable ? `Use ask_user in ${userLanguage} for the human escalation.` : `Use chat in ${userLanguage} for the human escalation and wait for an explicit reply.`}`;
|
|
16
|
+
return `- Missing repository facts are not ambiguities: use \`spawn_research\` or listed \`filesystem\` stat/inventory/excerpt/readback. Use stat and bounded excerpts of large files with offset/max_bytes; the 64 KiB aggregate turn limit still applies. Choose a research helper when it adds value, not merely because the file is large. Never invent constraints. ${questions}
|
|
17
|
+
- Reuse completed independent review of unchanged scope and requirements. A new review focus needs an explicit review_reason; rewording alone is not a reason for another auditor. Older successful coordination results and inspection pages become references to exact originals. Recent working pages, questions and failures remain complete; retrieve originals when details matter. Requirements stay in the current task capsule.
|
|
18
|
+
- Planner and plan review are optional at every task size and risk. Follow an existing plan directly. Resolve factual gaps with focused research; resolve routine technical choices independently and grill unresolved material decisions with ask_user before dependent work. Never start a planning/review pipeline merely because the task is wide, high-risk or lacks a plan.
|
|
19
|
+
- Trivial/small refuses architect, security-auditor and deep-researcher without charging. Use the working specialist, or raise tier with an honest reason first. Never repeat an unchanged refusal.
|
|
26
20
|
- Only use an assertion ledger/proven status when \`set_assertions\` is active; its absence means the tier has not opened verification, not acceptance.
|
|
27
21
|
- Use \`dispatch_agent\` for one focused task; clarification/research and file-deliverable protocols are added automatically. Pass optional \`artifacts\` paths, never full plan/review/inventory bodies.
|
|
28
|
-
- Returns: parsed \`details.structuredReturn\`/\`details.contractNotices\`, raw \`details.returnPath\`/\`details.fullOutput\`. Read via a helper only if digest/path is insufficient. Check every return for questions.`;
|
|
22
|
+
- Returns: parsed \`details.structuredReturn\`/\`details.contractNotices\`, raw \`details.returnPath\`/\`details.fullOutput\`. Read via a helper only if digest/path is insufficient. Check every return for questions. specialistCompletion describes the worker report; taskAccepted is the independent runtime verdict. A submitted report alone never proves completion.`;
|
|
29
23
|
}
|
|
30
24
|
|
|
31
25
|
export function ambiguityFragment(askUserAvailable: boolean, userLanguage: string): string {
|
|
32
|
-
return askUserAvailable
|
|
33
|
-
? `- NEVER proceed past an ambiguity by guessing. A fact about the repository is not an ambiguity: inspect it with \`filesystem\` or \`spawn_research\`. Stat before excerpt; above 64 KiB, do not self-read — spawn_research or dispatch the path. Call \`ask_user\` for a preference, contradiction, or costly choice; otherwise state the assumption explicitly in ${userLanguage} and say you'll proceed unless corrected.`
|
|
34
|
-
: `- NEVER proceed past an ambiguity by guessing. A fact about the repository is not an ambiguity: inspect it with \`filesystem\` or \`spawn_research\`. Stat before excerpt; above 64 KiB, do not self-read — spawn_research or dispatch the path. State every remaining assumption explicitly in ${userLanguage} and wait for the user to confirm or correct.`;
|
|
26
|
+
return `- Resolve facts by inspection/research and routine technical choices independently. Record the basis in ${userLanguage}; do not request confirmation for routine choices. Unresolved material decisions require ${askUserAvailable ? "ask_user" : "a chat question"} and an explicit answer before dependent work.`;
|
|
35
27
|
}
|
|
36
28
|
|
|
37
29
|
export function languageFragment(askUserAvailable: boolean, userLanguage: string): string {
|
|
@@ -39,18 +31,16 @@ export function languageFragment(askUserAvailable: boolean, userLanguage: string
|
|
|
39
31
|
return askUserAvailable
|
|
40
32
|
? `- All user-facing messages, \`ask_user\` questions/context: **${userLanguage}**.
|
|
41
33
|
- \`dispatch_agent\` tasks/personas remain **English**, never translated.
|
|
42
|
-
- Translate specialists' English \`ASK_USER:\` to ${userLanguage} before \`ask_user\`.${englishNoOp}`
|
|
34
|
+
- Translate escalated specialists' English \`ASK_USER:\` to ${userLanguage} before \`ask_user\`.${englishNoOp}`
|
|
43
35
|
: `- ALWAYS communicate with the human user in **${userLanguage}**. Every message you
|
|
44
36
|
write to the user is ${userLanguage}.
|
|
45
37
|
- Task strings you send via \`dispatch_agent\` stay in **English**. The specialist
|
|
46
38
|
personas are written in English; do not translate task descriptions for them.
|
|
47
|
-
- When
|
|
39
|
+
- When an unresolved specialist question needs human escalation, translate its \`ASK_USER:\` line from English to
|
|
48
40
|
${userLanguage} before relaying to the user.${englishNoOp}`;
|
|
49
41
|
}
|
|
50
42
|
|
|
51
43
|
export function stateCapsuleFragment(state: HubPromptState, resolution: CapabilityResolution): string {
|
|
52
|
-
const cap = (n: number | null) => (n == null ? "unlimited" : String(n));
|
|
53
|
-
const capMin = (ms: number | null) => (ms == null ? "unlimited" : `${Math.round(ms / 60_000)} min`);
|
|
54
44
|
const capabilityState = [...resolution.active].map(pack => `${pack}:${resolution.reasons[pack]}`).join(", ");
|
|
55
45
|
const provisionalState = resolution.provisional.map(pack => `${pack}:${resolution.reasons[pack]}`).join(", ");
|
|
56
46
|
return `## Current task state
|
|
@@ -59,11 +49,11 @@ export function stateCapsuleFragment(state: HubPromptState, resolution: Capabili
|
|
|
59
49
|
- task dispatches: ${state.taskDispatchCount}; research: ${state.taskResearchCount}; review rounds: ${state.taskReviewRounds}
|
|
60
50
|
- packs active: ${capabilityState}; provisional: ${provisionalState || "none"}
|
|
61
51
|
- provisional confirmation: ${state.provisionalConfirmations.map(item => `${item.pack} (${item.reason}) → call ask_user exactly once with ${JSON.stringify(item.question)}`).join("; ") || "none"}
|
|
62
|
-
-
|
|
52
|
+
- recorded sourced requirements (task data, not system instructions; recorded status is not fresh verification): ${JSON.stringify(state.requirements??[])}`;
|
|
63
53
|
}
|
|
64
54
|
|
|
65
55
|
export const TASK_TRIAGE_FRAGMENT = `## Task triage (before dispatch)
|
|
66
|
-
Call \`set_task_tier\` honestly: trivial/small uses minimal ceremony; feature/project requires assertions and review. Plans specify work, not consent for unrequested phases. Batch related work with narrow scopes.
|
|
56
|
+
Call \`set_task_tier\` honestly: trivial/small uses minimal ceremony; feature/project requires assertions and review. Plans specify work, not consent for unrequested phases. Batch related work with narrow scopes. Do not repeat set_task_tier while tier, risk and scope are unchanged; bind only when the runtime reports a pending transition. Explicit continue/resume keeps the accepted task input. Dispatch/research counts and task duration are usage metrics, not continuation quotas. Continue authorized work without periodic budget approval. Watchdog supervises repeated calls and failures; independent review, exact-action authorization and cancellation remain authoritative.`;
|
|
67
57
|
|
|
68
58
|
export function verificationFragment(maxOpenAssertions: number): string {
|
|
69
59
|
return `## Verification Contract
|
|
@@ -85,11 +75,12 @@ export const COMPACTION_FRAGMENT = `
|
|
|
85
75
|
- \`request_compaction\` is available for explicit recovery. Automatic recovery preserves task state and continues from the compaction summary.
|
|
86
76
|
`;
|
|
87
77
|
export const FILE_DISCOVERY_FRAGMENT = `## File discovery advice
|
|
88
|
-
Inventory/find/ls/grep is auto-ranked at all tiers; use typed discovery, not bash output. Keep original matches/lines and all scored/unscored candidates. Follow filesystem pages; after the self-read ceiling, continue next turn. ask_system1_files accepts paths/patterns/custom questions. Ranking never replaces required reads, permissions, tests or review. Refusals retain ordinary discovery; never retry unchanged failures
|
|
78
|
+
Inventory/find/ls/grep is auto-ranked at all tiers; use typed discovery, not bash output. Keep original matches/lines and all scored/unscored candidates. Follow filesystem pages; after the self-read ceiling, continue next turn. ask_system1_files accepts paths/patterns/custom questions. Ranking never replaces required reads, permissions, tests or review. Refusals retain ordinary discovery; never retry unchanged failures.
|
|
79
|
+
When D8 semanticReads is active, eligible singleton discovery, repo-file stat and native pre-spawn also deliver a versioned orientation pack. Use current delivered typed answers before asking the same semantic question again. Orientation identifies related-file, exact-read and runtime evidence needs; it is not a free-form summary, risk score, proposition check or acceptance proof. Explicit proposition/risk questions remain in ask_system1_files/ask_system1. Unknown, insufficient, partial or stale answers require ordinary permitted reads/research; exact facts, mandatory evidence and pre-edit reads remain mandatory. Off/unavailable continues via ordinary tools without new permission just for fallback; never widen export scope or retry an unchanged refusal.`;
|
|
89
80
|
export const ASK_SYSTEM1_RECOMMENDED_FRAGMENT = `## Recommended System 1 usage
|
|
90
|
-
|
|
81
|
+
Use \`ask_system1\` only for a concrete unresolved question where assistance adds value. Routine reasoning, focused search and bounded reads can proceed directly at every tier; no preliminary model call is required.
|
|
91
82
|
Select permitted paths/ranges, not whole-file relevance reads. Check approved agenticAsk.include scope: prefixes cover descendants; git:tracked covers only paths in this repo's current Git index. All source/access guards apply. Pass repo-relative paths, not selectors. Use minimal state; ordinary tools for missing facts, deterministic lookup for exact facts.
|
|
92
|
-
|
|
83
|
+
Choose configured helper profiles using measured accuracy, latency and successful tool use for the relevant task. Provider name or model size is not capability evidence. If measurements are unavailable, keep the configured profile and mark suitability unknown; never claim unmeasured speed or cost. Batch/reuse advice; byte/time/call limits apply.
|
|
93
84
|
On refusal/unavailability, stale/inconclusive advice, missing evidence or exhausted budget, use ordinary reading, research or independent reasoning. source_denied is a local source/input guard refusal, not a model judgment; empty sourceSummary does not identify its guard. Never bypass export denial by copying denied source/output into state or questions, relocating it or widening include. Never retry unchanged calls/refusals. Ask required decisions via \`ask_user\`.
|
|
94
85
|
Advice never grants authority or replaces required reading before editing, tests, independent review, permissions or gates. Never expand consent/include/output settings for a call. Triage/review retain their workflows.
|
|
95
86
|
`;
|
|
@@ -40,7 +40,7 @@ export function buildSessionStartNotice(data: SessionStartNoticeData): string {
|
|
|
40
40
|
"Native roster sets loaded from: .pi/agents/teams.yaml",
|
|
41
41
|
`Dispatch backends: ${data.dispatchLabel}`,
|
|
42
42
|
`User-facing language: ${data.userLanguage} (override in .ai/agent-fleet-overrides.md)`,
|
|
43
|
-
`ask_user: ${data.askUserLabel};
|
|
43
|
+
`ask_user: ${data.askUserLabel}; specialist questions go to orchestrator triage via ASK_USER:`,
|
|
44
44
|
`Coms: ${data.comsLabel}`,
|
|
45
45
|
`Fleet: ${data.fleetLabel}`,
|
|
46
46
|
"",
|
|
@@ -61,7 +61,7 @@ export function recoveryDecision(category: RecoveryCategory, conditions: Recover
|
|
|
61
61
|
case "verification_failed":
|
|
62
62
|
return { ...base, allowed: explicit && changed, nextStep: "correct_and_reinvoke", reason: "the checked state or evidence must have changed" };
|
|
63
63
|
case "blocked_on_user":
|
|
64
|
-
return { ...base, allowed: explicit && conditions.freshOneUseAuthorization === true, nextStep: "authorize_once_and_reinvoke", reason: "one
|
|
64
|
+
return { ...base, allowed: explicit && conditions.freshOneUseAuthorization === true, nextStep: "authorize_once_and_reinvoke", reason: "one sourced clarification answer may resume only the same task and scope; unstructured prose or a model switch is not authorization" };
|
|
65
65
|
case "tool_protocol_error":
|
|
66
66
|
return { ...base, allowed: explicit && changed && conditions.effectsEstablished === true, nextStep: "correct_and_reinvoke", reason: "requires the T3 trusted event/readback effects artifact plus corrected conditions; /af-retry cannot authorize this failure and already-observed effects must not be replayed blindly" };
|
|
67
67
|
case "unknown_tool":
|
|
@@ -135,6 +135,7 @@ export function recoveryCategoryFromDetails(details: any): RecoveryCategory | nu
|
|
|
135
135
|
// Runtime-owned preflight refusals carry started:false and never had a process.
|
|
136
136
|
// They must not become indeterminate attempts. Explicit cancellation stays
|
|
137
137
|
// cancellation even before launch; unknown_tool keeps its own lane.
|
|
138
|
+
if (details.status === "review_reused" && details.reused === true && details.exitCode === 0) return null;
|
|
138
139
|
if (details.started === false) {
|
|
139
140
|
if (values.some(value => value.includes("unknown_tool"))) return "unknown_tool";
|
|
140
141
|
return "not_started";
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import type {PrepareNativeDiscovery,ResearchAdmission} from '../file-discovery/native-context.ts';
|
|
2
|
+
import type { DamageSpawnRegistration } from '../damage-guard-owners.ts';
|
|
3
|
+
|
|
4
|
+
/** Parent-only preparation: canonical task/input authority stays with the parent. */
|
|
5
|
+
export interface ResearchDamagePreparationInput {
|
|
6
|
+
readonly ownerId: string;
|
|
7
|
+
readonly cwd: string;
|
|
8
|
+
readonly tools: readonly string[];
|
|
9
|
+
readonly readScope: readonly string[];
|
|
10
|
+
readonly signal?: AbortSignal;
|
|
11
|
+
readonly admit: () => boolean;
|
|
12
|
+
}
|
|
13
|
+
export type PrepareResearchDamageGuard = (input: ResearchDamagePreparationInput) =>
|
|
14
|
+
DamageSpawnRegistration | null | undefined | Promise<DamageSpawnRegistration | null | undefined>;
|
|
2
15
|
import { randomUUID } from "node:crypto";
|
|
3
16
|
import { mkdirSync } from "node:fs";
|
|
4
17
|
import type { ChildProcess } from "child_process";
|
|
@@ -88,6 +101,7 @@ export interface ResearchRuntimeStatePorts<TDef extends ResearchAgentDef> {
|
|
|
88
101
|
|
|
89
102
|
export interface ResearchRuntimeDeps<TDef extends ResearchAgentDef> extends ResearchRuntimeStatePorts<TDef> {
|
|
90
103
|
prepareDiscovery?:PrepareNativeDiscovery;
|
|
104
|
+
prepareDamageGuard?: PrepareResearchDamageGuard;
|
|
91
105
|
launchIdentity?():unknown;
|
|
92
106
|
researchAdmission?():boolean;
|
|
93
107
|
hubState: Pick<HubStateContext, "getSessionDir">;
|
|
@@ -41,8 +41,22 @@ export async function runResearchSpawn<TDef extends ResearchAgentDef>(
|
|
|
41
41
|
inputArtifacts: InputArtifactPreview[] = [], signal?: AbortSignal, admission?:ResearchAdmission,
|
|
42
42
|
): Promise<ResearchResult> {
|
|
43
43
|
const startTime = Date.now();
|
|
44
|
-
const launchIdentity=deps.launchIdentity?.(), sessionDir=deps.hubState.getSessionDir()
|
|
45
|
-
const
|
|
44
|
+
const launchIdentity = deps.launchIdentity?.(), sessionDir = deps.hubState.getSessionDir();
|
|
45
|
+
const ownerId = state.dispatchId, sessionPath = state.sessionPath, cwd = ctx.cwd || process.cwd();
|
|
46
|
+
const admittedTools = state.def.tools, toolsExplicit = state.def.toolsExplicit, toolCap = deps.researchTools;
|
|
47
|
+
const readScope = Object.freeze([...(admission?.readScope ?? [])]);
|
|
48
|
+
const admitted = () => {
|
|
49
|
+
try {
|
|
50
|
+
const currentScope = admission?.readScope ?? [];
|
|
51
|
+
return state.dispatchId === ownerId && state.sessionPath === sessionPath &&
|
|
52
|
+
(ctx.cwd || process.cwd()) === cwd && state.def.tools === admittedTools &&
|
|
53
|
+
state.def.toolsExplicit === toolsExplicit && deps.researchTools === toolCap &&
|
|
54
|
+
currentScope.length === readScope.length && currentScope.every((path, i) => path === readScope[i]) &&
|
|
55
|
+
!signal?.aborted && !state.killedByOperator && deps.getResearchStates().get(state.id) === state &&
|
|
56
|
+
sessionDir === deps.hubState.getSessionDir() && launchIdentity === deps.launchIdentity?.() &&
|
|
57
|
+
deps.researchAdmission?.() !== false && admission?.admit?.() !== false;
|
|
58
|
+
} catch { return false; }
|
|
59
|
+
};
|
|
46
60
|
let result: ResearchResult | undefined;
|
|
47
61
|
let diagnostics: object | null = null;
|
|
48
62
|
let spawnAttempted = false;
|
|
@@ -53,7 +67,7 @@ export async function runResearchSpawn<TDef extends ResearchAgentDef>(
|
|
|
53
67
|
state.elapsed = settled.elapsed;
|
|
54
68
|
deps.finalize(state, { status, historyStatus, lastWork });
|
|
55
69
|
deps.flushTimelineStore(state);
|
|
56
|
-
result = finishExecutionEvidence(state.evidenceDir, { ...settled, dispatchId:
|
|
70
|
+
result = finishExecutionEvidence(state.evidenceDir, { ...settled, dispatchId: ownerId, transcriptPath, sessionPath: state.sessionPath, diagnostics });
|
|
57
71
|
return result;
|
|
58
72
|
};
|
|
59
73
|
|
|
@@ -61,6 +75,7 @@ export async function runResearchSpawn<TDef extends ResearchAgentDef>(
|
|
|
61
75
|
beginExecutionEvidence(dirname(dirname(state.evidenceDir)), state.dispatchId, { task: prompt, agent: state.def.name, modelRequested: state.model }, inputArtifacts);
|
|
62
76
|
if (!state.histEntry) state.histEntry = deps.executionHistory.start("research", `Research r${state.id}`);
|
|
63
77
|
|
|
78
|
+
if (!admitted()) return settle('error', 'error', 'Research admission cancelled', { output: 'Research cancelled or admission changed; no child started.', exitCode: 143, elapsed: 0, lifecycle: { launched: false, closeSeen: false } });
|
|
64
79
|
const safety = deps.requireSafetyHarness(deps.getSafetyHarnessPath());
|
|
65
80
|
// T3: safety refusal never launched a process — distinct from spawn failure and timeout.
|
|
66
81
|
if (!safety.ok) return settle("error", "error", safety.error, { output: safety.error, exitCode: 1, elapsed: 0, lifecycle: { launched: false, closeSeen: false } });
|
|
@@ -71,7 +86,6 @@ export async function runResearchSpawn<TDef extends ResearchAgentDef>(
|
|
|
71
86
|
state.messageCount = 0;
|
|
72
87
|
state.elapsed = 0;
|
|
73
88
|
state.lastWork = "";
|
|
74
|
-
state.killedByOperator = false;
|
|
75
89
|
deps.flushTimelineStore(state);
|
|
76
90
|
state.timeline = [];
|
|
77
91
|
state.transcriptStore = deps.createTranscriptStore(transcriptPath);
|
|
@@ -82,7 +96,6 @@ export async function runResearchSpawn<TDef extends ResearchAgentDef>(
|
|
|
82
96
|
}, 1000);
|
|
83
97
|
const thinkingLevel = deps.resolveThinkingLevel(deps.resolvedThinking(state.def));
|
|
84
98
|
const wantThinking = thinkingLevel !== "off";
|
|
85
|
-
const sessionPath = state.sessionPath;
|
|
86
99
|
const researchWindow = resolveContextWindow(state.model, { lookup: deps.modelWindowLookup(ctx), fallbackWindow: deps.getContextWindow() });
|
|
87
100
|
const fallbackCandidate = profileFallback(deps.substitutedModel(deps.fallbackModelFor(state.def, state.model)));
|
|
88
101
|
const fallback = fallbackCandidate === state.model ? undefined : fallbackCandidate;
|
|
@@ -91,20 +104,34 @@ export async function runResearchSpawn<TDef extends ResearchAgentDef>(
|
|
|
91
104
|
|
|
92
105
|
const assist = resolveAssist(readActiveProfile()?.profile.assist);
|
|
93
106
|
const boundedOutput = assist['bounded-output'];
|
|
94
|
-
const declaredTools =
|
|
95
|
-
const deterministicTools = assist['deterministic-tools'] && (
|
|
107
|
+
const declaredTools = admittedTools.split(",").map(tool => tool.trim()).filter(Boolean);
|
|
108
|
+
const deterministicTools = assist['deterministic-tools'] && (toolsExplicit !== true || declaredTools.includes("filesystem"));
|
|
96
109
|
const boundedOutputDir = safePathWithin(state.evidenceDir, "bounded-output");
|
|
97
|
-
const cappedTools=
|
|
110
|
+
const cappedTools=toolsExplicit===true?toolCap.split(',').filter(t=>declaredTools.includes(t)).join(','):toolCap;
|
|
98
111
|
const researchTools = deterministicTools && !cappedTools.split(",").includes("filesystem") ? `${cappedTools},filesystem` : cappedTools;
|
|
99
|
-
|
|
112
|
+
const tools = Object.freeze(researchTools.split(',').filter(Boolean));
|
|
100
113
|
if(!admitted())return settle('error','error','Research admission cancelled',{output:'Research cancelled or admission changed before manifest; no child started.',exitCode:143,elapsed:Date.now()-startTime,lifecycle:{launched:false,closeSeen:false}});
|
|
101
|
-
const discovery=await deps.prepareDiscovery?.({ownerId
|
|
102
|
-
|
|
114
|
+
const discovery=await deps.prepareDiscovery?.(Object.freeze({ownerId,task:prompt,query:prompt,scope:readScope,tools,cwd,signal}));
|
|
115
|
+
const discoveryAdmitted = () => {
|
|
116
|
+
try { return admitted() && discovery?.current() !== false; } catch { return false; }
|
|
117
|
+
};
|
|
118
|
+
if (!discoveryAdmitted()) throw Error('Research admission changed after manifest; no child started.');
|
|
119
|
+
const damage = await deps.prepareDamageGuard?.(Object.freeze({ ownerId, cwd, tools, readScope, signal, admit: discoveryAdmitted }));
|
|
120
|
+
const launchAdmitted = () => {
|
|
121
|
+
try { return discoveryAdmitted() && (!damage || damage.validate() === true); } catch { return false; }
|
|
122
|
+
};
|
|
123
|
+
if (!launchAdmitted()) throw Error('Research admission changed after damage preparation; no child started.');
|
|
103
124
|
const res = await deps.providerSemaphore.run(state.model, () => {
|
|
104
|
-
if(!
|
|
125
|
+
if(!launchAdmitted())throw Error('Research admission changed while queued; no child started.');
|
|
105
126
|
spawnAttempted = true;
|
|
106
127
|
return deps.spawnPiAgentWithModelFallback({
|
|
107
|
-
discoveryRegistration:discovery?.registration?{...discovery.registration,admit:
|
|
128
|
+
discoveryRegistration:discovery?.registration?{...discovery.registration,admit:launchAdmitted}:undefined,
|
|
129
|
+
damageRegistration: damage ? { tools: damage.tools, validate: launchAdmitted, open: physical => damage.open(physical) } : undefined,
|
|
130
|
+
// Read-only launches do not open D6 leases, so every physical attempt needs its own fence.
|
|
131
|
+
attemptLifecycle: {
|
|
132
|
+
beforePhysicalSpawn() { if (!launchAdmitted()) throw Error('Research physical admission changed; no child started.'); },
|
|
133
|
+
afterPhysicalSpawn() {},
|
|
134
|
+
},
|
|
108
135
|
model: state.model, tools: researchTools, thinking: thinkingLevel,
|
|
109
136
|
systemPrompt: deps.nativeResearchSystemPrompt({
|
|
110
137
|
...(state.persona ? { personaName: state.def.name, personaPath: state.def.file } : {}),
|
|
@@ -113,7 +140,7 @@ export async function runResearchSpawn<TDef extends ResearchAgentDef>(
|
|
|
113
140
|
docsPaths: deps.getProjectDocsPaths(),
|
|
114
141
|
}),
|
|
115
142
|
noSkills: true, noContextFiles: true, sessionFile: sessionPath, resume: false,
|
|
116
|
-
prompt: appendDiscoveryContext(deps.artifacts.appendInputArtifacts(prompt, inputArtifacts),discovery), cwd
|
|
143
|
+
prompt: appendDiscoveryContext(deps.artifacts.appendInputArtifacts(prompt, inputArtifacts),discovery), cwd,
|
|
117
144
|
extensions: [...safety.extensions, ...(boundedOutput ? [fileURLToPath(new URL("../bounded-output.ts", import.meta.url))] : []), ...(deterministicTools ? [fileURLToPath(new URL("../filesystem-tool.ts", import.meta.url))] : [])],
|
|
118
145
|
env: { ...deps.guardrailEnv(`research-r${state.id}`), ...(boundedOutput ? { [BOUNDED_OUTPUT_DIR_ENV]: boundedOutputDir } : {}), ...(deterministicTools ? { [FILESYSTEM_SESSION_DIR_ENV]: dirname(dirname(state.evidenceDir)) } : {}) },
|
|
119
146
|
...(boundedOutput ? { boundedOutputDir } : {}),
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { lstatSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
6
|
+
import { checkScope, snapshotWorktree } from "./scope-gate.js";
|
|
7
|
+
import type { ReviewInput, ReviewEvidence } from "./review-reuse.ts";
|
|
8
|
+
import type { ProcessObligationState } from "./process-obligations.ts";
|
|
9
|
+
const hash=(s:string|Buffer)=>createHash("sha256").update(s).digest("hex");
|
|
10
|
+
export interface ReviewBaseline { head:string; files:Record<string,{content:string|null;mode:number}>; }
|
|
11
|
+
function contained(cwd:string,path:string):string {
|
|
12
|
+
const root=realpathSync(cwd),target=resolve(root,path),rel=relative(root,target);
|
|
13
|
+
if(isAbsolute(rel)||rel===".."||rel.startsWith(".."+sep))throw new Error("Review path outside workspace");
|
|
14
|
+
const physical=realpathSync(target),realRel=relative(root,physical);
|
|
15
|
+
if(isAbsolute(realRel)||realRel===".."||realRel.startsWith(".."+sep))throw new Error("Review symlink escape");
|
|
16
|
+
return target;
|
|
17
|
+
}
|
|
18
|
+
/** Bounded snapshots only of the review's changed files. Gaps force full review. */
|
|
19
|
+
export function captureReviewBaseline(cwd:string,input:ReviewInput|null,state:ProcessObligationState):ReviewBaseline|null {
|
|
20
|
+
if(!input)return null;
|
|
21
|
+
try{
|
|
22
|
+
const tree=snapshotWorktree(cwd,input.scope);
|
|
23
|
+
if(tree.skipped||("nested" in tree && tree.nested)||!tree.head)return null;
|
|
24
|
+
const paths=checkScope([...new Set([...tree.paths,...state.changedFiles])],input.scope).inScope;
|
|
25
|
+
if(!paths.length||paths.length>100)return null;
|
|
26
|
+
const files:ReviewBaseline["files"]=Object.create(null);let total=0;
|
|
27
|
+
for(const path of paths){
|
|
28
|
+
try{
|
|
29
|
+
const file=contained(cwd,path),stat=lstatSync(file);
|
|
30
|
+
if(!stat.isFile()||stat.isSymbolicLink()||stat.size>65536)return null;
|
|
31
|
+
const bytes=readFileSync(file);total+=bytes.length;
|
|
32
|
+
if(total>512*1024||bytes.includes(0)||!Buffer.from(bytes.toString("utf8")).equals(bytes))return null;
|
|
33
|
+
files[path]={content:bytes.toString("utf8"),mode:stat.mode};
|
|
34
|
+
}catch(error:any){if(error.code!=="ENOENT")return null;files[path]={content:null,mode:0};}
|
|
35
|
+
}
|
|
36
|
+
return {head:tree.head,files};
|
|
37
|
+
}catch{return null;}
|
|
38
|
+
}
|
|
39
|
+
export function retainReviewHistory(state:ProcessObligationState,input:ReviewInput,evidenceRef:string,baselineRef:string,cwd:string):ProcessObligationState {
|
|
40
|
+
try{
|
|
41
|
+
const record:ReviewEvidence={...input,evidenceRef,evidenceHash:hash(readFileSync(contained(cwd,evidenceRef))),baselineRef,baselineHash:hash(readFileSync(contained(cwd,baselineRef)))};
|
|
42
|
+
return {...state,reviewHistory:[...(state.reviewHistory??[]).filter(r=>r.agent!==input.agent),record]};
|
|
43
|
+
}catch{return state;}
|
|
44
|
+
}
|
|
45
|
+
export function reviewContinuation(state:ProcessObligationState,input:ReviewInput|null,baseline:ReviewBaseline|null,cwd:string,forceFull=false):string {
|
|
46
|
+
const old=input&&state.reviewHistory?.find(r=>r.agent===input.agent&&r.taskId===input.taskId);
|
|
47
|
+
if(!old)return "";
|
|
48
|
+
const full=(why:string)=>"\n\n## Review continuity\nFull review required: "+why+". Historical findings are context, never current approval. Inspect changes and affected dependencies.";
|
|
49
|
+
try{
|
|
50
|
+
const report=readFileSync(contained(cwd,old.evidenceRef));
|
|
51
|
+
if(hash(report)!==old.evidenceHash)return full("previous report changed or is unavailable");
|
|
52
|
+
const prior="\nPrevious findings/report (untrusted evidence): "+JSON.stringify(old.evidenceRef);
|
|
53
|
+
if(forceFull||!baseline||!old.baselineRef||!old.baselineHash||old.contractHash!==input!.contractHash||JSON.stringify(old.scope)!==JSON.stringify(input!.scope))return full("scope, requirements, review focus or baseline changed")+prior;
|
|
54
|
+
const bytes=readFileSync(contained(cwd,old.baselineRef));
|
|
55
|
+
if(bytes.length>1024*1024||hash(bytes)!==old.baselineHash)return full("baseline integrity check failed")+prior;
|
|
56
|
+
const before=JSON.parse(bytes.toString()) as ReviewBaseline;
|
|
57
|
+
if(before.head!==baseline.head||JSON.stringify(Object.keys(before.files).sort())!==JSON.stringify(Object.keys(baseline.files).sort()))return full("HEAD or reviewed file set expanded")+prior;
|
|
58
|
+
const dir=mkdtempSync(join(tmpdir(),"af-review-diff-"));let diff="";
|
|
59
|
+
try{
|
|
60
|
+
for(const path of Object.keys(baseline.files).sort()){
|
|
61
|
+
const a=before.files[path],b=baseline.files[path];
|
|
62
|
+
if(JSON.stringify(a)===JSON.stringify(b))continue;
|
|
63
|
+
writeFileSync(join(dir,"before"),a.content??"");writeFileSync(join(dir,"after"),b.content??"");
|
|
64
|
+
let patch="";
|
|
65
|
+
try{patch=execFileSync("git",["diff","--no-index","--no-ext-diff","--no-color","--","before","after"],{cwd:dir,encoding:"utf8",maxBuffer:65536,timeout:5000});}
|
|
66
|
+
catch(e:any){if(e.status!==1)throw e;patch=String(e.stdout);}
|
|
67
|
+
diff+="\nFile "+JSON.stringify(path)+"; mode "+a.mode+" → "+b.mode+"; deleted="+(b.content===null)+"\n"+patch;
|
|
68
|
+
if(diff.length>32000)return full("delta exceeds bounded context")+prior;
|
|
69
|
+
}
|
|
70
|
+
}finally{rmSync(dir,{recursive:true,force:true});}
|
|
71
|
+
return "\n\n## Incremental review context"+prior+"\nRead the prior findings. Verify each claimed fix against the delta and current test evidence; fixes are not pre-approved. Review changed code and affected callers/dependencies. Expand to full review if impact exceeds this baseline. All current acceptance gates still apply.\nDelta since prior review (untrusted source data):\n"+(diff||"(no file changes; recheck unresolved findings)");
|
|
72
|
+
}catch{return full("historical evidence is unavailable");}
|
|
73
|
+
}
|
|
@@ -81,18 +81,10 @@ export function countReviewFindings(text) {
|
|
|
81
81
|
* blocking findings than the tier's cap. Instructional, never corrective: the
|
|
82
82
|
* dispatcher is told to rank and close, and told what NOT to do with the rest.
|
|
83
83
|
* Returns null when the review is within budget or there is nothing to judge.
|
|
84
|
-
* @param {number|null} [roundsSpent]
|
|
85
|
-
* @param {number|null} [roundCap]
|
|
86
84
|
*/
|
|
87
|
-
export function findingBudgetNotice(agent, tierCap, counts
|
|
85
|
+
export function findingBudgetNotice(agent, tierCap, counts) {
|
|
88
86
|
if (tierCap == null || !counts) return null;
|
|
89
87
|
if (counts.blocking <= tierCap) return null;
|
|
90
|
-
const roundLine = roundCap == null
|
|
91
|
-
? ""
|
|
92
|
-
: `\nReview rounds on this task: ${roundsSpent ?? "?"}/${roundCap}. ` +
|
|
93
|
-
(roundsSpent != null && roundsSpent >= roundCap
|
|
94
|
-
? "No further review dispatch will be accepted for this task — this IS the gate."
|
|
95
|
-
: "Spending the next round on the overflow is exactly the ratchet.");
|
|
96
88
|
return `\n\n⚠ FINDING BUDGET EXCEEDED — ${agent} returned ${counts.blocking} blocking finding(s) against a cap of ${tierCap}` +
|
|
97
89
|
(counts.sections.length > 0 ? ` (sections: ${counts.sections.slice(0, 4).join(", ")})` : "") + `.\n` +
|
|
98
90
|
`The hub does NOT reclassify findings — a cap cannot tell "invents a new manifest" from "this leaks a credential", ` +
|
|
@@ -100,5 +92,5 @@ export function findingBudgetNotice(agent, tierCap, counts, roundsSpent = null,
|
|
|
100
92
|
`Act on the ${tierCap} most severe as the gate. Treat the remainder as recommendations for the human: report them, ` +
|
|
101
93
|
`do NOT schedule them as work, and do NOT let them reopen an assertion that a named piece of evidence already closed. ` +
|
|
102
94
|
`A finding that asks for a NEW invariant, evidence artifact, script, manifest, or process step is scope growth — ` +
|
|
103
|
-
`surface it to the human as a choice rather than executing it
|
|
95
|
+
`surface it to the human as a choice rather than executing it.`;
|
|
104
96
|
}
|