@astrosheep/keiyaku 4.6.27 → 4.6.28
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 +76 -35
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +39 -4
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +4 -7
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +39 -15
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +42 -22
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +39 -4
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +4 -7
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +39 -15
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +42 -22
- package/build/plugins/opencode/package.json +1 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +39 -4
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +4 -7
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +39 -15
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +42 -22
- package/build/plugins/pi/README.md +7 -12
- package/build/plugins/pi/akuma-tools.ts +3 -18
- package/build/skills/keiyaku-akuma/SKILL.md +39 -4
- package/build/skills/keiyaku-akuma/references/automation.md +4 -7
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +39 -15
- package/build/skills/keiyaku-workflow/SKILL.md +42 -22
- package/build/src/akuma/akuma-call.d.ts +15 -18
- package/build/src/akuma/akuma-call.js +55 -112
- package/build/src/akuma/akuma-errors.d.ts +0 -5
- package/build/src/akuma/akuma-errors.js +0 -9
- package/build/src/akuma/akuma-instance.d.ts +0 -2
- package/build/src/akuma/akuma-instance.js +18 -14
- package/build/src/akuma/akuma-observe.js +0 -1
- package/build/src/akuma/akuma-owner.js +0 -1
- package/build/src/akuma/akuma.d.ts +10 -26
- package/build/src/akuma/akuma.js +0 -2
- package/build/src/akuma/archetype.d.ts +0 -2
- package/build/src/akuma/archetype.js +3 -9
- package/build/src/akuma/body-launch.d.ts +12 -4
- package/build/src/akuma/body.d.ts +2 -5
- package/build/src/akuma/body.js +5 -49
- package/build/src/akuma/call-initial-tell.d.ts +39 -147
- package/build/src/akuma/call-initial-tell.js +0 -48
- package/build/src/akuma/caller.d.ts +0 -4
- package/build/src/akuma/custody.js +1 -57
- package/build/src/akuma/heart/facts.d.ts +0 -39
- package/build/src/akuma/heart/facts.js +0 -1
- package/build/src/akuma/heart/index.d.ts +1 -2
- package/build/src/akuma/heart/index.js +0 -1
- package/build/src/akuma/heart/schema.js +0 -26
- package/build/src/akuma/heart/soul.d.ts +2 -2
- package/build/src/akuma/heart/soul.js +2 -4
- package/build/src/akuma/identity.d.ts +0 -1
- package/build/src/akuma/identity.js +0 -2
- package/build/src/akuma/in-process-body.d.ts +1 -1
- package/build/src/akuma/index.d.ts +0 -2
- package/build/src/akuma/index.js +0 -1
- package/build/src/akuma/projection.d.ts +23 -23
- package/build/src/akuma/provider.d.ts +0 -5
- package/build/src/akuma/provider.js +0 -1
- package/build/src/akuma/providers/acp/core.js +1 -1
- package/build/src/akuma/providers/claude/index.js +1 -2
- package/build/src/akuma/providers/codex-app-server/index.js +1 -1
- package/build/src/akuma/providers/execution-environment.d.ts +1 -3
- package/build/src/akuma/providers/execution-environment.js +1 -7
- package/build/src/akuma/providers/opencode-sdk/index.js +0 -1
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +0 -1
- package/build/src/akuma/providers/opencode-sdk/session.js +4 -4
- package/build/src/akuma/providers/paseo/index.js +2 -9
- package/build/src/akuma/providers/pi/index.js +8 -14
- package/build/src/akuma/publication.d.ts +24 -59
- package/build/src/akuma/publication.js +29 -64
- package/build/src/akuma/selection-observation.d.ts +47 -2036
- package/build/src/akuma/selection-observation.js +1 -59
- package/build/src/akuma/turn-drive.d.ts +0 -8
- package/build/src/akuma/turn-drive.js +19 -103
- package/build/src/akuma-body.js +3 -6
- package/build/src/body-host.d.ts +8 -2
- package/build/src/body-host.js +30 -4
- package/build/src/cli/commands/akuma-grammar.d.ts +0 -2
- package/build/src/cli/commands/akuma-grammar.js +10 -33
- package/build/src/cli/commands/akuma.js +31 -49
- package/build/src/cli/commands/contract-grammar.d.ts +7 -1
- package/build/src/cli/commands/contract-grammar.js +15 -0
- package/build/src/cli/commands/contract-help.d.ts +13 -1
- package/build/src/cli/commands/contract-help.js +47 -16
- package/build/src/cli/commands/contract.js +27 -26
- package/build/src/cli/commands/debt.js +3 -3
- package/build/src/cli/commands/whoami.d.ts +0 -2
- package/build/src/cli/commands/whoami.js +0 -5
- package/build/src/cli/coordinates.js +15 -0
- package/build/src/cli/delivery-identity.d.ts +3 -0
- package/build/src/cli/delivery-identity.js +23 -0
- package/build/src/cli/parse.js +1 -0
- package/build/src/cli/render/akuma-activity.d.ts +0 -1
- package/build/src/cli/render/akuma-activity.js +1 -4
- package/build/src/cli/render/catalog.js +7 -1
- package/build/src/cli/render/contract-history.js +16 -38
- package/build/src/cli/render/contract-observation.d.ts +23 -10
- package/build/src/cli/render/contract-observation.js +9 -6
- package/build/src/cli/render/contract-wait.d.ts +2 -0
- package/build/src/cli/render/contract-wait.js +18 -0
- package/build/src/cli/render/contract.d.ts +2 -2
- package/build/src/cli/render/contract.js +57 -39
- package/build/src/cli/render/delivery-preview.js +13 -26
- package/build/src/cli/render/execution-progress.js +9 -9
- package/build/src/cli/render/kanshi.js +4 -11
- package/build/src/cli/render/receipt.d.ts +18 -0
- package/build/src/cli/render/receipt.js +34 -10
- package/build/src/cli/render/reconcile.js +3 -0
- package/build/src/cli/render/refusal.js +28 -6
- package/build/src/cli/render/whoami.js +1 -4
- package/build/src/cli/runtime.d.ts +0 -2
- package/build/src/cli/runtime.js +3 -7
- package/build/src/cli/selectors.d.ts +1 -2
- package/build/src/cli/selectors.js +2 -5
- package/build/src/contract-guidance.js +4 -2
- package/build/src/contract-worktree.d.ts +3 -3
- package/build/src/core/facts/codec.js +38 -5
- package/build/src/core/facts/fold.js +1 -0
- package/build/src/core/facts/gate.d.ts +10 -4
- package/build/src/core/facts/gate.js +56 -39
- package/build/src/core/facts/observation.d.ts +7 -1
- package/build/src/core/facts/observation.js +15 -0
- package/build/src/core/facts/offer.d.ts +2 -2
- package/build/src/core/facts/types.d.ts +17 -1
- package/build/src/core/facts/types.js +6 -0
- package/build/src/core/verbs/amend.js +8 -0
- package/build/src/core/verbs/bind.d.ts +3 -1
- package/build/src/core/verbs/bind.js +9 -1
- package/build/src/core/verbs/deliver.d.ts +2 -1
- package/build/src/core/verbs/deliver.js +4 -1
- package/build/src/core/verbs/placement.d.ts +2 -1
- package/build/src/core/verbs/placement.js +7 -4
- package/build/src/core/verbs/reintegrate.d.ts +2 -1
- package/build/src/core/verbs/reintegrate.js +4 -1
- package/build/src/debt/board.d.ts +10 -10
- package/build/src/debt/created-observation.d.ts +3 -3
- package/build/src/debt/document.d.ts +1 -1
- package/build/src/debt/index.d.ts +2 -24
- package/build/src/debt/index.js +11 -71
- package/build/src/debt/operation-types.d.ts +44 -3
- package/build/src/git/admission.js +18 -6
- package/build/src/git/integration.d.ts +4 -4
- package/build/src/git/integration.js +7 -1
- package/build/src/git/observe.d.ts +6 -4
- package/build/src/git/observe.js +18 -17
- package/build/src/git/reconcile.d.ts +20 -8
- package/build/src/git/reconcile.js +94 -45
- package/build/src/git/repository.d.ts +3 -1
- package/build/src/git/repository.js +26 -4
- package/build/src/git/scratch.d.ts +1 -1
- package/build/src/git/scratch.js +19 -18
- package/build/src/git/target-placement.d.ts +33 -7
- package/build/src/git/target-placement.js +67 -18
- package/build/src/git/target.d.ts +32 -0
- package/build/src/git/target.js +84 -0
- package/build/src/git/terminal-reconcile.d.ts +1 -1
- package/build/src/git/terminal-reconcile.js +34 -6
- package/build/src/index.d.ts +9 -7
- package/build/src/index.js +1 -1
- package/build/src/library/address.d.ts +1 -20
- package/build/src/library/address.js +3 -24
- package/build/src/library/akuma-creation.d.ts +2 -5
- package/build/src/library/akuma-creation.js +60 -44
- package/build/src/library/akumas.d.ts +3 -9
- package/build/src/library/akumas.js +12 -25
- package/build/src/library/bind.d.ts +21 -9
- package/build/src/library/bind.js +5 -1
- package/build/src/library/continuation.d.ts +130 -155
- package/build/src/library/continuation.js +1 -4
- package/build/src/library/contract-composition.d.ts +4 -9
- package/build/src/library/contract-composition.js +8 -12
- package/build/src/library/contract-creation.d.ts +1 -3
- package/build/src/library/contract-creation.js +2 -3
- package/build/src/library/contract-execution.d.ts +3 -5
- package/build/src/library/contract-execution.js +55 -96
- package/build/src/library/contract-outcomes.d.ts +2 -1
- package/build/src/library/contract-types.d.ts +5 -0
- package/build/src/library/contract-wait.d.ts +35 -0
- package/build/src/library/contract-wait.js +141 -0
- package/build/src/library/delivery.d.ts +13 -525
- package/build/src/library/delivery.js +1 -12
- package/build/src/library/input.js +2 -1
- package/build/src/library/invocation.d.ts +5 -1
- package/build/src/library/invocation.js +9 -2
- package/build/src/library/keiyaku.d.ts +7 -6
- package/build/src/library/keiyaku.js +12 -7
- package/build/src/library/outcome.d.ts +461 -12586
- package/build/src/library/outcome.js +15 -234
- package/build/src/library/reconcile.d.ts +12 -0
- package/build/src/library/reconcile.js +1 -0
- package/build/src/library/refusal.d.ts +251 -34
- package/build/src/library/refusal.js +10 -5
- package/build/src/library/selection.d.ts +9 -35
- package/build/src/library/selection.js +59 -129
- package/build/src/plugin/akuma-signals.d.ts +2 -2
- package/build/src/plugin/akuma-signals.js +2 -2
- package/build/src/plugin/public.d.ts +0 -7
- package/build/src/plugin/runtime.d.ts +2 -2
- package/build/src/plugin/runtime.js +4 -3
- package/build/src/protocol/attempt.js +7 -3
- package/build/src/protocol/bind.d.ts +18 -4
- package/build/src/protocol/bind.js +102 -35
- package/build/src/protocol/completion.d.ts +18 -331
- package/build/src/protocol/completion.js +17 -130
- package/build/src/protocol/deliver.d.ts +3 -3
- package/build/src/protocol/deliver.js +64 -74
- package/build/src/protocol/delivery-preview.d.ts +85 -28
- package/build/src/protocol/delivery-preview.js +34 -22
- package/build/src/protocol/execution-observation.d.ts +12 -9
- package/build/src/protocol/execution-observation.js +0 -1
- package/build/src/protocol/intent.d.ts +20 -50
- package/build/src/protocol/intent.js +37 -44
- package/build/src/protocol/operations.d.ts +299 -19
- package/build/src/protocol/operations.js +68 -27
- package/build/src/protocol/outcome.d.ts +1 -1
- package/build/src/protocol/placement.d.ts +2 -2
- package/build/src/protocol/placement.js +4 -3
- package/build/src/protocol/progress.d.ts +35 -2
- package/build/src/protocol/progress.js +12 -1
- package/build/src/protocol/read/observation.js +15 -4
- package/build/src/protocol/read/status.d.ts +9 -14
- package/build/src/protocol/read/status.js +15 -22
- package/build/src/protocol/reintegrate.d.ts +4 -3
- package/build/src/protocol/reintegrate.js +21 -5
- package/build/src/protocol/review.d.ts +9 -15
- package/build/src/protocol/review.js +2 -6
- package/build/src/protocol/run.d.ts +1 -1
- package/build/src/protocol/verify.d.ts +51 -0
- package/build/src/protocol/verify.js +128 -0
- package/build/src/verification/declaration.d.ts +5 -1
- package/build/src/verification/declaration.js +19 -2
- package/build/src/verification/execution.d.ts +5 -2
- package/build/src/verification/execution.js +48 -53
- package/build/src/verification/observation.d.ts +10 -6
- package/build/src/verification/observation.js +5 -2
- package/package.json +3 -3
- package/plugins/paseo/plugin/index.server.ts +3 -0
- package/plugins/paseo/plugin/server/attach.ts +42 -0
- package/plugins/paseo/plugin/server/mirror-identity.ts +51 -0
- package/plugins/paseo/plugin/server/model.ts +26 -0
- package/plugins/paseo/plugin/server/provider.ts +4 -6
- package/plugins/paseo/plugin/server/reopen.ts +4 -39
- package/plugins/pi/README.md +7 -12
- package/plugins/pi/akuma-tools.ts +3 -18
- package/skills/keiyaku-akuma/SKILL.md +39 -4
- package/skills/keiyaku-akuma/references/automation.md +4 -7
- package/skills/keiyaku-babysit/SKILL.md +1 -1
- package/skills/keiyaku-bind/SKILL.md +39 -15
- package/skills/keiyaku-workflow/SKILL.md +42 -22
- package/build/src/akuma/allowed.d.ts +0 -23
- package/build/src/akuma/allowed.js +0 -63
- package/build/src/akuma/call-request.d.ts +0 -308
- package/build/src/akuma/call-request.js +0 -175
- package/build/src/akuma/heart/request-authority.d.ts +0 -16
- package/build/src/akuma/heart/request-authority.js +0 -140
- package/build/src/akuma/heart/request-rows.d.ts +0 -18
- package/build/src/akuma/heart/request-rows.js +0 -107
- package/build/src/akuma/request-lifecycle.d.ts +0 -42
- package/build/src/akuma/request-lifecycle.js +0 -197
- package/build/src/akuma/request-observation.d.ts +0 -45
- package/build/src/akuma/request-observation.js +0 -162
- package/build/src/akuma/request-rendezvous.d.ts +0 -32
- package/build/src/akuma/request-rendezvous.js +0 -189
- package/build/src/akuma/request-serve.d.ts +0 -16
- package/build/src/akuma/request-serve.js +0 -188
- package/build/src/akuma/request-wire.d.ts +0 -143
- package/build/src/akuma/request-wire.js +0 -146
- package/build/src/akuma/requests.d.ts +0 -20
- package/build/src/akuma/requests.js +0 -72
- package/build/src/akuma/selection-owner-port.d.ts +0 -14
- package/build/src/akuma/selection-owner-port.js +0 -54
- package/build/src/akuma/selection-request.d.ts +0 -305
- package/build/src/akuma/selection-request.js +0 -307
- package/build/src/body-requests.d.ts +0 -13
- package/build/src/body-requests.js +0 -131
- package/build/src/cli/square-identity.d.ts +0 -10
- package/build/src/cli/square-identity.js +0 -130
- package/build/src/debt/mutation-result.d.ts +0 -981
- package/build/src/debt/mutation-result.js +0 -109
- package/build/src/debt/mutation.d.ts +0 -424
- package/build/src/debt/mutation.js +0 -223
- package/build/src/library/contract-operations.d.ts +0 -382
- package/build/src/library/contract-operations.js +0 -300
|
@@ -1,341 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { type ActorId, type SnapshotId } from "../core/facts/types.js";
|
|
2
|
+
import { type GateReport } from "../core/facts/gate.js";
|
|
3
3
|
import type { GitRepository } from "../git/process.js";
|
|
4
4
|
import type { GitDecodeChannel } from "../git/read-observation.js";
|
|
5
5
|
import { type ContractCheckpoint, type ProtocolProgress, type ExecutionStop } from "./progress.js";
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import type { PlacementStop } from "./operations.js";
|
|
7
|
+
export type CandidateCompletion = Readonly<{
|
|
8
|
+
integration: SnapshotId;
|
|
9
|
+
predecessor?: SnapshotId;
|
|
10
|
+
target?: string;
|
|
11
|
+
scope?: Readonly<{
|
|
12
|
+
filesChanged: number;
|
|
13
|
+
insertions: number;
|
|
14
|
+
deletions: number;
|
|
12
15
|
}>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
satisfied: "satisfied";
|
|
20
|
-
unsatisfied: "unsatisfied";
|
|
21
|
-
}>;
|
|
22
|
-
entry: z.ZodPipe<z.ZodString, z.ZodTransform<EntryUlid, string>>;
|
|
23
|
-
summary: z.ZodOptional<z.ZodString>;
|
|
24
|
-
kind: z.ZodLiteral<"reused">;
|
|
25
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
-
kind: z.ZodLiteral<"stopped">;
|
|
27
|
-
stop: z.ZodUnion<readonly [z.ZodObject<{
|
|
28
|
-
refusal: z.ZodUnion<readonly [z.ZodObject<{
|
|
29
|
-
kind: z.ZodEnum<{
|
|
30
|
-
terminal: "terminal";
|
|
31
|
-
"contract-missing": "contract-missing";
|
|
32
|
-
}>;
|
|
33
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
34
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
35
|
-
kind: z.ZodLiteral<"verification-declaration-invalid">;
|
|
36
|
-
contractId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>>;
|
|
37
|
-
}, z.core.$strict>]>;
|
|
38
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
39
|
-
retry: z.ZodUnion<readonly [z.ZodObject<{
|
|
40
|
-
kind: z.ZodEnum<{
|
|
41
|
-
exhausted: "exhausted";
|
|
42
|
-
collision: "collision";
|
|
43
|
-
}>;
|
|
44
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
45
|
-
kind: z.ZodLiteral<"publication-failed">;
|
|
46
|
-
diagnostic: z.ZodString;
|
|
47
|
-
}, z.core.$strict>]>;
|
|
48
|
-
}, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
|
|
49
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
50
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
51
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
52
|
-
failure: z.ZodEnum<{
|
|
53
|
-
cancelled: "cancelled";
|
|
54
|
-
"unknown-exit": "unknown-exit";
|
|
55
|
-
}>;
|
|
56
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
57
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
58
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
59
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
60
|
-
failure: z.ZodEnum<{
|
|
61
|
-
"spawn-error": "spawn-error";
|
|
62
|
-
"candidate-unavailable": "candidate-unavailable";
|
|
63
|
-
}>;
|
|
64
|
-
diagnostic: z.ZodString;
|
|
65
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
66
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
67
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
68
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
69
|
-
failure: z.ZodLiteral<"environment-failure">;
|
|
70
|
-
diagnostic: z.ZodString;
|
|
71
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
72
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
73
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
74
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
75
|
-
failure: z.ZodLiteral<"environment-failure">;
|
|
76
|
-
name: z.ZodString;
|
|
77
|
-
detail: z.ZodUnion<readonly [z.ZodObject<{
|
|
78
|
-
kind: z.ZodLiteral<"exit">;
|
|
79
|
-
code: z.ZodNumber;
|
|
80
|
-
stdout: z.ZodString;
|
|
81
|
-
stderr: z.ZodString;
|
|
82
|
-
truncated: z.ZodBoolean;
|
|
83
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
84
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
85
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
86
|
-
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
-
kind: z.ZodLiteral<"timeout">;
|
|
88
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
89
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
90
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
91
|
-
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
-
kind: z.ZodLiteral<"unknown-exit">;
|
|
93
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
94
|
-
kind: z.ZodLiteral<"spawn-error">;
|
|
95
|
-
diagnostic: z.ZodString;
|
|
96
|
-
}, z.core.$strict>]>;
|
|
97
|
-
}, z.core.$strict>]>]>;
|
|
98
|
-
}, z.core.$strict>], "kind">;
|
|
99
|
-
export type VerificationEvidence = z.infer<typeof verificationEvidenceSchema>;
|
|
100
|
-
declare const candidateCompletionSchema: z.ZodObject<{
|
|
101
|
-
integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
102
|
-
predecessor: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>>;
|
|
103
|
-
target: z.ZodOptional<z.ZodString>;
|
|
104
|
-
scope: z.ZodOptional<z.ZodObject<{
|
|
105
|
-
deletions: z.ZodNumber;
|
|
106
|
-
filesChanged: z.ZodNumber;
|
|
107
|
-
insertions: z.ZodNumber;
|
|
108
|
-
}, z.core.$strict>>;
|
|
109
|
-
}, z.core.$strict>;
|
|
110
|
-
export type CandidateCompletion = z.infer<typeof candidateCompletionSchema>;
|
|
111
|
-
export declare const completionEvidenceSchema: z.ZodObject<{
|
|
112
|
-
completion: z.ZodOptional<z.ZodObject<{
|
|
113
|
-
integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
114
|
-
predecessor: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>>;
|
|
115
|
-
target: z.ZodOptional<z.ZodString>;
|
|
116
|
-
scope: z.ZodOptional<z.ZodObject<{
|
|
117
|
-
deletions: z.ZodNumber;
|
|
118
|
-
filesChanged: z.ZodNumber;
|
|
119
|
-
insertions: z.ZodNumber;
|
|
120
|
-
}, z.core.$strict>>;
|
|
121
|
-
}, z.core.$strict>>;
|
|
122
|
-
verification: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
123
|
-
snapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
124
|
-
verdict: z.ZodEnum<{
|
|
125
|
-
satisfied: "satisfied";
|
|
126
|
-
unsatisfied: "unsatisfied";
|
|
127
|
-
}>;
|
|
128
|
-
summary: z.ZodOptional<z.ZodString>;
|
|
129
|
-
kind: z.ZodLiteral<"ran">;
|
|
130
|
-
entry: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<EntryUlid, string>>>;
|
|
131
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
132
|
-
snapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
133
|
-
verdict: z.ZodEnum<{
|
|
134
|
-
satisfied: "satisfied";
|
|
135
|
-
unsatisfied: "unsatisfied";
|
|
136
|
-
}>;
|
|
137
|
-
entry: z.ZodPipe<z.ZodString, z.ZodTransform<EntryUlid, string>>;
|
|
138
|
-
summary: z.ZodOptional<z.ZodString>;
|
|
139
|
-
kind: z.ZodLiteral<"reused">;
|
|
140
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
141
|
-
kind: z.ZodLiteral<"stopped">;
|
|
142
|
-
stop: z.ZodUnion<readonly [z.ZodObject<{
|
|
143
|
-
refusal: z.ZodUnion<readonly [z.ZodObject<{
|
|
144
|
-
kind: z.ZodEnum<{
|
|
145
|
-
terminal: "terminal";
|
|
146
|
-
"contract-missing": "contract-missing";
|
|
147
|
-
}>;
|
|
148
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
149
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
150
|
-
kind: z.ZodLiteral<"verification-declaration-invalid">;
|
|
151
|
-
contractId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>>;
|
|
152
|
-
}, z.core.$strict>]>;
|
|
153
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
154
|
-
retry: z.ZodUnion<readonly [z.ZodObject<{
|
|
155
|
-
kind: z.ZodEnum<{
|
|
156
|
-
exhausted: "exhausted";
|
|
157
|
-
collision: "collision";
|
|
158
|
-
}>;
|
|
159
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
160
|
-
kind: z.ZodLiteral<"publication-failed">;
|
|
161
|
-
diagnostic: z.ZodString;
|
|
162
|
-
}, z.core.$strict>]>;
|
|
163
|
-
}, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
|
|
164
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
165
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
166
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
167
|
-
failure: z.ZodEnum<{
|
|
168
|
-
cancelled: "cancelled";
|
|
169
|
-
"unknown-exit": "unknown-exit";
|
|
170
|
-
}>;
|
|
171
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
172
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
173
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
174
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
175
|
-
failure: z.ZodEnum<{
|
|
176
|
-
"spawn-error": "spawn-error";
|
|
177
|
-
"candidate-unavailable": "candidate-unavailable";
|
|
178
|
-
}>;
|
|
179
|
-
diagnostic: z.ZodString;
|
|
180
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
181
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
182
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
183
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
184
|
-
failure: z.ZodLiteral<"environment-failure">;
|
|
185
|
-
diagnostic: z.ZodString;
|
|
186
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
187
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
188
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
189
|
-
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
190
|
-
failure: z.ZodLiteral<"environment-failure">;
|
|
191
|
-
name: z.ZodString;
|
|
192
|
-
detail: z.ZodUnion<readonly [z.ZodObject<{
|
|
193
|
-
kind: z.ZodLiteral<"exit">;
|
|
194
|
-
code: z.ZodNumber;
|
|
195
|
-
stdout: z.ZodString;
|
|
196
|
-
stderr: z.ZodString;
|
|
197
|
-
truncated: z.ZodBoolean;
|
|
198
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
199
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
200
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
201
|
-
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
202
|
-
kind: z.ZodLiteral<"timeout">;
|
|
203
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
204
|
-
stdout: z.ZodOptional<z.ZodString>;
|
|
205
|
-
stderr: z.ZodOptional<z.ZodString>;
|
|
206
|
-
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
207
|
-
kind: z.ZodLiteral<"unknown-exit">;
|
|
208
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
209
|
-
kind: z.ZodLiteral<"spawn-error">;
|
|
210
|
-
diagnostic: z.ZodString;
|
|
211
|
-
}, z.core.$strict>]>;
|
|
212
|
-
}, z.core.$strict>]>]>;
|
|
213
|
-
}, z.core.$strict>], "kind">>;
|
|
214
|
-
placement: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
215
|
-
refusal: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
|
|
216
|
-
kind: z.ZodEnum<{
|
|
217
|
-
terminal: "terminal";
|
|
218
|
-
"contract-missing": "contract-missing";
|
|
219
|
-
"delivery-missing": "delivery-missing";
|
|
220
|
-
}>;
|
|
221
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
222
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
223
|
-
kind: z.ZodLiteral<"gates-unsatisfied">;
|
|
224
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
225
|
-
unmet: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
226
|
-
gate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>;
|
|
227
|
-
current: z.ZodUnion<readonly [z.ZodObject<{
|
|
228
|
-
kind: z.ZodLiteral<"missing">;
|
|
229
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
230
|
-
kind: z.ZodLiteral<"attested">;
|
|
231
|
-
verdict: z.ZodEnum<{
|
|
232
|
-
satisfied: "satisfied";
|
|
233
|
-
unsatisfied: "unsatisfied";
|
|
234
|
-
}>;
|
|
235
|
-
at: z.ZodString;
|
|
236
|
-
summary: z.ZodOptional<z.ZodString>;
|
|
237
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
238
|
-
kind: z.ZodLiteral<"stale">;
|
|
239
|
-
priorVerdict: z.ZodEnum<{
|
|
240
|
-
satisfied: "satisfied";
|
|
241
|
-
unsatisfied: "unsatisfied";
|
|
242
|
-
}>;
|
|
243
|
-
reason: z.ZodOptional<z.ZodObject<{
|
|
244
|
-
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
245
|
-
target: z.ZodOptional<z.ZodString>;
|
|
246
|
-
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
247
|
-
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
248
|
-
}, z.core.$strict>>;
|
|
249
|
-
}, z.core.$strict>]>;
|
|
250
|
-
}, z.core.$strict>>>;
|
|
251
|
-
target: z.ZodOptional<z.ZodString>;
|
|
252
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
253
|
-
kind: z.ZodLiteral<"prerequisites-unsatisfied">;
|
|
254
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
255
|
-
unmet: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
256
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
257
|
-
state: z.ZodEnum<{
|
|
258
|
-
abandoned: "abandoned";
|
|
259
|
-
missing: "missing";
|
|
260
|
-
active: "active";
|
|
261
|
-
}>;
|
|
262
|
-
}, z.core.$strict>>>;
|
|
263
|
-
}, z.core.$strict>]>, z.ZodObject<{
|
|
264
|
-
kind: z.ZodLiteral<"checkout-not-followable">;
|
|
265
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
266
|
-
target: z.ZodString;
|
|
267
|
-
path: z.ZodString;
|
|
268
|
-
reason: z.ZodLiteral<"untracked">;
|
|
269
|
-
paths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
270
|
-
}, z.core.$strict>, z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
271
|
-
kind: z.ZodLiteral<"integration-failed">;
|
|
272
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
273
|
-
reason: z.ZodEnum<{
|
|
274
|
-
"not-based-on-target": "not-based-on-target";
|
|
275
|
-
"unrelated-histories": "unrelated-histories";
|
|
276
|
-
conflict: "conflict";
|
|
277
|
-
}>;
|
|
278
|
-
targetHead: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
279
|
-
conflictPaths: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
280
|
-
}, z.core.$strict>, z.ZodTransform<{
|
|
281
|
-
kind: "integration-failed";
|
|
282
|
-
contractId: ContractId;
|
|
283
|
-
reason: "not-based-on-target" | "unrelated-histories" | "conflict";
|
|
284
|
-
targetHead: import("../core/facts/types.js").SnapshotId;
|
|
285
|
-
} & {
|
|
286
|
-
conflictPaths?: readonly string[];
|
|
287
|
-
}, {
|
|
288
|
-
kind: "integration-failed";
|
|
289
|
-
contractId: ContractId;
|
|
290
|
-
reason: "not-based-on-target" | "unrelated-histories" | "conflict";
|
|
291
|
-
targetHead: import("../core/facts/types.js").SnapshotId;
|
|
292
|
-
conflictPaths?: readonly string[] | undefined;
|
|
293
|
-
}>>, z.ZodObject<{
|
|
294
|
-
kind: z.ZodLiteral<"integration-unsupported">;
|
|
295
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
296
|
-
requiredGit: z.ZodLiteral<"2.38">;
|
|
297
|
-
}, z.core.$strict>]>, z.ZodObject<{
|
|
298
|
-
kind: z.ZodLiteral<"target-missing">;
|
|
299
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
300
|
-
}, z.core.$strict>]>;
|
|
301
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
302
|
-
retry: z.ZodUnion<readonly [z.ZodObject<{
|
|
303
|
-
kind: z.ZodEnum<{
|
|
304
|
-
exhausted: "exhausted";
|
|
305
|
-
collision: "collision";
|
|
306
|
-
}>;
|
|
307
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
308
|
-
kind: z.ZodLiteral<"publication-failed">;
|
|
309
|
-
diagnostic: z.ZodString;
|
|
310
|
-
}, z.core.$strict>]>;
|
|
311
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
312
|
-
failure: z.ZodLiteral<"target-placement-failed">;
|
|
313
|
-
diagnostic: z.ZodString;
|
|
314
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
315
|
-
failure: z.ZodLiteral<"target-moved">;
|
|
316
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
317
|
-
target: z.ZodString;
|
|
318
|
-
integratedAt: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
319
|
-
observed: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>>;
|
|
320
|
-
attempts: z.ZodNumber;
|
|
321
|
-
observedTreeEqualsCandidate: z.ZodBoolean;
|
|
322
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
323
|
-
failure: z.ZodLiteral<"target-moved">;
|
|
324
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
325
|
-
target: z.ZodString;
|
|
326
|
-
expected: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
327
|
-
observed: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>>;
|
|
328
|
-
observedTreeEqualsCandidate: z.ZodBoolean;
|
|
329
|
-
}, z.core.$strict>]>>;
|
|
330
|
-
}, z.core.$strict>;
|
|
331
|
-
export type CompletionEvidence = z.infer<typeof completionEvidenceSchema>;
|
|
16
|
+
}>;
|
|
17
|
+
export type CompletionEvidence = Readonly<{
|
|
18
|
+
completion?: CandidateCompletion;
|
|
19
|
+
gates?: readonly GateReport[];
|
|
20
|
+
placement?: PlacementStop;
|
|
21
|
+
}>;
|
|
332
22
|
export type CompletionInput = Readonly<{
|
|
333
23
|
channel: GitDecodeChannel;
|
|
334
24
|
repository: GitRepository;
|
|
335
25
|
checkpoint: ContractCheckpoint;
|
|
336
26
|
progress: ProtocolProgress;
|
|
337
|
-
start: "verification" | "placement";
|
|
338
|
-
deriveDocument(state: ContractCheckpoint["state"]): DocumentDerivation;
|
|
339
27
|
actor?: ActorId;
|
|
340
28
|
signal?: AbortSignal;
|
|
341
29
|
}>;
|
|
@@ -349,8 +37,7 @@ export type CompletionResult = Readonly<{
|
|
|
349
37
|
kind: "stopped";
|
|
350
38
|
checkpoint: ContractCheckpoint;
|
|
351
39
|
evidence: CompletionEvidence;
|
|
352
|
-
stop: PlacementStop |
|
|
40
|
+
stop: PlacementStop | ExecutionStop;
|
|
353
41
|
}>;
|
|
354
42
|
/** Advance one contract. The trigger owns the leading act; this node owns no other contract. */
|
|
355
43
|
export declare function completeCandidate(input: CompletionInput): Promise<CompletionResult>;
|
|
356
|
-
export {};
|
|
@@ -1,41 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { currentVerifiedAttestation, verifyDelivery } from "./intent.js";
|
|
1
|
+
import { targetName } from "../core/facts/types.js";
|
|
2
|
+
import { gateReports } from "../core/facts/gate.js";
|
|
3
|
+
import { readDeliveryScope } from "../git/integration.js";
|
|
5
4
|
import { admitPlacement, observeTargetPlacement, observeIntegrationTargetMovement } from "./placement.js";
|
|
6
5
|
import { reintegrateOperation } from "./reintegrate.js";
|
|
7
6
|
import { contractCheckpoint, executionStop, isOperationalFailure, isOperationalStop, } from "./progress.js";
|
|
8
|
-
import { placementStop, timestamp
|
|
7
|
+
import { placementStop, timestamp } from "./operations.js";
|
|
9
8
|
const MAX_REINTEGRATION_CYCLES = 3;
|
|
10
|
-
const verificationVerdictSchema = z.object({
|
|
11
|
-
snapshot: snapshotIdSchema,
|
|
12
|
-
verdict: verdictSchema,
|
|
13
|
-
entry: entryUlidSchema,
|
|
14
|
-
summary: z.string().optional(),
|
|
15
|
-
});
|
|
16
|
-
const verificationEvidenceSchema = z.discriminatedUnion("kind", [
|
|
17
|
-
verificationVerdictSchema.extend({ kind: z.literal("ran"), entry: entryUlidSchema.optional() }).strict(),
|
|
18
|
-
verificationVerdictSchema.extend({ kind: z.literal("reused") }).strict(),
|
|
19
|
-
z.object({ kind: z.literal("stopped"), stop: verificationStopSchema }).strict(),
|
|
20
|
-
]);
|
|
21
|
-
const candidateCompletionSchema = z
|
|
22
|
-
.object({
|
|
23
|
-
integration: snapshotIdSchema,
|
|
24
|
-
predecessor: snapshotIdSchema.optional(),
|
|
25
|
-
target: z
|
|
26
|
-
.string()
|
|
27
|
-
.refine((value) => value.trim() !== "")
|
|
28
|
-
.optional(),
|
|
29
|
-
scope: deliveryDiffScopeSchema.omit({ paths: true }).optional(),
|
|
30
|
-
})
|
|
31
|
-
.strict();
|
|
32
|
-
export const completionEvidenceSchema = z
|
|
33
|
-
.object({
|
|
34
|
-
completion: candidateCompletionSchema.optional(),
|
|
35
|
-
verification: verificationEvidenceSchema.optional(),
|
|
36
|
-
placement: placementStopSchema.optional(),
|
|
37
|
-
})
|
|
38
|
-
.strict();
|
|
39
9
|
function reintegrationStop(result) {
|
|
40
10
|
if (result.kind === "placement-failed")
|
|
41
11
|
return { failure: "target-placement-failed", diagnostic: result.diagnostic };
|
|
@@ -43,70 +13,6 @@ function reintegrationStop(result) {
|
|
|
43
13
|
return { refusal: result.refusal };
|
|
44
14
|
return { retry: result.reason };
|
|
45
15
|
}
|
|
46
|
-
async function verifyCurrentCandidate(input, cursor) {
|
|
47
|
-
cursor.stage = "verification";
|
|
48
|
-
input.signal?.throwIfAborted();
|
|
49
|
-
const state = cursor.checkpoint.state;
|
|
50
|
-
const snapshot = state.currentIntegration?.snapshot;
|
|
51
|
-
if (snapshot === undefined)
|
|
52
|
-
throw new Error("delivery completion requires an integration snapshot");
|
|
53
|
-
cursor.evidence = {};
|
|
54
|
-
cursor.ran = undefined;
|
|
55
|
-
input.progress.recordCandidate(state.id, cursor.evidence);
|
|
56
|
-
const declaration = input.deriveDocument(state).verification;
|
|
57
|
-
if (declaration.kind === "refused") {
|
|
58
|
-
cursor.evidence = { verification: { kind: "stopped", stop: { refusal: declaration.refusal } } };
|
|
59
|
-
input.progress.recordCandidate(state.id, cursor.evidence);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (declaration.data === null)
|
|
63
|
-
return;
|
|
64
|
-
const current = currentVerifiedAttestation(state);
|
|
65
|
-
if (current?.verdict === "satisfied") {
|
|
66
|
-
cursor.evidence = {
|
|
67
|
-
verification: { kind: "reused", snapshot, ...current },
|
|
68
|
-
};
|
|
69
|
-
input.progress.recordCandidate(state.id, cursor.evidence);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const result = await verifyDelivery({
|
|
73
|
-
channel: input.channel,
|
|
74
|
-
repository: input.repository,
|
|
75
|
-
contractId: state.id,
|
|
76
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
77
|
-
at: timestamp(),
|
|
78
|
-
state,
|
|
79
|
-
snapshot,
|
|
80
|
-
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
81
|
-
progress: input.progress,
|
|
82
|
-
verification: declaration.data,
|
|
83
|
-
});
|
|
84
|
-
if (result === null)
|
|
85
|
-
return;
|
|
86
|
-
const verified = unpackVerificationOutcome(result);
|
|
87
|
-
if (verified.admission !== undefined) {
|
|
88
|
-
cursor.checkpoint = contractCheckpoint(verified.admission);
|
|
89
|
-
input.progress.recordResidue(state.id, verified.admission);
|
|
90
|
-
cursor.ran = verified.admission.facts.find((fact) => fact.kind === "attestation" && fact.data.gate === "verified")?.entry;
|
|
91
|
-
}
|
|
92
|
-
if (verified.reuse !== undefined)
|
|
93
|
-
cursor.ran = verified.reuse.entry;
|
|
94
|
-
const verification = verified.stop !== undefined
|
|
95
|
-
? { kind: "stopped", stop: verified.stop }
|
|
96
|
-
: verified.reuse !== undefined
|
|
97
|
-
? { kind: "reused", snapshot, ...verified.reuse }
|
|
98
|
-
: verified.counts === undefined
|
|
99
|
-
? undefined
|
|
100
|
-
: {
|
|
101
|
-
kind: "ran",
|
|
102
|
-
snapshot,
|
|
103
|
-
verdict: verified.counts.verdict,
|
|
104
|
-
...(cursor.ran === undefined ? {} : { entry: cursor.ran }),
|
|
105
|
-
...(verified.counts.verdict === "unsatisfied" ? { summary: verified.counts.summary } : {}),
|
|
106
|
-
};
|
|
107
|
-
cursor.evidence = verification === undefined ? {} : { verification };
|
|
108
|
-
input.progress.recordCandidate(state.id, cursor.evidence);
|
|
109
|
-
}
|
|
110
16
|
async function observeCandidateTarget(input, cursor) {
|
|
111
17
|
const target = cursor.checkpoint.state.coordinates.target;
|
|
112
18
|
if (target === undefined)
|
|
@@ -140,20 +46,15 @@ async function completedResult(input, cursor) {
|
|
|
140
46
|
// read must never erase an already-claimed candidate.
|
|
141
47
|
cursor.completion = {
|
|
142
48
|
integration,
|
|
143
|
-
...(predecessor === undefined || target === undefined ? {} : { predecessor, target }),
|
|
49
|
+
...(predecessor === undefined || target === undefined ? {} : { predecessor, target: targetName(target) }),
|
|
144
50
|
};
|
|
145
51
|
input.progress.recordCompletion(state.id, cursor.completion);
|
|
146
|
-
|
|
147
|
-
const current = declaration.data == null ? undefined : currentVerifiedAttestation(state);
|
|
148
|
-
const verification = current === undefined
|
|
149
|
-
? undefined
|
|
150
|
-
: { kind: cursor.ran === current.entry ? "ran" : "reused", snapshot: integration, ...current };
|
|
151
|
-
cursor.evidence = verification === undefined ? {} : { verification };
|
|
52
|
+
cursor.evidence = { gates: gateReports(state).reports };
|
|
152
53
|
input.progress.recordCandidate(state.id, { ...cursor.evidence, completion: cursor.completion });
|
|
153
54
|
const scope = predecessor === undefined ? undefined : await readDeliveryScope(input.repository, predecessor, integration, false);
|
|
154
55
|
const completion = {
|
|
155
56
|
integration,
|
|
156
|
-
...(predecessor === undefined || target === undefined ? {} : { predecessor, target }),
|
|
57
|
+
...(predecessor === undefined || target === undefined ? {} : { predecessor, target: targetName(target) }),
|
|
157
58
|
...(scope === undefined
|
|
158
59
|
? {}
|
|
159
60
|
: { scope: { filesChanged: scope.filesChanged, insertions: scope.insertions, deletions: scope.deletions } }),
|
|
@@ -218,33 +119,20 @@ async function placeCurrentCandidate(input, cursor) {
|
|
|
218
119
|
}
|
|
219
120
|
return result;
|
|
220
121
|
}
|
|
221
|
-
async function verifyCandidateReadiness(input, cursor) {
|
|
222
|
-
const observedPlacement = await observeCandidateTarget(input, cursor);
|
|
223
|
-
await verifyCurrentCandidate(input, cursor);
|
|
224
|
-
const stop = cursor.evidence.verification?.kind === "stopped" ? cursor.evidence.verification.stop : observedPlacement;
|
|
225
|
-
if (stop !== undefined) {
|
|
226
|
-
return {
|
|
227
|
-
kind: "stopped",
|
|
228
|
-
checkpoint: cursor.checkpoint,
|
|
229
|
-
evidence: { ...cursor.evidence, ...(observedPlacement === undefined ? {} : { placement: observedPlacement }) },
|
|
230
|
-
stop,
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
return undefined;
|
|
234
|
-
}
|
|
235
122
|
async function advanceCandidate(input, cursor) {
|
|
236
123
|
const target = cursor.checkpoint.state.coordinates.target;
|
|
237
|
-
let needsVerification = input.start === "verification";
|
|
238
124
|
for (let cycles = 0;; cycles += 1) {
|
|
239
125
|
input.signal?.throwIfAborted();
|
|
126
|
+
cursor.evidence = { gates: gateReports(cursor.checkpoint.state).reports };
|
|
127
|
+
input.progress.recordCandidate(cursor.checkpoint.state.id, cursor.evidence);
|
|
240
128
|
let placement = await observeIntegrationTargetMovement(input.repository, cursor.checkpoint.state);
|
|
241
129
|
if (placement === undefined) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return stopped;
|
|
246
|
-
}
|
|
130
|
+
const targetStop = await observeCandidateTarget(input, cursor);
|
|
131
|
+
if (targetStop !== undefined)
|
|
132
|
+
return stoppedResult(cursor, targetStop);
|
|
247
133
|
placement = await placeCurrentCandidate(input, cursor);
|
|
134
|
+
cursor.evidence = { gates: gateReports(cursor.checkpoint.state).reports };
|
|
135
|
+
input.progress.recordCandidate(cursor.checkpoint.state.id, cursor.evidence);
|
|
248
136
|
}
|
|
249
137
|
if (placement.kind === "accepted")
|
|
250
138
|
return await completedResult(input, cursor);
|
|
@@ -258,7 +146,7 @@ async function advanceCandidate(input, cursor) {
|
|
|
258
146
|
return stoppedResult(cursor, {
|
|
259
147
|
failure: "target-moved",
|
|
260
148
|
contractId: cursor.checkpoint.state.id,
|
|
261
|
-
target,
|
|
149
|
+
target: targetName(target),
|
|
262
150
|
integratedAt: cursor.checkpoint.state.currentIntegration.snapshot,
|
|
263
151
|
observed: placement.observed,
|
|
264
152
|
attempts: cycles,
|
|
@@ -279,12 +167,11 @@ async function advanceCandidate(input, cursor) {
|
|
|
279
167
|
return stoppedResult(cursor, reintegrationStop(reintegrated));
|
|
280
168
|
cursor.checkpoint = contractCheckpoint(reintegrated);
|
|
281
169
|
input.progress.recordResidue(reintegrated.state.id, reintegrated);
|
|
282
|
-
needsVerification = true;
|
|
283
170
|
}
|
|
284
171
|
}
|
|
285
172
|
/** Advance one contract. The trigger owns the leading act; this node owns no other contract. */
|
|
286
173
|
export async function completeCandidate(input) {
|
|
287
|
-
const cursor = { checkpoint: input.checkpoint, evidence: {},
|
|
174
|
+
const cursor = { checkpoint: input.checkpoint, evidence: {}, stage: "placement" };
|
|
288
175
|
try {
|
|
289
176
|
return await advanceCandidate(input, cursor);
|
|
290
177
|
}
|
|
@@ -306,7 +193,7 @@ export async function completeCandidate(input) {
|
|
|
306
193
|
const target = admitted.state.coordinates.target;
|
|
307
194
|
cursor.completion = {
|
|
308
195
|
integration: integration.snapshot,
|
|
309
|
-
...(target === undefined ? {} : { target, predecessor: integration.predecessor }),
|
|
196
|
+
...(target === undefined ? {} : { target: targetName(target), predecessor: integration.predecessor }),
|
|
310
197
|
};
|
|
311
198
|
input.progress.recordCompletion(contractId, cursor.completion);
|
|
312
199
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { candidateContentChangeSchema } from "./operations.js";
|
|
3
|
-
import type { ActorId, ContractId, ContractState, DeliverData, SnapshotId } from "../core/facts/types.js";
|
|
4
|
-
import { type CurrentVerifiedAttestation } from "./intent.js";
|
|
3
|
+
import type { ActorId, ContractId, ContractState, DeliverData, JournalEntry, SnapshotId } from "../core/facts/types.js";
|
|
5
4
|
import type { LeadingOutcome } from "./outcome.js";
|
|
6
5
|
import type { CompletionEvidence } from "./completion.js";
|
|
7
6
|
import { type ManagedWorktreeAppointment } from "../workspace-place.js";
|
|
8
7
|
import type { DeliveryPreparationRefusal, DocumentDerivation, MutationOperationInput } from "./operations.js";
|
|
9
8
|
type DeliveryIdentity = DeliverData;
|
|
10
|
-
|
|
9
|
+
/** Known prospective and delivered integrations, newest first, without giving Git producer vocabulary. */
|
|
10
|
+
export declare function deliveryIntegrationSnapshots(journal: readonly JournalEntry[]): readonly SnapshotId[];
|
|
11
11
|
export declare const deliverLeadingSchema: z.ZodObject<{
|
|
12
12
|
kind: z.ZodEnum<{
|
|
13
13
|
"admitted-now": "admitted-now";
|