harnery 0.46.1 → 0.47.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.
Files changed (176) hide show
  1. package/README.md +24 -0
  2. package/bin/README.md +10 -0
  3. package/bin/agent-coord.mjs +3 -0
  4. package/bin/agent-hook.mjs +3 -0
  5. package/bin/harn.mjs +3 -0
  6. package/bin/run.mjs +43 -0
  7. package/dist/commander.d.ts +18 -6
  8. package/dist/commander.d.ts.map +1 -1
  9. package/dist/commander.js +74 -2
  10. package/dist/commands/agents.d.ts +25 -0
  11. package/dist/commands/agents.d.ts.map +1 -1
  12. package/dist/commands/agents.js +70 -27
  13. package/dist/commands/autoupdate.d.ts +12 -0
  14. package/dist/commands/autoupdate.d.ts.map +1 -0
  15. package/dist/commands/autoupdate.js +190 -0
  16. package/dist/commands/computer.d.ts +45 -0
  17. package/dist/commands/computer.d.ts.map +1 -0
  18. package/dist/commands/computer.js +509 -0
  19. package/dist/commands/docs.js +3 -1
  20. package/dist/commands/fetch.js +11 -1
  21. package/dist/commands/grep.d.ts +72 -0
  22. package/dist/commands/grep.d.ts.map +1 -1
  23. package/dist/commands/grep.js +200 -47
  24. package/dist/commands/init.d.ts.map +1 -1
  25. package/dist/commands/init.js +15 -9
  26. package/dist/commands/rm.js +2 -2
  27. package/dist/commands/web.d.ts.map +1 -1
  28. package/dist/commands/web.js +2 -0
  29. package/dist/core/agents/canonical-emit.d.ts.map +1 -1
  30. package/dist/core/agents/canonical-emit.js +2 -3
  31. package/dist/core/agents/coord-bin.d.ts +3 -0
  32. package/dist/core/agents/coord-bin.d.ts.map +1 -1
  33. package/dist/core/agents/coord-bin.js +6 -0
  34. package/dist/core/agents/coord-client.d.ts.map +1 -1
  35. package/dist/core/agents/coord-client.js +6 -2
  36. package/dist/core/agents/render/prompt-context.d.ts +55 -7
  37. package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
  38. package/dist/core/agents/render/prompt-context.js +122 -48
  39. package/dist/core/agents/state/proc-start.d.ts +3 -1
  40. package/dist/core/agents/state/proc-start.d.ts.map +1 -1
  41. package/dist/core/agents/state/proc-start.js +26 -4
  42. package/dist/core/autoupdate/engine.d.ts +97 -0
  43. package/dist/core/autoupdate/engine.d.ts.map +1 -0
  44. package/dist/core/autoupdate/engine.js +548 -0
  45. package/dist/core/autoupdate/fingerprint.d.ts +16 -0
  46. package/dist/core/autoupdate/fingerprint.d.ts.map +1 -0
  47. package/dist/core/autoupdate/fingerprint.js +73 -0
  48. package/dist/core/autoupdate/git.d.ts +30 -0
  49. package/dist/core/autoupdate/git.d.ts.map +1 -0
  50. package/dist/core/autoupdate/git.js +82 -0
  51. package/dist/core/autoupdate/index.d.ts +6 -0
  52. package/dist/core/autoupdate/index.d.ts.map +1 -0
  53. package/dist/core/autoupdate/index.js +4 -0
  54. package/dist/core/autoupdate/state.d.ts +59 -0
  55. package/dist/core/autoupdate/state.d.ts.map +1 -0
  56. package/dist/core/autoupdate/state.js +214 -0
  57. package/dist/core/autoupdate/types.d.ts +113 -0
  58. package/dist/core/autoupdate/types.d.ts.map +1 -0
  59. package/dist/core/autoupdate/types.js +35 -0
  60. package/dist/core/config.d.ts +53 -1
  61. package/dist/core/config.d.ts.map +1 -1
  62. package/dist/core/config.js +114 -1
  63. package/dist/core/events/v3/bootstrap.js +1 -0
  64. package/dist/core/events/v3/runtime-build.d.ts.map +1 -1
  65. package/dist/core/events/v3/runtime-build.js +1 -0
  66. package/dist/core/hooks/adapter/wiring.d.ts +12 -2
  67. package/dist/core/hooks/adapter/wiring.d.ts.map +1 -1
  68. package/dist/core/hooks/adapter/wiring.js +38 -8
  69. package/dist/core/hooks/autoupdate-cue.d.ts +29 -0
  70. package/dist/core/hooks/autoupdate-cue.d.ts.map +1 -0
  71. package/dist/core/hooks/autoupdate-cue.js +53 -0
  72. package/dist/core/hooks/cli.js +28 -3
  73. package/dist/core/hooks/effects/index.js +4 -4
  74. package/dist/core/hooks/resolve/coord-root.js +1 -0
  75. package/dist/core/semantic/contract.d.ts +3 -3
  76. package/dist/core/semantic/service.d.ts.map +1 -1
  77. package/dist/core/semantic/service.js +4 -2
  78. package/dist/core/storage/modes.d.ts +1 -1
  79. package/dist/core/storage/modes.d.ts.map +1 -1
  80. package/dist/core/storage/modes.js +5 -1
  81. package/dist/core/workflow/durable-record.d.ts +2 -0
  82. package/dist/core/workflow/durable-record.d.ts.map +1 -1
  83. package/dist/core/workflow/durable-record.js +13 -1
  84. package/dist/core/workflow/engine.js +4 -0
  85. package/dist/core/workflow/spawn-claude.d.ts +7 -0
  86. package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
  87. package/dist/core/workflow/spawn-claude.js +16 -4
  88. package/dist/core/workflow/specialists.d.ts.map +1 -1
  89. package/dist/core/workflow/specialists.js +1 -0
  90. package/dist/core/workflow/types.d.ts +10 -0
  91. package/dist/core/workflow/types.d.ts.map +1 -1
  92. package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
  93. package/dist/core/workflow/workspaces/leases.js +1 -9
  94. package/dist/lib/computer/cua.d.ts +50 -0
  95. package/dist/lib/computer/cua.d.ts.map +1 -0
  96. package/dist/lib/computer/cua.js +474 -0
  97. package/dist/lib/computer/host.d.ts +19 -0
  98. package/dist/lib/computer/host.d.ts.map +1 -0
  99. package/dist/lib/computer/host.js +72 -0
  100. package/dist/lib/computer/lease.d.ts +13 -0
  101. package/dist/lib/computer/lease.d.ts.map +1 -0
  102. package/dist/lib/computer/lease.js +269 -0
  103. package/dist/lib/computer/types.d.ts +163 -0
  104. package/dist/lib/computer/types.d.ts.map +1 -0
  105. package/dist/lib/computer/types.js +10 -0
  106. package/dist/lib/docs-metadata-v2.d.ts.map +1 -1
  107. package/dist/lib/docs-metadata-v2.js +6 -5
  108. package/dist/lib/exec.d.ts.map +1 -1
  109. package/dist/lib/exec.js +1 -0
  110. package/dist/lib/guarded-remove.d.ts.map +1 -1
  111. package/dist/lib/guarded-remove.js +5 -4
  112. package/dist/lib/headless/index.d.ts +33 -0
  113. package/dist/lib/headless/index.d.ts.map +1 -1
  114. package/dist/lib/headless/index.js +38 -2
  115. package/dist/lib/http/client.d.ts +2 -9
  116. package/dist/lib/http/client.d.ts.map +1 -1
  117. package/dist/lib/http/client.js +30 -9
  118. package/dist/lib/instructions/apply.d.ts +9 -0
  119. package/dist/lib/instructions/apply.d.ts.map +1 -1
  120. package/dist/lib/instructions/apply.js +92 -14
  121. package/dist/lib/instructions/git-hooks.d.ts.map +1 -1
  122. package/dist/lib/instructions/git-hooks.js +8 -4
  123. package/dist/lib/instructions/templates.d.ts +11 -0
  124. package/dist/lib/instructions/templates.d.ts.map +1 -1
  125. package/dist/lib/instructions/templates.js +81 -1
  126. package/package.json +5 -5
  127. package/schemas/config.schema.json +89 -1
  128. package/src/commander.ts +98 -8
  129. package/src/commands/agents.ts +100 -32
  130. package/src/commands/autoupdate.ts +250 -0
  131. package/src/commands/computer.ts +682 -0
  132. package/src/commands/docs.ts +3 -1
  133. package/src/commands/fetch.ts +11 -1
  134. package/src/commands/grep.ts +274 -59
  135. package/src/commands/init.ts +17 -7
  136. package/src/commands/rm.ts +2 -2
  137. package/src/commands/web.ts +2 -0
  138. package/src/core/agents/canonical-emit.ts +2 -3
  139. package/src/core/agents/coord-bin.ts +30 -0
  140. package/src/core/agents/coord-client.ts +6 -2
  141. package/src/core/agents/render/prompt-context.ts +152 -53
  142. package/src/core/agents/state/proc-start.ts +29 -5
  143. package/src/core/autoupdate/engine.ts +691 -0
  144. package/src/core/autoupdate/fingerprint.ts +89 -0
  145. package/src/core/autoupdate/git.ts +120 -0
  146. package/src/core/autoupdate/index.ts +29 -0
  147. package/src/core/autoupdate/state.ts +269 -0
  148. package/src/core/autoupdate/types.ts +135 -0
  149. package/src/core/config.ts +142 -1
  150. package/src/core/events/v3/bootstrap.ts +1 -0
  151. package/src/core/events/v3/runtime-build.ts +1 -0
  152. package/src/core/hooks/adapter/wiring.ts +51 -6
  153. package/src/core/hooks/autoupdate-cue.ts +72 -0
  154. package/src/core/hooks/cli.ts +27 -1
  155. package/src/core/hooks/effects/index.ts +4 -4
  156. package/src/core/hooks/resolve/coord-root.ts +1 -0
  157. package/src/core/semantic/service.ts +6 -2
  158. package/src/core/storage/modes.ts +7 -1
  159. package/src/core/workflow/durable-record.ts +15 -1
  160. package/src/core/workflow/engine.ts +3 -0
  161. package/src/core/workflow/spawn-claude.ts +16 -4
  162. package/src/core/workflow/specialists.ts +1 -0
  163. package/src/core/workflow/types.ts +10 -0
  164. package/src/core/workflow/workspaces/leases.ts +1 -9
  165. package/src/lib/computer/cua.ts +572 -0
  166. package/src/lib/computer/host.ts +87 -0
  167. package/src/lib/computer/lease.ts +299 -0
  168. package/src/lib/computer/types.ts +177 -0
  169. package/src/lib/docs-metadata-v2.ts +24 -5
  170. package/src/lib/exec.ts +1 -0
  171. package/src/lib/guarded-remove.ts +5 -3
  172. package/src/lib/headless/index.ts +66 -2
  173. package/src/lib/http/client.ts +33 -19
  174. package/src/lib/instructions/apply.ts +100 -12
  175. package/src/lib/instructions/git-hooks.ts +8 -4
  176. package/src/lib/instructions/templates.ts +95 -1
package/README.md CHANGED
@@ -47,6 +47,30 @@ harn doctor # optional: one-time runtime + dependency check
47
47
 
48
48
  > **npm gives you the engine + CLI.** The `web/` dashboard and the `docs/` site live in the git repo, not the npm package (which is the CLI + coord engine: `bin`, `dist`, `src`, `schemas`). To run the dashboard, `git clone` the repo, `bun install`, and `harn web up` from there, pointing it at your project with `--coord-root <dir>` (or just run it from inside the project). `harn web up` prints these exact steps if you invoke it without the clone present.
49
49
 
50
+ ### Native Windows source checkout
51
+
52
+ For source development on Windows, install Node.js 20.19+ and Bun, then use
53
+ PowerShell 7:
54
+
55
+ ```powershell
56
+ bun install --frozen-lockfile
57
+ Push-Location web
58
+ bun install --frozen-lockfile
59
+ Pop-Location
60
+ npm link --ignore-scripts --offline --package-lock=false
61
+ harn init --project-root 'C:\path\to\project' --adapter 'claude-code,codex'
62
+ harn web up --coord-root 'C:\path\to\project'
63
+ ```
64
+
65
+ The [native launchers](bin/README.md) run source through Bun and need no Bash.
66
+ The dashboard binds to loopback. Codex hook commands still need the harness's
67
+ separate approval before a new session can execute them.
68
+
69
+ Windows state inherits NTFS ACLs: POSIX mode bits cannot prove those access
70
+ rights. File contents are still flushed before publication; Windows does not
71
+ support the directory fsync used for POSIX directory-entry durability. Atomic
72
+ file publication and lease ownership checks remain in place.
73
+
50
74
  ## Uninstall
51
75
 
52
76
  Two layers. **Unwire a project** (keeps `.harnery/` history by default; on a terminal it asks before deleting it):
package/bin/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # Executables
2
+
3
+ | File | Purpose |
4
+ | --- | --- |
5
+ | `harn`, `agent-hook`, `agent-coord` | Existing Bash entrypoints for POSIX callers |
6
+ | `harn.mjs`, `agent-hook.mjs`, `agent-coord.mjs` | Node entrypoints used by npm on all platforms |
7
+ | `run.mjs` | Starts Bun source or the built Node bundle without a shell |
8
+
9
+ The native entrypoints preserve arguments, stdin, and the child exit code.
10
+ Source checkouts require Bun; the published package also includes `dist/`.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { launch } from "./run.mjs";
3
+ launch("agent-coord");
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { launch } from "./run.mjs";
3
+ launch("agent-hook");
package/bin/harn.mjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { launch } from "./run.mjs";
3
+ launch("harn");
package/bin/run.mjs ADDED
@@ -0,0 +1,43 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { existsSync } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { delimiter, dirname, join, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
8
+ const entries = {
9
+ harn: "cli",
10
+ "agent-hook": "core/hooks/cli",
11
+ "agent-coord": "core/agents/cli",
12
+ };
13
+
14
+ export function launch(name, args = process.argv.slice(2)) {
15
+ const entry = entries[name];
16
+ if (!entry) throw new Error(`Unknown Harnery executable: ${name}`);
17
+ const executable = process.platform === "win32" ? "bun.exe" : "bun";
18
+ const candidates = [
19
+ ...(process.versions.bun ? [process.execPath] : []),
20
+ ...(process.env.PATH ?? "").split(delimiter).map((dir) => join(dir, executable)),
21
+ join(process.env.BUN_INSTALL || join(homedir(), ".bun"), "bin", executable),
22
+ // npm's Windows shim is a .cmd file; spawn the installed binary directly.
23
+ join(dirname(process.execPath), "node_modules", "bun", "bin", executable),
24
+ ];
25
+ const bun = candidates.find((candidate) => existsSync(candidate));
26
+ const built = join(root, "dist", `${entry}.js`);
27
+ const runtime = bun || process.execPath;
28
+ const script = bun ? join(root, "src", `${entry}.ts`) : built;
29
+ if (!existsSync(script)) {
30
+ console.error(`${name}: install Bun to run this source checkout, or build dist/ for Node.`);
31
+ process.exitCode = 1;
32
+ return;
33
+ }
34
+ const child = spawnSync(runtime, [script, ...args], { stdio: "inherit", windowsHide: true });
35
+ if (child.error) console.error(`${name}: ${child.error.message}`);
36
+ process.exitCode = child.status ?? 1;
37
+ }
38
+
39
+ // Native hook commands keep the executable name as an argument so managed
40
+ // hook inspection can identify the same `agent-hook <event>` contract.
41
+ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
42
+ launch(process.argv[2], process.argv.slice(3));
43
+ }
@@ -56,6 +56,13 @@ export interface EnvCheck {
56
56
  * core ships only the generic sections (runtimes, docker, git).
57
57
  */
58
58
  export type EnvSection = () => Promise<EnvCheck[]>;
59
+ /** Verdict from `HarneryProgramContext.headerPolicy` for one caller header. */
60
+ export type FetchHeaderDecision = {
61
+ allow: true;
62
+ } | {
63
+ allow: false;
64
+ message: string;
65
+ };
59
66
  export interface HarneryProgramContext {
60
67
  /** Project name (e.g., "my-monorepo"). Used in user-facing log lines + telemetry tags. */
61
68
  projectName?: string;
@@ -96,6 +103,17 @@ export interface HarneryProgramContext {
96
103
  * zones behind a WAF). harn standalone skips the callback entirely.
97
104
  */
98
105
  extraHeaders?: (url: string) => Record<string, string>;
106
+ /**
107
+ * Optional check run on every header the caller passed to `fetch` with
108
+ * `-H`, before any request leaves the process. Returning
109
+ * `{ allow: false, message }` stops the run with that message and a
110
+ * nonzero exit; there is no flag to override it. Only caller headers are
111
+ * checked: the default User-Agent and anything `extraHeaders` adds are the
112
+ * host's own. Redirect hops are not re-checked because a cross-origin hop
113
+ * already drops every caller header except a few browser headers. The
114
+ * message must not echo the header value. harn standalone checks nothing.
115
+ */
116
+ headerPolicy?: (host: string, name: string, value: string) => FetchHeaderDecision;
99
117
  /**
100
118
  * Optional callback that returns extra cookies to persist into the shared
101
119
  * jar before `fetch` / `browse` attach it. Runs only when a jar is in
@@ -105,12 +123,6 @@ export interface HarneryProgramContext {
105
123
  * harn standalone skips the callback entirely.
106
124
  */
107
125
  extraCookies?: import("./lib/cookies/index.js").ExtraCookies;
108
- /**
109
- * When it returns true for a run, `fetch` follows redirects itself so the
110
- * cookie header, `extraHeaders`, and Set-Cookie persistence apply to every
111
- * hop instead of only the first request.
112
- */
113
- clientRedirects?: () => boolean;
114
126
  /**
115
127
  * Called once per `browse` run. Returns the guard that inspects that
116
128
  * session's live cookies before each request, after each response, and at
@@ -1 +1 @@
1
- {"version":3,"file":"commander.d.ts","sourceRoot":"","sources":["../src/commander.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAEhC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,C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ED
@@ -14,11 +14,12 @@
14
14
  * Each subdirectory under src/commands/ exports its `register…` function
15
15
  * (Commander pattern).
16
16
  */
17
- import { readFileSync } from "node:fs";
18
- import { dirname, join } from "node:path";
17
+ import { existsSync, readFileSync } from "node:fs";
18
+ import { dirname, join, resolve } from "node:path";
19
19
  import { fileURLToPath } from "node:url";
20
20
  import { Command } from "commander";
21
21
  import { loadAllLazyCommands, registerLazyCommandBundles, } from "./lazy-commands.js";
22
+ import { coordEnv } from "./lib/env.js";
22
23
  export { loadAllLazyCommands, loadLazyCommand, onLazyCommandLoaded, registerLazyCommandBundles, } from "./lazy-commands.js";
23
24
  export const defaultEmit = {
24
25
  config() {
@@ -96,8 +97,77 @@ export function createHarneryProgram(opts = {}) {
96
97
  .version(readVersion());
97
98
  const bundles = harneryCommandBundles({ emit, context: opts.context, binName }).filter((bundle) => bundle.commands.every((command) => !skip.has(commandName(command.command))));
98
99
  registerLazyCommandBundles(program, bundles);
100
+ program.hook("preAction", async (_root, actionCommand) => {
101
+ await triggerAutoUpdate(actionCommand, opts.context);
102
+ });
99
103
  return program;
100
104
  }
105
+ let autoUpdateTriggered = false;
106
+ /** Top-level command name below the program for a Commander action command. */
107
+ function topLevelCommandName(command) {
108
+ let current = command;
109
+ while (current.parent?.parent)
110
+ current = current.parent;
111
+ return current.name();
112
+ }
113
+ /** Nearest enclosing directory carrying `.harnery/`, without spawning Git. */
114
+ function cheapCoordRoot(context) {
115
+ const override = coordEnv("COORD_ROOT_OVERRIDE");
116
+ if (override)
117
+ return override;
118
+ if (context?.resolveCoordRoot)
119
+ return context.resolveCoordRoot();
120
+ const starts = [process.env.CLAUDE_PROJECT_DIR, process.cwd()].filter((dir) => typeof dir === "string" && dir.length > 0);
121
+ for (const start of starts) {
122
+ let dir = resolve(start);
123
+ while (true) {
124
+ if (existsSync(join(dir, ".harnery")))
125
+ return dir;
126
+ const parent = dirname(dir);
127
+ if (parent === dir)
128
+ break;
129
+ dir = parent;
130
+ }
131
+ }
132
+ return null;
133
+ }
134
+ /**
135
+ * Host CLI activity fires the project self-update check (ADR 0229) once per
136
+ * process. A project without an `autoUpdate` section pays a directory walk
137
+ * and one small file read; the engine module loads only when the section is
138
+ * present. Never throws and never delays the command beyond the tick's stat.
139
+ */
140
+ async function triggerAutoUpdate(actionCommand, context) {
141
+ if (autoUpdateTriggered)
142
+ return;
143
+ autoUpdateTriggered = true;
144
+ try {
145
+ if (coordEnv("AUTOUPDATE_CHILD") === "1")
146
+ return;
147
+ if (topLevelCommandName(actionCommand) === "autoupdate")
148
+ return;
149
+ const root = cheapCoordRoot(context);
150
+ if (!root)
151
+ return;
152
+ let text;
153
+ try {
154
+ text = readFileSync(join(root, ".harnery", "config.jsonc"), "utf8");
155
+ }
156
+ catch {
157
+ return;
158
+ }
159
+ if (!text.includes('"autoUpdate"'))
160
+ return;
161
+ const { readAutoUpdateConfig } = await import("./core/config.js");
162
+ if (readAutoUpdateConfig(root)?.enabled !== true)
163
+ return;
164
+ const { autoUpdateTick } = await import("./core/autoupdate/index.js");
165
+ autoUpdateTick(root);
166
+ }
167
+ catch {
168
+ // Self-update is best effort; the user's command always runs.
169
+ }
170
+ }
101
171
  function lazy(command, description, load, options = {}) {
102
172
  return { commands: [{ command, description, ...options }], load };
103
173
  }
@@ -130,6 +200,8 @@ function harneryCommandBundles({ emit, context, binName, }) {
130
200
  lazy("qa-record <target>", "Record hand-performed page QA as a standard result document: same schema, run identity, stage timings, and freshness guarantees as qa-run, marked evidence_source manual so it can report a defect but never a pass.", async (program) => (await import("./commands/qa-record.js")).registerQaRecordCommand(program, emit, context), { hasOptions: true }),
131
201
  lazy("qa-status [path]", "Report a qa-run's live state (queued/launching/running/completed/dead) from its run-status.json, PID liveness, and result document; --wait reconnects to a detached run and exits with its verdict; --queue shows the machine-wide browser-qa admission queue.", async (program) => (await import("./commands/qa-status.js")).registerQaStatusCommand(program, emit, context), { hasOptions: true }),
132
202
  lazy("admission", "Machine-wide admission control for heavy jobs: `admission run --resource <name> -- <command…>` waits for a FIFO slot then runs the command; `admission status` lists holders and waiters per resource.", async (program) => (await import("./commands/admission.js")).registerAdmissionCommand(program, emit)),
203
+ lazy("computer", `Opt-in desktop control through a pinned desktop driver: \`computer status\`, \`install\`, \`up\`, \`call <tool> [json]\` under a desktop lease shared by every agent on the machine. Start with \`${binName} computer status\`.`, async (program) => (await import("./commands/computer.js")).registerComputerCommand(program, emit, binName)),
204
+ lazy("autoupdate", `Activity-fired project self-update: \`autoupdate status\`, \`check\`, \`run\`. Configure steps under \`autoUpdate\` in .harnery/config.jsonc; start with \`${binName} autoupdate status\`.`, async (program) => (await import("./commands/autoupdate.js")).registerAutoUpdateCommand(program, emit, binName)),
133
205
  lazy("browse-session", "Control an opted-in headed browse session through an owner-only descriptor", async (program) => (await import("./commands/browse-session.js")).registerBrowseSessionCommand(program, emit)),
134
206
  lazy("browse-ai <url>", `agent-browser (Vercel Labs) wrapper: accessibility-tree snapshots with element refs (@e1, @e2) for LLM consumption. Daemon-mode: successive calls reuse the same browser instance. Sister to ${binName} browse (Playwright).`, async (program) => (await import("./commands/browse-ai.js")).registerBrowseAiCommand(program, emit, context), { hasOptions: true }),
135
207
  lazy("webview <url>", `Lightweight headless page probe through Bun.WebView (experimental, Bun 1.4+). Fresh ephemeral browser per call; use ${binName} browse for login, cookies, HAR, and QA.`, async (program) => (await import("./commands/webview.js")).registerWebviewCommand(program, emit, binName), { hasOptions: true }),
@@ -38,6 +38,31 @@ export declare function coordHelperOpts(root: string): {
38
38
  export { nativeSessionIdentity };
39
39
  export declare function registerAgentsCommand(program: Command, emitParam: EmitContext, programContext?: HarneryProgramContext, binName?: string): void;
40
40
  export declare function registerCouncilCommands(parent: Command): void;
41
+ /**
42
+ * Rows of the status box. The compact default carries what an operator acts
43
+ * on (task, lifecycle, files held, live peers, time, with the turn duration
44
+ * beside the time); diagnostic rows appear only when they report a problem.
45
+ * `--full` restores every row. The Stop hook detects the box by its
46
+ * `┌─ agent-` title, never by a row, so trimming rows cannot break it.
47
+ */
48
+ export declare function statusBoxRows(input: {
49
+ full: boolean;
50
+ session: string;
51
+ turn: string | null;
52
+ changes: string;
53
+ task: string;
54
+ activity: string;
55
+ lifecycle: string;
56
+ parent: string;
57
+ parentProblem: boolean;
58
+ context: string;
59
+ contextProblem: boolean;
60
+ resources: string;
61
+ resourcesProblem: boolean;
62
+ files: string;
63
+ peers: string;
64
+ time: string;
65
+ }): Array<[string, string]>;
41
66
  type StatusPeerHeartbeat = {
42
67
  instance_id: string;
43
68
  last_heartbeat: string;
@@ -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;AAQjC,OAAO,EAKL,KAAK,4BAA4B,EAClC,MAAM,wCAAwC,CAAC;AAMhD,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,0CAA0C,CAAC;AASlD,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,0CAA0C,CAAC;AAkBlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AA8BjE,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,gCAAgC,CAAC;AAqExC;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;CAAE,CAErF;AAgFD,OAAO,EAAE,qBAAqB,EAAE,CAAC;AASjC,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,WAAW,EACtB,cAAc,CAAC,EAAE,qBAAqB,EACtC,OAAO,S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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;AA4xBD,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,oBAAoB,GAAG,MAAM,CAI/E;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,mBAAmB,GAAG,MAAM,CAiBjF"}
@@ -16,7 +16,7 @@ import { spawnSync } from "node:child_process";
16
16
  import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
17
17
  import { tmpdir } from "node:os";
18
18
  import { basename, join, resolve } from "node:path";
19
- import { coordBinPath } from "../core/agents/coord-bin.js";
19
+ import { coordBinPath, spawnCoordBinSync } 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";
@@ -174,8 +174,9 @@ export function registerAgentsCommand(program, emitParam, programContext, binNam
174
174
  });
175
175
  cmd
176
176
  .command("status")
177
- .description("End-of-turn status box (name + session age + files held + peer count)")
177
+ .description("End-of-turn status box (name, task, lifecycle, files held, live peers, time; diagnostics only when they report a problem)")
178
178
  .option("--json", "JSON output instead of the box")
179
+ .option("--full", "Print every diagnostic row (session age, changes, activity, parent, context, resources)")
179
180
  .option("--end-turn", "Treat this as the turn's closing status: issue the box only when this session's held paths are committed and their repositories are pushed")
180
181
  .option("--end-session", "After the closing status, durably request an authoritative session end as soon as this exact turn closes (requires --end-turn)")
181
182
  .option("--session-id <id>", "Lookup the V3 generation by session_id directly, bypassing the ppid walk. " +
@@ -1349,7 +1350,7 @@ function ensureAdapterSession(root) {
1349
1350
  ? { composer_mode: "agent", is_background_agent: false }
1350
1351
  : { source: "resume" }),
1351
1352
  });
1352
- spawnSync("bash", [agentHook, "session-start", "--adapter", bootstrap.adapter], {
1353
+ spawnCoordBinSync(agentHook, ["session-start", "--adapter", bootstrap.adapter], {
1353
1354
  input: payload,
1354
1355
  cwd: root,
1355
1356
  encoding: "utf8",
@@ -1404,7 +1405,7 @@ function runReleaseClaim(path) {
1404
1405
  if (path.startsWith(`${root}/`))
1405
1406
  canonical = path.slice(root.length + 1);
1406
1407
  const helper = agentCoordOrExit(root);
1407
- const result = spawnSync(helper, ["release-claim", myOwner, canonical], {
1408
+ const result = spawnCoordBinSync(helper, ["release-claim", myOwner, canonical], {
1408
1409
  encoding: "utf8",
1409
1410
  ...coordHelperOpts(root),
1410
1411
  });
@@ -1455,7 +1456,7 @@ function runSetTask(task, opts) {
1455
1456
  : null;
1456
1457
  // Heartbeat mutation goes through agent-coord (atomic temp+rename).
1457
1458
  const helper = agentCoordOrExit(root);
1458
- const result = spawnSync(helper, ["set-task", myOwner, task], {
1459
+ const result = spawnCoordBinSync(helper, ["set-task", myOwner, task], {
1459
1460
  encoding: "utf8",
1460
1461
  ...coordHelperOpts(root),
1461
1462
  });
@@ -1954,25 +1955,29 @@ function runStatus(opts) {
1954
1955
  emit.data(data);
1955
1956
  return;
1956
1957
  }
1957
- const rows = [
1958
- ["session", formatAge(ageSecs)],
1959
- ...(turnElapsed ? [["turn", turnElapsed.value]] : []),
1960
- ["changes", turnChanges.value],
1961
- ["activity", activityOf(hb)],
1962
- ["lifecycle", lifecycleLabel(hb)],
1963
- ["parent", describeParentReference(data.parent_reference)],
1964
- ["context", ctxStr],
1965
- ["resources", formatResourceSummary(resources)],
1966
- ["files", filesStr],
1967
- ["peers", peersStr],
1968
- ["time", timeStr],
1969
- ];
1970
- // Task gets full text; formatBox word-wraps to MAX_BOX_CONTENT_WIDTH. It sits
1971
- // directly above `activity`, which keeps it under the session/turn clocks
1972
- // whether or not the turn row rendered.
1973
- if (hb.task && hb.task.length > 0) {
1974
- rows.splice(rows.findIndex((row) => row[0] === "activity"), 0, ["task", hb.task]);
1975
- }
1958
+ const contextPercent = !ctxUsage
1959
+ ? null
1960
+ : ctxUsage.percentOnly
1961
+ ? ctxUsage.usedPercent
1962
+ : (ctxUsage.used / ctxUsage.window) * 100;
1963
+ const rows = statusBoxRows({
1964
+ full: opts.full === true,
1965
+ session: formatAge(ageSecs),
1966
+ turn: turnElapsed?.value ?? null,
1967
+ changes: turnChanges.value,
1968
+ task: hb.task ?? "",
1969
+ activity: activityOf(hb),
1970
+ lifecycle: lifecycleLabel(hb),
1971
+ parent: describeParentReference(data.parent_reference),
1972
+ parentProblem: data.parent_reference.state === "conflict",
1973
+ context: ctxStr,
1974
+ contextProblem: contextPercent !== null && contextPercent >= STATUS_CONTEXT_WARN_PERCENT,
1975
+ resources: formatResourceSummary(resources),
1976
+ resourcesProblem: resources.assessment.state === "elevated" || resources.assessment.state === "critical",
1977
+ files: filesStr,
1978
+ peers: peersStr,
1979
+ time: timeStr,
1980
+ });
1976
1981
  if (pendingCouncils.length > 0) {
1977
1982
  // Slot the council line right before `time` so it stays in the "what's
1978
1983
  // active for me" cluster of rows. Show the first ID + count; full list
@@ -2004,6 +2009,44 @@ function runStatus(opts) {
2004
2009
  // agent runs this via Bash (no TTY) and pastes captured stdout into chat.
2005
2010
  process.stdout.write(`${formatBox(displayName, rows)}\n`); // lint-ok-emission: chat-paste path; emit.text() auto-suppresses non-TTY
2006
2011
  }
2012
+ /** Context use at which the compact status box adds its context row. */
2013
+ const STATUS_CONTEXT_WARN_PERCENT = 80;
2014
+ /**
2015
+ * Rows of the status box. The compact default carries what an operator acts
2016
+ * on (task, lifecycle, files held, live peers, time, with the turn duration
2017
+ * beside the time); diagnostic rows appear only when they report a problem.
2018
+ * `--full` restores every row. The Stop hook detects the box by its
2019
+ * `┌─ agent-` title, never by a row, so trimming rows cannot break it.
2020
+ */
2021
+ export function statusBoxRows(input) {
2022
+ const task = input.task ? [["task", input.task]] : [];
2023
+ if (input.full) {
2024
+ return [
2025
+ ["session", input.session],
2026
+ ...(input.turn ? [["turn", input.turn]] : []),
2027
+ ["changes", input.changes],
2028
+ ...task,
2029
+ ["activity", input.activity],
2030
+ ["lifecycle", input.lifecycle],
2031
+ ["parent", input.parent],
2032
+ ["context", input.context],
2033
+ ["resources", input.resources],
2034
+ ["files", input.files],
2035
+ ["peers", input.peers],
2036
+ ["time", input.time],
2037
+ ];
2038
+ }
2039
+ const rows = [...task, ["lifecycle", input.lifecycle]];
2040
+ if (input.parentProblem)
2041
+ rows.push(["parent", input.parent]);
2042
+ if (input.contextProblem)
2043
+ rows.push(["context", input.context]);
2044
+ if (input.resourcesProblem)
2045
+ rows.push(["resources", input.resources]);
2046
+ rows.push(["files", input.files], ["peers", input.peers]);
2047
+ rows.push(["time", input.turn ? `${input.time} (turn ${input.turn})` : input.time]);
2048
+ return rows;
2049
+ }
2007
2050
  function qualityForStatus(mode, snapshot) {
2008
2051
  if (mode !== "report")
2009
2052
  return null;
@@ -3745,7 +3788,7 @@ function replayAdapterSamples(adapter, root, relativeSampleDir, filter) {
3745
3788
  payloadObj.workspace_roots = [sandbox];
3746
3789
  }
3747
3790
  const subcommand = EVENT_SUBCOMMAND[event] ?? event;
3748
- const dispatch = spawnSync("bash", [agentHook, subcommand, "--adapter", adapterFlag], {
3791
+ const dispatch = spawnCoordBinSync(agentHook, [subcommand, "--adapter", adapterFlag], {
3749
3792
  cwd: sandbox,
3750
3793
  encoding: "utf8",
3751
3794
  input: JSON.stringify(payloadObj),
@@ -4240,7 +4283,7 @@ function runHeal(opts) {
4240
4283
  }
4241
4284
  // Both recovery actions are handled by the bundled agent-coord binary.
4242
4285
  const helper = agentCoordOrExit(root);
4243
- let proc = spawnSync(helper, helperArgs, {
4286
+ let proc = spawnCoordBinSync(helper, helperArgs, {
4244
4287
  encoding: "utf8",
4245
4288
  ...coordHelperOpts(root),
4246
4289
  });
@@ -4270,7 +4313,7 @@ function runHeal(opts) {
4270
4313
  : "authority_bootstrap_failed";
4271
4314
  emitHealFailure(reason, "the current native session could not establish authority; no fallback cache was accepted");
4272
4315
  }
4273
- proc = spawnSync(helper, helperArgs, {
4316
+ proc = spawnCoordBinSync(helper, helperArgs, {
4274
4317
  encoding: "utf8",
4275
4318
  ...coordHelperOpts(root),
4276
4319
  });
@@ -0,0 +1,12 @@
1
+ import type { Command } from "commander";
2
+ import type { EmitContext } from "../commander.js";
3
+ import { type AutoUpdateDeps } from "../core/autoupdate/engine.js";
4
+ import { type RunOutcome } from "../core/autoupdate/types.js";
5
+ export interface AutoUpdateCommandOptions {
6
+ /** Project root override (tests). */
7
+ root?: () => string;
8
+ deps?: AutoUpdateDeps;
9
+ }
10
+ export declare function exitCodeForOutcome(outcome: RunOutcome): number;
11
+ export declare function registerAutoUpdateCommand(program: Command, emit: EmitContext, binName: string, options?: AutoUpdateCommandOptions): void;
12
+ //# sourceMappingURL=autoupdate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoupdate.d.ts","sourceRoot":"","sources":["../../src/commands/autoupdate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,6BAA6B,CAAC;AAKrC,MAAM,WAAW,wBAAwB;IACvC,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAiBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAI9D;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,wBAA6B,GACrC,IAAI,CAiMN"}