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
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { lstatSync, readdirSync, readlinkSync, realpathSync, rmSync, type Stats } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { basename, dirname, isAbsolute, parse, relative, resolve, sep } from "node:path";
|
|
5
|
+
|
|
6
|
+
export interface RemoveOptions {
|
|
7
|
+
root: string;
|
|
8
|
+
recursive?: boolean;
|
|
9
|
+
yes?: boolean;
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Protected paths (Git metadata, credentials, Harnery state, SSH or GnuPG
|
|
13
|
+
* keys, a bare repository) the caller names for removal, one exact path
|
|
14
|
+
* each. A protected path that is not named is still refused.
|
|
15
|
+
*/
|
|
16
|
+
allowProtected?: string[];
|
|
17
|
+
/** Directories whose own Git metadata and Harnery state may never be allowed (the live workspace). */
|
|
18
|
+
liveRoots?: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface RemovalLink {
|
|
22
|
+
path: string;
|
|
23
|
+
/** What the link points to. It is removed as a link and never followed. */
|
|
24
|
+
target: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface RemovalReport {
|
|
28
|
+
schema: "harnery.removal/v1";
|
|
29
|
+
applied: boolean;
|
|
30
|
+
root: string;
|
|
31
|
+
targets: string[];
|
|
32
|
+
entries: number;
|
|
33
|
+
bytes: number;
|
|
34
|
+
/** Protected paths removed because the caller named them with allowProtected. */
|
|
35
|
+
protected: string[];
|
|
36
|
+
/** Symbolic links inside recursive targets, removed as links. */
|
|
37
|
+
links: RemovalLink[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const protectedNames = new Set([".git", ".harnery", ".credentials", ".ssh", ".gnupg"]);
|
|
41
|
+
const MAX_ENTRIES = 10_000;
|
|
42
|
+
|
|
43
|
+
/** Permanent removal is deliberately limited to inspected, untracked local outputs. */
|
|
44
|
+
export function guardedRemove(
|
|
45
|
+
paths: string[],
|
|
46
|
+
options: RemoveOptions,
|
|
47
|
+
checkClaims: (targets: string[]) => void = () => {},
|
|
48
|
+
): RemovalReport {
|
|
49
|
+
const cwd = realpathSync(process.cwd());
|
|
50
|
+
const root = checkedPath(options.root, new Set(), true);
|
|
51
|
+
const allowed = allowedProtected(options.allowProtected ?? [], root, options.liveRoots ?? []);
|
|
52
|
+
const rootStat = lstatSync(root);
|
|
53
|
+
const rootFingerprint = fingerprint(rootStat);
|
|
54
|
+
if (!rootStat.isDirectory()) throw new Error("--root must be a directory");
|
|
55
|
+
if (root === parse(root).root || root === realpathSync(homedir()))
|
|
56
|
+
throw new Error("--root cannot be a filesystem root or home directory");
|
|
57
|
+
if (paths.length === 0 || paths.length > 100) throw new Error("Supply 1-100 explicit targets");
|
|
58
|
+
const targets = paths.map((path) => checkedPath(path, allowed));
|
|
59
|
+
const snapshots = new Map<string, string>();
|
|
60
|
+
const removedProtected = new Set<string>();
|
|
61
|
+
const links: RemovalLink[] = [];
|
|
62
|
+
const gitDirs = new Set<string>();
|
|
63
|
+
let bytes = 0;
|
|
64
|
+
const devices = new Set<number>();
|
|
65
|
+
|
|
66
|
+
for (const target of targets) {
|
|
67
|
+
const home = realpathSync(homedir());
|
|
68
|
+
if (target === home || strictlyInside(target, home))
|
|
69
|
+
throw new Error(`Cannot remove the home directory or its ancestor: ${target}`);
|
|
70
|
+
const systemRoots =
|
|
71
|
+
process.platform === "win32"
|
|
72
|
+
? [
|
|
73
|
+
process.env.SystemRoot,
|
|
74
|
+
process.env.ProgramFiles,
|
|
75
|
+
process.env["ProgramFiles(x86)"],
|
|
76
|
+
].filter((value): value is string => Boolean(value))
|
|
77
|
+
: [
|
|
78
|
+
"/etc",
|
|
79
|
+
"/usr",
|
|
80
|
+
"/boot",
|
|
81
|
+
"/dev",
|
|
82
|
+
"/proc",
|
|
83
|
+
"/sys",
|
|
84
|
+
"/bin",
|
|
85
|
+
"/sbin",
|
|
86
|
+
"/lib",
|
|
87
|
+
"/lib64",
|
|
88
|
+
"/run",
|
|
89
|
+
];
|
|
90
|
+
if (
|
|
91
|
+
systemRoots.some(
|
|
92
|
+
(system) =>
|
|
93
|
+
target === resolve(system) ||
|
|
94
|
+
strictlyInside(resolve(system), target) ||
|
|
95
|
+
strictlyInside(target, resolve(system)),
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
throw new Error(`System files are protected: ${target}`);
|
|
99
|
+
if (!strictlyInside(root, target))
|
|
100
|
+
throw new Error(`Target must be strictly inside --root: ${target}`);
|
|
101
|
+
if (target === cwd || strictlyInside(target, cwd))
|
|
102
|
+
throw new Error(`Cannot remove the working directory or its ancestor: ${target}`);
|
|
103
|
+
if (
|
|
104
|
+
targets.some((other) => other !== target && strictlyInside(other, target)) ||
|
|
105
|
+
targets.filter((other) => other === target).length > 1
|
|
106
|
+
)
|
|
107
|
+
throw new Error("Targets must not duplicate or contain one another");
|
|
108
|
+
const stat = lstatSync(target);
|
|
109
|
+
if (stat.dev !== rootStat.dev) throw new Error(`Target crosses a mount boundary: ${target}`);
|
|
110
|
+
if (stat.isDirectory() && !options.recursive)
|
|
111
|
+
throw new Error(`Directory removal requires --recursive: ${target}`);
|
|
112
|
+
const device = stat.dev;
|
|
113
|
+
devices.add(device);
|
|
114
|
+
const pending = [target];
|
|
115
|
+
while (pending.length) {
|
|
116
|
+
const path = pending.pop()!;
|
|
117
|
+
const info = lstatSync(path);
|
|
118
|
+
if (basename(path) === ARTIFACT_RECORD && insideArtifactWorkspace(path, null))
|
|
119
|
+
throw new Error(`An artifact's record is managed by the artifact commands: ${path}`);
|
|
120
|
+
if (protectedNames.has(basename(path).toLowerCase())) {
|
|
121
|
+
if (!allowed.has(path)) throw new Error(protectedMessage(path));
|
|
122
|
+
removedProtected.add(path);
|
|
123
|
+
}
|
|
124
|
+
if (info.isSymbolicLink()) {
|
|
125
|
+
// A link inside the tree is removed as a link; its target is never
|
|
126
|
+
// read, followed, or counted. (The target itself and its ancestors
|
|
127
|
+
// were already refused if they were links, in checkedPath.)
|
|
128
|
+
if (path === target) throw new Error(`Path contains a symlink: ${path}`);
|
|
129
|
+
if (snapshots.size >= MAX_ENTRIES)
|
|
130
|
+
throw new Error(
|
|
131
|
+
`Removal exceeds the ${MAX_ENTRIES}-entry limit; use the owning cleanup command`,
|
|
132
|
+
);
|
|
133
|
+
snapshots.set(path, fingerprint(info));
|
|
134
|
+
links.push({ path, target: readlinkSync(path) });
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (info.dev !== device || (!info.isDirectory() && !info.isFile()))
|
|
138
|
+
throw new Error(`Mount boundary or special file cannot be removed: ${path}`);
|
|
139
|
+
if (snapshots.size >= MAX_ENTRIES)
|
|
140
|
+
throw new Error(
|
|
141
|
+
`Removal exceeds the ${MAX_ENTRIES}-entry limit; use the owning cleanup command`,
|
|
142
|
+
);
|
|
143
|
+
snapshots.set(path, fingerprint(info));
|
|
144
|
+
if (info.isFile()) bytes += info.size;
|
|
145
|
+
else {
|
|
146
|
+
const names = readdirSync(path);
|
|
147
|
+
if (
|
|
148
|
+
names.includes("HEAD") &&
|
|
149
|
+
names.includes("objects") &&
|
|
150
|
+
names.includes("config") &&
|
|
151
|
+
!insideAllowed(path, allowed)
|
|
152
|
+
)
|
|
153
|
+
throw new Error(
|
|
154
|
+
`Repository metadata cannot be removed: ${path}. To remove it on purpose, name it with --allow-protected ${path}`,
|
|
155
|
+
);
|
|
156
|
+
if (allowed.has(path)) removedProtected.add(path);
|
|
157
|
+
if (isRepositoryMetadata(path)) gitDirs.add(path);
|
|
158
|
+
for (const name of names) pending.push(resolve(path, name));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
assertUntracked(target);
|
|
162
|
+
}
|
|
163
|
+
if (devices.size > 1) throw new Error("Targets must be on one filesystem");
|
|
164
|
+
for (const path of allowed)
|
|
165
|
+
if (!removedProtected.has(path))
|
|
166
|
+
throw new Error(`--allow-protected names a path no target removes: ${path}`);
|
|
167
|
+
for (const dir of gitDirs) assertNoUnpushedHistory(dir);
|
|
168
|
+
checkClaims(targets);
|
|
169
|
+
const report: RemovalReport = {
|
|
170
|
+
schema: "harnery.removal/v1",
|
|
171
|
+
applied: false,
|
|
172
|
+
root,
|
|
173
|
+
targets,
|
|
174
|
+
entries: snapshots.size,
|
|
175
|
+
bytes,
|
|
176
|
+
protected: [...removedProtected].sort(),
|
|
177
|
+
links,
|
|
178
|
+
};
|
|
179
|
+
if (!options.yes || options.dryRun) return report;
|
|
180
|
+
|
|
181
|
+
// Recheck the entire batch before its first mutation. Filesystem changes after
|
|
182
|
+
// these checks remain possible; this is a guard, not a transactional filesystem.
|
|
183
|
+
if (
|
|
184
|
+
checkedPath(options.root, new Set(), true) !== root ||
|
|
185
|
+
fingerprint(lstatSync(root)) !== rootFingerprint
|
|
186
|
+
)
|
|
187
|
+
throw new Error("Allowed root changed during inspection");
|
|
188
|
+
for (const target of targets) {
|
|
189
|
+
checkedPath(target, allowed);
|
|
190
|
+
assertUntracked(target);
|
|
191
|
+
}
|
|
192
|
+
for (const dir of gitDirs) assertNoUnpushedHistory(dir);
|
|
193
|
+
checkClaims(targets);
|
|
194
|
+
for (const [path, previous] of snapshots) {
|
|
195
|
+
if (fingerprint(lstatSync(path)) !== previous)
|
|
196
|
+
throw new Error(`Target changed during inspection: ${path}`);
|
|
197
|
+
}
|
|
198
|
+
for (const target of targets)
|
|
199
|
+
rmSync(target, { recursive: Boolean(options.recursive), force: false });
|
|
200
|
+
return { ...report, applied: true };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** The metadata file the artifact commands keep in each artifact workspace. */
|
|
204
|
+
const ARTIFACT_RECORD = ".harnery-artifact.json";
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* True when `path` lies strictly inside one artifact workspace,
|
|
208
|
+
* <dir>/.harnery/artifacts/<id>/..., under the `.harnery` component `state`
|
|
209
|
+
* (any `.harnery` when null). Artifact workspaces hold local outputs, so their
|
|
210
|
+
* contents may be removed; the workspace itself, its record file, and the rest
|
|
211
|
+
* of Harnery state stay protected and follow the artifact commands. `orSelf`
|
|
212
|
+
* accepts the workspace directory itself (used for --root, which is never removed).
|
|
213
|
+
*/
|
|
214
|
+
function insideArtifactWorkspace(path: string, state: string | null, orSelf = false): boolean {
|
|
215
|
+
const parts = path.split(sep);
|
|
216
|
+
for (let i = 0; i < parts.length; i++) {
|
|
217
|
+
if (parts[i]!.toLowerCase() !== ".harnery") continue;
|
|
218
|
+
if (state !== null && parts.slice(0, i + 1).join(sep) !== state) continue;
|
|
219
|
+
// .harnery / artifacts / <id> / <something>
|
|
220
|
+
return (
|
|
221
|
+
parts[i + 1] === "artifacts" && Boolean(parts[i + 2]) && parts.length >= i + (orSelf ? 3 : 4)
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function protectedMessage(path: string): string {
|
|
228
|
+
return `Protected state cannot be removed: ${path}. To remove it on purpose, name it with --allow-protected ${path}`;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function insideAllowed(path: string, allowed: ReadonlySet<string>): boolean {
|
|
232
|
+
for (const entry of allowed) if (path === entry || strictlyInside(entry, path)) return true;
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Resolves the caller's --allow-protected paths. Each must be one exact
|
|
238
|
+
* protected path strictly inside the root, reached without symlinks, and
|
|
239
|
+
* never the Git metadata or Harnery state of a live workspace root.
|
|
240
|
+
*/
|
|
241
|
+
function allowedProtected(paths: string[], root: string, liveRoots: string[]): Set<string> {
|
|
242
|
+
const allowed = new Set<string>();
|
|
243
|
+
const live = liveRoots.map((dir) => resolve(dir));
|
|
244
|
+
for (const input of paths) {
|
|
245
|
+
if (!input?.trim() || /[\0\r\n*?[\]$]/.test(input))
|
|
246
|
+
throw new Error("Use a nonempty explicit --allow-protected path without wildcards");
|
|
247
|
+
const path = resolve(input);
|
|
248
|
+
let cursor = dirname(path);
|
|
249
|
+
while (true) {
|
|
250
|
+
if (lstatSync(cursor).isSymbolicLink())
|
|
251
|
+
throw new Error(`--allow-protected path contains a symlink: ${cursor}`);
|
|
252
|
+
const parent = dirname(cursor);
|
|
253
|
+
if (parent === cursor) break;
|
|
254
|
+
cursor = parent;
|
|
255
|
+
}
|
|
256
|
+
const info = lstatSync(path);
|
|
257
|
+
if (info.isSymbolicLink()) throw new Error(`--allow-protected path is a symlink: ${path}`);
|
|
258
|
+
if (!strictlyInside(root, path))
|
|
259
|
+
throw new Error(`--allow-protected path must be strictly inside --root: ${path}`);
|
|
260
|
+
const named = protectedNames.has(basename(path).toLowerCase());
|
|
261
|
+
if (!named && !(info.isDirectory() && isRepositoryMetadata(path)))
|
|
262
|
+
throw new Error(`--allow-protected must name a protected path itself: ${path}`);
|
|
263
|
+
for (const dir of live) {
|
|
264
|
+
const own = [".git", ".harnery"].map((name) => resolve(dir, name));
|
|
265
|
+
if (
|
|
266
|
+
path === dir ||
|
|
267
|
+
strictlyInside(path, dir) ||
|
|
268
|
+
own.some((state) => path === state || strictlyInside(state, path))
|
|
269
|
+
)
|
|
270
|
+
throw new Error(`The live workspace's own state cannot be allowed: ${path}`);
|
|
271
|
+
}
|
|
272
|
+
allowed.add(realpathSync(path));
|
|
273
|
+
}
|
|
274
|
+
return allowed;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function isRepositoryMetadata(dir: string): boolean {
|
|
278
|
+
const names = readdirSync(dir);
|
|
279
|
+
return names.includes("HEAD") && names.includes("objects") && names.includes("config");
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Removing a repository's metadata loses any commit that exists nowhere
|
|
284
|
+
* else. An allowed Git directory must have no branch or tag commit missing
|
|
285
|
+
* from its remotes; anything that cannot be checked is refused.
|
|
286
|
+
*/
|
|
287
|
+
function assertNoUnpushedHistory(gitDir: string): void {
|
|
288
|
+
const result = spawnSync(
|
|
289
|
+
"git",
|
|
290
|
+
[
|
|
291
|
+
"--git-dir",
|
|
292
|
+
gitDir,
|
|
293
|
+
"rev-list",
|
|
294
|
+
"--max-count=1",
|
|
295
|
+
"--branches",
|
|
296
|
+
"--tags",
|
|
297
|
+
"--not",
|
|
298
|
+
"--remotes",
|
|
299
|
+
],
|
|
300
|
+
{
|
|
301
|
+
encoding: "utf8",
|
|
302
|
+
timeout: 10_000,
|
|
303
|
+
env: { ...process.env, LC_ALL: "C", GIT_DIR: undefined, GIT_WORK_TREE: undefined },
|
|
304
|
+
},
|
|
305
|
+
);
|
|
306
|
+
if (result.error || result.status !== 0)
|
|
307
|
+
throw new Error(`Cannot confirm ${gitDir} holds no unpushed history`);
|
|
308
|
+
if (result.stdout.trim()) throw new Error(`Repository has commits not on any remote: ${gitDir}`);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function strictlyInside(parent: string, child: string): boolean {
|
|
312
|
+
const rel = relative(parent, child);
|
|
313
|
+
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function checkedPath(
|
|
317
|
+
input: string,
|
|
318
|
+
allowed: ReadonlySet<string> = new Set(),
|
|
319
|
+
isRoot = false,
|
|
320
|
+
): string {
|
|
321
|
+
if (!input?.trim() || /[\0\r\n*?[\]$]/.test(input))
|
|
322
|
+
throw new Error("Use a nonempty explicit path without wildcards or unresolved variables");
|
|
323
|
+
const path = resolve(input);
|
|
324
|
+
let cursor = path;
|
|
325
|
+
while (true) {
|
|
326
|
+
if (
|
|
327
|
+
protectedNames.has(basename(cursor).toLowerCase()) &&
|
|
328
|
+
!allowed.has(cursor) &&
|
|
329
|
+
!insideArtifactWorkspace(path, cursor, isRoot)
|
|
330
|
+
)
|
|
331
|
+
throw new Error(
|
|
332
|
+
cursor === path ? protectedMessage(path) : `Protected state contains this path: ${cursor}`,
|
|
333
|
+
);
|
|
334
|
+
const info = lstatSync(cursor);
|
|
335
|
+
if (info.isSymbolicLink()) throw new Error(`Path contains a symlink: ${cursor}`);
|
|
336
|
+
const parent = dirname(cursor);
|
|
337
|
+
if (parent === cursor) break;
|
|
338
|
+
cursor = parent;
|
|
339
|
+
}
|
|
340
|
+
return realpathSync(path);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function fingerprint(stat: Stats): string {
|
|
344
|
+
return [stat.dev, stat.ino, stat.mode, stat.size, stat.mtimeMs, stat.ctimeMs].join(":");
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function assertUntracked(target: string): void {
|
|
348
|
+
const git = (args: string[]) =>
|
|
349
|
+
spawnSync("git", ["-C", dirname(target), ...args], {
|
|
350
|
+
encoding: "utf8",
|
|
351
|
+
timeout: 10_000,
|
|
352
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
353
|
+
env: {
|
|
354
|
+
...process.env,
|
|
355
|
+
LC_ALL: "C",
|
|
356
|
+
GIT_LITERAL_PATHSPECS: "1",
|
|
357
|
+
GIT_DIR: undefined,
|
|
358
|
+
GIT_WORK_TREE: undefined,
|
|
359
|
+
GIT_INDEX_FILE: undefined,
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
const detected = git(["rev-parse", "--show-toplevel"]);
|
|
363
|
+
if (detected.error) throw new Error(`Cannot check Git ownership: ${detected.error.message}`);
|
|
364
|
+
if (detected.status !== 0) {
|
|
365
|
+
if (detected.status === 128 && detected.stderr.startsWith("fatal: not a git repository"))
|
|
366
|
+
return;
|
|
367
|
+
throw new Error(`Cannot check Git ownership: ${detected.stderr.trim()}`);
|
|
368
|
+
}
|
|
369
|
+
const repo = detected.stdout.trim();
|
|
370
|
+
const tracked = git(["ls-files", "--cached", "-z", "--full-name", "--", target]);
|
|
371
|
+
if (tracked.error || tracked.status !== 0) throw new Error(`Cannot inspect Git index in ${repo}`);
|
|
372
|
+
if (tracked.stdout.length)
|
|
373
|
+
throw new Error(
|
|
374
|
+
`Tracked files are protected; use git rm for intentional source removal: ${target}`,
|
|
375
|
+
);
|
|
376
|
+
}
|
|
@@ -25,8 +25,11 @@ import {
|
|
|
25
25
|
} from "../../core/agents/state/live-coordination-view.ts";
|
|
26
26
|
import { resolveForkAncestry } from "../../core/agents/state/names.ts";
|
|
27
27
|
import { instanceHasLivePid, removePidmapRowsForInstance } from "../../core/agents/state/pidmap.ts";
|
|
28
|
-
import { coordFreshnessSeconds } from "../../core/config.ts";
|
|
29
|
-
import
|
|
28
|
+
import { coordFreshnessSeconds, resolveBinName } from "../../core/config.ts";
|
|
29
|
+
import {
|
|
30
|
+
type EventAdapterIdV3,
|
|
31
|
+
eventAdapterIdV3FromPlatform,
|
|
32
|
+
} from "../../core/events/v3/adapter-id.ts";
|
|
30
33
|
import { readRemoteMachines } from "../../core/presence/index.ts";
|
|
31
34
|
import { type AgentIdentity, bareName, ensureIdentity, lookupById, lookupByName } from "./index.ts";
|
|
32
35
|
|
|
@@ -237,10 +240,7 @@ function acquireLock(coordRoot: string): () => void {
|
|
|
237
240
|
}
|
|
238
241
|
|
|
239
242
|
function adapterOf(platform: string | undefined): EventAdapterIdV3 {
|
|
240
|
-
|
|
241
|
-
if (platform === "codex") return "codex";
|
|
242
|
-
if (platform === "openclaw") return "openclaw";
|
|
243
|
-
return "claude-code";
|
|
243
|
+
return eventAdapterIdV3FromPlatform(platform, { context: "identity-assume" });
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
/** Assume `target` for one live main session. Safe to retry. */
|
|
@@ -256,7 +256,7 @@ export function assumeIdentity(
|
|
|
256
256
|
if (!hb) {
|
|
257
257
|
throw new IdentityAssumeError(
|
|
258
258
|
"no_live_generation",
|
|
259
|
-
`no authority-safe live V3 generation for instance '${instanceId}'`,
|
|
259
|
+
`no authority-safe live V3 generation for instance '${instanceId}'; run \`${resolveBinName(coordRoot)} agents lifecycle active\` to open a fresh generation for this continuing session, then assume again`,
|
|
260
260
|
);
|
|
261
261
|
}
|
|
262
262
|
if (hb.kind && hb.kind !== "session") {
|
|
@@ -58,6 +58,8 @@ const ADAPTER_SKILLS_DIR: Readonly<Record<string, string>> = {
|
|
|
58
58
|
"claude-code": join(".claude", "skills"),
|
|
59
59
|
cursor: join(".agents", "skills"),
|
|
60
60
|
codex: join(".agents", "skills"),
|
|
61
|
+
// OpenCode natively discovers .agents/skills (and .claude/skills); no mirror needed.
|
|
62
|
+
opencode: join(".agents", "skills"),
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
function adapterSkillsDir(adapter: string): string | null {
|
|
@@ -89,8 +89,7 @@ export function renderInstructionsBlock(
|
|
|
89
89
|
return `## harnery coordination
|
|
90
90
|
|
|
91
91
|
This project runs [harnery](https://harnery.com) for multi-agent coordination.
|
|
92
|
-
You share this checkout with other agents; the surfaces below keep you oriented
|
|
93
|
-
and out of each other's way, and let you dispatch a team of your own when a job
|
|
92
|
+
You share this checkout with other agents; the surfaces below keep you oriented and out of each other's way, and let you dispatch a team of your own when a job
|
|
94
93
|
is bigger than one session. Run \`${b} <command> --help\` for any command's full
|
|
95
94
|
surface. ${deeper}
|
|
96
95
|
|
|
@@ -103,8 +102,7 @@ widely-shared files.
|
|
|
103
102
|
**Task lifecycle.** Beside the activity peers already see, declare whether your
|
|
104
103
|
objective is still open: \`${b} agents lifecycle blocked --reason "<why>"\` when
|
|
105
104
|
it cannot proceed, \`${b} agents lifecycle done\` when it is complete, and
|
|
106
|
-
\`${b} agents lifecycle active\` to reopen. \`done\` requires a current task and
|
|
107
|
-
a passing Git finalization check (dirty or unpushed work refuses, and nothing is
|
|
105
|
+
\`${b} agents lifecycle active\` to reopen. \`done\` requires a current task and a passing Git finalization check (dirty or unpushed work refuses, and nothing is
|
|
108
106
|
written). Ordinary \`set-task\` calls never change lifecycle, and a transition
|
|
109
107
|
that re-mints the session title tells you the new name to copy. ${endPointer}
|
|
110
108
|
|
|
@@ -129,8 +127,7 @@ It reclaims an abandoned namesake (no live process) and refuses only when anothe
|
|
|
129
127
|
live process still holds the name; never hand-edit Harnery's history, heartbeat,
|
|
130
128
|
or derived identity cache.
|
|
131
129
|
|
|
132
|
-
**Declare intent on shell commands.** Every command you run is captured to the
|
|
133
|
-
coordination ledger (\`.harnery/ledgers/v3/\`). Lead a shell command with a
|
|
130
|
+
**Declare intent on shell commands.** Every command you run is captured to the coordination ledger (\`.harnery/ledgers/v3/\`). Lead a shell command with a
|
|
134
131
|
\`# intent: <why>\` comment (or set the tool's description) so the recorded event
|
|
135
132
|
carries a reason instead of \`(no intent)\`; the [tool-intent
|
|
136
133
|
guide](https://harnery.com/guides/tool-intent/) owns the details.
|
|
@@ -154,6 +151,10 @@ After review, use \`${b} artifacts discard <id> --reason "<why no longer needed>
|
|
|
154
151
|
Do not create a repo-root temp directory; \`${b} artifacts clean\` previews
|
|
155
152
|
expired cleanup and requires \`--yes\` to delete anything.
|
|
156
153
|
|
|
154
|
+
**Removing local outputs.** Use \`${b} rm --root <directory> <paths...>\` instead of shell \`rm\`, which skips resolved-path, Git ownership, and peer-claim checks. Preview
|
|
155
|
+
is the default; \`--yes\` deletes permanently and \`--recursive\` permits directories.
|
|
156
|
+
Use \`git rm\` for tracked source and the artifact commands for managed evidence.
|
|
157
|
+
|
|
157
158
|
**Local file links.** When the operator should open a local repo file, mint the
|
|
158
159
|
URL with \`${b} files url <repo-relative-path>\` instead of guessing it. HTML opens
|
|
159
160
|
as a real page with working scripts and relative assets; other files open in the
|
|
@@ -164,8 +165,7 @@ can't resolve from the repo, file it instead. \`${b} decision file "<question>"\
|
|
|
164
165
|
records it and lets you proceed on a stated default; \`${b} decision search "<terms>"\`
|
|
165
166
|
surfaces prior decisions, so check for precedent before re-deciding. ${decidePointer}
|
|
166
167
|
|
|
167
|
-
**Councils.** For a hard or contested decision, convene a council of agents.
|
|
168
|
-
\`${b} council create "<objective>"\` runs structured rounds toward a decision. ${councilPointer}`;
|
|
168
|
+
**Councils.** For a hard or contested decision, convene a council of agents. \`${b} council create "<objective>"\` runs structured rounds toward a decision. ${councilPointer}`;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
// ── Skills ──────────────────────────────────────────────────────────────────
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export {
|
|
2
|
+
commandPaceGate,
|
|
3
|
+
DEFAULT_PACE_LEDGER,
|
|
4
|
+
DEFAULT_PACE_MAX_MS,
|
|
5
|
+
DEFAULT_PACE_MIN_MS,
|
|
6
|
+
describePaceWait,
|
|
7
|
+
PaceGate,
|
|
8
|
+
type PaceGateDeps,
|
|
9
|
+
type PacePolicy,
|
|
10
|
+
type PaceWait,
|
|
11
|
+
pacePolicyFromEnv,
|
|
12
|
+
paceSiteKey,
|
|
13
|
+
sleepSync,
|
|
14
|
+
} from "./pace.ts";
|