harnery 0.12.2 → 0.14.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 (54) hide show
  1. package/README.md +2 -1
  2. package/dist/commander.d.ts.map +1 -1
  3. package/dist/commander.js +2 -0
  4. package/dist/commands/work.d.ts +4 -0
  5. package/dist/commands/work.d.ts.map +1 -0
  6. package/dist/commands/work.js +281 -0
  7. package/dist/commands/workflow.d.ts.map +1 -1
  8. package/dist/commands/workflow.js +193 -0
  9. package/dist/core/policy/types.d.ts +1 -1
  10. package/dist/core/policy/types.d.ts.map +1 -1
  11. package/dist/core/work/index.d.ts +3 -0
  12. package/dist/core/work/index.d.ts.map +1 -0
  13. package/dist/core/work/index.js +2 -0
  14. package/dist/core/work/read.d.ts +2 -0
  15. package/dist/core/work/read.d.ts.map +1 -0
  16. package/dist/core/work/read.js +1 -0
  17. package/dist/core/work/runner.d.ts +10 -0
  18. package/dist/core/work/runner.d.ts.map +1 -0
  19. package/dist/core/work/runner.js +63 -0
  20. package/dist/core/work/state.d.ts +109 -0
  21. package/dist/core/work/state.d.ts.map +1 -0
  22. package/dist/core/work/state.js +698 -0
  23. package/dist/core/workflow/approvals.d.ts +71 -0
  24. package/dist/core/workflow/approvals.d.ts.map +1 -0
  25. package/dist/core/workflow/approvals.js +288 -0
  26. package/dist/core/workflow/engine.d.ts +6 -0
  27. package/dist/core/workflow/engine.d.ts.map +1 -1
  28. package/dist/core/workflow/engine.js +243 -43
  29. package/dist/core/workflow/index.d.ts +6 -2
  30. package/dist/core/workflow/index.d.ts.map +1 -1
  31. package/dist/core/workflow/index.js +3 -1
  32. package/dist/core/workflow/proof.d.ts +1 -0
  33. package/dist/core/workflow/proof.d.ts.map +1 -1
  34. package/dist/core/workflow/proof.js +1 -0
  35. package/dist/core/workflow/run-state.d.ts +44 -0
  36. package/dist/core/workflow/run-state.d.ts.map +1 -0
  37. package/dist/core/workflow/run-state.js +233 -0
  38. package/dist/core/workflow/types.d.ts +16 -0
  39. package/dist/core/workflow/types.d.ts.map +1 -1
  40. package/package.json +11 -1
  41. package/src/commander.ts +2 -0
  42. package/src/commands/work.ts +367 -0
  43. package/src/commands/workflow.ts +226 -0
  44. package/src/core/policy/types.ts +1 -1
  45. package/src/core/work/index.ts +24 -0
  46. package/src/core/work/read.ts +15 -0
  47. package/src/core/work/runner.ts +81 -0
  48. package/src/core/work/state.ts +900 -0
  49. package/src/core/workflow/approvals.ts +393 -0
  50. package/src/core/workflow/engine.ts +288 -44
  51. package/src/core/workflow/index.ts +31 -1
  52. package/src/core/workflow/proof.ts +2 -0
  53. package/src/core/workflow/run-state.ts +290 -0
  54. package/src/core/workflow/types.ts +16 -0
package/README.md CHANGED
@@ -21,7 +21,8 @@
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 scratchpads, and harness 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 workflow run <script>` executes bounded, schema-gated multi-subagent workflow scripts — plain JS stages fanning out to headless harness-CLI subagents that are born coordination-registered (heartbeats, events, claim guards), with deterministic code deciding the routing between stages. An optional host-owned policy gates dispatch and declared external mutations with fail-closed `ALLOW`, `ASK`, and `DENY` decisions recorded in the run proof.
24
+ - **Coordination-aware workflows:** `harn workflow run <script>` executes bounded, schema-gated multi-subagent workflow scripts — plain JS stages fanning out to headless harness-CLI subagents that are born coordination-registered (heartbeats, events, claim guards), with deterministic code deciding 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, while library callers remain fail-closed by default.
25
+ - **Durable work above attempts:** `harn work` preserves an objective across bounded workflow attempts, dependencies, approval parks, failures, and review. Its one-shot reconciler derives state from append-only local evidence and reports the next explicit action without silently spawning, retrying, or accepting work.
25
26
  - **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)).
26
27
  - **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).
27
28
 
@@ -1 +1 @@
1
- {"version":3,"file":"commander.d.ts","sourceRoot":"","sources":["../src/commander.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsCpC,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,CAAC;IAEnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED,8CAA8C;AAC9C,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;CAC7C;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IACpC,0FAA0F;IAC1F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACvC;;;;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AAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAC5C,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,KAAK,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,GAAG,OAAO,GAAG,IAAI,CAAC;IACrF,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACpE,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,WAAW,EAAE,WAkCzB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAmD3E"}
package/dist/commander.js CHANGED
@@ -52,6 +52,7 @@ import { registerSectionCommand, registerTocCommand } from "./commands/toc.js";
52
52
  import { registerTokensCommand } from "./commands/tokens.js";
53
53
  import { registerTunnelCommand } from "./commands/tunnel.js";
54
54
  import { registerWebCommand } from "./commands/web.js";
55
+ import { registerWorkCommand } from "./commands/work.js";
55
56
  import { registerWorkflowCommand } from "./commands/workflow.js";
56
57
  export const defaultEmit = {
57
58
  config() {
@@ -132,6 +133,7 @@ export function createHarneryProgram(opts = {}) {
132
133
  registerClaudeDesktopCommand(program, emit);
133
134
  registerSyncCommand(program, emit);
134
135
  registerWorkflowCommand(program, emit);
136
+ registerWorkCommand(program, emit);
135
137
  if (include("web"))
136
138
  registerWebCommand(program, emit);
137
139
  return program;
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import type { EmitContext } from "../commander.js";
3
+ export declare function registerWorkCommand(program: Command, emit: EmitContext): void;
4
+ //# sourceMappingURL=work.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"work.d.ts","sourceRoot":"","sources":["../../src/commands/work.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAmDnD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CA8F7E"}
@@ -0,0 +1,281 @@
1
+ import { workflowSubscriptionOnly } from "../core/config.js";
2
+ import { createBuiltinHarnessRegistry } from "../core/harnesses/index.js";
3
+ import { findCoordRoot } from "../core/hooks/resolve/coord-root.js";
4
+ import { loadPolicyFile } from "../core/policy/index.js";
5
+ import { acceptWorkItem, cancelWorkItem, createWorkItem, listWorkItems, readWorkItem, reconcileAllWorkItems, reconcileWorkItem, reopenWorkItem, runWorkItem, } from "../core/work/index.js";
6
+ import { WorkflowParkedError } from "../core/workflow/index.js";
7
+ export function registerWorkCommand(program, emit) {
8
+ const registry = createBuiltinHarnessRegistry();
9
+ const harnesses = registry.ids();
10
+ const work = program
11
+ .command("work")
12
+ .description("Track durable objectives across bounded workflow attempts.");
13
+ work
14
+ .command("create <title> <workflow>")
15
+ .description("Create an immutable durable-work intent linked to a workflow script.")
16
+ .requiredOption("--objective <text>", "Objective that must survive execution attempts")
17
+ .option("--id <work-id>", "Stable work id (generated by default)")
18
+ .option("--accept <text>", "Acceptance statement; repeat for more than one", collect, [])
19
+ .option("--depends-on <ids>", "Comma-separated prerequisite work ids")
20
+ .option("--max-attempts <n>", "Attempt ceiling (default 3)")
21
+ .option("--source-kind <kind>", "human | workflow | external", "human")
22
+ .option("--source-ref <ref>", "Bounded source reference")
23
+ .option("--actor <name>", "Actor recorded in the creation receipt")
24
+ .option("--json", "Emit the complete work record as JSON")
25
+ .action((title, workflowPath, opts) => {
26
+ withWorkRoot(emit, (coordRoot) => {
27
+ const record = createWorkItem({
28
+ coordRoot,
29
+ id: opts.id,
30
+ title,
31
+ objective: opts.objective,
32
+ workflowPath,
33
+ acceptance: opts.accept,
34
+ dependencies: splitIds(opts.dependsOn),
35
+ maxAttempts: opts.maxAttempts ? Number.parseInt(opts.maxAttempts, 10) : undefined,
36
+ source: opts.sourceKind ? { kind: opts.sourceKind, ref: opts.sourceRef } : undefined,
37
+ actor: opts.actor,
38
+ });
39
+ emitWork(record, opts.json, emit);
40
+ });
41
+ });
42
+ work
43
+ .command("list")
44
+ .description("List durable work with its currently derived state.")
45
+ .option("--state <state>", "Filter by derived state")
46
+ .option("--json", "Emit complete work records as JSON")
47
+ .action((opts) => {
48
+ withWorkRoot(emit, (coordRoot) => {
49
+ const records = listWorkItems(coordRoot).filter((record) => !opts.state || record.projection.state === opts.state);
50
+ if (opts.json) {
51
+ emit.config({ format: "json" });
52
+ emit.data(records);
53
+ }
54
+ else if (records.length === 0) {
55
+ emit.text("no durable work\n");
56
+ }
57
+ else {
58
+ emit.text(`${records.map(renderWorkRow).join("\n")}\n`);
59
+ }
60
+ });
61
+ });
62
+ work
63
+ .command("show <work-id>")
64
+ .description("Show one work item, its attempts, and the next explicit action.")
65
+ .option("--json", "Emit the complete work record as JSON")
66
+ .action((workId, opts) => {
67
+ withWorkRoot(emit, (coordRoot) => {
68
+ emitWork(readWorkItem(coordRoot, workId), opts.json, emit, true);
69
+ });
70
+ });
71
+ work
72
+ .command("reconcile [work-id]")
73
+ .description("Derive state from durable evidence without starting or retrying work.")
74
+ .option("--actor <name>", "Actor recorded on changed reconciliation receipts")
75
+ .option("--json", "Emit reconciled work records as JSON")
76
+ .action((workId, opts) => {
77
+ withWorkRoot(emit, (coordRoot) => {
78
+ const records = workId
79
+ ? [reconcileWorkItem(coordRoot, workId, opts.actor)]
80
+ : reconcileAllWorkItems(coordRoot, opts.actor);
81
+ if (opts.json) {
82
+ emit.config({ format: "json" });
83
+ emit.data(workId ? records[0] : records);
84
+ }
85
+ else if (records.length === 0) {
86
+ emit.text("no durable work\n");
87
+ }
88
+ else {
89
+ emit.text(`${records.map(renderWorkRow).join("\n")}\n`);
90
+ }
91
+ });
92
+ });
93
+ registerRunCommand(work, "run", false, registry, harnesses, emit);
94
+ registerRunCommand(work, "retry", true, registry, harnesses, emit);
95
+ registerGovernanceCommand(work, "accept", emit);
96
+ registerGovernanceCommand(work, "cancel", emit);
97
+ registerGovernanceCommand(work, "reopen", emit);
98
+ }
99
+ function registerRunCommand(work, name, retry, registry, harnesses, emit) {
100
+ work
101
+ .command(`${name} <work-id>`)
102
+ .description(retry
103
+ ? "Start a new bounded attempt after a blocked run."
104
+ : "Start ready work or resume its resolved parked attempt.")
105
+ .option("--max-agents <n>", "Total-agent ceiling for the workflow")
106
+ .option("--concurrency <n>", "Concurrent-subagent cap")
107
+ .option("--cwd <dir>", "Working directory children spawn in")
108
+ .option("--harness <name>", `Default harness: ${harnesses.join(" | ")}`)
109
+ .option("--subscription-only", "Require stored harness-login billing")
110
+ .option("--allow-api-billing", "Permit API-key override billing")
111
+ .option("--policy <file>", "Host policy JSON/JSONC")
112
+ .option("--isolation <mode>", "shared | worktree | sandbox | remote")
113
+ .option("--approval-to <address>", "Address durable ASK requests")
114
+ .option("--actor <name>", "Actor recorded in attempt receipts")
115
+ .option("--json", "Emit the workflow report or parked result as JSON")
116
+ .action(async (workId, opts) => {
117
+ await withWorkRootAsync(emit, async (coordRoot) => {
118
+ if (opts.harness && !registry.get(opts.harness)) {
119
+ throw new Error(`unknown harness ${JSON.stringify(opts.harness)}`);
120
+ }
121
+ try {
122
+ const report = await runWorkItem({
123
+ coordRoot,
124
+ workId,
125
+ retry,
126
+ actor: opts.actor,
127
+ engine: {
128
+ spawners: registry.spawners(),
129
+ defaultHarness: opts.harness,
130
+ maxAgents: opts.maxAgents ? Number.parseInt(opts.maxAgents, 10) : undefined,
131
+ concurrency: opts.concurrency ? Number.parseInt(opts.concurrency, 10) : undefined,
132
+ cwd: opts.cwd,
133
+ subscriptionOnly: opts.subscriptionOnly === true ? true : workflowSubscriptionOnly(coordRoot),
134
+ allowApiBilling: opts.allowApiBilling,
135
+ harnessEvidence: Object.fromEntries(registry
136
+ .list()
137
+ .map((adapter) => [
138
+ adapter.profile.id,
139
+ { toolEvidence: adapter.profile.capabilities.toolEvidence },
140
+ ])),
141
+ policy: opts.policy ? loadPolicyFile(opts.policy) : undefined,
142
+ approvalMode: "park",
143
+ approvalAddressee: opts.approvalTo,
144
+ isolation: opts.isolation,
145
+ networkAccess: "enabled",
146
+ },
147
+ });
148
+ if (opts.json) {
149
+ emit.config({ format: "json" });
150
+ emit.data(report);
151
+ }
152
+ else {
153
+ emit.text(`work ${workId}: run ${report.runId} finished\nproof: ${report.proofPath}\n` +
154
+ `next: harn work reconcile ${workId}\n`);
155
+ }
156
+ }
157
+ catch (error) {
158
+ if (error instanceof WorkflowParkedError) {
159
+ if (opts.json) {
160
+ emit.config({ format: "json" });
161
+ emit.data({
162
+ status: "parked",
163
+ workId,
164
+ runId: error.runId,
165
+ approvalId: error.approvalId,
166
+ journalPath: error.journalPath,
167
+ });
168
+ }
169
+ else {
170
+ emit.text(`work ${workId}: run ${error.runId} parked\napproval: ${error.approvalId}\n` +
171
+ `next: resolve the approval, then harn work run ${workId}\n`);
172
+ }
173
+ return;
174
+ }
175
+ throw error;
176
+ }
177
+ });
178
+ });
179
+ }
180
+ function registerGovernanceCommand(work, name, emit) {
181
+ work
182
+ .command(`${name} <work-id>`)
183
+ .description(name === "accept"
184
+ ? "Explicitly accept reviewed proof and complete the objective."
185
+ : name === "cancel"
186
+ ? "Explicitly cancel unfinished durable work."
187
+ : "Explicitly reopen terminal or blocked work for a future attempt.")
188
+ .option("--actor <name>", "Actor recorded in the governance receipt")
189
+ .option("--reason <text>", "Bounded decision reason")
190
+ .option("--json", "Emit the complete work record as JSON")
191
+ .action((workId, opts) => {
192
+ withWorkRoot(emit, (coordRoot) => {
193
+ const fn = name === "accept" ? acceptWorkItem : name === "cancel" ? cancelWorkItem : reopenWorkItem;
194
+ emitWork(fn(coordRoot, workId, opts), opts.json, emit, true);
195
+ });
196
+ });
197
+ }
198
+ function emitWork(record, json, emit, detail = false) {
199
+ if (json) {
200
+ emit.config({ format: "json" });
201
+ emit.data(record);
202
+ return;
203
+ }
204
+ if (!detail) {
205
+ emit.text(`${renderWorkRow(record)}\n`);
206
+ return;
207
+ }
208
+ const projection = record.projection;
209
+ const lines = [
210
+ `${record.intent.id}: ${record.intent.title}`,
211
+ `state: ${projection.state}`,
212
+ `objective: ${record.intent.objective}`,
213
+ `reason: ${projection.reason}`,
214
+ `next: ${projection.next_action}`,
215
+ `attempts: ${projection.attempts_used}/${record.intent.max_attempts}`,
216
+ ];
217
+ if (record.intent.dependencies.length)
218
+ lines.push(`depends on: ${record.intent.dependencies.join(", ")}`);
219
+ if (record.intent.acceptance.length) {
220
+ lines.push("acceptance:", ...record.intent.acceptance.map((item) => ` - ${item}`));
221
+ }
222
+ if (projection.attempts.length) {
223
+ lines.push("attempts:", ...projection.attempts.map((attempt) => ` ${attempt.number}. ${attempt.run_id} ${attempt.status}`));
224
+ }
225
+ if (projection.approval_id)
226
+ lines.push(`approval: ${projection.approval_id}`);
227
+ if (projection.proof_path)
228
+ lines.push(`proof: ${projection.proof_path}`);
229
+ emit.text(`${lines.join("\n")}\n`);
230
+ }
231
+ function renderWorkRow(record) {
232
+ const projection = record.projection;
233
+ return `${record.intent.id} ${projection.state.padEnd(17)} ${projection.attempts_used}/${record.intent.max_attempts} ${projection.next_action.padEnd(21)} ${record.intent.title}`;
234
+ }
235
+ function withWorkRoot(emit, fn) {
236
+ const coordRoot = findCoordRoot();
237
+ if (!coordRoot) {
238
+ emit.error({
239
+ code: "no_coord_root",
240
+ message: "no .harnery/ coordination root found; run `init` first",
241
+ });
242
+ emit.setExitCode(1);
243
+ return;
244
+ }
245
+ try {
246
+ fn(coordRoot);
247
+ }
248
+ catch (error) {
249
+ emit.error({ code: "work_failed", message: error.message });
250
+ emit.setExitCode(1);
251
+ }
252
+ }
253
+ async function withWorkRootAsync(emit, fn) {
254
+ const coordRoot = findCoordRoot();
255
+ if (!coordRoot) {
256
+ emit.error({
257
+ code: "no_coord_root",
258
+ message: "no .harnery/ coordination root found; run `init` first",
259
+ });
260
+ emit.setExitCode(1);
261
+ return;
262
+ }
263
+ try {
264
+ await fn(coordRoot);
265
+ }
266
+ catch (error) {
267
+ emit.error({ code: "work_failed", message: error.message });
268
+ emit.setExitCode(1);
269
+ }
270
+ }
271
+ function splitIds(value) {
272
+ return value
273
+ ? value
274
+ .split(",")
275
+ .map((item) => item.trim())
276
+ .filter(Boolean)
277
+ : [];
278
+ }
279
+ function collect(value, previous) {
280
+ return [...previous, value];
281
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAkCnD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAuKjF"}
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAgDnD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CA2XjF"}
@@ -2,6 +2,7 @@ import { workflowSubscriptionOnly } from "../core/config.js";
2
2
  import { createBuiltinHarnessRegistry } from "../core/harnesses/index.js";
3
3
  import { findCoordRoot } from "../core/hooks/resolve/coord-root.js";
4
4
  import { loadPolicyFile } from "../core/policy/index.js";
5
+ import { WorkflowParkedError } from "../core/workflow/engine.js";
5
6
  export function registerWorkflowCommand(program, emit) {
6
7
  const registry = createBuiltinHarnessRegistry();
7
8
  const harnesses = registry.ids();
@@ -23,6 +24,7 @@ export function registerWorkflowCommand(program, emit) {
23
24
  "without this the engine refuses that silent-override state")
24
25
  .option("--policy <file>", "Host policy JSON/JSONC applied before dispatch and external mutation")
25
26
  .option("--isolation <mode>", "Host-created execution boundary: shared | worktree | sandbox | remote (default shared)")
27
+ .option("--approval-to <address>", "Address durable ASK requests (default: operator)")
26
28
  .option("--json", "Emit the full RunReport as JSON")
27
29
  .action(async (script, opts) => {
28
30
  const coordRoot = findCoordRoot();
@@ -77,6 +79,8 @@ export function registerWorkflowCommand(program, emit) {
77
79
  { toolEvidence: adapter.profile.capabilities.toolEvidence },
78
80
  ])),
79
81
  policy: opts.policy ? loadPolicyFile(opts.policy) : undefined,
82
+ approvalMode: "park",
83
+ approvalAddressee: opts.approvalTo,
80
84
  isolation: opts.isolation,
81
85
  // CLI harness subprocesses inherit the host network. A policy that
82
86
  // forbids network must therefore deny dispatch unless a future host
@@ -101,6 +105,23 @@ export function registerWorkflowCommand(program, emit) {
101
105
  `result: ${typeof report.result === "string" ? report.result : JSON.stringify(report.result, null, 2)}\n`);
102
106
  }
103
107
  catch (err) {
108
+ if (err instanceof WorkflowParkedError) {
109
+ if (opts.json) {
110
+ emit.config({ format: "json" });
111
+ emit.data({
112
+ status: "parked",
113
+ runId: err.runId,
114
+ approvalId: err.approvalId,
115
+ journalPath: err.journalPath,
116
+ });
117
+ }
118
+ else {
119
+ emit.text(`run ${err.runId} parked\napproval: ${err.approvalId}\n` +
120
+ `journal: ${err.journalPath}\n` +
121
+ `resume after resolution: harn workflow resume ${err.runId}\n`);
122
+ }
123
+ return;
124
+ }
104
125
  const proofPath = typeof err === "object" && err !== null && "proofPath" in err
105
126
  ? String(err.proofPath)
106
127
  : undefined;
@@ -111,6 +132,178 @@ export function registerWorkflowCommand(program, emit) {
111
132
  process.exit(1);
112
133
  }
113
134
  });
135
+ workflow
136
+ .command("resume <run-id>")
137
+ .description("Resume a parked workflow after its durable approval has been resolved.")
138
+ .option("--json", "Emit the full RunReport or parked result as JSON")
139
+ .action(async (runId, opts) => {
140
+ const coordRoot = findCoordRoot();
141
+ if (!coordRoot) {
142
+ emit.error({
143
+ code: "no_coord_root",
144
+ message: "no .harnery/ coordination root found; run `init` first",
145
+ });
146
+ process.exit(1);
147
+ }
148
+ try {
149
+ const { assertWorkflowRunResumable, runWorkflow } = await import("../core/workflow/index.js");
150
+ const { manifest } = assertWorkflowRunResumable(coordRoot, runId);
151
+ const report = await runWorkflow(manifest.script.path, {
152
+ coordRoot,
153
+ spawners: registry.spawners(),
154
+ resumeRunId: runId,
155
+ harnessEvidence: Object.fromEntries(registry
156
+ .list()
157
+ .map((adapter) => [
158
+ adapter.profile.id,
159
+ { toolEvidence: adapter.profile.capabilities.toolEvidence },
160
+ ])),
161
+ });
162
+ if (opts.json) {
163
+ emit.config({ format: "json" });
164
+ emit.data(report);
165
+ return;
166
+ }
167
+ const cachedPart = report.agentsCached > 0 ? ` (+${report.agentsCached} cached)` : "";
168
+ emit.text(`run ${report.runId} (${report.name}) finished: ${report.agentsSpawned} agent(s)${cachedPart}, ` +
169
+ `$${report.costUsd.toFixed(4)}, ${Math.round(report.durationMs / 1000)}s\n` +
170
+ `acceptance: ${report.acceptance.satisfied} satisfied, ${report.acceptance.unsatisfied} unsatisfied, ` +
171
+ `${report.acceptance.unknown} unknown\n` +
172
+ `journal: ${report.journalPath}\nproof: ${report.proofPath}\n` +
173
+ `result: ${typeof report.result === "string" ? report.result : JSON.stringify(report.result, null, 2)}\n`);
174
+ }
175
+ catch (err) {
176
+ if (err instanceof WorkflowParkedError) {
177
+ if (opts.json) {
178
+ emit.config({ format: "json" });
179
+ emit.data({
180
+ status: "parked",
181
+ runId: err.runId,
182
+ approvalId: err.approvalId,
183
+ journalPath: err.journalPath,
184
+ });
185
+ }
186
+ else {
187
+ emit.text(`run ${err.runId} parked again\napproval: ${err.approvalId}\n` +
188
+ `journal: ${err.journalPath}\n`);
189
+ }
190
+ return;
191
+ }
192
+ const proofPath = typeof err === "object" && err !== null && "proofPath" in err
193
+ ? String(err.proofPath)
194
+ : undefined;
195
+ emit.error({
196
+ code: "workflow_resume_failed",
197
+ message: `${err.message}${proofPath ? `\nproof: ${proofPath}` : ""}`,
198
+ });
199
+ process.exit(1);
200
+ }
201
+ });
202
+ const approvals = workflow
203
+ .command("approvals")
204
+ .description("Inspect and resolve durable workflow policy approvals.");
205
+ approvals
206
+ .command("list")
207
+ .description("List durable workflow approvals.")
208
+ .option("--status <status>", "Filter: pending | approved | denied")
209
+ .option("--json", "Emit approval records as JSON")
210
+ .action(async (opts) => {
211
+ const coordRoot = findCoordRoot();
212
+ if (!coordRoot) {
213
+ emit.error({ code: "no_coord_root", message: "no .harnery/ coordination root found" });
214
+ process.exit(1);
215
+ }
216
+ if (opts.status && !["pending", "approved", "denied"].includes(opts.status)) {
217
+ emit.error({
218
+ code: "bad_approval_status",
219
+ message: `unknown approval status ${JSON.stringify(opts.status)}`,
220
+ });
221
+ process.exit(1);
222
+ }
223
+ const { listWorkflowApprovals } = await import("../core/workflow/approvals.js");
224
+ const records = listWorkflowApprovals(coordRoot, { status: opts.status });
225
+ if (opts.json) {
226
+ emit.config({ format: "json" });
227
+ emit.data(records);
228
+ return;
229
+ }
230
+ if (records.length === 0) {
231
+ emit.text("no workflow approvals\n");
232
+ return;
233
+ }
234
+ emit.text(`${records
235
+ .map(({ request, status }) => `${request.id} ${status.padEnd(8)} ${request.run_id} ${request.request.phase} ${request.request.action} -> ${request.addressed_to}`)
236
+ .join("\n")}\n`);
237
+ });
238
+ approvals
239
+ .command("show <approval-id>")
240
+ .description("Show one durable workflow approval.")
241
+ .option("--json", "Emit the approval record as JSON")
242
+ .action(async (approvalId, opts) => {
243
+ const coordRoot = findCoordRoot();
244
+ if (!coordRoot) {
245
+ emit.error({ code: "no_coord_root", message: "no .harnery/ coordination root found" });
246
+ process.exit(1);
247
+ }
248
+ try {
249
+ const { readWorkflowApproval, renderWorkflowApproval } = await import("../core/workflow/approvals.js");
250
+ const approval = readWorkflowApproval(coordRoot, approvalId);
251
+ if (opts.json) {
252
+ emit.config({ format: "json" });
253
+ emit.data(approval);
254
+ }
255
+ else {
256
+ emit.text(renderWorkflowApproval(approval));
257
+ }
258
+ }
259
+ catch (err) {
260
+ emit.error({ code: "workflow_approval_read_failed", message: err.message });
261
+ process.exit(1);
262
+ }
263
+ });
264
+ const registerApprovalDecision = (command, verdict) => {
265
+ approvals
266
+ .command(`${command} <approval-id>`)
267
+ .description(`${command === "approve" ? "Approve" : "Deny"} a pending workflow approval.`)
268
+ .option("--actor <name>", "Decision actor recorded in the receipt")
269
+ .option("--reason <text>", "Bounded decision reason")
270
+ .option("--json", "Emit the resolved approval as JSON")
271
+ .action(async (approvalId, opts) => {
272
+ const coordRoot = findCoordRoot();
273
+ if (!coordRoot) {
274
+ emit.error({ code: "no_coord_root", message: "no .harnery/ coordination root found" });
275
+ process.exit(1);
276
+ }
277
+ try {
278
+ const { resolveWorkflowApproval, renderWorkflowApproval } = await import("../core/workflow/approvals.js");
279
+ const resolved = resolveWorkflowApproval({
280
+ coordRoot,
281
+ approvalId,
282
+ verdict,
283
+ actor: opts.actor ?? process.env.USER ?? process.env.USERNAME ?? "operator",
284
+ reason: opts.reason,
285
+ });
286
+ if (opts.json) {
287
+ emit.config({ format: "json" });
288
+ emit.data(resolved);
289
+ }
290
+ else {
291
+ emit.text(`${renderWorkflowApproval(resolved.approval)}` +
292
+ `${resolved.applied ? "decision recorded" : "decision already recorded"}\n` +
293
+ `resume: harn workflow resume ${resolved.approval.request.run_id}\n`);
294
+ }
295
+ }
296
+ catch (err) {
297
+ emit.error({
298
+ code: "workflow_approval_resolution_failed",
299
+ message: err.message,
300
+ });
301
+ process.exit(1);
302
+ }
303
+ });
304
+ };
305
+ registerApprovalDecision("approve", "allow");
306
+ registerApprovalDecision("deny", "deny");
114
307
  workflow
115
308
  .command("proof <run-id>")
116
309
  .description("Show the bounded proof packet for a completed workflow run.")
@@ -73,7 +73,7 @@ export interface PolicyDecision {
73
73
  phase: PolicyPhase;
74
74
  initial_verdict: PolicyVerdict;
75
75
  verdict: "allow" | "deny";
76
- resolved_by: "policy" | "host" | "fail_closed";
76
+ resolved_by: "policy" | "host" | "approval" | "fail_closed";
77
77
  reason: string;
78
78
  rule_codes: string[];
79
79
  request: PolicyRequestSummary;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/policy/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAG,CAAU,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,mBAAmB,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC3E,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAErE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,cAAc,CAAC,EAAE,OAAO,qBAAqB,CAAC;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,4DAA4D;IAC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B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACvC,UAAU,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KACnC,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,eAAe,EAAE,aAAa,CAAC;IAC/B,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,WAAW,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,oBAAoB,CAAC;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,KACpC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { type RunWorkItemInput, runWorkItem } from "./runner.js";
2
+ export { acceptWorkItem, assertWorkId, type CreateWorkItemInput, cancelWorkItem, createWorkItem, listWorkItems, newWorkId, readWorkItem, reconcileAllWorkItems, reconcileWorkItem, reopenWorkItem, WORK_EVENT_SCHEMA_VERSION, WORK_INTENT_SCHEMA_VERSION, type WorkAttempt, type WorkEvent, type WorkEventType, type WorkIntent, type WorkNextAction, type WorkProjection, type WorkRecord, type WorkState, } from "./state.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/work/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,cAAc,EACd,YAAY,EACZ,KAAK,mBAAmB,EACxB,cAAc,EACd,cAAc,EACd,aAAa,EACb,SAAS,EACT,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { runWorkItem } from "./runner.js";
2
+ export { acceptWorkItem, assertWorkId, cancelWorkItem, createWorkItem, listWorkItems, newWorkId, readWorkItem, reconcileAllWorkItems, reconcileWorkItem, reopenWorkItem, WORK_EVENT_SCHEMA_VERSION, WORK_INTENT_SCHEMA_VERSION, } from "./state.js";
@@ -0,0 +1,2 @@
1
+ export { assertWorkId, listWorkItems, readWorkItem, WORK_EVENT_SCHEMA_VERSION, WORK_INTENT_SCHEMA_VERSION, type WorkAttempt, type WorkEvent, type WorkEventType, type WorkIntent, type WorkNextAction, type WorkProjection, type WorkRecord, type WorkState, } from "./state.js";
2
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/core/work/read.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,yBAAyB,EACzB,0BAA0B,EAC1B,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ export { assertWorkId, listWorkItems, readWorkItem, WORK_EVENT_SCHEMA_VERSION, WORK_INTENT_SCHEMA_VERSION, } from "./state.js";
@@ -0,0 +1,10 @@
1
+ import type { EngineOpts, RunReport } from "../workflow/types.js";
2
+ export interface RunWorkItemInput {
3
+ coordRoot: string;
4
+ workId: string;
5
+ engine: Omit<EngineOpts, "coordRoot" | "runId" | "resumeRunId" | "workItemId">;
6
+ retry?: boolean;
7
+ actor?: string;
8
+ }
9
+ export declare function runWorkItem(input: RunWorkItemInput): Promise<RunReport>;
10
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/core/work/runner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAWlE,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,GAAG,aAAa,GAAG,YAAY,CAAC,CAAC;IAC/E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CA2D7E"}