@chankov/agent-fleet 2.0.18 → 2.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/proactive-external-git.ts +28 -5
- package/.pi/harnesses/agent-hub/proactive-external.ts +83 -18
- package/.pi/harnesses/agent-hub/proactive-rules.ts +3 -3
- package/.pi/harnesses/agent-hub/proactive-snapshot.ts +23 -10
- package/.pi/harnesses/agent-hub/prompts/fragments.ts +6 -6
- package/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +1 -1
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/policy-roots.js +106 -0
- package/.pi/harnesses/lib/policy-roots.ts +7 -118
- package/.versions/2.0.19/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.0.19/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.0.19/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-claude-bridge.ts +437 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet.ts +217 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/flow.ts +157 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/package-lock.json +35 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/package.json +9 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +36 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.0.19/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.0.19/.pi/agents/model-profiles.yaml +134 -0
- package/.versions/2.0.19/.pi/agents/peers.yaml +147 -0
- package/.versions/2.0.19/.pi/agents/teams.yaml +41 -0
- package/.versions/2.0.19/.pi/agents/voices.yaml +13 -0
- package/.versions/2.0.19/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.0.19/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.0.19/.pi/extensions/btw/index.ts +914 -0
- package/.versions/2.0.19/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.0.19/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/2.0.19/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.0.19/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.0.19/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.0.19/.pi/extensions/package.json +9 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.0.19/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/README.md +1483 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/acceptance.ts +199 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/access-approval.ts +135 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-hub.ts +54 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/context.ts +47 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/config/agents.ts +178 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/config/overrides.ts +165 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/budgets.ts +206 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/deterministic-fs.ts +169 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +270 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +233 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-types.ts +267 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native.ts +234 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/external-blocker.js +85 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/adapters.ts +82 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/broker.ts +125 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +33 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/descendant.ts +63 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +48 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/hub.ts +152 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +99 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/results.ts +54 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/runtime.ts +120 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/filesystem-tool.ts +185 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/fixtures/registration-surface.json +66 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/footer.ts +30 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/helpers.ts +270 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/index.ts +2625 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +133 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +144 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/no-progress.ts +593 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-activation.ts +112 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-route.ts +76 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/work-mode.ts +137 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/poll-command.ts +176 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/presentation.ts +48 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-config.ts +21 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-snapshot.ts +271 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-types.ts +67 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/process-obligations.ts +158 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/context.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/fragments.ts +95 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/recovery-contract.ts +150 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research/runtime.ts +201 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research/spawn-run.ts +194 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/return-contract.js +349 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/review-findings.js +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/run-budget.js +554 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/scope-gate.js +144 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/session-audit.ts +313 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/spawn.ts +563 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-communication-store.ts +190 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-runtime.ts +258 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-authorization.ts +122 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-config.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-obligations.ts +104 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-runtime.ts +125 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/action-executors.ts +213 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/context.ts +144 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +560 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/herdr-executors.ts +95 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/work-mode.ts +187 -0
- package/.versions/2.0.19/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/index.ts +558 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/questions.ts +161 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.0.19/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
- package/.versions/2.0.19/.pi/harnesses/coms/README.md +100 -0
- package/.versions/2.0.19/.pi/harnesses/coms/index.ts +282 -0
- package/.versions/2.0.19/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.0.19/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/README.md +135 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/index.ts +533 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.0.19/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.0.19/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.0.19/.pi/harnesses/lib/coms-core-io.ts +385 -0
- package/.versions/2.0.19/.pi/harnesses/lib/coms-core.ts +577 -0
- package/.versions/2.0.19/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget-child-prompt.ts +220 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget-view.ts +107 -0
- package/.versions/2.0.19/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.0.19/.pi/harnesses/lib/damage-control-shared.ts +226 -0
- package/.versions/2.0.19/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.0.19/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.0.19/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.0.19/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.0.19/.pi/harnesses/lib/policy-roots.js +106 -0
- package/.versions/2.0.19/.pi/harnesses/lib/policy-roots.ts +31 -0
- package/.versions/2.0.19/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.0.19/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-file-discovery.js +21 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-loader.js +44 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config-v2.js +106 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.0.19/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.0.19/.pi/harnesses/lib/update-check.ts +222 -0
- package/.versions/2.0.19/.pi/harnesses/package-lock.json +2039 -0
- package/.versions/2.0.19/.pi/harnesses/package.json +10 -0
- package/.versions/2.0.19/.pi/prompts/af-build.md +27 -0
- package/.versions/2.0.19/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.0.19/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.0.19/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.0.19/.pi/prompts/af-review.md +16 -0
- package/.versions/2.0.19/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.0.19/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.0.19/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.0.19/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.0.19/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.0.19/.pi/prompts/af-test.md +19 -0
- package/.versions/2.0.19/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.0.19/.version +1 -0
- package/.versions/2.0.19/agents/architect.md +24 -0
- package/.versions/2.0.19/agents/bowser.md +28 -0
- package/.versions/2.0.19/agents/builder.md +55 -0
- package/.versions/2.0.19/agents/code-reviewer.md +209 -0
- package/.versions/2.0.19/agents/deep-researcher.md +32 -0
- package/.versions/2.0.19/agents/documenter.md +22 -0
- package/.versions/2.0.19/agents/orchestrator.md +22 -0
- package/.versions/2.0.19/agents/plan-reviewer.md +83 -0
- package/.versions/2.0.19/agents/planner.md +105 -0
- package/.versions/2.0.19/agents/releaser.md +24 -0
- package/.versions/2.0.19/agents/researcher.md +30 -0
- package/.versions/2.0.19/agents/security-auditor.md +167 -0
- package/.versions/2.0.19/agents/test-engineer.md +153 -0
- package/.versions/2.0.19/agents/web-debugger.md +44 -0
- package/.versions/2.0.19/agents/web-performance-auditor.md +194 -0
- package/.versions/2.0.19/bin/catalog/harness-runtime-closure.json +73 -0
- package/.versions/2.0.19/codex/fleet-session-client/SKILL.md +34 -0
- package/.versions/2.0.19/codex/fleet-session-client.zip +0 -0
- package/.versions/2.0.19/docs/ARCHITECTURE.md +874 -0
- package/.versions/2.0.19/docs/agent-fleet-setup.md +1101 -0
- package/.versions/2.0.19/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.0.19/docs/codex-session-bridge.md +219 -0
- package/.versions/2.0.19/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.0.19/docs/getting-started.md +126 -0
- package/.versions/2.0.19/docs/npm-install.md +535 -0
- package/.versions/2.0.19/docs/pi-extensions.md +454 -0
- package/.versions/2.0.19/docs/pi-setup.md +92 -0
- package/.versions/2.0.19/docs/skill-anatomy.md +150 -0
- package/.versions/2.0.19/install-manifest.json +3197 -0
- package/.versions/2.0.19/justfile +247 -0
- package/.versions/2.0.19/manifest-meta.json +1075 -0
- package/.versions/2.0.19/references/accessibility-checklist.md +160 -0
- package/.versions/2.0.19/references/communication-contract.md +26 -0
- package/.versions/2.0.19/references/definition-of-done.md +67 -0
- package/.versions/2.0.19/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.0.19/references/observability-checklist.md +92 -0
- package/.versions/2.0.19/references/orchestration-patterns.md +370 -0
- package/.versions/2.0.19/references/performance-checklist.md +236 -0
- package/.versions/2.0.19/references/prompting-patterns.md +380 -0
- package/.versions/2.0.19/references/security-checklist.md +245 -0
- package/.versions/2.0.19/references/testing-patterns.md +235 -0
- package/.versions/2.0.19/references/workflow-authoring.md +304 -0
- package/.versions/2.0.19/skills/_internal/grilling.md +59 -0
- package/.versions/2.0.19/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.0.19/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.19/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.0.19/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.0.19/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.19/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.0.19/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.19/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.0.19/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.0.19/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.0.19/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.0.19/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.19/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.0.19/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.0.19/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.19/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.19/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.19/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.19/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.0.19/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.0.19/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.0.19/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.0.19/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.19/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.0.19/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.0.19/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.0.19/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.0.19/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.19/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.0.19/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.0.19/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +6 -0
- package/bin/cli.js +1 -1
- package/bin/lib/doctor.js +8 -2
- package/bin/lib/system1-migration.js +17 -8
- package/bin/lib/system1-policy-context.js +57 -0
- package/bin/lib/transaction.js +1 -1
- package/docs/agent-fleet-setup.md +1 -1
- package/docs/external-project-ai-content.md +17 -1
- package/install-manifest.json +5 -1
- package/manifest-meta.json +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as crypto from "node:crypto";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as net from "node:net";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
|
|
6
|
+
import type { MonitorRegistration } from "./hermes-monitor-registry.ts";
|
|
7
|
+
|
|
8
|
+
export const MAX_SOCKET_FRAME_BYTES = 64 * 1024;
|
|
9
|
+
export const MAX_SNAPSHOT_BYTES = 256 * 1024;
|
|
10
|
+
export const MAX_CANCEL_RESPONSE_BYTES = 16 * 1024;
|
|
11
|
+
export const PARTIAL_FRAME_TIMEOUT_MS = 1000;
|
|
12
|
+
export const MAX_SOCKET_CONNECTIONS = 32;
|
|
13
|
+
export const MAX_TASK_ID_LENGTH = 128;
|
|
14
|
+
export const MAX_AFTER_SEQUENCE = 1_000_000_000;
|
|
15
|
+
/** 2 MiB covers the 256 KiB retained UTF-8 output after worst-case JSON escaping plus its envelope. */
|
|
16
|
+
export const MAX_OUTPUT_RESPONSE_BYTES = 2 * 1024 * 1024;
|
|
17
|
+
export const MAX_EVENT_WAITERS = 8;
|
|
18
|
+
export const MAX_EVENT_WAIT_MS = 25_000;
|
|
19
|
+
|
|
20
|
+
interface SnapshotRequest {
|
|
21
|
+
type: "snapshot";
|
|
22
|
+
token: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function authorized(actual: string, expected: string): boolean {
|
|
26
|
+
const actualBytes = Buffer.from(actual);
|
|
27
|
+
const expectedBytes = Buffer.from(expected);
|
|
28
|
+
return actualBytes.length === expectedBytes.length && crypto.timingSafeEqual(actualBytes, expectedBytes);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function validTaskRequest(taskId: unknown, generation: unknown, afterSequence?: unknown): boolean { return typeof taskId === "string" && /^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(taskId) && taskId.length <= MAX_TASK_ID_LENGTH && Number.isInteger(generation) && (generation as number) >= 1 && (afterSequence === undefined || (Number.isInteger(afterSequence) && (afterSequence as number) >= 0 && (afterSequence as number) <= MAX_AFTER_SEQUENCE)); }
|
|
32
|
+
|
|
33
|
+
function parseRequest(frame: string): SnapshotRequest | null {
|
|
34
|
+
try {
|
|
35
|
+
const value = JSON.parse(frame) as Partial<SnapshotRequest>;
|
|
36
|
+
if (value.type !== "snapshot" || typeof value.token !== "string") return null;
|
|
37
|
+
return { type: "snapshot", token: value.token };
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class MonitorSocketServer {
|
|
44
|
+
private readonly registration: MonitorRegistration;
|
|
45
|
+
private readonly server: net.Server;
|
|
46
|
+
private connections = 0;
|
|
47
|
+
private eventWaiters = 0;
|
|
48
|
+
private readonly sockets = new Set<net.Socket>();
|
|
49
|
+
|
|
50
|
+
constructor(registration: MonitorRegistration) {
|
|
51
|
+
this.registration = registration;
|
|
52
|
+
// Consumers are documented to half-close after writing their single frame.
|
|
53
|
+
// Without allowHalfOpen the runtime would end our writable side on that FIN,
|
|
54
|
+
// silently dropping any response that settles later than the current turn —
|
|
55
|
+
// every long-poll `events` reply, and any cancel that waits on a real exit.
|
|
56
|
+
this.server = net.createServer({ allowHalfOpen: true }, (socket) => {
|
|
57
|
+
if (this.connections >= MAX_SOCKET_CONNECTIONS) { socket.destroy(); return; }
|
|
58
|
+
this.connections += 1;
|
|
59
|
+
this.sockets.add(socket);
|
|
60
|
+
socket.once("close", () => { this.connections -= 1; this.sockets.delete(socket); });
|
|
61
|
+
this.handle(socket);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private assertOwnedSocketPath(): void {
|
|
66
|
+
if (!this.registration.socketDir || path.resolve(this.registration.socketPath) !== path.join(path.resolve(this.registration.socketDir), "s")) throw new Error("monitor socket path is not registry-owned");
|
|
67
|
+
if (fs.lstatSync(this.registration.socketDir).isSymbolicLink() || (fs.statSync(this.registration.socketDir).mode & 0o777) !== 0o700) throw new Error("monitor socket directory is unsafe");
|
|
68
|
+
}
|
|
69
|
+
private async removeVerifiedStaleSocket(): Promise<void> {
|
|
70
|
+
this.assertOwnedSocketPath(); if (!fs.existsSync(this.registration.socketPath)) return;
|
|
71
|
+
const active=await new Promise<boolean>(resolve=>{const probe=net.createConnection(this.registration.socketPath);probe.once("connect",()=>{probe.destroy();resolve(true);});probe.once("error",()=>resolve(false));});
|
|
72
|
+
if (active) throw new Error("monitor socket is already active");
|
|
73
|
+
if (fs.lstatSync(this.registration.socketPath).isSymbolicLink()) throw new Error("monitor socket must not be a symlink"); fs.unlinkSync(this.registration.socketPath);
|
|
74
|
+
}
|
|
75
|
+
async listen(): Promise<void> {
|
|
76
|
+
await this.removeVerifiedStaleSocket(); return new Promise((resolve, reject) => { this.server.once("error", reject); this.server.listen(this.registration.socketPath, () => { this.server.off("error", reject); fs.chmodSync(this.registration.socketPath, 0o600); resolve(); }); });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async close(): Promise<void> {
|
|
80
|
+
for (const socket of this.sockets) socket.destroy();
|
|
81
|
+
await new Promise<void>((resolve, reject) => this.server.close((error) => error ? reject(error) : resolve()));
|
|
82
|
+
this.assertOwnedSocketPath(); try { fs.unlinkSync(this.registration.socketPath); } catch (error: any) { if (error?.code !== "ENOENT") throw error; }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
mode(): number {
|
|
86
|
+
return fs.statSync(this.registration.socketPath).mode & 0o777;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private handle(socket: net.Socket): void {
|
|
90
|
+
// A long-poll callback may settle after its peer disconnects. Keep that
|
|
91
|
+
// late write local to this connection instead of emitting an unhandled error.
|
|
92
|
+
socket.on("error", () => {});
|
|
93
|
+
let buffer = "";
|
|
94
|
+
let handled = false;
|
|
95
|
+
const deadline = setTimeout(() => { if (!handled) socket.destroy(); }, PARTIAL_FRAME_TIMEOUT_MS);
|
|
96
|
+
socket.on("data", (chunk) => {
|
|
97
|
+
if (handled) return;
|
|
98
|
+
buffer += chunk.toString("utf8");
|
|
99
|
+
if (Buffer.byteLength(buffer, "utf8") > MAX_SOCKET_FRAME_BYTES) {
|
|
100
|
+
socket.destroy();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const newline = buffer.indexOf("\n");
|
|
104
|
+
if (newline < 0) return;
|
|
105
|
+
handled = true;
|
|
106
|
+
const request = parseRequest(buffer.slice(0, newline));
|
|
107
|
+
clearTimeout(deadline);
|
|
108
|
+
let value: { type?: string; token?: string; taskId?: string; generation?: number };
|
|
109
|
+
try { value = JSON.parse(buffer.slice(0, newline)) as typeof value; } catch { socket.destroy(); return; }
|
|
110
|
+
if (value.type === "events") {
|
|
111
|
+
if (!authorized(String(value.token ?? ""), this.registration.token)) { socket.end(JSON.stringify({ ok: false, error: "unauthorized" }) + "\n"); return; }
|
|
112
|
+
const afterSequence=(value as any).afterSequence, limit=(value as any).limit, waitMs=(value as any).waitMs;
|
|
113
|
+
if (!this.registration.events || !Number.isInteger(afterSequence) || afterSequence < 0 || afterSequence > MAX_AFTER_SEQUENCE || !Number.isInteger(limit) || limit < 1 || limit > 100 || !Number.isInteger(waitMs) || waitMs < 0 || waitMs > MAX_EVENT_WAIT_MS) { socket.destroy(); return; }
|
|
114
|
+
if (waitMs > 0 && this.eventWaiters >= MAX_EVENT_WAITERS) { socket.end(JSON.stringify({ ok: false, error: "too_many_waiters" }) + "\n"); return; }
|
|
115
|
+
let waiterReleased = false;
|
|
116
|
+
const releaseWaiter = () => {
|
|
117
|
+
if (waitMs > 0 && !waiterReleased) { waiterReleased = true; this.eventWaiters--; }
|
|
118
|
+
};
|
|
119
|
+
const abort = new AbortController();
|
|
120
|
+
if (waitMs > 0) {
|
|
121
|
+
this.eventWaiters++;
|
|
122
|
+
// Release on FIN as well as close: with allowHalfOpen a gone peer is
|
|
123
|
+
// otherwise indistinguishable from a live one, and a parked waiter
|
|
124
|
+
// would hold a slot for the full wait window. A client that wants to
|
|
125
|
+
// park on a long poll keeps its write side open (as the watcher does);
|
|
126
|
+
// one that half-closes gets an immediate bounded reply instead.
|
|
127
|
+
const release = () => { abort.abort(); releaseWaiter(); };
|
|
128
|
+
socket.once("close", release);
|
|
129
|
+
socket.once("end", release);
|
|
130
|
+
}
|
|
131
|
+
Promise.resolve().then(()=>this.registration.events!({afterSequence,limit,waitMs,signal:abort.signal})).then((events:any)=>{
|
|
132
|
+
if (events?.error === "cursor_too_old") socket.end(JSON.stringify({ ok: false, error: "cursor_too_old", snapshotRequired: true, firstAvailableSequence: events.firstAvailableSequence, latestSequence: events.latestSequence }) + "\n");
|
|
133
|
+
else socket.end(JSON.stringify({ok:true,events})+"\n");
|
|
134
|
+
}).catch(()=>socket.end(JSON.stringify({ok:false,error:"monitor_unavailable"})+"\n")).finally(releaseWaiter); return;
|
|
135
|
+
}
|
|
136
|
+
if (value.type === "invoke") {
|
|
137
|
+
if (!authorized(String(value.token ?? ""), this.registration.token)) { socket.end(JSON.stringify({ ok: false, error: "unauthorized" }) + "\n"); return; }
|
|
138
|
+
if (!this.registration.invoke) { socket.end(JSON.stringify({ ok: false, error: "unsupported" }) + "\n"); return; }
|
|
139
|
+
const request={...(value as any)}; delete (request as any).token; delete (request as any).type;
|
|
140
|
+
Promise.resolve().then(()=>this.registration.invoke!(request)).then(result=>socket.end(JSON.stringify({ok:true,result})+"\n")).catch(()=>socket.end(JSON.stringify({ok:false,error:"monitor_unavailable"})+"\n")); return;
|
|
141
|
+
}
|
|
142
|
+
if (value.type === "output") {
|
|
143
|
+
if (!authorized(String(value.token ?? ""), this.registration.token)) { socket.end(JSON.stringify({ ok: false, error: "unauthorized" }) + "\n"); return; }
|
|
144
|
+
if (!this.registration.output || (value as any).afterSequence === undefined || !validTaskRequest(value.taskId, value.generation, (value as any).afterSequence)) { socket.destroy(); return; }
|
|
145
|
+
Promise.resolve().then(()=>this.registration.output!({ taskId: value.taskId!, generation: value.generation!, afterSequence: (value as any).afterSequence })).then((output) => { const body=JSON.stringify({ ok:true, output }); if(Buffer.byteLength(body)>MAX_OUTPUT_RESPONSE_BYTES) socket.end(JSON.stringify({ok:false,error:"response_too_large"})+"\n"); else socket.end(body+"\n"); }).catch(()=>socket.end(JSON.stringify({ok:false,error:"monitor_unavailable"})+"\n")); return;
|
|
146
|
+
}
|
|
147
|
+
if (value.type === "cancel") {
|
|
148
|
+
if (!authorized(String(value.token ?? ""), this.registration.token)) { socket.end(JSON.stringify({ ok: false, error: "unauthorized" }) + "\n"); return; }
|
|
149
|
+
if (!this.registration.cancel || !validTaskRequest(value.taskId, value.generation)) { socket.destroy(); return; }
|
|
150
|
+
Promise.resolve().then(()=>this.registration.cancel!({ taskId: value.taskId!, generation: value.generation! })).then((result) => { const body=JSON.stringify({ ok: true, result }); if (Buffer.byteLength(body, "utf8") > MAX_CANCEL_RESPONSE_BYTES) socket.end(JSON.stringify({ok:false,error:"response_too_large"})+"\n"); else socket.end(body + "\n"); }).catch(()=>socket.end(JSON.stringify({ok:false,error:"monitor_unavailable"})+"\n")); return;
|
|
151
|
+
}
|
|
152
|
+
if (!request || !authorized(request.token, this.registration.token)) {
|
|
153
|
+
if (request) socket.end(JSON.stringify({ ok: false, error: "unauthorized" }) + "\n");
|
|
154
|
+
else socket.destroy();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
try { const response = JSON.stringify({ ok: true, snapshot: this.registration.snapshot() }); if (Buffer.byteLength(response, "utf8") > MAX_SNAPSHOT_BYTES) socket.end(JSON.stringify({ok:false,error:"response_too_large"})+"\n"); else socket.end(response + "\n"); } catch { socket.end(JSON.stringify({ok:false,error:"monitor_unavailable"})+"\n"); }
|
|
158
|
+
});
|
|
159
|
+
socket.on("end", () => {
|
|
160
|
+
if (!handled) socket.destroy();
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createChildTask, createParentTask, type CreateChildTaskInput, type CreateParentTaskInput, type MonitorTask } from "./hermes-monitor-model.ts";
|
|
2
|
+
export const MAX_OUTPUT_BYTES=256*1024;
|
|
3
|
+
export const MONITOR_RETENTION_MS=7*24*60*60*1000;
|
|
4
|
+
export const MONITOR_RETENTION_MAX=200;
|
|
5
|
+
const terminal=new Set(["completed","blocked","failed","cancelled","orphaned","done"]);
|
|
6
|
+
const active=(state:string)=>state==="starting"||state==="running"||state==="cancelling"||state==="recovering";
|
|
7
|
+
export function pruneMonitorTasks<T extends {state:string;updatedAt?:string}>(options:{now:Date;tasks:T[]}):T[]{const cutoff=options.now.getTime()-MONITOR_RETENTION_MS;const running=options.tasks.filter(t=>active(t.state));const terminalTasks=options.tasks.filter(t=>!active(t.state)&&(!t.updatedAt||new Date(t.updatedAt).getTime()>=cutoff)).sort((a,b)=>new Date(a.updatedAt??0).getTime()-new Date(b.updatedAt??0).getTime()).slice(-MONITOR_RETENTION_MAX);return [...running,...terminalTasks];}
|
|
8
|
+
export interface MonitorOutput{text:string;sequence:number;firstSequence:number;truncated:boolean}
|
|
9
|
+
interface StoredOutput{chunks:{sequence:number;text:string}[];sequence:number;truncated:boolean}
|
|
10
|
+
interface StoredTask{task:MonitorTask;output:StoredOutput;createdAt:string;updatedAt:string}
|
|
11
|
+
function suffix(text:string,limit:number){let bytes=0;const chars:string[]=[];for(const char of Array.from(text).reverse()){const size=Buffer.byteLength(char);if(bytes+size>limit)break;chars.push(char);bytes+=size;}return chars.reverse().join("");}
|
|
12
|
+
|
|
13
|
+
export class MonitorStore {
|
|
14
|
+
private readonly tasks=new Map<string,StoredTask>(); private readonly now:()=>Date;
|
|
15
|
+
constructor(options:{now?:()=>Date}={}){this.now=options.now??(()=>new Date());}
|
|
16
|
+
private key(id:string,generation:number){return `${id}:${generation}`;} private stamp(){return this.now().toISOString();}
|
|
17
|
+
createParent(input:CreateParentTaskInput){return this.add(createParentTask(input));}
|
|
18
|
+
createChild(input:CreateChildTaskInput){if(![...this.tasks.values()].some(s=>s.task.id===input.parentId&&s.task.generation===input.parentGeneration&&s.task.kind==="parent"))throw new Error(`parent task ${input.parentId} was not found`);return this.add(createChildTask(input));}
|
|
19
|
+
patch(id:string,generation:number,values:any){const stored=this.require(id,generation);Object.assign(stored.task,values);stored.updatedAt=this.stamp();return stored.task;}
|
|
20
|
+
transition(id:string,generation:number,state:any){const stored=this.require(id,generation);if(terminal.has(stored.task.state))throw new Error("terminal transition");stored.task.state=state;stored.updatedAt=this.stamp();return stored.task;}
|
|
21
|
+
get(id:string,generation?:number){return generation===undefined?[...this.tasks.values()].find(s=>s.task.id===id)?.task:this.tasks.get(this.key(id,generation))?.task;}
|
|
22
|
+
appendPublicOutput(id:string,generation:number,text:string){const stored=this.require(id,generation);if(terminal.has(stored.task.state))throw new Error("terminal output");const sequence=stored.output.sequence+1, chunk=suffix(text,MAX_OUTPUT_BYTES),chunks=[...stored.output.chunks,{sequence,text:chunk}];let bytes=chunks.reduce((n,c)=>n+Buffer.byteLength(c.text),0),truncated=stored.output.truncated||bytes<Buffer.byteLength(text);while(bytes>MAX_OUTPUT_BYTES&&chunks.length>1){bytes-=Buffer.byteLength(chunks.shift()!.text);truncated=true;}stored.output={chunks,sequence,truncated};stored.updatedAt=this.stamp();return this.outputAfter(stored.output,0);}
|
|
23
|
+
readOutput(id:string,generation:number,afterSequence:number){return this.outputAfter(this.require(id,generation).output,afterSequence);}
|
|
24
|
+
snapshot(){return {tasks:[...this.tasks.values()].map(s=>this.publicTask(s))};} durableSnapshot(){return{tasks:[...this.tasks.values()].map(s=>({...this.publicTask(s),outputChunks:s.output.chunks.map(c=>({...c}),),outputLatestSequence:s.output.sequence,outputFirstSequence:s.output.chunks[0]?.sequence??0,outputTruncated:s.output.truncated}))};} restore(rows:any[]){for(const row of rows){const key=this.key(row.id,row.generation);if(this.tasks.has(key))continue;const output=row.output??"";this.tasks.set(key,{task:{...row},output:{chunks:Array.isArray(row.outputChunks)?row.outputChunks.map((c:any)=>({sequence:c.sequence,text:c.text})):output?[{sequence:row.outputSequence??1,text:output}]:[],sequence:row.outputLatestSequence??row.outputSequence??0,truncated:row.outputTruncated??!!row.truncated},createdAt:row.createdAt??this.stamp(),updatedAt:row.updatedAt??this.stamp()});}}
|
|
25
|
+
prune(now=this.now()){const cutoff=now.getTime()-MONITOR_RETENTION_MS;const values=[...this.tasks.values()];const protectedIds=new Set<string>();for(const s of values)if(active(s.task.state)){protectedIds.add(this.key(s.task.id,s.task.generation));if(s.task.parentId)for(const p of values)if(p.task.id===s.task.parentId)protectedIds.add(this.key(p.task.id,p.task.generation));for(const c of values)if(c.task.parentId===s.task.id)protectedIds.add(this.key(c.task.id,c.task.generation));}const candidates=values.filter(s=>!active(s.task.state)&&!protectedIds.has(this.key(s.task.id,s.task.generation))).sort((a,b)=>Date.parse(a.updatedAt)-Date.parse(b.updatedAt));const expired=candidates.filter(s=>Date.parse(s.updatedAt)<cutoff);for(const s of expired)this.tasks.delete(this.key(s.task.id,s.task.generation));const remaining=[...this.tasks.values()].filter(s=>!active(s.task.state)&&!protectedIds.has(this.key(s.task.id,s.task.generation))).sort((a,b)=>Date.parse(a.updatedAt)-Date.parse(b.updatedAt));while(remaining.length>MONITOR_RETENTION_MAX){const oldest=remaining.shift()!;this.tasks.delete(this.key(oldest.task.id,oldest.task.generation));}return this.snapshot();}
|
|
26
|
+
private add(task:MonitorTask){const key=this.key(task.id,task.generation);if(this.tasks.has(key))throw new Error(`task ${task.id} generation ${task.generation} already exists`);const stamp=this.stamp();this.tasks.set(key,{task,output:{chunks:[],sequence:0,truncated:false},createdAt:stamp,updatedAt:stamp});return task;}
|
|
27
|
+
private publicTask(s:StoredTask){const output=this.outputAfter(s.output,0);return {...s.task,createdAt:s.createdAt,updatedAt:s.updatedAt,outputSequence:output.sequence,firstSequence:output.firstSequence,truncated:output.truncated};}
|
|
28
|
+
private outputAfter(output:StoredOutput,after:number):MonitorOutput{return{text:output.chunks.filter(c=>c.sequence>after).map(c=>c.text).join(""),sequence:output.sequence,firstSequence:output.chunks[0]?.sequence??0,truncated:output.truncated};}
|
|
29
|
+
private require(id:string,generation:number){const stored=this.tasks.get(this.key(id,generation));if(!stored)throw new Error(`task ${id} generation ${generation} was not found`);return stored;}
|
|
30
|
+
}
|
|
31
|
+
export function createMonitorStore(options:{now:()=>Date}){const store=new MonitorStore(options);const baseSnapshot=store.snapshot.bind(store);return Object.assign(store,{snapshot(){const all=(baseSnapshot() as any).tasks;return{tasks:all.filter((t:any)=>t.kind==='parent').map((parent:any)=>({id:parent.id,generation:parent.generation,children:all.filter((child:any)=>child.parentId===parent.id).map((child:any)=>({id:child.id,generation:child.generation,state:child.state,workspaceId:child.workspaceId,hubPaneId:child.hubPaneId,outputSequence:child.outputSequence,updatedAt:child.updatedAt}))}))};}});}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Shared runtime for Hub and the JavaScript-only CLI. Types live in policy-roots.ts.
|
|
2
|
+
import { realpathSync, statSync } from "node:fs";
|
|
3
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
4
|
+
|
|
5
|
+
const deniedSegment = /^(?:\.git|\.pi|node_modules|vendor|dist|build|coverage|\.env(?:\..*)?|credentials?|secrets?)$/i;
|
|
6
|
+
const denied = path => path.split(/[\\/]/).some(part => deniedSegment.test(part));
|
|
7
|
+
function inside(root, target) {
|
|
8
|
+
const rel = relative(root, target);
|
|
9
|
+
return rel === "" || (!isAbsolute(rel) && rel !== ".." && !rel.startsWith(`..${sep}`));
|
|
10
|
+
}
|
|
11
|
+
function covers(root, target, base = root.canonicalPath) {
|
|
12
|
+
return root.kind === "file" ? target === base : inside(base, target);
|
|
13
|
+
}
|
|
14
|
+
function currentRoot(root) {
|
|
15
|
+
let canonical;
|
|
16
|
+
try { canonical = realpathSync(root.lexicalPath); }
|
|
17
|
+
catch { throw new Error(`root_changed:${root.configuredPath}`); }
|
|
18
|
+
if (canonical !== root.canonicalPath) throw new Error(`root_changed:${root.configuredPath}`);
|
|
19
|
+
const stat = statSync(root.lexicalPath);
|
|
20
|
+
if (root.kind === "directory" ? !stat.isDirectory() : !stat.isFile()) throw new Error(`root_changed:${root.configuredPath}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Explicit read grants only; not capture consent, registration or write ownership. */
|
|
24
|
+
export function resolvePolicyRoots(checkout, config) {
|
|
25
|
+
const workspace = realpathSync(checkout);
|
|
26
|
+
const roots = [Object.freeze({ id: "workspace", role: "workspace", configuredPath: ".", lexicalPath: resolve(checkout), canonicalPath: workspace, kind: "directory" })];
|
|
27
|
+
const diagnostics = [];
|
|
28
|
+
const note = (code, path) => diagnostics.push(Object.freeze({ code, path, message: `${code}:${path}` }));
|
|
29
|
+
for (const [role, paths] of [["rules", config.rulesDirs ?? []], ["docs", config.docsPaths ?? []]]) {
|
|
30
|
+
for (const configuredPath of paths) {
|
|
31
|
+
if (!configuredPath || isAbsolute(configuredPath) || configuredPath.includes("\\")) { note("invalid_root", configuredPath); continue; }
|
|
32
|
+
const lexicalPath = resolve(checkout, configuredPath);
|
|
33
|
+
if (denied(configuredPath)) { note("denied_path", configuredPath); continue; }
|
|
34
|
+
let canonicalPath;
|
|
35
|
+
try { canonicalPath = realpathSync(lexicalPath); }
|
|
36
|
+
catch { note("missing_root", configuredPath); continue; }
|
|
37
|
+
if (denied(canonicalPath)) { note("denied_path", configuredPath); continue; }
|
|
38
|
+
if (canonicalPath !== workspace && inside(canonicalPath, workspace)) { note("unsafe_root", configuredPath); continue; }
|
|
39
|
+
const stat = statSync(canonicalPath);
|
|
40
|
+
if ((!stat.isDirectory() && !stat.isFile()) || (role === "rules" && !stat.isDirectory())) { note("invalid_root_type", configuredPath); continue; }
|
|
41
|
+
if (roots.some(root => root.role === role && root.canonicalPath === canonicalPath)) { note("duplicate_root", configuredPath); continue; }
|
|
42
|
+
const root = Object.freeze({ id: `${role}:${canonicalPath}`, role, configuredPath, lexicalPath, canonicalPath, kind: stat.isDirectory() ? "directory" : "file" });
|
|
43
|
+
for (const existing of roots.filter(r => r.role !== "workspace")) {
|
|
44
|
+
if (covers(existing, canonicalPath) || covers(root, existing.canonicalPath)) note("overlapping_roots", configuredPath);
|
|
45
|
+
}
|
|
46
|
+
roots.push(root);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return Object.freeze({ workspace, roots: Object.freeze(roots), diagnostics: Object.freeze(diagnostics) });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Revalidate lexical/canonical containment and root identity before every access. */
|
|
53
|
+
export function authorizePolicyPath(table, path, operation = "read") {
|
|
54
|
+
const target = resolve(table.workspace, path);
|
|
55
|
+
if (denied(path)) throw new Error(`denied_path:${path}`);
|
|
56
|
+
const candidates = table.roots.filter(root => covers(root, target, root.lexicalPath) || covers(root, target));
|
|
57
|
+
candidates.sort((a, b) => (a.role === "workspace" ? 1 : 0) - (b.role === "workspace" ? 1 : 0) || b.canonicalPath.length - a.canonicalPath.length || a.id.localeCompare(b.id));
|
|
58
|
+
const root = candidates[0];
|
|
59
|
+
if (!root) throw new Error(`ungranted_path:${path}`);
|
|
60
|
+
currentRoot(root);
|
|
61
|
+
let canonical;
|
|
62
|
+
try { canonical = realpathSync(target); }
|
|
63
|
+
catch { throw new Error(`missing_path:${path}`); }
|
|
64
|
+
if (!covers(root, canonical)) throw new Error(`canonical_escape:${path}`);
|
|
65
|
+
if (denied(canonical)) throw new Error(`denied_path:${path}`);
|
|
66
|
+
if (operation === "inventory" && (root.kind !== "directory" || !statSync(canonical).isDirectory())) throw new Error(`inventory_requires_directory:${path}`);
|
|
67
|
+
return { root, path: canonical };
|
|
68
|
+
}
|
|
69
|
+
export function resolvePolicyReferences(table, paths, role) {
|
|
70
|
+
return paths.map(path => {
|
|
71
|
+
const target = resolve(table.workspace, path);
|
|
72
|
+
if (inside(table.workspace, target)) return path;
|
|
73
|
+
const source = authorizePolicyPath(table, path);
|
|
74
|
+
if (source.root.role !== role) throw new Error(`ungranted_reference:${path}`);
|
|
75
|
+
return source.path;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export function policyRootValidationContext(table) {
|
|
79
|
+
return { externalIncludeAllowed: include => {
|
|
80
|
+
const subtree = include.endsWith("/**");
|
|
81
|
+
const path = subtree ? include.slice(0, -3) : include;
|
|
82
|
+
try {
|
|
83
|
+
const source = authorizePolicyPath(table, path, subtree ? "inventory" : "read");
|
|
84
|
+
return source.root.role !== "workspace";
|
|
85
|
+
} catch { return false; }
|
|
86
|
+
} };
|
|
87
|
+
}
|
|
88
|
+
/** Legacy logical identities never select ambiguous sources or approve a changed pin. */
|
|
89
|
+
export function resolveRuleBinding(table, logicalPath) {
|
|
90
|
+
if (!logicalPath.startsWith(".ai/rules/") || logicalPath.includes("\\") || logicalPath.split("/").some(part => !part || part === "." || part === "..") || denied(logicalPath)) throw new Error(`invalid_binding:${logicalPath}`);
|
|
91
|
+
const suffix = logicalPath.slice(".ai/rules/".length);
|
|
92
|
+
const candidates = [];
|
|
93
|
+
const paths = [resolve(table.workspace, logicalPath), ...table.roots.filter(root => root.role === "rules").map(root => resolve(root.lexicalPath, suffix))];
|
|
94
|
+
for (const path of paths) {
|
|
95
|
+
let candidate;
|
|
96
|
+
try { candidate = authorizePolicyPath(table, path); }
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (error instanceof Error && error.message.startsWith("missing_path:")) continue;
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
if (!statSync(candidate.path).isFile()) throw new Error(`invalid_binding_type:${logicalPath}`);
|
|
102
|
+
if (!candidates.some(item => item.path === candidate.path)) candidates.push(candidate);
|
|
103
|
+
}
|
|
104
|
+
if (candidates.length !== 1) throw new Error(`${candidates.length ? "ambiguous_binding" : "missing_binding"}:${logicalPath}`);
|
|
105
|
+
return candidates[0];
|
|
106
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Typed facade over the runtime shared with the JavaScript-only CLI.
|
|
2
|
+
import * as runtime from "./policy-roots.js";
|
|
3
|
+
|
|
4
|
+
export type PolicyRole = "workspace" | "rules" | "docs";
|
|
5
|
+
export interface PolicyRoot {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly role: PolicyRole;
|
|
8
|
+
readonly configuredPath: string;
|
|
9
|
+
readonly lexicalPath: string;
|
|
10
|
+
readonly canonicalPath: string;
|
|
11
|
+
readonly kind: "directory" | "file";
|
|
12
|
+
}
|
|
13
|
+
export interface PolicyRootDiagnostic {
|
|
14
|
+
readonly code: string;
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly message: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PolicyRootTable {
|
|
19
|
+
readonly workspace: string;
|
|
20
|
+
readonly roots: readonly PolicyRoot[];
|
|
21
|
+
readonly diagnostics: readonly PolicyRootDiagnostic[];
|
|
22
|
+
}
|
|
23
|
+
export interface AuthorizedPolicyPath {
|
|
24
|
+
readonly root: PolicyRoot;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
}
|
|
27
|
+
export const resolvePolicyRoots = runtime.resolvePolicyRoots as (checkout: string, config: { rulesDirs?: readonly string[]; docsPaths?: readonly string[] }) => PolicyRootTable;
|
|
28
|
+
export const authorizePolicyPath = runtime.authorizePolicyPath as (table: PolicyRootTable, path: string, operation?: "read" | "inventory") => AuthorizedPolicyPath;
|
|
29
|
+
export const resolvePolicyReferences = runtime.resolvePolicyReferences as (table: PolicyRootTable, paths: readonly string[], role: "rules" | "docs") => string[];
|
|
30
|
+
export const policyRootValidationContext = runtime.policyRootValidationContext as (table: PolicyRootTable) => { externalIncludeAllowed(include: string): boolean };
|
|
31
|
+
export const resolveRuleBinding = runtime.resolveRuleBinding as (table: PolicyRootTable, logicalPath: string) => AuthorizedPolicyPath;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import {closeSync,constants,fstatSync,lstatSync,openSync,readSync,realpathSync} from 'node:fs';
|
|
3
|
+
import {isAbsolute,join,relative,resolve} from 'node:path';
|
|
4
|
+
export function checkedSourcePath(root,path) {
|
|
5
|
+
const realRoot=realpathSync(root), full=resolve(path), rel=relative(realRoot,full);
|
|
6
|
+
if(!rel||rel.startsWith('..')||isAbsolute(rel))throw Error('source_denied');
|
|
7
|
+
let cursor=realRoot;
|
|
8
|
+
for(const part of rel.split('/')) {cursor=join(cursor,part);if(lstatSync(cursor).isSymbolicLink())throw Error('source_denied');}
|
|
9
|
+
if(realpathSync(full)!==full)throw Error('source_denied');
|
|
10
|
+
return full;
|
|
11
|
+
}
|
|
12
|
+
export function safeSourceRead(root,path,maxBytes,check=()=>{},afterFirstRead=()=>{}) {
|
|
13
|
+
check();const full=checkedSourcePath(root,path), fd=openSync(full,constants.O_RDONLY|constants.O_NOFOLLOW|constants.O_NONBLOCK);
|
|
14
|
+
try {
|
|
15
|
+
const before=fstatSync(fd);
|
|
16
|
+
if(!before.isFile())throw Error('source_denied');
|
|
17
|
+
if(before.size>maxBytes)throw Error('state_too_large');
|
|
18
|
+
// Recheck the opened descriptor against the fenced pathname before any bytes
|
|
19
|
+
// are read, including an ancestor swapped between the preflight and open.
|
|
20
|
+
checkedSourcePath(root,full);const opened=lstatSync(full);
|
|
21
|
+
if(opened.ino!==before.ino||opened.dev!==before.dev)throw Error('source_changed');
|
|
22
|
+
const read=()=>{const b=Buffer.alloc(before.size);let offset=0;while(offset<b.length){check();const n=readSync(fd,b,offset,b.length-offset,offset);if(!n)throw Error('source_changed');offset+=n;}return b;};
|
|
23
|
+
const bytes=read();afterFirstRead();const confirm=read(),after=fstatSync(fd);checkedSourcePath(root,full);const final=lstatSync(full);
|
|
24
|
+
if(!bytes.equals(confirm)||['size','mtimeMs','ctimeMs','ino','dev'].some(k=>before[k]!==after[k])||final.ino!==after.ino||final.dev!==after.dev)throw Error('source_changed');
|
|
25
|
+
if(bytes.includes(0))throw Error('source_denied');
|
|
26
|
+
try{new TextDecoder('utf-8',{fatal:true}).decode(bytes);}catch{throw Error('source_denied');}
|
|
27
|
+
check();return bytes;
|
|
28
|
+
}finally{closeSync(fd);}
|
|
29
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// Spawned coms peers: pane launch, readiness policy and the never-addressed sweep.
|
|
2
|
+
//
|
|
3
|
+
// Lives in the SHARED harness lib, not under agent-hub: `just fleet peer`
|
|
4
|
+
// (.pi/agent-fleet/scripts/peer-launch.ts) launches a single peer with the same pane plumbing
|
|
5
|
+
// and the same readiness timings, and the fleet scripts are installed into
|
|
6
|
+
// target projects that may not have selected the agent-hub harness at all.
|
|
7
|
+
//
|
|
8
|
+
// Root cause this encodes: `herdr_spawn_peer` launches a REUSABLE coms peer —
|
|
9
|
+
// it boots idle and waits for a `coms_send`. Spawning it delivers no work. One
|
|
10
|
+
// session spawned `repair-builder` and `final-test-worker`, sent all twelve of
|
|
11
|
+
// its messages to a third peer, and left two empty panes named like workers.
|
|
12
|
+
// The spawns were a sound reaction to a broken session; nothing told the
|
|
13
|
+
// dispatcher when the peers became addressable, and nothing noticed they never
|
|
14
|
+
// were addressed.
|
|
15
|
+
//
|
|
16
|
+
// Two answers: the spawn returns a readiness verdict instead of a bare pane id,
|
|
17
|
+
// and an unaddressed hub-spawned peer is named at the end of the session.
|
|
18
|
+
|
|
19
|
+
// Second root cause this encodes: herdr's `pane.split` takes NO command — a
|
|
20
|
+
// split always opens a plain interactive shell in `cwd`. The hub used to pass
|
|
21
|
+
// `command: argv` to it; herdr silently ignores unknown params, so every
|
|
22
|
+
// "spawned peer" was an empty shell pane with the right label, the tool
|
|
23
|
+
// reported success, and the peer never existed. `just fleet team` was
|
|
24
|
+
// unaffected because it launches through `layout.apply`, whose pane nodes DO
|
|
25
|
+
// carry an argv. A hub spawn is therefore three steps: split, wait for the
|
|
26
|
+
// pane's shell prompt, then type the command line.
|
|
27
|
+
|
|
28
|
+
/** Longest we wait for a spawned peer to register in the coms pool. */
|
|
29
|
+
export const PEER_READY_TIMEOUT_MS = 45_000;
|
|
30
|
+
|
|
31
|
+
/** Longest we wait for a freshly split pane to reach its shell prompt. */
|
|
32
|
+
export const PANE_PROMPT_TIMEOUT_MS = 10_000;
|
|
33
|
+
|
|
34
|
+
/** Poll interval while watching a new pane for its shell prompt, in ms. */
|
|
35
|
+
export const PANE_PROMPT_POLL_MS = 250;
|
|
36
|
+
|
|
37
|
+
/** Shell metacharacter-free values pass through unquoted; everything else is quoted. */
|
|
38
|
+
const BARE_ARG = /^[A-Za-z0-9._/,:=@%+-]+$/;
|
|
39
|
+
|
|
40
|
+
function shellQuote(arg) {
|
|
41
|
+
const s = String(arg ?? "");
|
|
42
|
+
if (s === "") return "''"; // positional placeholders must survive as empty args
|
|
43
|
+
if (BARE_ARG.test(s)) return s;
|
|
44
|
+
return `'${s.replace(/'/g, `'\\''`)}'`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An argv (as built by peerCommand) turned into one line of shell input,
|
|
49
|
+
* newline included. Quoting matters for the empty positional placeholders the
|
|
50
|
+
* `just` recipes use to keep later positionals aligned — unquoted they would
|
|
51
|
+
* vanish and shift `--project` into the model slot.
|
|
52
|
+
*/
|
|
53
|
+
export function paneLaunchLine(argv) {
|
|
54
|
+
if (!Array.isArray(argv) || argv.length === 0) {
|
|
55
|
+
throw new Error("paneLaunchLine: empty argv");
|
|
56
|
+
}
|
|
57
|
+
return `${argv.map(shellQuote).join(" ")}\n`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Does this pane read end at an interactive shell prompt? Typing before the
|
|
62
|
+
* shell is up can drop the line, and herdr's own `agent.start` refuses a pane
|
|
63
|
+
* that is not at a prompt, so the spawn waits for one. Best-effort by design:
|
|
64
|
+
* the caller sends anyway once PANE_PROMPT_TIMEOUT_MS is spent.
|
|
65
|
+
*/
|
|
66
|
+
export function looksLikeShellPrompt(text) {
|
|
67
|
+
if (typeof text !== "string") return false;
|
|
68
|
+
const lines = text.replace(/\r/g, "").split("\n");
|
|
69
|
+
while (lines.length > 0 && lines[lines.length - 1].trim() === "") lines.pop();
|
|
70
|
+
if (lines.length === 0) return false;
|
|
71
|
+
return /[$#%>❯➜›]\s*$/.test(lines[lines.length - 1]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Launch an argv in a freshly split pane by typing it at the pane's shell.
|
|
76
|
+
* `client` is the herdr client (paneRead/paneSendText/paneSendKeys).
|
|
77
|
+
*
|
|
78
|
+
* Text and Enter go as separate calls on purpose: bash enables bracketed
|
|
79
|
+
* paste, where a newline inside sent text is inserted into the line editor
|
|
80
|
+
* instead of executing it. A pane that never shows a prompt still gets the
|
|
81
|
+
* command — the shell's input queue survives a slow banner — but the caller
|
|
82
|
+
* is told, because that is also what a pane whose shell died looks like.
|
|
83
|
+
*/
|
|
84
|
+
export async function launchPeerInPane(client, paneId, argv, opts = {}) {
|
|
85
|
+
const {
|
|
86
|
+
timeoutMs = PANE_PROMPT_TIMEOUT_MS,
|
|
87
|
+
pollMs = PANE_PROMPT_POLL_MS,
|
|
88
|
+
now = Date.now,
|
|
89
|
+
sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
90
|
+
} = opts;
|
|
91
|
+
const line = paneLaunchLine(argv).replace(/\n$/, "");
|
|
92
|
+
const started = now();
|
|
93
|
+
let promptSeen = false;
|
|
94
|
+
for (;;) {
|
|
95
|
+
try {
|
|
96
|
+
const { read } = await client.paneRead({ pane_id: paneId, lines: 5 });
|
|
97
|
+
if (looksLikeShellPrompt(read?.text ?? "")) {
|
|
98
|
+
promptSeen = true;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
} catch {
|
|
102
|
+
// Pane not readable yet; the timeout below bounds the wait.
|
|
103
|
+
}
|
|
104
|
+
if (now() - started >= timeoutMs) break;
|
|
105
|
+
await sleep(pollMs);
|
|
106
|
+
}
|
|
107
|
+
await client.paneSendText(paneId, line);
|
|
108
|
+
await client.paneSendKeys(paneId, ["enter"]);
|
|
109
|
+
return { promptSeen, waitedMs: now() - started };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Seconds a hub-spawned pi peer should sleep before launching (the justfile
|
|
114
|
+
* recipes honor it as AGENT_FLEET_SPAWN_DELAY). Same stale-OAuth lock race
|
|
115
|
+
* that staggers team spawns: the first peer refreshes the token, so only a
|
|
116
|
+
* sibling spawned inside the warm-up window has to wait. `needed` is
|
|
117
|
+
* oauthNeedsWarmup() re-read at each spawn — once the warmer lands a fresh
|
|
118
|
+
* token it goes false and nobody waits.
|
|
119
|
+
*/
|
|
120
|
+
export function spawnStaggerSeconds({ needed, lastSpawnAt, now, warmupSeconds }) {
|
|
121
|
+
if (!needed || !Number.isFinite(warmupSeconds) || warmupSeconds <= 0) return 0;
|
|
122
|
+
if (typeof lastSpawnAt !== "number" || !Number.isFinite(lastSpawnAt)) return 0;
|
|
123
|
+
if (now - lastSpawnAt >= warmupSeconds * 1000) return 0;
|
|
124
|
+
return warmupSeconds;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Poll backoff while waiting for registration, in ms; the last step repeats. */
|
|
128
|
+
export const PEER_READY_BACKOFF_MS = [250, 500, 1_000, 2_000, 3_000];
|
|
129
|
+
|
|
130
|
+
/** Backoff delay for the nth readiness poll (0-based); the last step repeats. */
|
|
131
|
+
export function peerReadyDelayMs(attempt) {
|
|
132
|
+
const i = Math.max(0, Math.min(Math.floor(attempt) || 0, PEER_READY_BACKOFF_MS.length - 1));
|
|
133
|
+
return PEER_READY_BACKOFF_MS[i];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The verdict a spawn reports back. `ready` means the peer is in the pool and
|
|
138
|
+
* `coms_send` will reach it; otherwise it is still booting and the caller is
|
|
139
|
+
* told how long we waited rather than being left to guess.
|
|
140
|
+
* @param {{name: string, paneId: string, found: boolean, waitedMs: number, timeoutMs?: number, paneTail?: string}} input
|
|
141
|
+
*/
|
|
142
|
+
export function peerReadyVerdict({ name, paneId, found, waitedMs, timeoutMs = PEER_READY_TIMEOUT_MS, paneTail }) {
|
|
143
|
+
if (found) {
|
|
144
|
+
return {
|
|
145
|
+
peer_ready: true,
|
|
146
|
+
peer_name: name,
|
|
147
|
+
pane_id: paneId,
|
|
148
|
+
waited_ms: waitedMs,
|
|
149
|
+
message:
|
|
150
|
+
`Peer "${name}" is ready in pane ${paneId} after ${Math.round(waitedMs / 1000)}s — ` +
|
|
151
|
+
`address it with coms_send(target: "${name}", ...). It boots idle and does no work until you send.`,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
// A peer that missed the window is usually dead, not slow, so the verdict
|
|
155
|
+
// carries the pane's own last words instead of sending the caller off to
|
|
156
|
+
// run herdr_read_pane to find out.
|
|
157
|
+
const tail = typeof paneTail === "string" ? paneTail.trim() : "";
|
|
158
|
+
return {
|
|
159
|
+
peer_ready: false,
|
|
160
|
+
peer_name: name,
|
|
161
|
+
pane_id: paneId,
|
|
162
|
+
waited_ms: waitedMs,
|
|
163
|
+
pane_tail: tail || null,
|
|
164
|
+
message:
|
|
165
|
+
`Peer "${name}" did not register in the coms pool within ${Math.round(timeoutMs / 1000)}s — ` +
|
|
166
|
+
`assume it failed to start rather than that it is slow. Do not coms_send to it. ` +
|
|
167
|
+
`Check coms_list; if it never appears, close the pane with herdr_close_pane.` +
|
|
168
|
+
(tail ? `\n\nLast output of pane ${paneId}:\n${tail}` : ""),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Sweep report for peers this hub spawned. `entries` carry
|
|
174
|
+
* { name, paneId, addressed } — `addressed` is true once any coms_send targeted
|
|
175
|
+
* that peer. Returns null when every spawned peer got work (the common case).
|
|
176
|
+
*/
|
|
177
|
+
export function unaddressedPeerSweep(entries) {
|
|
178
|
+
const idle = (Array.isArray(entries) ? entries : []).filter((e) => e && !e.addressed);
|
|
179
|
+
if (idle.length === 0) return null;
|
|
180
|
+
const rows = idle.map((e) => ` ${e.name} (pane ${e.paneId ?? "?"}) — spawned, never sent to`);
|
|
181
|
+
return {
|
|
182
|
+
count: idle.length,
|
|
183
|
+
peers: idle.map((e) => ({ name: e.name, pane_id: e.paneId ?? null })),
|
|
184
|
+
message: [
|
|
185
|
+
`⚠ ${idle.length} hub-spawned peer(s) never received a message:`,
|
|
186
|
+
...rows,
|
|
187
|
+
"A spawned peer boots idle and waits — it is holding a pane and a model session for nothing.",
|
|
188
|
+
`Close them with herdr_close_pane (asks for your confirmation) or send them work.`,
|
|
189
|
+
].join("\n"),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Pure Node-compatible consumer configuration; no I/O or provider construction.
|
|
3
|
+
export const GIT_TRACKED_INCLUDE = 'git:tracked';
|
|
4
|
+
export const AGENTIC_LIMITS = Object.freeze({ maxFiles: 20, maxQuestions: 16, maxStateBytes: 8192, maxQuestionsBytes: 16384, maxSourceBytes: 65536, maxRequestBytes: 131072, maxCallsPerSession: 100, timeoutMs: 2000, collectionMs: 1000, maxHandles: 20, maxRetainedBytes: 1048576 });
|
|
5
|
+
export function parseAgenticConfig(value) {
|
|
6
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || Object.keys(value).some(k => !['mode','remoteContextApproved','include','allowToolOutputs','limits'].includes(k))) throw new Error('Invalid agentic section');
|
|
7
|
+
if (!['off','advisory','recommended'].includes(value.mode) || (value.remoteContextApproved !== undefined && typeof value.remoteContextApproved !== 'boolean') || (value.allowToolOutputs !== undefined && typeof value.allowToolOutputs !== 'boolean')) throw new Error('Invalid agentic mode or consent');
|
|
8
|
+
const include = value.include ?? [];
|
|
9
|
+
if (!Array.isArray(include) || include.length > AGENTIC_LIMITS.maxFiles || include.some(p => typeof p !== 'string' || !p || p.length > 1024 || (p.startsWith('git:') && p !== GIT_TRACKED_INCLUDE) || /[\\\0*?]/.test(p) || p.startsWith('/') || p.replace(/\/$/,'').split('/').some(s => !s || s === '.' || s === '..'))) throw new Error('Invalid include scope');
|
|
10
|
+
const supplied = value.limits ?? {};
|
|
11
|
+
if (!supplied || typeof supplied !== 'object' || Array.isArray(supplied) || Object.keys(supplied).some(k => !Object.hasOwn(AGENTIC_LIMITS,k))) throw new Error('Invalid agentic limits');
|
|
12
|
+
const limits = { ...AGENTIC_LIMITS, ...supplied };
|
|
13
|
+
if (Object.entries(limits).some(([key,n]) => !Number.isSafeInteger(n) || n <= 0 || n > AGENTIC_LIMITS[key])) throw new Error('Invalid agentic limits');
|
|
14
|
+
return { mode:value.mode, remoteContextApproved:value.remoteContextApproved === true, include:[...include], allowToolOutputs:value.allowToolOutputs === true, limits };
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Pure independent consumer configuration. Defaults are also supported maxima.
|
|
2
|
+
export const FILE_DISCOVERY_LIMITS = Object.freeze({
|
|
3
|
+
concurrency: 8, maxQueuedJobs: 32, maxCandidates: 1024,
|
|
4
|
+
maxEvaluationsPerJob: 256, maxCallsPerSession: 10000, maxFileBytes: 65536,
|
|
5
|
+
maxRequestBytes: 131072, maxSourceBytesPerJob: 16777216, discoveryMs: 1000,
|
|
6
|
+
jobTimeoutMs: 20000, resultPageBytes: 32768, maxCacheEntries: 2048,
|
|
7
|
+
});
|
|
8
|
+
/** @param {unknown} value */
|
|
9
|
+
export function parseFileDiscoveryConfig(value) {
|
|
10
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) throw Error('Invalid fileDiscovery section');
|
|
11
|
+
const section = /** @type {Record<string, any>} */ (value);
|
|
12
|
+
if (Object.keys(section).some(k => !['mode','remoteContextApproved','include','limits'].includes(k)) || !['off','active'].includes(section.mode) || (section.remoteContextApproved !== undefined && typeof section.remoteContextApproved !== 'boolean')) throw Error('Invalid fileDiscovery section');
|
|
13
|
+
const include = section.include ?? [];
|
|
14
|
+
if (!Array.isArray(include) || include.length > 20 || include.some(p => typeof p !== 'string' || !p || p.length > 1024 || /[\\\0*?]/.test(p) || p.startsWith('/') || p.replace(/\/$/,'').split('/').some(s => !s || s === '.' || s === '..'))) throw Error('Invalid include scope');
|
|
15
|
+
if (section.mode === 'active' && section.remoteContextApproved === true && !include.length) throw Error('Explicit include scope required');
|
|
16
|
+
const supplied = section.limits ?? {};
|
|
17
|
+
if (!supplied || typeof supplied !== 'object' || Array.isArray(supplied) || Object.keys(supplied).some(k => !Object.hasOwn(FILE_DISCOVERY_LIMITS,k))) throw Error('Invalid fileDiscovery limits');
|
|
18
|
+
const limits = { ...FILE_DISCOVERY_LIMITS, ...supplied };
|
|
19
|
+
if (Object.entries(limits).some(([k,n]) => !Number.isSafeInteger(n) || n <= 0 || n > FILE_DISCOVERY_LIMITS[/** @type {keyof typeof FILE_DISCOVERY_LIMITS} */ (k)])) throw Error('Invalid fileDiscovery limits');
|
|
20
|
+
return { mode: /** @type {'off'|'active'} */ (section.mode), remoteContextApproved: section.remoteContextApproved === true, include: /** @type {string[]} */ ([...include]), limits: /** @type {Record<keyof typeof FILE_DISCOVERY_LIMITS, number>} */ (limits) };
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/** JSON parser that refuses duplicate object keys, including escaped aliases. */
|
|
3
|
+
export function parseConfigJson(text) {
|
|
4
|
+
let i = 0;
|
|
5
|
+
const space = () => { while (/\s/.test(text[i] ?? '') && i < text.length) i++; };
|
|
6
|
+
const string = () => {
|
|
7
|
+
const start = i++;
|
|
8
|
+
while (i < text.length) {
|
|
9
|
+
if (text[i] === '\\') { i += 2; continue; }
|
|
10
|
+
if (text[i++] === '"') return JSON.parse(text.slice(start, i));
|
|
11
|
+
}
|
|
12
|
+
throw new Error('Invalid JSON string');
|
|
13
|
+
};
|
|
14
|
+
const value = path => {
|
|
15
|
+
space();
|
|
16
|
+
if (text[i] === '{') {
|
|
17
|
+
i++; space(); const keys = new Set();
|
|
18
|
+
if (text[i] === '}') { i++; return; }
|
|
19
|
+
while (i < text.length) {
|
|
20
|
+
space(); if (text[i] !== '"') throw new Error(`Invalid JSON at ${path}`);
|
|
21
|
+
const key = string();
|
|
22
|
+
if (keys.has(key)) throw new Error(`Duplicate JSON key: ${path}.${key}`);
|
|
23
|
+
keys.add(key); space(); if (text[i++] !== ':') throw new Error(`Invalid JSON at ${path}`);
|
|
24
|
+
value(`${path}.${key}`); space();
|
|
25
|
+
const end = text[i++]; if (end === '}') return; if (end !== ',') throw new Error(`Invalid JSON at ${path}`);
|
|
26
|
+
}
|
|
27
|
+
} else if (text[i] === '[') {
|
|
28
|
+
i++; space(); if (text[i] === ']') { i++; return; }
|
|
29
|
+
let index = 0;
|
|
30
|
+
while (i < text.length) { value(`${path}[${index++}]`); space(); const end = text[i++]; if (end === ']') return; if (end !== ',') throw new Error(`Invalid JSON at ${path}`); }
|
|
31
|
+
} else if (text[i] === '"') { string(); return; }
|
|
32
|
+
else { const start = i; while (i < text.length && !/[\s,}\]]/.test(text[i])) i++; JSON.parse(text.slice(start, i)); return; }
|
|
33
|
+
throw new Error(`Invalid JSON at ${path}`);
|
|
34
|
+
};
|
|
35
|
+
value('$'); space(); if (i !== text.length) throw new Error('Invalid trailing JSON');
|
|
36
|
+
return JSON.parse(text);
|
|
37
|
+
}
|