@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
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {projectDamageResult,validDamageResultMetadata,damageResultGap,type DamageResultEvent,type DamageResultMetadata} from './result-screen.ts';
|
|
2
|
+
import {randomUUID} from 'node:crypto';
|
|
3
|
+
import {connect,type Socket} from 'node:net';
|
|
4
|
+
import {DAMAGE_FRAME_BYTES,exactKeys,decodeDamageFrame,validDamageAssignment,validDamageInput,damageAssessmentFrame,damageControlFrame,verifyDamageFrame,type DamageOutcome} from '../agent-hub/damage-guard-broker.ts';
|
|
5
|
+
export interface DamageClientResult {outcome:DamageOutcome;}
|
|
6
|
+
/** Transport only. No configuration discovery, providers, hooks, grants or effects.
|
|
7
|
+
* A granted result is semantic evidence only: callers must revalidate their own
|
|
8
|
+
* baseline authority. Lost replies never become an allow. No reconnect/retry.
|
|
9
|
+
*/
|
|
10
|
+
export function createDamageClient(assignment?:unknown,limits:{technicalMs?:number;humanMs?:number}={}){
|
|
11
|
+
let trusted:Readonly<{path:string;capability:string}>|undefined;
|
|
12
|
+
try{if(validDamageAssignment(assignment)&&process.platform!=='win32')trusted=Object.freeze({...assignment});}catch{/* Invalid trusted assignment is indeterminate. */}
|
|
13
|
+
const validLimits=[limits.technicalMs,limits.humanMs].every(v=>v===undefined||Number.isSafeInteger(v)&&v>0);
|
|
14
|
+
const technical=Math.min(2000,limits.technicalMs??2000),human=Math.min(600000,limits.humanMs??600000);
|
|
15
|
+
const cancellations=new Set<()=>void>();let disposed=false;
|
|
16
|
+
return {
|
|
17
|
+
result(event:DamageResultEvent,options:{signal?:AbortSignal;deadlineAt?:number}={}):Promise<DamageResultMetadata>{
|
|
18
|
+
if(disposed||options.signal?.aborted)return Promise.resolve(damageResultGap('cancelled'));
|
|
19
|
+
if(!trusted||!validLimits)return Promise.resolve(damageResultGap('transport_unavailable'));
|
|
20
|
+
const deadline=Math.min(performance.timeOrigin+performance.now()+technical,options.deadlineAt??Infinity),id=randomUUID();
|
|
21
|
+
let frame:Buffer;
|
|
22
|
+
try{const evidence=projectDamageResult(event);if(!evidence)return Promise.resolve(damageResultGap('unsupported_source'));frame=Buffer.from(JSON.stringify(damageControlFrame(trusted,id,'screen_result',{evidence,deadline}))+'\n');}catch{return Promise.resolve(damageResultGap('unsupported_source'));}
|
|
23
|
+
if(frame.length>DAMAGE_FRAME_BYTES||performance.timeOrigin+performance.now()>=deadline)return Promise.resolve(damageResultGap('transport_unavailable'));
|
|
24
|
+
return new Promise(resolve=>{
|
|
25
|
+
let socket:Socket|undefined,buffer=Buffer.alloc(DAMAGE_FRAME_BYTES),used=0,terminal:DamageResultMetadata|undefined,settled=false;
|
|
26
|
+
const finish=(metadata:DamageResultMetadata)=>{if(settled)return;settled=true;clearTimeout(timer);cancellations.delete(cancel);options.signal?.removeEventListener('abort',cancel);socket?.removeAllListeners();socket?.on('error',()=>{});socket?.destroy();resolve(metadata);};
|
|
27
|
+
const fail=()=>finish(damageResultGap('transport_unavailable')),cancel=()=>finish(damageResultGap('cancelled'));
|
|
28
|
+
const timer=setTimeout(fail,Math.max(0,deadline-performance.timeOrigin-performance.now()));cancellations.add(cancel);options.signal?.addEventListener('abort',cancel,{once:true});
|
|
29
|
+
try{socket=connect(trusted.path);}catch{fail();return;}
|
|
30
|
+
socket.once('connect',()=>{if(!settled)socket!.write(frame);});socket.on('error',fail);
|
|
31
|
+
socket.on('data',(chunk:Buffer|string)=>{
|
|
32
|
+
const bytes=Buffer.isBuffer(chunk)?chunk:Buffer.from(chunk);if(terminal||used+bytes.length>DAMAGE_FRAME_BYTES||performance.timeOrigin+performance.now()>=deadline){fail();return;}
|
|
33
|
+
bytes.copy(buffer,used);used+=bytes.length;const newline=buffer.subarray(0,used).indexOf(10);if(newline<0)return;
|
|
34
|
+
if(newline!==used-1){fail();return;}let row:unknown;try{row=decodeDamageFrame(buffer.subarray(0,newline));}catch{fail();return;}
|
|
35
|
+
if(!exactKeys(row,['v','id','result','auth'])||!verifyDamageFrame(row,trusted.capability)||row.v!==1||row.id!==id||!validDamageResultMetadata(row.result)){fail();return;}
|
|
36
|
+
terminal=row.result;used=0;
|
|
37
|
+
});
|
|
38
|
+
socket.once('end',()=>{if(used||!terminal||performance.timeOrigin+performance.now()>=deadline)fail();else finish(terminal);});socket.once('close',()=>{if(!settled)fail();});if(options.signal?.aborted)cancel();
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
assess(tool:string,input:unknown,options:{signal?:AbortSignal}={}):Promise<DamageClientResult>{
|
|
42
|
+
if(disposed||options.signal?.aborted)return Promise.resolve({outcome:'cancelled'});
|
|
43
|
+
if(!validLimits)return Promise.resolve({outcome:'indeterminate'});
|
|
44
|
+
if(!trusted)return Promise.resolve({outcome:assignment===undefined?'unavailable':'indeterminate'});
|
|
45
|
+
// Include cloning/encoding and transport in the same non-extendable budget.
|
|
46
|
+
const technicalDeadline=performance.now()+technical;
|
|
47
|
+
let frame:Buffer;const id=randomUUID();
|
|
48
|
+
try{const exactInput=structuredClone(input);if(!validDamageInput(tool,exactInput))return Promise.resolve({outcome:'indeterminate'});frame=Buffer.from(JSON.stringify(damageAssessmentFrame(trusted,id,tool,exactInput,performance.timeOrigin+technicalDeadline))+'\n');}catch{return Promise.resolve({outcome:'indeterminate'});}
|
|
49
|
+
if(frame.length>DAMAGE_FRAME_BYTES)return Promise.resolve({outcome:'indeterminate'});
|
|
50
|
+
// Clock starts before connect/write, never restarts on connection or reply.
|
|
51
|
+
return new Promise(resolve=>{
|
|
52
|
+
let deadline=technicalDeadline;
|
|
53
|
+
let socket:Socket|undefined,buffer=Buffer.alloc(DAMAGE_FRAME_BYTES),used=0,total=0,held=false,terminal:DamageOutcome|undefined,settled=false;
|
|
54
|
+
const finish=(outcome:DamageOutcome)=>{
|
|
55
|
+
if(settled)return;settled=true;clearTimeout(timer);cancellations.delete(cancel);options.signal?.removeEventListener('abort',cancel);
|
|
56
|
+
socket?.removeAllListeners();socket?.on('error',()=>{});socket?.destroy();resolve({outcome});
|
|
57
|
+
};
|
|
58
|
+
const fail=()=>finish(held?'blocked':'indeterminate');
|
|
59
|
+
const cancel=()=>finish(held?'blocked':'cancelled');
|
|
60
|
+
let timer=setTimeout(fail,Math.max(0,deadline-performance.now()));cancellations.add(cancel);options.signal?.addEventListener('abort',cancel,{once:true});
|
|
61
|
+
try{socket=connect(trusted.path);}catch{fail();return;}
|
|
62
|
+
socket.once('connect',()=>{if(!settled)socket!.write(frame);});
|
|
63
|
+
socket.on('error',fail);
|
|
64
|
+
socket.on('data',(chunk:Buffer|string)=>{
|
|
65
|
+
if(performance.now()>=deadline){fail();return;}
|
|
66
|
+
const bytes=Buffer.isBuffer(chunk)?chunk:Buffer.from(chunk);total+=bytes.length;if(total>DAMAGE_FRAME_BYTES){fail();return;}bytes.copy(buffer,used);used+=bytes.length;
|
|
67
|
+
for(let newline;(newline=buffer.subarray(0,used).indexOf(10))>=0;){
|
|
68
|
+
let row:unknown;try{row=decodeDamageFrame(buffer.subarray(0,newline));}catch{fail();return;}buffer.copyWithin(0,newline+1,used);used-=newline+1;
|
|
69
|
+
if(!exactKeys(row,['v','id','outcome','auth'])||!verifyDamageFrame(row,trusted.capability)||row.v!==1||row.id!==id||terminal){fail();return;}
|
|
70
|
+
if(row.outcome==='held'){
|
|
71
|
+
if(held){fail();return;}held=true;deadline=performance.now()+human;clearTimeout(timer);timer=setTimeout(fail,human);continue;
|
|
72
|
+
}
|
|
73
|
+
if(typeof row.outcome!=='string'||!['no_hold','unavailable','blocked','granted','cancelled','revoked','indeterminate'].includes(row.outcome)||row.outcome==='granted'&&!held||held&&['no_hold','unavailable','indeterminate'].includes(row.outcome)){fail();return;}
|
|
74
|
+
terminal=row.outcome as DamageOutcome;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// Commit only at clean EOF: duplicate/extra/partial replies cannot race an allow.
|
|
78
|
+
socket.once('end',()=>{if(performance.now()>=deadline||used||!terminal)fail();else finish(terminal);});
|
|
79
|
+
socket.once('close',()=>{if(!settled)fail();});
|
|
80
|
+
if(options.signal?.aborted)cancel();
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
dispose(){if(disposed)return;disposed=true;for(const cancel of [...cancellations])cancel();},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {realpathSync} from 'node:fs';
|
|
2
|
+
import {resolve} from 'node:path';
|
|
3
|
+
import {parseDamageGuardConfig} from '../lib/system1/config-damage-guard.js';
|
|
4
|
+
import {damageActionHashes} from '../lib/damage-action-hash.ts';
|
|
5
|
+
import {screenDamagePayload} from '../lib/system1/payload-screen.ts';
|
|
6
|
+
import {DAMAGE_GUARD_VERSION,DAMAGE_GUARD_QUESTIONS,damageVerdict} from '../agent-hub/damage-guard-contract.ts';
|
|
7
|
+
import {createDamageState,damageDenyKey,type DamageAction} from '../agent-hub/damage-guard-state.ts';
|
|
8
|
+
import type {DamageApprovalProof} from '../agent-hub/damage-guard-approval.ts';
|
|
9
|
+
import type {DamageCallEvent,DamageCallContext} from '../lib/damage-guard-port.ts';
|
|
10
|
+
import type {System1Service,System1Result} from '../lib/system1/contracts.ts';
|
|
11
|
+
export function createDamageGuard(deps:{root:string;config:ReturnType<typeof parseDamageGuardConfig>;state:ReturnType<typeof createDamageState>;binding():Pick<DamageAction,'taskId'|'inputRevision'|'owner'|'attempt'>;canRead(path:string):boolean;service?:System1Service;signal?:AbortSignal;takeOverride?(action:DamageAction):boolean;approve(action:DamageAction,input:unknown):Promise<boolean|DamageApprovalProof>}){
|
|
12
|
+
let backoff=0,disposed=false;const lifetime=new AbortController();
|
|
13
|
+
const revoked=()=>disposed||deps.signal?.aborted===true;
|
|
14
|
+
const holds=new Set<string>(),admitted=new Map<string,DamageApprovalProof>(),pending=new Map<string,Promise<{block:boolean;reason?:string}>>();
|
|
15
|
+
const action=(event:DamageCallEvent,ctx:DamageCallContext):DamageAction=>({...deps.binding(),operation:event.toolName as DamageAction['operation'],actionId:event.toolCallId,...damageActionHashes(event.toolName,event.input),cwd:realpathSync(ctx.cwd)});
|
|
16
|
+
const evaluate=async(event:DamageCallEvent,ctx:DamageCallContext)=>{
|
|
17
|
+
if(!['bash','write','edit'].includes(event.toolName))return {block:false};
|
|
18
|
+
const contract=action(event,ctx),identity=JSON.stringify(contract),holdKey=damageDenyKey(contract);
|
|
19
|
+
if(revoked())return {block:true,reason:'Damage-Control: owner cancelled; propose no retry.'};
|
|
20
|
+
if(deps.state.needsArm(contract)&&deps.takeOverride?.(contract)!==true)return {block:true,reason:'Damage-Control: exact action denied or outcome-recovery fenced. Only the human can arm /af-damage-override for a new exact approval dialog.'};
|
|
21
|
+
const resolveHold=async()=>{
|
|
22
|
+
try{
|
|
23
|
+
const answer=await deps.approve(contract,event.input),proof:DamageApprovalProof=typeof answer==='boolean'?{allowed:answer,denialEpoch:deps.state.denialEpoch(contract),overrideDenied:false}:answer;
|
|
24
|
+
if(!proof.allowed||revoked()||ctx.revalidateBaseline?.()!==true||JSON.stringify(action(event,ctx))!==identity||proof.denialEpoch!==deps.state.denialEpoch(contract)||deps.state.denied(contract)&&!proof.overrideDenied)return {block:true,reason:'Damage-Control: exact action remains held'};
|
|
25
|
+
admitted.set(identity,proof);holds.delete(holdKey);return {block:false};
|
|
26
|
+
}catch{return {block:true,reason:'Damage-Control: held approval failed'};}
|
|
27
|
+
};
|
|
28
|
+
if(holds.has(holdKey)||deps.state.held(contract)||deps.state.needsArm(contract))return resolveHold();
|
|
29
|
+
if(!deps.service||deps.config.mode!=='active'||Date.now()<backoff)return {block:false};
|
|
30
|
+
const controller=new AbortController(),abort=()=>controller.abort();deps.signal?.addEventListener('abort',abort,{once:true});lifetime.signal.addEventListener('abort',abort,{once:true});
|
|
31
|
+
let timer:ReturnType<typeof setTimeout>|undefined,held=false;
|
|
32
|
+
try{
|
|
33
|
+
const deadline=Date.now()+deps.config.limits.hookTimeoutMs;
|
|
34
|
+
timer=setTimeout(abort,deps.config.limits.hookTimeoutMs);
|
|
35
|
+
const raw=event.input as Record<string,unknown>;
|
|
36
|
+
const input=event.toolName!=='bash'&&raw&&typeof raw==='object'&&typeof raw.path==='string'?{...raw,path:resolve(ctx.cwd,raw.path)}:raw;
|
|
37
|
+
const screened=await screenDamagePayload({kind:event.toolName==='bash'?'command':'edit',input},{root:deps.root,config:deps.config,canRead:deps.canRead,signal:controller.signal});
|
|
38
|
+
if(screened.status!=='ready')return revoked()?{block:true,reason:'Damage-Control: cancelled'}:{block:false};
|
|
39
|
+
const request={state:{owner:contract.owner,trigger:event.toolName,scope:screened.scope,coverage:screened.coverage,bytes:screened.bytes,payload:screened.payload},questions:DAMAGE_GUARD_QUESTIONS,questionSetVersion:DAMAGE_GUARD_VERSION,timeoutMs:Math.max(1,deadline-Date.now()),signal:controller.signal};
|
|
40
|
+
if(Buffer.byteLength(JSON.stringify({...request,signal:undefined}))>deps.config.limits.maxPayloadBytes)return {block:false};
|
|
41
|
+
const result=await Promise.race([deps.service.evaluate(request),new Promise<System1Result>(resolve=>{if(controller.signal.aborted)resolve({status:'cancelled'});else controller.signal.addEventListener('abort',()=>resolve({status:'cancelled'}),{once:true});})]);
|
|
42
|
+
if(revoked()||JSON.stringify(action(event,ctx))!==identity)return {block:true,reason:'Damage-Control: authority changed or cancelled'};
|
|
43
|
+
if(result.status!=='ok'){backoff=Date.now()+deps.config.limits.outageBackoffMs;return {block:false};}
|
|
44
|
+
if(damageVerdict(result,'call')!=='hold_exact_action')return {block:false};
|
|
45
|
+
held=true;holds.add(holdKey);clearTimeout(timer);timer=undefined;
|
|
46
|
+
// Durable fence precedes the human wait; failed decision writes cannot lose its protection on resume.
|
|
47
|
+
deps.state.hold(contract);
|
|
48
|
+
return resolveHold();
|
|
49
|
+
}catch{return revoked()||held?{block:true,reason:'Damage-Control: cancelled or held approval failed'}:{block:false};}
|
|
50
|
+
finally{if(timer)clearTimeout(timer);deps.signal?.removeEventListener('abort',abort);lifetime.signal.removeEventListener('abort',abort);}
|
|
51
|
+
};
|
|
52
|
+
return {action,call(event:DamageCallEvent,ctx:DamageCallContext){
|
|
53
|
+
if(revoked())return Promise.resolve({block:true,reason:'Damage-Control: cancelled'});
|
|
54
|
+
let initial:DamageAction;try{initial=action(event,ctx);}catch{return Promise.resolve({block:true,reason:'Damage-Control: exact action authority unavailable'});}
|
|
55
|
+
const key=JSON.stringify(initial),prior=pending.get(key);
|
|
56
|
+
// Coalesce assessment, not execution permission: a duplicate observer cannot spend one grant twice.
|
|
57
|
+
if(prior)return prior.then(decision=>decision.block?decision:{block:true,reason:'Damage-Control: duplicate in-flight action; no duplicate execution'});
|
|
58
|
+
const result=evaluate(event,ctx).then(decision=>{
|
|
59
|
+
const proof=admitted.get(key),authorized=proof?.allowed&&proof.denialEpoch===deps.state.denialEpoch(initial)&&(!deps.state.denied(initial)||proof.overrideDenied);
|
|
60
|
+
if(!decision.block&&(revoked()||ctx.revalidateBaseline?.()===false||JSON.stringify(action(event,ctx))!==key||(deps.state.needsArm(initial)||deps.state.held(initial)||holds.has(damageDenyKey(initial)))&&!authorized))return {block:true,reason:'Damage-Control: authority changed before effect admission'};
|
|
61
|
+
return decision;
|
|
62
|
+
}).catch(()=>({block:true,reason:'Damage-Control: action authority revalidation failed'}));
|
|
63
|
+
pending.set(key,result);void result.finally(()=>{if(pending.get(key)===result)pending.delete(key);admitted.delete(key);});return result;
|
|
64
|
+
},dispose(){disposed=true;lifetime.abort();pending.clear();admitted.clear();}};
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {processShared} from './process-shared.ts';
|
|
2
|
+
/** One active human wait per process. Reset aborts authority but retains the tail until old UI closes. */
|
|
3
|
+
export function createApprovalWait(){
|
|
4
|
+
let tail:Promise<unknown>=Promise.resolve(),generation=0;const controllers=new Set<AbortController>();
|
|
5
|
+
return {
|
|
6
|
+
run<T>(work:(signal:AbortSignal)=>Promise<T>,signal?:AbortSignal):Promise<T|undefined>{
|
|
7
|
+
const epoch=generation,controller=new AbortController(),abort=()=>controller.abort();controllers.add(controller);
|
|
8
|
+
if(signal?.aborted)controller.abort();else signal?.addEventListener('abort',abort,{once:true});
|
|
9
|
+
const result=tail.then(async()=>{if(controller.signal.aborted||epoch!==generation)return undefined;const value=await work(controller.signal);return controller.signal.aborted||epoch!==generation?undefined:value;});
|
|
10
|
+
tail=result.catch(()=>{});
|
|
11
|
+
return result.finally(()=>{controllers.delete(controller);signal?.removeEventListener('abort',abort);});
|
|
12
|
+
},
|
|
13
|
+
reset(){generation++;for(const controller of controllers)controller.abort();},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
// Damage-Control, ask_user and the Hub load as separate extension module instances.
|
|
17
|
+
export const sharedApprovalWait=processShared('agent-fleet.approval-wait.v1',createApprovalWait);
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { basename, dirname, isAbsolute, resolve } from "node:path";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { damageControlPathMatches, type PathRuleCategory } from "./damage-control-shared.ts";
|
|
4
|
+
|
|
5
|
+
interface Token { text: string; operator?: boolean; }
|
|
6
|
+
interface ShellCommand { words: string[]; reads: string[]; writes: string[]; deletes: string[]; patternText: string; opaque: boolean; }
|
|
7
|
+
export interface BashPolicyAnalysis { commands: ShellCommand[]; patternText: string; }
|
|
8
|
+
|
|
9
|
+
/** Recognize static shell words and operators only. Expansion, compound grammar
|
|
10
|
+
* and interpreter source fall back to the existing conservative text checks.
|
|
11
|
+
* This is operand classification, not a shell or arbitrary-program sandbox.
|
|
12
|
+
*/
|
|
13
|
+
function tokens(text: string): Token[] | null {
|
|
14
|
+
const out: Token[] = []; let word = "", quoted = false, quote = "";
|
|
15
|
+
const push = () => { if (word || quoted) out.push({ text: word }); word = ""; quoted = false; };
|
|
16
|
+
for (let i = 0; i < text.length; i++) {
|
|
17
|
+
const char = text[i];
|
|
18
|
+
if (quote) {
|
|
19
|
+
if (char === quote) { quote = ""; continue; }
|
|
20
|
+
if (quote === '"' && /[$`]/.test(char)) return null;
|
|
21
|
+
if (quote === '"' && char === "\\" && /["\\$`\n]/.test(text[i + 1] ?? "")) { const next = text[++i]; if (next !== "\n") word += next; continue; }
|
|
22
|
+
word += char; continue;
|
|
23
|
+
}
|
|
24
|
+
if (char === "'" || char === '"') { quote = char; quoted = true; continue; }
|
|
25
|
+
if (char === "\\") { if (i + 1 >= text.length) return null; const next = text[++i]; if (next !== "\n") word += next; continue; }
|
|
26
|
+
if (/[$`(){}]/.test(char)) return null;
|
|
27
|
+
if (char === "#" && !word && !quoted) { while (i < text.length && text[i] !== "\n") i++; push(); out.push({ text: ";", operator: true }); continue; }
|
|
28
|
+
if (/[ \t\r]/.test(char)) { push(); continue; }
|
|
29
|
+
if (/[;\n|&<>]/.test(char)) {
|
|
30
|
+
push(); let operator = char === "\n" ? ";" : char;
|
|
31
|
+
if (["||", "&&", ">>", "<<", ">&", "<&", "<>", "&>"].includes(char + text[i + 1])) operator += text[++i];
|
|
32
|
+
if (["&", "<<", "<>"].includes(operator)) return null;
|
|
33
|
+
out.push({ text: operator, operator: true }); continue;
|
|
34
|
+
}
|
|
35
|
+
word += char;
|
|
36
|
+
if (out.length > 4096) return null;
|
|
37
|
+
}
|
|
38
|
+
if (quote) return null; push(); return out;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Only cat/tee receive a quoted heredoc as literal data. Shell/interpreter
|
|
42
|
+
* heredocs and unquoted (expanding) delimiters retain conservative handling.
|
|
43
|
+
*/
|
|
44
|
+
function unquotedAt(text: string, index: number): boolean {
|
|
45
|
+
let quote = "";
|
|
46
|
+
for (let i = 0; i < index; i++) {
|
|
47
|
+
const char = text[i];
|
|
48
|
+
if (char === "\\" && quote !== "'") { if (++i >= index) return false; continue; }
|
|
49
|
+
if (quote) { if (char === quote) quote = ""; }
|
|
50
|
+
else if (char === "'" || char === '"') quote = char;
|
|
51
|
+
}
|
|
52
|
+
return !quote;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function withoutLiteralHeredocs(text: string): string | null {
|
|
56
|
+
const lines = text.split("\n"), retained: string[] = [];
|
|
57
|
+
for (let i = 0; i < lines.length; i++) {
|
|
58
|
+
const line = lines[i];
|
|
59
|
+
if (!line.includes("<<")) { retained.push(line); continue; }
|
|
60
|
+
const match = /<<\s*(?:'([A-Za-z_][A-Za-z0-9_]*)'|"([A-Za-z_][A-Za-z0-9_]*)")/.exec(line);
|
|
61
|
+
if (!match || !unquotedAt(line, match.index)
|
|
62
|
+
|| !/^(?:\s|[<>]|$)/.test(line.slice(match.index + match[0].length))
|
|
63
|
+
|| line.replace(match[0], "").includes("<<")) return null;
|
|
64
|
+
const header = line.replace(match[0], ""), parsed = tokens(header);
|
|
65
|
+
if (!parsed || !["cat", "tee"].includes(parsed[0]?.text) || parsed.some(t => t.operator && ![">", ">>", "<", ">&", "<&", "&>"].includes(t.text))) return null;
|
|
66
|
+
const delimiter = match[1] ?? match[2]; let end = i + 1;
|
|
67
|
+
while (end < lines.length && lines[end] !== delimiter) end++;
|
|
68
|
+
if (end === lines.length) return null;
|
|
69
|
+
retained.push(header); i = end;
|
|
70
|
+
}
|
|
71
|
+
return retained.join("\n");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const readers = new Set(["cat", "ls", "pwd", "stat", "head", "tail", "wc", "file", "grep", "rg", "find", "test", "readlink", "realpath", "du"]);
|
|
75
|
+
const writers = new Set(["rm", "mv", "cp", "touch", "mkdir", "rmdir", "install", "chmod", "chown", "truncate", "tee"]);
|
|
76
|
+
const dataCommands = new Set(["printf", "echo"]);
|
|
77
|
+
// Preserve option text and operands after `--`. Long options may carry a path
|
|
78
|
+
// after `=`; ambiguous attached short options use conservative handling below.
|
|
79
|
+
// Bash tilde-expands assignment-like arguments after `=` and `:` (`dd if=~/.ssh/id_rsa`,
|
|
80
|
+
// `K=a:~/x`), so each value segment is an operand too.
|
|
81
|
+
const operands = (words: string[]) => words.flatMap(word => {
|
|
82
|
+
if (word === "--") return [];
|
|
83
|
+
if (word.startsWith("-") && word.includes("=")) return [word, word.slice(word.indexOf("=") + 1)];
|
|
84
|
+
const assignment = /^[A-Za-z_]\w*=([^]*)$/.exec(word);
|
|
85
|
+
return assignment ? [word, ...assignment[1].split(":").filter(Boolean)] : [word];
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export function analyzeBashCommand(command: string): BashPolicyAnalysis | null {
|
|
89
|
+
const literal = withoutLiteralHeredocs(command); if (literal === null) return null;
|
|
90
|
+
const parsed = tokens(literal); if (!parsed) return null;
|
|
91
|
+
const commands: ShellCommand[] = []; let words: string[] = [], reads: string[] = [], writes: string[] = [], requiresDataSink = false;
|
|
92
|
+
const finish = (): boolean => {
|
|
93
|
+
if (!words.length) return !reads.length && !writes.length;
|
|
94
|
+
const name = basename(words[0]), args = words.slice(1), paths = operands(args);
|
|
95
|
+
// A repository executable named cat/printf/etc need not behave like a utility.
|
|
96
|
+
if (words[0] !== name || ["if", "then", "else", "fi", "for", "while", "until", "do", "done", "case", "esac", "function", "eval", "exec", "source", ".", "cd", "pushd", "popd"].includes(name)
|
|
97
|
+
|| args.some(arg => /^(?:-exec|-execdir|-ok|-okdir|-delete|-fprint|-fprintf|-fls|--pre)(?:=|$)/.test(arg))
|
|
98
|
+
|| /^[A-Za-z_]\w*=/.test(words[0]) || ["bash", "sh", "zsh"].includes(name)
|
|
99
|
+
|| ["sed", "file"].includes(name)
|
|
100
|
+
|| name !== "find" && args.some(arg => /^-[^-].+/.test(arg))
|
|
101
|
+
|| ["node", "nodejs", "python", "python3", "perl", "ruby"].includes(name) && args.some(arg => /^-(?:.*[ec]|-eval)(?:=|$)/.test(arg))) return false;
|
|
102
|
+
if(requiresDataSink&&!readers.has(name)&&!dataCommands.has(name)&&name!=="tee")return false;
|
|
103
|
+
let modified: string[] = [];
|
|
104
|
+
if (writers.has(name)) modified = paths;
|
|
105
|
+
else if (!readers.has(name) && !dataCommands.has(name)) modified = paths;
|
|
106
|
+
const referenced = dataCommands.has(name) ? [] : [words[0], ...paths];
|
|
107
|
+
const patternText = readers.has(name) || dataCommands.has(name) ? words[0] : words.join(" ");
|
|
108
|
+
const opaqueDeletion=!readers.has(name)&&!writers.has(name)&&!dataCommands.has(name)&&/\b(?:rm|mv|rmdir)\b/.test(words.join(" "));
|
|
109
|
+
const opaque=!readers.has(name)&&!writers.has(name)&&!dataCommands.has(name)&&!opaqueDeletion;
|
|
110
|
+
commands.push({ words, reads: [...reads, ...referenced], writes: [...writes, ...modified], deletes: ["rm", "mv", "rmdir"].includes(name)||opaqueDeletion ? paths : [], patternText, opaque });
|
|
111
|
+
words = []; reads = []; writes = []; requiresDataSink=false;return true;
|
|
112
|
+
};
|
|
113
|
+
for (let i = 0; i < parsed.length; i++) {
|
|
114
|
+
const token = parsed[i];
|
|
115
|
+
if (!token.operator) { words.push(token.text); continue; }
|
|
116
|
+
if ([";", "&&", "||", "|"].includes(token.text)) {
|
|
117
|
+
// A continued pipe must never lose its pending consumer across a newline or
|
|
118
|
+
// comment. Unsupported separator combinations retain conservative checks.
|
|
119
|
+
if (requiresDataSink && !words.length || !finish()) return null;
|
|
120
|
+
requiresDataSink=token.text==="|";continue;
|
|
121
|
+
}
|
|
122
|
+
if (!parsed[i + 1] || parsed[i + 1].operator) return null;
|
|
123
|
+
if([">&","<&"].includes(token.text)) { if(!/^(?:\d+|-)$/.test(parsed[++i].text))return null;continue; }
|
|
124
|
+
if (![">", ">>", "<", "&>"].includes(token.text)) return null;
|
|
125
|
+
(token.text === "<" ? reads : writes).push(parsed[++i].text);
|
|
126
|
+
}
|
|
127
|
+
if (!finish()) return null;
|
|
128
|
+
return { commands, patternText: commands.map(c => c.patternText).join("\n") };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function matches(target: string, pattern: string, cwd: string): boolean {
|
|
132
|
+
const expanded = target.startsWith("~/") ? resolve(homedir(), target.slice(2)) : target;
|
|
133
|
+
const absolute = resolve(cwd, expanded);
|
|
134
|
+
if (pattern.endsWith("/")) {
|
|
135
|
+
const base = pattern.startsWith("~/") ? resolve(homedir(), pattern.slice(2)) : pattern;
|
|
136
|
+
if (isAbsolute(base)) return absolute === resolve(base) || absolute.startsWith(resolve(base) + "/");
|
|
137
|
+
const relative = base.replace(/^\.\//, "").replace(/\/$/, "");
|
|
138
|
+
return absolute.endsWith("/" + relative) || absolute.includes("/" + relative + "/");
|
|
139
|
+
}
|
|
140
|
+
if (damageControlPathMatches(absolute, pattern, cwd)) return true;
|
|
141
|
+
// A literal shell glob can name a protected file even before expansion.
|
|
142
|
+
return target.includes("*") && (damageControlPathMatches(resolve(cwd, pattern), target, cwd)
|
|
143
|
+
|| !pattern.includes("/") && damageControlPathMatches(resolve(dirname(absolute), pattern), target, cwd));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function bashReferencesProtectedPath(analysis: BashPolicyAnalysis, category: PathRuleCategory, pattern: string, cwd: string): boolean {
|
|
147
|
+
// A slash-free word of an unknown program (`npm run build`, `cargo build`) names a
|
|
148
|
+
// subcommand far more often than a relative output directory; known writers stay exact.
|
|
149
|
+
const relativeDirectory = pattern.endsWith("/") && !isAbsolute(pattern) && !pattern.startsWith("~");
|
|
150
|
+
const subcommand = (command: ShellCommand, candidate: string) => category === "read_only" && relativeDirectory && command.opaque && !candidate.includes("/");
|
|
151
|
+
return analysis.commands.some(command => {
|
|
152
|
+
const candidates = category === "zero_access" ? [...command.reads, ...command.writes] : category === "read_only" ? command.writes : command.deletes;
|
|
153
|
+
return candidates.some(candidate => !subcommand(command, candidate) && matches(candidate, pattern, cwd));
|
|
154
|
+
});
|
|
155
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Shared decision boundary for Hub, native specialists and connected peers. */
|
|
2
|
+
export const DECISION_ROUTING = `Use settled instructions and approved decisions without re-asking. Investigate discoverable facts with available tools or focused research. Resolve routine technical choices independently within the approved scope and record the choice and reason: local helper names, equivalent existing patterns, test fixtures, and reversible implementation details do not require human preference. Multiple valid approaches alone are not a reason to ask.
|
|
3
|
+
Ask only for an unresolved material decision: changed requirements or acceptance criteria, a public compatibility contract, consequential product/architecture trade-offs, new cost or external exposure, destructive effects needing new permission, or conflicting authoritative instructions that research cannot resolve. Respect explicit user boundaries even for small changes. Never invent user intent or treat silence, model consensus, or a specialist report as permission.`;
|
|
4
|
+
|
|
5
|
+
export const SPECIALIST_CLARIFICATION = `${DECISION_ROUTING}
|
|
6
|
+
If you cannot resolve a question within your authority, pause dependent work and return ASK_USER: <one clear English question>, with the evidence checked, options and recommendation. This marker goes to the orchestrator first; it is not an instruction to contact the human automatically. The orchestrator resolves settled/factual/routine questions itself and escalates only remaining material decisions or questions it cannot answer. An ORCHESTRATOR_ANSWER is a model clarification, not human consent; preserve all permission gates.`;
|
|
7
|
+
|
|
8
|
+
export const ORCHESTRATOR_CLARIFICATION = `Triage every ASK_USER/details.questions item before escalating: inspect existing decisions and facts, then resolve routine technical choices yourself. If still unresolved or material, ask the human and wait for the answer before dependent work. Never fabricate a human answer.
|
|
9
|
+
For a parent-resolved round, re-dispatch with one line ORCHESTRATOR_ANSWER: {"dispatchId":"<dispatchId>","answers":[{"question":"<exact returned question>","answer":"<answer>","basis":"routine_technical","evidence":"<source or reasoning>"}]}. Include every returned question exactly once; basis is existing_decision, repository_fact, or routine_technical. For actual human answers use USER_ANSWER: <dispatchId> :: <question> and include the actual answers and their source in the task (including any parent-resolved questions). Both paths resume clarification only, never grant new permissions or override cancellation.`;
|
|
@@ -57,7 +57,8 @@ export interface AgentCard {
|
|
|
57
57
|
purpose: string;
|
|
58
58
|
model: string;
|
|
59
59
|
color: string;
|
|
60
|
-
context_used_pct: number;
|
|
60
|
+
context_used_pct: number | null;
|
|
61
|
+
context_measurement?: "measured" | "unknown";
|
|
61
62
|
queue_depth: number;
|
|
62
63
|
pane_id?: string | null;
|
|
63
64
|
status?: PeerStatus;
|
|
@@ -167,7 +167,7 @@ export function createComsPeer(deps: CreateComsPeerDeps) {
|
|
|
167
167
|
liveSessions.add(entry.session_id);
|
|
168
168
|
const next = {
|
|
169
169
|
name: entry.name, purpose: entry.purpose, model: entry.model, color: entry.color,
|
|
170
|
-
context_used_pct: entry.context_used_pct ??
|
|
170
|
+
context_used_pct: entry.context_measurement === "measured" ? entry.context_used_pct ?? null : null, context_measurement:entry.context_measurement??"unknown", queue_depth: entry.queue_depth ?? 0, staleCount: 0,
|
|
171
171
|
};
|
|
172
172
|
const previous = peerCards.get(entry.session_id);
|
|
173
173
|
if (!previous || JSON.stringify(previous) !== JSON.stringify(next)) {
|
|
@@ -237,7 +237,8 @@ export function createComsPeer(deps: CreateComsPeerDeps) {
|
|
|
237
237
|
purpose: identity?.purpose ?? "",
|
|
238
238
|
model: ctx?.model?.id ?? identity?.model ?? "unknown",
|
|
239
239
|
color: identity?.color ?? "#36F9F6",
|
|
240
|
-
context_used_pct:
|
|
240
|
+
context_used_pct: ctx?.getContextUsage()?.percent ?? null,
|
|
241
|
+
context_measurement: ctx?.getContextUsage()?.percent == null ? "unknown" : "measured",
|
|
241
242
|
queue_depth: inboundQueue.size,
|
|
242
243
|
pane_id: herdrPaneId() ?? null,
|
|
243
244
|
status: turnState === "working" || inboundQueue.size > 0 ? "working" : "idle",
|
|
@@ -30,7 +30,8 @@ export interface ComsRegistryEntry {
|
|
|
30
30
|
version: number;
|
|
31
31
|
// Live status snapshot — refreshed every keepalive tick. Optional so
|
|
32
32
|
// entries written before the heartbeat carried them still parse cleanly.
|
|
33
|
-
context_used_pct?: number;
|
|
33
|
+
context_used_pct?: number | null;
|
|
34
|
+
context_measurement?: "measured" | "unknown";
|
|
34
35
|
queue_depth?: number;
|
|
35
36
|
heartbeat_at?: string;
|
|
36
37
|
}
|
|
@@ -87,7 +88,8 @@ export function buildLiveRegistryEntry(identity: ComsIdentity, live: LiveSnapsho
|
|
|
87
88
|
started_at: identity.started_at,
|
|
88
89
|
explicit: identity.explicit,
|
|
89
90
|
version: 1,
|
|
90
|
-
context_used_pct:
|
|
91
|
+
context_used_pct: typeof live.contextUsedPct === "number" && Number.isFinite(live.contextUsedPct) && live.contextUsedPct >= 0 ? Math.round(live.contextUsedPct) : null,
|
|
92
|
+
context_measurement: typeof live.contextUsedPct === "number" && Number.isFinite(live.contextUsedPct) && live.contextUsedPct >= 0 ? "measured" : "unknown",
|
|
91
93
|
queue_depth: count(live.queueDepth),
|
|
92
94
|
heartbeat_at: live.now,
|
|
93
95
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SPECIALIST_CLARIFICATION } from "./clarification-policy.ts";
|
|
1
2
|
import { isAbsolute } from "node:path";
|
|
2
3
|
import { DELEGATE_TREE_SPAWN_BUDGET } from "../agent-hub/helpers.ts";
|
|
3
4
|
import { externalBlockedProtocol } from "../agent-hub/external-blocker.js";
|
|
@@ -13,15 +14,8 @@ export function buildClarificationProtocol(userLanguage: string, maxQuestions =
|
|
|
13
14
|
return `
|
|
14
15
|
|
|
15
16
|
## Clarification protocol
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return a single line of the form:
|
|
19
|
-
|
|
20
|
-
ASK_USER: <your question in one clear English sentence>
|
|
21
|
-
|
|
22
|
-
You may emit multiple ASK_USER lines if you have several questions. The dispatcher
|
|
23
|
-
will surface each to the human user in ${userLanguage} and re-dispatch you with the
|
|
24
|
-
answers. Do not invent values, do not pick "reasonable defaults" silently — ask.
|
|
17
|
+
${SPECIALIST_CLARIFICATION}
|
|
18
|
+
Human escalations are presented in ${userLanguage}.
|
|
25
19
|
|
|
26
20
|
## External-blocker protocol
|
|
27
21
|
${externalBlockedProtocol()}
|
|
@@ -37,8 +31,7 @@ form
|
|
|
37
31
|
with nothing after them. Your session pauses there; read-only research helpers are
|
|
38
32
|
spawned for you, each helper's findings are saved to a file, and you are resumed in
|
|
39
33
|
this same session with the file paths — read them and continue from where you left
|
|
40
|
-
off. Ask at most ${maxQuestions} questions per pause. Use ASK_USER
|
|
41
|
-
for decisions a human must make; use NEEDS_RESEARCH for facts that can be looked up.`;
|
|
34
|
+
off. Ask at most ${maxQuestions} questions per pause. Use ASK_USER for unresolved decisions routed through the orchestrator; use NEEDS_RESEARCH for facts that can be looked up.`;
|
|
42
35
|
}
|
|
43
36
|
|
|
44
37
|
export function buildDelegationProtocol(roleNames: readonly string[], spawnBudget = DELEGATE_TREE_SPAWN_BUDGET): string {
|
|
@@ -46,9 +39,10 @@ export function buildDelegationProtocol(roleNames: readonly string[], spawnBudge
|
|
|
46
39
|
return `
|
|
47
40
|
|
|
48
41
|
## Delegation protocol
|
|
49
|
-
You have a \`delegate\` tool with
|
|
50
|
-
(roles: ${roleNames.join(", ")}).
|
|
51
|
-
sub-tasks
|
|
42
|
+
You have a \`delegate\` tool with sub-agents on configured models
|
|
43
|
+
(roles: ${roleNames.join(", ")}). Delegate scoped, self-contained
|
|
44
|
+
sub-tasks when specialization or measured capability adds value. Routine reasoning
|
|
45
|
+
and bounded reads can proceed directly; delegation is optional. A child shares NONE of your
|
|
52
46
|
context — put everything it needs into its instruction/context. You may run up
|
|
53
47
|
to ${spawnBudget} delegate calls for this dispatch; parallel children are forced read-only.
|
|
54
48
|
Children are terminal workers: they do not receive delegate tooling at remaining depth 0.`;
|
|
@@ -44,6 +44,11 @@ export function contextBudgetRows(snapshot: ContextBudgetSnapshot, expanded: Set
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
const rows: ContextBudgetRow[] = [];
|
|
47
|
+
const monitor=snapshot.pressure?.monitor;
|
|
48
|
+
if(monitor) {
|
|
49
|
+
rows.push({key:"compaction/policy",label:"Auto compaction",detail:`min ${monitor.minimumPercent}% · early ${monitor.earlyPercent}% · target ${monitor.targetPercent}% · ceiling ${monitor.maximumPercent}%`});
|
|
50
|
+
rows.push({key:"compaction/recovery",label:"Last compaction",detail:`${monitor.phase} · episode ${monitor.episode} · before ${monitor.beforePercent?.toFixed(1)??"unknown"}% → after ${monitor.afterPercent?.toFixed(1)??"unknown"}%`});
|
|
51
|
+
}
|
|
47
52
|
for (const key of order) {
|
|
48
53
|
const group = groups.get(key);
|
|
49
54
|
if (!group) continue;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Operator-approved automatic policy. Explicit user compaction is independent. */
|
|
2
|
+
export const COMPACTION_MIN_PERCENT = 50;
|
|
3
|
+
export const COMPACTION_EARLY_PERCENT = 60;
|
|
4
|
+
export const COMPACTION_TARGET_PERCENT = 70;
|
|
5
|
+
export const COMPACTION_MAX_PERCENT = 80;
|
|
6
|
+
/** One hysteresis band of new history since the first post-compaction measurement. */
|
|
7
|
+
export const COMPACTION_REARM_GROWTH_PERCENT = COMPACTION_TARGET_PERCENT - COMPACTION_EARLY_PERCENT;
|
|
8
|
+
|
|
9
|
+
/** @param {unknown} value @returns {value is number} */
|
|
10
|
+
const count = value => typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
11
|
+
|
|
12
|
+
/** A window whose post-compaction baseline stays above the early threshold (system
|
|
13
|
+
* prompt, tool schemas, summary and kept recent turns) can never fall below it, so
|
|
14
|
+
* automatic compaction also re-arms once that much new history could be summarized.
|
|
15
|
+
* @param {number|null|undefined} baselineTokens first measurement after a compaction
|
|
16
|
+
* @param {number|null|undefined} tokens
|
|
17
|
+
* @param {number|null|undefined} contextWindow
|
|
18
|
+
*/
|
|
19
|
+
export function compactionRearmed(baselineTokens, tokens, contextWindow) {
|
|
20
|
+
if (!count(tokens) || !count(baselineTokens) || !count(contextWindow) || contextWindow === 0) return false;
|
|
21
|
+
return tokens - baselineTokens >= contextWindow * COMPACTION_REARM_GROWTH_PERCENT / 100;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Compaction left usage between its target and the ceiling: another compaction
|
|
25
|
+
* cannot reach the target before one band of growth, so holding work at the ceiling
|
|
26
|
+
* would only stall it. A baseline at or above the ceiling still stops work, because
|
|
27
|
+
* the window cannot hold the history that compaction keeps.
|
|
28
|
+
* @param {number|null|undefined} baselineTokens
|
|
29
|
+
* @param {number|null|undefined} contextWindow
|
|
30
|
+
*/
|
|
31
|
+
export function compactionShortOfTarget(baselineTokens, contextWindow) {
|
|
32
|
+
if (!count(baselineTokens) || !count(contextWindow) || contextWindow === 0) return false;
|
|
33
|
+
const percent = baselineTokens / contextWindow * 100;
|
|
34
|
+
return percent >= COMPACTION_TARGET_PERCENT && percent < COMPACTION_MAX_PERCENT;
|
|
35
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {createHash} from 'node:crypto';
|
|
2
|
+
const sha=(value:string)=>createHash('sha256').update(value).digest('hex');
|
|
3
|
+
function canonical(value:any,seen=new Set<object>()):any{
|
|
4
|
+
if(value===null||typeof value==='string'||typeof value==='boolean')return value;
|
|
5
|
+
if(typeof value==='number'){if(!Number.isFinite(value))throw Error('non_json_input');return value;}
|
|
6
|
+
if(typeof value!=='object')throw Error('non_json_input');
|
|
7
|
+
if(seen.has(value))throw Error('cyclic_input');seen.add(value);
|
|
8
|
+
try{
|
|
9
|
+
if(Array.isArray(value))return value.map(v=>canonical(v,seen));
|
|
10
|
+
if(![Object.prototype,null].includes(Object.getPrototypeOf(value)))throw Error('non_json_input');
|
|
11
|
+
return Object.fromEntries(Object.keys(value).sort().filter(k=>value[k]!==undefined).map(k=>[k,canonical(value[k],seen)]));
|
|
12
|
+
}finally{seen.delete(value);}
|
|
13
|
+
}
|
|
14
|
+
/** Full JSON input identity is independent of object-key order, not of field values. */
|
|
15
|
+
export function damageActionHashes(operation:string,input:unknown):{target:string;legacyTargets:readonly string[]}{
|
|
16
|
+
const target=sha(JSON.stringify(canonical(input))),legacy=new Set<string>();
|
|
17
|
+
// Compatibility for the previously unwired v1 helpers' raw JSON hashes.
|
|
18
|
+
// Only the small, known native scalar argument shapes are enumerated.
|
|
19
|
+
const fields=operation==='bash'?['command','timeout']:operation==='write'?['path','content']:operation==='edit'?['path','oldText','newText']:[];
|
|
20
|
+
if(input&&typeof input==='object'&&!Array.isArray(input)){
|
|
21
|
+
const row=input as Record<string,unknown>,keys=Object.keys(row);
|
|
22
|
+
if(keys.length&&keys.every(k=>fields.includes(k))){
|
|
23
|
+
const visit=(prefix:string[],remaining:string[])=>{if(!remaining.length){legacy.add(sha(JSON.stringify(Object.fromEntries(prefix.map(k=>[k,row[k]])))));return;}for(const key of remaining)visit([...prefix,key],remaining.filter(k=>k!==key));};
|
|
24
|
+
visit([],keys);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return {target,legacyTargets:Object.freeze([...legacy].filter(h=>h!==target).sort())};
|
|
28
|
+
}
|
|
@@ -109,6 +109,9 @@ export function removeExemptionFromFile(filePath: string | undefined, pattern: s
|
|
|
109
109
|
* so the hub's isValidEnvelope accepts it.
|
|
110
110
|
*/
|
|
111
111
|
export interface AccessRequest {
|
|
112
|
+
/** Diagnostic correlation only; these fields never authorize access. */
|
|
113
|
+
toolCallId?: string;
|
|
114
|
+
traceOwner?: string;
|
|
112
115
|
type: "access_request";
|
|
113
116
|
msg_id: string;
|
|
114
117
|
sender_session: string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {processShared} from './process-shared.ts';
|
|
2
|
+
export interface DamageCallEvent {toolName:string;toolCallId:string;input:unknown;}
|
|
3
|
+
export interface DamageCallContext {cwd:string;revalidateBaseline?():boolean;}
|
|
4
|
+
export interface DamageGuardPort {call(event:DamageCallEvent,ctx:DamageCallContext):Promise<{block:boolean;reason?:string}>;}
|
|
5
|
+
// The Hub registers in its module instance while Damage-Control assesses in another.
|
|
6
|
+
const state=processShared<{port?:DamageGuardPort;spawned?:{assignment:unknown}}>('agent-fleet.damage-guard-port.v1',()=>({}));
|
|
7
|
+
/** Process-owned adapter only. Missing registration preserves standalone baseline, not a second provider. */
|
|
8
|
+
export function registerDamageGuard(next:DamageGuardPort){state.port=next;return ()=>{if(state.port===next)state.port=undefined;};}
|
|
9
|
+
export function assessDamageCall(event:DamageCallEvent,ctx:DamageCallContext){return state.port?state.port.call(event,ctx):Promise.resolve({block:false});}
|
|
10
|
+
export const DAMAGE_ASSIGNMENT_ENV='AF_D6_ASSIGNMENT';
|
|
11
|
+
const parsed=(raw:string):unknown=>{try{return JSON.parse(raw);}catch{return null;}};
|
|
12
|
+
/** Pi calls an extension factory without dependencies, so a native child's fresh assignment
|
|
13
|
+
* arrives through the trusted spawn environment. Damage-Control takes it before any tool runs:
|
|
14
|
+
* Bash subprocesses (tests, nested pi) never inherit the capability. Malformed transport stays
|
|
15
|
+
* assigned, so the child fails closed instead of silently losing D6. */
|
|
16
|
+
export function takeSpawnedDamageAssignment():unknown {
|
|
17
|
+
const raw=process.env[DAMAGE_ASSIGNMENT_ENV];
|
|
18
|
+
if(raw!==undefined){delete process.env[DAMAGE_ASSIGNMENT_ENV];state.spawned={assignment:parsed(raw)};}
|
|
19
|
+
return state.spawned?.assignment;
|
|
20
|
+
}
|
|
21
|
+
/** Descendant registration: a present transport wins, otherwise the copy Damage-Control took. */
|
|
22
|
+
export function spawnedDamageAssignment():unknown {
|
|
23
|
+
const raw=process.env[DAMAGE_ASSIGNMENT_ENV];
|
|
24
|
+
return raw!==undefined?parsed(raw):state.spawned?.assignment;
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {processShared} from './process-shared.ts';
|
|
2
|
+
/** Emission-local original evidence. Pi 1.1.0 passes the same event to each result hook,
|
|
3
|
+
* but loads each extension with its own module instance, so the capture is process-shared. */
|
|
4
|
+
interface EvidenceState {originals:WeakMap<object,unknown>;unavailable:WeakSet<object>;}
|
|
5
|
+
const {originals,unavailable}=processShared<EvidenceState>('agent-fleet.damage-result-evidence.v1',()=>({originals:new WeakMap(),unavailable:new WeakSet()}));
|
|
6
|
+
function freeze(value:any,seen=new Set<object>()){
|
|
7
|
+
if(!value||typeof value!=='object'||seen.has(value))return;
|
|
8
|
+
if(!Array.isArray(value)&&![Object.prototype,null].includes(Object.getPrototypeOf(value)))throw Error('unsupported_evidence');
|
|
9
|
+
seen.add(value);for(const child of Object.values(value))freeze(child,seen);Object.freeze(value);
|
|
10
|
+
}
|
|
11
|
+
export type DamageCaptureState='uncaptured'|'captured'|'failed';
|
|
12
|
+
/** Consumers requiring independent provenance must require the captured state. */
|
|
13
|
+
export function damageCaptureState(event:object):DamageCaptureState{
|
|
14
|
+
return unavailable.has(event)?'failed':originals.has(event)?'captured':'uncaptured';
|
|
15
|
+
}
|
|
16
|
+
/** Legacy parent compatibility: uncaptured is not a known capture failure. */
|
|
17
|
+
export function damageCaptureAvailable(event:object){return damageCaptureState(event)!=='failed';}
|
|
18
|
+
export function captureDamageResult<T extends {content:readonly unknown[]}>(event:T):T {
|
|
19
|
+
if(!originals.has(event)&&!unavailable.has(event)){
|
|
20
|
+
try{JSON.stringify(event);const snapshot=structuredClone(event);freeze(snapshot);originals.set(event,snapshot);}catch{unavailable.add(event);}
|
|
21
|
+
}
|
|
22
|
+
return (originals.get(event) as T|undefined)??event;
|
|
23
|
+
}
|
|
24
|
+
/** Failed capture is an explicit gap, never a mutable alias advertised as original. */
|
|
25
|
+
export function originalDamageResult<T extends object>(event:T):T|undefined{return unavailable.has(event)?undefined:(originals.get(event) as T|undefined)??event;}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Visible programmatic views carry the advisory as well as untouched original evidence. */
|
|
2
|
+
export function damageResultView<T extends {content:readonly any[];structuredContent?:unknown}>(event:T,text:string,metadata:unknown,key:'damageGuard'|'fileDiscovery'='damageGuard'):T{
|
|
3
|
+
const original=event.structuredContent;
|
|
4
|
+
const advisory={metadata,text};
|
|
5
|
+
let structuredContent:unknown=original;
|
|
6
|
+
if(typeof original==='string')structuredContent=original+'\n'+text;
|
|
7
|
+
else if(original!==undefined){
|
|
8
|
+
const plain=!!original&&typeof original==='object'&&!Array.isArray(original)&&Object.getPrototypeOf(original)===Object.prototype;
|
|
9
|
+
// D8 composes onto the D6 view without replacing its warning or original slot.
|
|
10
|
+
if(key==='fileDiscovery'&&plain&&!Object.hasOwn(original as object,key))structuredContent={...original as object,[key]:advisory};
|
|
11
|
+
else structuredContent=plain&&!Object.hasOwn(original as object,key)&&!Object.hasOwn(original as object,'originalStructuredContent')?{...original as object,originalStructuredContent:original,[key]:advisory}:{originalStructuredContent:original,[key]:advisory};
|
|
12
|
+
}
|
|
13
|
+
// Strings retain their declared native output type; the emission-local evidence
|
|
14
|
+
// snapshot and untouched original text block retain the exact original string.
|
|
15
|
+
return {...event,content:[...event.content,{type:'text',text}],structuredContent} as T;
|
|
16
|
+
}
|