harnery 0.27.0 → 0.29.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 (62) hide show
  1. package/dist/commands/browse.d.ts.map +1 -1
  2. package/dist/commands/browse.js +27 -1
  3. package/dist/commands/work.d.ts +2 -0
  4. package/dist/commands/work.d.ts.map +1 -1
  5. package/dist/commands/work.js +74 -5
  6. package/dist/core/harnesses/types.d.ts +5 -0
  7. package/dist/core/harnesses/types.d.ts.map +1 -1
  8. package/dist/core/work/index.d.ts +1 -1
  9. package/dist/core/work/index.d.ts.map +1 -1
  10. package/dist/core/work/index.js +1 -1
  11. package/dist/core/work/runner.d.ts.map +1 -1
  12. package/dist/core/work/runner.js +8 -1
  13. package/dist/core/work/state.d.ts +24 -1
  14. package/dist/core/work/state.d.ts.map +1 -1
  15. package/dist/core/work/state.js +108 -14
  16. package/dist/core/workflow/approvals.d.ts.map +1 -1
  17. package/dist/core/workflow/approvals.js +3 -6
  18. package/dist/core/workflow/attempt-context.d.ts.map +1 -1
  19. package/dist/core/workflow/attempt-context.js +38 -1
  20. package/dist/core/workflow/engine.d.ts.map +1 -1
  21. package/dist/core/workflow/engine.js +20 -19
  22. package/dist/core/workflow/journal.d.ts +30 -0
  23. package/dist/core/workflow/journal.d.ts.map +1 -0
  24. package/dist/core/workflow/journal.js +70 -0
  25. package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
  26. package/dist/core/workflow/spawn-claude.js +8 -0
  27. package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
  28. package/dist/core/workflow/spawn-codex.js +8 -0
  29. package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
  30. package/dist/core/workflow/spawn-cursor.js +8 -0
  31. package/dist/core/workflow/types.d.ts +11 -0
  32. package/dist/core/workflow/types.d.ts.map +1 -1
  33. package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
  34. package/dist/core/workflow/workspaces/local-git.js +101 -20
  35. package/dist/core/workflow/workspaces/state.d.ts +1 -1
  36. package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
  37. package/dist/core/workflow/workspaces/state.js +9 -30
  38. package/dist/lib/browser/client.d.ts +50 -0
  39. package/dist/lib/browser/client.d.ts.map +1 -1
  40. package/dist/lib/browser/client.js +103 -0
  41. package/dist/lib/exec.d.ts +4 -0
  42. package/dist/lib/exec.d.ts.map +1 -1
  43. package/dist/lib/exec.js +6 -1
  44. package/package.json +1 -1
  45. package/src/commands/browse.ts +33 -1
  46. package/src/commands/work.ts +109 -14
  47. package/src/core/harnesses/types.ts +5 -0
  48. package/src/core/work/index.ts +1 -0
  49. package/src/core/work/runner.ts +8 -0
  50. package/src/core/work/state.ts +177 -27
  51. package/src/core/workflow/approvals.ts +3 -6
  52. package/src/core/workflow/attempt-context.ts +47 -1
  53. package/src/core/workflow/engine.ts +48 -33
  54. package/src/core/workflow/journal.ts +90 -0
  55. package/src/core/workflow/spawn-claude.ts +8 -0
  56. package/src/core/workflow/spawn-codex.ts +8 -0
  57. package/src/core/workflow/spawn-cursor.ts +8 -0
  58. package/src/core/workflow/types.ts +12 -0
  59. package/src/core/workflow/workspaces/local-git.ts +112 -22
  60. package/src/core/workflow/workspaces/state.ts +13 -33
  61. package/src/lib/browser/client.ts +129 -0
  62. package/src/lib/exec.ts +10 -1
@@ -5,7 +5,12 @@ const MAX_ATTEMPTS = 100;
5
5
  const MAX_ERROR = 2_000;
6
6
  const MAX_CRITERIA = 50;
7
7
  const MAX_STATEMENT = 500;
8
- const CONTEXT_FIELDS = new Set(["schema_version", "number", "trigger", "prior"]);
8
+ const MAX_FINDINGS = 20;
9
+ const MAX_FINDING_STATEMENT = 1_000;
10
+ const MAX_FINDING_ACTOR = 100;
11
+ const FINDING_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
12
+ const CONTEXT_FIELDS = new Set(["schema_version", "number", "trigger", "prior", "findings"]);
13
+ const FINDING_FIELDS = new Set(["id", "actor", "statement"]);
9
14
  const PRIOR_FIELDS = new Set(["run_id", "causes", "error", "acceptance", "unresolved"]);
10
15
  const SUMMARY_FIELDS = new Set(["satisfied", "unsatisfied", "unknown", "total"]);
11
16
  const CRITERION_FIELDS = new Set(["id", "statement", "status"]);
@@ -25,6 +30,7 @@ export function normalizeWorkflowAttemptContext(value) {
25
30
  if (input.trigger !== "initial" && input.trigger !== "retry") {
26
31
  throw new Error('workflow attempt context trigger must be "initial" or "retry"');
27
32
  }
33
+ const findings = normalizeFindings(input.findings);
28
34
  if (input.trigger === "initial") {
29
35
  if (input.prior !== undefined) {
30
36
  throw new Error("initial workflow attempt context cannot contain prior evidence");
@@ -33,6 +39,7 @@ export function normalizeWorkflowAttemptContext(value) {
33
39
  schema_version: WORKFLOW_ATTEMPT_CONTEXT_SCHEMA_VERSION,
34
40
  number,
35
41
  trigger: "initial",
42
+ ...(findings.length === 0 ? {} : { findings }),
36
43
  };
37
44
  }
38
45
  if (number < 2)
@@ -45,8 +52,33 @@ export function normalizeWorkflowAttemptContext(value) {
45
52
  number,
46
53
  trigger: "retry",
47
54
  prior: normalizePrior(input.prior),
55
+ ...(findings.length === 0 ? {} : { findings }),
48
56
  };
49
57
  }
58
+ function normalizeFindings(value) {
59
+ if (value === undefined)
60
+ return [];
61
+ if (!Array.isArray(value) || value.length === 0 || value.length > MAX_FINDINGS) {
62
+ throw new Error(`workflow attempt findings must contain 1 to ${MAX_FINDINGS} entries when present`);
63
+ }
64
+ const ids = new Set();
65
+ return value.map((candidate, index) => {
66
+ const input = objectValue(candidate, `workflow attempt finding[${index}]`);
67
+ rejectExtraFields(input, FINDING_FIELDS, `workflow attempt finding[${index}]`);
68
+ const id = requiredString(input.id, `workflow attempt finding[${index}].id`, 64);
69
+ if (!FINDING_ID.test(id)) {
70
+ throw new Error(`invalid workflow attempt finding id ${JSON.stringify(id)}`);
71
+ }
72
+ if (ids.has(id))
73
+ throw new Error(`duplicate workflow attempt finding id ${JSON.stringify(id)}`);
74
+ ids.add(id);
75
+ return {
76
+ id,
77
+ actor: requiredString(input.actor, `workflow attempt finding[${index}].actor`, MAX_FINDING_ACTOR),
78
+ statement: requiredString(input.statement, `workflow attempt finding[${index}].statement`, MAX_FINDING_STATEMENT),
79
+ };
80
+ });
81
+ }
50
82
  export function freezeWorkflowAttemptContext(value) {
51
83
  const normalized = normalizeWorkflowAttemptContext(value);
52
84
  if (normalized.prior) {
@@ -57,6 +89,11 @@ export function freezeWorkflowAttemptContext(value) {
57
89
  Object.freeze(normalized.prior.unresolved);
58
90
  Object.freeze(normalized.prior);
59
91
  }
92
+ if (normalized.findings) {
93
+ for (const finding of normalized.findings)
94
+ Object.freeze(finding);
95
+ Object.freeze(normalized.findings);
96
+ }
60
97
  return Object.freeze(normalized);
61
98
  }
62
99
  export function isCanonicalWorkflowAttemptContext(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwCH,OAAO,KAAK,EAEV,UAAU,EAGV,SAAS,EAYV,MAAM,YAAY,CAAC;AAwCpB,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAM/E;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;CAOpF;AAED,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CA6E1F"}
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAyCH,OAAO,KAAK,EAEV,UAAU,EAGV,SAAS,EAYV,MAAM,YAAY,CAAC;AAsCpB,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAM/E;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;CAOpF;AAED,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CA6E1F"}
@@ -25,7 +25,7 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
25
25
  return path;
26
26
  };
27
27
  import { createHash, randomBytes } from "node:crypto";
28
- import { appendFileSync, existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
28
+ import { existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
29
29
  import { isAbsolute, join, resolve } from "node:path";
30
30
  import { pathToFileURL } from "node:url";
31
31
  import { snapshotRepo } from "../context/index.js";
@@ -34,15 +34,14 @@ import { assertWorkflowRunId, createWorkflowApproval } from "./approvals.js";
34
34
  import { freezeWorkflowAttemptContext } from "./attempt-context.js";
35
35
  import { probeBilling } from "./billing.js";
36
36
  import { stableDigest } from "./durable-record.js";
37
+ import { appendWorkflowJournalEvent } from "./journal.js";
37
38
  import { buildWorkflowProof, createEvidenceRecord, digestResult, normalizeWorkflowMeta, writeWorkflowProof, } from "./proof.js";
38
39
  import { acquireWorkflowResumeLease, assertWorkflowRunResumable, assertWorkflowScriptUnchanged, workflowScriptDigest, writeWorkflowRunManifest, } from "./run-state.js";
39
40
  import { assertProjectionWithinWorkspace, resolveGitGrantRoots } from "./sandbox-projection.js";
40
41
  import { normalizeWorkflowSpecialists, resolveSpecialistAssignment } from "./specialists.js";
41
- import { WORKFLOW_PROOF_SCHEMA_VERSION } from "./types.js";
42
42
  import { parseStageOutput, validateAgainstSchema } from "./validate.js";
43
43
  import { freezeWorkflowWorkContext } from "./work-context.js";
44
44
  import { attestTerminal, attestWorkspaceFailure, resolveWorkspaceBinding, } from "./workspaces/execution.js";
45
- import { appendWorkflowJournalEvent } from "./workspaces/state.js";
46
45
  import { isWorkspaceAttestation } from "./workspaces/validate.js";
47
46
  /** Proof record of the filesystem projection a run applied (ADR 0039/0040).
48
47
  * Absent when no policy was in force, which reads as "no projection applied"
@@ -417,15 +416,18 @@ async function executeWorkflow(scriptPath, absScript, opts, resumeState, workCon
417
416
  const policyDecisions = new Map(history?.policyDecisions.map((decision) => [decision.id, decision]));
418
417
  const acceptanceIds = new Set(meta.acceptance.map((criterion) => criterion.id));
419
418
  const journal = (event, data) => {
420
- const line = JSON.stringify({
421
- schema_version: WORKFLOW_PROOF_SCHEMA_VERSION,
422
- run_id: runId,
423
- ts: new Date().toISOString(),
424
- event,
425
- stage: currentStage,
419
+ appendWorkflowJournalEvent(opts.coordRoot, runId, event, { stage: currentStage, ...data });
420
+ };
421
+ const journalAgentEnd = (data, resultKind, result) => {
422
+ // The writer shrinks an oversized record itself and names what it dropped,
423
+ // so no per-call fallback is needed here. A digest rides along regardless so
424
+ // a shrunk record can still be tied back to the exact result.
425
+ journal("agent.end", {
426
426
  ...data,
427
+ result_kind: resultKind,
428
+ result_digest: digestResult(result, resultKind),
429
+ result,
427
430
  });
428
- appendFileSync(journalPath, `${line}\n`, "utf8");
429
431
  };
430
432
  // Bounded concurrency gate shared by every spawn in the run — direct
431
433
  // `agent()` calls and `parallel()` thunks draw from the same slot pool, so
@@ -780,7 +782,7 @@ async function executeWorkflow(scriptPath, absScript, opts, resumeState, workCon
780
782
  agentCostUsd > 0 || last.costUsd !== undefined ? agentCostUsd : undefined;
781
783
  agentProof.session_id = last.sessionId;
782
784
  agentProof.result = digestResult(last.text, "text");
783
- journal("agent.end", {
785
+ journalAgentEnd({
784
786
  id,
785
787
  key,
786
788
  attempts: attempt,
@@ -788,9 +790,7 @@ async function executeWorkflow(scriptPath, absScript, opts, resumeState, workCon
788
790
  total_cost_usd: agentCostUsd,
789
791
  duration_ms: last.durationMs,
790
792
  session_id: last.sessionId,
791
- result_kind: "text",
792
- result: last.text,
793
- });
793
+ }, "text", last.text);
794
794
  return last.text;
795
795
  }
796
796
  const parsed = parseStageOutput(last.text);
@@ -803,7 +803,7 @@ async function executeWorkflow(scriptPath, absScript, opts, resumeState, workCon
803
803
  agentCostUsd > 0 || last.costUsd !== undefined ? agentCostUsd : undefined;
804
804
  agentProof.session_id = last.sessionId;
805
805
  agentProof.result = digestResult(parsed.value, "json");
806
- journal("agent.end", {
806
+ journalAgentEnd({
807
807
  id,
808
808
  key,
809
809
  attempts: attempt,
@@ -811,9 +811,7 @@ async function executeWorkflow(scriptPath, absScript, opts, resumeState, workCon
811
811
  total_cost_usd: agentCostUsd,
812
812
  duration_ms: last.durationMs,
813
813
  session_id: last.sessionId,
814
- result_kind: "json",
815
- result: parsed.value,
816
- });
814
+ }, "json", parsed.value);
817
815
  return parsed.value;
818
816
  }
819
817
  journal("agent.schema_retry", { id, attempt, problems });
@@ -1127,7 +1125,10 @@ function loadResumeCache(coordRoot, resumeFrom) {
1127
1125
  continue;
1128
1126
  try {
1129
1127
  const e = JSON.parse(line);
1130
- if (e.event === "agent.end" && e.key && e.result_kind !== undefined) {
1128
+ if (e.event === "agent.end" &&
1129
+ e.key &&
1130
+ (e.result_kind === "json" || e.result_kind === "text") &&
1131
+ "result" in e) {
1131
1132
  cache.set(e.key, { kind: e.result_kind, value: e.result });
1132
1133
  }
1133
1134
  }
@@ -0,0 +1,30 @@
1
+ export declare const WORKFLOW_JOURNAL_EVENT_BYTES: number;
2
+ /** Key under which a shrunk record names the fields it had to drop. */
3
+ export declare const WORKFLOW_JOURNAL_OMITTED = "omitted_fields";
4
+ export interface WorkflowJournalOmission {
5
+ field: string;
6
+ bytes: number;
7
+ sha256: string;
8
+ }
9
+ export declare function workflowJournalPath(coordRoot: string, runId: string): string;
10
+ /**
11
+ * Append one journal record, always.
12
+ *
13
+ * A record that would exceed what a reader accepts has its largest fields
14
+ * replaced by a digest and a byte count until it fits, and it names what it
15
+ * dropped. Size never raises.
16
+ *
17
+ * Refusing an oversized record would let a valid run fail on its own opening
18
+ * line: `run.start` carries the workflow's declared metadata plus the frozen
19
+ * work and attempt context, and Harnery's own validators permit those to exceed
20
+ * this limit by construction. Losing detail from a record is recoverable.
21
+ * Losing the run that was writing it is not.
22
+ */
23
+ export declare function appendWorkflowJournalEvent(coordRoot: string, runId: string, event: string, data: Record<string, unknown>): void;
24
+ /**
25
+ * Shrink a record to the reader's limit by dropping its largest fields first.
26
+ * The envelope is never dropped, so a record keeps its run id, timestamp, and
27
+ * event name however much detail it loses. Exported for tests.
28
+ */
29
+ export declare function fitWorkflowJournalRecord(envelope: Record<string, unknown>, data: Record<string, unknown>): Record<string, unknown>;
30
+ //# sourceMappingURL=journal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/journal.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B,QAAY,CAAC;AAEtD,uEAAuE;AACvE,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAIzD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,IAAI,CAiBN;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB"}
@@ -0,0 +1,70 @@
1
+ import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, writeFileSync } from "node:fs";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { fsyncParentDirectory, stableDigest } from "./durable-record.js";
4
+ // Limit for the JSON record body. The trailing newline delimiter is outside the
5
+ // record and is not counted by readers after splitting journal lines.
6
+ export const WORKFLOW_JOURNAL_EVENT_BYTES = 16 * 1024;
7
+ /** Key under which a shrunk record names the fields it had to drop. */
8
+ export const WORKFLOW_JOURNAL_OMITTED = "omitted_fields";
9
+ const RUN_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/;
10
+ export function workflowJournalPath(coordRoot, runId) {
11
+ if (!RUN_ID.test(runId))
12
+ throw new Error(`invalid workflow run id ${JSON.stringify(runId)}`);
13
+ return join(resolve(coordRoot), ".harnery", "workflows", runId, "journal.jsonl");
14
+ }
15
+ /**
16
+ * Append one journal record, always.
17
+ *
18
+ * A record that would exceed what a reader accepts has its largest fields
19
+ * replaced by a digest and a byte count until it fits, and it names what it
20
+ * dropped. Size never raises.
21
+ *
22
+ * Refusing an oversized record would let a valid run fail on its own opening
23
+ * line: `run.start` carries the workflow's declared metadata plus the frozen
24
+ * work and attempt context, and Harnery's own validators permit those to exceed
25
+ * this limit by construction. Losing detail from a record is recoverable.
26
+ * Losing the run that was writing it is not.
27
+ */
28
+ export function appendWorkflowJournalEvent(coordRoot, runId, event, data) {
29
+ const path = workflowJournalPath(coordRoot, runId);
30
+ const record = fitWorkflowJournalRecord({ schema_version: 1, run_id: runId, ts: new Date().toISOString(), event }, data);
31
+ const line = `${JSON.stringify(record)}\n`;
32
+ mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
33
+ const existed = existsSync(path);
34
+ const fd = openSync(path, "a", 0o600);
35
+ try {
36
+ writeFileSync(fd, line, "utf8");
37
+ fsyncSync(fd);
38
+ }
39
+ finally {
40
+ closeSync(fd);
41
+ }
42
+ if (!existed)
43
+ fsyncParentDirectory(path);
44
+ }
45
+ /**
46
+ * Shrink a record to the reader's limit by dropping its largest fields first.
47
+ * The envelope is never dropped, so a record keeps its run id, timestamp, and
48
+ * event name however much detail it loses. Exported for tests.
49
+ */
50
+ export function fitWorkflowJournalRecord(envelope, data) {
51
+ const candidate = { ...envelope, ...data };
52
+ if (Buffer.byteLength(JSON.stringify(candidate)) <= WORKFLOW_JOURNAL_EVENT_BYTES) {
53
+ return candidate;
54
+ }
55
+ const kept = { ...data };
56
+ const omitted = [];
57
+ const bySize = Object.keys(data)
58
+ .map((field) => ({ field, bytes: Buffer.byteLength(JSON.stringify(data[field]) ?? "") }))
59
+ .sort((a, b) => b.bytes - a.bytes);
60
+ for (const { field, bytes } of bySize) {
61
+ omitted.push({ field, bytes, sha256: stableDigest(data[field]) });
62
+ delete kept[field];
63
+ const next = { ...envelope, ...kept, [WORKFLOW_JOURNAL_OMITTED]: omitted };
64
+ if (Buffer.byteLength(JSON.stringify(next)) <= WORKFLOW_JOURNAL_EVENT_BYTES)
65
+ return next;
66
+ }
67
+ // Every field dropped and still over: the omission list is itself the excess.
68
+ // Keep the envelope and a count so the record stays parseable and honest.
69
+ return { ...envelope, [WORKFLOW_JOURNAL_OMITTED]: omitted.length };
70
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"spawn-claude.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/spawn-claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKjF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAYrE,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,GAAG,iBAAiB,CAsB1E;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,WAAW,CAgDxE;AAED,eAAO,MAAM,iBAAiB,EAAE,OAc/B,CAAC"}
1
+ {"version":3,"file":"spawn-claude.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/spawn-claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKjF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAYrE,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,GAAG,iBAAiB,CAsB1E;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,WAAW,CAwDxE;AAED,eAAO,MAAM,iBAAiB,EAAE,OAc/B,CAAC"}
@@ -45,6 +45,14 @@ export function buildClaudeInvocation(req) {
45
45
  return { argv };
46
46
  }
47
47
  export function normalizeClaudeResult(raw) {
48
+ if (raw.timedOut) {
49
+ return {
50
+ ok: false,
51
+ text: "",
52
+ durationMs: raw.durationMs,
53
+ error: `claude timed out after ${raw.durationMs}ms and was killed`,
54
+ };
55
+ }
48
56
  if (raw.exitCode === 127) {
49
57
  return {
50
58
  ok: false,
@@ -1 +1 @@
1
- {"version":3,"file":"spawn-codex.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/spawn-codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKjF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,iBAAiB,CA8B9F;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,gBAAgB,GAAG,WAAW,CAiBvE;AAED,eAAO,MAAM,YAAY,EAAE,OA2B1B,CAAC"}
1
+ {"version":3,"file":"spawn-codex.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/spawn-codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKjF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,iBAAiB,CA8B9F;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,gBAAgB,GAAG,WAAW,CAyBvE;AAED,eAAO,MAAM,YAAY,EAAE,OA2B1B,CAAC"}
@@ -52,6 +52,14 @@ export function buildCodexInvocation(req, resultFile) {
52
52
  return { argv, resultFile };
53
53
  }
54
54
  export function normalizeCodexResult(raw) {
55
+ if (raw.timedOut) {
56
+ return {
57
+ ok: false,
58
+ text: "",
59
+ durationMs: raw.durationMs,
60
+ error: `codex timed out after ${raw.durationMs}ms and was killed`,
61
+ };
62
+ }
55
63
  if (raw.exitCode === 127) {
56
64
  return { ok: false, text: "", durationMs: raw.durationMs, error: notFoundError("codex") };
57
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"spawn-cursor.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/spawn-cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKjF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AASrE,gEAAgE;AAChE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAWA;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,GAAG,iBAAiB,CAkB1E;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,WAAW,CA6BxE;AAED,eAAO,MAAM,aAAa,EAAE,OAe3B,CAAC"}
1
+ {"version":3,"file":"spawn-cursor.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/spawn-cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKjF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AASrE,gEAAgE;AAChE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAWA;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,GAAG,iBAAiB,CAkB1E;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,WAAW,CAqCxE;AAED,eAAO,MAAM,aAAa,EAAE,OAe3B,CAAC"}
@@ -55,6 +55,14 @@ export function buildCursorInvocation(req) {
55
55
  return { argv };
56
56
  }
57
57
  export function normalizeCursorResult(raw) {
58
+ if (raw.timedOut) {
59
+ return {
60
+ ok: false,
61
+ text: "",
62
+ durationMs: raw.durationMs,
63
+ error: `cursor timed out after ${raw.durationMs}ms and was killed`,
64
+ };
65
+ }
58
66
  if (raw.exitCode === 127) {
59
67
  return { ok: false, text: "", durationMs: raw.durationMs, error: notFoundError("cursor") };
60
68
  }
@@ -369,6 +369,17 @@ export interface WorkflowAttemptContext {
369
369
  readonly number: number;
370
370
  readonly trigger: "initial" | "retry";
371
371
  readonly prior?: Readonly<WorkflowAttemptPriorContext>;
372
+ /** Open findings an operator raised against a prior attempt. Present on any
373
+ * trigger, because a reopen with findings starts a fresh initial attempt.
374
+ * Distinct from `prior`, which is evidence the run itself produced. */
375
+ readonly findings?: readonly Readonly<WorkflowOperatorFinding>[];
376
+ }
377
+ /** One correction an operator raised against work they judged wrong. Authored
378
+ * by a human, not derived from proof, and carried until explicitly disposed. */
379
+ export interface WorkflowOperatorFinding {
380
+ readonly id: string;
381
+ readonly actor: string;
382
+ readonly statement: string;
372
383
  }
373
384
  export interface EngineOpts {
374
385
  /** Repo root whose .harnery/ receives the run journal. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,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M,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,iBAAiB,CAAC;IAC9B;;gFAE4E;IAC5E,6BAA6B,EAAE,MAAM,CAAC;IACtC,6EAA6E;IAC7E,OAAO,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;IAC5D,6DAA6D;IAC7D,MAAM,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACxC,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"local-git.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/workspaces/local-git.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAgBV,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EAElB,MAAM,YAAY,CAAC;AASpB,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC;CAC1C;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,+BAA+B,GACvC,iBAAiB,CAgBnB;AAED,wBAAsB,KAAK,CACzB,KAAK,EAAE,mBAAmB,EAC1B,wBAAwB,GAAE,MAAM,OAAwC,GACvE,OAAO,CAAC,oBAAoB,CAAC,CAkE/B"}
1
+ {"version":3,"file":"local-git.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/workspaces/local-git.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAgBV,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EAElB,MAAM,YAAY,CAAC;AASpB,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC;CAC1C;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,+BAA+B,GACvC,iBAAiB,CAgBnB;AAED,wBAAsB,KAAK,CACzB,KAAK,EAAE,mBAAmB,EAC1B,wBAAwB,GAAE,MAAM,OAAwC,GACvE,OAAO,CAAC,oBAAoB,CAAC,CA4E/B"}
@@ -44,17 +44,28 @@ export async function probe(input, descriptorPathsSupported = descriptorBackedPa
44
44
  if (input.writable_roots.length === 0) {
45
45
  unsupported.push(reason("writable_roots_required", "explicit writable roots are required"));
46
46
  }
47
- for (const root of input.writable_roots) {
47
+ // Allocation always selects writable_roots[0] (validateRequest pins the selected root
48
+ // to it), so probe's authority-coverage verdict must be judged against that same root.
49
+ let selectedRoot;
50
+ input.writable_roots.forEach((root, index) => {
48
51
  try {
49
- validateConfiguredRoot(root);
52
+ const validated = validateConfiguredRoot(root);
53
+ if (index === 0)
54
+ selectedRoot = validated;
50
55
  }
51
56
  catch (error) {
52
57
  unsupported.push(reason("writable_root_invalid", error.message));
53
58
  }
54
- }
59
+ });
55
60
  if (version.ok) {
56
61
  try {
57
- inspectSourceRepository(input.requested_cwd);
62
+ const repo = inspectSourceRepository(input.requested_cwd);
63
+ if (selectedRoot) {
64
+ const outside = describeAuthorityOutsideRoot(repo, selectedRoot.realpath);
65
+ if (outside) {
66
+ unsupported.push(reason("repository_authority_outside_writable_root", outside));
67
+ }
68
+ }
58
69
  }
59
70
  catch (error) {
60
71
  unsupported.push(reason("repository_unsupported", error.message));
@@ -115,10 +126,9 @@ async function allocate(coordRoot, request) {
115
126
  const repo = inspectSourceRepository(request.requested_cwd);
116
127
  assertAllowedPathAuthority(request.allowed_paths, repo.sourceRoot.realpath, "source repository");
117
128
  assertAllowedPathAuthority(request.allowed_paths, repo.commonDir.realpath, "Git common directory");
118
- if (!containsPath(root.realpath, repo.sourceRoot.realpath) ||
119
- !containsPath(root.realpath, repo.commonDir.realpath)) {
120
- throw new Error("source repository and Git common dir must be inside the writable root");
121
- }
129
+ const authorityOutside = describeAuthorityOutsideRoot(repo, root.realpath);
130
+ if (authorityOutside)
131
+ throw new Error(authorityOutside);
122
132
  const workspaceRoot = candidateUnderRoot(root, ["harnery-workspaces", bindingId]);
123
133
  const activeRoot = resolve(workspaceRoot, repo.requestedRelativePath);
124
134
  if (!containsPath(workspaceRoot, activeRoot)) {
@@ -887,6 +897,17 @@ async function applyIntegrationUnderLease(coordRoot, input) {
887
897
  }
888
898
  revalidateClaimResources(claim, validateConfiguredRoot(plan.binding.writable_root.configured));
889
899
  inspectIntegrationTarget(current.target_root, plan.binding);
900
+ // The fast-forward moves the target branch ref, which for a submodule or linked
901
+ // worktree lives in the common directory outside the checkout tree. allowed_paths is
902
+ // the real write authority (allocate and cleanup already gate the common directory on
903
+ // it), so re-authorize both the target checkout and its common directory here rather
904
+ // than trusting containment alone.
905
+ const applyCommonDir = plan.binding.repository?.common_dir.realpath;
906
+ if (!applyCommonDir) {
907
+ throw new Error("integration binding is missing Git common-dir authority");
908
+ }
909
+ assertAllowedPathAuthority(claim.request.allowed_paths, current.target_root, "integration target path");
910
+ assertAllowedPathAuthority(claim.request.allowed_paths, applyCommonDir, "integration Git common directory");
890
911
  git(current.target_root, ["merge", "--ff-only", expected.source_commit]);
891
912
  const finalCommit = git(current.target_root, ["rev-parse", "HEAD"]);
892
913
  const finalTree = git(current.target_root, ["rev-parse", "HEAD^{tree}"]);
@@ -969,18 +990,15 @@ function inspectSourceRepository(cwd) {
969
990
  if (!containsPath(sourceRoot, requestedCwd.realpath)) {
970
991
  throw new Error("requested working directory is outside the resolved Git worktree");
971
992
  }
972
- if (lstatSync(join(sourceRoot, ".git")).isSymbolicLink()) {
973
- throw new Error("symlink Git directories are unsupported");
974
- }
975
- if (!lstatSync(join(sourceRoot, ".git")).isDirectory()) {
976
- throw new Error("linked worktree and submodule source repositories are unsupported");
977
- }
978
- const requestedGitDir = realpathSync(join(sourceRoot, ".git"));
993
+ const pointedGitDir = resolveGitDirPointer(sourceRoot);
979
994
  const gitDir = realpathSync(resolve(sourceRoot, git(sourceRoot, ["rev-parse", "--git-dir"])));
980
995
  const commonDir = realpathSync(resolve(sourceRoot, git(sourceRoot, ["rev-parse", "--git-common-dir"])));
981
- if (gitDir !== requestedGitDir || commonDir !== requestedGitDir) {
996
+ if (pointedGitDir !== gitDir) {
982
997
  throw new Error("resolved Git authority does not match the requested checkout");
983
998
  }
999
+ if (!containsPath(commonDir, gitDir)) {
1000
+ throw new Error("resolved Git directory is not inside its common directory");
1001
+ }
984
1002
  const branch = gitMaybe(sourceRoot, ["symbolic-ref", "-q", "--short", "HEAD"]);
985
1003
  if (!branch.ok || !branch.out)
986
1004
  throw new Error("detached integration targets are unsupported");
@@ -1002,6 +1020,48 @@ function inspectSourceRepository(cwd) {
1002
1020
  requestedRelativePath: relative(sourceRoot, requestedCwd.realpath),
1003
1021
  };
1004
1022
  }
1023
+ // Resolve the `.git` entry at a checkout root to the real Git directory it names,
1024
+ // without trusting the ambient environment. `.git` is a real directory in a plain
1025
+ // checkout, and a `gitdir:` pointer file in a linked worktree, submodule, or
1026
+ // worktree-of-a-submodule. A symlink is refused: the identity model pins a path to a
1027
+ // device and inode, and a symlink lets the target move under a pinned pointer.
1028
+ //
1029
+ // The caller cross-checks the result against `rev-parse --git-dir`. That is a
1030
+ // consistency assertion, not spoof detection: Git honours a `gitdir:` pointer, so a
1031
+ // pointer aimed at an unrelated repository agrees with `rev-parse` and is accepted.
1032
+ // It cannot be otherwise, because a doctored pointer and a submodule's pointer are
1033
+ // the same construct. What the equality buys is that this resolution and Git's own
1034
+ // never silently diverge, which is defence in depth over the `GIT_*` stripping in
1035
+ // `isolatedGitEnvironment`. The real authority check is containment plus
1036
+ // `allowed_paths` on the resolved common directory.
1037
+ function resolveGitDirPointer(sourceRoot) {
1038
+ const dotGit = join(sourceRoot, ".git");
1039
+ let stats;
1040
+ try {
1041
+ stats = lstatSync(dotGit);
1042
+ }
1043
+ catch {
1044
+ throw new Error("requested checkout has no .git entry");
1045
+ }
1046
+ if (stats.isSymbolicLink()) {
1047
+ throw new Error("symlink Git directories are unsupported");
1048
+ }
1049
+ if (stats.isDirectory()) {
1050
+ return realpathSync(dotGit);
1051
+ }
1052
+ if (!stats.isFile()) {
1053
+ throw new Error(".git must be a directory or a gitdir pointer file");
1054
+ }
1055
+ const pointer = readFileSync(dotGit, "utf8").split(/\r?\n/, 1)[0]?.trim() ?? "";
1056
+ const prefix = "gitdir:";
1057
+ if (!pointer.startsWith(prefix)) {
1058
+ throw new Error(".git file is not a gitdir pointer");
1059
+ }
1060
+ const target = pointer.slice(prefix.length).trim();
1061
+ if (!target)
1062
+ throw new Error(".git gitdir pointer is empty");
1063
+ return realpathSync(resolve(sourceRoot, target));
1064
+ }
1005
1065
  function inspectFrozenSourceAuthority(sourceRoot, commonDir, targetRef) {
1006
1066
  const configured = validateConfiguredRoot(sourceRoot.configured);
1007
1067
  if (configured.realpath !== sourceRoot.realpath ||
@@ -1295,6 +1355,22 @@ function validFrozenFilesystemPath(path) {
1295
1355
  typeof path.identity.device === "string" &&
1296
1356
  typeof path.identity.inode === "string");
1297
1357
  }
1358
+ // Explain, in the caller's terms, why a checkout's Git authority falls outside a
1359
+ // writable root — naming the offending path so a submodule or linked-worktree user
1360
+ // who declared only the inner checkout knows exactly what to widen. Returns undefined
1361
+ // when both the source checkout and its common directory are inside the root.
1362
+ function describeAuthorityOutsideRoot(repo, rootRealpath) {
1363
+ if (!containsPath(rootRealpath, repo.commonDir.realpath)) {
1364
+ return (`Git keeps this checkout's administrative files in ${repo.commonDir.realpath}, ` +
1365
+ `which is outside the writable root ${rootRealpath}. Linked-worktree and submodule ` +
1366
+ `checkouts keep their Git authority in the enclosing repository, and allocating a ` +
1367
+ `worktree writes there; declare that repository (or a parent of it) as the writable root.`);
1368
+ }
1369
+ if (!containsPath(rootRealpath, repo.sourceRoot.realpath)) {
1370
+ return `the source checkout ${repo.sourceRoot.realpath} is outside the writable root ${rootRealpath}`;
1371
+ }
1372
+ return undefined;
1373
+ }
1298
1374
  function assertAllowedPathAuthority(allowedPaths, candidate, label) {
1299
1375
  if (allowedPaths.length > 0 &&
1300
1376
  !allowedPaths.some((allowedPath) => {
@@ -1383,10 +1459,15 @@ function capabilityDigestForClaim(claim) {
1383
1459
  function acquireRepositoryLease(coordRoot, claim) {
1384
1460
  const leaseDir = join(resolve(coordRoot), ".harnery", "workspaces", PROVIDER_ID, ".leases");
1385
1461
  mkdirSync(leaseDir, { recursive: true, mode: 0o700 });
1386
- const key = stableDigest({
1387
- common: claim.repository.common_dir.identity,
1388
- root: claim.writable_root.identity,
1389
- });
1462
+ // Mutual exclusion keys on the Git common directory alone. `git worktree add`,
1463
+ // `prune`, and the shared-`config` migration all write to the common directory's
1464
+ // administrative area, and once worktrees and submodules are allowed, several
1465
+ // distinct source checkouts (a superproject and its linked worktrees; a submodule
1466
+ // and a worktree of it) share one common directory under different — possibly
1467
+ // nested — writable roots. Including the writable root in the key would hand those
1468
+ // agents different locks and let their admin-area writes race. The writable root
1469
+ // stays in the lease metadata for diagnostics, not in the exclusion key.
1470
+ const key = stableDigest({ common: claim.repository.common_dir.identity });
1390
1471
  return acquireLease(coordRoot, join(leaseDir, `repository-${key}.lock`), claim, "repository");
1391
1472
  }
1392
1473
  function acquireLease(coordRoot, path, claim, scope) {
@@ -1,3 +1,4 @@
1
+ export { appendWorkflowJournalEvent } from "../journal.js";
1
2
  import type { GitRepositoryBinding, IntegrationApplyAttempt, IntegrationApplyReceipt, IntegrationAuthorization, IntegrationPlan, IntegrationReviewRecord, WorkspaceAllocationRequest, WorkspaceBinding, WorkspaceCancellationReceipt, WorkspaceCleanupAttempt, WorkspaceCleanupIntent, WorkspaceCleanupReceipt, WorkspaceCleanupResult } from "./types.js";
2
3
  export interface WorkspaceClaim {
3
4
  schema_version: 1;
@@ -48,7 +49,6 @@ export declare function writeWorkspaceBinding(coordRoot: string, binding: Worksp
48
49
  export declare function readWorkspaceBinding(coordRoot: string, providerId: string, bindingId: string): WorkspaceBinding | undefined;
49
50
  export declare function appendWorkspaceEvent(coordRoot: string, claim: WorkspaceClaim, event: string, data?: Record<string, unknown>): WorkspaceProviderEvent;
50
51
  export declare function readWorkspaceEvents(coordRoot: string, providerId: string, bindingId: string): WorkspaceProviderEvent[];
51
- export declare function appendWorkflowJournalEvent(coordRoot: string, runId: string, event: string, data: Record<string, unknown>): void;
52
52
  export type WorkflowSupplement = WorkspaceBinding | IntegrationReviewRecord | IntegrationPlan | IntegrationAuthorization | IntegrationApplyReceipt | WorkspaceCleanupResult | WorkspaceCancellationReceipt | WorkspaceCleanupIntent | WorkspaceCleanupReceipt;
53
53
  export declare function appendCleanupAttempt(coordRoot: string, runId: string, input: Omit<WorkspaceCleanupAttempt, "seq" | "previous_sha256" | "record_sha256">): WorkspaceCleanupAttempt;
54
54
  export declare function appendIntegrationAttempt(coordRoot: string, runId: string, input: Omit<IntegrationApplyAttempt, "seq" | "previous_sha256" | "record_sha256">): IntegrationApplyAttempt;