harnery 0.43.0 → 0.44.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 +3 -3
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +41 -48
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +38 -11
- package/dist/commands/diagnostics.d.ts.map +1 -1
- package/dist/commands/diagnostics.js +10 -0
- package/dist/commands/doctor.d.ts +12 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +22 -7
- package/dist/commands/governor.js +22 -10
- package/dist/commands/inbox.d.ts +1 -1
- package/dist/commands/inbox.d.ts.map +1 -1
- package/dist/commands/inbox.js +55 -2
- package/dist/commands/rm.d.ts.map +1 -1
- package/dist/commands/rm.js +28 -4
- package/dist/commands/servers.d.ts.map +1 -1
- package/dist/commands/servers.js +16 -1
- package/dist/commands/supervisor.d.ts.map +1 -1
- package/dist/commands/supervisor.js +7 -2
- package/dist/commands/toc.d.ts +14 -0
- package/dist/commands/toc.d.ts.map +1 -1
- package/dist/commands/toc.js +7 -4
- package/dist/commands/workflow.js +24 -30
- package/dist/core/agents/live-authority-v3.d.ts +1 -0
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
- package/dist/core/agents/live-authority-v3.js +11 -0
- package/dist/core/agents/live-lifecycle-v3.d.ts +4 -2
- package/dist/core/agents/live-lifecycle-v3.d.ts.map +1 -1
- package/dist/core/agents/live-lifecycle-v3.js +28 -7
- package/dist/core/agents/mailbox.d.ts +9 -8
- package/dist/core/agents/mailbox.d.ts.map +1 -1
- package/dist/core/agents/mailbox.js +24 -17
- package/dist/core/agents/render/prompt-context.d.ts +2 -0
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +8 -12
- package/dist/core/agents/render/session-context.d.ts +2 -8
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +7 -30
- package/dist/core/agents/rules/stop-hook.js +3 -3
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +25 -14
- package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-writer.js +5 -0
- package/dist/core/agents/state/pidmap.d.ts.map +1 -1
- package/dist/core/agents/state/pidmap.js +5 -0
- package/dist/core/agents/state/proc-start.d.ts +19 -0
- package/dist/core/agents/state/proc-start.d.ts.map +1 -1
- package/dist/core/agents/state/proc-start.js +41 -0
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +180 -70
- package/dist/core/agents/state/unchanged-file.d.ts +44 -0
- package/dist/core/agents/state/unchanged-file.d.ts.map +1 -0
- package/dist/core/agents/state/unchanged-file.js +390 -0
- package/dist/core/context/index.d.ts +22 -10
- package/dist/core/context/index.d.ts.map +1 -1
- package/dist/core/context/index.js +381 -119
- package/dist/core/context/observation.d.ts +26 -0
- package/dist/core/context/observation.d.ts.map +1 -0
- package/dist/core/context/observation.js +11 -0
- package/dist/core/diagnostics/bundle.d.ts.map +1 -1
- package/dist/core/diagnostics/bundle.js +25 -14
- package/dist/core/diagnostics/path-identity.d.ts +3 -0
- package/dist/core/diagnostics/path-identity.d.ts.map +1 -0
- package/dist/core/diagnostics/path-identity.js +12 -0
- package/dist/core/diagnostics/sanitize.d.ts.map +1 -1
- package/dist/core/diagnostics/sanitize.js +4 -3
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +29 -0
- package/dist/core/events/v3/generation-custody.d.ts +5 -0
- package/dist/core/events/v3/generation-custody.d.ts.map +1 -0
- package/dist/core/events/v3/generation-custody.js +50 -0
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +1 -0
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +7 -0
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +77 -64
- package/dist/core/governor/planning.d.ts.map +1 -1
- package/dist/core/governor/planning.js +14 -1
- package/dist/core/governor/service-read.d.ts +10 -2
- package/dist/core/governor/service-read.d.ts.map +1 -1
- package/dist/core/governor/service-read.js +105 -22
- package/dist/core/governor/service.d.ts +20 -2
- package/dist/core/governor/service.d.ts.map +1 -1
- package/dist/core/governor/service.js +72 -47
- package/dist/core/hooks/cli.js +33 -5
- package/dist/core/inbox/contract.d.ts +2 -1
- package/dist/core/inbox/contract.d.ts.map +1 -1
- package/dist/core/inbox/index.d.ts +2 -0
- package/dist/core/inbox/index.d.ts.map +1 -1
- package/dist/core/inbox/index.js +2 -0
- package/dist/core/inbox/peer-messages.d.ts +37 -0
- package/dist/core/inbox/peer-messages.d.ts.map +1 -0
- package/dist/core/inbox/peer-messages.js +72 -0
- package/dist/core/inbox/service.d.ts +8 -1
- package/dist/core/inbox/service.d.ts.map +1 -1
- package/dist/core/inbox/service.js +67 -21
- package/dist/core/inbox/targets.d.ts +22 -0
- package/dist/core/inbox/targets.d.ts.map +1 -0
- package/dist/core/inbox/targets.js +108 -0
- package/dist/core/inbox/watcher.js +7 -3
- package/dist/core/journal/index.d.ts.map +1 -1
- package/dist/core/journal/index.js +17 -2
- package/dist/core/resources/contract.d.ts +3 -0
- package/dist/core/resources/contract.d.ts.map +1 -1
- package/dist/core/resources/service-status.d.ts +14 -1
- package/dist/core/resources/service-status.d.ts.map +1 -1
- package/dist/core/resources/service-status.js +23 -13
- package/dist/core/resources/service.d.ts +9 -1
- package/dist/core/resources/service.d.ts.map +1 -1
- package/dist/core/resources/service.js +47 -27
- package/dist/core/resources/status.d.ts +2 -5
- package/dist/core/resources/status.d.ts.map +1 -1
- package/dist/core/resources/status.js +36 -7
- package/dist/core/servers/index.d.ts +24 -13
- package/dist/core/servers/index.d.ts.map +1 -1
- package/dist/core/servers/index.js +132 -92
- package/dist/core/servers/tunnels.d.ts +3 -5
- package/dist/core/servers/tunnels.d.ts.map +1 -1
- package/dist/core/servers/tunnels.js +3 -9
- package/dist/core/supervisor/contract.d.ts +12 -0
- package/dist/core/supervisor/contract.d.ts.map +1 -1
- package/dist/core/supervisor/explanations.d.ts.map +1 -1
- package/dist/core/supervisor/explanations.js +2 -1
- package/dist/core/supervisor/findings.d.ts.map +1 -1
- package/dist/core/supervisor/findings.js +54 -9
- package/dist/core/supervisor/service.d.ts +9 -1
- package/dist/core/supervisor/service.d.ts.map +1 -1
- package/dist/core/supervisor/service.js +59 -29
- package/dist/core/supervisor/services.d.ts.map +1 -1
- package/dist/core/supervisor/services.js +22 -1
- package/dist/core/supervisor/status.d.ts +17 -2
- package/dist/core/supervisor/status.d.ts.map +1 -1
- package/dist/core/supervisor/status.js +70 -12
- package/dist/core/supervisor/timeline.d.ts.map +1 -1
- package/dist/core/supervisor/timeline.js +2 -1
- package/dist/core/work/state.js +7 -7
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +105 -32
- package/dist/core/workflow/failure-evidence.d.ts +16 -0
- package/dist/core/workflow/failure-evidence.d.ts.map +1 -0
- package/dist/core/workflow/failure-evidence.js +114 -0
- package/dist/core/workflow/index.d.ts +1 -1
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +1 -1
- package/dist/core/workflow/live-session-v3.d.ts +6 -0
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +126 -5
- package/dist/core/workflow/proof.d.ts +5 -5
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +115 -20
- package/dist/core/workflow/run-state.d.ts +3 -1
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +31 -27
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +19 -0
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +13 -0
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +19 -0
- package/dist/core/workflow/spawn-opencode.d.ts.map +1 -1
- package/dist/core/workflow/spawn-opencode.js +14 -0
- package/dist/core/workflow/types.d.ts +64 -17
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/index.d.ts +0 -1
- package/dist/core/workflow/workspaces/index.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/index.js +0 -1
- package/dist/core/workflow/workspaces/leases.d.ts +3 -1
- package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.js +30 -16
- package/dist/core/workflow/workspaces/local-git.d.ts +6 -2
- package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/local-git.js +270 -6
- package/dist/core/workflow/workspaces/ownership.d.ts +11 -0
- package/dist/core/workflow/workspaces/ownership.d.ts.map +1 -0
- package/dist/core/workflow/workspaces/ownership.js +194 -0
- package/dist/core/workflow/workspaces/reclaim.d.ts +35 -0
- package/dist/core/workflow/workspaces/reclaim.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/reclaim.js +14 -0
- package/dist/core/workflow/workspaces/recovery.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/recovery.js +21 -13
- package/dist/core/workflow/workspaces/state.d.ts +1 -0
- package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/state.js +21 -1
- package/dist/lib/browser/windows-chrome.d.ts +100 -12
- package/dist/lib/browser/windows-chrome.d.ts.map +1 -1
- package/dist/lib/browser/windows-chrome.js +262 -73
- package/dist/lib/docs-links.d.ts.map +1 -1
- package/dist/lib/docs-links.js +45 -2
- package/dist/lib/guarded-remove.d.ts +7 -0
- package/dist/lib/guarded-remove.d.ts.map +1 -1
- package/dist/lib/guarded-remove.js +106 -12
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +4 -0
- package/dist/lib/zip/index.d.ts +41 -0
- package/dist/lib/zip/index.d.ts.map +1 -0
- package/dist/lib/zip/index.js +398 -0
- package/package.json +7 -1
- package/src/commands/agents.ts +54 -63
- package/src/commands/browse.ts +50 -14
- package/src/commands/diagnostics.ts +10 -0
- package/src/commands/doctor.ts +26 -7
- package/src/commands/governor.ts +23 -10
- package/src/commands/inbox.ts +52 -2
- package/src/commands/rm.ts +43 -4
- package/src/commands/servers.ts +16 -4
- package/src/commands/supervisor.ts +7 -2
- package/src/commands/toc.ts +14 -6
- package/src/commands/workflow.ts +30 -30
- package/src/core/agents/live-authority-v3.ts +17 -0
- package/src/core/agents/live-lifecycle-v3.ts +52 -14
- package/src/core/agents/mailbox.ts +26 -17
- package/src/core/agents/render/prompt-context.ts +10 -12
- package/src/core/agents/render/session-context.ts +9 -32
- package/src/core/agents/rules/stop-hook.ts +3 -3
- package/src/core/agents/state/heartbeat-writer.ts +29 -12
- package/src/core/agents/state/live-coordination-writer.ts +29 -0
- package/src/core/agents/state/pidmap.ts +13 -0
- package/src/core/agents/state/proc-start.ts +57 -0
- package/src/core/agents/state/stale-sweep.ts +247 -82
- package/src/core/agents/state/unchanged-file.ts +456 -0
- package/src/core/context/index.ts +446 -136
- package/src/core/context/observation.ts +29 -0
- package/src/core/diagnostics/bundle.ts +23 -18
- package/src/core/diagnostics/path-identity.ts +15 -0
- package/src/core/diagnostics/sanitize.ts +4 -3
- package/src/core/events/v3/authority-outbox.ts +56 -0
- package/src/core/events/v3/generation-custody.ts +59 -0
- package/src/core/events/v3/producers/coordination-recorder.ts +15 -0
- package/src/core/events/v3/producers/recorder.ts +94 -68
- package/src/core/governor/planning.ts +20 -8
- package/src/core/governor/service-read.ts +128 -20
- package/src/core/governor/service.ts +119 -42
- package/src/core/hooks/cli.ts +33 -5
- package/src/core/inbox/contract.ts +2 -1
- package/src/core/inbox/index.ts +2 -0
- package/src/core/inbox/peer-messages.ts +94 -0
- package/src/core/inbox/service.ts +88 -22
- package/src/core/inbox/targets.ts +148 -0
- package/src/core/inbox/watcher.ts +8 -9
- package/src/core/journal/index.ts +19 -2
- package/src/core/resources/contract.ts +4 -0
- package/src/core/resources/service-status.ts +35 -12
- package/src/core/resources/service.ts +71 -24
- package/src/core/resources/status.ts +57 -8
- package/src/core/servers/index.ts +177 -91
- package/src/core/servers/tunnels.ts +3 -11
- package/src/core/supervisor/contract.ts +13 -0
- package/src/core/supervisor/explanations.ts +4 -1
- package/src/core/supervisor/findings.ts +68 -10
- package/src/core/supervisor/service.ts +88 -26
- package/src/core/supervisor/services.ts +26 -8
- package/src/core/supervisor/status.ts +89 -12
- package/src/core/supervisor/timeline.ts +2 -1
- package/src/core/work/state.ts +7 -7
- package/src/core/workflow/engine.ts +131 -49
- package/src/core/workflow/failure-evidence.ts +141 -0
- package/src/core/workflow/index.ts +0 -1
- package/src/core/workflow/live-session-v3.ts +146 -5
- package/src/core/workflow/proof.ts +134 -26
- package/src/core/workflow/run-state.ts +31 -29
- package/src/core/workflow/spawn-claude.ts +18 -0
- package/src/core/workflow/spawn-codex.ts +13 -0
- package/src/core/workflow/spawn-cursor.ts +18 -0
- package/src/core/workflow/spawn-opencode.ts +14 -0
- package/src/core/workflow/types.ts +51 -17
- package/src/core/workflow/workspaces/index.ts +0 -1
- package/src/core/workflow/workspaces/leases.ts +48 -17
- package/src/core/workflow/workspaces/local-git.ts +315 -5
- package/src/core/workflow/workspaces/ownership.ts +232 -0
- package/src/core/workflow/workspaces/reclaim.ts +58 -0
- package/src/core/workflow/workspaces/recovery.ts +25 -13
- package/src/core/workflow/workspaces/state.ts +20 -0
- package/src/lib/browser/windows-chrome.ts +346 -86
- package/src/lib/docs-links.ts +49 -2
- package/src/lib/guarded-remove.ts +132 -14
- package/src/lib/identities/assume.ts +4 -0
- package/src/lib/zip/index.ts +483 -0
package/README.md
CHANGED
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
|
|
22
22
|
- **Multi-agent coordination.** Per-agent heartbeats in `.harnery/active/`, claim-time and commit-time guards, the canonical event stream, councils, a decision docket, per-agent journals, and adapter adapters for Claude Code / Cursor / Codex.
|
|
23
23
|
- **Cross-machine presence.** Sessions on every machine that shares a repo see each other, labeled by machine. Zero-config over the repo's own git remote (presence refs), with an optional live-socket upgrade via an end-to-end-encrypted relay: the public `relay.harnery.com`, or self-host with `harn relay serve` / the bundled Cloudflare Worker (`relay/worker/`). The relay sees only ciphertext in opaquely-named rooms.
|
|
24
|
-
- **Coordination-aware workflows.** `harn
|
|
25
|
-
- **Optional isolated workspaces.** Add `--isolation worktree --workspace-root <dir>` to run a workflow in a host-owned local Git worktree. Harnery freezes the allocation and provider identity, verifies the workspace before execution and resume, requires review and policy authority before fast-forward integration, and keeps cleanup conservative. Inspect with `harn
|
|
24
|
+
- **Coordination-aware workflows.** `harn run <script>` runs bounded, schema-gated multi-subagent workflow scripts. Plain JS stages fan out to headless adapter-CLI subagents that are born coordination-registered (heartbeats, events, claim guards), and deterministic code decides the routing between stages. An optional host-owned policy gates dispatch and declared external mutations with `ALLOW`, `ASK`, and `DENY`. CLI `ASK` requests park durably for an explicit approve/deny and same-run resume; library callers stay fail-closed by default.
|
|
25
|
+
- **Optional isolated workspaces.** Add `--isolation worktree --workspace-root <dir>` to run a workflow in a host-owned local Git worktree. Harnery freezes the allocation and provider identity, verifies the workspace before execution and resume, requires review and policy authority before fast-forward integration, and keeps cleanup conservative. Inspect with `harn run workspace`, then use the separate `run integration prepare`, `integration apply`, and `cleanup` phases. Shared execution remains the default.
|
|
26
26
|
- **Durable work above attempts.** `harn work` keeps an objective alive across bounded workflow attempts, dependencies, approval parks, failures, and review. Reusable workflow code receives the exact work ID, title, objective, acceptance criteria, and attempt identity as frozen typed context. A retry also receives the prior run's bounded error and unresolved proof criteria; retry authority and attempt ceilings stay unchanged. The manifest, proof, and append-only ledger bind the same context, and the one-shot reconciler reports the next explicit action without silently spawning, retrying, or accepting work.
|
|
27
|
-
- **Bounded goal supervision.** `harn
|
|
27
|
+
- **Bounded goal supervision.** `harn governor` freezes a mission or existing root graph, specialist team, and safety limits, then runs scheduling cycles until reviewed mission success, human attention, no progress, or budget exhaustion. Its optional planner can create the first milestone, reassess accepted milestone proof, or recover a terminal graph using only a frozen workflow-template catalog. Plans can require independent bounded specialist review before ordinary approval or auto-apply authority. Old generations stay immutable evidence, and all attempts still consume the goal budget. Use explicit foreground ticks or enroll goals in the optional heartbeat-backed background service.
|
|
28
28
|
- **Standalone web UI.** `harn web up` boots a local Next.js dashboard for the coord layer, councils, per-project state, and a local coding-agent status view (Claude Code / Codex / Cursor usage, backed by `harn devtools`). Ships with the git clone, not the npm package (see [Install](#install)).
|
|
29
29
|
- **Backup + sync.** `harn backup` snapshots `.harnery/` via [restic](https://restic.net/); `harn sync` keeps a curated subset live across machines via [rclone](https://rclone.org/) (Google Drive or any rclone remote).
|
|
30
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAS1E,OAAO,EAGL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAS1E,OAAO,EAGL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAKL,KAAK,4BAA4B,EAClC,MAAM,wCAAwC,CAAC;AAMhD,OAA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,EAAE,EACjD,UAAU,EAAE,MAAM,GACjB,UAAU,EAAE,CAQd;AA8KD,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,KAAK,SAAa,EAClB,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,qBAAqB,EAA6B,EAC9E,gBAAgB,SAAwB,GACvC,wBAAwB,CA0C1B;AAED,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,mBAAmB,GAAG,WAAW,CAAC;AAEhF,wFAAwF;AACxF,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAC,EACrD,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,mBAAmB,GAAG,IAAI,CAO5B"}
|
package/dist/commands/agents.js
CHANGED
|
@@ -20,7 +20,6 @@ import { coordBinPath } from "../core/agents/coord-bin.js";
|
|
|
20
20
|
import { checkGitFinalization, formatGitFinalizationFailure, readSessionWriteClaims, } from "../core/agents/finalization.js";
|
|
21
21
|
import { emitEventV3, monorepoRoot, nativeSessionIdentity, normalizeAdapter, resolveOwner, resolveOwnerBySessionEnv, resolveOwnerWithSource, sessionIdentityFromEnv, } from "../core/agents/index.js";
|
|
22
22
|
import { bootstrapLiveCoordinationAuthorityV3, LiveCoordinationAuthorityV3Error, reopenLiveCoordinationGenerationV3, } from "../core/agents/live-authority-v3.js";
|
|
23
|
-
import { isAddressableName, MailboxCapacityError, queueMailboxMessage, suggestNames, } from "../core/agents/mailbox.js";
|
|
24
23
|
import { qaSignalStatusRow } from "../core/agents/qa-signal.js";
|
|
25
24
|
import { reconcileCoordinationV3 } from "../core/agents/reconcile-coordination-v3.js";
|
|
26
25
|
import { listSessionFinalizationRequestsV3, observeHostDisappearedV3, reconcileSessionFinalizationV3, requestSessionEndExplicitV3, } from "../core/agents/session-finalizer-v3.js";
|
|
@@ -45,9 +44,12 @@ import { readLedgerV3 } from "../core/events/v3/reader.js";
|
|
|
45
44
|
import { EVENT_V3_LEDGER_RELATIVE_ROOT } from "../core/events/v3/writer.js";
|
|
46
45
|
import { evaluateRunQualityIfDue } from "../core/guard/index.js";
|
|
47
46
|
import { readRuntimeContextTelemetry, readRuntimeContextUsage, } from "../core/hooks/adapter/runtime-telemetry.js";
|
|
47
|
+
import { HarneryInboxCapacityError } from "../core/inbox/contract.js";
|
|
48
|
+
import { peerInbox, sendPeerMessage } from "../core/inbox/peer-messages.js";
|
|
48
49
|
import { readRemoteMachines } from "../core/presence/index.js";
|
|
49
50
|
import { formatResourceSummary, readResourceStatus } from "../core/resources/status.js";
|
|
50
51
|
import { registerContextCommand } from "./context.js";
|
|
52
|
+
import { registerInboxCommand } from "./inbox.js";
|
|
51
53
|
function readCurrentCoordinationRow(instanceId) {
|
|
52
54
|
const root = monorepoRoot();
|
|
53
55
|
return root ? readLiveCoordinationRow(root, instanceId) : null;
|
|
@@ -147,6 +149,12 @@ export function registerAgentsCommand(program, emitParam, programContext, binNam
|
|
|
147
149
|
.command("agents")
|
|
148
150
|
.description("The live agent sessions in this project: who is running now, what they hold, and their coordination state (whoami / list / status / health).");
|
|
149
151
|
registerContextCommand(cmd, emitParam, programContext);
|
|
152
|
+
registerInboxCommand(cmd, emitParam, peerInbox(monorepoRoot() ?? process.cwd()), () => {
|
|
153
|
+
const owner = resolveOwner();
|
|
154
|
+
if (!owner)
|
|
155
|
+
throw new Error("recipient instance is required outside an agent session");
|
|
156
|
+
return owner;
|
|
157
|
+
});
|
|
150
158
|
cmd
|
|
151
159
|
.command("whoami")
|
|
152
160
|
.description("Print the current agent's name + instance_id + files claimed")
|
|
@@ -281,10 +289,11 @@ export function registerAgentsCommand(program, emitParam, programContext, binNam
|
|
|
281
289
|
});
|
|
282
290
|
cmd
|
|
283
291
|
.command("ping <name> <message...>")
|
|
284
|
-
.description("
|
|
285
|
-
"
|
|
286
|
-
"
|
|
287
|
-
"
|
|
292
|
+
.description("Queue a durable message for one known task instance by name. Stale or " +
|
|
293
|
+
"done tasks receive it when that same task resumes. Ambiguous names " +
|
|
294
|
+
"require an exact instance; receipts do not confirm attention.")
|
|
295
|
+
.option("--instance-id <id>", "Select the exact known recipient instance")
|
|
296
|
+
.option("--require-live", "Refuse a recipient outside live presence")
|
|
288
297
|
.option("--json", "JSON output")
|
|
289
298
|
.action((name, message, opts) => {
|
|
290
299
|
runPing(name, message.join(" "), opts);
|
|
@@ -3853,48 +3862,34 @@ function runPing(name, message, opts) {
|
|
|
3853
3862
|
});
|
|
3854
3863
|
process.exit(1);
|
|
3855
3864
|
}
|
|
3856
|
-
const coordRoot = monorepoRoot();
|
|
3857
|
-
const peerOwner = resolveOwnerByName(name);
|
|
3858
|
-
// A name with no live session is the common case, not an error: the agent it
|
|
3859
|
-
// refers to may have ended minutes ago and may come back under the same name.
|
|
3860
|
-
// Refuse only a name that no agent has ever held, which is a typo — queueing
|
|
3861
|
-
// that would swallow the message silently.
|
|
3862
|
-
if (!peerOwner && coordRoot && !isAddressableName(coordRoot, name)) {
|
|
3863
|
-
const suggestions = suggestNames(coordRoot, name);
|
|
3864
|
-
emit.error({
|
|
3865
|
-
code: "unknown_agent",
|
|
3866
|
-
message: `no agent has ever been named "${name}". ` +
|
|
3867
|
-
(suggestions.length > 0 ? `Did you mean ${suggestions.join(", ")}? ` : "") +
|
|
3868
|
-
`Run \`${resolveBinName()} agents list\` for live sessions.`,
|
|
3869
|
-
});
|
|
3870
|
-
process.exit(1);
|
|
3871
|
-
}
|
|
3865
|
+
const coordRoot = monorepoRoot() ?? process.cwd();
|
|
3872
3866
|
const myHb = readCurrentCoordinationRow(myOwner);
|
|
3873
3867
|
const fromName = myHb?.name ?? "anonymous";
|
|
3874
|
-
|
|
3875
|
-
// A live recipient gets the journal entry immediately, so a peer reading
|
|
3876
|
-
// their own journal mid-session sees it without waiting for a prompt. A
|
|
3877
|
-
// dormant recipient has no journal to write to yet; the drain writes it into
|
|
3878
|
-
// whichever session picks the message up.
|
|
3879
|
-
const doc = peerOwner ? appendEntry(peerOwner, "handoff", body) : null;
|
|
3880
|
-
let queued;
|
|
3868
|
+
let sent;
|
|
3881
3869
|
try {
|
|
3882
|
-
|
|
3883
|
-
coordRoot
|
|
3884
|
-
|
|
3885
|
-
fromName,
|
|
3886
|
-
|
|
3870
|
+
sent = sendPeerMessage({
|
|
3871
|
+
coordRoot,
|
|
3872
|
+
target: { name, instanceId: opts.instanceId, requireLive: opts.requireLive },
|
|
3873
|
+
senderName: fromName,
|
|
3874
|
+
senderInstanceId: myOwner,
|
|
3887
3875
|
body: message.trim(),
|
|
3888
|
-
journaled: Boolean(peerOwner),
|
|
3889
3876
|
});
|
|
3890
3877
|
}
|
|
3891
3878
|
catch (error) {
|
|
3892
|
-
if (error instanceof
|
|
3893
|
-
emit.error({ code: `
|
|
3879
|
+
if (error instanceof HarneryInboxCapacityError) {
|
|
3880
|
+
emit.error({ code: `inbox_${error.reason_code}`, message: error.message });
|
|
3894
3881
|
process.exit(1);
|
|
3895
3882
|
}
|
|
3896
3883
|
throw error;
|
|
3897
3884
|
}
|
|
3885
|
+
if (!sent.ok) {
|
|
3886
|
+
emit.error({
|
|
3887
|
+
code: sent.code,
|
|
3888
|
+
message: sent.message,
|
|
3889
|
+
...(sent.candidates ? { candidates: sent.candidates } : {}),
|
|
3890
|
+
});
|
|
3891
|
+
process.exit(1);
|
|
3892
|
+
}
|
|
3898
3893
|
// Canonical delivery record: sender is the envelope owner, recipient rides
|
|
3899
3894
|
// in data, so read-only observers can render the communication without
|
|
3900
3895
|
// joining journal files.
|
|
@@ -3905,20 +3900,19 @@ function runPing(name, message, opts) {
|
|
|
3905
3900
|
observation: {
|
|
3906
3901
|
event_type: "coord.message_observed",
|
|
3907
3902
|
direction: "sent",
|
|
3908
|
-
subject:
|
|
3903
|
+
subject: sent.target.instance_id,
|
|
3904
|
+
message_id: sent.message_id,
|
|
3909
3905
|
body: message.trim(),
|
|
3910
3906
|
},
|
|
3911
3907
|
});
|
|
3912
3908
|
const data = {
|
|
3913
|
-
peer:
|
|
3914
|
-
peer_instance_id:
|
|
3915
|
-
|
|
3916
|
-
message_id:
|
|
3917
|
-
|
|
3909
|
+
peer: sent.target.name,
|
|
3910
|
+
peer_instance_id: sent.target.instance_id,
|
|
3911
|
+
state: sent.state,
|
|
3912
|
+
message_id: sent.message_id,
|
|
3913
|
+
synced: sent.synced,
|
|
3914
|
+
body_bytes: sent.body_bytes,
|
|
3918
3915
|
from: fromName,
|
|
3919
|
-
body,
|
|
3920
|
-
journal_path: doc?.path ?? null,
|
|
3921
|
-
journal_bytes: doc?.bytes ?? null,
|
|
3922
3916
|
};
|
|
3923
3917
|
if (opts.json) {
|
|
3924
3918
|
emit.config({ format: "json" });
|
|
@@ -3926,9 +3920,8 @@ function runPing(name, message, opts) {
|
|
|
3926
3920
|
return;
|
|
3927
3921
|
}
|
|
3928
3922
|
emit.data(data);
|
|
3929
|
-
emit.text(
|
|
3930
|
-
|
|
3931
|
-
: `queued for agent-${data.peer} (no live session; delivered when a session of that name next starts): "${truncate(message.trim(), 80)}"\n`);
|
|
3923
|
+
emit.text(`${data.state} for agent-${data.peer} (${data.peer_instance_id}); ` +
|
|
3924
|
+
`stored as ${data.message_id}, pending until surfaced to that task.\n`);
|
|
3932
3925
|
}
|
|
3933
3926
|
async function runWait(name, opts) {
|
|
3934
3927
|
const timeoutMs = parseDurationToMs(opts.timeout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browse.d.ts","sourceRoot":"","sources":["../../src/commands/browse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAmE1E,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC9B,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"browse.d.ts","sourceRoot":"","sources":["../../src/commands/browse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAmE1E,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC9B,MAAM,yCAAyC,CAAC;AA2FjD,UAAU,UAAU;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,4BAA4B,CAAC,EAAE,2BAA2B,CAAC;IAC3D,kBAAkB,CAAC,EAAE;QACnB,QAAQ,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,aAAa,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC7F,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;I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AC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B,sFAAsF;IACtF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0FAA0F;IAC1F,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAcD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,WAAW,EACtB,OAAO,CAAC,EAAE,qBAAqB,EAC/B,OAAO,SAAmB,GACzB,IAAI,CAqmBN;AAg+DD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,qCAAqC,CAAC;AAwXxE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,gBAAgB,CAAC,GAC9E,MAAM,GAAG,OAAO,GAAG,UAAU,CAW/B"}
|
package/dist/commands/browse.js
CHANGED
|
@@ -22,7 +22,7 @@ import { startBrowserSessionServer, } from "../lib/browser/session-control.js";
|
|
|
22
22
|
import { captureThumbnailFingerprint, registerCaptureThumbnail, } from "../lib/browser/thumbnail-association.js";
|
|
23
23
|
import { reviewCandidateRects } from "../lib/browser/tiling.js";
|
|
24
24
|
import { diffAgainstBaseline, saveBaseline, } from "../lib/browser/visual-diff.js";
|
|
25
|
-
import { harvestDomain, harvestWindowsChromeCookies, stopWindowsChromeProfile, windowsChromePath, windowsLocalAppData, windowsPlainProfile, wslPathToWindows, } from "../lib/browser/windows-chrome.js";
|
|
25
|
+
import { harvestDomain, harvestWindowsChromeCookies, keepWindowsChromeSession, stopWindowsChromeProfile, windowsChromePath, windowsLocalAppData, windowsPlainProfile, wslPathToWindows, } from "../lib/browser/windows-chrome.js";
|
|
26
26
|
import { applyExtraCookies, CookieJar, mergeCookies } from "../lib/cookies/index.js";
|
|
27
27
|
import { commandPaceGate } from "../lib/pace/index.js";
|
|
28
28
|
/**
|
|
@@ -2371,9 +2371,12 @@ function useWindowsPlainLogin() {
|
|
|
2371
2371
|
}
|
|
2372
2372
|
/**
|
|
2373
2373
|
* The WSL form of `--login`: the person signs in through the Windows
|
|
2374
|
-
* Chrome on a dedicated Windows profile with nothing attached.
|
|
2375
|
-
*
|
|
2376
|
-
*
|
|
2374
|
+
* Chrome on a dedicated Windows profile with nothing attached. Before the
|
|
2375
|
+
* window opens, the profile is set to continue where it left off, so Chrome
|
|
2376
|
+
* keeps browser-session cookies when the window closes. When the window
|
|
2377
|
+
* closes, the profile's cookies for the sign-in site are read and merged
|
|
2378
|
+
* into the shared cookie store, which later `browse` runs attach, and the
|
|
2379
|
+
* last page open on that site is reported so an agent can resume from it.
|
|
2377
2380
|
*/
|
|
2378
2381
|
async function runWindowsPlainLogin(url, storePath, loginCloseFile, emit) {
|
|
2379
2382
|
const chromeLinux = windowsChromePath();
|
|
@@ -2383,6 +2386,10 @@ async function runWindowsPlainLogin(url, storePath, loginCloseFile, emit) {
|
|
|
2383
2386
|
}
|
|
2384
2387
|
const chromeWindows = wslPathToWindows(chromeLinux);
|
|
2385
2388
|
const profileWindows = windowsPlainProfile(localAppData);
|
|
2389
|
+
const keep = keepWindowsChromeSession({ chromeWindows, profileWindows });
|
|
2390
|
+
if (!keep.kept) {
|
|
2391
|
+
emit.log("[--login] Could not set the sign-in profile to keep browser-session cookies. A sign-in that relies on them survives only if you end it from the terminal instead of closing the window.", "warn");
|
|
2392
|
+
}
|
|
2386
2393
|
const child = spawn(chromeLinux, [`--user-data-dir=${profileWindows}`, "--no-first-run", "--no-default-browser-check", url], { stdio: "ignore" });
|
|
2387
2394
|
const exited = new Promise((resolveExit) => {
|
|
2388
2395
|
child.once("exit", () => resolveExit());
|
|
@@ -2397,18 +2404,38 @@ async function runWindowsPlainLogin(url, storePath, loginCloseFile, emit) {
|
|
|
2397
2404
|
: waitForTerminalEnter(lifecycleAbort.signal));
|
|
2398
2405
|
await Promise.race(waits);
|
|
2399
2406
|
lifecycleAbort.abort();
|
|
2400
|
-
stopWindowsChromeProfile(profileWindows);
|
|
2407
|
+
const stop = stopWindowsChromeProfile(profileWindows);
|
|
2408
|
+
if (stop.forced > 0) {
|
|
2409
|
+
emit.log("[--login] Chrome did not close when asked and was stopped. Cookies set in its last 30 seconds may be missing; run the sign-in again if later pages are signed out.", "warn");
|
|
2410
|
+
}
|
|
2401
2411
|
await Promise.race([exited, new Promise((r) => setTimeout(r, 5000))]);
|
|
2402
2412
|
const domain = harvestDomain(url);
|
|
2403
|
-
const cookies = harvestWindowsChromeCookies({ chromeWindows, profileWindows, domain });
|
|
2413
|
+
const { cookies, pages } = harvestWindowsChromeCookies({ chromeWindows, profileWindows, domain });
|
|
2414
|
+
const lastPage = pages[0] ?? null;
|
|
2415
|
+
const names = [...new Set(cookies.map((cookie) => cookie.name))].sort();
|
|
2416
|
+
const sessionCookies = cookies.filter((cookie) => cookie.expires <= 0).length;
|
|
2404
2417
|
if (cookies.length === 0) {
|
|
2405
2418
|
emit.log(`[--login] No ${domain} cookies were found in the Windows profile; the sign-in may not have completed.`, "warn");
|
|
2406
|
-
return;
|
|
2407
2419
|
}
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2420
|
+
else {
|
|
2421
|
+
const jar = new CookieJar({ path: storePath, source: "harn-browse" });
|
|
2422
|
+
jar.save(mergeCookies(jar.load(), cookies));
|
|
2423
|
+
emit.log(`[--login] Copied ${cookies.length} ${domain} cookies (${sessionCookies} browser-session) into ${storePath}: ${names.join(", ")}.`, "info");
|
|
2424
|
+
}
|
|
2425
|
+
if (lastPage) {
|
|
2426
|
+
emit.log(`[--login] Last page: ${lastPage} (the last page you had open on ${domain}; open it to continue where the sign-in left off, since its address may carry a sign-in token that cookies alone do not replace).`, "info");
|
|
2427
|
+
}
|
|
2428
|
+
emit.data({
|
|
2429
|
+
login: {
|
|
2430
|
+
domain,
|
|
2431
|
+
store: storePath,
|
|
2432
|
+
cookies: cookies.length,
|
|
2433
|
+
sessionCookies,
|
|
2434
|
+
names,
|
|
2435
|
+
lastPage,
|
|
2436
|
+
pages,
|
|
2437
|
+
},
|
|
2438
|
+
});
|
|
2412
2439
|
}
|
|
2413
2440
|
async function waitForLoginCloseFile(path, signal) {
|
|
2414
2441
|
while (!existsSync(path) && !signal?.aborted) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/commands/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AA0B1E,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/commands/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AA0B1E,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CAsKN"}
|
|
@@ -23,6 +23,7 @@ export function registerDiagnosticsCommand(program, emit, context) {
|
|
|
23
23
|
findings,
|
|
24
24
|
bundles,
|
|
25
25
|
capability,
|
|
26
|
+
supervisor: readSupervisorStatus(repoRoot),
|
|
26
27
|
total_findings: findings.length,
|
|
27
28
|
total_bundles: bundles.length,
|
|
28
29
|
});
|
|
@@ -40,6 +41,7 @@ export function registerDiagnosticsCommand(program, emit, context) {
|
|
|
40
41
|
schema_version: DIAGNOSTIC_COMMAND_SCHEMA_VERSION,
|
|
41
42
|
kind: "diagnostic_finding",
|
|
42
43
|
finding,
|
|
44
|
+
supervisor: readSupervisorStatus(repoRoot),
|
|
43
45
|
timeline: readSupervisorTimeline(repoRoot, finding.id) ?? buildSupervisorTimeline(finding),
|
|
44
46
|
explanation: readSupervisorExplanation(repoRoot, finding.id) ?? explainSupervisorFinding(finding),
|
|
45
47
|
});
|
|
@@ -88,6 +90,7 @@ export function registerDiagnosticsCommand(program, emit, context) {
|
|
|
88
90
|
schema_version: DIAGNOSTIC_COMMAND_SCHEMA_VERSION,
|
|
89
91
|
kind: "diagnostic_advice",
|
|
90
92
|
source: { mode: "live" },
|
|
93
|
+
supervisor: readSupervisorStatus(repoRoot),
|
|
91
94
|
advice: buildDiagnosticAdvice({
|
|
92
95
|
assessment: published.assessment,
|
|
93
96
|
priorHysteresis: published.prior_hysteresis,
|
|
@@ -171,6 +174,13 @@ function liveFindingsCapability(repoRoot, reportPresent) {
|
|
|
171
174
|
const status = readSupervisorStatus(repoRoot);
|
|
172
175
|
if (status.running)
|
|
173
176
|
return { source_kind: "supervisor.findings", state: "supported" };
|
|
177
|
+
if (status.liveness === "unknown")
|
|
178
|
+
return {
|
|
179
|
+
source_kind: "supervisor.findings",
|
|
180
|
+
state: "error",
|
|
181
|
+
reason_code: "supervisor_generation_unknown",
|
|
182
|
+
detail: status.build_status,
|
|
183
|
+
};
|
|
174
184
|
return {
|
|
175
185
|
source_kind: "supervisor.findings",
|
|
176
186
|
state: "expired",
|
|
@@ -36,5 +36,17 @@ export declare function codexWindowsBridgeCheck(coordRoot: string | null): Check
|
|
|
36
36
|
* now does not hide an intermittent Codex-to-WSL identity drop. */
|
|
37
37
|
export declare function countRecentCodexMidFlightOnboardings(coordRoot: string, nowMs?: number, windowMs?: number): number;
|
|
38
38
|
export declare function codexAuthorizationCheck(result: CodexHookAuthorizationResult): Check;
|
|
39
|
+
/**
|
|
40
|
+
* Report the `node` on PATH, which is what Node-based tools run. Under Bun,
|
|
41
|
+
* `process.versions.node` is the Node version Bun emulates, not an installed
|
|
42
|
+
* Node, so it is used only when doctor itself runs on Node and PATH has none.
|
|
43
|
+
*/
|
|
44
|
+
export declare function nodeCheck(onPath: {
|
|
45
|
+
ok: boolean;
|
|
46
|
+
out: string;
|
|
47
|
+
}, runtime: {
|
|
48
|
+
node: string;
|
|
49
|
+
bun?: string;
|
|
50
|
+
}): Check;
|
|
39
51
|
export {};
|
|
40
52
|
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AASnD,OAAO,EACL,KAAK,4BAA4B,EAElC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,mCAAmC,CAAC;AAY3C,KAAK,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAOD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAmD/E;AAED,wBAAsB,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AO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAmD/E;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,CA+BlD;AAgCD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,oBAAoB,GAAG,IAAI,EACnC,oBAAoB,SAAI,GACvB,KAAK,GAAG,IAAI,CAed;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,SAAa,EAClB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GACjC,KAAK,GAAG,IAAI,CAad;AAED,sFAAsF;AACtF,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAmB9E;AAID;mEACmE;AACnE,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,MAAM,EACjB,KAAK,SAAa,EAClB,QAAQ,SAAqC,GAC5C,MAAM,CA0CR;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,4BAA4B,GAAG,KAAK,CAoBnF;AAgHD;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACpC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtC,KAAK,CAmBP"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -345,15 +345,30 @@ function checkWorkflowAdapter(adapter) {
|
|
|
345
345
|
return { check: { name, severity: "ok", detail: `${r.out} — ${billing}` }, installed: true };
|
|
346
346
|
}
|
|
347
347
|
function checkNode() {
|
|
348
|
-
|
|
348
|
+
return nodeCheck(whichVersion("node"), process.versions);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Report the `node` on PATH, which is what Node-based tools run. Under Bun,
|
|
352
|
+
* `process.versions.node` is the Node version Bun emulates, not an installed
|
|
353
|
+
* Node, so it is used only when doctor itself runs on Node and PATH has none.
|
|
354
|
+
*/
|
|
355
|
+
export function nodeCheck(onPath, runtime) {
|
|
356
|
+
const hint = "https://nodejs.org/en/download";
|
|
357
|
+
let v = onPath.ok ? onPath.out.replace(/^v/, "") : "";
|
|
358
|
+
if (!v) {
|
|
359
|
+
if (runtime.bun) {
|
|
360
|
+
return {
|
|
361
|
+
name: "node",
|
|
362
|
+
severity: "warn",
|
|
363
|
+
detail: "not on PATH (Bun runs harnery; Node-based tools need it)",
|
|
364
|
+
hint,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
v = runtime.node;
|
|
368
|
+
}
|
|
349
369
|
const major = Number.parseInt(v.split(".")[0], 10);
|
|
350
370
|
if (Number.isNaN(major) || major < 20) {
|
|
351
|
-
return {
|
|
352
|
-
name: "node",
|
|
353
|
-
severity: "fail",
|
|
354
|
-
detail: `${v} (need ≥ 20)`,
|
|
355
|
-
hint: "https://nodejs.org/en/download",
|
|
356
|
-
};
|
|
371
|
+
return { name: "node", severity: "fail", detail: `${v} (need ≥ 20)`, hint };
|
|
357
372
|
}
|
|
358
373
|
return { name: "node", severity: "ok", detail: v };
|
|
359
374
|
}
|
|
@@ -250,12 +250,13 @@ function registerServiceCommand(governor, registry, emit) {
|
|
|
250
250
|
.action(async (opts) => {
|
|
251
251
|
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
252
252
|
let status = requestGovernorServiceStop(coordRoot);
|
|
253
|
+
const signal = { signal_sent: status.signal_sent, signal_verdict: status.signal_verdict };
|
|
253
254
|
const deadline = Date.now() + 5_000;
|
|
254
255
|
while (status.running && Date.now() < deadline) {
|
|
255
256
|
await delay(50);
|
|
256
257
|
status = readGovernorServiceStatus(coordRoot);
|
|
257
258
|
}
|
|
258
|
-
emitServiceStatus(status, opts.json, emit);
|
|
259
|
+
emitServiceStatus({ ...status, ...signal }, opts.json, emit);
|
|
259
260
|
});
|
|
260
261
|
});
|
|
261
262
|
service
|
|
@@ -372,19 +373,30 @@ function emitServiceStatus(status, json, emit) {
|
|
|
372
373
|
emit.data(status);
|
|
373
374
|
return;
|
|
374
375
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
376
|
+
const state = status.liveness === "unknown"
|
|
377
|
+
? "unknown"
|
|
378
|
+
: !status.config && !status.record
|
|
379
|
+
? "unconfigured"
|
|
380
|
+
: status.running
|
|
381
|
+
? (status.record?.state ?? "running")
|
|
382
|
+
: status.stale
|
|
383
|
+
? "stale"
|
|
384
|
+
: "stopped";
|
|
384
385
|
const lines = [
|
|
385
386
|
`governor service: ${state}`,
|
|
387
|
+
`generation: ${status.generation}`,
|
|
388
|
+
`liveness: ${status.liveness}`,
|
|
389
|
+
`running build: ${status.running_build ? `${status.running_build.version} (${status.running_build.revision})` : "unknown"}`,
|
|
390
|
+
`installed build: ${status.installed_build.version} (${status.installed_build.revision})`,
|
|
391
|
+
`build: ${status.build_status}`,
|
|
386
392
|
`goals: ${status.config?.goal_ids.join(", ") || "none"}`,
|
|
387
393
|
];
|
|
394
|
+
if (status.signal_sent !== undefined) {
|
|
395
|
+
lines.push(`signal sent: ${status.signal_sent ? "yes" : "no"} (${status.signal_verdict})`);
|
|
396
|
+
if (!status.signal_sent && status.record?.state !== "stopped") {
|
|
397
|
+
lines.push("The durable stop request remains for the service to read.");
|
|
398
|
+
}
|
|
399
|
+
}
|
|
388
400
|
if (status.record) {
|
|
389
401
|
lines.push(`pid: ${status.record.pid} on ${status.record.host}`);
|
|
390
402
|
lines.push(`heartbeat: ${status.record.heartbeat_at}`);
|
package/dist/commands/inbox.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
2
|
import type { EmitContext } from "../commander.js";
|
|
3
3
|
import type { HarneryInboxService } from "../core/inbox/service.js";
|
|
4
|
-
export declare function registerInboxCommand(program: Command, emit: EmitContext, service?: HarneryInboxService): void;
|
|
4
|
+
export declare function registerInboxCommand(program: Command, emit: EmitContext, service?: HarneryInboxService, defaultRecipient?: () => string): void;
|
|
5
5
|
//# sourceMappingURL=inbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/commands/inbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/commands/inbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,mBAAmB,EAC7B,gBAAgB,CAAC,EAAE,MAAM,MAAM,GAC9B,IAAI,CA6EN"}
|
package/dist/commands/inbox.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { watchInbox } from "../core/inbox/watcher.js";
|
|
2
|
+
export function registerInboxCommand(program, emit, service, defaultRecipient) {
|
|
2
3
|
const inbox = program.command("inbox").description("Inspect private coordination inbox state");
|
|
3
4
|
inbox
|
|
4
|
-
.command("list
|
|
5
|
+
.command("list [recipient]")
|
|
5
6
|
.option("--json", "Emit stable JSON")
|
|
6
7
|
.action((recipient, options) => {
|
|
7
8
|
run(emit, () => {
|
|
9
|
+
recipient = requireRecipient(recipient, defaultRecipient);
|
|
8
10
|
const rows = requireInboxService(service)
|
|
9
11
|
.pending(recipient)
|
|
10
12
|
.map((record) => ({
|
|
@@ -14,6 +16,7 @@ export function registerInboxCommand(program, emit, service) {
|
|
|
14
16
|
created_at: record.created_at,
|
|
15
17
|
body_bytes: record.body_bytes,
|
|
16
18
|
body: record.body,
|
|
19
|
+
state: "pending",
|
|
17
20
|
}));
|
|
18
21
|
if (options.json) {
|
|
19
22
|
emit.config({ format: "json" });
|
|
@@ -37,6 +40,56 @@ export function registerInboxCommand(program, emit, service) {
|
|
|
37
40
|
emit.rows([status]);
|
|
38
41
|
});
|
|
39
42
|
});
|
|
43
|
+
inbox
|
|
44
|
+
.command("watch [recipient]")
|
|
45
|
+
.description("Surface pending messages for this instance; poll history until timeout")
|
|
46
|
+
.option("--timeout <seconds>", "Stop after this many seconds", "60")
|
|
47
|
+
.option("--json", "Emit one JSON record per surfaced message")
|
|
48
|
+
.action(async (recipient, options) => {
|
|
49
|
+
let controller;
|
|
50
|
+
let timer;
|
|
51
|
+
try {
|
|
52
|
+
const instanceId = requireRecipient(recipient, defaultRecipient);
|
|
53
|
+
const inboxService = requireInboxService(service);
|
|
54
|
+
const seconds = Number(options.timeout);
|
|
55
|
+
if (!Number.isFinite(seconds) || seconds <= 0 || seconds > 3600)
|
|
56
|
+
throw new Error("--timeout must be greater than 0 and at most 3600 seconds");
|
|
57
|
+
controller = new AbortController();
|
|
58
|
+
timer = setTimeout(() => controller.abort(), seconds * 1000);
|
|
59
|
+
if (options.json)
|
|
60
|
+
emit.config({ format: "json" });
|
|
61
|
+
for await (const message of watchInbox(inboxService, instanceId, {
|
|
62
|
+
signal: controller.signal,
|
|
63
|
+
})) {
|
|
64
|
+
const row = { ...message, state: "surfaced" };
|
|
65
|
+
if (options.json)
|
|
66
|
+
emit.data(row);
|
|
67
|
+
else
|
|
68
|
+
emit.rows([row]);
|
|
69
|
+
// An output error leaves this ID pending for prompt recovery.
|
|
70
|
+
await new Promise((resolve, reject) => process.stdout.write("", (error) => (error ? reject(error) : resolve())));
|
|
71
|
+
inboxService.acknowledgeSurface(instanceId, [message.message_id]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
emit.error({
|
|
76
|
+
code: "inbox_failed",
|
|
77
|
+
message: error instanceof Error ? error.message : String(error),
|
|
78
|
+
});
|
|
79
|
+
emit.setExitCode(1);
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
if (timer)
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
controller?.abort();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function requireRecipient(recipient, fallback) {
|
|
89
|
+
const resolved = recipient ?? fallback?.();
|
|
90
|
+
if (!resolved)
|
|
91
|
+
throw new Error("recipient instance is required outside an agent session");
|
|
92
|
+
return resolved;
|
|
40
93
|
}
|
|
41
94
|
function requireInboxService(service) {
|
|
42
95
|
if (!service)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rm.d.ts","sourceRoot":"","sources":["../../src/commands/rm.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"rm.d.ts","sourceRoot":"","sources":["../../src/commands/rm.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAW1E,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CAsHN"}
|