@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,359 +0,0 @@
1
- import { type ContinuationReport } from "./continuation.js";
2
- import { type DeliveryValue } from "./delivery.js";
3
- import { z } from "zod";
4
- export type Review = import("../protocol/review.js").ReviewValue & Readonly<{
5
- continuation?: ContinuationReport;
6
- }>;
7
- export declare function decodeReview(value: unknown): Review;
8
- export declare const auditReportSchema: z.ZodType<Readonly<{
9
- candidate: Readonly<{
10
- kind: "blocked";
11
- refusal: import("./contract.js").DeliveryPreparationRefusal;
12
- }> | Readonly<{
13
- kind: "ready";
14
- workspace: Readonly<{
15
- kind: "worktree";
16
- path: string;
17
- }>;
18
- identity: import("../core/facts/types.js").DeliverData;
19
- scope: Readonly<{
20
- filesChanged: number;
21
- insertions: number;
22
- deletions: number;
23
- paths?: readonly string[];
24
- }>;
25
- diff?: string;
26
- }>;
27
- verification: Readonly<{
28
- kind: "not-run";
29
- }> | Readonly<{
30
- kind: "satisfied";
31
- passed: number;
32
- total: number;
33
- summary?: string;
34
- }> | Readonly<{
35
- kind: "unsatisfied";
36
- passed: number;
37
- total: number;
38
- summary?: string;
39
- }> | Readonly<{
40
- kind: "stopped";
41
- stop: import("./contract.js").VerificationStop;
42
- }>;
43
- target: Readonly<{
44
- kind: "not-observed";
45
- }> | import("../git/target-placement.js").AuditTargetAnswer;
46
- delivery?: Readonly<{
47
- changeId: import("./contract.js").ChangeId;
48
- relation: "identical" | "differs";
49
- }>;
50
- }>, unknown, z.core.$ZodTypeInternals<Readonly<{
51
- candidate: Readonly<{
52
- kind: "blocked";
53
- refusal: import("./contract.js").DeliveryPreparationRefusal;
54
- }> | Readonly<{
55
- kind: "ready";
56
- workspace: Readonly<{
57
- kind: "worktree";
58
- path: string;
59
- }>;
60
- identity: import("../core/facts/types.js").DeliverData;
61
- scope: Readonly<{
62
- filesChanged: number;
63
- insertions: number;
64
- deletions: number;
65
- paths?: readonly string[];
66
- }>;
67
- diff?: string;
68
- }>;
69
- verification: Readonly<{
70
- kind: "not-run";
71
- }> | Readonly<{
72
- kind: "satisfied";
73
- passed: number;
74
- total: number;
75
- summary?: string;
76
- }> | Readonly<{
77
- kind: "unsatisfied";
78
- passed: number;
79
- total: number;
80
- summary?: string;
81
- }> | Readonly<{
82
- kind: "stopped";
83
- stop: import("./contract.js").VerificationStop;
84
- }>;
85
- target: Readonly<{
86
- kind: "not-observed";
87
- }> | import("../git/target-placement.js").AuditTargetAnswer;
88
- delivery?: Readonly<{
89
- changeId: import("./contract.js").ChangeId;
90
- relation: "identical" | "differs";
91
- }>;
92
- }>, unknown>>;
93
- export declare const deliveryResultSchema: z.ZodUnion<readonly [z.ZodType<Readonly<{
94
- kind: "accepted";
95
- facts: readonly import("../core/facts/types.js").JournalEntry[];
96
- head: import("../core/facts/types.js").ContractHead;
97
- value: DeliveryValue;
98
- lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
99
- kind: "contract-file-failed";
100
- worktree: string;
101
- path: string;
102
- diagnostic: string;
103
- }>)[];
104
- settlementLags: readonly Readonly<{
105
- kind: "settlement-failed";
106
- surface: "task-holder" | "task";
107
- contractId: import("./contract.js").ContractId;
108
- taskId?: import("./contract.js").TaskId;
109
- path?: string;
110
- diagnostic: string;
111
- }>[];
112
- recoverySnapshot?: import("./contract.js").SnapshotId;
113
- pending: readonly Readonly<{
114
- surface: import("./mutation.js").MutationFinalitySurface;
115
- required: boolean;
116
- }>[];
117
- } & Readonly<{
118
- cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
119
- leak?: import("../git/scratch.js").WorktreeLeak;
120
- seatClose?: readonly import("../git/private-state-seat.js").PrivateStateSeatCloseLag[];
121
- }>>, unknown, z.core.$ZodTypeInternals<Readonly<{
122
- kind: "accepted";
123
- facts: readonly import("../core/facts/types.js").JournalEntry[];
124
- head: import("../core/facts/types.js").ContractHead;
125
- value: DeliveryValue;
126
- lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
127
- kind: "contract-file-failed";
128
- worktree: string;
129
- path: string;
130
- diagnostic: string;
131
- }>)[];
132
- settlementLags: readonly Readonly<{
133
- kind: "settlement-failed";
134
- surface: "task-holder" | "task";
135
- contractId: import("./contract.js").ContractId;
136
- taskId?: import("./contract.js").TaskId;
137
- path?: string;
138
- diagnostic: string;
139
- }>[];
140
- recoverySnapshot?: import("./contract.js").SnapshotId;
141
- pending: readonly Readonly<{
142
- surface: import("./mutation.js").MutationFinalitySurface;
143
- required: boolean;
144
- }>[];
145
- } & Readonly<{
146
- cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
147
- leak?: import("../git/scratch.js").WorktreeLeak;
148
- seatClose?: readonly import("../git/private-state-seat.js").PrivateStateSeatCloseLag[];
149
- }>>, unknown>>, z.ZodType<Readonly<{
150
- kind: "integration-conflict-materialized";
151
- targetHead: import("./contract.js").SnapshotId;
152
- conflictPaths: readonly string[];
153
- workspace: import("../protocol/deliver.js").AppointedWorkspace;
154
- }>, unknown, z.core.$ZodTypeInternals<Readonly<{
155
- kind: "integration-conflict-materialized";
156
- targetHead: import("./contract.js").SnapshotId;
157
- conflictPaths: readonly string[];
158
- workspace: import("../protocol/deliver.js").AppointedWorkspace;
159
- }>, unknown>>]>;
160
- export declare const reviewResultSchema: z.ZodType<Readonly<{
161
- kind: "accepted";
162
- facts: readonly import("../core/facts/types.js").JournalEntry[];
163
- head: import("../core/facts/types.js").ContractHead;
164
- value: Review;
165
- lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
166
- kind: "contract-file-failed";
167
- worktree: string;
168
- path: string;
169
- diagnostic: string;
170
- }>)[];
171
- settlementLags: readonly Readonly<{
172
- kind: "settlement-failed";
173
- surface: "task-holder" | "task";
174
- contractId: import("./contract.js").ContractId;
175
- taskId?: import("./contract.js").TaskId;
176
- path?: string;
177
- diagnostic: string;
178
- }>[];
179
- recoverySnapshot?: import("./contract.js").SnapshotId;
180
- pending: readonly Readonly<{
181
- surface: import("./mutation.js").MutationFinalitySurface;
182
- required: boolean;
183
- }>[];
184
- } & Readonly<{
185
- cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
186
- leak?: import("../git/scratch.js").WorktreeLeak;
187
- seatClose?: readonly import("../git/private-state-seat.js").PrivateStateSeatCloseLag[];
188
- }>>, unknown, z.core.$ZodTypeInternals<Readonly<{
189
- kind: "accepted";
190
- facts: readonly import("../core/facts/types.js").JournalEntry[];
191
- head: import("../core/facts/types.js").ContractHead;
192
- value: Review;
193
- lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
194
- kind: "contract-file-failed";
195
- worktree: string;
196
- path: string;
197
- diagnostic: string;
198
- }>)[];
199
- settlementLags: readonly Readonly<{
200
- kind: "settlement-failed";
201
- surface: "task-holder" | "task";
202
- contractId: import("./contract.js").ContractId;
203
- taskId?: import("./contract.js").TaskId;
204
- path?: string;
205
- diagnostic: string;
206
- }>[];
207
- recoverySnapshot?: import("./contract.js").SnapshotId;
208
- pending: readonly Readonly<{
209
- surface: import("./mutation.js").MutationFinalitySurface;
210
- required: boolean;
211
- }>[];
212
- } & Readonly<{
213
- cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
214
- leak?: import("../git/scratch.js").WorktreeLeak;
215
- seatClose?: readonly import("../git/private-state-seat.js").PrivateStateSeatCloseLag[];
216
- }>>, unknown>>;
217
- export declare const auditResultSchema: z.ZodType<Readonly<{
218
- kind: "accepted";
219
- facts: readonly import("../core/facts/types.js").JournalEntry[];
220
- head: import("../core/facts/types.js").ContractHead;
221
- value: Readonly<{
222
- candidate: Readonly<{
223
- kind: "blocked";
224
- refusal: import("./contract.js").DeliveryPreparationRefusal;
225
- }> | Readonly<{
226
- kind: "ready";
227
- workspace: Readonly<{
228
- kind: "worktree";
229
- path: string;
230
- }>;
231
- identity: import("../core/facts/types.js").DeliverData;
232
- scope: Readonly<{
233
- filesChanged: number;
234
- insertions: number;
235
- deletions: number;
236
- paths?: readonly string[];
237
- }>;
238
- diff?: string;
239
- }>;
240
- verification: Readonly<{
241
- kind: "not-run";
242
- }> | Readonly<{
243
- kind: "satisfied";
244
- passed: number;
245
- total: number;
246
- summary?: string;
247
- }> | Readonly<{
248
- kind: "unsatisfied";
249
- passed: number;
250
- total: number;
251
- summary?: string;
252
- }> | Readonly<{
253
- kind: "stopped";
254
- stop: import("./contract.js").VerificationStop;
255
- }>;
256
- target: Readonly<{
257
- kind: "not-observed";
258
- }> | import("../git/target-placement.js").AuditTargetAnswer;
259
- delivery?: Readonly<{
260
- changeId: import("./contract.js").ChangeId;
261
- relation: "identical" | "differs";
262
- }>;
263
- }>;
264
- lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
265
- kind: "contract-file-failed";
266
- worktree: string;
267
- path: string;
268
- diagnostic: string;
269
- }>)[];
270
- settlementLags: readonly Readonly<{
271
- kind: "settlement-failed";
272
- surface: "task-holder" | "task";
273
- contractId: import("./contract.js").ContractId;
274
- taskId?: import("./contract.js").TaskId;
275
- path?: string;
276
- diagnostic: string;
277
- }>[];
278
- recoverySnapshot?: import("./contract.js").SnapshotId;
279
- pending: readonly Readonly<{
280
- surface: import("./mutation.js").MutationFinalitySurface;
281
- required: boolean;
282
- }>[];
283
- } & Readonly<{
284
- cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
285
- leak?: import("../git/scratch.js").WorktreeLeak;
286
- seatClose?: readonly import("../git/private-state-seat.js").PrivateStateSeatCloseLag[];
287
- }>>, unknown, z.core.$ZodTypeInternals<Readonly<{
288
- kind: "accepted";
289
- facts: readonly import("../core/facts/types.js").JournalEntry[];
290
- head: import("../core/facts/types.js").ContractHead;
291
- value: Readonly<{
292
- candidate: Readonly<{
293
- kind: "blocked";
294
- refusal: import("./contract.js").DeliveryPreparationRefusal;
295
- }> | Readonly<{
296
- kind: "ready";
297
- workspace: Readonly<{
298
- kind: "worktree";
299
- path: string;
300
- }>;
301
- identity: import("../core/facts/types.js").DeliverData;
302
- scope: Readonly<{
303
- filesChanged: number;
304
- insertions: number;
305
- deletions: number;
306
- paths?: readonly string[];
307
- }>;
308
- diff?: string;
309
- }>;
310
- verification: Readonly<{
311
- kind: "not-run";
312
- }> | Readonly<{
313
- kind: "satisfied";
314
- passed: number;
315
- total: number;
316
- summary?: string;
317
- }> | Readonly<{
318
- kind: "unsatisfied";
319
- passed: number;
320
- total: number;
321
- summary?: string;
322
- }> | Readonly<{
323
- kind: "stopped";
324
- stop: import("./contract.js").VerificationStop;
325
- }>;
326
- target: Readonly<{
327
- kind: "not-observed";
328
- }> | import("../git/target-placement.js").AuditTargetAnswer;
329
- delivery?: Readonly<{
330
- changeId: import("./contract.js").ChangeId;
331
- relation: "identical" | "differs";
332
- }>;
333
- }>;
334
- lags: readonly (import("../git/reconcile.js").ReconcileLag | Readonly<{
335
- kind: "contract-file-failed";
336
- worktree: string;
337
- path: string;
338
- diagnostic: string;
339
- }>)[];
340
- settlementLags: readonly Readonly<{
341
- kind: "settlement-failed";
342
- surface: "task-holder" | "task";
343
- contractId: import("./contract.js").ContractId;
344
- taskId?: import("./contract.js").TaskId;
345
- path?: string;
346
- diagnostic: string;
347
- }>[];
348
- recoverySnapshot?: import("./contract.js").SnapshotId;
349
- pending: readonly Readonly<{
350
- surface: import("./mutation.js").MutationFinalitySurface;
351
- required: boolean;
352
- }>[];
353
- } & Readonly<{
354
- cleanup?: import("../protocol/intent.js").VerificationCleanupFailure;
355
- leak?: import("../git/scratch.js").WorktreeLeak;
356
- seatClose?: readonly import("../git/private-state-seat.js").PrivateStateSeatCloseLag[];
357
- }>>, unknown>>;
358
- export declare function encodeContractLiveFailure(error: unknown): unknown | null;
359
- export declare function decodeContractLiveFailure(value: unknown): Error | null;
@@ -1,44 +0,0 @@
1
- import { decodeAuditReport, decodeMaterializedConflict, decodeReviewValue } from "../protocol/result-codec.js";
2
- import { decodeContinuationReport } from "./continuation.js";
3
- import { deliveryValueSchema } from "./delivery.js";
4
- import { mutationResultSchema } from "./mutation.js";
5
- import { KeiyakuRefused, KeiyakuRetry, decodeKeiyakuRefusal, keiyakuRefusalSchema, keiyakuRetryReasonSchema, } from "./refusal.js";
6
- import { ownerSchema } from "./result-codec.js";
7
- import { z } from "zod";
8
- export function decodeReview(value) {
9
- if (value === null || typeof value !== "object" || Array.isArray(value))
10
- throw new Error("malformed review");
11
- const { continuation, ...protocol } = value;
12
- const review = decodeReviewValue(protocol);
13
- return continuation === undefined ? review : { ...review, continuation: decodeContinuationReport(continuation) };
14
- }
15
- export const auditReportSchema = ownerSchema(decodeAuditReport, "expected audit report");
16
- const reviewSchema = ownerSchema(decodeReview, "expected review");
17
- const materializedConflictSchema = ownerSchema(decodeMaterializedConflict, "expected materialized conflict");
18
- export const deliveryResultSchema = z.union([
19
- mutationResultSchema(deliveryValueSchema),
20
- materializedConflictSchema,
21
- ]);
22
- export const reviewResultSchema = mutationResultSchema(reviewSchema);
23
- export const auditResultSchema = mutationResultSchema(auditReportSchema);
24
- const contractLiveFailureSchema = z.union([
25
- z.object({ kind: z.literal("refused"), refusal: keiyakuRefusalSchema }).strict(),
26
- z.object({ kind: z.literal("retry"), reason: keiyakuRetryReasonSchema }).strict(),
27
- ]);
28
- export function encodeContractLiveFailure(error) {
29
- if (error instanceof KeiyakuRefused) {
30
- return { kind: "refused", refusal: error.refusal };
31
- }
32
- if (error instanceof KeiyakuRetry) {
33
- return { kind: "retry", reason: error.reason };
34
- }
35
- return null;
36
- }
37
- export function decodeContractLiveFailure(value) {
38
- const parsed = contractLiveFailureSchema.safeParse(value);
39
- if (!parsed.success)
40
- return null;
41
- return parsed.data.kind === "refused"
42
- ? new KeiyakuRefused(decodeKeiyakuRefusal(parsed.data.refusal))
43
- : new KeiyakuRetry(parsed.data.reason);
44
- }