harnery 0.40.0 → 0.42.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/README.md +1 -1
- package/dist/commander.js +4 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +34 -20
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +113 -12
- package/dist/commands/browse-ai.d.ts.map +1 -1
- package/dist/commands/browse-ai.js +4 -0
- package/dist/commands/browse.d.ts +164 -0
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +388 -45
- package/dist/commands/checkpoint.js +8 -12
- package/dist/commands/claude-desktop.d.ts.map +1 -1
- package/dist/commands/claude-desktop.js +52 -0
- package/dist/commands/deinit.d.ts +1 -1
- package/dist/commands/deinit.d.ts.map +1 -1
- package/dist/commands/deinit.js +8 -4
- package/dist/commands/disk.d.ts +6 -0
- package/dist/commands/disk.d.ts.map +1 -0
- package/dist/commands/disk.js +80 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +2 -0
- package/dist/commands/doctor.d.ts +8 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +58 -3
- package/dist/commands/fetch.d.ts.map +1 -1
- package/dist/commands/fetch.js +10 -0
- package/dist/commands/files.d.ts +16 -0
- package/dist/commands/files.d.ts.map +1 -1
- package/dist/commands/files.js +54 -2
- package/dist/commands/init.d.ts +21 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +271 -109
- package/dist/commands/instructions.js +5 -4
- package/dist/commands/ledger-v3.d.ts.map +1 -1
- package/dist/commands/ledger-v3.js +2 -1
- package/dist/commands/rm.d.ts +4 -0
- package/dist/commands/rm.d.ts.map +1 -0
- package/dist/commands/rm.js +87 -0
- package/dist/commands/servers.d.ts +7 -0
- package/dist/commands/servers.d.ts.map +1 -0
- package/dist/commands/servers.js +394 -0
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +82 -2
- package/dist/commands/webview.d.ts +4 -0
- package/dist/commands/webview.d.ts.map +1 -0
- package/dist/commands/webview.js +94 -0
- package/dist/core/adapter.d.ts +50 -1
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +59 -1
- package/dist/core/adapters/attestation.d.ts.map +1 -1
- package/dist/core/adapters/attestation.js +3 -2
- package/dist/core/adapters/profiles.d.ts +29 -3
- package/dist/core/adapters/profiles.d.ts.map +1 -1
- package/dist/core/adapters/profiles.js +53 -1
- package/dist/core/adapters/registry.d.ts.map +1 -1
- package/dist/core/adapters/registry.js +33 -0
- package/dist/core/adapters/types.d.ts +9 -0
- package/dist/core/adapters/types.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.d.ts +1 -1
- package/dist/core/agents/canonical-emit.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.js +2 -7
- package/dist/core/agents/cli.js +25 -16
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +7 -2
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +2 -0
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/claim-conflict.js +3 -9
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/commit-conflict.js +2 -8
- package/dist/core/agents/rules/stop-hook.d.ts +2 -0
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +1 -1
- package/dist/core/agents/session-events.d.ts +6 -2
- package/dist/core/agents/session-events.d.ts.map +1 -1
- package/dist/core/agents/session-events.js +105 -26
- package/dist/core/agents/session-finalization-state-v3.d.ts.map +1 -1
- package/dist/core/agents/session-finalization-state-v3.js +2 -1
- package/dist/core/agents/session-finalizer-v3.d.ts.map +1 -1
- package/dist/core/agents/session-finalizer-v3.js +5 -4
- package/dist/core/agents/session-name-display.d.ts +28 -0
- package/dist/core/agents/session-name-display.d.ts.map +1 -1
- package/dist/core/agents/session-name-display.js +43 -0
- package/dist/core/agents/state/heartbeat-reader.d.ts +7 -0
- package/dist/core/agents/state/heartbeat-reader.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.d.ts +10 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +21 -2
- package/dist/core/agents/state/live-coordination-view.d.ts +20 -0
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.js +61 -0
- package/dist/core/agents/state/live-coordination-writer.js +3 -0
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +2 -10
- package/dist/core/agents/turn-changes.d.ts +17 -0
- package/dist/core/agents/turn-changes.d.ts.map +1 -0
- package/dist/core/agents/turn-changes.js +76 -0
- package/dist/core/artifacts/delivery-card.d.ts.map +1 -1
- package/dist/core/artifacts/delivery-card.js +11 -3
- package/dist/core/artifacts/index.d.ts +140 -4
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +526 -52
- package/dist/core/config.d.ts +73 -11
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +142 -3
- package/dist/core/context/index.d.ts.map +1 -1
- package/dist/core/context/index.js +2 -1
- package/dist/core/conversations/archive.d.ts.map +1 -1
- package/dist/core/conversations/archive.js +4 -3
- package/dist/core/diagnostics/bundle.d.ts.map +1 -1
- package/dist/core/diagnostics/bundle.js +5 -4
- package/dist/core/events/legacy-storage/canary.d.ts.map +1 -1
- package/dist/core/events/legacy-storage/canary.js +5 -4
- package/dist/core/events/legacy-storage/compression.d.ts.map +1 -1
- package/dist/core/events/legacy-storage/compression.js +2 -1
- package/dist/core/events/v3/adapter-id.d.ts +10 -2
- package/dist/core/events/v3/adapter-id.d.ts.map +1 -1
- package/dist/core/events/v3/adapter-id.js +16 -0
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +2 -1
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -1
- package/dist/core/events/v3/bootstrap.js +5 -4
- package/dist/core/events/v3/capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/capabilities.js +17 -0
- package/dist/core/events/v3/contract.d.ts +5 -0
- package/dist/core/events/v3/contract.d.ts.map +1 -1
- package/dist/core/events/v3/contract.js +7 -1
- package/dist/core/events/v3/control-witness.d.ts.map +1 -1
- package/dist/core/events/v3/control-witness.js +3 -2
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts.map +1 -1
- package/dist/core/events/v3/coordination-transaction-recovery.js +4 -3
- package/dist/core/events/v3/fingerprint-keys.d.ts.map +1 -1
- package/dist/core/events/v3/fingerprint-keys.js +7 -6
- package/dist/core/events/v3/generated.d.ts +1 -1
- package/dist/core/events/v3/generated.js +1 -1
- package/dist/core/events/v3/live-feed.d.ts.map +1 -1
- package/dist/core/events/v3/live-feed.js +5 -4
- package/dist/core/events/v3/producers/command-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/command-recorder.js +8 -7
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +8 -7
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts.map +1 -1
- package/dist/core/events/v3/producers/diagnostic-summaries.js +5 -4
- package/dist/core/events/v3/producers/hook-base.d.ts +1 -0
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook-base.js +10 -4
- package/dist/core/events/v3/producers/hook.d.ts +2 -0
- package/dist/core/events/v3/producers/hook.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook.js +16 -1
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -1
- package/dist/core/events/v3/producers/intake.js +16 -6
- package/dist/core/events/v3/producers/recorder.d.ts +2 -4
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +125 -101
- package/dist/core/events/v3/projection.js +9 -1
- package/dist/core/events/v3/recovery.d.ts.map +1 -1
- package/dist/core/events/v3/recovery.js +4 -3
- package/dist/core/events/v3/support-storage/inventory.d.ts.map +1 -1
- package/dist/core/events/v3/support-storage/inventory.js +2 -1
- package/dist/core/events/v3/support-storage/maintenance.d.ts.map +1 -1
- package/dist/core/events/v3/support-storage/maintenance.js +4 -3
- package/dist/core/events/v3/support-storage/pack-reader.d.ts.map +1 -1
- package/dist/core/events/v3/support-storage/pack-reader.js +4 -3
- package/dist/core/events/v3/support-storage/pack-writer.d.ts.map +1 -1
- package/dist/core/events/v3/support-storage/pack-writer.js +6 -5
- package/dist/core/events/v3/tool-line-changes.d.ts +8 -0
- package/dist/core/events/v3/tool-line-changes.d.ts.map +1 -0
- package/dist/core/events/v3/tool-line-changes.js +135 -0
- package/dist/core/events/v3/writer.d.ts.map +1 -1
- package/dist/core/events/v3/writer.js +8 -7
- package/dist/core/governor/planning.d.ts.map +1 -1
- package/dist/core/governor/planning.js +6 -5
- package/dist/core/governor/service.d.ts.map +1 -1
- package/dist/core/governor/service.js +12 -11
- package/dist/core/governor/state.d.ts.map +1 -1
- package/dist/core/governor/state.js +7 -6
- package/dist/core/guard/evaluator.js +1 -0
- package/dist/core/guard/storage.d.ts.map +1 -1
- package/dist/core/guard/storage.js +3 -2
- package/dist/core/hooks/adapter/behaviors/claude-code.d.ts +4 -0
- package/dist/core/hooks/adapter/behaviors/claude-code.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/claude-code.js +31 -0
- package/dist/core/hooks/adapter/behaviors/codex.d.ts +15 -0
- package/dist/core/hooks/adapter/behaviors/codex.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/codex.js +82 -0
- package/dist/core/hooks/adapter/behaviors/cursor.d.ts +7 -0
- package/dist/core/hooks/adapter/behaviors/cursor.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/cursor.js +35 -0
- package/dist/core/hooks/adapter/behaviors/index.d.ts +11 -0
- package/dist/core/hooks/adapter/behaviors/index.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/index.js +20 -0
- package/dist/core/hooks/adapter/behaviors/openclaw.d.ts +7 -0
- package/dist/core/hooks/adapter/behaviors/openclaw.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/openclaw.js +34 -0
- package/dist/core/hooks/adapter/behaviors/opencode.d.ts +7 -0
- package/dist/core/hooks/adapter/behaviors/opencode.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/opencode.js +34 -0
- package/dist/core/hooks/adapter/behaviors/types.d.ts +89 -0
- package/dist/core/hooks/adapter/behaviors/types.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/types.js +1 -0
- package/dist/core/hooks/adapter/detect.d.ts +1 -1
- package/dist/core/hooks/adapter/detect.d.ts.map +1 -1
- package/dist/core/hooks/adapter/detect.js +2 -3
- package/dist/core/hooks/adapter/events.d.ts +46 -1
- package/dist/core/hooks/adapter/events.d.ts.map +1 -1
- package/dist/core/hooks/adapter/events.js +36 -0
- package/dist/core/hooks/adapter/opencode-plugin.d.ts +60 -0
- package/dist/core/hooks/adapter/opencode-plugin.d.ts.map +1 -0
- package/dist/core/hooks/adapter/opencode-plugin.js +129 -0
- package/dist/core/hooks/adapter/output.d.ts +7 -0
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +8 -1
- package/dist/core/hooks/adapter/runtime-telemetry.js +3 -1
- package/dist/core/hooks/adapter/wiring.d.ts +52 -8
- package/dist/core/hooks/adapter/wiring.d.ts.map +1 -1
- package/dist/core/hooks/adapter/wiring.js +133 -12
- package/dist/core/hooks/cli.js +676 -531
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +2 -1
- package/dist/core/hooks/prompt-context/contract.d.ts.map +1 -1
- package/dist/core/hooks/prompt-context/contract.js +1 -0
- package/dist/core/hooks/resolve/transcript.d.ts +1 -1
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +35 -4
- package/dist/core/hooks/run-markers.d.ts +37 -0
- package/dist/core/hooks/run-markers.d.ts.map +1 -0
- package/dist/core/hooks/run-markers.js +109 -0
- package/dist/core/hooks/session-name-presence.d.ts +3 -1
- package/dist/core/hooks/session-name-presence.d.ts.map +1 -1
- package/dist/core/hooks/session-name-presence.js +7 -2
- package/dist/core/hooks/shell-waiter.d.ts +2 -0
- package/dist/core/hooks/shell-waiter.d.ts.map +1 -0
- package/dist/core/hooks/shell-waiter.js +173 -0
- package/dist/core/resources/service.d.ts.map +1 -1
- package/dist/core/resources/service.js +5 -4
- package/dist/core/semantic/review.d.ts.map +1 -1
- package/dist/core/semantic/review.js +5 -4
- package/dist/core/semantic/service.d.ts.map +1 -1
- package/dist/core/semantic/service.js +15 -14
- package/dist/core/semantic/storage.d.ts.map +1 -1
- package/dist/core/semantic/storage.js +5 -4
- package/dist/core/servers/index.d.ts +211 -0
- package/dist/core/servers/index.d.ts.map +1 -0
- package/dist/core/servers/index.js +560 -0
- package/dist/core/servers/net.d.ts +58 -0
- package/dist/core/servers/net.d.ts.map +1 -0
- package/dist/core/servers/net.js +270 -0
- package/dist/core/servers/tunnels.d.ts +14 -0
- package/dist/core/servers/tunnels.d.ts.map +1 -0
- package/dist/core/servers/tunnels.js +33 -0
- package/dist/core/storage/atomic-json.d.ts.map +1 -1
- package/dist/core/storage/atomic-json.js +7 -3
- package/dist/core/storage/builtins.js +1 -0
- package/dist/core/storage/durable-history.d.ts.map +1 -1
- package/dist/core/storage/durable-history.js +6 -5
- package/dist/core/storage/maintenance-providers.d.ts.map +1 -1
- package/dist/core/storage/maintenance-providers.js +2 -1
- package/dist/core/storage/maintenance.d.ts.map +1 -1
- package/dist/core/storage/maintenance.js +7 -6
- package/dist/core/storage/metrics.d.ts.map +1 -1
- package/dist/core/storage/metrics.js +5 -1
- package/dist/core/storage/modes.d.ts +17 -0
- package/dist/core/storage/modes.d.ts.map +1 -0
- package/dist/core/storage/modes.js +47 -0
- package/dist/core/storage/process-log.d.ts.map +1 -1
- package/dist/core/storage/process-log.js +3 -2
- package/dist/core/storage/receipts.d.ts.map +1 -1
- package/dist/core/storage/receipts.js +4 -3
- package/dist/core/storage/segments.d.ts.map +1 -1
- package/dist/core/storage/segments.js +7 -6
- package/dist/core/supervisor/hook-health.d.ts +2 -1
- package/dist/core/supervisor/hook-health.d.ts.map +1 -1
- package/dist/core/supervisor/hook-health.js +4 -3
- package/dist/core/supervisor/service.d.ts.map +1 -1
- package/dist/core/supervisor/service.js +7 -6
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +8 -7
- package/dist/core/workflow/adapters.d.ts +7 -0
- package/dist/core/workflow/adapters.d.ts.map +1 -1
- package/dist/core/workflow/adapters.js +9 -0
- package/dist/core/workflow/approvals.d.ts.map +1 -1
- package/dist/core/workflow/approvals.js +6 -5
- package/dist/core/workflow/billing.d.ts.map +1 -1
- package/dist/core/workflow/billing.js +33 -4
- package/dist/core/workflow/durable-record.d.ts.map +1 -1
- package/dist/core/workflow/durable-record.js +4 -3
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +30 -1
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +2 -3
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +3 -2
- package/dist/core/workflow/sandbox-projection.d.ts +13 -2
- package/dist/core/workflow/sandbox-projection.d.ts.map +1 -1
- package/dist/core/workflow/sandbox-projection.js +23 -0
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +6 -1
- package/dist/core/workflow/spawn-codex.d.ts +2 -0
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +20 -1
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +6 -1
- package/dist/core/workflow/spawn-opencode.d.ts +36 -0
- package/dist/core/workflow/spawn-opencode.d.ts.map +1 -0
- package/dist/core/workflow/spawn-opencode.js +135 -0
- package/dist/core/workflow/transcript.d.ts.map +1 -1
- package/dist/core/workflow/transcript.js +3 -2
- package/dist/core/workflow/types.d.ts +47 -2
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/worker-access.d.ts +92 -0
- package/dist/core/workflow/worker-access.d.ts.map +1 -0
- package/dist/core/workflow/worker-access.js +450 -0
- package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.js +5 -4
- package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/local-git.js +3 -2
- package/dist/core/workflow/workspaces/paths.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/paths.js +2 -1
- package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/state.js +10 -9
- package/dist/lazy-commands.js +8 -1
- package/dist/lib/agent-browser/client.d.ts +9 -0
- package/dist/lib/agent-browser/client.d.ts.map +1 -1
- package/dist/lib/agent-browser/client.js +13 -0
- package/dist/lib/browser/batch-steps.d.ts +18 -0
- package/dist/lib/browser/batch-steps.d.ts.map +1 -0
- package/dist/lib/browser/batch-steps.js +82 -0
- package/dist/lib/browser/client.d.ts +35 -1
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +117 -8
- package/dist/lib/browser/collect/collector.d.ts +99 -0
- package/dist/lib/browser/collect/collector.d.ts.map +1 -0
- package/dist/lib/browser/collect/collector.js +202 -0
- package/dist/lib/browser/collect/fields.d.ts +31 -0
- package/dist/lib/browser/collect/fields.d.ts.map +1 -0
- package/dist/lib/browser/collect/fields.js +75 -0
- package/dist/lib/browser/collect/index.d.ts +6 -0
- package/dist/lib/browser/collect/index.d.ts.map +1 -0
- package/dist/lib/browser/collect/index.js +5 -0
- package/dist/lib/browser/collect/page-driver.d.ts +14 -0
- package/dist/lib/browser/collect/page-driver.d.ts.map +1 -0
- package/dist/lib/browser/collect/page-driver.js +306 -0
- package/dist/lib/browser/collect/presets.d.ts +52 -0
- package/dist/lib/browser/collect/presets.d.ts.map +1 -0
- package/dist/lib/browser/collect/presets.js +176 -0
- package/dist/lib/browser/collect/scroll-plan.d.ts +85 -0
- package/dist/lib/browser/collect/scroll-plan.d.ts.map +1 -0
- package/dist/lib/browser/collect/scroll-plan.js +118 -0
- package/dist/lib/browser/identity.d.ts +25 -0
- package/dist/lib/browser/identity.d.ts.map +1 -0
- package/dist/lib/browser/identity.js +66 -0
- package/dist/lib/browser/index.d.ts +3 -2
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -1
- package/dist/lib/browser/launch-args.d.ts +26 -0
- package/dist/lib/browser/launch-args.d.ts.map +1 -1
- package/dist/lib/browser/launch-args.js +41 -1
- package/dist/lib/browser/page-review-judge.d.ts +2 -0
- package/dist/lib/browser/page-review-judge.d.ts.map +1 -1
- package/dist/lib/browser/page-review-judge.js +13 -0
- package/dist/lib/browser/qa-run-contracts.d.ts +10 -0
- package/dist/lib/browser/qa-run-contracts.d.ts.map +1 -1
- package/dist/lib/browser/qa-run.d.ts.map +1 -1
- package/dist/lib/browser/qa-run.js +1 -0
- package/dist/lib/browser/user-agent.d.ts +53 -0
- package/dist/lib/browser/user-agent.d.ts.map +1 -0
- package/dist/lib/browser/user-agent.js +79 -0
- package/dist/lib/browser/windows-chrome.d.ts +59 -0
- package/dist/lib/browser/windows-chrome.d.ts.map +1 -0
- package/dist/lib/browser/windows-chrome.js +179 -0
- package/dist/lib/claude-desktop-share.d.ts +136 -0
- package/dist/lib/claude-desktop-share.d.ts.map +1 -0
- package/dist/lib/claude-desktop-share.js +394 -0
- package/dist/lib/disk-usage.d.ts +50 -0
- package/dist/lib/disk-usage.d.ts.map +1 -0
- package/dist/lib/disk-usage.js +303 -0
- package/dist/lib/docs-lint.d.ts +6 -0
- package/dist/lib/docs-lint.d.ts.map +1 -1
- package/dist/lib/docs-lint.js +8 -3
- package/dist/lib/docs-metadata-managed.d.ts +1 -0
- package/dist/lib/docs-metadata-managed.d.ts.map +1 -1
- package/dist/lib/docs-metadata-managed.js +17 -1
- package/dist/lib/guarded-remove.d.ts +34 -0
- package/dist/lib/guarded-remove.d.ts.map +1 -0
- package/dist/lib/guarded-remove.js +310 -0
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +4 -9
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +2 -0
- package/dist/lib/instructions/templates.js +8 -8
- package/dist/lib/pace/index.d.ts +2 -0
- package/dist/lib/pace/index.d.ts.map +1 -0
- package/dist/lib/pace/index.js +1 -0
- package/dist/lib/pace/pace.d.ts +95 -0
- package/dist/lib/pace/pace.d.ts.map +1 -0
- package/dist/lib/pace/pace.js +313 -0
- package/dist/lib/tunnel/error-page.d.ts +1 -1
- package/dist/lib/tunnel/error-page.d.ts.map +1 -1
- package/dist/lib/tunnel/error-page.js +19 -8
- package/dist/lib/tunnel/forward-headers.d.ts +11 -0
- package/dist/lib/tunnel/forward-headers.d.ts.map +1 -0
- package/dist/lib/tunnel/forward-headers.js +17 -0
- package/dist/lib/tunnel/gate.js +34 -10
- package/dist/lib/tunnel/path-scope.d.ts +22 -0
- package/dist/lib/tunnel/path-scope.d.ts.map +1 -0
- package/dist/lib/tunnel/path-scope.js +62 -0
- package/dist/lib/tunnel/state.d.ts +5 -0
- package/dist/lib/tunnel/state.d.ts.map +1 -1
- package/dist/lib/tunnel/state.js +17 -3
- package/dist/lib/webview/index.d.ts +2 -0
- package/dist/lib/webview/index.d.ts.map +1 -0
- package/dist/lib/webview/index.js +1 -0
- package/dist/lib/webview/webview.d.ts +116 -0
- package/dist/lib/webview/webview.d.ts.map +1 -0
- package/dist/lib/webview/webview.js +289 -0
- package/opencode-plugin/package.json +19 -0
- package/opencode-plugin/src/index.ts +791 -0
- package/package.json +16 -4
- package/schemas/config.schema.json +104 -0
- package/schemas/event-v3.schema.json +164 -0
- package/src/commander.ts +26 -0
- package/src/commands/agents.ts +47 -18
- package/src/commands/artifacts.ts +171 -19
- package/src/commands/browse-ai.ts +8 -0
- package/src/commands/browse.ts +570 -48
- package/src/commands/checkpoint.ts +7 -9
- package/src/commands/claude-desktop.ts +61 -0
- package/src/commands/deinit.ts +9 -4
- package/src/commands/disk.ts +114 -0
- package/src/commands/docs.ts +2 -0
- package/src/commands/doctor.ts +63 -3
- package/src/commands/fetch.ts +14 -0
- package/src/commands/files.ts +93 -2
- package/src/commands/init.ts +334 -122
- package/src/commands/instructions.ts +8 -4
- package/src/commands/ledger-v3.ts +2 -1
- package/src/commands/rm.ts +115 -0
- package/src/commands/servers.ts +506 -0
- package/src/commands/tunnel.ts +102 -2
- package/src/commands/webview.ts +159 -0
- package/src/core/adapter.ts +102 -1
- package/src/core/adapters/attestation.ts +3 -2
- package/src/core/adapters/profiles.ts +63 -1
- package/src/core/adapters/registry.ts +37 -0
- package/src/core/adapters/types.ts +10 -0
- package/src/core/agents/canonical-emit.ts +2 -5
- package/src/core/agents/cli.ts +26 -17
- package/src/core/agents/coord-client.ts +9 -3
- package/src/core/agents/render/session-context.ts +1 -0
- package/src/core/agents/rules/claim-conflict.ts +3 -8
- package/src/core/agents/rules/commit-conflict.ts +2 -7
- package/src/core/agents/rules/stop-hook.ts +3 -1
- package/src/core/agents/session-events.ts +120 -26
- package/src/core/agents/session-finalization-state-v3.ts +2 -1
- package/src/core/agents/session-finalizer-v3.ts +5 -4
- package/src/core/agents/session-name-display.ts +48 -0
- package/src/core/agents/state/heartbeat-reader.ts +7 -0
- package/src/core/agents/state/heartbeat-writer.ts +24 -2
- package/src/core/agents/state/live-coordination-view.ts +74 -0
- package/src/core/agents/state/live-coordination-writer.ts +3 -0
- package/src/core/agents/state/stale-sweep.ts +2 -9
- package/src/core/agents/turn-changes.ts +97 -0
- package/src/core/artifacts/delivery-card.ts +12 -3
- package/src/core/artifacts/index.ts +701 -47
- package/src/core/config.ts +206 -4
- package/src/core/context/index.ts +2 -1
- package/src/core/conversations/archive.ts +4 -3
- package/src/core/diagnostics/bundle.ts +5 -3
- package/src/core/events/legacy-storage/canary.ts +5 -4
- package/src/core/events/legacy-storage/compression.ts +2 -1
- package/src/core/events/v3/adapter-id.ts +29 -1
- package/src/core/events/v3/authority-outbox.ts +2 -1
- package/src/core/events/v3/bootstrap.ts +5 -4
- package/src/core/events/v3/capabilities.ts +17 -0
- package/src/core/events/v3/contract.ts +9 -1
- package/src/core/events/v3/control-witness.ts +3 -2
- package/src/core/events/v3/coordination-transaction-recovery.ts +4 -3
- package/src/core/events/v3/fingerprint-keys.ts +7 -6
- package/src/core/events/v3/generated.ts +1 -1
- package/src/core/events/v3/live-feed.ts +5 -4
- package/src/core/events/v3/producers/command-recorder.ts +8 -6
- package/src/core/events/v3/producers/coordination-recorder.ts +8 -7
- package/src/core/events/v3/producers/diagnostic-summaries.ts +5 -4
- package/src/core/events/v3/producers/hook-base.ts +11 -4
- package/src/core/events/v3/producers/hook.ts +19 -1
- package/src/core/events/v3/producers/intake.ts +18 -6
- package/src/core/events/v3/producers/recorder.ts +139 -114
- package/src/core/events/v3/projection.ts +11 -1
- package/src/core/events/v3/recovery.ts +4 -3
- package/src/core/events/v3/support-storage/inventory.ts +2 -1
- package/src/core/events/v3/support-storage/maintenance.ts +8 -3
- package/src/core/events/v3/support-storage/pack-reader.ts +4 -3
- package/src/core/events/v3/support-storage/pack-writer.ts +6 -5
- package/src/core/events/v3/tool-line-changes.ts +139 -0
- package/src/core/events/v3/writer.ts +8 -7
- package/src/core/governor/planning.ts +6 -5
- package/src/core/governor/service.ts +12 -11
- package/src/core/governor/state.ts +7 -6
- package/src/core/guard/evaluator.ts +1 -0
- package/src/core/guard/storage.ts +3 -2
- package/src/core/hooks/adapter/behaviors/claude-code.ts +33 -0
- package/src/core/hooks/adapter/behaviors/codex.ts +96 -0
- package/src/core/hooks/adapter/behaviors/cursor.ts +37 -0
- package/src/core/hooks/adapter/behaviors/index.ts +31 -0
- package/src/core/hooks/adapter/behaviors/openclaw.ts +36 -0
- package/src/core/hooks/adapter/behaviors/opencode.ts +36 -0
- package/src/core/hooks/adapter/behaviors/types.ts +110 -0
- package/src/core/hooks/adapter/detect.ts +2 -3
- package/src/core/hooks/adapter/events.ts +72 -1
- package/src/core/hooks/adapter/opencode-plugin.ts +177 -0
- package/src/core/hooks/adapter/output.ts +8 -1
- package/src/core/hooks/adapter/runtime-telemetry.ts +3 -1
- package/src/core/hooks/adapter/wiring.ts +198 -16
- package/src/core/hooks/cli.ts +776 -539
- package/src/core/hooks/effects/image-capture.ts +2 -1
- package/src/core/hooks/prompt-context/contract.ts +1 -0
- package/src/core/hooks/resolve/transcript.ts +42 -5
- package/src/core/hooks/run-markers.ts +132 -0
- package/src/core/hooks/session-name-presence.ts +10 -3
- package/src/core/hooks/shell-waiter.ts +166 -0
- package/src/core/resources/service.ts +5 -4
- package/src/core/semantic/review.ts +5 -4
- package/src/core/semantic/service.ts +15 -14
- package/src/core/semantic/storage.ts +5 -4
- package/src/core/servers/index.ts +712 -0
- package/src/core/servers/net.ts +283 -0
- package/src/core/servers/tunnels.ts +39 -0
- package/src/core/storage/atomic-json.ts +7 -3
- package/src/core/storage/builtins.ts +1 -0
- package/src/core/storage/durable-history.ts +6 -5
- package/src/core/storage/maintenance-providers.ts +2 -1
- package/src/core/storage/maintenance.ts +7 -6
- package/src/core/storage/metrics.ts +5 -1
- package/src/core/storage/modes.ts +53 -0
- package/src/core/storage/process-log.ts +3 -2
- package/src/core/storage/receipts.ts +4 -3
- package/src/core/storage/segments.ts +7 -6
- package/src/core/supervisor/hook-health.ts +4 -4
- package/src/core/supervisor/service.ts +7 -6
- package/src/core/work/state.ts +8 -7
- package/src/core/workflow/adapters.ts +15 -0
- package/src/core/workflow/approvals.ts +6 -5
- package/src/core/workflow/billing.ts +34 -4
- package/src/core/workflow/durable-record.ts +4 -3
- package/src/core/workflow/engine.ts +38 -1
- package/src/core/workflow/live-session-v3.ts +2 -3
- package/src/core/workflow/run-state.ts +3 -2
- package/src/core/workflow/sandbox-projection.ts +38 -2
- package/src/core/workflow/spawn-claude.ts +5 -1
- package/src/core/workflow/spawn-codex.ts +18 -1
- package/src/core/workflow/spawn-cursor.ts +5 -1
- package/src/core/workflow/spawn-opencode.ts +153 -0
- package/src/core/workflow/transcript.ts +3 -2
- package/src/core/workflow/types.ts +62 -2
- package/src/core/workflow/worker-access.ts +525 -0
- package/src/core/workflow/workspaces/leases.ts +5 -4
- package/src/core/workflow/workspaces/local-git.ts +3 -2
- package/src/core/workflow/workspaces/paths.ts +2 -1
- package/src/core/workflow/workspaces/state.ts +10 -9
- package/src/lazy-commands.ts +11 -1
- package/src/lib/agent-browser/client.ts +18 -0
- package/src/lib/browser/batch-steps.ts +79 -0
- package/src/lib/browser/client.ts +147 -9
- package/src/lib/browser/collect/collector.ts +306 -0
- package/src/lib/browser/collect/fields.ts +87 -0
- package/src/lib/browser/collect/index.ts +47 -0
- package/src/lib/browser/collect/page-driver.ts +327 -0
- package/src/lib/browser/collect/presets.ts +237 -0
- package/src/lib/browser/collect/scroll-plan.ts +179 -0
- package/src/lib/browser/identity.ts +64 -0
- package/src/lib/browser/index.ts +16 -1
- package/src/lib/browser/launch-args.ts +53 -1
- package/src/lib/browser/page-review-judge.ts +16 -0
- package/src/lib/browser/qa-run-contracts.ts +11 -0
- package/src/lib/browser/qa-run.ts +1 -0
- package/src/lib/browser/user-agent.ts +130 -0
- package/src/lib/browser/windows-chrome.ts +227 -0
- package/src/lib/claude-desktop-share.ts +511 -0
- package/src/lib/disk-usage.ts +347 -0
- package/src/lib/docs-lint.ts +8 -3
- package/src/lib/docs-metadata-managed.ts +21 -0
- package/src/lib/guarded-remove.ts +376 -0
- package/src/lib/identities/assume.ts +7 -7
- package/src/lib/instructions/apply.ts +2 -0
- package/src/lib/instructions/templates.ts +8 -8
- package/src/lib/pace/index.ts +14 -0
- package/src/lib/pace/pace.ts +370 -0
- package/src/lib/tunnel/error-page.ts +25 -9
- package/src/lib/tunnel/forward-headers.ts +16 -0
- package/src/lib/tunnel/gate.ts +39 -10
- package/src/lib/tunnel/path-scope.ts +73 -0
- package/src/lib/tunnel/state.ts +20 -3
- package/src/lib/webview/index.ts +13 -0
- package/src/lib/webview/webview.ts +457 -0
|
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { constants, createReadStream } from "node:fs";
|
|
3
3
|
import { chmod, lstat, mkdir, open, readdir, readFile, realpath } from "node:fs/promises";
|
|
4
4
|
import { join, relative, resolve } from "node:path";
|
|
5
|
+
import { stateDirMode, stateFileMode } from "../../../storage/modes.ts";
|
|
5
6
|
import { canonicalJsonV3 } from "../canonical.ts";
|
|
6
7
|
import type { EventV3SupportInventoryEntry } from "./inventory.ts";
|
|
7
8
|
import { digestEventV3LogicalAuthority } from "./logical-authority.ts";
|
|
@@ -136,7 +137,7 @@ export async function planEventV3SupportTransaction(
|
|
|
136
137
|
};
|
|
137
138
|
const directory = transactionDirectory(input.transaction_root, transactionId);
|
|
138
139
|
try {
|
|
139
|
-
await mkdir(directory, { recursive: false, mode:
|
|
140
|
+
await mkdir(directory, { recursive: false, mode: stateDirMode() });
|
|
140
141
|
} catch (error) {
|
|
141
142
|
if ((error as NodeJS.ErrnoException).code !== "EEXIST") throw error;
|
|
142
143
|
const existing = await readEventV3SupportTransaction(input.transaction_root, transactionId);
|
|
@@ -145,7 +146,7 @@ export async function planEventV3SupportTransaction(
|
|
|
145
146
|
}
|
|
146
147
|
return existing;
|
|
147
148
|
}
|
|
148
|
-
await chmod(directory,
|
|
149
|
+
await chmod(directory, stateDirMode());
|
|
149
150
|
await publishState(directory, transaction);
|
|
150
151
|
return transaction;
|
|
151
152
|
}
|
|
@@ -427,7 +428,11 @@ async function publishState(
|
|
|
427
428
|
transaction: EventV3SupportMaintenanceTransaction,
|
|
428
429
|
): Promise<void> {
|
|
429
430
|
const path = join(directory, `state-${String(transaction.sequence).padStart(6, "0")}.json`);
|
|
430
|
-
const handle = await open(
|
|
431
|
+
const handle = await open(
|
|
432
|
+
path,
|
|
433
|
+
constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL,
|
|
434
|
+
stateFileMode(),
|
|
435
|
+
);
|
|
431
436
|
try {
|
|
432
437
|
await handle.writeFile(`${canonicalJsonV3(transaction)}\n`, "utf8");
|
|
433
438
|
await handle.sync();
|
|
@@ -4,6 +4,7 @@ import { lstat, mkdir, open, realpath, rm, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
5
5
|
import { StringDecoder } from "node:string_decoder";
|
|
6
6
|
import { createGunzip, createInflateRaw } from "node:zlib";
|
|
7
|
+
import { stateDirMode, stateFileMode } from "../../../storage/modes.ts";
|
|
7
8
|
import {
|
|
8
9
|
type EventV3LogicalAuthorityEntry,
|
|
9
10
|
type EventV3SupportPackManifest,
|
|
@@ -226,7 +227,7 @@ export async function unpackEventV3SupportPack(
|
|
|
226
227
|
} catch (error) {
|
|
227
228
|
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
|
228
229
|
}
|
|
229
|
-
await mkdir(target, { recursive: false, mode:
|
|
230
|
+
await mkdir(target, { recursive: false, mode: stateDirMode() });
|
|
230
231
|
let files = 0;
|
|
231
232
|
let bytes = 0;
|
|
232
233
|
try {
|
|
@@ -234,8 +235,8 @@ export async function unpackEventV3SupportPack(
|
|
|
234
235
|
const path = resolve(target, ...record.path.split("/"));
|
|
235
236
|
if (relative(target, path).startsWith(".."))
|
|
236
237
|
throw new Error("event_v3_support_unpack_path_escape");
|
|
237
|
-
await mkdir(dirname(path), { recursive: true, mode:
|
|
238
|
-
await writeFile(path, record.content, { flag: "wx", mode:
|
|
238
|
+
await mkdir(dirname(path), { recursive: true, mode: stateDirMode() });
|
|
239
|
+
await writeFile(path, record.content, { flag: "wx", mode: stateFileMode() });
|
|
239
240
|
files += 1;
|
|
240
241
|
bytes += record.bytes;
|
|
241
242
|
}
|
|
@@ -5,6 +5,7 @@ import { chmod, lstat, mkdir, open, realpath, rename, rm } from "node:fs/promise
|
|
|
5
5
|
import { basename, isAbsolute, join, relative, resolve } from "node:path";
|
|
6
6
|
import { pipeline } from "node:stream/promises";
|
|
7
7
|
import { createGzip } from "node:zlib";
|
|
8
|
+
import { stateDirMode, stateFileMode } from "../../../storage/modes.ts";
|
|
8
9
|
import { canonicalJsonV3 } from "../canonical.ts";
|
|
9
10
|
import {
|
|
10
11
|
EVENT_V3_SUPPORT_FAMILIES,
|
|
@@ -95,8 +96,8 @@ export async function writeEventV3SupportPack(
|
|
|
95
96
|
.slice(0, 32)}` as const;
|
|
96
97
|
|
|
97
98
|
const outputDirectory = resolve(input.output_directory);
|
|
98
|
-
await mkdir(outputDirectory, { recursive: true, mode:
|
|
99
|
-
await chmod(outputDirectory,
|
|
99
|
+
await mkdir(outputDirectory, { recursive: true, mode: stateDirMode() });
|
|
100
|
+
await chmod(outputDirectory, stateDirMode());
|
|
100
101
|
const payloadName = `${packId}.ndjson.gz`;
|
|
101
102
|
const payloadPath = join(outputDirectory, payloadName);
|
|
102
103
|
const manifestPath = join(outputDirectory, `${packId}.manifest.json`);
|
|
@@ -106,7 +107,7 @@ export async function writeEventV3SupportPack(
|
|
|
106
107
|
|
|
107
108
|
try {
|
|
108
109
|
await streamPayload(inspected, payloadPartial, authorityReal);
|
|
109
|
-
await chmod(payloadPartial,
|
|
110
|
+
await chmod(payloadPartial, stateFileMode());
|
|
110
111
|
await rename(payloadPartial, payloadPath);
|
|
111
112
|
const payload = await inspectRegularFile(payloadPath);
|
|
112
113
|
const manifest = validateEventV3SupportPackManifest({
|
|
@@ -143,7 +144,7 @@ export async function writeEventV3SupportPack(
|
|
|
143
144
|
const handle = await open(
|
|
144
145
|
manifestPartial,
|
|
145
146
|
constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL,
|
|
146
|
-
|
|
147
|
+
stateFileMode(),
|
|
147
148
|
);
|
|
148
149
|
try {
|
|
149
150
|
await handle.writeFile(`${canonicalJsonV3(manifest)}\n`, "utf8");
|
|
@@ -168,7 +169,7 @@ async function streamPayload(
|
|
|
168
169
|
authorityReal: string,
|
|
169
170
|
): Promise<void> {
|
|
170
171
|
const gzip = createGzip({ level: 9 });
|
|
171
|
-
const output = createWriteStream(destination, { flags: "wx", mode:
|
|
172
|
+
const output = createWriteStream(destination, { flags: "wx", mode: stateFileMode() });
|
|
172
173
|
const completed = pipeline(gzip, output);
|
|
173
174
|
try {
|
|
174
175
|
for (const entry of entries) {
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
|
+
import type { ParsedPayload } from "../../hooks/adapter/parse.ts";
|
|
6
|
+
import { stateFileMode } from "../../storage/modes.ts";
|
|
7
|
+
|
|
8
|
+
export interface LineChanges {
|
|
9
|
+
added: number;
|
|
10
|
+
removed: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Unknown tools remain unmeasured: a shell, script, or connector can write files.
|
|
14
|
+
const READ_TOOLS = new Set(["Read", "Glob", "Grep", "LS", "view_image"]);
|
|
15
|
+
const MAX_BYTES = 2 * 1024 * 1024;
|
|
16
|
+
|
|
17
|
+
function object(value: unknown): Record<string, unknown> | undefined {
|
|
18
|
+
if (typeof value === "string") {
|
|
19
|
+
try {
|
|
20
|
+
return object(JSON.parse(value));
|
|
21
|
+
} catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
26
|
+
? (value as Record<string, unknown>)
|
|
27
|
+
: undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function lineCount(text: string): number {
|
|
31
|
+
return text === "" ? 0 : text.split("\n").length - (text.endsWith("\n") ? 1 : 0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function readText(path: string): string {
|
|
35
|
+
if (statSync(path).size > MAX_BYTES) throw new Error("unmeasured file");
|
|
36
|
+
const bytes = readFileSync(path);
|
|
37
|
+
if (bytes.length > MAX_BYTES || bytes.includes(0)) throw new Error("unmeasured file");
|
|
38
|
+
return bytes.toString("utf8");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Use Git's line semantics without retaining file contents in producer state. */
|
|
42
|
+
function compare(before: string, after: string): LineChanges | undefined {
|
|
43
|
+
if (Buffer.byteLength(after) > MAX_BYTES || after.includes("\0")) return;
|
|
44
|
+
if (before === after) return { added: 0, removed: 0 };
|
|
45
|
+
const directory = mkdtempSync(join(tmpdir(), "harnery-lines-"));
|
|
46
|
+
try {
|
|
47
|
+
const oldPath = join(directory, "before");
|
|
48
|
+
const newPath = join(directory, "after");
|
|
49
|
+
writeFileSync(oldPath, before, { mode: stateFileMode() });
|
|
50
|
+
writeFileSync(newPath, after, { mode: stateFileMode() });
|
|
51
|
+
const result = spawnSync(
|
|
52
|
+
"git",
|
|
53
|
+
["diff", "--no-index", "--no-ext-diff", "--no-textconv", "--numstat", "--", oldPath, newPath],
|
|
54
|
+
{
|
|
55
|
+
encoding: "utf8",
|
|
56
|
+
timeout: 2000,
|
|
57
|
+
maxBuffer: 4096,
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
if (result.status !== 0 && result.status !== 1) return;
|
|
61
|
+
const match = /^(\d+)\t(\d+)\t/.exec(result.stdout);
|
|
62
|
+
return match ? { added: Number(match[1]), removed: Number(match[2]) } : undefined;
|
|
63
|
+
} finally {
|
|
64
|
+
rmSync(directory, { recursive: true, force: true });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Proposed edit counts, captured before execution; publish only on success. */
|
|
69
|
+
export function prepareToolLineChanges(
|
|
70
|
+
payload: ParsedPayload,
|
|
71
|
+
cwd: string,
|
|
72
|
+
): LineChanges | undefined {
|
|
73
|
+
try {
|
|
74
|
+
const name = payload.tool_name ?? "";
|
|
75
|
+
if (READ_TOOLS.has(name)) return { added: 0, removed: 0 };
|
|
76
|
+
const input = object(payload.tool_input);
|
|
77
|
+
if (name === "apply_patch") {
|
|
78
|
+
const patch =
|
|
79
|
+
typeof payload.tool_input === "string" && payload.tool_input.startsWith("*** Begin Patch")
|
|
80
|
+
? payload.tool_input
|
|
81
|
+
: (input?.patch ?? input?.input ?? input?.command);
|
|
82
|
+
if (
|
|
83
|
+
typeof patch !== "string" ||
|
|
84
|
+
!patch.startsWith("*** Begin Patch\n") ||
|
|
85
|
+
!patch.includes("*** End Patch")
|
|
86
|
+
)
|
|
87
|
+
return;
|
|
88
|
+
let added = 0;
|
|
89
|
+
let removed = 0;
|
|
90
|
+
let inFile = false;
|
|
91
|
+
for (const line of patch.split("\n")) {
|
|
92
|
+
if (line.startsWith("*** Delete File: ")) {
|
|
93
|
+
removed += lineCount(readText(resolve(cwd, line.slice(17))));
|
|
94
|
+
inFile = false;
|
|
95
|
+
} else if (/^\*\*\* (?:Add|Update) File: /.test(line)) {
|
|
96
|
+
inFile = true;
|
|
97
|
+
} else if (line === "*** End Patch") {
|
|
98
|
+
inFile = false;
|
|
99
|
+
} else if (inFile && line.startsWith("+")) added++;
|
|
100
|
+
else if (inFile && line.startsWith("-")) removed++;
|
|
101
|
+
}
|
|
102
|
+
return { added, removed };
|
|
103
|
+
}
|
|
104
|
+
if (!["Write", "Edit", "StrReplace", "MultiEdit"].includes(name) || !input) return;
|
|
105
|
+
const path = input.file_path ?? input.path;
|
|
106
|
+
if (typeof path !== "string") return;
|
|
107
|
+
let before: string;
|
|
108
|
+
try {
|
|
109
|
+
before = readText(resolve(cwd, path));
|
|
110
|
+
} catch (error) {
|
|
111
|
+
if (name !== "Write" || (error as NodeJS.ErrnoException).code !== "ENOENT") return;
|
|
112
|
+
before = "";
|
|
113
|
+
}
|
|
114
|
+
if (name === "Write")
|
|
115
|
+
return typeof input.content === "string" ? compare(before, input.content) : undefined;
|
|
116
|
+
let after = before;
|
|
117
|
+
const edits = name === "MultiEdit" ? input.edits : [input];
|
|
118
|
+
if (!Array.isArray(edits)) return;
|
|
119
|
+
for (const entry of edits) {
|
|
120
|
+
const edit = object(entry);
|
|
121
|
+
if (
|
|
122
|
+
!edit ||
|
|
123
|
+
typeof edit.old_string !== "string" ||
|
|
124
|
+
typeof edit.new_string !== "string" ||
|
|
125
|
+
!edit.old_string
|
|
126
|
+
)
|
|
127
|
+
return;
|
|
128
|
+
const occurrences = after.split(edit.old_string).length - 1;
|
|
129
|
+
if (occurrences === 0 || (occurrences > 1 && edit.replace_all !== true)) return;
|
|
130
|
+
after =
|
|
131
|
+
edit.replace_all === true
|
|
132
|
+
? after.split(edit.old_string).join(edit.new_string)
|
|
133
|
+
: after.replace(edit.old_string, () => edit.new_string as string);
|
|
134
|
+
}
|
|
135
|
+
return compare(before, after);
|
|
136
|
+
} catch {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "node:fs";
|
|
20
20
|
import { hostname } from "node:os";
|
|
21
21
|
import { join, resolve } from "node:path";
|
|
22
|
+
import { stateDirMode, stateFileMode, stateModeTooOpen } from "../../storage/modes.ts";
|
|
22
23
|
import { fsyncParentDirectory } from "../../workflow/durable-record.ts";
|
|
23
24
|
import { acquireNoClobberLease } from "../../workflow/workspaces/leases.ts";
|
|
24
25
|
import { canonicalJsonV3, sha256V3 } from "./canonical.ts";
|
|
@@ -212,7 +213,7 @@ export function drainReadyEventsUnderLeaseV3(
|
|
|
212
213
|
checkpoint?.genesis_id ? checkpoint : undefined,
|
|
213
214
|
);
|
|
214
215
|
if (readyRows.length === 0) return 0;
|
|
215
|
-
const activeFd = openSync(paths.active, "a",
|
|
216
|
+
const activeFd = openSync(paths.active, "a", stateFileMode());
|
|
216
217
|
let committed = 0;
|
|
217
218
|
try {
|
|
218
219
|
for (const { readyName, readyPath, row } of readyRows) {
|
|
@@ -397,13 +398,13 @@ export function ensureEventV3Layout(coordRoot: string) {
|
|
|
397
398
|
paths.segments,
|
|
398
399
|
paths.authorityOutbox,
|
|
399
400
|
]) {
|
|
400
|
-
mkdirSync(path, { recursive: true, mode:
|
|
401
|
-
chmodSync(path,
|
|
401
|
+
mkdirSync(path, { recursive: true, mode: stateDirMode() });
|
|
402
|
+
chmodSync(path, stateDirMode());
|
|
402
403
|
}
|
|
403
404
|
if (!existsSync(paths.active)) {
|
|
404
405
|
let fd: number | undefined;
|
|
405
406
|
try {
|
|
406
|
-
fd = openSync(paths.active, "wx",
|
|
407
|
+
fd = openSync(paths.active, "wx", stateFileMode());
|
|
407
408
|
fsyncSync(fd);
|
|
408
409
|
fsyncParentDirectory(paths.active);
|
|
409
410
|
} catch (error) {
|
|
@@ -413,8 +414,8 @@ export function ensureEventV3Layout(coordRoot: string) {
|
|
|
413
414
|
}
|
|
414
415
|
}
|
|
415
416
|
const active = lstatSync(paths.active);
|
|
416
|
-
if (!active.isFile() || active.isSymbolicLink() || (active.mode
|
|
417
|
-
throw new Error("active V3 ledger must be
|
|
417
|
+
if (!active.isFile() || active.isSymbolicLink() || stateModeTooOpen(active.mode)) {
|
|
418
|
+
throw new Error("active V3 ledger must be a regular file closed to other users");
|
|
418
419
|
}
|
|
419
420
|
return paths;
|
|
420
421
|
}
|
|
@@ -429,7 +430,7 @@ function writeReadyRecord(
|
|
|
429
430
|
const temporary = join(spool, `.tmp-${process.pid}-${randomUUID()}`);
|
|
430
431
|
let fd: number | undefined;
|
|
431
432
|
try {
|
|
432
|
-
fd = openSync(temporary, "wx",
|
|
433
|
+
fd = openSync(temporary, "wx", stateFileMode());
|
|
433
434
|
writeFileSync(fd, row, "utf8");
|
|
434
435
|
fsyncSync(fd);
|
|
435
436
|
onStep?.("ready_temp_flushed", eventId);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "node:fs";
|
|
12
12
|
import { dirname, join, resolve } from "node:path";
|
|
13
13
|
import { appendSegmentedJsonlFile } from "../storage/durable-history.ts";
|
|
14
|
+
import { stateDirMode, stateFileMode } from "../storage/modes.ts";
|
|
14
15
|
import { createWorkItem, readWorkItem } from "../work/index.ts";
|
|
15
16
|
import {
|
|
16
17
|
digestResult,
|
|
@@ -709,8 +710,8 @@ function createPlanRequest(
|
|
|
709
710
|
};
|
|
710
711
|
const script = plannerScript(coordRoot, record, planId, trigger);
|
|
711
712
|
const dir = planDir(coordRoot, record.intent.id, planId);
|
|
712
|
-
mkdirSync(dir, { recursive: true, mode:
|
|
713
|
-
chmodSync(dir,
|
|
713
|
+
mkdirSync(dir, { recursive: true, mode: stateDirMode() });
|
|
714
|
+
chmodSync(dir, stateDirMode());
|
|
714
715
|
writeExclusiveJson(join(dir, "request.json"), request, "governor plan request");
|
|
715
716
|
writeExclusive(join(dir, "planner.mjs"), script, "governor planner script");
|
|
716
717
|
return request;
|
|
@@ -1610,10 +1611,10 @@ function writeExclusive(path: string, body: string, label: string): void {
|
|
|
1610
1611
|
if (Buffer.byteLength(body) > MAX_RECORD_BYTES) {
|
|
1611
1612
|
throw new Error(`${label} exceeds ${MAX_RECORD_BYTES} bytes`);
|
|
1612
1613
|
}
|
|
1613
|
-
mkdirSync(dirname(path), { recursive: true, mode:
|
|
1614
|
+
mkdirSync(dirname(path), { recursive: true, mode: stateDirMode() });
|
|
1614
1615
|
const temporary = `${path}.tmp-${process.pid}-${randomUUID()}`;
|
|
1615
1616
|
try {
|
|
1616
|
-
writeFileSync(temporary, body, { encoding: "utf8", flag: "wx", mode:
|
|
1617
|
+
writeFileSync(temporary, body, { encoding: "utf8", flag: "wx", mode: stateFileMode() });
|
|
1617
1618
|
try {
|
|
1618
1619
|
linkSync(temporary, path);
|
|
1619
1620
|
} catch (error) {
|
|
@@ -1621,7 +1622,7 @@ function writeExclusive(path: string, body: string, label: string): void {
|
|
|
1621
1622
|
const existing = readFileSync(path, "utf8");
|
|
1622
1623
|
if (existing !== body) throw new Error(`${label} already exists with different content`);
|
|
1623
1624
|
}
|
|
1624
|
-
chmodSync(path,
|
|
1625
|
+
chmodSync(path, stateFileMode());
|
|
1625
1626
|
} finally {
|
|
1626
1627
|
try {
|
|
1627
1628
|
unlinkSync(temporary);
|
|
@@ -18,6 +18,7 @@ import { dirname, join, resolve } from "node:path";
|
|
|
18
18
|
import { coordEnv } from "../../lib/env.ts";
|
|
19
19
|
import { type NormalizedPolicy, normalizePolicy, type PolicyIsolation } from "../policy/index.ts";
|
|
20
20
|
import { closeProcessLoggers, legacyLogFields, processLogger } from "../storage/logger.ts";
|
|
21
|
+
import { stateDirMode, stateFileMode } from "../storage/modes.ts";
|
|
21
22
|
import { RotatingTextSink } from "../storage/process-log.ts";
|
|
22
23
|
import type { RunWorkItemInput } from "../work/index.ts";
|
|
23
24
|
import { type GovernorRunReport, type GovernorStopReason, runGovernor } from "./runner.ts";
|
|
@@ -196,8 +197,8 @@ export function configureGovernorService(
|
|
|
196
197
|
created_at: new Date().toISOString(),
|
|
197
198
|
};
|
|
198
199
|
const dir = serviceDir(coordRoot);
|
|
199
|
-
mkdirSync(dir, { recursive: true, mode:
|
|
200
|
-
chmodSync(dir,
|
|
200
|
+
mkdirSync(dir, { recursive: true, mode: stateDirMode() });
|
|
201
|
+
chmodSync(dir, stateDirMode());
|
|
201
202
|
writePrivateJsonAtomic(serviceConfigPath(coordRoot), config);
|
|
202
203
|
return readGovernorServiceConfig(coordRoot);
|
|
203
204
|
}
|
|
@@ -261,10 +262,10 @@ export async function spawnGovernorService(coordRootRaw: string): Promise<Govern
|
|
|
261
262
|
if (current.running) {
|
|
262
263
|
throw new Error(`governor service is already running under pid ${current.record?.pid}`);
|
|
263
264
|
}
|
|
264
|
-
mkdirSync(serviceDir(coordRoot), { recursive: true, mode:
|
|
265
|
+
mkdirSync(serviceDir(coordRoot), { recursive: true, mode: stateDirMode() });
|
|
265
266
|
const sharedLogs = coordEnv("SHARED_LOGS") !== "0";
|
|
266
|
-
const logFd = sharedLogs ? undefined : openSync(serviceLogPath(coordRoot), "a",
|
|
267
|
-
if (logFd !== undefined) chmodSync(serviceLogPath(coordRoot),
|
|
267
|
+
const logFd = sharedLogs ? undefined : openSync(serviceLogPath(coordRoot), "a", stateFileMode());
|
|
268
|
+
if (logFd !== undefined) chmodSync(serviceLogPath(coordRoot), stateFileMode());
|
|
268
269
|
const harnBin = new URL("../../../bin/harn", import.meta.url).pathname;
|
|
269
270
|
if (!existsSync(harnBin)) {
|
|
270
271
|
if (logFd !== undefined) closeSync(logFd);
|
|
@@ -712,7 +713,7 @@ function normalizeIsolation(value: unknown): PolicyIsolation | undefined {
|
|
|
712
713
|
|
|
713
714
|
function acquireServiceLease(coordRoot: string): () => void {
|
|
714
715
|
const path = serviceLeasePath(coordRoot);
|
|
715
|
-
mkdirSync(dirname(path), { recursive: true, mode:
|
|
716
|
+
mkdirSync(dirname(path), { recursive: true, mode: stateDirMode() });
|
|
716
717
|
const owner: ServiceLease = {
|
|
717
718
|
pid: process.pid,
|
|
718
719
|
host: hostname(),
|
|
@@ -721,7 +722,7 @@ function acquireServiceLease(coordRoot: string): () => void {
|
|
|
721
722
|
};
|
|
722
723
|
const acquire = (): boolean => {
|
|
723
724
|
try {
|
|
724
|
-
const fd = openSync(path, "wx",
|
|
725
|
+
const fd = openSync(path, "wx", stateFileMode());
|
|
725
726
|
try {
|
|
726
727
|
writeFileSync(fd, `${JSON.stringify(owner)}\n`, "utf8");
|
|
727
728
|
} finally {
|
|
@@ -867,12 +868,12 @@ function writePrivateJsonAtomic(path: string, value: unknown): void {
|
|
|
867
868
|
if (Buffer.byteLength(body) > MAX_FILE_BYTES) {
|
|
868
869
|
throw new Error(`governor service file exceeds ${MAX_FILE_BYTES} bytes`);
|
|
869
870
|
}
|
|
870
|
-
mkdirSync(dirname(path), { recursive: true, mode:
|
|
871
|
-
chmodSync(dirname(path),
|
|
871
|
+
mkdirSync(dirname(path), { recursive: true, mode: stateDirMode() });
|
|
872
|
+
chmodSync(dirname(path), stateDirMode());
|
|
872
873
|
const temporary = `${path}.tmp-${process.pid}-${randomBytes(4).toString("hex")}`;
|
|
873
|
-
writeFileSync(temporary, body, { encoding: "utf8", flag: "wx", mode:
|
|
874
|
+
writeFileSync(temporary, body, { encoding: "utf8", flag: "wx", mode: stateFileMode() });
|
|
874
875
|
renameSync(temporary, path);
|
|
875
|
-
chmodSync(path,
|
|
876
|
+
chmodSync(path, stateFileMode());
|
|
876
877
|
}
|
|
877
878
|
|
|
878
879
|
function serviceDir(coordRoot: string): string {
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "node:fs";
|
|
14
14
|
import { hostname } from "node:os";
|
|
15
15
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
16
|
+
import { stateDirMode, stateFileMode } from "../storage/modes.ts";
|
|
16
17
|
import { assertWorkId, readWorkItem, type WorkRecord } from "../work/read.ts";
|
|
17
18
|
import { workflowScriptDigest } from "../workflow/run-state.ts";
|
|
18
19
|
import { normalizeWorkflowSpecialists } from "../workflow/specialists.ts";
|
|
@@ -233,8 +234,8 @@ export function createGovernor(input: CreateGovernorInput): GovernorRecord {
|
|
|
233
234
|
created_at: new Date().toISOString(),
|
|
234
235
|
};
|
|
235
236
|
const path = governorIntentPath(coordRoot, id);
|
|
236
|
-
mkdirSync(dirname(path), { recursive: true, mode:
|
|
237
|
-
chmodSync(dirname(path),
|
|
237
|
+
mkdirSync(dirname(path), { recursive: true, mode: stateDirMode() });
|
|
238
|
+
chmodSync(dirname(path), stateDirMode());
|
|
238
239
|
writePrivateJson(path, intent);
|
|
239
240
|
return readGovernor(coordRoot, id);
|
|
240
241
|
}
|
|
@@ -309,13 +310,13 @@ export function acquireGovernorLease(coordRoot: string, goalId: string): () => v
|
|
|
309
310
|
};
|
|
310
311
|
const acquire = (): boolean => {
|
|
311
312
|
try {
|
|
312
|
-
const fd = openSync(path, "wx",
|
|
313
|
+
const fd = openSync(path, "wx", stateFileMode());
|
|
313
314
|
try {
|
|
314
315
|
writeFileSync(fd, `${JSON.stringify(owner)}\n`, "utf8");
|
|
315
316
|
} finally {
|
|
316
317
|
closeSync(fd);
|
|
317
318
|
}
|
|
318
|
-
chmodSync(path,
|
|
319
|
+
chmodSync(path, stateFileMode());
|
|
319
320
|
return true;
|
|
320
321
|
} catch (error) {
|
|
321
322
|
if ((error as NodeJS.ErrnoException).code !== "EEXIST") throw error;
|
|
@@ -1250,8 +1251,8 @@ function writePrivateJson(path: string, value: unknown): void {
|
|
|
1250
1251
|
if (Buffer.byteLength(body) > MAX_INTENT_BYTES) {
|
|
1251
1252
|
throw new Error(`governor intent exceeds ${MAX_INTENT_BYTES} bytes`);
|
|
1252
1253
|
}
|
|
1253
|
-
writeFileSync(path, body, { encoding: "utf8", flag: "wx", mode:
|
|
1254
|
-
chmodSync(path,
|
|
1254
|
+
writeFileSync(path, body, { encoding: "utf8", flag: "wx", mode: stateFileMode() });
|
|
1255
|
+
chmodSync(path, stateFileMode());
|
|
1255
1256
|
}
|
|
1256
1257
|
|
|
1257
1258
|
function bounded(value: unknown, field: string, max: number): string {
|
|
@@ -185,6 +185,7 @@ function attestedContextSource(
|
|
|
185
185
|
"claude-code": ["hook", "native_event", "result"],
|
|
186
186
|
codex: ["native_event", "result", "transcript"],
|
|
187
187
|
cursor: ["native_event"],
|
|
188
|
+
opencode: ["native_event", "result"],
|
|
188
189
|
};
|
|
189
190
|
return !!source && (allowed[adapter] ?? []).includes(source);
|
|
190
191
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
writeFileSync,
|
|
13
13
|
} from "node:fs";
|
|
14
14
|
import { dirname, join } from "node:path";
|
|
15
|
+
import { stateFileMode } from "../storage/modes.ts";
|
|
15
16
|
import type { RunQualitySnapshot } from "./types.ts";
|
|
16
17
|
|
|
17
18
|
export interface GuardCursor {
|
|
@@ -143,7 +144,7 @@ export function writeAtomicJson(
|
|
|
143
144
|
try {
|
|
144
145
|
writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\n`, {
|
|
145
146
|
encoding: "utf8",
|
|
146
|
-
mode:
|
|
147
|
+
mode: stateFileMode(),
|
|
147
148
|
});
|
|
148
149
|
if (beforeRename && !beforeRename()) throw new Error("run_quality_lock_stolen");
|
|
149
150
|
renameSync(temporary, path);
|
|
@@ -155,7 +156,7 @@ export function writeAtomicJson(
|
|
|
155
156
|
function createExclusive(path: string, value: EvaluationLock): boolean {
|
|
156
157
|
let fd: number | undefined;
|
|
157
158
|
try {
|
|
158
|
-
fd = openSync(path, "wx",
|
|
159
|
+
fd = openSync(path, "wx", stateFileMode());
|
|
159
160
|
writeFileSync(fd, `${JSON.stringify(value)}\n`, "utf8");
|
|
160
161
|
return true;
|
|
161
162
|
} catch (error) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AdapterBehavior } from "./types.ts";
|
|
2
|
+
|
|
3
|
+
/** Claude Code: the reference adapter; host-default labels, full effect set. */
|
|
4
|
+
export const claudeCodeBehavior: AdapterBehavior = {
|
|
5
|
+
id: "claude-code",
|
|
6
|
+
sessionStartPlatformLabel: undefined,
|
|
7
|
+
soundEffects: true,
|
|
8
|
+
journalMaintenance: true,
|
|
9
|
+
sessionTelemetrySync: true,
|
|
10
|
+
promptPresenceDetection: true,
|
|
11
|
+
promptContextNudges: {
|
|
12
|
+
taskNudge: false,
|
|
13
|
+
hostPromptReminder: false,
|
|
14
|
+
statusFooterNudge: false,
|
|
15
|
+
turnRitualNudge: "claude-code",
|
|
16
|
+
},
|
|
17
|
+
completedResponseEvent: undefined,
|
|
18
|
+
sessionIdentityOnStartOnly: false,
|
|
19
|
+
nativeTurnIdOptional: false,
|
|
20
|
+
tracksExecutionMode: false,
|
|
21
|
+
shellOperationDedup: false,
|
|
22
|
+
promptMayPrecedeSessionStart: false,
|
|
23
|
+
promptContinuesOpenTurn: false,
|
|
24
|
+
turnRecovery: true,
|
|
25
|
+
nativeTelemetryOnly: false,
|
|
26
|
+
runtimeContextTranscriptOptional: false,
|
|
27
|
+
runtimeContextRetry: false,
|
|
28
|
+
effortAttestation: "payload",
|
|
29
|
+
transcriptTuningRefresh: true,
|
|
30
|
+
modelProvider: "anthropic",
|
|
31
|
+
runtimeContextAvailable: () => true,
|
|
32
|
+
bridgeFor: () => undefined,
|
|
33
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { resolveBinName } from "../../../config.ts";
|
|
2
|
+
import {
|
|
3
|
+
codexWslFileLinkTelemetry,
|
|
4
|
+
inspectCodexWslBridge,
|
|
5
|
+
isWslUncPath,
|
|
6
|
+
renderCodexWslFileLinkContext,
|
|
7
|
+
} from "../../codex-wsl-bridge.ts";
|
|
8
|
+
import { unsafeCrossShellReason } from "../../unsafe-cross-shell.ts";
|
|
9
|
+
import type { ParsedPayload } from "../parse.ts";
|
|
10
|
+
import { discoverCodexSessionTranscript } from "../runtime-telemetry.ts";
|
|
11
|
+
import type { AdapterBehavior } from "./types.ts";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Privacy-safe environment and recovery provenance for Codex mid-flight
|
|
15
|
+
* onboarding. WSLENV values are never recorded, only normalized variable
|
|
16
|
+
* names, and the native session identifier itself remains fingerprinted.
|
|
17
|
+
*/
|
|
18
|
+
export function codexMidFlightDiagnosticContext(
|
|
19
|
+
payload: ParsedPayload,
|
|
20
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
21
|
+
): Record<string, string | boolean> {
|
|
22
|
+
const wslenv = env.WSLENV?.trim() ?? "";
|
|
23
|
+
const wslenvNames = [
|
|
24
|
+
...new Set(
|
|
25
|
+
wslenv
|
|
26
|
+
.split(":")
|
|
27
|
+
.map((entry) => entry.split("/", 1)[0]?.trim() ?? "")
|
|
28
|
+
.filter((name) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(name)),
|
|
29
|
+
),
|
|
30
|
+
]
|
|
31
|
+
.sort()
|
|
32
|
+
.join(":")
|
|
33
|
+
.slice(0, 512);
|
|
34
|
+
const identityRecoverySource = payload.session_id
|
|
35
|
+
? "native_session_id"
|
|
36
|
+
: payload.conversation_id
|
|
37
|
+
? "native_conversation_id"
|
|
38
|
+
: payload.agent_id
|
|
39
|
+
? "native_agent_id"
|
|
40
|
+
: "unavailable";
|
|
41
|
+
return {
|
|
42
|
+
thread_id_present: Boolean(env.CODEX_THREAD_ID?.trim()),
|
|
43
|
+
wslenv_present: wslenv.length > 0,
|
|
44
|
+
wslenv_names: wslenvNames,
|
|
45
|
+
identity_recovery_source: identityRecoverySource,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Codex: hook payloads omit `transcript_path`, so the rollout is discovered by
|
|
51
|
+
* session id; effort is probed from the rollout; a Windows-native Codex over a
|
|
52
|
+
* WSL UNC workspace is the one bridged deployment Harnery knows about.
|
|
53
|
+
*/
|
|
54
|
+
export const codexBehavior: AdapterBehavior = {
|
|
55
|
+
id: "codex",
|
|
56
|
+
sessionStartPlatformLabel: "Codex",
|
|
57
|
+
soundEffects: false,
|
|
58
|
+
journalMaintenance: false,
|
|
59
|
+
sessionTelemetrySync: false,
|
|
60
|
+
promptPresenceDetection: false,
|
|
61
|
+
promptContextNudges: {
|
|
62
|
+
taskNudge: true,
|
|
63
|
+
hostPromptReminder: true,
|
|
64
|
+
statusFooterNudge: true,
|
|
65
|
+
turnRitualNudge: undefined,
|
|
66
|
+
},
|
|
67
|
+
completedResponseEvent: undefined,
|
|
68
|
+
sessionIdentityOnStartOnly: false,
|
|
69
|
+
nativeTurnIdOptional: false,
|
|
70
|
+
tracksExecutionMode: false,
|
|
71
|
+
shellOperationDedup: false,
|
|
72
|
+
promptMayPrecedeSessionStart: false,
|
|
73
|
+
promptContinuesOpenTurn: false,
|
|
74
|
+
turnRecovery: true,
|
|
75
|
+
nativeTelemetryOnly: false,
|
|
76
|
+
runtimeContextTranscriptOptional: false,
|
|
77
|
+
runtimeContextRetry: true,
|
|
78
|
+
effortAttestation: "rollout-probe",
|
|
79
|
+
transcriptTuningRefresh: false,
|
|
80
|
+
modelProvider: "openai",
|
|
81
|
+
runtimeContextAvailable: () => true,
|
|
82
|
+
bridgeFor: (cwd) => (isWslUncPath(cwd) ? "codex-wsl" : undefined),
|
|
83
|
+
discoverTranscript: (nativeSessionId, candidate, options) =>
|
|
84
|
+
discoverCodexSessionTranscript(nativeSessionId, candidate, options),
|
|
85
|
+
midFlightDiagnosticContext: (payload) => codexMidFlightDiagnosticContext(payload),
|
|
86
|
+
fileLinkTelemetry: (coordRoot, cwd, lastAssistantMessage) =>
|
|
87
|
+
codexWslFileLinkTelemetry(coordRoot, cwd, lastAssistantMessage),
|
|
88
|
+
fileLinkContext: (coordRoot, cwd) => renderCodexWslFileLinkContext(coordRoot, cwd),
|
|
89
|
+
bridgeWarning: (coordRoot, cwd) => {
|
|
90
|
+
if (!isWslUncPath(cwd)) return undefined;
|
|
91
|
+
const bridge = inspectCodexWslBridge(process.env, { expected: true });
|
|
92
|
+
if (!bridge || bridge.ok) return undefined;
|
|
93
|
+
return `Harnery hybrid warning: ${bridge.detail}. Run \`${resolveBinName(coordRoot)} doctor\` for the repair hint.`;
|
|
94
|
+
},
|
|
95
|
+
unsafeCrossShellReason: (input) => unsafeCrossShellReason({ adapter: "codex", ...input }),
|
|
96
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AdapterBehavior } from "./types.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cursor: no exit-code enforcement, a separate afterAgentResponse hook carries
|
|
5
|
+
* the completed reply, and cloud mode has no readable runtime context.
|
|
6
|
+
*/
|
|
7
|
+
export const cursorBehavior: AdapterBehavior = {
|
|
8
|
+
id: "cursor",
|
|
9
|
+
sessionStartPlatformLabel: "Cursor",
|
|
10
|
+
soundEffects: false,
|
|
11
|
+
journalMaintenance: false,
|
|
12
|
+
sessionTelemetrySync: false,
|
|
13
|
+
promptPresenceDetection: false,
|
|
14
|
+
promptContextNudges: {
|
|
15
|
+
taskNudge: true,
|
|
16
|
+
hostPromptReminder: true,
|
|
17
|
+
statusFooterNudge: false,
|
|
18
|
+
turnRitualNudge: undefined,
|
|
19
|
+
},
|
|
20
|
+
completedResponseEvent: "after-agent-response",
|
|
21
|
+
sessionIdentityOnStartOnly: true,
|
|
22
|
+
nativeTurnIdOptional: true,
|
|
23
|
+
tracksExecutionMode: true,
|
|
24
|
+
shellOperationDedup: true,
|
|
25
|
+
promptMayPrecedeSessionStart: true,
|
|
26
|
+
promptContinuesOpenTurn: true,
|
|
27
|
+
turnRecovery: true,
|
|
28
|
+
nativeTelemetryOnly: false,
|
|
29
|
+
runtimeContextTranscriptOptional: true,
|
|
30
|
+
runtimeContextRetry: false,
|
|
31
|
+
effortAttestation: "payload",
|
|
32
|
+
transcriptTuningRefresh: false,
|
|
33
|
+
modelProvider: "cursor",
|
|
34
|
+
runtimeContextAvailable: (mode) => mode !== "cloud",
|
|
35
|
+
bridgeFor: () => undefined,
|
|
36
|
+
inlineAssistantText: (payload) => payload?.agent_message,
|
|
37
|
+
};
|