@astrosheep/keiyaku 4.6.11 → 4.6.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.
- package/build/plugins/claude/skills/keiyaku/SKILL.md +3 -1
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +3 -2
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/plugins/codex/skills/keiyaku/SKILL.md +3 -1
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +3 -2
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +3 -1
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +3 -2
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/skills/keiyaku/SKILL.md +3 -1
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +3 -2
- package/build/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/src/akuma/akuma-errors.d.ts +5 -0
- package/build/src/akuma/akuma-errors.js +9 -0
- package/build/src/akuma/akuma-owner.d.ts +14 -19
- package/build/src/akuma/akuma-owner.js +56 -54
- package/build/src/akuma/akuma-selection-execution.d.ts +5 -4
- package/build/src/akuma/akuma-selection-execution.js +59 -17
- package/build/src/akuma/akuma.d.ts +1 -2
- package/build/src/akuma/allowed.d.ts +2 -3
- package/build/src/akuma/allowed.js +1 -3
- package/build/src/akuma/body.js +17 -7
- package/build/src/akuma/call-initial-tell.d.ts +18 -0
- package/build/src/akuma/call-initial-tell.js +18 -0
- package/build/src/akuma/call-request.d.ts +20 -4
- package/build/src/akuma/heart/facts.d.ts +13 -0
- package/build/src/akuma/heart/facts.js +6 -0
- package/build/src/akuma/heart/index.d.ts +29 -14
- package/build/src/akuma/heart/index.js +75 -29
- package/build/src/akuma/heart/rows.d.ts +9 -2
- package/build/src/akuma/heart/rows.js +72 -11
- package/build/src/akuma/heart/storage.d.ts +2 -8
- package/build/src/akuma/heart/storage.js +13 -13
- package/build/src/akuma/heart/tells.d.ts +3 -1
- package/build/src/akuma/heart/tells.js +18 -2
- package/build/src/akuma/provider.d.ts +2 -4
- package/build/src/akuma/provider.js +29 -6
- package/build/src/akuma/providers/acp/core.js +23 -21
- package/build/src/akuma/providers/claude/index.js +0 -8
- package/build/src/akuma/providers/codex-app-server/index.js +9 -8
- package/build/src/akuma/providers/execution-environment.d.ts +1 -1
- package/build/src/akuma/providers/execution-environment.js +1 -0
- package/build/src/akuma/providers/opencode-sdk/events.js +111 -81
- package/build/src/akuma/providers/opencode-sdk/index.js +179 -150
- package/build/src/akuma/providers/opencode-sdk/native-http.js +7 -3
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +5 -3
- package/build/src/akuma/providers/opencode-sdk/session.js +32 -27
- package/build/src/akuma/providers/paseo/index.js +0 -2
- package/build/src/akuma/providers/pi/index.js +23 -20
- package/build/src/akuma/selection-observation.d.ts +78 -9
- package/build/src/akuma/selection-owner-port.d.ts +2 -1
- package/build/src/akuma/selection-owner-port.js +6 -1
- package/build/src/akuma/selection-request.d.ts +1 -1
- package/build/src/akuma/selection-request.js +8 -3
- package/build/src/akuma/turn-drive.js +79 -48
- package/build/src/akuma-body.js +5 -3
- package/build/src/cli/commands/akuma-grammar.js +2 -2
- package/build/src/cli/commands/akuma.js +24 -16
- package/build/src/cli/commands/contract-grammar.d.ts +3 -7
- package/build/src/cli/commands/contract-grammar.js +12 -10
- package/build/src/cli/commands/contract-help.d.ts +3 -13
- package/build/src/cli/commands/contract-help.js +7 -16
- package/build/src/cli/commands/contract.js +19 -35
- package/build/src/cli/commands/debt.js +30 -29
- package/build/src/cli/parse.js +0 -1
- package/build/src/cli/render/akuma-activity.d.ts +36 -9
- package/build/src/cli/render/akuma-activity.js +142 -65
- package/build/src/cli/render/akuma.d.ts +6 -0
- package/build/src/cli/render/akuma.js +67 -24
- package/build/src/cli/render/catalog.js +0 -1
- package/build/src/cli/render/contract-observation.d.ts +16 -3
- package/build/src/cli/render/contract-observation.js +3 -0
- package/build/src/cli/render/contract.d.ts +2 -2
- package/build/src/cli/render/contract.js +4 -4
- package/build/src/cli/render/delivery-preview.d.ts +7 -0
- package/build/src/cli/render/{audit.js → delivery-preview.js} +29 -27
- package/build/src/cli/render/kanshi-akuma.d.ts +3 -1
- package/build/src/cli/render/kanshi-akuma.js +23 -8
- package/build/src/cli/render/kanshi.js +4 -1
- package/build/src/cli/render/receipt.js +3 -3
- package/build/src/cli/render/refusal.js +2 -2
- package/build/src/cli/render/terminal.d.ts +0 -1
- package/build/src/cli/render/terminal.js +1 -1
- package/build/src/cli/square-identity.d.ts +15 -0
- package/build/src/cli/square-identity.js +180 -0
- package/build/src/contract-worktree.js +1 -1
- package/build/src/core/verbs/placement.d.ts +2 -1
- package/build/src/core/verbs/placement.js +1 -1
- package/build/src/debt/context.d.ts +0 -5
- package/build/src/debt/context.js +32 -44
- package/build/src/git/process.d.ts +1 -0
- package/build/src/git/process.js +18 -1
- package/build/src/git/read-observation.js +2 -1
- package/build/src/git/scratch.d.ts +5 -1
- package/build/src/git/scratch.js +41 -12
- package/build/src/git/target-placement.d.ts +22 -4
- package/build/src/git/target-placement.js +44 -20
- package/build/src/index.d.ts +2 -2
- package/build/src/kanshi/read.js +187 -105
- package/build/src/kanshi/report.d.ts +5 -0
- package/build/src/library/address.d.ts +18 -4
- package/build/src/library/address.js +27 -6
- package/build/src/library/contract-address.d.ts +6 -0
- package/build/src/library/contract-address.js +12 -1
- package/build/src/library/contract-execution.d.ts +2 -2
- package/build/src/library/contract-execution.js +13 -17
- package/build/src/library/contract-operations.d.ts +59 -94
- package/build/src/library/contract-operations.js +23 -19
- package/build/src/library/contract-outcomes.d.ts +3 -3
- package/build/src/library/contract-settings.d.ts +1 -0
- package/build/src/library/contract-settings.js +1 -1
- package/build/src/library/invocation.d.ts +2 -2
- package/build/src/library/invocation.js +1 -1
- package/build/src/library/keiyaku.d.ts +2 -2
- package/build/src/library/keiyaku.js +2 -2
- package/build/src/library/outcome.d.ts +148 -268
- package/build/src/library/outcome.js +4 -8
- package/build/src/library/refusal.d.ts +2 -2
- package/build/src/library/refusal.js +2 -2
- package/build/src/plugin/runtime.js +15 -19
- package/build/src/protocol/{audit.d.ts → delivery-preview.d.ts} +62 -97
- package/build/src/protocol/delivery-preview.js +167 -0
- package/build/src/protocol/progress.d.ts +1 -1
- package/build/src/runtime/proc/run.js +22 -4
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/verification/execution.d.ts +1 -1
- package/build/src/verification/execution.js +5 -3
- package/package.json +5 -2
- package/skills/keiyaku/SKILL.md +3 -1
- package/skills/keiyaku-babysit/SKILL.md +1 -1
- package/skills/keiyaku-bind/SKILL.md +3 -2
- package/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/src/cli/render/audit.d.ts +0 -7
- package/build/src/protocol/audit.js +0 -203
|
@@ -10,7 +10,7 @@ import { documentDiff } from "../markdown/diff.js";
|
|
|
10
10
|
import { abandonOperation } from "../protocol/abandon.js";
|
|
11
11
|
import { amendOperation } from "../protocol/amend.js";
|
|
12
12
|
import { arcOperation } from "../protocol/arc.js";
|
|
13
|
-
import {
|
|
13
|
+
import { previewDeliveryOperation } from "../protocol/delivery-preview.js";
|
|
14
14
|
import { completeCandidate } from "../protocol/completion.js";
|
|
15
15
|
import { admitDeliveryOperation } from "../protocol/deliver.js";
|
|
16
16
|
import { withScopeAbortSignal, } from "../protocol/operations.js";
|
|
@@ -20,7 +20,7 @@ import { releaseDebtHolder, releaseDebtHolderWithFence, debtHolderObservationSel
|
|
|
20
20
|
import { continueDeliveredDependents } from "./continuation.js";
|
|
21
21
|
import { requestForwardedContractLive } from "./contract-operations.js";
|
|
22
22
|
import { acceptedOutcome, expected, retainAdmission } from "./contract-outcomes.js";
|
|
23
|
-
import { derivedContractPolicy, derivedGates, derivedHooks, gateNames, } from "./contract-settings.js";
|
|
23
|
+
import { derivedContractPolicy, derivedFreshness, derivedGates, derivedHooks, gateNames, } from "./contract-settings.js";
|
|
24
24
|
import { deliveryForContract } from "./delivery.js";
|
|
25
25
|
import { actorOption, contractTerms, documentDerivation, normalizedList, optionalBoolean, optionalNonblank, optionalSignal, requireInput, requireMarkdown, } from "./input.js";
|
|
26
26
|
import { InvocationAccumulator } from "./invocation.js";
|
|
@@ -300,8 +300,10 @@ export class ContractExecution {
|
|
|
300
300
|
return acceptedOutcome("arc", this.id, accumulator, undefined);
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
|
-
async
|
|
304
|
-
const values = validated(() => input === undefined
|
|
303
|
+
async previewDelivery(input, options) {
|
|
304
|
+
const values = validated(() => input === undefined
|
|
305
|
+
? undefined
|
|
306
|
+
: requireInput(input, "delivery preview input", ["includeDirty", "showDiff", "signal"]));
|
|
305
307
|
const includeDirty = validated(() => optionalBoolean(values?.includeDirty, "includeDirty") ?? false);
|
|
306
308
|
const showDiff = validated(() => optionalBoolean(values?.showDiff, "showDiff") ?? false);
|
|
307
309
|
const signal = validated(() => optionalSignal(values?.signal));
|
|
@@ -310,20 +312,20 @@ export class ContractExecution {
|
|
|
310
312
|
if (channel.kind === "body-request")
|
|
311
313
|
return await forwardedContractOutcome({
|
|
312
314
|
directory: channel.directory,
|
|
313
|
-
action: "contract.
|
|
315
|
+
action: "contract.preview-delivery",
|
|
314
316
|
...(observer === undefined ? {} : { observe: observer }),
|
|
315
317
|
...(signal === undefined ? {} : { signal }),
|
|
316
318
|
request: {
|
|
317
|
-
action: "contract.
|
|
319
|
+
action: "contract.preview-delivery",
|
|
318
320
|
repoRoot: this.scope.primaryWorktree,
|
|
319
321
|
contractId: this.id,
|
|
320
322
|
includeDirty,
|
|
321
323
|
showDiff,
|
|
322
324
|
},
|
|
323
325
|
});
|
|
324
|
-
const
|
|
325
|
-
return await this.local("
|
|
326
|
-
const admission = await
|
|
326
|
+
const requireBranchesToBeUpToDate = derivedFreshness(this.composition);
|
|
327
|
+
return await this.local("deliver-preview", async (accumulator, localChannel, scope) => {
|
|
328
|
+
const admission = await previewDeliveryOperation({
|
|
327
329
|
scope,
|
|
328
330
|
channel: localChannel,
|
|
329
331
|
progress: accumulator,
|
|
@@ -337,14 +339,8 @@ export class ContractExecution {
|
|
|
337
339
|
});
|
|
338
340
|
if (admission.kind !== "accepted")
|
|
339
341
|
return expected(this.id, admission);
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
channel: localChannel,
|
|
343
|
-
leading: admission,
|
|
344
|
-
hooks,
|
|
345
|
-
value: (value) => value,
|
|
346
|
-
});
|
|
347
|
-
return acceptedOutcome("audit", this.id, accumulator, report);
|
|
342
|
+
accumulator.recordDeliveryPreview(this.id, admission.value);
|
|
343
|
+
return { kind: "accepted", contract: this.id, head: admission.head, value: admission.value };
|
|
348
344
|
}, signal, observer);
|
|
349
345
|
}
|
|
350
346
|
/** One accumulator before the first admission-capable await, one projector after teardown. */
|
|
@@ -4,10 +4,10 @@ import type { ActorId } from "../core/facts/types.js";
|
|
|
4
4
|
import { type ExecutionObserver } from "../protocol/execution-observation.js";
|
|
5
5
|
type DeliveryResult = import("./contract-outcomes.js").DeliverOutcome;
|
|
6
6
|
type ReviewResult = import("./contract-outcomes.js").ReviewOutcome;
|
|
7
|
-
type
|
|
8
|
-
type ContractResult = DeliveryResult | ReviewResult |
|
|
7
|
+
type DeliveryPreviewResult = import("./contract-outcomes.js").DeliveryPreviewOutcome;
|
|
8
|
+
type ContractResult = DeliveryResult | ReviewResult | DeliveryPreviewResult;
|
|
9
9
|
type ContractRequester = ActorId;
|
|
10
|
-
declare const
|
|
10
|
+
declare const previewRequestSchema: z.ZodPipe<z.ZodObject<{
|
|
11
11
|
repoRoot: z.ZodString;
|
|
12
12
|
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
|
|
13
13
|
includeDirty: z.ZodBoolean;
|
|
@@ -17,7 +17,7 @@ declare const auditRequestSchema: z.ZodPipe<z.ZodObject<{
|
|
|
17
17
|
contractId: import("../core/facts/types.js").ContractId;
|
|
18
18
|
includeDirty: boolean;
|
|
19
19
|
showDiff: boolean;
|
|
20
|
-
action: "contract.
|
|
20
|
+
action: "contract.preview-delivery";
|
|
21
21
|
}, {
|
|
22
22
|
repoRoot: string;
|
|
23
23
|
contractId: import("../core/facts/types.js").ContractId;
|
|
@@ -70,17 +70,17 @@ declare const reviewRequestSchema: z.ZodPipe<z.ZodObject<{
|
|
|
70
70
|
summary?: string | undefined;
|
|
71
71
|
actor?: string | undefined;
|
|
72
72
|
}>>;
|
|
73
|
-
export type ContractRequest = z.infer<typeof
|
|
73
|
+
export type ContractRequest = z.infer<typeof previewRequestSchema> | z.infer<typeof deliverRequestSchema> | z.infer<typeof reviewRequestSchema>;
|
|
74
74
|
type DeliverRequest = Extract<ContractRequest, {
|
|
75
75
|
action: "contract.deliver";
|
|
76
76
|
}>;
|
|
77
77
|
type ReviewRequest = Extract<ContractRequest, {
|
|
78
78
|
action: "contract.review";
|
|
79
79
|
}>;
|
|
80
|
-
type
|
|
81
|
-
action: "contract.
|
|
80
|
+
type DeliveryPreviewRequest = Extract<ContractRequest, {
|
|
81
|
+
action: "contract.preview-delivery";
|
|
82
82
|
}>;
|
|
83
|
-
type ContractResultFor<Action extends ContractRequest["action"]> = Action extends "contract.deliver" ? DeliveryResult : Action extends "contract.review" ? ReviewResult :
|
|
83
|
+
type ContractResultFor<Action extends ContractRequest["action"]> = Action extends "contract.deliver" ? DeliveryResult : Action extends "contract.review" ? ReviewResult : DeliveryPreviewResult;
|
|
84
84
|
type ContractRequestFor<Action extends ContractRequest["action"]> = Extract<ContractRequest, {
|
|
85
85
|
action: Action;
|
|
86
86
|
}>;
|
|
@@ -100,7 +100,7 @@ declare const materializedHandoffReferenceSchema: z.ZodObject<{
|
|
|
100
100
|
}, z.core.$strict>;
|
|
101
101
|
}, z.core.$strict>;
|
|
102
102
|
declare const contractServiceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
103
|
-
kind: z.ZodLiteral<"
|
|
103
|
+
kind: z.ZodLiteral<"delivery-preview-report">;
|
|
104
104
|
repoRoot: z.ZodString;
|
|
105
105
|
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
|
|
106
106
|
report: z.ZodObject<{
|
|
@@ -196,92 +196,49 @@ declare const contractServiceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
196
196
|
paths: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
197
197
|
}, z.core.$strict>;
|
|
198
198
|
diff: z.ZodOptional<z.ZodString>;
|
|
199
|
+
requirements: z.ZodObject<{
|
|
200
|
+
gates: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
201
|
+
gate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>;
|
|
202
|
+
current: z.ZodUnion<readonly [z.ZodObject<{
|
|
203
|
+
kind: z.ZodLiteral<"missing">;
|
|
204
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
205
|
+
kind: z.ZodLiteral<"attested">;
|
|
206
|
+
verdict: z.ZodEnum<{
|
|
207
|
+
satisfied: "satisfied";
|
|
208
|
+
unsatisfied: "unsatisfied";
|
|
209
|
+
}>;
|
|
210
|
+
at: z.ZodString;
|
|
211
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
213
|
+
kind: z.ZodLiteral<"stale">;
|
|
214
|
+
priorVerdict: z.ZodEnum<{
|
|
215
|
+
satisfied: "satisfied";
|
|
216
|
+
unsatisfied: "unsatisfied";
|
|
217
|
+
}>;
|
|
218
|
+
reason: z.ZodOptional<z.ZodObject<{
|
|
219
|
+
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
220
|
+
target: z.ZodOptional<z.ZodString>;
|
|
221
|
+
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
222
|
+
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
223
|
+
}, z.core.$strict>>;
|
|
224
|
+
}, z.core.$strict>]>;
|
|
225
|
+
}, z.core.$strict>>>;
|
|
226
|
+
unmetPrerequisites: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
227
|
+
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
|
|
228
|
+
state: z.ZodEnum<{
|
|
229
|
+
abandoned: "abandoned";
|
|
230
|
+
missing: "missing";
|
|
231
|
+
active: "active";
|
|
232
|
+
}>;
|
|
233
|
+
}, z.core.$strict>>>;
|
|
234
|
+
}, z.core.$strict>;
|
|
199
235
|
}, z.core.$strict>]>;
|
|
200
236
|
verification: z.ZodUnion<readonly [z.ZodObject<{
|
|
201
237
|
kind: z.ZodLiteral<"not-run">;
|
|
202
238
|
}, z.core.$strict>, z.ZodObject<{
|
|
203
239
|
kind: z.ZodLiteral<"undeclared">;
|
|
204
240
|
}, z.core.$strict>, z.ZodObject<{
|
|
205
|
-
kind: z.ZodLiteral<"
|
|
206
|
-
stop: z.ZodUnion<readonly [z.ZodObject<{
|
|
207
|
-
refusal: z.ZodUnion<readonly [z.ZodObject<{
|
|
208
|
-
kind: z.ZodEnum<{
|
|
209
|
-
terminal: "terminal";
|
|
210
|
-
"contract-missing": "contract-missing";
|
|
211
|
-
}>;
|
|
212
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
|
|
213
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
214
|
-
kind: z.ZodLiteral<"verification-declaration-invalid">;
|
|
215
|
-
contractId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>>;
|
|
216
|
-
}, z.core.$strict>]>;
|
|
217
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
218
|
-
retry: z.ZodUnion<readonly [z.ZodObject<{
|
|
219
|
-
kind: z.ZodEnum<{
|
|
220
|
-
exhausted: "exhausted";
|
|
221
|
-
collision: "collision";
|
|
222
|
-
}>;
|
|
223
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
224
|
-
kind: z.ZodLiteral<"publication-failed">;
|
|
225
|
-
diagnostic: z.ZodString;
|
|
226
|
-
}, z.core.$strict>]>;
|
|
227
|
-
}, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
|
|
228
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
229
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
230
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
231
|
-
failure: z.ZodEnum<{
|
|
232
|
-
cancelled: "cancelled";
|
|
233
|
-
"unknown-exit": "unknown-exit";
|
|
234
|
-
}>;
|
|
235
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
236
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
237
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
238
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
239
|
-
failure: z.ZodEnum<{
|
|
240
|
-
"spawn-error": "spawn-error";
|
|
241
|
-
"candidate-unavailable": "candidate-unavailable";
|
|
242
|
-
}>;
|
|
243
|
-
diagnostic: z.ZodString;
|
|
244
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
245
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
246
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
247
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
248
|
-
failure: z.ZodLiteral<"environment-failure">;
|
|
249
|
-
diagnostic: z.ZodString;
|
|
250
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
251
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
252
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
253
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
254
|
-
failure: z.ZodLiteral<"environment-failure">;
|
|
255
|
-
name: z.ZodString;
|
|
256
|
-
detail: z.ZodUnion<readonly [z.ZodObject<{
|
|
257
|
-
kind: z.ZodLiteral<"exit">;
|
|
258
|
-
code: z.ZodNumber;
|
|
259
|
-
stdout: z.ZodString;
|
|
260
|
-
stderr: z.ZodString;
|
|
261
|
-
truncated: z.ZodBoolean;
|
|
262
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
263
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
264
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
265
|
-
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
266
|
-
kind: z.ZodLiteral<"timeout">;
|
|
267
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
268
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
269
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
270
|
-
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
271
|
-
kind: z.ZodLiteral<"unknown-exit">;
|
|
272
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
273
|
-
kind: z.ZodLiteral<"spawn-error">;
|
|
274
|
-
diagnostic: z.ZodString;
|
|
275
|
-
}, z.core.$strict>]>;
|
|
276
|
-
}, z.core.$strict>]>]>;
|
|
277
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
278
|
-
kind: z.ZodEnum<{
|
|
279
|
-
satisfied: "satisfied";
|
|
280
|
-
unsatisfied: "unsatisfied";
|
|
281
|
-
}>;
|
|
282
|
-
passed: z.ZodNumber;
|
|
283
|
-
total: z.ZodNumber;
|
|
284
|
-
summary: z.ZodOptional<z.ZodString>;
|
|
241
|
+
kind: z.ZodLiteral<"required">;
|
|
285
242
|
}, z.core.$strict>, z.ZodObject<{
|
|
286
243
|
entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
|
|
287
244
|
verdict: z.ZodEnum<{
|
|
@@ -289,7 +246,7 @@ declare const contractServiceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
289
246
|
unsatisfied: "unsatisfied";
|
|
290
247
|
}>;
|
|
291
248
|
summary: z.ZodOptional<z.ZodString>;
|
|
292
|
-
kind: z.ZodLiteral<"
|
|
249
|
+
kind: z.ZodLiteral<"recorded">;
|
|
293
250
|
}, z.core.$strict>]>;
|
|
294
251
|
target: z.ZodUnion<readonly [z.ZodObject<{
|
|
295
252
|
kind: z.ZodLiteral<"not-observed">;
|
|
@@ -297,6 +254,14 @@ declare const contractServiceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
297
254
|
kind: z.ZodLiteral<"placeable">;
|
|
298
255
|
ref: z.ZodString;
|
|
299
256
|
head: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
257
|
+
checkouts: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
258
|
+
kind: z.ZodLiteral<"followable">;
|
|
259
|
+
path: z.ZodString;
|
|
260
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
261
|
+
kind: z.ZodLiteral<"not-followable">;
|
|
262
|
+
path: z.ZodString;
|
|
263
|
+
diagnostic: z.ZodString;
|
|
264
|
+
}, z.core.$strict>]>>>;
|
|
300
265
|
}, z.core.$strict>, z.ZodObject<{
|
|
301
266
|
kind: z.ZodLiteral<"moved">;
|
|
302
267
|
ref: z.ZodString;
|
|
@@ -383,11 +348,11 @@ declare const contractServiceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
383
348
|
type ContractService = z.infer<typeof contractServiceSchema>;
|
|
384
349
|
type ContractReference = ContractService | z.infer<typeof materializedHandoffReferenceSchema>;
|
|
385
350
|
export type ContractRequestPort = Readonly<{
|
|
386
|
-
|
|
351
|
+
previewDelivery(input: DeliveryPreviewRequest & Readonly<{
|
|
387
352
|
requester: ContractRequester;
|
|
388
353
|
signal: AbortSignal;
|
|
389
354
|
observe?: ExecutionObserver;
|
|
390
|
-
}>): Promise<
|
|
355
|
+
}>): Promise<DeliveryPreviewResult>;
|
|
391
356
|
deliver(input: DeliverRequest & Readonly<{
|
|
392
357
|
requester: ContractRequester;
|
|
393
358
|
signal: AbortSignal;
|
|
@@ -401,7 +366,7 @@ export type ContractRequestPort = Readonly<{
|
|
|
401
366
|
}>;
|
|
402
367
|
export declare function contractRequestProtocol(action: ContractRequest["action"]): RequestProtocol<ContractRequest, ContractResult, ContractReference>;
|
|
403
368
|
export declare function contractRequestCommand(action: ContractRequest["action"], port: ContractRequestPort): ServiceRequestCommand<ContractRequest, ContractResult, ContractService, ContractReference>;
|
|
404
|
-
export declare function contractRequestCommands(port: ContractRequestPort): Readonly<Record<"contract.
|
|
369
|
+
export declare function contractRequestCommands(port: ContractRequestPort): Readonly<Record<"contract.preview-delivery" | "contract.deliver" | "contract.review", ErasedRequestCommand>>;
|
|
405
370
|
export declare function requestForwardedContractLive<Action extends ContractRequest["action"]>(input: Readonly<{
|
|
406
371
|
directory: string;
|
|
407
372
|
action: Action;
|
|
@@ -412,6 +377,6 @@ export declare function requestForwardedContractLive<Action extends ContractRequ
|
|
|
412
377
|
/** Map durable request disposition without reconstructing an expired owner answer. */
|
|
413
378
|
export declare function mapForwardedContractFailure(error: unknown, request: ContractRequest): {
|
|
414
379
|
kind: "returned";
|
|
415
|
-
result: import("./outcome.js").ProjectedOutcome<"deliver" | "review" | "
|
|
380
|
+
result: import("./outcome.js").ProjectedOutcome<"deliver" | "review" | "deliver-preview", unknown, unknown>;
|
|
416
381
|
};
|
|
417
382
|
export {};
|
|
@@ -2,7 +2,7 @@ import { isAbsolute, resolve } from "node:path";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { AkumaBodyRequestError, requestBodyCommand } from "../akuma/request-rendezvous.js";
|
|
4
4
|
import { eraseRequestCommand, } from "../akuma/request-wire.js";
|
|
5
|
-
import {
|
|
5
|
+
import { deliveryPreviewReportSchema } from "../protocol/delivery-preview.js";
|
|
6
6
|
import { materializedConflictSchema } from "../protocol/deliver.js";
|
|
7
7
|
import { observationSchema, observeExecution } from "../protocol/execution-observation.js";
|
|
8
8
|
import { contractIdSchema } from "../protocol/operations.js";
|
|
@@ -12,12 +12,12 @@ import { decodeFailureWire, encodeFailureWire, KeiyakuError, outcomeSchema, proj
|
|
|
12
12
|
const absolutePathSchema = z.string().refine((value) => isAbsolute(value) && resolve(value) === value);
|
|
13
13
|
const nonblankStringSchema = z.string().refine((value) => value.trim() !== "");
|
|
14
14
|
const contractRequestBaseSchema = z.object({ repoRoot: absolutePathSchema, contractId: contractIdSchema }).strict();
|
|
15
|
-
const
|
|
15
|
+
const previewRequestSchema = contractRequestBaseSchema
|
|
16
16
|
.extend({
|
|
17
17
|
includeDirty: z.boolean(),
|
|
18
18
|
showDiff: z.boolean(),
|
|
19
19
|
})
|
|
20
|
-
.transform((request) => ({ action: "contract.
|
|
20
|
+
.transform((request) => ({ action: "contract.preview-delivery", ...request }));
|
|
21
21
|
const deliverRequestSchema = contractRequestBaseSchema
|
|
22
22
|
.extend({
|
|
23
23
|
includeDirty: z.boolean(),
|
|
@@ -33,12 +33,12 @@ const reviewRequestSchema = contractRequestBaseSchema
|
|
|
33
33
|
actor: z.string().optional(),
|
|
34
34
|
})
|
|
35
35
|
.transform((request) => ({ action: "contract.review", ...request }));
|
|
36
|
-
const
|
|
36
|
+
const previewServiceSchema = z
|
|
37
37
|
.object({
|
|
38
|
-
kind: z.literal("
|
|
38
|
+
kind: z.literal("delivery-preview-report"),
|
|
39
39
|
repoRoot: absolutePathSchema,
|
|
40
40
|
contractId: contractIdSchema,
|
|
41
|
-
report:
|
|
41
|
+
report: deliveryPreviewReportSchema,
|
|
42
42
|
})
|
|
43
43
|
.strict();
|
|
44
44
|
const deliveryReferenceSchema = z
|
|
@@ -66,14 +66,14 @@ const materializedHandoffServiceSchema = materializedConflictSchema
|
|
|
66
66
|
})
|
|
67
67
|
.strict();
|
|
68
68
|
const contractServiceSchema = z.union([
|
|
69
|
-
|
|
69
|
+
previewServiceSchema,
|
|
70
70
|
deliveryReferenceSchema,
|
|
71
71
|
materializedHandoffServiceSchema,
|
|
72
72
|
reviewReferenceSchema,
|
|
73
73
|
]);
|
|
74
74
|
function decodeContractRequest(action, value) {
|
|
75
|
-
const schema = action === "contract.
|
|
76
|
-
?
|
|
75
|
+
const schema = action === "contract.preview-delivery"
|
|
76
|
+
? previewRequestSchema
|
|
77
77
|
: action === "contract.deliver"
|
|
78
78
|
? deliverRequestSchema
|
|
79
79
|
: reviewRequestSchema;
|
|
@@ -81,8 +81,8 @@ function decodeContractRequest(action, value) {
|
|
|
81
81
|
return parsed.success ? parsed.data : null;
|
|
82
82
|
}
|
|
83
83
|
function decodeContractService(action, value) {
|
|
84
|
-
const schema = action === "contract.
|
|
85
|
-
?
|
|
84
|
+
const schema = action === "contract.preview-delivery"
|
|
85
|
+
? previewServiceSchema
|
|
86
86
|
: action === "contract.deliver"
|
|
87
87
|
? z.union([deliveryReferenceSchema, materializedHandoffServiceSchema])
|
|
88
88
|
: reviewReferenceSchema;
|
|
@@ -125,8 +125,8 @@ function acceptedReviewEvidence(result, contractId) {
|
|
|
125
125
|
}
|
|
126
126
|
async function executeContractRequest(request, facts, port) {
|
|
127
127
|
const observation = executionObservation(facts);
|
|
128
|
-
if (request.action === "contract.
|
|
129
|
-
const result = await port.
|
|
128
|
+
if (request.action === "contract.preview-delivery") {
|
|
129
|
+
const result = await port.previewDelivery({
|
|
130
130
|
...request,
|
|
131
131
|
...observation,
|
|
132
132
|
requester: facts.requester,
|
|
@@ -138,7 +138,7 @@ async function executeContractRequest(request, facts, port) {
|
|
|
138
138
|
kind: "served",
|
|
139
139
|
result,
|
|
140
140
|
service: {
|
|
141
|
-
kind: "
|
|
141
|
+
kind: "delivery-preview-report",
|
|
142
142
|
repoRoot: request.repoRoot,
|
|
143
143
|
contractId: request.contractId,
|
|
144
144
|
report: result.value,
|
|
@@ -202,8 +202,8 @@ async function executeContractRequest(request, facts, port) {
|
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
function decodedContractResult(action, value) {
|
|
205
|
-
const schema = action === "contract.
|
|
206
|
-
? outcomeSchema("
|
|
205
|
+
const schema = action === "contract.preview-delivery"
|
|
206
|
+
? outcomeSchema("deliver-preview", deliveryPreviewReportSchema)
|
|
207
207
|
: action === "contract.deliver"
|
|
208
208
|
? outcomeSchema("deliver", deliveryValueSchema, materializedHandoffReferenceSchema)
|
|
209
209
|
: outcomeSchema("review", reviewSchema);
|
|
@@ -226,7 +226,7 @@ export function contractRequestProtocol(action) {
|
|
|
226
226
|
encodeFailure: encodeFailureWire,
|
|
227
227
|
decodeFailure: (value) => decodeFailureWire(value),
|
|
228
228
|
decodeReference: (reference) => decodeContractReference(action, reference),
|
|
229
|
-
isPermitted: (allowed) => allowed.includes(action),
|
|
229
|
+
isPermitted: (allowed) => action === "contract.preview-delivery" || allowed.includes(action),
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
232
|
export function contractRequestCommand(action, port) {
|
|
@@ -241,7 +241,7 @@ export function contractRequestCommand(action, port) {
|
|
|
241
241
|
}
|
|
242
242
|
export function contractRequestCommands(port) {
|
|
243
243
|
return {
|
|
244
|
-
"contract.
|
|
244
|
+
"contract.preview-delivery": eraseRequestCommand(contractRequestCommand("contract.preview-delivery", port)),
|
|
245
245
|
"contract.deliver": eraseRequestCommand(contractRequestCommand("contract.deliver", port)),
|
|
246
246
|
"contract.review": eraseRequestCommand(contractRequestCommand("contract.review", port)),
|
|
247
247
|
};
|
|
@@ -271,7 +271,11 @@ export async function requestForwardedContractLive(input) {
|
|
|
271
271
|
/** Map durable request disposition without reconstructing an expired owner answer. */
|
|
272
272
|
export function mapForwardedContractFailure(error, request) {
|
|
273
273
|
if (error instanceof AkumaBodyRequestError && error.outcome === "voided") {
|
|
274
|
-
const operation = request.action === "contract.
|
|
274
|
+
const operation = request.action === "contract.preview-delivery"
|
|
275
|
+
? "deliver-preview"
|
|
276
|
+
: request.action === "contract.review"
|
|
277
|
+
? "review"
|
|
278
|
+
: "deliver";
|
|
275
279
|
const projected = project(operation, new InvocationAccumulator().snapshot(), {
|
|
276
280
|
kind: "retry",
|
|
277
281
|
contract: request.contractId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @architectureCompositionRoot */
|
|
2
2
|
import type { ContractId, Gate } from "../core/facts/types.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { DeliveryPreviewReport } from "../protocol/delivery-preview.js";
|
|
4
4
|
import type { ExecutionObserver } from "../protocol/execution-observation.js";
|
|
5
5
|
import type { IntentOutcome, IntentRetry } from "../protocol/operations.js";
|
|
6
6
|
import type { ContractWorkspaceLocation } from "../workspace-place.js";
|
|
@@ -26,13 +26,13 @@ export type BindOutcome = OperationOutcome<"bind", BindValue, OperationRefusals[
|
|
|
26
26
|
export type AmendOutcome = OperationOutcome<"amend", AmendValue, OperationRefusals["amend"]>;
|
|
27
27
|
export type DeliverOutcome = OperationOutcome<"deliver", Delivery & DeliveryValue, OperationRefusals["deliver"]> | HandoffOutcome;
|
|
28
28
|
export type ReviewOutcome = OperationOutcome<"review", Review, OperationRefusals["review"]>;
|
|
29
|
-
export type
|
|
29
|
+
export type DeliveryPreviewOutcome = OperationOutcome<"deliver-preview", DeliveryPreviewReport, OperationRefusals["deliver-preview"]>;
|
|
30
30
|
export type ArcOutcome = OperationOutcome<"arc", void, OperationRefusals["arc"]>;
|
|
31
31
|
export type AbandonOutcome = OperationOutcome<"abandon", void, OperationRefusals["abandon"]>;
|
|
32
32
|
export type MutationObservation = Readonly<{
|
|
33
33
|
observe?: ExecutionObserver;
|
|
34
34
|
}>;
|
|
35
|
-
export type
|
|
35
|
+
export type DeliveryPreviewInput = Readonly<{
|
|
36
36
|
includeDirty?: boolean;
|
|
37
37
|
showDiff?: boolean;
|
|
38
38
|
signal?: AbortSignal;
|
|
@@ -14,6 +14,7 @@ export type LocalContractCompositionCapture = Readonly<{
|
|
|
14
14
|
* built-in gate words; a broken selected namespace fails before any admission.
|
|
15
15
|
*/
|
|
16
16
|
export declare function derivedHooks(composition: LocalContractCompositionCapture): WorktreeHooks;
|
|
17
|
+
export declare function derivedFreshness(composition: LocalContractCompositionCapture): boolean;
|
|
17
18
|
/** The two Settings-derived Contract policies one mutating operation may consume. */
|
|
18
19
|
export declare function derivedContractPolicy(composition: LocalContractCompositionCapture): Readonly<{
|
|
19
20
|
hooks: WorktreeHooks;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContractHead, ContractId, JournalEntry } from "../core/facts/types.js";
|
|
2
2
|
import type { ReconcileResult } from "../git/reconcile.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { DeliveryPreviewReport } from "../protocol/delivery-preview.js";
|
|
4
4
|
import type { CandidateCompletion, CompletionEvidence } from "../protocol/completion.js";
|
|
5
5
|
import { type ExecutionObservation, type ExecutionObserver } from "../protocol/execution-observation.js";
|
|
6
6
|
import type { AcceptedProtocolStep } from "../protocol/outcome.js";
|
|
@@ -60,7 +60,7 @@ export declare class InvocationAccumulator implements ProtocolProgress {
|
|
|
60
60
|
recordCandidate(contract: ContractId, evidence: CompletionEvidence): void;
|
|
61
61
|
/** The candidate's completion base, known before an optional observation can fail. */
|
|
62
62
|
recordCompletion(contract: ContractId, completion: CandidateCompletion): void;
|
|
63
|
-
|
|
63
|
+
recordDeliveryPreview(contract: ContractId, report: Partial<DeliveryPreviewReport>): void;
|
|
64
64
|
/** Physical residue a continuation's dependent reconciliation observed. */
|
|
65
65
|
recordPhysical(contract: ContractId, physical: ReconcileResult): void;
|
|
66
66
|
recordPlacementPhysical(contract: ContractId, physical: ReconcileResult): void;
|
|
@@ -129,7 +129,7 @@ export class InvocationAccumulator {
|
|
|
129
129
|
recordCompletion(contract, completion) {
|
|
130
130
|
this.extendConclusions(contract, { completion });
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
recordDeliveryPreview(contract, report) {
|
|
133
133
|
this.extendConclusions(contract, report);
|
|
134
134
|
}
|
|
135
135
|
/** Physical residue a continuation's dependent reconciliation observed. */
|
|
@@ -3,7 +3,7 @@ import { type ExecutionContext } from "../akuma/requests.js";
|
|
|
3
3
|
import type { ContractId, ContractState } from "../core/facts/types.js";
|
|
4
4
|
import { type RepositoryScope } from "../protocol/operations.js";
|
|
5
5
|
import { type KeiyakuLibrary } from "./contract-composition.js";
|
|
6
|
-
import type { AbandonOutcome, AmendOutcome, ArcOutcome,
|
|
6
|
+
import type { AbandonOutcome, AmendOutcome, ArcOutcome, DeliveryPreviewInput, DeliveryPreviewOutcome, DeliverOutcome, MutationObservation, ReviewOutcome } from "./contract-outcomes.js";
|
|
7
7
|
import type { LocalContractCompositionCapture } from "./contract-settings.js";
|
|
8
8
|
import type { AbandonInput, AmendInput, ArcInput, ContractHistory, DeliverInput, LocalContractComposition, ReviewInput } from "./contract-types.js";
|
|
9
9
|
import { type Delivery } from "./delivery.js";
|
|
@@ -31,7 +31,7 @@ export declare class Keiyaku {
|
|
|
31
31
|
review(input: ReviewInput, options?: MutationObservation): Promise<ReviewOutcome>;
|
|
32
32
|
abandon(input?: AbandonInput): Promise<AbandonOutcome>;
|
|
33
33
|
arc(input: ArcInput): Promise<ArcOutcome>;
|
|
34
|
-
|
|
34
|
+
previewDelivery(input?: DeliveryPreviewInput, options?: MutationObservation): Promise<DeliveryPreviewOutcome>;
|
|
35
35
|
}
|
|
36
36
|
/** Internal constructor capability; callers select a Contract through Keiyaku.with. */
|
|
37
37
|
export declare function createKeiyakuHandle(id: ContractId, scope: RepositoryScope, execution: ExecutionContext, composition: LocalContractCompositionCapture): Keiyaku;
|
|
@@ -112,8 +112,8 @@ export class Keiyaku {
|
|
|
112
112
|
async arc(input) {
|
|
113
113
|
return await this.operations.arc(input);
|
|
114
114
|
}
|
|
115
|
-
async
|
|
116
|
-
return await this.operations.
|
|
115
|
+
async previewDelivery(input, options) {
|
|
116
|
+
return await this.operations.previewDelivery(input, options);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
/** Internal constructor capability; callers select a Contract through Keiyaku.with. */
|