@chankov/agent-fleet 2.1.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/agent-fleet/hooks/coms-stop-hook.mjs +53 -13
- package/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/README.md +223 -0
- package/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile-0.167.json +5627 -0
- package/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +4 -0
- package/.pi/agent-fleet/scripts/fleet.ts +13 -17
- package/.pi/agent-fleet/scripts/flow.ts +2 -2
- package/.pi/agent-fleet/scripts/lib/codex-bootstrap-files.ts +46 -0
- package/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +44 -0
- package/.pi/agent-fleet/scripts/lib/codex-bootstrap-producer.ts +131 -0
- package/.pi/agent-fleet/scripts/lib/codex-daemon-observer.ts +137 -0
- package/.pi/agent-fleet/scripts/lib/codex-desktop-discovery.ts +84 -0
- package/.pi/agent-fleet/scripts/lib/codex-desktop-preflight.ts +130 -0
- package/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +20 -13
- package/.pi/agent-fleet/scripts/lib/codex-measurement.ts +218 -0
- package/.pi/agent-fleet/scripts/lib/codex-native-presence.ts +61 -0
- package/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +135 -0
- package/.pi/agent-fleet/scripts/lib/codex-send-lineage.ts +72 -0
- package/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +23 -13
- package/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +100 -14
- package/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +1 -1
- package/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +204 -0
- package/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +9 -3
- package/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +32 -16
- package/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +41 -21
- package/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +21 -0
- package/.pi/agent-fleet/scripts/lib/fleet-command.ts +4 -8
- package/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +2 -1
- package/.pi/agent-fleet/scripts/lib/team-project.ts +0 -2
- package/.pi/agent-fleet/scripts/team-up.ts +5 -12
- package/.pi/agent-fleet/scripts/workflows/lib/git.ts +9 -0
- package/.pi/agent-fleet/scripts/workflows/lib/quality.ts +17 -4
- package/.pi/agents/model-profiles.yaml +0 -2
- package/.pi/harnesses/agent-hub/README.md +116 -67
- package/.pi/harnesses/agent-hub/capability-packs.ts +7 -4
- package/.pi/harnesses/agent-hub/codex-bootstrap.ts +117 -0
- package/.pi/harnesses/agent-hub/commands/context.ts +0 -4
- package/.pi/harnesses/agent-hub/commands/recover.ts +2 -1
- package/.pi/harnesses/agent-hub/config/agents.ts +3 -1
- package/.pi/harnesses/agent-hub/config/model-profiles.ts +3 -0
- package/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +14 -1
- package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +17 -0
- package/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +3 -1
- package/.pi/harnesses/agent-hub/dispatch-native-types.ts +4 -0
- package/.pi/harnesses/agent-hub/dispatch-native.ts +9 -3
- package/.pi/harnesses/agent-hub/drift-watchdog.js +5 -10
- package/.pi/harnesses/agent-hub/execution-trace.ts +1 -1
- package/.pi/harnesses/agent-hub/filesystem-tool.ts +1 -1
- package/.pi/harnesses/agent-hub/footer.ts +2 -3
- package/.pi/harnesses/agent-hub/helpers.ts +4 -5
- package/.pi/harnesses/agent-hub/history-projection.ts +1 -1
- package/.pi/harnesses/agent-hub/index.ts +213 -196
- package/.pi/harnesses/agent-hub/input/shortcuts.ts +0 -7
- package/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +0 -2
- package/.pi/harnesses/agent-hub/no-progress.ts +14 -9
- package/.pi/harnesses/agent-hub/operator-current-state.ts +5 -1
- package/.pi/harnesses/agent-hub/package.json +1 -1
- package/.pi/harnesses/agent-hub/policy/roster.ts +12 -3
- package/.pi/harnesses/agent-hub/policy/work-mode.ts +10 -49
- package/.pi/harnesses/agent-hub/poll-command.ts +12 -4
- package/.pi/harnesses/agent-hub/proactive-snapshot.ts +12 -4
- package/.pi/harnesses/agent-hub/process-obligations.ts +42 -9
- package/.pi/harnesses/agent-hub/prompts/context.ts +17 -0
- package/.pi/harnesses/agent-hub/prompts/fragments.ts +9 -1
- package/.pi/harnesses/agent-hub/prompts/session-start.ts +2 -3
- package/.pi/harnesses/agent-hub/prompts/system-prompt.ts +25 -8
- package/.pi/harnesses/agent-hub/provider-semaphore.js +5 -0
- package/.pi/harnesses/agent-hub/review-continuity.ts +5 -2
- package/.pi/harnesses/agent-hub/review-reuse.ts +2 -1
- package/.pi/harnesses/agent-hub/run-budget.js +22 -2
- package/.pi/harnesses/agent-hub/scope-gate.js +38 -0
- package/.pi/harnesses/agent-hub/scope-overlap.ts +46 -0
- package/.pi/harnesses/agent-hub/task-brief.ts +98 -0
- package/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +4 -0
- package/.pi/harnesses/agent-hub/tool-catalog-state.ts +5 -3
- package/.pi/harnesses/agent-hub/tools/action-executors.ts +5 -7
- package/.pi/harnesses/agent-hub/tools/context.ts +2 -0
- package/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +2 -1
- package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +184 -33
- package/.pi/harnesses/agent-hub/tools/poll-panel-core.ts +30 -0
- package/.pi/harnesses/agent-hub/tools/poll-panel.ts +33 -0
- package/.pi/harnesses/agent-hub/tools/run-flow.ts +41 -10
- package/.pi/harnesses/agent-hub/tools/team-adjust.ts +1 -1
- package/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +12 -2
- package/.pi/harnesses/agent-hub/work-mode.ts +44 -49
- package/.pi/harnesses/agent-hub/write-isolation.ts +53 -8
- package/.pi/harnesses/coms/package.json +1 -1
- package/.pi/harnesses/damage-control-continue/package.json +1 -1
- package/.pi/harnesses/lib/codex-compat.ts +97 -0
- package/.pi/harnesses/lib/codex-contract.ts +259 -0
- package/.pi/harnesses/lib/codex-notification-profile.ts +75 -0
- package/.pi/harnesses/lib/coms-core.ts +8 -4
- package/.pi/harnesses/lib/context-budget-child-prompt.ts +1 -1
- package/.pi/harnesses/lib/context-budget-hub-prompt.ts +6 -3
- package/.pi/harnesses/lib/fleet-bootstrap-channel.ts +148 -0
- package/.pi/harnesses/lib/fleet-codex-catalog.ts +30 -0
- package/.pi/harnesses/lib/fleet-codex-chat-view.ts +43 -0
- package/.pi/harnesses/lib/fleet-codex-namespace.ts +2 -0
- package/.pi/harnesses/lib/fleet-codex-policy-snapshot.ts +10 -0
- package/.pi/harnesses/lib/fleet-connection-control.ts +20 -3
- package/.pi/harnesses/lib/fleet-notification-admission.ts +32 -0
- package/.pi/harnesses/lib/fleet-notification-bootstrap.ts +152 -0
- package/.pi/harnesses/lib/fleet-notification-validation.ts +80 -25
- package/.pi/harnesses/lib/fleet-target-identity.ts +9 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/README.md +347 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
- package/.versions/2.2.0/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
- package/.versions/2.2.0/.pi/agent-fleet/hooks/coms-stop-hook.mjs +124 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/0.167-shared.json +1900 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/README.md +223 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/assessment.md +83 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile-0.167.json +5627 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile.md +43 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap.md +45 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture-profile.ts +53 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture.ts +102 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/catalog.md +91 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/channel.md +21 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurement.md +133 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurements.json +74 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/notification-profile-0.167.json +2679 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/observer.md +101 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/opaque-response.md +57 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/open-sent.md +68 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/probe-reader.md +51 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/profile.md +71 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/projection.md +147 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/reconnect.md +40 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/response-unions.md +74 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/semver.md +124 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/surface.md +73 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/fleet-codex-allowlist-store-child.ts +31 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/response-fixture.ts +23 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fleet-codex-local-mcp.mjs +26 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +63 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/fleet.ts +244 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/flow.ts +166 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-bootstrap-files.ts +46 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +44 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-bootstrap-producer.ts +131 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-daemon-observer.ts +137 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-desktop-discovery.ts +84 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-desktop-preflight.ts +130 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +113 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-measurement.ts +218 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-native-presence.ts +61 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +135 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-send-lineage.ts +72 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +101 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +453 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +73 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +204 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +76 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +58 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +132 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +175 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +435 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +44 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +83 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-response-read.ts +26 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-response-transport.ts +38 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-command.ts +264 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +239 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/team-project.ts +176 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/package-lock.json +57 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/package.json +10 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/pi-session.ts +9 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/team-up.ts +378 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/git.ts +108 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/quality.ts +78 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
- package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
- package/.versions/2.2.0/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/2.2.0/.pi/agents/model-profiles.yaml +132 -0
- package/.versions/2.2.0/.pi/agents/peers.yaml +147 -0
- package/.versions/2.2.0/.pi/agents/teams.yaml +41 -0
- package/.versions/2.2.0/.pi/agents/voices.yaml +13 -0
- package/.versions/2.2.0/.pi/damage-control-rules.yaml +297 -0
- package/.versions/2.2.0/.pi/extensions/btw/README.md +120 -0
- package/.versions/2.2.0/.pi/extensions/btw/index.ts +916 -0
- package/.versions/2.2.0/.pi/extensions/btw/package.json +6 -0
- package/.versions/2.2.0/.pi/extensions/btw/state.js +179 -0
- package/.versions/2.2.0/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
- package/.versions/2.2.0/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
- package/.versions/2.2.0/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/2.2.0/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/2.2.0/.pi/extensions/compact-and-continue/index.ts +136 -0
- package/.versions/2.2.0/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/2.2.0/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/2.2.0/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/2.2.0/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/2.2.0/.pi/extensions/package-lock.json +1175 -0
- package/.versions/2.2.0/.pi/extensions/package.json +9 -0
- package/.versions/2.2.0/.pi/extensions/pi-voice-stt/README.md +224 -0
- package/.versions/2.2.0/.pi/extensions/pi-voice-stt/config.ts +199 -0
- package/.versions/2.2.0/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/2.2.0/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/2.2.0/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/2.2.0/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/2.2.0/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/README.md +1633 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/acceptance.ts +204 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/access-approval.ts +266 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/artifacts.js +146 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/assertion-ledger.js +68 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/backend-policy.js +174 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/capability-packs.ts +187 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/codex-bootstrap.ts +117 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/config.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/context.ts +43 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/models.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/recover.ts +62 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/config/agents.ts +183 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/config/model-profiles.ts +240 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +234 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-compat.ts +45 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/context-window.js +108 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-approval.ts +83 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-hub.ts +263 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/debate-command.ts +176 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/delegate.ts +478 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native-complete.ts +176 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +318 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +264 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native-types.ts +297 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native.ts +242 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/docs-lane.js +123 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-watchdog.js +344 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/external-blocker.js +92 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/fixtures/registration-surface.json +68 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/footer.ts +29 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/helpers.ts +269 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/history-projection.ts +116 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/index.ts +2722 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/input/completions.ts +82 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/input/shortcuts.ts +16 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/no-progress.ts +627 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/operator-current-state.ts +57 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/package.json +7 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/models.ts +153 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/roster.ts +103 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/work-mode.ts +103 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/poll-command.ts +184 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/presentation.ts +54 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/private-config-current-state.ts +81 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/private-config-fixtures.ts +26 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/private-config-review.ts +100 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-snapshot.ts +287 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/process-obligations.ts +210 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/prompts/context.ts +72 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/prompts/fragments.ts +94 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/prompts/session-start.ts +89 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/prompts/system-prompt.ts +142 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/provider-semaphore.js +143 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/reconcile.ts +26 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/recover-state.ts +104 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/research/controls.ts +74 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/return-contract.js +371 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/return-extract.js +77 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/review-closure.ts +43 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/review-continuity.ts +76 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/review-findings.js +96 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/review-reuse.ts +48 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/run-budget.js +362 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/run-namespace.js +93 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/runtime-receipts.ts +63 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/runtime-test-check.ts +85 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/scope-gate.js +271 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/scope-overlap.ts +46 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/session-audit.ts +331 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/session-health.js +110 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/session-start.ts +42 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/spawn.ts +702 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/specialist-result.ts +78 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/system1-communication-store.ts +225 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/system1-report.ts +275 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-brief.ts +98 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-resume-contract.ts +80 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-authorization.ts +170 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-runtime.ts +130 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/timeline.ts +72 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +83 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tool-catalog-state.ts +125 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/action-executors.ts +214 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/context.ts +149 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +93 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +928 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/poll-panel-core.ts +30 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/poll-panel.ts +33 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/run-flow.ts +177 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/verification-contract.ts +81 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/tsconfig.json +22 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/types.ts +66 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +173 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/history.ts +234 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/version.ts +42 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/work-mode.ts +183 -0
- package/.versions/2.2.0/.pi/harnesses/agent-hub/write-isolation.ts +232 -0
- package/.versions/2.2.0/.pi/harnesses/ask-user-remote/README.md +59 -0
- package/.versions/2.2.0/.pi/harnesses/ask-user-remote/index.ts +571 -0
- package/.versions/2.2.0/.pi/harnesses/ask-user-remote/questions.ts +206 -0
- package/.versions/2.2.0/.pi/harnesses/ask-user-remote/race-core.js +124 -0
- package/.versions/2.2.0/.pi/harnesses/ask-user-remote/runtime-ask.ts +90 -0
- package/.versions/2.2.0/.pi/harnesses/coms/README.md +105 -0
- package/.versions/2.2.0/.pi/harnesses/coms/index.ts +308 -0
- package/.versions/2.2.0/.pi/harnesses/coms/package.json +7 -0
- package/.versions/2.2.0/.pi/harnesses/coms/version.ts +42 -0
- package/.versions/2.2.0/.pi/harnesses/damage-control-continue/README.md +161 -0
- package/.versions/2.2.0/.pi/harnesses/damage-control-continue/index.ts +659 -0
- package/.versions/2.2.0/.pi/harnesses/damage-control-continue/package.json +7 -0
- package/.versions/2.2.0/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
- package/.versions/2.2.0/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
- package/.versions/2.2.0/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
- package/.versions/2.2.0/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
- package/.versions/2.2.0/.pi/harnesses/damage-control-continue/version.ts +42 -0
- package/.versions/2.2.0/.pi/harnesses/lib/approval-wait.ts +17 -0
- package/.versions/2.2.0/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
- package/.versions/2.2.0/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
- package/.versions/2.2.0/.pi/harnesses/lib/clarification-policy.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/lib/codex-compat.ts +97 -0
- package/.versions/2.2.0/.pi/harnesses/lib/codex-contract.ts +259 -0
- package/.versions/2.2.0/.pi/harnesses/lib/codex-notification-profile.ts +75 -0
- package/.versions/2.2.0/.pi/harnesses/lib/coms-core-io.ts +422 -0
- package/.versions/2.2.0/.pi/harnesses/lib/coms-core.ts +738 -0
- package/.versions/2.2.0/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
- package/.versions/2.2.0/.pi/harnesses/lib/coms-observation.ts +74 -0
- package/.versions/2.2.0/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
- package/.versions/2.2.0/.pi/harnesses/lib/coms-response-read.ts +107 -0
- package/.versions/2.2.0/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
- package/.versions/2.2.0/.pi/harnesses/lib/context-budget-hub-prompt.ts +124 -0
- package/.versions/2.2.0/.pi/harnesses/lib/context-budget-view.ts +112 -0
- package/.versions/2.2.0/.pi/harnesses/lib/context-budget.ts +114 -0
- package/.versions/2.2.0/.pi/harnesses/lib/context-compaction-policy.js +35 -0
- package/.versions/2.2.0/.pi/harnesses/lib/damage-action-hash.ts +28 -0
- package/.versions/2.2.0/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
- package/.versions/2.2.0/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
- package/.versions/2.2.0/.pi/harnesses/lib/damage-control-shared.ts +276 -0
- package/.versions/2.2.0/.pi/harnesses/lib/damage-guard-port.ts +25 -0
- package/.versions/2.2.0/.pi/harnesses/lib/damage-policy.ts +35 -0
- package/.versions/2.2.0/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
- package/.versions/2.2.0/.pi/harnesses/lib/damage-result-view.ts +16 -0
- package/.versions/2.2.0/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
- package/.versions/2.2.0/.pi/harnesses/lib/exact-permission-port.ts +38 -0
- package/.versions/2.2.0/.pi/harnesses/lib/execution-trace.ts +45 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-bootstrap-channel.ts +148 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-catalog.ts +30 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-chat-view.ts +43 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-event-bridge.ts +82 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-namespace.ts +2 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-policy-snapshot.ts +10 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/view.ts +338 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-connection-control.ts +94 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-dashboard-view.ts +174 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-event-source.ts +21 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-notification-admission.ts +32 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-notification-bootstrap.ts +152 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-notification-validation.ts +122 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-overlay.ts +26 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-panel.ts +34 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-question-reference.ts +42 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-read-model.ts +609 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-selection.ts +24 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-target-identity.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
- package/.versions/2.2.0/.pi/harnesses/lib/herdr-client.ts +472 -0
- package/.versions/2.2.0/.pi/harnesses/lib/herdr-presence.ts +399 -0
- package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
- package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
- package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
- package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
- package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
- package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
- package/.versions/2.2.0/.pi/harnesses/lib/identical-dialog.ts +27 -0
- package/.versions/2.2.0/.pi/harnesses/lib/installation-state.js +62 -0
- package/.versions/2.2.0/.pi/harnesses/lib/peer-target.ts +24 -0
- package/.versions/2.2.0/.pi/harnesses/lib/policy-roots.js +117 -0
- package/.versions/2.2.0/.pi/harnesses/lib/policy-roots.ts +32 -0
- package/.versions/2.2.0/.pi/harnesses/lib/process-shared.ts +9 -0
- package/.versions/2.2.0/.pi/harnesses/lib/resource-closure.js +26 -0
- package/.versions/2.2.0/.pi/harnesses/lib/safe-source-read.js +29 -0
- package/.versions/2.2.0/.pi/harnesses/lib/semantic-approval.ts +80 -0
- package/.versions/2.2.0/.pi/harnesses/lib/session-target.ts +62 -0
- package/.versions/2.2.0/.pi/harnesses/lib/spawned-peers.js +191 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config-agentic.js +15 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config-json.js +37 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config-loader.js +53 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config-proactive.js +68 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config-triage.js +42 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config-v2.js +112 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/config.js +50 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/contracts.ts +154 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/demo.ts +95 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/jev.ts +503 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/selection.js +11 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/service.ts +245 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
- package/.versions/2.2.0/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
- package/.versions/2.2.0/.pi/harnesses/lib/target-capabilities.js +7 -0
- package/.versions/2.2.0/.pi/harnesses/lib/update-check.ts +227 -0
- package/.versions/2.2.0/.pi/harnesses/lib/workspace-context.js +115 -0
- package/.versions/2.2.0/.pi/harnesses/lib/workspace-context.ts +22 -0
- package/.versions/2.2.0/.pi/harnesses/package-lock.json +2121 -0
- package/.versions/2.2.0/.pi/harnesses/package.json +13 -0
- package/.versions/2.2.0/.pi/prompts/af-build.md +27 -0
- package/.versions/2.2.0/.pi/prompts/af-code-simplify.md +22 -0
- package/.versions/2.2.0/.pi/prompts/af-constraints.md +31 -0
- package/.versions/2.2.0/.pi/prompts/af-plan.md +17 -0
- package/.versions/2.2.0/.pi/prompts/af-review.md +16 -0
- package/.versions/2.2.0/.pi/prompts/af-set-hermes-telegram.md +15 -0
- package/.versions/2.2.0/.pi/prompts/af-set-hermes-watchdog.md +6 -0
- package/.versions/2.2.0/.pi/prompts/af-setup-rules.md +20 -0
- package/.versions/2.2.0/.pi/prompts/af-ship.md +17 -0
- package/.versions/2.2.0/.pi/prompts/af-spec.md +15 -0
- package/.versions/2.2.0/.pi/prompts/af-test.md +19 -0
- package/.versions/2.2.0/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/2.2.0/.version +1 -0
- package/.versions/2.2.0/agents/architect.md +24 -0
- package/.versions/2.2.0/agents/bowser.md +28 -0
- package/.versions/2.2.0/agents/builder.md +55 -0
- package/.versions/2.2.0/agents/code-reviewer.md +209 -0
- package/.versions/2.2.0/agents/deep-researcher.md +32 -0
- package/.versions/2.2.0/agents/documenter.md +22 -0
- package/.versions/2.2.0/agents/plan-reviewer.md +83 -0
- package/.versions/2.2.0/agents/planner.md +107 -0
- package/.versions/2.2.0/agents/releaser.md +24 -0
- package/.versions/2.2.0/agents/researcher.md +30 -0
- package/.versions/2.2.0/agents/security-auditor.md +167 -0
- package/.versions/2.2.0/agents/test-engineer.md +153 -0
- package/.versions/2.2.0/agents/web-debugger.md +44 -0
- package/.versions/2.2.0/agents/web-performance-auditor.md +194 -0
- package/.versions/2.2.0/bin/catalog/harness-runtime-closure.json +85 -0
- package/.versions/2.2.0/docs/ARCHITECTURE.md +1291 -0
- package/.versions/2.2.0/docs/agent-fleet-setup.md +1161 -0
- package/.versions/2.2.0/docs/claude-code-coms-bridge.md +147 -0
- package/.versions/2.2.0/docs/codex-local-mcp.md +520 -0
- package/.versions/2.2.0/docs/codex-session-bridge.md +44 -0
- package/.versions/2.2.0/docs/codex-setup.md +183 -0
- package/.versions/2.2.0/docs/coms-hermes-bridge.md +188 -0
- package/.versions/2.2.0/docs/fleet-native-voice.md +151 -0
- package/.versions/2.2.0/docs/getting-started.md +126 -0
- package/.versions/2.2.0/docs/npm-install.md +535 -0
- package/.versions/2.2.0/docs/pi-extensions.md +450 -0
- package/.versions/2.2.0/docs/pi-setup.md +92 -0
- package/.versions/2.2.0/docs/skill-anatomy.md +150 -0
- package/.versions/2.2.0/install-manifest.json +3226 -0
- package/.versions/2.2.0/justfile +246 -0
- package/.versions/2.2.0/manifest-meta.json +1098 -0
- package/.versions/2.2.0/references/accessibility-checklist.md +160 -0
- package/.versions/2.2.0/references/communication-contract.md +26 -0
- package/.versions/2.2.0/references/definition-of-done.md +67 -0
- package/.versions/2.2.0/references/fleet-coordination-patterns.md +171 -0
- package/.versions/2.2.0/references/observability-checklist.md +92 -0
- package/.versions/2.2.0/references/orchestration-patterns.md +370 -0
- package/.versions/2.2.0/references/performance-checklist.md +236 -0
- package/.versions/2.2.0/references/prompting-patterns.md +380 -0
- package/.versions/2.2.0/references/security-checklist.md +245 -0
- package/.versions/2.2.0/references/testing-patterns.md +235 -0
- package/.versions/2.2.0/references/workflow-authoring.md +304 -0
- package/.versions/2.2.0/skills/_internal/grilling.md +59 -0
- package/.versions/2.2.0/skills/browser-testing-with-devtools/SKILL.md +351 -0
- package/.versions/2.2.0/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.2.0/skills/compound-learning/SKILL.md +137 -0
- package/.versions/2.2.0/skills/constraint-driven-development/SKILL.md +338 -0
- package/.versions/2.2.0/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.2.0/skills/context-engineering/SKILL.md +341 -0
- package/.versions/2.2.0/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.2.0/skills/designing-agents/SKILL.md +394 -0
- package/.versions/2.2.0/skills/designing-agents/pi-harness-authoring.md +222 -0
- package/.versions/2.2.0/skills/drafting-workflows/SKILL.md +143 -0
- package/.versions/2.2.0/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
- package/.versions/2.2.0/skills/fleet-connect/SKILL.md +29 -0
- package/.versions/2.2.0/skills/fleet-connect.zip +0 -0
- package/.versions/2.2.0/skills/fleet-native-voice/SKILL.md +103 -0
- package/.versions/2.2.0/skills/fleet-native-voice/agents/openai.yaml +4 -0
- package/.versions/2.2.0/skills/fleet-native-voice.zip +0 -0
- package/.versions/2.2.0/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.2.0/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/2.2.0/skills/idea-refine/SKILL.md +182 -0
- package/.versions/2.2.0/skills/idea-refine/examples.md +238 -0
- package/.versions/2.2.0/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.2.0/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.2.0/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.2.0/skills/incremental-implementation/SKILL.md +353 -0
- package/.versions/2.2.0/skills/incremental-implementation.zip +0 -0
- package/.versions/2.2.0/skills/interview-me/SKILL.md +226 -0
- package/.versions/2.2.0/skills/orchestration-verification/SKILL.md +182 -0
- package/.versions/2.2.0/skills/peer-coms/SKILL.md +90 -0
- package/.versions/2.2.0/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.2.0/skills/planning-and-task-breakdown/SKILL.md +318 -0
- package/.versions/2.2.0/skills/planning-and-task-breakdown.zip +0 -0
- package/.versions/2.2.0/skills/repository-ai-setup/SKILL.md +135 -0
- package/.versions/2.2.0/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
- package/.versions/2.2.0/skills/repository-ai-setup/references/apply-contract.md +74 -0
- package/.versions/2.2.0/skills/repository-ai-setup/references/provenance-template.md +16 -0
- package/.versions/2.2.0/skills/repository-ai-setup/references/setup-flow.md +108 -0
- package/.versions/2.2.0/skills/repository-ai-setup/references/verify-setup.md +20 -0
- package/.versions/2.2.0/skills/repository-ai-setup.zip +0 -0
- package/.versions/2.2.0/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.2.0/skills/spec-driven-development/SKILL.md +295 -0
- package/.versions/2.2.0/skills/spec-driven-development.zip +0 -0
- package/.versions/2.2.0/skills/using-agent-skills/SKILL.md +198 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/README.md +430 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
- package/.versions/2.2.0/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
- package/CHANGELOG.md +33 -0
- package/README.md +7 -10
- package/bin/lib/set-codex-mcp.js +1 -1
- package/bin/lib/validate-overrides.js +8 -1
- package/docs/ARCHITECTURE.md +122 -26
- package/docs/MIGRATION-agent-fleet.md +26 -5
- package/docs/agent-fleet-setup.md +44 -26
- package/docs/claude-code-coms-bridge.md +1 -1
- package/docs/codex-local-mcp.md +29 -12
- package/docs/codex-session-bridge.md +2 -2
- package/docs/codex-setup.md +1 -1
- package/docs/fleet-native-voice.md +10 -4
- package/docs/npm-install.md +1 -1
- package/docs/pi-extensions.md +13 -18
- package/docs/system1-agentic.md +1 -1
- package/docs/system1-file-discovery.md +2 -2
- package/docs/workflows.md +24 -1
- package/install-manifest.json +15 -28
- package/justfile +3 -4
- package/manifest-meta.json +13 -2
- package/package.json +4 -2
- package/skills/fleet-connect/SKILL.md +20 -16
- package/skills/fleet-connect.zip +0 -0
- package/skills/fleet-native-voice.zip +0 -0
- package/.pi/harnesses/agent-hub/commands/work-mode.ts +0 -29
- package/.pi/harnesses/agent-hub/work-mode-controls.ts +0 -56
- package/agents/orchestrator.md +0 -22
|
@@ -52,8 +52,12 @@ async function main() {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
if (buffered.length && !dropping && !failed) await schedule(buffered);
|
|
55
|
+
// Native host EOF invalidates bootstrap presence/rights writes immediately;
|
|
56
|
+
// unrelated legacy requests retain their existing bounded drain behavior.
|
|
57
|
+
protocol.stopBootstrap();
|
|
55
58
|
await Promise.all(tasks);
|
|
56
59
|
if (failed) throw new Error('STDIO_FAILED');
|
|
57
60
|
} catch { process.stderr.write('LOCAL_MCP_IO_FAILED\n'); process.exitCode = 1; }
|
|
61
|
+
finally { protocol.close(); }
|
|
58
62
|
}
|
|
59
63
|
await main();
|
|
@@ -17,7 +17,7 @@ const PI_LAUNCH_RECIPES = new Set([
|
|
|
17
17
|
"_fleet-team-resume",
|
|
18
18
|
]);
|
|
19
19
|
|
|
20
|
-
const HELP = `Agent Fleet — one guarded Hub runtime
|
|
20
|
+
const HELP = `Agent Fleet — one guarded Hub runtime with one operator, independent topology
|
|
21
21
|
|
|
22
22
|
СЕСИЕН WORKTREE TARGET
|
|
23
23
|
just fleet --worktree ../repo.worktree --dry-run
|
|
@@ -42,7 +42,7 @@ SET UP A NEW REPOSITORY
|
|
|
42
42
|
|
|
43
43
|
QUICK START
|
|
44
44
|
just fleet # Hub/operator, empty native roster
|
|
45
|
-
just fleet --agents frontend # Hub/
|
|
45
|
+
just fleet --agents frontend # Hub/operator starting with a native roster
|
|
46
46
|
just fleet --herdr --project af
|
|
47
47
|
# Hub/operator in a one-pane Herdr workspace
|
|
48
48
|
just fleet --agents frontend --peers frontend --project af
|
|
@@ -68,23 +68,19 @@ FLEET CORE — loaded in every Pi mode
|
|
|
68
68
|
BTW side sessions · update check via damage-control-continue (voice is opt-in with --voice)
|
|
69
69
|
|
|
70
70
|
UNIFIED HUB
|
|
71
|
-
just fleet [--
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
--
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/af-work-mode # report work mode and capability state
|
|
71
|
+
just fleet [--agents <roster>] [--herdr] [--peers <preset>] [--no-coms] [PI_ARGS...]
|
|
72
|
+
Fleet loads Agent Hub with its one operator: read/bash/edit/write plus
|
|
73
|
+
delegation to every installed agent. --agents picks the starting native
|
|
74
|
+
roster from .pi/agents/teams.yaml; dispatching any other installed agent
|
|
75
|
+
adds it. --work-mode is deprecated and ignored. --no-coms leaves
|
|
76
|
+
direct/native work available while coms, peer dispatch, and handoff
|
|
77
|
+
refuse actionably.
|
|
78
|
+
|
|
79
|
+
ROSTER
|
|
81
80
|
/af-agents-add code-reviewer # add a native Pi specialist at runtime
|
|
82
|
-
/af-work-mode orchestrator # remove direct coding tools; keep orchestration
|
|
83
|
-
/af-work-mode operator # restore the approved direct tool surface
|
|
84
81
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
actions whose coms/Herdr capability is unavailable return remediation guidance.
|
|
82
|
+
The roster is independent from the peer topology. Budgets follow task tier.
|
|
83
|
+
Actions whose coms/Herdr capability is unavailable return remediation guidance.
|
|
88
84
|
|
|
89
85
|
Explicit dispatch backend examples (inside the Hub):
|
|
90
86
|
dispatch_agent({ agent: "code-reviewer", task: "Review the diff", backend: "native" })
|
|
@@ -9,7 +9,7 @@ import {loadSystem1Snapshot} from '../../harnesses/lib/system1/config-loader.js'
|
|
|
9
9
|
import { parseFlowCommand, parseFlowMaintenanceCommand, type FlowCommand } from "./lib/flow-command.ts";
|
|
10
10
|
import { runFlowMaintenance } from "./lib/flow-maintenance.ts";
|
|
11
11
|
import { loadEnv } from "./workflows/lib/env.ts";
|
|
12
|
-
import { createFlowBranch, recordFlowResult, requireCleanTree, StartRefusedError } from "./workflows/lib/git.ts";
|
|
12
|
+
import { createFlowBranch, recordFlowResult, requireCleanTree, requireRepository, StartRefusedError } from "./workflows/lib/git.ts";
|
|
13
13
|
import { snapshot } from "./workflows/lib/permissions.ts";
|
|
14
14
|
import { Run, type FinishResult } from "./workflows/lib/run.ts";
|
|
15
15
|
import { buildTestWorkflow, buildTestWorkflowPreflight } from "./workflows/wf-build-test.ts";
|
|
@@ -89,7 +89,7 @@ export async function executeFlow(command: FlowCommand, options: { cwd?: string;
|
|
|
89
89
|
// CLI keeps its clean-tree guard, but creates a branch only on explicit request.
|
|
90
90
|
// Hub scout runs only in a detached
|
|
91
91
|
// isolated snapshot and never creates or annotates a branch.
|
|
92
|
-
if (!options.hubScout) requireCleanTree(cwd, command.allowDirty);
|
|
92
|
+
if (!options.hubScout) { requireRepository(cwd); requireCleanTree(cwd, command.allowDirty); }
|
|
93
93
|
workflow.preflight?.(cwd, command);
|
|
94
94
|
const runId = command.runId ?? makeRunId();
|
|
95
95
|
const repositoryBaseline = snapshot(cwd);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {constants,lstatSync,type Stats} from 'node:fs';
|
|
2
|
+
import {lstat,mkdir,open,rename,unlink,type FileHandle} from 'node:fs/promises';
|
|
3
|
+
import {isAbsolute,resolve,dirname,parse} from 'node:path';
|
|
4
|
+
import {randomUUID} from 'node:crypto';
|
|
5
|
+
export const privateFileIdentity=(s:Stats)=>[s.dev,s.ino,s.uid,s.mode,s.nlink,s.size,s.mtimeMs,s.ctimeMs].join(':');
|
|
6
|
+
const directoryIdentity=(s:Stats)=>[s.dev,s.ino,s.uid,s.mode].join(':');
|
|
7
|
+
const missing=(e:unknown)=>(e as any)?.code==='ENOENT';
|
|
8
|
+
export function canonicalPrivatePath(path:string){return typeof path==='string'&&path.length<=4096&&isAbsolute(path)&&resolve(path)===path&&!/[\u0000-\u001f\u007f]/.test(path);}
|
|
9
|
+
function check(signal?:AbortSignal,guard?:()=>void){if(signal?.aborted)throw Error('bootstrap_file_cancelled');guard?.();if(signal?.aborted)throw Error('bootstrap_file_cancelled');}
|
|
10
|
+
/** Explicit user-owned local POSIX directory; no mode repair or symlink walk. */
|
|
11
|
+
export async function privateDirectory(path:string,create=false){
|
|
12
|
+
if(!canonicalPrivatePath(path)||path===parse(path).root||typeof process.getuid!=='function')throw Error('bootstrap_directory_unsafe');
|
|
13
|
+
const chain:string[]=[];for(let p=path;;p=dirname(p)){chain.unshift(p);if(p===dirname(p))break;}
|
|
14
|
+
for(const p of chain){let s:Stats;try{s=await lstat(p);}catch(e){if(!create||!missing(e))throw e;try{await mkdir(p,{mode:0o700});}catch(x){if((x as any)?.code!=='EEXIST')throw x;}s=await lstat(p);}
|
|
15
|
+
if(!s.isDirectory()||s.isSymbolicLink()||(s.uid!==0&&s.uid!==process.getuid())||((s.mode&0o022)!==0&&!(s.uid===0&&(s.mode&0o1000)!==0))||(p===path&&(s.uid!==process.getuid()||(s.mode&0o077)!==0)))throw Error('bootstrap_directory_unsafe');
|
|
16
|
+
}
|
|
17
|
+
return directoryIdentity(await lstat(path));
|
|
18
|
+
}
|
|
19
|
+
export function directoryCurrent(path:string,expected:string){try{const s=lstatSync(path);return s.isDirectory()&&!s.isSymbolicLink()&&directoryIdentity(s)===expected;}catch{return false;}}
|
|
20
|
+
function safe(s:Stats,max:number){if(!s.isFile()||s.isSymbolicLink()||s.uid!==process.getuid?.()||s.nlink!==1||(s.mode&0o077)!==0||s.size<1||s.size>max)throw Error('bootstrap_file_unsafe');}
|
|
21
|
+
export async function readPrivateJson(path:string,max=32768,signal?:AbortSignal):Promise<{value:any;identity:string}|null>{
|
|
22
|
+
if(!canonicalPrivatePath(path)||!Number.isSafeInteger(max)||max<1||max>65536)throw Error('bootstrap_file_invalid');let file:FileHandle|undefined;
|
|
23
|
+
try{
|
|
24
|
+
check(signal);const parent=await privateDirectory(dirname(path)),before=await lstat(path);safe(before,max);file=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW);const held=await file.stat();safe(held,max);if(privateFileIdentity(held)!==privateFileIdentity(before))throw Error('bootstrap_file_changed');
|
|
25
|
+
const bytes=Buffer.alloc(held.size+1);let offset=0;while(offset<bytes.length){check(signal);const read=await file.read(bytes,offset,bytes.length-offset,null);if(!read.bytesRead)break;offset+=read.bytesRead;}
|
|
26
|
+
if(offset!==held.size||privateFileIdentity(await file.stat())!==privateFileIdentity(held)||privateFileIdentity(await lstat(path))!==privateFileIdentity(held)||!directoryCurrent(dirname(path),parent))throw Error('bootstrap_file_changed');
|
|
27
|
+
const value=JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(bytes.subarray(0,offset)));await file.close();file=undefined;check(signal);return {value,identity:privateFileIdentity(held)};
|
|
28
|
+
}catch(e){if(missing(e))return null;throw e;}finally{await file?.close();}
|
|
29
|
+
}
|
|
30
|
+
/** Owned temporary file + CAS publication. Unknown after rename is not rollback.
|
|
31
|
+
* guard is trusted synchronous scope/epoch/lease validation immediately before
|
|
32
|
+
* publication, never a model boolean. No repair/foreign replacement cleanup. */
|
|
33
|
+
export async function writePrivateJson(path:string,value:unknown,options:{signal?:AbortSignal;guard?:()=>void;expected?:string|null;createParent?:boolean}={}){
|
|
34
|
+
const encoded=JSON.stringify(value);if(typeof encoded!=='string')throw Error('bootstrap_file_invalid');const bytes=Buffer.from(encoded+'\n');if(bytes.length>32768||!canonicalPrivatePath(path))throw Error('bootstrap_file_limit');
|
|
35
|
+
const {signal,guard,expected:requestedExpected,createParent}=options;check(signal,guard);const parent=await privateDirectory(dirname(path),createParent===true);check(signal,guard);
|
|
36
|
+
const at=async()=>{try{const s=await lstat(path);safe(s,32768);return privateFileIdentity(s);}catch(e){if(missing(e))return null;throw e;}};
|
|
37
|
+
const expected=requestedExpected===undefined?await at():requestedExpected,temp=path+'.tmp-'+randomUUID();let file:FileHandle|undefined,owned:Stats|undefined,staged:string|undefined,renamed=false;
|
|
38
|
+
try{
|
|
39
|
+
check(signal,guard);file=await open(temp,constants.O_WRONLY|constants.O_CREAT|constants.O_EXCL|constants.O_NOFOLLOW,0o600);owned=await file.stat();await file.writeFile(bytes);await file.sync();staged=privateFileIdentity(await file.stat());await file.close();file=undefined;
|
|
40
|
+
if(!directoryCurrent(dirname(path),parent)||await at()!==expected)throw Error('bootstrap_file_changed');check(signal,guard);
|
|
41
|
+
const pending=lstatSync(temp);safe(pending,32768);if(privateFileIdentity(pending)!==staged||!directoryCurrent(dirname(path),parent))throw Error('bootstrap_file_changed');
|
|
42
|
+
await rename(temp,path);renamed=true;const dir=await open(dirname(path),constants.O_RDONLY|constants.O_DIRECTORY);try{await dir.sync();}finally{await dir.close();}
|
|
43
|
+
check(signal,guard);if(!directoryCurrent(dirname(path),parent))throw Error('bootstrap_file_changed');const result=await readPrivateJson(path,32768,signal);if(!result||JSON.stringify(result.value)+'\n'!==bytes.toString('utf8'))throw Error('bootstrap_file_changed');check(signal,guard);return result.identity;
|
|
44
|
+
}catch(e){if(renamed)throw Error('bootstrap_file_publication_unknown');throw e;}
|
|
45
|
+
finally{try{await file?.close();}finally{if(!renamed&&owned){try{const s=await lstat(temp);if(s.dev!==owned.dev||s.ino!==owned.ino||!s.isFile()||s.uid!==process.getuid?.()||(staged!==undefined&&privateFileIdentity(s)!==staged))throw Error('bootstrap_file_cleanup_unsafe');await unlink(temp);}catch(e){if(!missing(e))throw e;}}}}
|
|
46
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {createHash} from 'node:crypto';
|
|
2
|
+
import type {BootstrapServices} from '../../../harnesses/lib/fleet-notification-bootstrap.ts';
|
|
3
|
+
import type {CodexUnixQueueRpc} from './codex-unix-queue-rpc.ts';
|
|
4
|
+
import type {CodexProbeTranscript,ProbeCheckpoint} from './codex-probe-transcript.ts';
|
|
5
|
+
const uuid=(v:unknown):v is string=>typeof v==='string'&&/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/.test(v);
|
|
6
|
+
const object=(v:unknown):v is Record<string,any>=>!!v&&typeof v==='object'&&!Array.isArray(v);
|
|
7
|
+
type Request=Parameters<BootstrapServices['probe']>[0];
|
|
8
|
+
/** One no-load probe. guard is TRUSTED server code rechecking exact native
|
|
9
|
+
* identity/read capability/owner/rights/context; never a model-supplied boolean.
|
|
10
|
+
* Metadata path comes only from pinned includeTurns:false response, not tool args.
|
|
11
|
+
* No fallback to thread load/resume, queue retry, or queue-ACK-as-delivery. */
|
|
12
|
+
export class CodexBootstrapProbe {
|
|
13
|
+
private readonly options:{rpc:Pick<CodexUnixQueueRpc,'request'>;reader:Pick<CodexProbeTranscript,'checkpoint'|'waitForAck'|'close'>;guard:(request:Request)=>void};
|
|
14
|
+
readonly #used=new Map<string,number>();
|
|
15
|
+
constructor(options:CodexBootstrapProbe['options']){this.options={...options};}
|
|
16
|
+
async run(input:Request,signal:AbortSignal):ReturnType<BootstrapServices['probe']>{
|
|
17
|
+
const request=structuredClone(input),{scope,assessment,probeId}=request;
|
|
18
|
+
if(!uuid(probeId)||!uuid(scope?.namespace?.threadId)||scope.binding.threadId!==scope.namespace.threadId||!['verified','contract_checked','contract_unverified'].includes(assessment.level)||!('context'in assessment))throw Error('bootstrap_probe_invalid');
|
|
19
|
+
const now=performance.now();for(const [id,until]of this.#used)if(until<=now)this.#used.delete(id);
|
|
20
|
+
if(this.#used.has(probeId)||this.#used.size>=128)throw Error('bootstrap_probe_not_replayable');this.#used.set(probeId,now+600000);
|
|
21
|
+
const deadline=now+29000,timeout=new AbortController(),scoped=AbortSignal.any([signal,timeout.signal]),timer=setTimeout(()=>timeout.abort(),29000);
|
|
22
|
+
const guard=()=>{if(scoped.aborted||performance.now()>=deadline||Date.now()>=scope.until)throw Error('bootstrap_probe_stale');this.options.guard(structuredClone(request));if(scoped.aborted||performance.now()>=deadline)throw Error('bootstrap_probe_stale');};
|
|
23
|
+
const pin={daemonVersion:assessment.context.daemonVersion,socketEpoch:assessment.context.socketEpoch};let checkpoint:ProbeCheckpoint|undefined,attempted=false;
|
|
24
|
+
const metadata=async()=>{guard();const raw=await this.options.rpc.request('thread/read',{threadId:scope.namespace.threadId,includeTurns:false},{signal:scoped,pin,beforeWrite:guard});guard();
|
|
25
|
+
if(!object(raw)||!object(raw.thread)||raw.thread.id!==scope.namespace.threadId||raw.thread.status?.type!=='notLoaded'||typeof raw.thread.path!=='string'||!raw.thread.path||raw.thread.path.length>4096)throw Error('bootstrap_probe_metadata_unavailable');return raw.thread.path as string;};
|
|
26
|
+
try{
|
|
27
|
+
const path=await metadata();checkpoint=await this.options.reader.checkpoint(path,scope.namespace.threadId,scoped);guard();
|
|
28
|
+
if(await metadata()!==path)throw Error('bootstrap_probe_path_changed');
|
|
29
|
+
if(deadline-performance.now()<=10000)throw Error('bootstrap_probe_budget_too_short');
|
|
30
|
+
const clientUserMessageId=createHash('sha256').update(JSON.stringify([scope.binding,assessment.context,probeId])).digest('hex');
|
|
31
|
+
const envelope={schema:'fleet-bootstrap-probe/v1',source:'fleet_machine',transportOrigin:'user_input',humanApproval:false,deliveryProbe:true,probeId,threadId:scope.namespace.threadId,bindingId:scope.binding.id,bindingEpoch:scope.binding.epoch,fleetOwner:scope.binding.fleetOwner,deadline:Math.floor(Math.min(scope.until,Date.now()+deadline-performance.now())),expectedReply:'FLEET_PROBE_ACK '+probeId};
|
|
32
|
+
const text='FLEET_BOOTSTRAP_PROBE_V1\n'+JSON.stringify(envelope)+'\nТова е само машинен тест за доставка, НЕ човешко одобрение или Fleet задача. Само ако thread/epoch/срокът съвпадат, отговори с единствен final_answer точно expectedReply, без инструменти, файлови промени, права или команди. При изтекъл/чужд probe не възстановявай разрешения.';
|
|
33
|
+
const result=await this.options.rpc.request('thread/queue/add',{threadId:scope.namespace.threadId,clientUserMessageId,input:[{type:'text',text,text_elements:[]}]},{signal:scoped,pin,beforeWrite:()=>{guard();attempted=true;}});
|
|
34
|
+
guard();if(!attempted)throw Error('bootstrap_probe_missing_prewrite_guard');const q=object(result)&&result.queuedSubmission;
|
|
35
|
+
if(!object(q)||typeof q.id!=='string'||!q.id||q.id.length>256||q.clientUserMessageId!==clientUserMessageId||!Array.isArray(q.input)||q.input.length!==1||q.input[0]?.type!=='text'||q.input[0]?.text!==text)throw Error('bootstrap_probe_enqueue_unknown');
|
|
36
|
+
const ack=await this.options.reader.waitForAck(checkpoint,probeId,scoped);guard();
|
|
37
|
+
if(ack.source!=='local_codex_rollout_jsonl'||ack.readerVersion!=='codex-local-rollout-ack/v1'||ack.threadId!==scope.namespace.threadId||ack.probeId!==probeId||!/^rollout:[a-f0-9]{64}$/.test(ack.receiptId))throw Error('bootstrap_probe_ack_invalid');
|
|
38
|
+
if(await metadata()!==path)throw Error('bootstrap_probe_path_changed');guard();
|
|
39
|
+
const closing=checkpoint;checkpoint=undefined;await this.options.reader.close(closing);guard();
|
|
40
|
+
return {status:'acknowledged',source:'read_only_assistant_transcript',probeId,threadId:scope.namespace.threadId,hostInstance:scope.binding.hostInstance,...assessment.context,notLoadedBefore:true,notLoadedAfter:true,receiptId:ack.receiptId};
|
|
41
|
+
}catch{throw Error(attempted?'bootstrap_probe_unknown_no_replay':'bootstrap_probe_not_sent');}
|
|
42
|
+
finally{clearTimeout(timer);timeout.abort();if(checkpoint)await this.options.reader.close(checkpoint);}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {randomUUID} from 'node:crypto';
|
|
2
|
+
import {AllowedSessionsStore,StoreError,type StoreOptions,type StoreSnapshot} from './fleet-codex-allowlist-store.ts';
|
|
3
|
+
import type {ConversationKey,TargetEpoch,Right} from './fleet-codex-allowlist.ts';
|
|
4
|
+
import {PermissionTransport} from './fleet-codex-permission-transport.ts';
|
|
5
|
+
import type {NativePresenceDirectory} from './codex-native-presence.ts';
|
|
6
|
+
import {BootstrapChannelClient,namespaceKey,bootstrapNamespace,type BootstrapPresence} from '../../../harnesses/lib/fleet-bootstrap-channel.ts';
|
|
7
|
+
import {codexRightsSnapshot} from '../../../harnesses/lib/fleet-codex-policy-snapshot.ts';
|
|
8
|
+
import {targetKey,validInstructionTarget} from '../../../harnesses/lib/fleet-target-identity.ts';
|
|
9
|
+
|
|
10
|
+
type Candidate={target:TargetEpoch;current:TargetEpoch[]};
|
|
11
|
+
type Pending={context:string;owner:TargetEpoch;expires:number;link:BootstrapChannelClient;running?:Promise<any>;outcome?:any};
|
|
12
|
+
const object=(v:unknown):v is Record<string,any>=>!!v&&typeof v==='object'&&!Array.isArray(v);
|
|
13
|
+
const clone=<T>(v:T):T=>structuredClone(v);
|
|
14
|
+
const uuid=(v:unknown):v is string=>typeof v==='string'&&/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/.test(v);
|
|
15
|
+
const failure=(reason:string)=>({status:'blocked',reason,noChanges:true,activation:'not_performed'});
|
|
16
|
+
|
|
17
|
+
/** Native MCP process owns the writer; neither model arguments nor the AF
|
|
18
|
+
* process can call it directly. Server write frames are accepted only on the
|
|
19
|
+
* exact attached owner/namespace/host-instance channel after native Pi consent.
|
|
20
|
+
* Same-UID cooperative scope is NOT cryptographic human/host authentication. */
|
|
21
|
+
export class CodexBootstrapProducer {
|
|
22
|
+
readonly #links=new Map<string,BootstrapChannelClient>();readonly #opening=new Map<string,Promise<BootstrapChannelClient>>();readonly #pending=new Map<string,Pending>();readonly #writing=new Set<string>();readonly #stop=new AbortController();
|
|
23
|
+
readonly #contexts=new Map<string,{observation:BootstrapPresence;at:number;dirty:boolean;publishing?:Promise<void>}>();readonly #requests=new Set<string>();#polling=false;#timer?:ReturnType<typeof setInterval>;
|
|
24
|
+
readonly hostInstance=randomUUID();
|
|
25
|
+
private readonly options:{policyRoot:string;transport:Pick<PermissionTransport,'open'>;candidate:(c:ConversationKey,t:TargetEpoch)=>Promise<Candidate>;observation:()=>{protocolVersion:string;clientInfo:BootstrapPresence['clientInfo'];catalog:string[]}|null;storeOptions?:StoreOptions;now?:()=>number;monotonic?:()=>number;pendingBudget?:(context:string)=>{total:number;context:number};presence?:NativePresenceDirectory};
|
|
26
|
+
constructor(options:CodexBootstrapProducer['options']){this.options={...options};}
|
|
27
|
+
#now(){return (this.options.now??Date.now)();}#mono(){return (this.options.monotonic??(()=>performance.now()))();}
|
|
28
|
+
#store(c:ConversationKey){return new AllowedSessionsStore(this.options.policyRoot,c,{...this.options.storeOptions,now:this.options.now});}
|
|
29
|
+
async #state(c:ConversationKey):Promise<StoreSnapshot|null>{try{return await this.#store(c).open();}catch(e){if(e instanceof StoreError&&e.code==='STATE_MISSING')return null;throw e;}}
|
|
30
|
+
async #fresh(c:ConversationKey,owner:TargetEpoch,signal:AbortSignal){if(this.#stop.signal.aborted||signal.aborted)throw Error('bootstrap_cancelled');const selected=await this.options.candidate(clone(c),clone(owner));if(this.#stop.signal.aborted||signal.aborted||targetKey(selected.target)!==targetKey(owner))throw Error('bootstrap_owner_changed');return clone(selected);}
|
|
31
|
+
#linkKey(c:ConversationKey,t:TargetEpoch){return namespaceKey(c)+'/'+targetKey(t);}
|
|
32
|
+
/** Called only after validated native metadata, never from model identity args.
|
|
33
|
+
* Coalesced private publication has no rights, queue, probe or daemon effects. */
|
|
34
|
+
observe(c:ConversationKey){
|
|
35
|
+
if(!this.options.presence||this.#stop.signal.aborted||!bootstrapNamespace(c))return;const raw=this.options.observation();if(!raw)return;
|
|
36
|
+
const k=namespaceKey(c);let context=this.#contexts.get(k);if(!context){if(this.#contexts.size>=32)return;context={observation:{namespace:clone(c),hostInstance:this.hostInstance,...clone(raw)},at:this.#now(),dirty:true};this.#contexts.set(k,context);}else{context.observation={namespace:clone(c),hostInstance:this.hostInstance,...clone(raw)};context.at=this.#now();context.dirty=true;}
|
|
37
|
+
for(const [id,link]of this.#links)if(id.startsWith(k+'/')&&!link.signal.aborted)void link.refresh(context.observation,context.at).catch(()=>link.stop());
|
|
38
|
+
if(!context.publishing){const current=context;let work:Promise<void>;work=(async()=>{while(current.dirty&&!this.#stop.signal.aborted){current.dirty=false;try{await this.options.presence!.publish(clone(current.observation),this.#stop.signal);}catch{}}})().finally(()=>{if(current.publishing===work)current.publishing=undefined;});current.publishing=work;}
|
|
39
|
+
if(!this.#timer){this.#timer=setInterval(()=>{void this.#poll();},500);this.#timer.unref?.();}
|
|
40
|
+
}
|
|
41
|
+
async #published(c:ConversationKey,signal:AbortSignal){
|
|
42
|
+
const work=this.#contexts.get(namespaceKey(c))?.publishing;if(!work)return;let timer:ReturnType<typeof setTimeout>|undefined;const stop=AbortSignal.any([signal,this.#stop.signal]);let abort=()=>{};
|
|
43
|
+
try{await Promise.race([work,new Promise<never>((_,reject)=>{abort=()=>reject(Error('bootstrap_cancelled'));stop.addEventListener('abort',abort,{once:true});timer=setTimeout(()=>reject(Error('bootstrap_presence_unavailable')),2000);if(stop.aborted)abort();})]);}finally{clearTimeout(timer);stop.removeEventListener('abort',abort);}
|
|
44
|
+
}
|
|
45
|
+
async #poll(){
|
|
46
|
+
if(this.#polling||this.#stop.signal.aborted||!this.options.presence)return;this.#polling=true;
|
|
47
|
+
try{
|
|
48
|
+
for(const [k,c]of this.#contexts)if(this.#now()-c.at>=600000){this.#contexts.delete(k);void this.options.presence.remove(c.observation).catch(()=>{});}
|
|
49
|
+
if(!this.#contexts.size){clearInterval(this.#timer);this.#timer=undefined;return;}
|
|
50
|
+
for(const entry of await this.options.presence.requests(this.hostInstance,this.#stop.signal)){
|
|
51
|
+
if(this.#requests.has(entry.request.id))continue;if(this.#requests.size>=256)this.#requests.delete(this.#requests.values().next().value!);this.#requests.add(entry.request.id);
|
|
52
|
+
const c=this.#contexts.get(namespaceKey(entry.request.namespace));if(!c||this.#now()-c.at>=600000)continue;
|
|
53
|
+
try{await this.#fresh(entry.request.namespace,entry.request.owner,this.#stop.signal);await this.#link(entry.request.namespace,entry.request.owner,this.#stop.signal);}catch{}
|
|
54
|
+
finally{await this.options.presence.consume(entry.path,entry.identity).catch(()=>{});}
|
|
55
|
+
}
|
|
56
|
+
}catch{}finally{this.#polling=false;}
|
|
57
|
+
}
|
|
58
|
+
async #link(c:ConversationKey,owner:TargetEpoch,signal:AbortSignal){
|
|
59
|
+
const id=this.#linkKey(c,owner),existing=this.#links.get(id);if(existing&&!existing.signal.aborted){const at=this.#contexts.get(namespaceKey(c))?.at??this.#now(),raw=this.options.observation();if(raw)await existing.refresh({namespace:clone(c),hostInstance:this.hostInstance,...clone(raw)},at);return existing;}
|
|
60
|
+
const opening=this.#opening.get(id);if(opening)return opening;
|
|
61
|
+
const observation=this.options.observation();if(!bootstrapNamespace(c)||!validInstructionTarget(owner)||!observation||this.#stop.signal.aborted||this.#links.size+this.#opening.size>=32)throw Error('bootstrap_presence_unavailable');
|
|
62
|
+
const work=Promise.resolve().then(async()=>{
|
|
63
|
+
let link:BootstrapChannelClient|undefined;
|
|
64
|
+
try{const socket=await this.options.transport.open(owner,async()=>{await this.#fresh(c,owner,signal);},AbortSignal.any([signal,this.#stop.signal]));
|
|
65
|
+
if(this.#stop.signal.aborted||signal.aborted){socket.destroy();throw Error('bootstrap_cancelled');}
|
|
66
|
+
link=new BootstrapChannelClient({socket,owner,observation:{namespace:clone(c),hostInstance:this.hostInstance,...clone(observation)},writeRights:(command,s)=>this.#write(c,owner,command,s),signal:this.#stop.signal,observedAt:this.#contexts.get(namespaceKey(c))?.at??this.#now()});
|
|
67
|
+
await link.ready();await this.#fresh(c,owner,signal);if(link.signal.aborted)throw Error('bootstrap_presence_unavailable');this.#links.set(id,link);const active=link;
|
|
68
|
+
active.signal.addEventListener('abort',()=>{if(this.#links.get(id)===active)this.#links.delete(id);},{once:true});return active;
|
|
69
|
+
}catch(e){link?.stop();throw e;}finally{this.#opening.delete(id);}
|
|
70
|
+
});this.#opening.set(id,work);return work;
|
|
71
|
+
}
|
|
72
|
+
async #write(c:ConversationKey,owner:TargetEpoch,command:unknown,signal:AbortSignal){
|
|
73
|
+
const context=namespaceKey(c);
|
|
74
|
+
if(!object(command)||!object(command.scope)||!object(command.expected)||this.#writing.has(context))throw Error('bootstrap_writer_invalid');
|
|
75
|
+
const {scope,expected}=clone(command);
|
|
76
|
+
if(!bootstrapNamespace(scope.namespace)||namespaceKey(scope.namespace)!==context||!validInstructionTarget(scope.owner)||targetKey(scope.owner)!==targetKey(owner)
|
|
77
|
+
||!object(scope.binding)||scope.binding.threadId!==c.threadId||scope.binding.hostInstance!==this.hostInstance||scope.binding.fleetOwner!==targetKey(owner)
|
|
78
|
+
||!Number.isSafeInteger(scope.until)||scope.until<=this.#now()||scope.until-this.#now()>720*3600000||!Array.isArray(scope.rights)||scope.rights.length>3
|
|
79
|
+
||JSON.stringify(scope.rights)!==JSON.stringify(['read',...(scope.rights.includes('send')?['send']:[]),...(scope.rights.includes('approve')?['approve']:[])]))throw Error('bootstrap_writer_scope_changed');
|
|
80
|
+
this.#writing.add(context);
|
|
81
|
+
try{
|
|
82
|
+
const selected=await this.#fresh(c,owner,signal),store=this.#store(c);let state=await this.#state(c);
|
|
83
|
+
if(JSON.stringify(codexRightsSnapshot(state,owner))!==JSON.stringify(expected))throw Error('bootstrap_rights_changed');
|
|
84
|
+
await this.#fresh(c,owner,signal);
|
|
85
|
+
if(!state){if(signal.aborted)throw Error('bootstrap_cancelled');state=await store.initialize();if(signal.aborted)throw Error('bootstrap_writer_unknown');}
|
|
86
|
+
const binding=state.bindings.find(b=>b.target.project===owner.project&&b.target.peer===owner.peer),rights=scope.rights as Right[];
|
|
87
|
+
const result=binding?await store.reconnect({alias:binding.alias,previousTarget:binding.target,target:owner,rights,expiresAt:scope.until},selected.current,state.revision,signal)
|
|
88
|
+
:await store.connect({alias:owner.project+':'+owner.peer,target:owner,rights,expiresAt:scope.until},selected.current,state.revision,signal);
|
|
89
|
+
if(signal.aborted)throw Error('bootstrap_writer_unknown');await this.#fresh(c,owner,signal);
|
|
90
|
+
return codexRightsSnapshot(result,owner);
|
|
91
|
+
}finally{this.#writing.delete(context);}
|
|
92
|
+
}
|
|
93
|
+
pendingCount(context?:string){for(const [id,p]of this.#pending)if((!p.running||p.outcome)&&p.expires<=this.#mono())this.#pending.delete(id);return context===undefined?this.#pending.size:[...this.#pending.values()].filter(p=>p.context===context).length;}
|
|
94
|
+
#capacity(c:ConversationKey){const other=this.options.pendingBudget?.(namespaceKey(c))??{total:0,context:0};return this.pendingCount()+other.total>=64||this.pendingCount(namespaceKey(c))+other.context>=16;}
|
|
95
|
+
async prepare(c:ConversationKey,a:any,signal=new AbortController().signal){
|
|
96
|
+
if(this.#capacity(c))return failure('bootstrap_capacity');this.observe(c);
|
|
97
|
+
try{
|
|
98
|
+
await this.#published(c,signal);
|
|
99
|
+
const selected=await this.#fresh(c,a.target,signal),link=await this.#link(clone(c),selected.target,signal),state=await this.#state(c);
|
|
100
|
+
const binding=state?.bindings.find(b=>b.target.project===a.target.project&&b.target.peer===a.target.peer);
|
|
101
|
+
const until=this.#now()+(a.durationHours??12)*3600000,rights=[...(a.rights??binding?.rights??['read'])];
|
|
102
|
+
const result=await link.request('prepare',{until,rights},signal);
|
|
103
|
+
if(result?.status==='prepared'&&uuid(result.proposalId)){
|
|
104
|
+
if(this.#capacity(c))return failure('bootstrap_capacity');
|
|
105
|
+
this.#pending.set(result.proposalId,{context:namespaceKey(c),owner:clone(selected.target),expires:this.#mono()+300000,link});
|
|
106
|
+
}
|
|
107
|
+
return {...clone(result),target:clone(selected.target),source:'native_pi_bootstrap',humanProvenance:'pending_native_pi_confirmation',delivery:'not_attempted'};
|
|
108
|
+
}catch{return failure('bootstrap_presence_or_control_unavailable');}
|
|
109
|
+
}
|
|
110
|
+
has(c:ConversationKey,id:string){return this.#pending.get(id)?.context===namespaceKey(c);}
|
|
111
|
+
/** Release the initiating model/tool turn before waiting for that same chat's
|
|
112
|
+
* terminal probe ACK. A handoff receipt never proves consent or effects. The
|
|
113
|
+
* normal MCP signal survives successful response; cancellation before handoff
|
|
114
|
+
* and producer shutdown still cancel the scoped operation. */
|
|
115
|
+
async beginCommit(c:ConversationKey,id:string,signal=new AbortController().signal){
|
|
116
|
+
const p=this.#pending.get(id);if(!p||p.context!==namespaceKey(c)||p.expires<=this.#mono())throw Error('bootstrap_proposal_unavailable');if(signal.aborted||this.#stop.signal.aborted)throw Error('bootstrap_cancelled');
|
|
117
|
+
if(p.outcome)return {...clone(p.outcome),cachedPreviousCommit:true,delivery:'not_established_by_receipt'};
|
|
118
|
+
if(!p.running)void this.commit(c,id,signal).catch(()=>{});
|
|
119
|
+
return {status:'pending',proposalId:id,source:'native_pi_bootstrap',humanProvenance:'not_established_by_handoff',activation:'not_established_by_handoff',rightsCommitted:'not_established_by_handoff',delivery:'not_established_by_handoff',startsDaemon:false,grantsApproveAutomatically:false};
|
|
120
|
+
}
|
|
121
|
+
async commit(c:ConversationKey,id:string,signal=new AbortController().signal){
|
|
122
|
+
const p=this.#pending.get(id);if(!p||p.context!==namespaceKey(c)||p.expires<=this.#mono())throw Error('bootstrap_proposal_unavailable');
|
|
123
|
+
if(p.outcome)return clone(p.outcome);if(p.running)return p.running.then(clone);
|
|
124
|
+
p.running=Promise.resolve().then(async()=>{try{await this.#fresh(c,p.owner,signal);p.outcome=await p.link.request('commit',{proposalId:id},signal);}catch{p.outcome={status:'failed_or_unknown',reason:'bootstrap_control_lost',replayAllowed:false,activation:'unknown'};}return clone(p.outcome);});return p.running.then(clone);
|
|
125
|
+
}
|
|
126
|
+
async status(c:ConversationKey,owner:TargetEpoch,signal=new AbortController().signal){
|
|
127
|
+
const link=this.#links.get(this.#linkKey(c,owner));if(!link||link.signal.aborted)return failure('bootstrap_presence_unavailable');
|
|
128
|
+
try{return await link.request('status',{},signal);}catch{return failure('bootstrap_control_unavailable');}
|
|
129
|
+
}
|
|
130
|
+
stop(){this.#stop.abort();clearInterval(this.#timer);for(const l of this.#links.values())l.stop();this.#links.clear();const contexts=[...this.#contexts.values()];this.#contexts.clear();if(this.options.presence)void Promise.allSettled(contexts.map(c=>c.publishing)).then(()=>Promise.allSettled(contexts.map(c=>this.options.presence!.remove(c.observation))));}
|
|
131
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {createRequire} from 'node:module';
|
|
2
|
+
import {createConnection,type Socket} from 'node:net';
|
|
3
|
+
import {lstatSync,realpathSync,readlinkSync,type BigIntStats} from 'node:fs';
|
|
4
|
+
import {dirname,isAbsolute,resolve} from 'node:path';
|
|
5
|
+
import {createHash,randomUUID} from 'node:crypto';
|
|
6
|
+
import type {EventEmitter} from 'node:events';
|
|
7
|
+
import type {DaemonObservationRpc} from './codex-measurement.ts';
|
|
8
|
+
|
|
9
|
+
export interface WsConnection extends EventEmitter {send(data:string):void;terminate():void;}
|
|
10
|
+
const require=createRequire(import.meta.url);
|
|
11
|
+
type WsConstructor=new(url:string,options:Record<string,unknown>)=>WsConnection;
|
|
12
|
+
// Resolved on the first connection, not at import: the Hub imports this module at
|
|
13
|
+
// startup, and a workspace without `ws` must still load the Hub.
|
|
14
|
+
let WebSocket:WsConstructor|undefined;
|
|
15
|
+
export const webSocket=():WsConstructor=>WebSocket??=require('ws') as WsConstructor;
|
|
16
|
+
export class CodexObserverError extends Error {
|
|
17
|
+
readonly code:string;
|
|
18
|
+
constructor(code:string){super(code);this.code=code;}
|
|
19
|
+
}
|
|
20
|
+
const fail=(code:string):never=>{throw new CodexObserverError(code);};
|
|
21
|
+
const validPath=(value:unknown):value is string=>typeof value==='string'&&isAbsolute(value)&&Buffer.byteLength(value)<=100&&!/[:?#%\\\u0000-\u0020\u007f]/.test(value);
|
|
22
|
+
const identity=(s:BigIntStats)=>[s.dev,s.ino,s.mode,s.uid,s.gid,s.nlink,s.ctimeNs].map(String);
|
|
23
|
+
type Observation={result:{userAgent:string};socketEpoch:string};
|
|
24
|
+
|
|
25
|
+
/** Connect-only initialize observer, NOT a queue client or Desktop attestation.
|
|
26
|
+
* Explicit physical socket path only: no discovery/start/auth/config operations.
|
|
27
|
+
* Kept separate from CodexUnixQueueRpc so its delivery surface stays unchanged.
|
|
28
|
+
*/
|
|
29
|
+
export class CodexDaemonObserver implements DaemonObservationRpc {
|
|
30
|
+
private readonly path:string;
|
|
31
|
+
private readonly timeout:number;
|
|
32
|
+
constructor(options:{socketPath:string;timeoutMs?:number}){
|
|
33
|
+
if(process.platform==='win32'||process.getuid===undefined)fail('UNSUPPORTED_PLATFORM');
|
|
34
|
+
if(!validPath(options.socketPath))fail('INVALID_SOCKET_PATH');
|
|
35
|
+
this.path=resolve(options.socketPath);this.timeout=options.timeoutMs??3000;
|
|
36
|
+
if(!Number.isSafeInteger(this.timeout)||this.timeout<1||this.timeout>10000)fail('INVALID_TIMEOUT');
|
|
37
|
+
}
|
|
38
|
+
private endpoint(){
|
|
39
|
+
try{
|
|
40
|
+
const uid=BigInt(process.getuid!()),checked=new Set<string>();
|
|
41
|
+
const privateParent=(path:string)=>{
|
|
42
|
+
const parent=dirname(path),s=lstatSync(parent,{bigint:true});
|
|
43
|
+
if(!s.isDirectory()||s.isSymbolicLink()||s.uid!==uid||(Number(s.mode)&0o077)!==0||realpathSync(parent)!==parent)fail('UNSAFE_SOCKET');
|
|
44
|
+
for(let dir=parent;!checked.has(dir);dir=dirname(dir)){
|
|
45
|
+
checked.add(dir);const d=lstatSync(dir,{bigint:true});
|
|
46
|
+
if(!d.isDirectory()||d.isSymbolicLink()||(d.uid!==uid&&d.uid!==0n)||((Number(d.mode)&0o022)!==0&&(Number(d.mode)&0o1000)===0))fail('UNSAFE_SOCKET');
|
|
47
|
+
}
|
|
48
|
+
return s;
|
|
49
|
+
};
|
|
50
|
+
const aliasParent=privateParent(this.path),alias=lstatSync(this.path,{bigint:true});
|
|
51
|
+
if(alias.uid!==uid)fail('UNSAFE_SOCKET');
|
|
52
|
+
const path=alias.isSymbolicLink()?resolve(dirname(this.path),readlinkSync(this.path)):this.path;
|
|
53
|
+
if(!validPath(path))fail('UNSAFE_SOCKET');
|
|
54
|
+
const targetParent=privateParent(path),socket=lstatSync(path,{bigint:true});
|
|
55
|
+
if(!socket.isSocket()||socket.isSymbolicLink()||socket.uid!==uid||(Number(socket.mode)&0o022)!==0||realpathSync(path)!==path)fail('UNSAFE_SOCKET');
|
|
56
|
+
// Capture the exact physical path used by createConnection. Epoch is our
|
|
57
|
+
// metadata, never an initialize result field. ctime detects restored aliases.
|
|
58
|
+
const digest=createHash('sha256').update(JSON.stringify([this.path,path,identity(alias),identity(socket),identity(aliasParent).slice(0,5),identity(targetParent).slice(0,5)])).digest('hex');
|
|
59
|
+
return {path,epoch:'codex-initialize/v1:'+digest};
|
|
60
|
+
}catch(error){if(error instanceof CodexObserverError)throw error;throw new CodexObserverError('DAEMON_UNAVAILABLE');}
|
|
61
|
+
}
|
|
62
|
+
socketEpoch(signal:AbortSignal):string{
|
|
63
|
+
if(signal.aborted)fail('CANCELLED');
|
|
64
|
+
const epoch=this.endpoint().epoch;if(signal.aborted)fail('CANCELLED');return epoch;
|
|
65
|
+
}
|
|
66
|
+
async initialize(signal:AbortSignal,expectedEpoch:string):Promise<Observation>{
|
|
67
|
+
const expires=performance.now()+this.timeout;
|
|
68
|
+
const live=()=>signal.aborted?'CANCELLED':performance.now()>=expires?'TIMEOUT':undefined;
|
|
69
|
+
const early=live();if(early)fail(early);
|
|
70
|
+
if(typeof expectedEpoch!=='string'||!/^codex-initialize\/v1:[a-f0-9]{64}$/.test(expectedEpoch))fail('INVALID_EPOCH');
|
|
71
|
+
const endpoint=this.endpoint();if(endpoint.epoch!==expectedEpoch)fail('SOCKET_CHANGED');
|
|
72
|
+
const id=randomUUID();
|
|
73
|
+
return await new Promise<Observation>((resolveObservation,reject)=>{
|
|
74
|
+
let ws:WsConnection|undefined,raw:Socket|undefined,timer:ReturnType<typeof setTimeout>|undefined;
|
|
75
|
+
let closing=false,settled=false,messages=0,errorCode:string|undefined,result:Observation|undefined;
|
|
76
|
+
const settle=()=>{
|
|
77
|
+
if(settled)return;settled=true;clearTimeout(timer);signal.removeEventListener('abort',abort);
|
|
78
|
+
errorCode??=live();
|
|
79
|
+
if(errorCode)reject(new CodexObserverError(errorCode));else if(result)resolveObservation(result);else reject(new CodexObserverError('INVALID_RESPONSE'));
|
|
80
|
+
};
|
|
81
|
+
const finish=(code?:string,value?:Observation)=>{
|
|
82
|
+
if(closing)return;closing=true;errorCode=code;result=value;
|
|
83
|
+
// Keep cancellation/deadline active until the owned raw connection closes.
|
|
84
|
+
if(raw&&!raw.closed)raw.once('close',settle);else queueMicrotask(settle);
|
|
85
|
+
try{ws?.on('error',()=>{});ws?.removeAllListeners('message');ws?.terminate();}
|
|
86
|
+
finally{raw?.on('error',()=>{});raw?.destroy();}
|
|
87
|
+
};
|
|
88
|
+
const abort=()=>{const code=performance.now()>=expires?'TIMEOUT':'CANCELLED';if(closing)errorCode??=code;else finish(code);};
|
|
89
|
+
const current=()=>{
|
|
90
|
+
const code=live();if(code){finish(code);return false;}
|
|
91
|
+
try{if(this.endpoint().epoch!==endpoint.epoch){finish('SOCKET_CHANGED');return false;}}
|
|
92
|
+
catch{finish('SOCKET_CHANGED');return false;}
|
|
93
|
+
const after=live();if(after){finish(after);return false;}
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
signal.addEventListener('abort',abort,{once:true});
|
|
97
|
+
timer=setTimeout(()=>{if(closing)errorCode??='TIMEOUT';else finish('TIMEOUT');},Math.max(0,expires-performance.now()));
|
|
98
|
+
try{
|
|
99
|
+
if(!current())return;
|
|
100
|
+
ws=new (webSocket())('ws+unix://'+endpoint.path+':/',{
|
|
101
|
+
createConnection:()=>{
|
|
102
|
+
if(closing)throw new CodexObserverError(errorCode??'CANCELLED');
|
|
103
|
+
const before=live();if(before)throw new CodexObserverError(before);
|
|
104
|
+
if(this.endpoint().epoch!==endpoint.epoch)throw new CodexObserverError('SOCKET_CHANGED');
|
|
105
|
+
const after=live();if(after)throw new CodexObserverError(after);
|
|
106
|
+
raw=createConnection(endpoint.path);raw.on('error',()=>{});return raw;
|
|
107
|
+
},maxPayload:32768,perMessageDeflate:false,followRedirects:false,handshakeTimeout:this.timeout,
|
|
108
|
+
});
|
|
109
|
+
ws.on('open',()=>{
|
|
110
|
+
if(closing||!current())return;
|
|
111
|
+
try{ws!.send(JSON.stringify({id,method:'initialize',params:{clientInfo:{name:'agent_fleet_contract_observer',title:'Fleet contract observer',version:'1'},capabilities:{experimentalApi:false}}}));}
|
|
112
|
+
catch{finish('INITIALIZE_FAILED');}
|
|
113
|
+
});
|
|
114
|
+
ws.on('message',(data:Buffer,isBinary:boolean)=>{
|
|
115
|
+
if(closing||!current())return;
|
|
116
|
+
if(++messages>256||!Buffer.isBuffer(data)||data.length>32768){finish('RESPONSE_LIMIT');return;}
|
|
117
|
+
if(isBinary){finish('INVALID_RESPONSE');return;}
|
|
118
|
+
let packet:unknown;try{packet=JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(data));}catch{finish('INVALID_JSON');return;}
|
|
119
|
+
if(!packet||typeof packet!=='object'||Array.isArray(packet)){finish('INVALID_RESPONSE');return;}
|
|
120
|
+
const p=packet as Record<string,unknown>;
|
|
121
|
+
// Ignore notifications and server requests, even if their id matches ours.
|
|
122
|
+
// Never send initialized, approvals, thread reads, queue calls or replies.
|
|
123
|
+
if(Object.hasOwn(p,'method')||p.id!==id)return;
|
|
124
|
+
const body=p.result;
|
|
125
|
+
if(Object.hasOwn(p,'error')||!body||typeof body!=='object'||Array.isArray(body)){finish('INITIALIZE_REJECTED');return;}
|
|
126
|
+
const ua=(body as {userAgent?:unknown}).userAgent;
|
|
127
|
+
if(typeof ua!=='string'||!ua||ua.length>4096||/[\u0000-\u001f\u007f]/.test(ua)){finish('INITIALIZE_REJECTED');return;}
|
|
128
|
+
if(!current())return;
|
|
129
|
+
finish(undefined,{result:{userAgent:ua},socketEpoch:endpoint.epoch});
|
|
130
|
+
});
|
|
131
|
+
ws.on('error',(error:unknown)=>{if(!closing)finish(error instanceof CodexObserverError?error.code:'CONNECTION_ERROR');});
|
|
132
|
+
ws.on('close',()=>{if(!closing)finish('CONNECTION_CLOSED');});
|
|
133
|
+
if(signal.aborted)abort();
|
|
134
|
+
}catch(error){finish(error instanceof CodexObserverError?error.code:'CONNECTION_ERROR');}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {constants,lstatSync,type BigIntStats} from 'node:fs';
|
|
2
|
+
import {lstat,open,opendir,readlink,realpath} from 'node:fs/promises';
|
|
3
|
+
import {dirname,join,resolve} from 'node:path';
|
|
4
|
+
import {compareCodexVersions} from '../../../harnesses/lib/codex-compat.ts';
|
|
5
|
+
import {canonicalPrivatePath,privateDirectory} from './codex-bootstrap-files.ts';
|
|
6
|
+
|
|
7
|
+
export type AutomaticDesktopData={desktopPid:number;desktopVersion:string;socketPath:string;codexHome:string;binaryPath?:string};
|
|
8
|
+
export type DesktopPackageEvidence={version:string;path:string;fileIdentity:string};
|
|
9
|
+
export type DesktopDiscoveryOptions={codexHome:string;procRoot?:string;desktopExecutable?:string;socketRoot?:string;platform?:string};
|
|
10
|
+
const stamp=(s:BigIntStats)=>[s.dev,s.ino,s.uid,s.mode,s.nlink,s.size,s.mtimeNs,s.ctimeNs].join(':');
|
|
11
|
+
const fail=(code:string):never=>{throw Error('desktop_discovery_'+code);};
|
|
12
|
+
function check(signal:AbortSignal,until:number){if(signal.aborted)fail('cancelled');if(performance.now()>=until)fail('overdue');}
|
|
13
|
+
function safeStat(s:BigIntStats,executable=false){const uid=BigInt(process.getuid!());return s.isFile()&&!s.isSymbolicLink()&&(s.uid===uid||s.uid===0n)&&(s.mode&0o6022n)===0n&&s.nlink===1n&&(!executable||(s.mode&0o111n)!==0n);}
|
|
14
|
+
async function ancestors(path:string){
|
|
15
|
+
for(let p=path;;p=dirname(p)){const s=await lstat(p);if(!s.isDirectory()||s.isSymbolicLink()||(s.uid!==0&&s.uid!==process.getuid?.())||((s.mode&0o022)!==0&&!(s.uid===0&&(s.mode&0o1000)!==0)))fail('unsafe_parent');if(p===dirname(p))break;}
|
|
16
|
+
}
|
|
17
|
+
function ancestorsNow(path:string){
|
|
18
|
+
for(let p=path;;p=dirname(p)){const s=lstatSync(p);if(!s.isDirectory()||s.isSymbolicLink()||(s.uid!==0&&s.uid!==process.getuid?.())||((s.mode&0o022)!==0&&!(s.uid===0&&(s.mode&0o1000)!==0)))return false;if(p===dirname(p))return true;}
|
|
19
|
+
}
|
|
20
|
+
async function small(path:string,max:number,signal:AbortSignal,until:number){
|
|
21
|
+
check(signal,until);const f=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW|constants.O_NONBLOCK);
|
|
22
|
+
try{const bytes=Buffer.alloc(max+1);let size=0;while(size<bytes.length){check(signal,until);const r=await f.read(bytes,size,bytes.length-size,null);if(!r.bytesRead)break;size+=r.bytesRead;}check(signal,until);if(size>max)fail('limit');return bytes.subarray(0,size);}finally{await f.close();}
|
|
23
|
+
}
|
|
24
|
+
/** Read only the bounded ASAR header and package.json from the selected Desktop's
|
|
25
|
+
* installation. Never substitute SDK/UA/CLI claims for the real Desktop version. */
|
|
26
|
+
export async function readDesktopPackageVersion(executable:string,signal:AbortSignal):Promise<DesktopPackageEvidence>{
|
|
27
|
+
if(!canonicalPrivatePath(executable)||typeof process.getuid!=='function')fail('unsupported');
|
|
28
|
+
const path=join(dirname(executable),'resources','app.asar'),until=performance.now()+2000;await ancestors(dirname(path));check(signal,until);
|
|
29
|
+
const before=await lstat(path,{bigint:true});if(!safeStat(before)||before.size<16n||before.size>2147483648n)fail('package_unsafe');
|
|
30
|
+
const f=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW|constants.O_NONBLOCK);
|
|
31
|
+
try{
|
|
32
|
+
if(stamp(await f.stat({bigint:true}))!==stamp(before))fail('package_changed');
|
|
33
|
+
const read=async(size:number,offset:number)=>{const b=Buffer.alloc(size);let n=0;while(n<size){check(signal,until);const r=await f.read(b,n,size-n,offset+n);if(!r.bytesRead)fail('package_invalid');n+=r.bytesRead;}return b;};
|
|
34
|
+
const prefix=await read(8,0),size=prefix.readUInt32LE(4);if(prefix.readUInt32LE(0)!==4||size<8||size>8*1024*1024||8+size>Number(before.size))fail('package_invalid');
|
|
35
|
+
const header=await read(size,8),length=header.readUInt32LE(4);if(length<2||length>size-8)fail('package_invalid');
|
|
36
|
+
let entry:any;try{entry=JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(header.subarray(8,8+length)))?.files?.['package.json'];}catch{fail('package_invalid');}
|
|
37
|
+
if(!entry||entry.unpacked||typeof entry.offset!=='string'||!/^\d{1,12}$/.test(entry.offset)||!Number.isInteger(entry.size)||entry.size<2||entry.size>65536)fail('package_invalid');
|
|
38
|
+
const at=8+size+Number(entry.offset);if(!Number.isSafeInteger(at)||at+entry.size>Number(before.size))fail('package_invalid');
|
|
39
|
+
let pkg:any;try{pkg=JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(await read(entry.size,at)));}catch{fail('package_invalid');}
|
|
40
|
+
if(pkg?.name!=='openai-codex-electron'||typeof pkg.version!=='string'||pkg.version.length>256||compareCodexVersions(pkg.version,pkg.version)!==0)fail('package_version');
|
|
41
|
+
if(stamp(await f.stat({bigint:true}))!==stamp(before)||stamp(await lstat(path,{bigint:true}))!==stamp(before))fail('package_changed');check(signal,until);
|
|
42
|
+
return {version:pkg.version,path,fileIdentity:stamp(before)};
|
|
43
|
+
}finally{await f.close();}
|
|
44
|
+
}
|
|
45
|
+
export function desktopPackageCurrent(evidence:DesktopPackageEvidence){try{return ancestorsNow(dirname(evidence.path))&&stamp(lstatSync(evidence.path,{bigint:true}))===evidence.fileIdentity;}catch{return false;}}
|
|
46
|
+
/** Trusted server composition only. No tool arguments, shell, process starts,
|
|
47
|
+
* auth/profile reads, file repair, queue writes or default selection by recency. */
|
|
48
|
+
export class AutomaticDesktopDiscovery {
|
|
49
|
+
private readonly options:DesktopDiscoveryOptions;
|
|
50
|
+
constructor(options:DesktopDiscoveryOptions){this.options={...options};}
|
|
51
|
+
async discover(signal:AbortSignal):Promise<AutomaticDesktopData>{
|
|
52
|
+
try{return await this.#discover(signal);}catch(e){
|
|
53
|
+
if(e instanceof Error&&/^desktop_discovery_[a-z_]{1,64}$/.test(e.message))throw e;
|
|
54
|
+
const code=(e as NodeJS.ErrnoException)?.code;return fail(code==='ENOENT'?'unavailable':code==='EACCES'||code==='EPERM'?'io_denied':'failed');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async #discover(signal:AbortSignal):Promise<AutomaticDesktopData>{
|
|
58
|
+
if((this.options.platform??process.platform)!=='linux'||typeof process.getuid!=='function')fail('unsupported');
|
|
59
|
+
const uid=process.getuid!(),proc=this.options.procRoot??'/proc',exe=this.options.desktopExecutable??'/usr/lib/chatgpt/ChatGPT',home=this.options.codexHome,root=this.options.socketRoot??'/tmp/codex-daemon-'+uid,until=performance.now()+5000;
|
|
60
|
+
if(![proc,exe,home,root].every(canonicalPrivatePath))fail('options');check(signal,until);await ancestors(dirname(exe));
|
|
61
|
+
const desktop=await lstat(exe,{bigint:true});if(!safeStat(desktop,true))fail('executable_unsafe');
|
|
62
|
+
const pids:number[]=[],dir=await opendir(proc);let count=0;
|
|
63
|
+
try{for await(const d of dir){check(signal,until);if(++count>16384)fail('limit');if(!/^\d{1,10}$/.test(d.name))continue;
|
|
64
|
+
const path=join(proc,d.name);try{const owner=await lstat(path);if(!owner.isDirectory()||owner.isSymbolicLink()||owner.uid!==uid)continue;
|
|
65
|
+
if((await small(join(path,'comm'),256,signal,until)).toString('utf8').trim()!=='ChatGPT')continue;
|
|
66
|
+
const command=await small(join(path,'cmdline'),16384,signal,until);if(command.includes('--type=')||await readlink(join(path,'exe'))!==exe)continue;pids.push(Number(d.name));
|
|
67
|
+
}catch(e){if((e as NodeJS.ErrnoException).code==='ENOENT'||(e as NodeJS.ErrnoException).code==='ESRCH')continue;throw e;}
|
|
68
|
+
}}finally{try{await dir.close();}catch{}}
|
|
69
|
+
if(pids.length!==1)fail(pids.length?'process_ambiguous':'process_unavailable');
|
|
70
|
+
const pkg=await readDesktopPackageVersion(exe,signal);check(signal,until);await ancestors(home);const homeStat=await lstat(home);if(homeStat.uid!==uid)fail('home_unsafe');
|
|
71
|
+
await privateDirectory(root);const unix=(await small(join(proc,'net','unix'),1024*1024,signal,until)).toString('utf8');
|
|
72
|
+
const listening=new Set(unix.split('\n').flatMap(line=>{const p=line.trim().split(/\s+/);return p.length===8&&(parseInt(p[3],16)&0x10000)!==0&&p[4]==='0001'?[p[7]]:[];}));
|
|
73
|
+
const sockets:string[]=[],entries=await opendir(root);count=0;
|
|
74
|
+
try{for await(const d of entries){check(signal,until);if(++count>64)fail('limit');if(!/^[a-f0-9]{64}$/.test(d.name))continue;const path=join(root,d.name),s=await lstat(path);if(s.isSocket()&&s.uid===uid&&(s.mode&0o077)===0&&listening.has(path))sockets.push(path);}}finally{try{await entries.close();}catch{}}
|
|
75
|
+
// The official managed endpoint belongs to the configured Codex home. Keep
|
|
76
|
+
// its checked one-hop alias so the existing RPC pin also detects retargeting.
|
|
77
|
+
const alias=join(home,'app-server-control','app-server-control.sock');let socketPath:string|undefined,aliasSeen=false;
|
|
78
|
+
try{const at=await lstat(alias);aliasSeen=true;if(at.uid!==uid||!at.isSymbolicLink()||alias.length>100)fail('daemon_alias_unsafe');await privateDirectory(dirname(alias));const target=resolve(dirname(alias),await readlink(alias));if(!sockets.includes(target))fail('daemon_alias_unsafe');socketPath=alias;}
|
|
79
|
+
catch(e){if(aliasSeen)throw e;if((e as NodeJS.ErrnoException).code!=='ENOENT')throw e;}
|
|
80
|
+
if(!socketPath){if(sockets.length!==1)fail(sockets.length?'daemon_ambiguous':'daemon_unavailable');socketPath=sockets[0];}
|
|
81
|
+
let binaryPath:string|undefined;try{binaryPath=await realpath(join(home,'packages','standalone','current','bin','codex'));const releases=join(home,'packages','standalone','releases');if(!binaryPath.startsWith(releases+'/'))fail('binary_unsafe');await ancestors(dirname(binaryPath));const s=await lstat(binaryPath,{bigint:true});if(!safeStat(s,true))fail('binary_unsafe');}catch(e){if((e as NodeJS.ErrnoException).code!=='ENOENT')throw e;}
|
|
82
|
+
check(signal,until);return {desktopPid:pids[0],desktopVersion:pkg.version,socketPath,codexHome:home,...(binaryPath?{binaryPath}:{})};
|
|
83
|
+
}
|
|
84
|
+
}
|