@astrosheep/keiyaku 4.6.32 → 4.6.33
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/README.md +8 -6
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +13 -9
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +13 -9
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +13 -9
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/pi/README.md +55 -97
- package/build/plugins/pi/keiyaku.ts +2 -9
- package/build/skills/keiyaku-akuma/SKILL.md +13 -9
- package/build/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/src/akuma/akuma-instance.d.ts +11 -0
- package/build/src/akuma/akuma-instance.js +1 -2
- package/build/src/akuma/akuma-observe.js +73 -14
- package/build/src/akuma/akuma-selection-execution.d.ts +82 -7
- package/build/src/akuma/akuma-selection-execution.js +26 -27
- package/build/src/akuma/akuma-wait.d.ts +40 -1
- package/build/src/akuma/akuma-wait.js +58 -29
- package/build/src/akuma/akuma.d.ts +11 -0
- package/build/src/akuma/body.js +13 -18
- package/build/src/akuma/call-initial-tell.d.ts +0 -1
- package/build/src/akuma/call-initial-tell.js +0 -1
- package/build/src/akuma/heart/activity-schema.d.ts +16 -0
- package/build/src/akuma/heart/activity-schema.js +7 -0
- package/build/src/akuma/heart/index.d.ts +1 -1
- package/build/src/akuma/heart/index.js +9 -1
- package/build/src/akuma/heart/timeline.js +4 -4
- package/build/src/akuma/projection-read.d.ts +4 -2
- package/build/src/akuma/projection-read.js +21 -14
- package/build/src/akuma/projection.d.ts +94 -2
- package/build/src/akuma/projection.js +47 -47
- package/build/src/akuma/provider.d.ts +2 -2
- package/build/src/akuma/provider.js +27 -20
- package/build/src/akuma/providers/acp/core.js +2 -5
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +2 -1
- package/build/src/akuma/providers/opencode-sdk/events.js +31 -1
- package/build/src/akuma/publication.js +3 -2
- package/build/src/akuma/selection-observation.d.ts +23 -0
- package/build/src/akuma/selection-observation.js +15 -4
- package/build/src/akuma/status-projection.d.ts +14 -1
- package/build/src/akuma/status-projection.js +40 -2
- package/build/src/akuma/turn-drive.js +21 -15
- package/build/src/body/amend.js +5 -17
- package/build/src/body/decode.js +11 -1
- package/build/src/body/envelope.d.ts +5 -1
- package/build/src/body/envelope.js +4 -2
- package/build/src/body/render.js +4 -6
- package/build/src/cli/commands/akuma-grammar.d.ts +3 -5
- package/build/src/cli/commands/akuma-grammar.js +22 -40
- package/build/src/cli/commands/akuma.d.ts +1 -2
- package/build/src/cli/commands/akuma.js +6 -58
- package/build/src/cli/commands/contract-grammar.d.ts +1 -0
- package/build/src/cli/commands/contract-grammar.js +7 -11
- package/build/src/cli/commands/contract-help.d.ts +3 -2
- package/build/src/cli/commands/contract-help.js +11 -5
- package/build/src/cli/commands/contract.js +3 -0
- package/build/src/cli/commands/debt-grammar.js +2 -4
- package/build/src/cli/parse.js +1 -4
- package/build/src/cli/render/akuma-activity.d.ts +3 -15
- package/build/src/cli/render/akuma-activity.js +19 -73
- package/build/src/cli/render/akuma.d.ts +5 -11
- package/build/src/cli/render/akuma.js +22 -30
- package/build/src/cli/render/catalog.js +1 -4
- package/build/src/cli/render/contract-history.js +2 -0
- package/build/src/cli/render/contract-observation.d.ts +2 -1
- package/build/src/cli/render/contract-observation.js +25 -1
- package/build/src/cli/render/contract-wait.d.ts +2 -2
- package/build/src/cli/render/contract-wait.js +13 -17
- package/build/src/cli/render/contract.js +12 -9
- package/build/src/cli/render/debt.js +1 -2
- package/build/src/cli/render/execution-progress.js +1 -3
- package/build/src/cli/render/kanshi-akuma.js +1 -2
- package/build/src/cli/render/kanshi.js +11 -17
- package/build/src/cli/render/receipt.d.ts +1 -1
- package/build/src/cli/render/receipt.js +33 -28
- package/build/src/cli/render/reconcile.js +2 -5
- package/build/src/cli/render/refusal.js +3 -6
- package/build/src/cli/render/terminal.d.ts +2 -4
- package/build/src/cli/render/terminal.js +10 -17
- package/build/src/cli/render/verbs.d.ts +1 -0
- package/build/src/cli/render/verbs.js +19 -17
- package/build/src/cli/runtime.js +3 -9
- package/build/src/core/facts/codec.js +7 -2
- package/build/src/core/facts/eligibility.d.ts +4 -4
- package/build/src/core/facts/eligibility.js +11 -0
- package/build/src/core/facts/fold.js +9 -5
- package/build/src/core/facts/gate.d.ts +5 -1
- package/build/src/core/facts/gate.js +14 -10
- package/build/src/core/facts/types.d.ts +5 -1
- package/build/src/core/facts/types.js +7 -0
- package/build/src/core/subject.d.ts +4 -1
- package/build/src/core/subject.js +10 -2
- package/build/src/core/verbs/amend.d.ts +15 -4
- package/build/src/core/verbs/amend.js +19 -9
- package/build/src/debt/index.d.ts +0 -1
- package/build/src/debt/index.js +6 -11
- package/build/src/debt/input.d.ts +2 -1
- package/build/src/debt/input.js +6 -4
- package/build/src/dispatch/index.d.ts +0 -17
- package/build/src/dispatch/index.js +1 -10
- package/build/src/git/identity.js +16 -45
- package/build/src/git/nuke.js +13 -23
- package/build/src/git/observe.d.ts +3 -0
- package/build/src/git/observe.js +25 -23
- package/build/src/git/process.js +11 -18
- package/build/src/git/read-observation.d.ts +5 -4
- package/build/src/git/repository.d.ts +2 -0
- package/build/src/git/repository.js +13 -1
- package/build/src/git/scratch.js +2 -14
- package/build/src/git/terminal-reconcile.js +1 -13
- package/build/src/index.d.ts +2 -0
- package/build/src/kanshi/index.d.ts +0 -1
- package/build/src/kanshi/index.js +0 -1
- package/build/src/kanshi/read.d.ts +21 -0
- package/build/src/kanshi/read.js +2 -1
- package/build/src/kanshi/report.d.ts +94 -0
- package/build/src/library/address.d.ts +12 -5
- package/build/src/library/address.js +18 -32
- package/build/src/library/akuma-creation.d.ts +39 -0
- package/build/src/library/akuma-creation.js +3 -9
- package/build/src/library/continuation.d.ts +10 -0
- package/build/src/library/contract-creation.js +10 -11
- package/build/src/library/contract-outcomes.d.ts +72 -1
- package/build/src/library/contract-outcomes.js +1 -0
- package/build/src/library/contract-types.d.ts +18 -0
- package/build/src/library/contract-types.js +2 -0
- package/build/src/library/contract-wait.d.ts +7 -0
- package/build/src/library/contract-wait.js +53 -49
- package/build/src/library/delivery.d.ts +25 -0
- package/build/src/library/input.d.ts +5 -23
- package/build/src/library/input.js +12 -7
- package/build/src/library/kei.js +39 -20
- package/build/src/library/keiyaku-classify.js +3 -3
- package/build/src/library/keiyaku-debt.js +1 -2
- package/build/src/library/keiyaku-identity.d.ts +3 -3
- package/build/src/library/keiyaku-identity.js +11 -6
- package/build/src/library/keiyaku-verbs.d.ts +456 -1362
- package/build/src/library/keiyaku-verbs.js +80 -92
- package/build/src/library/keiyaku-wait.d.ts +183 -0
- package/build/src/library/keiyaku-wait.js +213 -0
- package/build/src/library/keiyaku.d.ts +3 -1
- package/build/src/library/keiyaku.js +49 -73
- package/build/src/{mcp/output.d.ts → library/model-tools.d.ts} +227 -56
- package/build/src/library/model-tools.js +347 -0
- package/build/src/library/outcome.js +5 -6
- package/build/src/library/refusal.d.ts +25 -1
- package/build/src/library/refusal.js +4 -5
- package/build/src/library/selection.d.ts +12 -0
- package/build/src/library/selection.js +1 -2
- package/build/src/mcp/adapter.d.ts +0 -6
- package/build/src/mcp/adapter.js +10 -159
- package/build/src/mcp/description.d.ts +2 -0
- package/build/src/mcp/description.js +2 -0
- package/build/src/mcp/help.d.ts +1 -1
- package/build/src/mcp/help.js +6 -4
- package/build/src/pi/index.d.ts +3 -0
- package/build/src/pi/index.js +83 -0
- package/build/src/protocol/amend.d.ts +14 -3
- package/build/src/protocol/amend.js +113 -46
- package/build/src/protocol/bind.d.ts +1 -1
- package/build/src/protocol/bind.js +5 -16
- package/build/src/protocol/completion.d.ts +30 -0
- package/build/src/protocol/completion.js +8 -5
- package/build/src/protocol/deliver.js +7 -20
- package/build/src/protocol/delivery-preview.d.ts +5 -0
- package/build/src/protocol/execution-observation.d.ts +8 -0
- package/build/src/protocol/intent.d.ts +1 -0
- package/build/src/protocol/intent.js +4 -1
- package/build/src/protocol/operations.d.ts +54 -16
- package/build/src/protocol/operations.js +17 -31
- package/build/src/protocol/placement.js +7 -1
- package/build/src/protocol/progress.js +0 -6
- package/build/src/protocol/read/status.d.ts +40 -0
- package/build/src/protocol/read/status.js +7 -10
- package/build/src/protocol/reintegrate.js +2 -2
- package/build/src/protocol/result-leaves.d.ts +56 -8
- package/build/src/protocol/result-leaves.js +11 -2
- package/build/src/protocol/run.js +1 -4
- package/build/src/protocol/verify.d.ts +10 -0
- package/build/src/protocol/verify.js +1 -0
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/settle.js +19 -68
- package/package.json +7 -3
- package/plugins/pi/README.md +55 -97
- package/plugins/pi/keiyaku.ts +2 -9
- package/skills/keiyaku-akuma/SKILL.md +13 -9
- package/skills/keiyaku-babysit/SKILL.md +8 -6
- package/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/pi/akuma-tools.ts +0 -283
- package/build/src/body/keys.d.ts +0 -4
- package/build/src/body/keys.js +0 -11
- package/build/src/kanshi/roster.d.ts +0 -2
- package/build/src/kanshi/roster.js +0 -2
- package/build/src/mcp/output.js +0 -193
- package/plugins/pi/akuma-tools.ts +0 -283
|
@@ -17,6 +17,11 @@ export declare const requirementProblemSchema: z.ZodUnion<readonly [z.ZodReadonl
|
|
|
17
17
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
18
18
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
19
19
|
state: z.ZodLiteral<"stale">;
|
|
20
|
+
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
21
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
22
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
23
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
24
|
+
}, z.core.$strict>>>;
|
|
20
25
|
previousContentId: z.ZodExactOptional<z.ZodString>;
|
|
21
26
|
currentContentId: z.ZodExactOptional<z.ZodString>;
|
|
22
27
|
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -58,6 +63,11 @@ export declare const placementReasonSchema: z.ZodUnion<readonly [z.ZodReadonly<z
|
|
|
58
63
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
59
64
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
60
65
|
state: z.ZodLiteral<"stale">;
|
|
66
|
+
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
67
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
68
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
69
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
70
|
+
}, z.core.$strict>>>;
|
|
61
71
|
previousContentId: z.ZodExactOptional<z.ZodString>;
|
|
62
72
|
currentContentId: z.ZodExactOptional<z.ZodString>;
|
|
63
73
|
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -131,6 +141,11 @@ export declare const normalContinuationStopSchema: z.ZodUnion<readonly [z.ZodRea
|
|
|
131
141
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
132
142
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
133
143
|
state: z.ZodLiteral<"stale">;
|
|
144
|
+
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
145
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
146
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
147
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
148
|
+
}, z.core.$strict>>>;
|
|
134
149
|
previousContentId: z.ZodExactOptional<z.ZodString>;
|
|
135
150
|
currentContentId: z.ZodExactOptional<z.ZodString>;
|
|
136
151
|
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -164,6 +179,11 @@ export declare const placementStopSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
164
179
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
165
180
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
166
181
|
state: z.ZodLiteral<"stale">;
|
|
182
|
+
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
183
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
184
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
185
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
186
|
+
}, z.core.$strict>>>;
|
|
167
187
|
previousContentId: z.ZodExactOptional<z.ZodString>;
|
|
168
188
|
currentContentId: z.ZodExactOptional<z.ZodString>;
|
|
169
189
|
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -287,6 +307,11 @@ export declare const normalPlacementSchema: z.ZodUnion<readonly [z.ZodReadonly<z
|
|
|
287
307
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
288
308
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
289
309
|
state: z.ZodLiteral<"stale">;
|
|
310
|
+
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
311
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
312
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
313
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
314
|
+
}, z.core.$strict>>>;
|
|
290
315
|
previousContentId: z.ZodExactOptional<z.ZodString>;
|
|
291
316
|
currentContentId: z.ZodExactOptional<z.ZodString>;
|
|
292
317
|
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -323,6 +348,11 @@ export declare const placementSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodOb
|
|
|
323
348
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
324
349
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
325
350
|
state: z.ZodLiteral<"stale">;
|
|
351
|
+
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
352
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
353
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
354
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
355
|
+
}, z.core.$strict>>>;
|
|
326
356
|
previousContentId: z.ZodExactOptional<z.ZodString>;
|
|
327
357
|
currentContentId: z.ZodExactOptional<z.ZodString>;
|
|
328
358
|
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { targetName } from "../core/facts/types.js";
|
|
3
3
|
import { snapshotIdSchema, contractIdSchema } from "../git/identity.js";
|
|
4
|
-
import { requirementIdSchema, gateSchema } from "./result-leaves.js";
|
|
4
|
+
import { requirementIdSchema, gateSchema, snapshotChangeSchema } from "./result-leaves.js";
|
|
5
5
|
import { admitPlacement, observeTargetPlacement, observeIntegrationTargetMovement } from "./placement.js";
|
|
6
6
|
import { reintegrateOperation } from "./reintegrate.js";
|
|
7
7
|
import { contractCheckpoint, executionStop, isOperationalFailure, isOperationalStop, } from "./progress.js";
|
|
@@ -18,6 +18,7 @@ export const requirementProblemSchema = z.union([
|
|
|
18
18
|
.strictObject({
|
|
19
19
|
...requirementCoordinate,
|
|
20
20
|
state: z.literal("stale"),
|
|
21
|
+
reason: snapshotChangeSchema.exactOptional(),
|
|
21
22
|
previousContentId: z.string().min(1).exactOptional(),
|
|
22
23
|
currentContentId: z.string().min(1).exactOptional(),
|
|
23
24
|
})
|
|
@@ -47,10 +48,12 @@ export function unmetGateProblems(reports) {
|
|
|
47
48
|
state: "stale",
|
|
48
49
|
...(current.reason === undefined
|
|
49
50
|
? {}
|
|
50
|
-
:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
: current.reason.kind === "snapshot-changed"
|
|
52
|
+
? { reason: current.reason }
|
|
53
|
+
: {
|
|
54
|
+
previousContentId: current.reason.previousChange,
|
|
55
|
+
currentContentId: current.reason.currentChange,
|
|
56
|
+
}),
|
|
54
57
|
},
|
|
55
58
|
];
|
|
56
59
|
}));
|
|
@@ -59,7 +59,6 @@ export const materializedConflictSchema = z
|
|
|
59
59
|
})
|
|
60
60
|
.strict()
|
|
61
61
|
.readonly();
|
|
62
|
-
const DELIVER_CONFLICT_RECOVERY = conflictRecovery;
|
|
63
62
|
async function captureAuthorizedDeliveryTender(repository, stage, includeDirty) {
|
|
64
63
|
const { contractId, coordinates } = stage;
|
|
65
64
|
const appointed = coordinates.workspace === "worktree"
|
|
@@ -120,13 +119,7 @@ async function prepareDeliveryWithWorktree(repository, stage, input, captured) {
|
|
|
120
119
|
method: "squash",
|
|
121
120
|
policy: { requireBranchesToBeUpToDate },
|
|
122
121
|
},
|
|
123
|
-
worktree:
|
|
124
|
-
tree: tender.data.tree,
|
|
125
|
-
head: tender.data.head,
|
|
126
|
-
...(tender.data.mergeHead === undefined ? {} : { mergeHead: tender.data.mergeHead }),
|
|
127
|
-
dirty: tender.data.dirty,
|
|
128
|
-
changeId,
|
|
129
|
-
},
|
|
122
|
+
worktree: worktreeWitness(tender.data, changeId),
|
|
130
123
|
};
|
|
131
124
|
}
|
|
132
125
|
export async function prepareDelivery(repository, stage, input) {
|
|
@@ -146,13 +139,7 @@ async function recaptureDeliveryWorktree(input, state) {
|
|
|
146
139
|
const tender = await captureAuthorizedDeliveryTender(input.scope, { contractId: state.id, coordinates: state.coordinates }, input.includeDirty);
|
|
147
140
|
if (tender.kind === "refused")
|
|
148
141
|
return undefined;
|
|
149
|
-
return {
|
|
150
|
-
tree: tender.data.tree,
|
|
151
|
-
head: tender.data.head,
|
|
152
|
-
...(tender.data.mergeHead === undefined ? {} : { mergeHead: tender.data.mergeHead }),
|
|
153
|
-
dirty: tender.data.dirty,
|
|
154
|
-
changeId: await worktreeChangeId(input.scope, { coordinates: state.coordinates }, tender.data),
|
|
155
|
-
};
|
|
142
|
+
return worktreeWitness(tender.data, await worktreeChangeId(input.scope, { coordinates: state.coordinates }, tender.data));
|
|
156
143
|
}
|
|
157
144
|
async function mechanicalDeliveryPreparation(input, state, derivation, journal, captured) {
|
|
158
145
|
const prepared = await prepareDeliveryWithWorktree(input.scope, {
|
|
@@ -170,14 +157,14 @@ async function mechanicalDeliveryPreparation(input, state, derivation, journal,
|
|
|
170
157
|
worktree: prepared.worktree,
|
|
171
158
|
};
|
|
172
159
|
}
|
|
173
|
-
function
|
|
174
|
-
return
|
|
160
|
+
function worktreeWitness(tender, changeId) {
|
|
161
|
+
return {
|
|
175
162
|
tree: tender.tree,
|
|
176
163
|
head: tender.head,
|
|
177
164
|
...(tender.mergeHead === undefined ? {} : { mergeHead: tender.mergeHead }),
|
|
178
165
|
dirty: tender.dirty,
|
|
179
166
|
changeId,
|
|
180
|
-
}
|
|
167
|
+
};
|
|
181
168
|
}
|
|
182
169
|
/**
|
|
183
170
|
* Repeatable physical delivery work outside the publication seat: locate the appointed worktree from
|
|
@@ -195,7 +182,7 @@ async function prepareDeliveryArtifacts(input, observation, state) {
|
|
|
195
182
|
const captured = await captureAuthorizedDeliveryTender(input.scope, { contractId: state.id, coordinates: state.coordinates }, input.includeDirty);
|
|
196
183
|
if (captured.kind === "refused")
|
|
197
184
|
return { kind: "refused", refusal: captured.refusal };
|
|
198
|
-
const worktree = await
|
|
185
|
+
const worktree = worktreeWitness(captured.data, await worktreeChangeId(input.scope, { coordinates: state.coordinates }, captured.data));
|
|
199
186
|
if (reusesCurrentCandidate(input, state, worktree.changeId)) {
|
|
200
187
|
return { kind: "reuse", worktree };
|
|
201
188
|
}
|
|
@@ -477,7 +464,7 @@ async function materializeDeliverConflict(input, refusal) {
|
|
|
477
464
|
conflictPaths: refusal.conflictPaths,
|
|
478
465
|
workspace,
|
|
479
466
|
handoffBase: handoffHead,
|
|
480
|
-
recovery:
|
|
467
|
+
recovery: conflictRecovery,
|
|
481
468
|
};
|
|
482
469
|
}
|
|
483
470
|
async function finishDeliverRefusal(input, refusal) {
|
|
@@ -30,6 +30,11 @@ export declare const deliveryPreviewReportSchema: z.ZodUnion<readonly [z.ZodRead
|
|
|
30
30
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
31
31
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
32
32
|
state: z.ZodLiteral<"stale">;
|
|
33
|
+
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
34
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
35
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
36
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
37
|
+
}, z.core.$strict>>>;
|
|
33
38
|
previousContentId: z.ZodExactOptional<z.ZodString>;
|
|
34
39
|
currentContentId: z.ZodExactOptional<z.ZodString>;
|
|
35
40
|
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -43,6 +43,14 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
43
43
|
gates: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
44
44
|
requirements: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>>>>>;
|
|
45
45
|
after: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>>>;
|
|
46
|
+
target: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
|
|
47
|
+
kind: z.ZodLiteral<"contract">;
|
|
48
|
+
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
49
|
+
worktree: z.ZodReadonly<z.ZodObject<{
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
identity: z.ZodString;
|
|
52
|
+
}, z.core.$strict>>;
|
|
53
|
+
}, z.core.$strict>>]>>;
|
|
46
54
|
}, z.core.$strict>>;
|
|
47
55
|
v: z.ZodLiteral<1>;
|
|
48
56
|
contract: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
@@ -136,7 +136,10 @@ async function verificationStep(input, execution, subject) {
|
|
|
136
136
|
/** Execute one declaration and record testimony only when its gate is selected. */
|
|
137
137
|
export async function verifyRequirement(input) {
|
|
138
138
|
const snapshot = input.snapshot;
|
|
139
|
-
const subject = dependencyKeySet([
|
|
139
|
+
const subject = dependencyKeySet([
|
|
140
|
+
{ kind: "snapshot", value: snapshot },
|
|
141
|
+
...(input.targetRevision === undefined ? [] : [{ kind: "target", value: input.targetRevision }]),
|
|
142
|
+
]);
|
|
140
143
|
const execution = await executeVerification({
|
|
141
144
|
repository: input.repository,
|
|
142
145
|
candidate: snapshot,
|
|
@@ -39,15 +39,22 @@ export declare const bindRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Zod
|
|
|
39
39
|
}>;
|
|
40
40
|
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
41
41
|
}, z.core.$strict>>]>;
|
|
42
|
-
export declare const amendRefusalSchema: z.ZodReadonly<z.ZodObject<{
|
|
42
|
+
export declare const amendRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
43
43
|
kind: z.ZodEnum<{
|
|
44
44
|
"contract-missing": "contract-missing";
|
|
45
45
|
terminal: "terminal";
|
|
46
46
|
"unknown-prerequisite": "unknown-prerequisite";
|
|
47
47
|
"terms-moved": "terms-moved";
|
|
48
48
|
"cyclic-prerequisite": "cyclic-prerequisite";
|
|
49
|
+
"cyclic-target": "cyclic-target";
|
|
49
50
|
}>;
|
|
50
|
-
}, z.core.$strict
|
|
51
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
52
|
+
kind: z.ZodEnum<{
|
|
53
|
+
"target-contract-missing": "target-contract-missing";
|
|
54
|
+
"target-contract-terminal": "target-contract-terminal";
|
|
55
|
+
}>;
|
|
56
|
+
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
57
|
+
}, z.core.$strict>>]>;
|
|
51
58
|
export declare const deliverRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
52
59
|
kind: z.ZodEnum<{
|
|
53
60
|
"contract-missing": "contract-missing";
|
|
@@ -113,12 +120,16 @@ export declare const placementRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<
|
|
|
113
120
|
satisfied: "satisfied";
|
|
114
121
|
unsatisfied: "unsatisfied";
|
|
115
122
|
}>;
|
|
116
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
123
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
117
124
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
118
125
|
target: z.ZodExactOptional<z.ZodString>;
|
|
119
126
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
120
127
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
121
|
-
}, z.core.$strict
|
|
128
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
129
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
130
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
131
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
132
|
+
}, z.core.$strict>>]>>;
|
|
122
133
|
}, z.core.$strict>>]>;
|
|
123
134
|
}, z.core.$strict>>>>;
|
|
124
135
|
satisfied: z.ZodBoolean;
|
|
@@ -138,12 +149,16 @@ export declare const placementRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<
|
|
|
138
149
|
satisfied: "satisfied";
|
|
139
150
|
unsatisfied: "unsatisfied";
|
|
140
151
|
}>;
|
|
141
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
152
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
142
153
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
143
154
|
target: z.ZodExactOptional<z.ZodString>;
|
|
144
155
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
145
156
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
146
|
-
}, z.core.$strict
|
|
157
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
158
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
159
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
160
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
161
|
+
}, z.core.$strict>>]>>;
|
|
147
162
|
}, z.core.$strict>>]>;
|
|
148
163
|
}, z.core.$strict>>>>;
|
|
149
164
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
@@ -209,15 +224,22 @@ export declare const intentRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
209
224
|
"contract-missing": "contract-missing";
|
|
210
225
|
terminal: "terminal";
|
|
211
226
|
}>;
|
|
212
|
-
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
227
|
+
}, z.core.$strict>>, z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
213
228
|
kind: z.ZodEnum<{
|
|
214
229
|
"contract-missing": "contract-missing";
|
|
215
230
|
terminal: "terminal";
|
|
216
231
|
"unknown-prerequisite": "unknown-prerequisite";
|
|
217
232
|
"terms-moved": "terms-moved";
|
|
218
233
|
"cyclic-prerequisite": "cyclic-prerequisite";
|
|
234
|
+
"cyclic-target": "cyclic-target";
|
|
219
235
|
}>;
|
|
220
|
-
}, z.core.$strict>>, z.
|
|
236
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
237
|
+
kind: z.ZodEnum<{
|
|
238
|
+
"target-contract-missing": "target-contract-missing";
|
|
239
|
+
"target-contract-terminal": "target-contract-terminal";
|
|
240
|
+
}>;
|
|
241
|
+
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
242
|
+
}, z.core.$strict>>]>, z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
221
243
|
kind: z.ZodEnum<{
|
|
222
244
|
"contract-exists": "contract-exists";
|
|
223
245
|
"invalid-after": "invalid-after";
|
|
@@ -327,12 +349,16 @@ export declare const intentRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
327
349
|
satisfied: "satisfied";
|
|
328
350
|
unsatisfied: "unsatisfied";
|
|
329
351
|
}>;
|
|
330
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
352
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
331
353
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
332
354
|
target: z.ZodExactOptional<z.ZodString>;
|
|
333
355
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
334
356
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
335
|
-
}, z.core.$strict
|
|
357
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
358
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
359
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
360
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
361
|
+
}, z.core.$strict>>]>>;
|
|
336
362
|
}, z.core.$strict>>]>;
|
|
337
363
|
}, z.core.$strict>>>>;
|
|
338
364
|
satisfied: z.ZodBoolean;
|
|
@@ -352,12 +378,16 @@ export declare const intentRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
352
378
|
satisfied: "satisfied";
|
|
353
379
|
unsatisfied: "unsatisfied";
|
|
354
380
|
}>;
|
|
355
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
381
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
356
382
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
357
383
|
target: z.ZodExactOptional<z.ZodString>;
|
|
358
384
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
359
385
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
360
|
-
}, z.core.$strict
|
|
386
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
387
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
388
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
389
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
390
|
+
}, z.core.$strict>>]>>;
|
|
361
391
|
}, z.core.$strict>>]>;
|
|
362
392
|
}, z.core.$strict>>>>;
|
|
363
393
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
@@ -506,12 +536,16 @@ export declare const placementStopSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
506
536
|
satisfied: "satisfied";
|
|
507
537
|
unsatisfied: "unsatisfied";
|
|
508
538
|
}>;
|
|
509
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
539
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
510
540
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
511
541
|
target: z.ZodExactOptional<z.ZodString>;
|
|
512
542
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
513
543
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
514
|
-
}, z.core.$strict
|
|
544
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
545
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
546
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
547
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
548
|
+
}, z.core.$strict>>]>>;
|
|
515
549
|
}, z.core.$strict>>]>;
|
|
516
550
|
}, z.core.$strict>>>>;
|
|
517
551
|
satisfied: z.ZodBoolean;
|
|
@@ -531,12 +565,16 @@ export declare const placementStopSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
531
565
|
satisfied: "satisfied";
|
|
532
566
|
unsatisfied: "unsatisfied";
|
|
533
567
|
}>;
|
|
534
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
568
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
535
569
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
536
570
|
target: z.ZodExactOptional<z.ZodString>;
|
|
537
571
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
538
572
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
539
|
-
}, z.core.$strict
|
|
573
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
574
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
575
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
576
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
577
|
+
}, z.core.$strict>>]>>;
|
|
540
578
|
}, z.core.$strict>>]>;
|
|
541
579
|
}, z.core.$strict>>>>;
|
|
542
580
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
@@ -17,6 +17,7 @@ import { verificationRuntimeStopSchema } from "./intent.js";
|
|
|
17
17
|
import { complete } from "./outcome.js";
|
|
18
18
|
import { readDocuments } from "./read/documents.js";
|
|
19
19
|
import { readContractMembershipAt, readContractCatalogue, readContractObservationAt, } from "./read/status.js";
|
|
20
|
+
import { targetLifecycleReasonSchema } from "./result-reasons.js";
|
|
20
21
|
import { protocolTerminalSchema } from "./run.js";
|
|
21
22
|
export { changeIdSchema, contractIdSchema, snapshotIdSchema } from "../git/identity.js";
|
|
22
23
|
export { entryUlidSchema } from "./attempt.js";
|
|
@@ -29,33 +30,24 @@ export const bindRefusalSchema = z.union([
|
|
|
29
30
|
.object({ kind: z.enum(["contract-exists", "invalid-after", "unknown-prerequisite"]) })
|
|
30
31
|
.strict()
|
|
31
32
|
.readonly(),
|
|
32
|
-
|
|
33
|
-
.object({
|
|
34
|
-
kind: z.enum(["target-contract-missing", "target-contract-terminal"]),
|
|
35
|
-
targetContractId: contractIdSchema,
|
|
36
|
-
})
|
|
37
|
-
.strict()
|
|
38
|
-
.readonly(),
|
|
33
|
+
targetLifecycleReasonSchema,
|
|
39
34
|
]);
|
|
40
|
-
export const amendRefusalSchema = z
|
|
41
|
-
.object({
|
|
42
|
-
kind: z.enum(["contract-missing", "terminal", "terms-moved", "unknown-prerequisite", "cyclic-prerequisite"]),
|
|
43
|
-
})
|
|
44
|
-
.strict()
|
|
45
|
-
.readonly();
|
|
46
|
-
export const deliverRefusalSchema = z.union([
|
|
47
|
-
z
|
|
48
|
-
.object({ kind: z.enum(["contract-missing", "terminal"]) })
|
|
49
|
-
.strict()
|
|
50
|
-
.readonly(),
|
|
35
|
+
export const amendRefusalSchema = z.union([
|
|
51
36
|
z
|
|
52
|
-
.
|
|
53
|
-
kind: z.enum([
|
|
54
|
-
|
|
37
|
+
.strictObject({
|
|
38
|
+
kind: z.enum([
|
|
39
|
+
"contract-missing",
|
|
40
|
+
"terminal",
|
|
41
|
+
"terms-moved",
|
|
42
|
+
"unknown-prerequisite",
|
|
43
|
+
"cyclic-prerequisite",
|
|
44
|
+
"cyclic-target",
|
|
45
|
+
]),
|
|
55
46
|
})
|
|
56
|
-
.strict()
|
|
57
47
|
.readonly(),
|
|
48
|
+
targetLifecycleReasonSchema,
|
|
58
49
|
]);
|
|
50
|
+
export const deliverRefusalSchema = z.union([activeContractRefusalSchema, targetLifecycleReasonSchema]);
|
|
59
51
|
export const verificationDeclarationRefusalSchema = z
|
|
60
52
|
.object({ kind: z.literal("verification-declaration-invalid") })
|
|
61
53
|
.strict()
|
|
@@ -68,13 +60,7 @@ export const verifyRefusalSchema = z
|
|
|
68
60
|
.strict()
|
|
69
61
|
.readonly();
|
|
70
62
|
export const placementRefusalSchema = z.union([
|
|
71
|
-
|
|
72
|
-
.object({
|
|
73
|
-
kind: z.enum(["target-contract-missing", "target-contract-terminal"]),
|
|
74
|
-
targetContractId: contractIdSchema,
|
|
75
|
-
})
|
|
76
|
-
.strict()
|
|
77
|
-
.readonly(),
|
|
63
|
+
targetLifecycleReasonSchema,
|
|
78
64
|
targetWorkspaceRefusalSchema,
|
|
79
65
|
z
|
|
80
66
|
.object({ kind: z.enum(["contract-missing", "delivery-missing", "terminal"]) })
|
|
@@ -261,8 +247,8 @@ export async function stateOperation(input) {
|
|
|
261
247
|
return (await observeContractAt(input.scope, input.channel, input.contractId)).state;
|
|
262
248
|
}
|
|
263
249
|
export async function deliveryOperation(input) {
|
|
264
|
-
const state =
|
|
265
|
-
if (state === null || state
|
|
250
|
+
const state = await stateOperation(input);
|
|
251
|
+
if (state === null || state.delivery === null)
|
|
266
252
|
return null;
|
|
267
253
|
return state.currentIntegration === null
|
|
268
254
|
? state.delivery.data
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SqliteTransactionLockError } from "../coordination/sqlite-transaction-lock.js";
|
|
2
2
|
import { AuthorityCorruptionError } from "../core/facts/errors.js";
|
|
3
3
|
import { contractState } from "../core/facts/observation.js";
|
|
4
|
-
import { targetName } from "../core/facts/types.js";
|
|
4
|
+
import { sameTarget, targetName } from "../core/facts/types.js";
|
|
5
5
|
import { decidePlacement } from "../core/verbs/placement.js";
|
|
6
6
|
import { observeContractsForAdmissionAt, observeGitForAdmissionAt } from "../git/observe.js";
|
|
7
7
|
import { withPrivateStatePublicationSeat } from "../git/private-state-seat.js";
|
|
@@ -191,6 +191,12 @@ export async function admitPlacement(admission) {
|
|
|
191
191
|
contracts: [input.contractId],
|
|
192
192
|
attempts,
|
|
193
193
|
decide: decidePlacement,
|
|
194
|
+
preparation: {
|
|
195
|
+
external: () => ({ kind: "prepared", prepared: input }),
|
|
196
|
+
assemble: (observation) => sameTarget(contractState(observation.decision, input.contractId)?.coordinates.target, target)
|
|
197
|
+
? { kind: "prepared", input }
|
|
198
|
+
: { kind: "stale" },
|
|
199
|
+
},
|
|
194
200
|
...(admission.progress === undefined ? {} : { progress: admission.progress }),
|
|
195
201
|
observe: (observedRepository, observedChannel, contracts) => observeGitForAdmissionAt(observedRepository, observedChannel, contracts),
|
|
196
202
|
};
|
|
@@ -41,12 +41,6 @@ export function isOperationalFailure(error) {
|
|
|
41
41
|
export function isOperationalStop(error, signal) {
|
|
42
42
|
if (signal?.aborted === true && error === signal.reason)
|
|
43
43
|
return true;
|
|
44
|
-
if (error instanceof AuthorityCorruptionError ||
|
|
45
|
-
error instanceof TypeError ||
|
|
46
|
-
error instanceof RangeError ||
|
|
47
|
-
error instanceof ReferenceError ||
|
|
48
|
-
error instanceof SyntaxError)
|
|
49
|
-
return false;
|
|
50
44
|
return isOperationalFailure(error);
|
|
51
45
|
}
|
|
52
46
|
/** Classify operational failures only; programming errors and corrupt authority still throw. */
|
|
@@ -151,6 +151,16 @@ declare const detailCurrentSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObjec
|
|
|
151
151
|
kind: z.ZodLiteral<"missing">;
|
|
152
152
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
153
153
|
kind: z.ZodLiteral<"stale">;
|
|
154
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
155
|
+
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
156
|
+
target: z.ZodExactOptional<z.ZodString>;
|
|
157
|
+
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
158
|
+
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
159
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
160
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
161
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
162
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
163
|
+
}, z.core.$strict>>]>>;
|
|
154
164
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
155
165
|
kind: z.ZodLiteral<"attested">;
|
|
156
166
|
verdict: z.ZodEnum<{
|
|
@@ -167,6 +177,16 @@ declare const rowGateSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
167
177
|
kind: z.ZodLiteral<"missing">;
|
|
168
178
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
169
179
|
kind: z.ZodLiteral<"stale">;
|
|
180
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
181
|
+
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
182
|
+
target: z.ZodExactOptional<z.ZodString>;
|
|
183
|
+
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
184
|
+
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
185
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
186
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
187
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
188
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
189
|
+
}, z.core.$strict>>]>>;
|
|
170
190
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
171
191
|
kind: z.ZodLiteral<"attested">;
|
|
172
192
|
verdict: z.ZodEnum<{
|
|
@@ -260,6 +280,16 @@ export declare const contractDetailSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
260
280
|
kind: z.ZodLiteral<"missing">;
|
|
261
281
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
262
282
|
kind: z.ZodLiteral<"stale">;
|
|
283
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
284
|
+
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
285
|
+
target: z.ZodExactOptional<z.ZodString>;
|
|
286
|
+
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
287
|
+
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
288
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
289
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
290
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
291
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
292
|
+
}, z.core.$strict>>]>>;
|
|
263
293
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
264
294
|
kind: z.ZodLiteral<"attested">;
|
|
265
295
|
verdict: z.ZodEnum<{
|
|
@@ -343,6 +373,16 @@ export declare const contractObservationSchema: z.ZodUnion<readonly [z.ZodReadon
|
|
|
343
373
|
kind: z.ZodLiteral<"missing">;
|
|
344
374
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
345
375
|
kind: z.ZodLiteral<"stale">;
|
|
376
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
377
|
+
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
378
|
+
target: z.ZodExactOptional<z.ZodString>;
|
|
379
|
+
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
380
|
+
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
381
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
382
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
383
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
384
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
385
|
+
}, z.core.$strict>>]>>;
|
|
346
386
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
347
387
|
kind: z.ZodLiteral<"attested">;
|
|
348
388
|
verdict: z.ZodEnum<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { errorCategory } from "../../errors.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { contractIdSchema, contractJournalPaths, snapshotIdSchema } from "../../git/identity.js";
|
|
4
|
-
import { gateSchema } from "../result-leaves.js";
|
|
4
|
+
import { gateSchema, gateStaleReasonSchema } from "../result-leaves.js";
|
|
5
5
|
import { activeContractJournalPaths, observeActiveContractJournals, observeActiveContractWorld, observeContractsForAdmissionInObservationAt, deliveryTargetObserver, withContractReadObservationAt, } from "../../git/observe.js";
|
|
6
6
|
import { decodeContractDocument } from "../../body/decode.js";
|
|
7
7
|
import { observeTargetLag, observeWorkspace, worktreePath } from "../../git/workspace.js";
|
|
@@ -9,6 +9,7 @@ import { appointmentFor, readPlaceRegister } from "../../workspace-place.js";
|
|
|
9
9
|
import { withGitTargetedReadObservation, } from "../../git/read-observation.js";
|
|
10
10
|
import { gateReports } from "../../core/facts/gate.js";
|
|
11
11
|
import { verificationRequirement } from "../../verification/declaration.js";
|
|
12
|
+
import { targetName, } from "../../core/facts/types.js";
|
|
12
13
|
import { projectBoundedList } from "../../bounded-list.js";
|
|
13
14
|
import { observeCurrentPhysicalIssue } from "./observation.js";
|
|
14
15
|
const phaseSchema = z.enum(["bound", "claimed", "abandoned"]);
|
|
@@ -77,7 +78,7 @@ export const contractCatalogueSchema = z
|
|
|
77
78
|
.readonly();
|
|
78
79
|
const detailCurrentSchema = z.union([
|
|
79
80
|
z.strictObject({ kind: z.literal("missing") }).readonly(),
|
|
80
|
-
z.strictObject({ kind: z.literal("stale") }).readonly(),
|
|
81
|
+
z.strictObject({ kind: z.literal("stale"), reason: gateStaleReasonSchema.exactOptional() }).readonly(),
|
|
81
82
|
z
|
|
82
83
|
.strictObject({
|
|
83
84
|
kind: z.literal("attested"),
|
|
@@ -389,7 +390,9 @@ export async function readContractObservation(observation, id) {
|
|
|
389
390
|
verdict: current.verdict,
|
|
390
391
|
...(current.summary === undefined ? {} : { summary: current.summary }),
|
|
391
392
|
}
|
|
392
|
-
:
|
|
393
|
+
: current.kind === "stale"
|
|
394
|
+
? { kind: current.kind, ...(current.reason === undefined ? {} : { reason: current.reason }) }
|
|
395
|
+
: { kind: current.kind },
|
|
393
396
|
};
|
|
394
397
|
}),
|
|
395
398
|
}));
|
|
@@ -400,13 +403,7 @@ export async function readContractObservation(observation, id) {
|
|
|
400
403
|
...(title === undefined ? {} : { title }),
|
|
401
404
|
phase: phaseFor(state),
|
|
402
405
|
workspace: facts.workspace,
|
|
403
|
-
...(state.coordinates.target === undefined
|
|
404
|
-
? {}
|
|
405
|
-
: {
|
|
406
|
-
target: typeof state.coordinates.target === "string"
|
|
407
|
-
? state.coordinates.target
|
|
408
|
-
: state.coordinates.target.contractId,
|
|
409
|
-
}),
|
|
406
|
+
...(state.coordinates.target === undefined ? {} : { target: targetName(state.coordinates.target) }),
|
|
410
407
|
...(facts.targetLag === undefined ? {} : { targetLag: facts.targetLag }),
|
|
411
408
|
...(state.delivery === null
|
|
412
409
|
? {}
|