@astrosheep/keiyaku 4.5.12 → 4.5.13

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 (42) hide show
  1. package/build/src/akuma/akuma-errors.d.ts +1 -0
  2. package/build/src/akuma/akuma-errors.js +1 -0
  3. package/build/src/akuma/body.js +65 -3
  4. package/build/src/akuma/heart/facts.d.ts +18 -0
  5. package/build/src/akuma/heart/facts.js +7 -0
  6. package/build/src/akuma/heart/index.d.ts +18 -3
  7. package/build/src/akuma/heart/index.js +48 -6
  8. package/build/src/akuma/heart/rows.d.ts +4 -1
  9. package/build/src/akuma/heart/rows.js +46 -19
  10. package/build/src/akuma/heart/schema.d.ts +1 -1
  11. package/build/src/akuma/heart/schema.js +18 -5
  12. package/build/src/akuma/heart/storage.d.ts +1 -1
  13. package/build/src/akuma/heart/tells.d.ts +7 -0
  14. package/build/src/akuma/heart/tells.js +48 -5
  15. package/build/src/akuma/heart/timeline.js +9 -3
  16. package/build/src/akuma/projection.js +3 -3
  17. package/build/src/akuma/provider.d.ts +1 -0
  18. package/build/src/akuma/providers/claude/index.js +3 -0
  19. package/build/src/akuma/providers/codex-app-server/index.js +1 -0
  20. package/build/src/akuma/providers/pi/index.js +7 -1
  21. package/build/src/akuma/turn-drive.d.ts +1 -0
  22. package/build/src/akuma/turn-drive.js +21 -7
  23. package/build/src/kanshi/read.js +17 -1
  24. package/build/src/kanshi/select.js +14 -1
  25. package/build/src/library/contract-forwarding.d.ts +2 -2
  26. package/build/src/library/contract-operations.d.ts +1 -1
  27. package/build/src/library/contract-operations.js +2 -2
  28. package/build/src/library/mutation.d.ts +360 -3
  29. package/build/src/library/mutation.js +22 -0
  30. package/build/src/library/refusal.d.ts +2 -0
  31. package/build/src/library/refusal.js +22 -0
  32. package/build/src/library/region.d.ts +0 -8
  33. package/build/src/library/region.js +1 -29
  34. package/build/src/protocol/audit.d.ts +1 -1
  35. package/build/src/protocol/audit.js +1 -0
  36. package/build/src/protocol/deliver.d.ts +1 -1
  37. package/build/src/protocol/deliver.js +1 -0
  38. package/build/src/protocol/review.d.ts +1 -1
  39. package/build/src/protocol/review.js +1 -0
  40. package/package.json +2 -2
  41. package/build/src/library/contract-forwarding-result.d.ts +0 -359
  42. package/build/src/library/contract-forwarding-result.js +0 -44
@@ -1,4 +1,5 @@
1
1
  import { type ContractHead, type ContractId, type JournalEntry, type SnapshotId } from "../core/facts/types.js";
2
+ import { type PrivateStateSeatCloseLag } from "../git/private-state-seat.js";
2
3
  import type { GitDecodeChannel } from "../git/read-observation.js";
3
4
  import type { ReconcileReport } from "../protocol/reconcile.js";
4
5
  import type { RepositoryScope } from "../protocol/operations.js";
@@ -8,9 +9,11 @@ import type { SettlementReport } from "../settlement/settle.js";
8
9
  import type { TaskHolderAdmission } from "../settlement/holder.js";
9
10
  import type { WorktreeHooks } from "./configuration.js";
10
11
  import { type ReconcileCompletion } from "./reconcile.js";
11
- import type { AuditReport } from "../protocol/audit.js";
12
- import type { IntegrationConflictMaterialized } from "../protocol/deliver.js";
13
- import type { ContinuationReport } from "./continuation.js";
12
+ import { type AuditReport } from "../protocol/audit.js";
13
+ import { type IntegrationConflictMaterialized } from "../protocol/deliver.js";
14
+ import { type ReviewValue } from "../protocol/review.js";
15
+ import { type ContinuationReport } from "./continuation.js";
16
+ import { type DeliveryValue } from "./delivery.js";
14
17
  import type { KeiyakuRefused, KeiyakuRetry } from "./refusal.js";
15
18
  import { z } from "zod";
16
19
  export type MutationFinalitySurface = "verification" | "placement" | "continuation" | "reconciliation" | "settlement" | "cleanup";
@@ -49,7 +52,361 @@ export declare const mutationPendingSurfaceSchema: z.ZodType<Readonly<{
49
52
  surface: MutationFinalitySurface;
50
53
  required: boolean;
51
54
  }>, unknown>>;
55
+ export type Review = ReviewValue & Readonly<{
56
+ continuation?: ContinuationReport;
57
+ }>;
58
+ export declare function decodeReview(value: unknown): Review;
59
+ export declare const auditReportSchema: z.ZodType<Readonly<{
60
+ candidate: Readonly<{
61
+ kind: "blocked";
62
+ refusal: import("../protocol/operations.js").DeliveryPreparationRefusal;
63
+ }> | Readonly<{
64
+ kind: "ready";
65
+ workspace: Readonly<{
66
+ kind: "worktree";
67
+ path: string;
68
+ }>;
69
+ identity: import("../core/facts/types.js").DeliverData;
70
+ scope: Readonly<{
71
+ filesChanged: number;
72
+ insertions: number;
73
+ deletions: number;
74
+ paths?: readonly string[];
75
+ }>;
76
+ diff?: string;
77
+ }>;
78
+ verification: Readonly<{
79
+ kind: "not-run";
80
+ }> | Readonly<{
81
+ kind: "satisfied";
82
+ passed: number;
83
+ total: number;
84
+ summary?: string;
85
+ }> | Readonly<{
86
+ kind: "unsatisfied";
87
+ passed: number;
88
+ total: number;
89
+ summary?: string;
90
+ }> | Readonly<{
91
+ kind: "stopped";
92
+ stop: import("../protocol/operations.js").VerificationStop;
93
+ }>;
94
+ target: Readonly<{
95
+ kind: "not-observed";
96
+ }> | import("../git/target-placement.js").AuditTargetAnswer;
97
+ delivery?: Readonly<{
98
+ changeId: import("../core/facts/types.js").ChangeId;
99
+ relation: "identical" | "differs";
100
+ }>;
101
+ }>, unknown, z.core.$ZodTypeInternals<Readonly<{
102
+ candidate: Readonly<{
103
+ kind: "blocked";
104
+ refusal: import("../protocol/operations.js").DeliveryPreparationRefusal;
105
+ }> | Readonly<{
106
+ kind: "ready";
107
+ workspace: Readonly<{
108
+ kind: "worktree";
109
+ path: string;
110
+ }>;
111
+ identity: import("../core/facts/types.js").DeliverData;
112
+ scope: Readonly<{
113
+ filesChanged: number;
114
+ insertions: number;
115
+ deletions: number;
116
+ paths?: readonly string[];
117
+ }>;
118
+ diff?: string;
119
+ }>;
120
+ verification: Readonly<{
121
+ kind: "not-run";
122
+ }> | Readonly<{
123
+ kind: "satisfied";
124
+ passed: number;
125
+ total: number;
126
+ summary?: string;
127
+ }> | Readonly<{
128
+ kind: "unsatisfied";
129
+ passed: number;
130
+ total: number;
131
+ summary?: string;
132
+ }> | Readonly<{
133
+ kind: "stopped";
134
+ stop: import("../protocol/operations.js").VerificationStop;
135
+ }>;
136
+ target: Readonly<{
137
+ kind: "not-observed";
138
+ }> | import("../git/target-placement.js").AuditTargetAnswer;
139
+ delivery?: Readonly<{
140
+ changeId: import("../core/facts/types.js").ChangeId;
141
+ relation: "identical" | "differs";
142
+ }>;
143
+ }>, unknown>>;
52
144
  export declare const mutationResultSchema: <Value>(value: z.ZodType<Value>) => z.ZodType<MutationResult<Value>>;
145
+ export declare const deliveryResultSchema: z.ZodUnion<readonly [z.ZodType<Readonly<{
146
+ kind: "accepted";
147
+ facts: readonly JournalEntry[];
148
+ head: ContractHead;
149
+ value: DeliveryValue;
150
+ lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
151
+ kind: "contract-file-failed";
152
+ worktree: string;
153
+ path: string;
154
+ diagnostic: string;
155
+ }>)[];
156
+ settlementLags: readonly Readonly<{
157
+ kind: "settlement-failed";
158
+ surface: "task-holder" | "task";
159
+ contractId: ContractId;
160
+ taskId?: import("./contract.js").TaskId;
161
+ path?: string;
162
+ diagnostic: string;
163
+ }>[];
164
+ recoverySnapshot?: SnapshotId;
165
+ pending: readonly Readonly<{
166
+ surface: MutationFinalitySurface;
167
+ required: boolean;
168
+ }>[];
169
+ } & Readonly<{
170
+ cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
171
+ leak?: import("../git/scratch.js").WorktreeLeak;
172
+ seatClose?: readonly PrivateStateSeatCloseLag[];
173
+ }>>, unknown, z.core.$ZodTypeInternals<Readonly<{
174
+ kind: "accepted";
175
+ facts: readonly JournalEntry[];
176
+ head: ContractHead;
177
+ value: DeliveryValue;
178
+ lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
179
+ kind: "contract-file-failed";
180
+ worktree: string;
181
+ path: string;
182
+ diagnostic: string;
183
+ }>)[];
184
+ settlementLags: readonly Readonly<{
185
+ kind: "settlement-failed";
186
+ surface: "task-holder" | "task";
187
+ contractId: ContractId;
188
+ taskId?: import("./contract.js").TaskId;
189
+ path?: string;
190
+ diagnostic: string;
191
+ }>[];
192
+ recoverySnapshot?: SnapshotId;
193
+ pending: readonly Readonly<{
194
+ surface: MutationFinalitySurface;
195
+ required: boolean;
196
+ }>[];
197
+ } & Readonly<{
198
+ cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
199
+ leak?: import("../git/scratch.js").WorktreeLeak;
200
+ seatClose?: readonly PrivateStateSeatCloseLag[];
201
+ }>>, unknown>>, z.ZodType<Readonly<{
202
+ kind: "integration-conflict-materialized";
203
+ targetHead: SnapshotId;
204
+ conflictPaths: readonly string[];
205
+ workspace: import("../protocol/deliver.js").AppointedWorkspace;
206
+ }>, unknown, z.core.$ZodTypeInternals<Readonly<{
207
+ kind: "integration-conflict-materialized";
208
+ targetHead: SnapshotId;
209
+ conflictPaths: readonly string[];
210
+ workspace: import("../protocol/deliver.js").AppointedWorkspace;
211
+ }>, unknown>>]>;
212
+ export declare const reviewResultSchema: z.ZodType<Readonly<{
213
+ kind: "accepted";
214
+ facts: readonly JournalEntry[];
215
+ head: ContractHead;
216
+ value: Review;
217
+ lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
218
+ kind: "contract-file-failed";
219
+ worktree: string;
220
+ path: string;
221
+ diagnostic: string;
222
+ }>)[];
223
+ settlementLags: readonly Readonly<{
224
+ kind: "settlement-failed";
225
+ surface: "task-holder" | "task";
226
+ contractId: ContractId;
227
+ taskId?: import("./contract.js").TaskId;
228
+ path?: string;
229
+ diagnostic: string;
230
+ }>[];
231
+ recoverySnapshot?: SnapshotId;
232
+ pending: readonly Readonly<{
233
+ surface: MutationFinalitySurface;
234
+ required: boolean;
235
+ }>[];
236
+ } & Readonly<{
237
+ cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
238
+ leak?: import("../git/scratch.js").WorktreeLeak;
239
+ seatClose?: readonly PrivateStateSeatCloseLag[];
240
+ }>>, unknown, z.core.$ZodTypeInternals<Readonly<{
241
+ kind: "accepted";
242
+ facts: readonly JournalEntry[];
243
+ head: ContractHead;
244
+ value: Review;
245
+ lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
246
+ kind: "contract-file-failed";
247
+ worktree: string;
248
+ path: string;
249
+ diagnostic: string;
250
+ }>)[];
251
+ settlementLags: readonly Readonly<{
252
+ kind: "settlement-failed";
253
+ surface: "task-holder" | "task";
254
+ contractId: ContractId;
255
+ taskId?: import("./contract.js").TaskId;
256
+ path?: string;
257
+ diagnostic: string;
258
+ }>[];
259
+ recoverySnapshot?: SnapshotId;
260
+ pending: readonly Readonly<{
261
+ surface: MutationFinalitySurface;
262
+ required: boolean;
263
+ }>[];
264
+ } & Readonly<{
265
+ cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
266
+ leak?: import("../git/scratch.js").WorktreeLeak;
267
+ seatClose?: readonly PrivateStateSeatCloseLag[];
268
+ }>>, unknown>>;
269
+ export declare const auditResultSchema: z.ZodType<Readonly<{
270
+ kind: "accepted";
271
+ facts: readonly JournalEntry[];
272
+ head: ContractHead;
273
+ value: Readonly<{
274
+ candidate: Readonly<{
275
+ kind: "blocked";
276
+ refusal: import("../protocol/operations.js").DeliveryPreparationRefusal;
277
+ }> | Readonly<{
278
+ kind: "ready";
279
+ workspace: Readonly<{
280
+ kind: "worktree";
281
+ path: string;
282
+ }>;
283
+ identity: import("../core/facts/types.js").DeliverData;
284
+ scope: Readonly<{
285
+ filesChanged: number;
286
+ insertions: number;
287
+ deletions: number;
288
+ paths?: readonly string[];
289
+ }>;
290
+ diff?: string;
291
+ }>;
292
+ verification: Readonly<{
293
+ kind: "not-run";
294
+ }> | Readonly<{
295
+ kind: "satisfied";
296
+ passed: number;
297
+ total: number;
298
+ summary?: string;
299
+ }> | Readonly<{
300
+ kind: "unsatisfied";
301
+ passed: number;
302
+ total: number;
303
+ summary?: string;
304
+ }> | Readonly<{
305
+ kind: "stopped";
306
+ stop: import("../protocol/operations.js").VerificationStop;
307
+ }>;
308
+ target: Readonly<{
309
+ kind: "not-observed";
310
+ }> | import("../git/target-placement.js").AuditTargetAnswer;
311
+ delivery?: Readonly<{
312
+ changeId: import("../core/facts/types.js").ChangeId;
313
+ relation: "identical" | "differs";
314
+ }>;
315
+ }>;
316
+ lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
317
+ kind: "contract-file-failed";
318
+ worktree: string;
319
+ path: string;
320
+ diagnostic: string;
321
+ }>)[];
322
+ settlementLags: readonly Readonly<{
323
+ kind: "settlement-failed";
324
+ surface: "task-holder" | "task";
325
+ contractId: ContractId;
326
+ taskId?: import("./contract.js").TaskId;
327
+ path?: string;
328
+ diagnostic: string;
329
+ }>[];
330
+ recoverySnapshot?: SnapshotId;
331
+ pending: readonly Readonly<{
332
+ surface: MutationFinalitySurface;
333
+ required: boolean;
334
+ }>[];
335
+ } & Readonly<{
336
+ cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
337
+ leak?: import("../git/scratch.js").WorktreeLeak;
338
+ seatClose?: readonly PrivateStateSeatCloseLag[];
339
+ }>>, unknown, z.core.$ZodTypeInternals<Readonly<{
340
+ kind: "accepted";
341
+ facts: readonly JournalEntry[];
342
+ head: ContractHead;
343
+ value: Readonly<{
344
+ candidate: Readonly<{
345
+ kind: "blocked";
346
+ refusal: import("../protocol/operations.js").DeliveryPreparationRefusal;
347
+ }> | Readonly<{
348
+ kind: "ready";
349
+ workspace: Readonly<{
350
+ kind: "worktree";
351
+ path: string;
352
+ }>;
353
+ identity: import("../core/facts/types.js").DeliverData;
354
+ scope: Readonly<{
355
+ filesChanged: number;
356
+ insertions: number;
357
+ deletions: number;
358
+ paths?: readonly string[];
359
+ }>;
360
+ diff?: string;
361
+ }>;
362
+ verification: Readonly<{
363
+ kind: "not-run";
364
+ }> | Readonly<{
365
+ kind: "satisfied";
366
+ passed: number;
367
+ total: number;
368
+ summary?: string;
369
+ }> | Readonly<{
370
+ kind: "unsatisfied";
371
+ passed: number;
372
+ total: number;
373
+ summary?: string;
374
+ }> | Readonly<{
375
+ kind: "stopped";
376
+ stop: import("../protocol/operations.js").VerificationStop;
377
+ }>;
378
+ target: Readonly<{
379
+ kind: "not-observed";
380
+ }> | import("../git/target-placement.js").AuditTargetAnswer;
381
+ delivery?: Readonly<{
382
+ changeId: import("../core/facts/types.js").ChangeId;
383
+ relation: "identical" | "differs";
384
+ }>;
385
+ }>;
386
+ lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
387
+ kind: "contract-file-failed";
388
+ worktree: string;
389
+ path: string;
390
+ diagnostic: string;
391
+ }>)[];
392
+ settlementLags: readonly Readonly<{
393
+ kind: "settlement-failed";
394
+ surface: "task-holder" | "task";
395
+ contractId: ContractId;
396
+ taskId?: import("./contract.js").TaskId;
397
+ path?: string;
398
+ diagnostic: string;
399
+ }>[];
400
+ recoverySnapshot?: SnapshotId;
401
+ pending: readonly Readonly<{
402
+ surface: MutationFinalitySurface;
403
+ required: boolean;
404
+ }>[];
405
+ } & Readonly<{
406
+ cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
407
+ leak?: import("../git/scratch.js").WorktreeLeak;
408
+ seatClose?: readonly PrivateStateSeatCloseLag[];
409
+ }>>, unknown>>;
53
410
  type ObligationPendingInput = Readonly<{
54
411
  lags: MutationResult<unknown>["lags"];
55
412
  settlementLags: MutationResult<unknown>["settlementLags"];
@@ -5,7 +5,13 @@ import { concatenatePrivateStateSeatClose } from "../git/private-state-seat.js";
5
5
  import { decodeVerificationCleanupFailure } from "../protocol/result-codec.js";
6
6
  import { decodeSettlementLag } from "../settlement/result-codec.js";
7
7
  import { completeReconcile, decodeReconciliationLag } from "./reconcile.js";
8
+ import { decodeAuditReport } from "../protocol/audit.js";
9
+ import { decodeMaterializedConflict } from "../protocol/deliver.js";
10
+ import { decodeReviewValue } from "../protocol/review.js";
11
+ import { decodeContinuationReport } from "./continuation.js";
12
+ import { deliveryValueSchema } from "./delivery.js";
8
13
  import { ownerSchema } from "./result-codec.js";
14
+ import { z } from "zod";
9
15
  function pendingSurface(surface, required) {
10
16
  return { surface, required };
11
17
  }
@@ -27,6 +33,16 @@ export function decodeMutationPendingSurface(value) {
27
33
  return { surface: object.surface, required: object.required };
28
34
  }
29
35
  export const mutationPendingSurfaceSchema = ownerSchema(decodeMutationPendingSurface, "expected pending surface");
36
+ export function decodeReview(value) {
37
+ if (value === null || typeof value !== "object" || Array.isArray(value))
38
+ throw new Error("malformed review");
39
+ const { continuation, ...protocol } = value;
40
+ const review = decodeReviewValue(protocol);
41
+ return continuation === undefined ? review : { ...review, continuation: decodeContinuationReport(continuation) };
42
+ }
43
+ export const auditReportSchema = ownerSchema(decodeAuditReport, "expected audit report");
44
+ const reviewSchema = ownerSchema(decodeReview, "expected review");
45
+ const materializedConflictSchema = ownerSchema(decodeMaterializedConflict, "expected materialized conflict");
30
46
  export const mutationResultSchema = (value) => ownerSchema((input) => {
31
47
  if (input === null || typeof input !== "object" || Array.isArray(input))
32
48
  throw new Error("malformed mutation result");
@@ -83,6 +99,12 @@ export const mutationResultSchema = (value) => ownerSchema((input) => {
83
99
  }),
84
100
  };
85
101
  }, "expected mutation result");
102
+ export const deliveryResultSchema = z.union([
103
+ mutationResultSchema(deliveryValueSchema),
104
+ materializedConflictSchema,
105
+ ]);
106
+ export const reviewResultSchema = mutationResultSchema(reviewSchema);
107
+ export const auditResultSchema = mutationResultSchema(auditReportSchema);
86
108
  export function noValuePending(_value) {
87
109
  return [];
88
110
  }
@@ -32,4 +32,6 @@ export declare class KeiyakuRetry extends Error {
32
32
  constructor(reason: KeiyakuRetryReason);
33
33
  get code(): KeiyakuRetryReason["kind"];
34
34
  }
35
+ export declare function encodeContractLiveFailure(error: unknown): unknown | null;
36
+ export declare function decodeContractLiveFailure(value: unknown): Error | null;
35
37
  export declare function requireAccepted<Value, Refusal extends KeiyakuRefusal>(result: IntentOutcome<Value, Refusal>): AcceptedIntent<Value>;
@@ -1,6 +1,7 @@
1
1
  import { contractId } from "../core/facts/types.js";
2
2
  import { decodeIntentRefusal, decodeProtocolTerminal } from "../protocol/result-codec.js";
3
3
  import { ownerSchema } from "./result-codec.js";
4
+ import { z } from "zod";
4
5
  function decodeForkSourceRefusal(value) {
5
6
  if (value === null || typeof value !== "object" || Array.isArray(value))
6
7
  throw new Error("malformed fork-source refusal");
@@ -74,6 +75,27 @@ export class KeiyakuRetry extends Error {
74
75
  return this.reason.kind;
75
76
  }
76
77
  }
78
+ const contractLiveFailureSchema = z.union([
79
+ z.object({ kind: z.literal("refused"), refusal: keiyakuRefusalSchema }).strict(),
80
+ z.object({ kind: z.literal("retry"), reason: keiyakuRetryReasonSchema }).strict(),
81
+ ]);
82
+ export function encodeContractLiveFailure(error) {
83
+ if (error instanceof KeiyakuRefused) {
84
+ return { kind: "refused", refusal: error.refusal };
85
+ }
86
+ if (error instanceof KeiyakuRetry) {
87
+ return { kind: "retry", reason: error.reason };
88
+ }
89
+ return null;
90
+ }
91
+ export function decodeContractLiveFailure(value) {
92
+ const parsed = contractLiveFailureSchema.safeParse(value);
93
+ if (!parsed.success)
94
+ return null;
95
+ return parsed.data.kind === "refused"
96
+ ? new KeiyakuRefused(decodeKeiyakuRefusal(parsed.data.refusal))
97
+ : new KeiyakuRetry(parsed.data.reason);
98
+ }
77
99
  export function requireAccepted(result) {
78
100
  if (result.kind === "refused")
79
101
  throw new KeiyakuRefused(result.refusal);
@@ -1,7 +1,6 @@
1
1
  import type { ContractId } from "../core/facts/types.js";
2
2
  import { type GitDecodeChannel } from "../git/read-observation.js";
3
3
  import { type RepositoryScope } from "../protocol/operations.js";
4
- import type { ContractDocumentProjection } from "../protocol/read/documents.js";
5
4
  export type RegionOverlap = Readonly<{
6
5
  contract: ContractId;
7
6
  patterns: readonly Readonly<{
@@ -20,12 +19,5 @@ export type AmendRegionObservation = RegionObservation | Readonly<{
20
19
  overlaps?: never;
21
20
  overlapFailure?: never;
22
21
  }>;
23
- export type RegionDeclarationRead = Readonly<{
24
- contract: ContractId;
25
- patterns: readonly string[];
26
- }>;
27
- export declare function readRegionDeclarations(documents: readonly ContractDocumentProjection[]): readonly RegionDeclarationRead[];
28
- export declare function regionOverlaps(mine: readonly string[], declarations: readonly RegionDeclarationRead[]): readonly RegionOverlap[];
29
- export declare function validateRegionPatterns(patterns: unknown): readonly [string, ...string[]];
30
22
  export declare function observeRegion(scope: RepositoryScope, channel: GitDecodeChannel, self: ContractId, mine: readonly string[]): Promise<RegionObservation>;
31
23
  export declare function observeChangedRegion(scope: RepositoryScope, self: ContractId, changed: ReadonlySet<string> | undefined, mine: readonly string[]): Promise<AmendRegionObservation>;
@@ -1,35 +1,7 @@
1
1
  import { decodeContractDocument } from "../body/decode.js";
2
- import { assertRegionPattern, regionsOverlap } from "../body/region.js";
2
+ import { regionsOverlap } from "../body/region.js";
3
3
  import { withGitDecodeChannel } from "../git/read-observation.js";
4
4
  import { documentsOperationAt } from "../protocol/operations.js";
5
- export function readRegionDeclarations(documents) {
6
- return documents.map((document) => ({
7
- contract: document.contract,
8
- patterns: decodeContractDocument(document.documentBytes).region,
9
- }));
10
- }
11
- export function regionOverlaps(mine, declarations) {
12
- const overlaps = [];
13
- for (const declaration of declarations) {
14
- const pairs = regionsOverlap(mine, declaration.patterns);
15
- if (pairs.length === 0)
16
- continue;
17
- overlaps.push({
18
- contract: declaration.contract,
19
- patterns: pairs.map(([minePattern, theirsPattern]) => ({ mine: minePattern, theirs: theirsPattern })),
20
- });
21
- }
22
- return overlaps;
23
- }
24
- export function validateRegionPatterns(patterns) {
25
- if (!Array.isArray(patterns) || patterns.length === 0)
26
- throw new Error("Region query requires one or more path patterns");
27
- return patterns.map((pattern) => {
28
- if (typeof pattern !== "string")
29
- throw new Error("Region path patterns must be strings");
30
- return assertRegionPattern(pattern);
31
- });
32
- }
33
5
  function diagnostic(error) {
34
6
  return error instanceof Error ? error.message : String(error);
35
7
  }
@@ -2,6 +2,7 @@ import { type DeliveryDiffScope } from "../git/integration.js";
2
2
  import type { ChangeId, ContractState, DeliverData } from "../core/facts/types.js";
3
3
  import { type AuditTargetAnswer } from "../git/target-placement.js";
4
4
  import type { DeliveryPreparationRefusal, DocumentDerivation, IntentOutcome, MutationOperationInput, VerificationStop } from "./operations.js";
5
+ export { decodeAuditReport } from "./result-codec.js";
5
6
  type AuditWorkspace = Readonly<{
6
7
  kind: "worktree";
7
8
  path: string;
@@ -50,4 +51,3 @@ type AuditOperationInput = MutationOperationInput & Readonly<{
50
51
  signal?: AbortSignal;
51
52
  }>;
52
53
  export declare function auditOperation(input: AuditOperationInput): Promise<IntentOutcome<AuditReport>>;
53
- export {};
@@ -7,6 +7,7 @@ import { verifyDelivery } from "./intent.js";
7
7
  import { accepted, admitted } from "./outcome.js";
8
8
  import { prepareDelivery } from "./deliver.js";
9
9
  import { timestamp, unpackVerificationOutcome } from "./operations.js";
10
+ export { decodeAuditReport } from "./result-codec.js";
10
11
  async function auditWorkspace(repository, state) {
11
12
  const appointed = await readManagedWorktreeAppointment(repository, state.id);
12
13
  if (appointed.kind === "failed")
@@ -16,6 +16,7 @@ export type IntegrationConflictMaterialized = Readonly<{
16
16
  conflictPaths: readonly string[];
17
17
  workspace: AppointedWorkspace;
18
18
  }>;
19
+ export { decodeMaterializedConflict } from "./result-codec.js";
19
20
  type DeliverOperationInput = MutationOperationInput & Readonly<{
20
21
  deriveDocument: (state: ContractState) => DocumentDerivation;
21
22
  message?: string;
@@ -54,4 +55,3 @@ export declare function continueDeliveryOperation(input: Readonly<{
54
55
  signal?: AbortSignal;
55
56
  }>): Promise<CompletionResult>;
56
57
  export declare function deliverOperation(input: DeliverOperationInput): Promise<IntentOutcome<DeliverValue> | IntegrationConflictMaterialized>;
57
- export {};
@@ -10,6 +10,7 @@ import { admitted } from "./outcome.js";
10
10
  import { completeCandidate } from "./completion.js";
11
11
  import { appointmentFor, readPlaceRegister } from "../workspace-place.js";
12
12
  import { attemptDecisionWithSeatClose, timestamp } from "./operations.js";
13
+ export { decodeMaterializedConflict } from "./result-codec.js";
13
14
  const DELIVER_CONFLICT_RECOVERY = Object.freeze({
14
15
  materialize: "deliver --materialize-conflict --include-dirty",
15
16
  continue: "deliver --include-dirty",
@@ -16,6 +16,7 @@ type ReviewOperationInput = MutationOperationInput & Readonly<{
16
16
  export type ReviewValue = CompletionEvidence & Readonly<{
17
17
  workspace?: WorkspaceDirtyDelta;
18
18
  }>;
19
+ export { decodeReviewValue } from "./result-codec.js";
19
20
  export declare function prepareReview(repository: RepositoryScope, stage: Readonly<{
20
21
  contractId: import("../core/facts/types.js").ContractId;
21
22
  coordinates: ContractState["coordinates"];
@@ -30,4 +31,3 @@ export declare function prepareReview(repository: RepositoryScope, stage: Readon
30
31
  refusal: ReviewPreparationRefusal;
31
32
  }>;
32
33
  export declare function reviewOperation(input: ReviewOperationInput): Promise<IntentOutcome<ReviewValue, ReviewRefusal>>;
33
- export {};
@@ -12,6 +12,7 @@ import { completeCandidate } from "./completion.js";
12
12
  import { appointmentFor, readPlaceRegister } from "../workspace-place.js";
13
13
  import { attemptDecisionWithSeatClose, timestamp } from "./operations.js";
14
14
  const REVIEWED = gate("reviewed");
15
+ export { decodeReviewValue } from "./result-codec.js";
15
16
  async function captureReviewableWorktree(repository, stage) {
16
17
  const appointed = stage.coordinates.workspace === "worktree"
17
18
  ? appointmentFor(await readPlaceRegister(repository), stage.contractId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/keiyaku",
3
- "version": "4.5.12",
3
+ "version": "4.5.13",
4
4
  "workspaces": [
5
5
  "plugins/*"
6
6
  ],
@@ -77,7 +77,7 @@
77
77
  "dependencies": {
78
78
  "@agentclientprotocol/sdk": "^1.3.0",
79
79
  "@anthropic-ai/claude-agent-sdk": "^0.3.226",
80
- "@astrosheep/keiyaku-plugin-square": "0.1.0",
80
+ "@astrosheep/keiyaku-plugin-square": "0.1.1",
81
81
  "@earendil-works/pi-coding-agent": "0.80.10",
82
82
  "@opencode-ai/sdk": "1.18.3",
83
83
  "cross-spawn": "^7.0.6",