@astrosheep/keiyaku 4.6.31 → 4.6.32
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 +34 -17
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/pi/README.md +16 -18
- package/build/plugins/pi/akuma-tools.ts +31 -38
- package/build/plugins/pi/keiyaku.ts +15 -4
- package/build/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/src/akuma/akuma-call.d.ts +3 -5
- package/build/src/akuma/akuma-call.js +7 -10
- package/build/src/akuma/akuma-errors.d.ts +7 -4
- package/build/src/akuma/akuma-errors.js +16 -12
- package/build/src/akuma/akuma-instance.d.ts +39 -303
- package/build/src/akuma/akuma-instance.js +48 -48
- package/build/src/akuma/akuma-observe.d.ts +5 -4
- package/build/src/akuma/akuma-observe.js +1 -7
- package/build/src/akuma/akuma-owner.d.ts +14 -6
- package/build/src/akuma/akuma-owner.js +33 -27
- package/build/src/akuma/akuma-selection-execution.d.ts +22 -19
- package/build/src/akuma/akuma-selection-execution.js +71 -124
- package/build/src/akuma/akuma-wait.d.ts +3 -3
- package/build/src/akuma/akuma.d.ts +47 -384
- package/build/src/akuma/akuma.js +8 -58
- package/build/src/akuma/archetype.d.ts +16 -19
- package/build/src/akuma/archetype.js +48 -49
- package/build/src/akuma/body.js +31 -26
- package/build/src/akuma/call-initial-tell.d.ts +4 -1
- package/build/src/akuma/call-initial-tell.js +9 -1
- package/build/src/akuma/call-input.d.ts +8 -1
- package/build/src/akuma/call-input.js +27 -18
- package/build/src/akuma/caller.js +2 -1
- package/build/src/akuma/detached-body.js +1 -1
- package/build/src/akuma/heart/facts.d.ts +5 -4
- package/build/src/akuma/heart/facts.js +5 -5
- package/build/src/akuma/heart/soul.js +20 -4
- package/build/src/akuma/identity.d.ts +1 -1
- package/build/src/akuma/identity.js +9 -4
- package/build/src/akuma/index.d.ts +6 -7
- package/build/src/akuma/index.js +2 -3
- package/build/src/akuma/projection.d.ts +3 -0
- package/build/src/akuma/provider-recipe.js +3 -2
- package/build/src/akuma/providers/acp/config.js +11 -10
- package/build/src/akuma/providers/acp/index.js +2 -1
- package/build/src/akuma/providers/codex-app-server/index.js +7 -1
- package/build/src/akuma/providers/grok-build/index.js +2 -1
- package/build/src/akuma/providers/index.d.ts +0 -1
- package/build/src/akuma/providers/index.js +0 -8
- package/build/src/akuma/providers/paseo/index.js +7 -4
- package/build/src/akuma/providers/pi/index.js +4 -3
- package/build/src/akuma/publication.d.ts +1 -2
- package/build/src/akuma/publication.js +16 -14
- package/build/src/akuma/schema.d.ts +3 -49
- package/build/src/akuma/schema.js +6 -147
- package/build/src/akuma/selection-observation.d.ts +281 -240
- package/build/src/akuma/selection-observation.js +122 -68
- package/build/src/akuma/status-projection.d.ts +49 -285
- package/build/src/akuma/status-projection.js +178 -138
- package/build/src/body/amend.js +2 -1
- package/build/src/body/arc.js +3 -2
- package/build/src/body/criteria.js +4 -3
- package/build/src/body/decode.js +2 -1
- package/build/src/body/envelope.js +2 -1
- package/build/src/body/region.d.ts +1 -3
- package/build/src/body/region.js +3 -8
- package/build/src/body-host.d.ts +4 -11
- package/build/src/body-host.js +5 -4
- package/build/src/bounded-list.js +2 -1
- package/build/src/cli/commands/akuma-grammar.d.ts +109 -66
- package/build/src/cli/commands/akuma-grammar.js +75 -95
- package/build/src/cli/commands/akuma.d.ts +8 -3
- package/build/src/cli/commands/akuma.js +63 -122
- package/build/src/cli/commands/contract-grammar.d.ts +3 -135
- package/build/src/cli/commands/contract-grammar.js +125 -218
- package/build/src/cli/commands/contract-help.d.ts +24 -21
- package/build/src/cli/commands/contract-help.js +43 -35
- package/build/src/cli/commands/contract.d.ts +6 -18
- package/build/src/cli/commands/contract.js +65 -272
- package/build/src/cli/commands/debt-grammar.d.ts +2 -4
- package/build/src/cli/commands/debt-grammar.js +22 -190
- package/build/src/cli/commands/debt.js +10 -87
- package/build/src/cli/commands/report.d.ts +2 -4
- package/build/src/cli/coordinates.d.ts +1 -1
- package/build/src/cli/coordinates.js +1 -1
- package/build/src/cli/main.js +9 -3
- package/build/src/cli/parse.d.ts +80 -3
- package/build/src/cli/parse.js +76 -16
- package/build/src/cli/render/akuma-activity.d.ts +19 -24
- package/build/src/cli/render/akuma-activity.js +164 -259
- package/build/src/cli/render/akuma.d.ts +3 -3
- package/build/src/cli/render/akuma.js +36 -43
- package/build/src/cli/render/catalog.d.ts +2 -5
- package/build/src/cli/render/catalog.js +2 -33
- package/build/src/cli/render/contract-history.js +1 -2
- package/build/src/cli/render/contract-observation.d.ts +0 -7
- package/build/src/cli/render/contract-observation.js +0 -3
- package/build/src/cli/render/contract.d.ts +7 -9
- package/build/src/cli/render/contract.js +35 -64
- package/build/src/cli/render/debt.d.ts +3 -11
- package/build/src/cli/render/debt.js +17 -88
- package/build/src/cli/render/delivery-preview.js +4 -4
- package/build/src/cli/render/kanshi-akuma.d.ts +5 -3
- package/build/src/cli/render/kanshi-akuma.js +22 -18
- package/build/src/cli/render/kanshi.d.ts +1 -3
- package/build/src/cli/render/kanshi.js +16 -39
- package/build/src/cli/render/receipt.d.ts +21 -12
- package/build/src/cli/render/receipt.js +49 -44
- package/build/src/cli/render/refusal.d.ts +4 -3
- package/build/src/cli/render/refusal.js +15 -17
- package/build/src/cli/render/settings.d.ts +1 -1
- package/build/src/cli/render/terminal.d.ts +9 -8
- package/build/src/cli/render/terminal.js +48 -32
- package/build/src/cli/render/verbs.d.ts +3 -1
- package/build/src/cli/render/verbs.js +74 -116
- package/build/src/cli/runtime.js +66 -65
- package/build/src/cli/streams.d.ts +2 -9
- package/build/src/cli/streams.js +8 -1
- package/build/src/cli/usage.d.ts +2 -1
- package/build/src/cli/usage.js +3 -2
- package/build/src/contract-worktree.js +2 -10
- package/build/src/core/facts/codec.js +9 -23
- package/build/src/core/facts/errors.d.ts +2 -1
- package/build/src/core/facts/errors.js +3 -3
- package/build/src/core/facts/types.d.ts +2 -13
- package/build/src/core/facts/types.js +1 -6
- package/build/src/core/verbs/abandon.d.ts +1 -2
- package/build/src/core/verbs/amend.d.ts +1 -2
- package/build/src/core/verbs/arc.d.ts +1 -2
- package/build/src/core/verbs/attestation.d.ts +1 -2
- package/build/src/core/verbs/bind.d.ts +1 -2
- package/build/src/core/verbs/deliver.d.ts +1 -2
- package/build/src/core/verbs/placement.d.ts +1 -2
- package/build/src/core/verbs/reintegrate.d.ts +1 -2
- package/build/src/debt/board.d.ts +14 -94
- package/build/src/debt/board.js +25 -160
- package/build/src/debt/catalog.d.ts +0 -2
- package/build/src/debt/catalog.js +1 -22
- package/build/src/debt/document.d.ts +8 -11
- package/build/src/debt/document.js +19 -62
- package/build/src/debt/identity.d.ts +2 -14
- package/build/src/debt/identity.js +19 -49
- package/build/src/debt/index.d.ts +81 -219
- package/build/src/debt/index.js +61 -110
- package/build/src/debt/input.d.ts +19 -5
- package/build/src/debt/input.js +51 -177
- package/build/src/debt/lifecycle-operations.d.ts +1 -3
- package/build/src/debt/lifecycle-operations.js +1 -73
- package/build/src/debt/operation-types.d.ts +24 -128
- package/build/src/debt/operation-types.js +6 -62
- package/build/src/debt/operations.d.ts +8 -17
- package/build/src/debt/operations.js +58 -154
- package/build/src/debt/store.d.ts +0 -2
- package/build/src/debt/store.js +32 -87
- package/build/src/errors.d.ts +28 -0
- package/build/src/errors.js +26 -0
- package/build/src/git/hooks.d.ts +1 -1
- package/build/src/git/observe.d.ts +3 -0
- package/build/src/git/observe.js +19 -5
- package/build/src/git/reconcile.d.ts +3 -16
- package/build/src/git/reconcile.js +0 -18
- package/build/src/git/repository.d.ts +2 -1
- package/build/src/git/repository.js +3 -3
- package/build/src/git/target-placement.d.ts +4 -4
- package/build/src/git/target.d.ts +2 -2
- package/build/src/git/tender.d.ts +1 -2
- package/build/src/git/tender.js +5 -12
- package/build/src/identity/coordinates.d.ts +1 -1
- package/build/src/identity/coordinates.js +3 -2
- package/build/src/identity/normalize.js +2 -1
- package/build/src/identity/selector.js +4 -3
- package/build/src/index.d.ts +34 -57
- package/build/src/index.js +11 -36
- package/build/src/kanshi/counts.d.ts +3 -8
- package/build/src/kanshi/counts.js +6 -14
- package/build/src/kanshi/index.d.ts +22 -7
- package/build/src/kanshi/index.js +30 -4
- package/build/src/kanshi/read.d.ts +81 -270
- package/build/src/kanshi/read.js +39 -199
- package/build/src/kanshi/report.d.ts +340 -1619
- package/build/src/kanshi/report.js +19 -31
- package/build/src/library/address.d.ts +11 -11
- package/build/src/library/address.js +34 -27
- package/build/src/library/akuma-creation.d.ts +210 -79
- package/build/src/library/akuma-creation.js +201 -242
- package/build/src/library/akumas.d.ts +24 -5
- package/build/src/library/akumas.js +96 -29
- package/build/src/library/bind.d.ts +7 -10
- package/build/src/library/bind.js +2 -8
- package/build/src/library/continuation.d.ts +141 -231
- package/build/src/library/continuation.js +22 -31
- package/build/src/library/contract-address.d.ts +6 -9
- package/build/src/library/contract-address.js +11 -16
- package/build/src/library/contract-composition.d.ts +2 -3
- package/build/src/library/contract-composition.js +12 -19
- package/build/src/library/contract-creation.js +33 -34
- package/build/src/library/contract-outcomes.d.ts +1278 -806
- package/build/src/library/contract-outcomes.js +11 -37
- package/build/src/library/contract-settings.d.ts +1 -2
- package/build/src/library/contract-settings.js +5 -7
- package/build/src/library/contract-types.d.ts +42 -67
- package/build/src/library/contract-types.js +15 -56
- package/build/src/library/contract-wait.d.ts +40 -3
- package/build/src/library/contract-wait.js +28 -21
- package/build/src/library/delivery.d.ts +366 -389
- package/build/src/library/delivery.js +5 -25
- package/build/src/library/input.d.ts +31 -5
- package/build/src/library/input.js +40 -40
- package/build/src/library/invocation.d.ts +13 -11
- package/build/src/library/invocation.js +69 -58
- package/build/src/library/kei.d.ts +16 -8
- package/build/src/library/kei.js +459 -19
- package/build/src/library/keiyaku-attribution.d.ts +0 -8
- package/build/src/library/keiyaku-attribution.js +0 -11
- package/build/src/library/keiyaku-classify.d.ts +2 -2
- package/build/src/library/keiyaku-classify.js +40 -59
- package/build/src/library/keiyaku-coordinates.d.ts +3 -8
- package/build/src/library/keiyaku-coordinates.js +6 -26
- package/build/src/library/keiyaku-debt.d.ts +21 -93
- package/build/src/library/keiyaku-debt.js +8 -157
- package/build/src/library/keiyaku-identity.js +5 -4
- package/build/src/library/keiyaku-verbs.d.ts +4004 -3885
- package/build/src/library/keiyaku-verbs.js +309 -271
- package/build/src/library/keiyaku.d.ts +30 -860
- package/build/src/library/keiyaku.js +169 -256
- package/build/src/library/nuke.d.ts +4 -2
- package/build/src/library/nuke.js +5 -1
- package/build/src/library/outcome.d.ts +424 -307
- package/build/src/library/outcome.js +167 -362
- package/build/src/library/reconcile.d.ts +331 -143
- package/build/src/library/reconcile.js +38 -72
- package/build/src/library/refusal.d.ts +20 -28
- package/build/src/library/refusal.js +1 -11
- package/build/src/library/repo.js +4 -3
- package/build/src/library/selection.d.ts +32 -21
- package/build/src/library/selection.js +63 -87
- package/build/src/mcp/adapter.d.ts +6 -0
- package/build/src/mcp/adapter.js +177 -42
- package/build/src/mcp/help.d.ts +1 -1
- package/build/src/mcp/help.js +12 -7
- package/build/src/mcp/output.d.ts +385 -0
- package/build/src/mcp/output.js +193 -0
- package/build/src/plugin/public.d.ts +4 -0
- package/build/src/plugin/runtime.d.ts +1 -1
- package/build/src/plugin/runtime.js +2 -2
- package/build/src/protocol/amend.d.ts +1 -1
- package/build/src/protocol/amend.js +2 -2
- package/build/src/protocol/bind.d.ts +5 -7
- package/build/src/protocol/bind.js +3 -3
- package/build/src/protocol/completion.d.ts +158 -195
- package/build/src/protocol/completion.js +55 -19
- package/build/src/protocol/deliver.d.ts +11 -6
- package/build/src/protocol/deliver.js +30 -30
- package/build/src/protocol/delivery-preview.d.ts +13 -11
- package/build/src/protocol/delivery-preview.js +2 -2
- package/build/src/protocol/execution-observation.d.ts +5 -13
- package/build/src/protocol/intent.d.ts +6 -9
- package/build/src/protocol/intent.js +18 -31
- package/build/src/protocol/operations.d.ts +48 -53
- package/build/src/protocol/operations.js +16 -25
- package/build/src/protocol/outcome.d.ts +3 -1
- package/build/src/protocol/placement.d.ts +1 -2
- package/build/src/protocol/placement.js +1 -1
- package/build/src/protocol/progress.d.ts +1 -0
- package/build/src/protocol/read/status.d.ts +29 -112
- package/build/src/protocol/read/status.js +52 -78
- package/build/src/protocol/reintegrate.d.ts +1 -2
- package/build/src/protocol/reintegrate.js +0 -1
- package/build/src/protocol/result-leaves.d.ts +11 -32
- package/build/src/protocol/result-leaves.js +18 -57
- package/build/src/protocol/result-reasons.d.ts +6 -6
- package/build/src/protocol/review.js +0 -1
- package/build/src/protocol/verify.d.ts +192 -146
- package/build/src/protocol/verify.js +60 -47
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +8 -9
- package/build/src/settings.js +16 -13
- package/build/src/settlement/holder.js +2 -2
- package/build/src/settlement/settle.d.ts +0 -6
- package/build/src/settlement/settle.js +0 -4
- package/build/src/verification/declaration.d.ts +3 -6
- package/build/src/verification/declaration.js +3 -5
- package/build/src/verification/observation.d.ts +2 -2
- package/build/src/world.d.ts +3 -2
- package/build/src/world.js +5 -6
- package/package.json +1 -1
- package/plugins/paseo/plugin/index.server.ts +1 -1
- package/plugins/paseo/plugin/server/attach.ts +74 -67
- package/plugins/paseo/plugin/server/keiyaku.ts +80 -14
- package/plugins/paseo/plugin/server/message.ts +2 -1
- package/plugins/paseo/plugin/server/mirror-identity.ts +6 -4
- package/plugins/paseo/plugin/server/sdk.ts +9 -11
- package/plugins/paseo/plugin/server/transport.ts +24 -1
- package/plugins/pi/README.md +16 -18
- package/plugins/pi/akuma-tools.ts +31 -38
- package/plugins/pi/keiyaku.ts +15 -4
- package/skills/keiyaku-akuma/SKILL.md +16 -11
- package/skills/keiyaku-babysit/SKILL.md +5 -3
- package/skills/keiyaku-bind/SKILL.md +4 -3
- package/skills/keiyaku-debt/SKILL.md +17 -17
- package/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/src/akuma/providers/codex-app-server/configuration.d.ts +0 -5
- package/build/src/akuma/providers/codex-app-server/configuration.js +0 -72
- package/build/src/cli/commands/debt-query.d.ts +0 -5
- package/build/src/cli/commands/debt-query.js +0 -194
- package/build/src/cli/render/akuma-tool-command.d.ts +0 -6
- package/build/src/cli/render/akuma-tool-command.js +0 -143
- package/build/src/cli/render/akuma-tool.d.ts +0 -29
- package/build/src/cli/render/akuma-tool.js +0 -225
- package/build/src/debt/context.d.ts +0 -28
- package/build/src/debt/context.js +0 -102
- package/build/src/debt/created-observation.d.ts +0 -26
- package/build/src/debt/created-observation.js +0 -38
- package/build/src/debt/query.d.ts +0 -80
- package/build/src/debt/query.js +0 -283
- package/build/src/library/contract-execution.d.ts +0 -28
- package/build/src/library/contract-execution.js +0 -506
- package/build/src/library/keiyaku-policy.d.ts +0 -27
- package/build/src/library/keiyaku-policy.js +0 -44
- package/build/src/library/keiyaku-status.d.ts +0 -1487
- package/build/src/library/keiyaku-status.js +0 -92
|
@@ -6,7 +6,7 @@ import { admitPlacement, observeTargetPlacement, observeIntegrationTargetMovemen
|
|
|
6
6
|
import { reintegrateOperation } from "./reintegrate.js";
|
|
7
7
|
import { contractCheckpoint, executionStop, isOperationalFailure, isOperationalStop, } from "./progress.js";
|
|
8
8
|
import { placementStop, timestamp } from "./operations.js";
|
|
9
|
-
import { activeReasonSchema, targetLifecycleReasonSchema, targetWorkspaceReasonSchema, checkoutCollisionSchema, integrationProblemSchema, retrySchema, compactRetry, compactReason, } from "./result-reasons.js";
|
|
9
|
+
import { activeReasonSchema, targetLifecycleReasonSchema, targetWorkspaceReasonSchema, checkoutCollisionSchema, integrationProblemSchema, retrySchema, compactRetry, compactReason, executionIssueSchema, } from "./result-reasons.js";
|
|
10
10
|
const MAX_REINTEGRATION_CYCLES = 3;
|
|
11
11
|
const requirementCoordinate = { gate: gateSchema, requirement: requirementIdSchema };
|
|
12
12
|
export const requirementProblemSchema = z.union([
|
|
@@ -61,11 +61,8 @@ export const unmetPrerequisiteSchema = z
|
|
|
61
61
|
state: z.enum(["missing", "active", "abandoned"]),
|
|
62
62
|
})
|
|
63
63
|
.readonly();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
targetLifecycleReasonSchema,
|
|
67
|
-
targetWorkspaceReasonSchema,
|
|
68
|
-
z.strictObject({ kind: z.enum(["delivery-missing", "target-missing"]) }).readonly(),
|
|
64
|
+
const normalPlacementReasonSchema = z.union([
|
|
65
|
+
z.strictObject({ kind: z.literal("delivery-missing") }).readonly(),
|
|
69
66
|
z
|
|
70
67
|
.strictObject({
|
|
71
68
|
kind: z.literal("prerequisites-unsatisfied"),
|
|
@@ -75,11 +72,24 @@ export const placementReasonSchema = z.union([
|
|
|
75
72
|
z
|
|
76
73
|
.strictObject({ kind: z.literal("gates-unsatisfied"), unmet: z.array(requirementProblemSchema).min(1).readonly() })
|
|
77
74
|
.readonly(),
|
|
75
|
+
]);
|
|
76
|
+
export const placementReasonSchema = z.union([
|
|
77
|
+
...normalPlacementReasonSchema.options,
|
|
78
|
+
activeReasonSchema,
|
|
79
|
+
targetLifecycleReasonSchema,
|
|
80
|
+
targetWorkspaceReasonSchema,
|
|
81
|
+
z.strictObject({ kind: z.literal("target-missing") }).readonly(),
|
|
78
82
|
checkoutCollisionSchema,
|
|
79
83
|
...integrationProblemSchema.options,
|
|
80
84
|
]);
|
|
81
|
-
export const
|
|
82
|
-
|
|
85
|
+
export const normalContinuationStopSchema = z.union([
|
|
86
|
+
...normalPlacementReasonSchema.options,
|
|
87
|
+
z.strictObject({ kind: z.literal("physical-lag") }).readonly(),
|
|
88
|
+
]);
|
|
89
|
+
export const placementStopSchema = z
|
|
90
|
+
.union([
|
|
91
|
+
...placementReasonSchema.options,
|
|
92
|
+
...retrySchema.options,
|
|
83
93
|
z.strictObject({ kind: z.literal("failed"), diagnostic: z.string().min(1) }).readonly(),
|
|
84
94
|
z
|
|
85
95
|
.strictObject({
|
|
@@ -97,15 +107,10 @@ export const placementFailureSchema = z.union([
|
|
|
97
107
|
observed: snapshotIdSchema.nullable(),
|
|
98
108
|
})
|
|
99
109
|
.readonly(),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
placementFailureSchema.options[1],
|
|
105
|
-
placementFailureSchema.options[2],
|
|
106
|
-
placementFailureSchema.options[3],
|
|
107
|
-
];
|
|
108
|
-
export const placementStopSchema = z.union(placementStopLeaves);
|
|
110
|
+
executionIssueSchema,
|
|
111
|
+
normalContinuationStopSchema.options[3],
|
|
112
|
+
])
|
|
113
|
+
.meta({ id: "contractStop" });
|
|
109
114
|
export const compactScopeSchema = z
|
|
110
115
|
.strictObject({
|
|
111
116
|
filesChanged: z.number().int().positive().exactOptional(),
|
|
@@ -122,7 +127,40 @@ export const placedSchema = z
|
|
|
122
127
|
predecessor: snapshotIdSchema.exactOptional(),
|
|
123
128
|
})
|
|
124
129
|
.readonly();
|
|
130
|
+
export const normalPlacementSchema = z.union([placedSchema, ...normalPlacementReasonSchema.options]);
|
|
125
131
|
export const placementSchema = z.union([placedSchema, placementStopSchema]);
|
|
132
|
+
export function placementOutcome(stop) {
|
|
133
|
+
switch (stop.kind) {
|
|
134
|
+
case "placed":
|
|
135
|
+
case "gates-unsatisfied":
|
|
136
|
+
case "prerequisites-unsatisfied":
|
|
137
|
+
case "delivery-missing":
|
|
138
|
+
case "physical-lag":
|
|
139
|
+
case "target-content-identical":
|
|
140
|
+
return "benign";
|
|
141
|
+
case "retry":
|
|
142
|
+
return "retry";
|
|
143
|
+
case "contract-missing":
|
|
144
|
+
case "terminal":
|
|
145
|
+
case "target-contract-missing":
|
|
146
|
+
case "target-contract-terminal":
|
|
147
|
+
case "target-workspace-unavailable":
|
|
148
|
+
case "target-missing":
|
|
149
|
+
case "checkout-not-followable":
|
|
150
|
+
case "not-based-on-target":
|
|
151
|
+
case "unrelated-histories":
|
|
152
|
+
case "integration-conflict":
|
|
153
|
+
case "integration-unsupported":
|
|
154
|
+
case "failed":
|
|
155
|
+
case "target-moved":
|
|
156
|
+
case "execution-stopped":
|
|
157
|
+
return "failed";
|
|
158
|
+
default: {
|
|
159
|
+
const exhaustive = stop;
|
|
160
|
+
return exhaustive;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
126
164
|
export function compactScope(scope) {
|
|
127
165
|
return {
|
|
128
166
|
...(scope.filesChanged === 0 ? {} : { filesChanged: scope.filesChanged }),
|
|
@@ -229,7 +267,6 @@ async function placeCurrentCandidate(input, cursor) {
|
|
|
229
267
|
target: cursor.checkpoint.state.coordinates.target,
|
|
230
268
|
placement: {
|
|
231
269
|
contractId: cursor.checkpoint.state.id,
|
|
232
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
233
270
|
at: timestamp(),
|
|
234
271
|
},
|
|
235
272
|
});
|
|
@@ -296,7 +333,6 @@ async function advanceCandidate(input, cursor) {
|
|
|
296
333
|
progress: input.progress,
|
|
297
334
|
contractId: cursor.checkpoint.state.id,
|
|
298
335
|
target,
|
|
299
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
300
336
|
});
|
|
301
337
|
if (reintegrated.kind !== "accepted")
|
|
302
338
|
return stoppedResult(cursor, reintegrationStop(reintegrated));
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ChangeId, ContractId, ContractState, DeliverData, EntryUlid, JournalEntry, SnapshotId } from "../core/facts/types.js";
|
|
3
3
|
import type { LeadingOutcome } from "./outcome.js";
|
|
4
|
-
import type { CompletionEvidence } from "./completion.js";
|
|
5
4
|
import { type ManagedWorktreeAppointment } from "../workspace-place.js";
|
|
6
5
|
import type { DeliveryPreparationRefusal, DocumentDerivation, MechanicalPreparationRefusal, MutationOperationInput } from "./operations.js";
|
|
7
|
-
|
|
6
|
+
export declare const deliveryIdentitySchema: z.ZodReadonly<z.ZodObject<{
|
|
7
|
+
candidate: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
8
|
+
integration: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
9
|
+
contentId: z.ZodPipe<z.ZodString, z.ZodTransform<ChangeId, string>>;
|
|
10
|
+
admission: z.ZodExactOptional<z.ZodLiteral<"reused">>;
|
|
11
|
+
previousContentId: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<ChangeId, string>>>;
|
|
12
|
+
}, z.core.$strict>>;
|
|
13
|
+
export type DeliveryIdentity = z.output<typeof deliveryIdentitySchema>;
|
|
14
|
+
export declare function compactDelivery(delivery: DeliverData, leading?: DeliverLeading, previousContentId?: ChangeId): DeliveryIdentity;
|
|
8
15
|
/** Known prospective and delivered integrations, newest first, without giving Git producer vocabulary. */
|
|
9
16
|
export declare function deliveryIntegrationSnapshots(journal: readonly JournalEntry[]): readonly SnapshotId[];
|
|
10
17
|
export type DeliverLeading = Readonly<{
|
|
11
18
|
kind: "admitted-now" | "already-admitted";
|
|
12
19
|
fact: EntryUlid;
|
|
13
20
|
}>;
|
|
14
|
-
type DeliverValue = DeliveryIdentity &
|
|
21
|
+
type DeliverValue = DeliveryIdentity & Readonly<{
|
|
15
22
|
leading: DeliverLeading;
|
|
16
|
-
previousContentId?: ChangeId;
|
|
17
23
|
}>;
|
|
18
24
|
export declare const materializedConflictSchema: z.ZodReadonly<z.ZodObject<{
|
|
19
25
|
kind: z.ZodLiteral<"integration-conflict-materialized">;
|
|
@@ -59,7 +65,6 @@ export declare function prepareDelivery(repository: import("../git/process.js").
|
|
|
59
65
|
}>, input: Readonly<{
|
|
60
66
|
title: string;
|
|
61
67
|
document: string;
|
|
62
|
-
actor?: ActorId;
|
|
63
68
|
message?: string;
|
|
64
69
|
requireBranchesToBeUpToDate?: boolean;
|
|
65
70
|
includeDirty?: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { VERIFIED } from "../verification/declaration.js";
|
|
3
|
+
import { snapshotIdSchema, changeIdSchema } from "../git/identity.js";
|
|
3
4
|
import { conflictRecoverySchema, worktreeWorkspaceSchema } from "../git/workspace.js";
|
|
4
5
|
import { materializeIntegrationSnapshot, materializeJudgedConflict, planIntegration, reusableIntegrationSnapshot, worktreeChangeId, } from "../git/integration.js";
|
|
5
6
|
import { captureTender, dirtyTenderRefusal, materializeTenderSnapshot, prepareDeliveryCommitMetadata, } from "../git/tender.js";
|
|
@@ -14,6 +15,24 @@ import { decideDeliver } from "../core/verbs/deliver.js";
|
|
|
14
15
|
import { admitDecidedOffer, mintAttempts } from "./attempt.js";
|
|
15
16
|
import { appointmentFor, readPlaceRegister } from "../workspace-place.js";
|
|
16
17
|
import { timestamp } from "./operations.js";
|
|
18
|
+
export const deliveryIdentitySchema = z
|
|
19
|
+
.strictObject({
|
|
20
|
+
candidate: snapshotIdSchema,
|
|
21
|
+
integration: snapshotIdSchema,
|
|
22
|
+
contentId: changeIdSchema,
|
|
23
|
+
admission: z.literal("reused").exactOptional(),
|
|
24
|
+
previousContentId: changeIdSchema.exactOptional(),
|
|
25
|
+
})
|
|
26
|
+
.readonly();
|
|
27
|
+
export function compactDelivery(delivery, leading, previousContentId) {
|
|
28
|
+
return {
|
|
29
|
+
candidate: delivery.tenderSnapshot,
|
|
30
|
+
integration: delivery.integration.snapshot,
|
|
31
|
+
contentId: delivery.integration.changeId,
|
|
32
|
+
...(leading?.kind === "already-admitted" ? { admission: "reused" } : {}),
|
|
33
|
+
...(previousContentId === undefined ? {} : { previousContentId }),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
17
36
|
/** Known prospective and delivered integrations, newest first, without giving Git producer vocabulary. */
|
|
18
37
|
export function deliveryIntegrationSnapshots(journal) {
|
|
19
38
|
return journal
|
|
@@ -74,7 +93,6 @@ async function prepareDeliveryWithWorktree(repository, stage, input, captured) {
|
|
|
74
93
|
title: input.title,
|
|
75
94
|
document: input.document,
|
|
76
95
|
at: tender.data.at,
|
|
77
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
78
96
|
...(input.message === undefined ? {} : { message: input.message }),
|
|
79
97
|
});
|
|
80
98
|
const tenderSnapshot = await materializeTenderSnapshot(repository, tender.data, commit);
|
|
@@ -119,7 +137,6 @@ function deliveryPreparationInput(input, derivation) {
|
|
|
119
137
|
return {
|
|
120
138
|
title: derivation.title,
|
|
121
139
|
document: derivation.bytes,
|
|
122
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
123
140
|
...(input.message === undefined ? {} : { message: input.message }),
|
|
124
141
|
requireBranchesToBeUpToDate: input.requireBranchesToBeUpToDate,
|
|
125
142
|
includeDirty: input.includeDirty,
|
|
@@ -171,7 +188,7 @@ async function prepareExternalDelivery(input) {
|
|
|
171
188
|
}
|
|
172
189
|
async function prepareDeliveryArtifacts(input, observation, state) {
|
|
173
190
|
const derivation = input.deriveDocument(state);
|
|
174
|
-
if (derivation.verification.kind === "refused")
|
|
191
|
+
if (state.terms.gates.includes(VERIFIED) && derivation.verification.kind === "refused")
|
|
175
192
|
return { kind: "defer" };
|
|
176
193
|
if (input.materializeConflict === true && state.terminal === null)
|
|
177
194
|
return { kind: "defer" };
|
|
@@ -207,7 +224,7 @@ async function assembleDeliveryAttempt(input, observation, external) {
|
|
|
207
224
|
if (external.witness.head !== state.head)
|
|
208
225
|
return { kind: "stale" };
|
|
209
226
|
const derivation = input.deriveDocument(state);
|
|
210
|
-
if (derivation.verification.kind === "refused") {
|
|
227
|
+
if (state.terms.gates.includes(VERIFIED) && derivation.verification.kind === "refused") {
|
|
211
228
|
return {
|
|
212
229
|
kind: "assembled",
|
|
213
230
|
state,
|
|
@@ -288,16 +305,10 @@ function currentCandidateDeliveryDecision(input, observation, assembled) {
|
|
|
288
305
|
if (record === undefined || delivery === undefined)
|
|
289
306
|
throw new Error("current delivery is missing its journal fact");
|
|
290
307
|
input.progress?.recordAdmission({ kind: "accepted", facts: [], state, journal: record.entries });
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
journal: record.entries,
|
|
296
|
-
value: {
|
|
297
|
-
...state.delivery.data,
|
|
298
|
-
leading: { kind: "already-admitted", fact: delivery.entry },
|
|
299
|
-
},
|
|
300
|
-
};
|
|
308
|
+
const leading = { kind: "already-admitted", fact: delivery.entry };
|
|
309
|
+
const value = compactDelivery({ ...state.delivery.data, integration: state.currentIntegration ?? state.delivery.data.integration }, leading);
|
|
310
|
+
input.progress?.recordDelivery(input.contractId, value);
|
|
311
|
+
return { kind: "accepted", facts: [], state, journal: record.entries, value: { ...value, leading } };
|
|
301
312
|
}
|
|
302
313
|
async function validateDeliveryTarget(input, observation, assembled) {
|
|
303
314
|
const target = assembled.state?.coordinates.target;
|
|
@@ -327,7 +338,6 @@ async function decideAndAdmitDelivery(input, attempt, seat, observation, assembl
|
|
|
327
338
|
const decision = decideDeliver({
|
|
328
339
|
input: {
|
|
329
340
|
contractId: input.contractId,
|
|
330
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
331
341
|
at: timestamp(),
|
|
332
342
|
preparation,
|
|
333
343
|
},
|
|
@@ -348,19 +358,10 @@ async function decideAndAdmitDelivery(input, attempt, seat, observation, assembl
|
|
|
348
358
|
if (deliverFact?.kind !== "deliver")
|
|
349
359
|
throw new Error("confirmed delivery requires its own receipt");
|
|
350
360
|
const previousContentId = assembled.state?.delivery?.data.integration.changeId;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
leading: {
|
|
356
|
-
kind: "admitted-now",
|
|
357
|
-
fact: deliverFact.entry,
|
|
358
|
-
},
|
|
359
|
-
...(previousContentId === undefined || previousContentId === preparation.data.integration.changeId
|
|
360
|
-
? {}
|
|
361
|
-
: { previousContentId }),
|
|
362
|
-
},
|
|
363
|
-
};
|
|
361
|
+
const leading = { kind: "admitted-now", fact: deliverFact.entry };
|
|
362
|
+
const value = compactDelivery(preparation.data, leading, previousContentId === preparation.data.integration.changeId ? undefined : previousContentId);
|
|
363
|
+
input.progress?.recordDelivery(input.contractId, value);
|
|
364
|
+
return { ...admission, value: { ...value, leading } };
|
|
364
365
|
}
|
|
365
366
|
/**
|
|
366
367
|
* One delivery attempt: the repeatable physical preparation happens outside custody, then a single
|
|
@@ -457,7 +458,6 @@ async function materializeDeliverConflict(input, refusal) {
|
|
|
457
458
|
title: derivation.title,
|
|
458
459
|
document: derivation.bytes,
|
|
459
460
|
at: tender.data.at,
|
|
460
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
461
461
|
...(input.message === undefined ? {} : { message: input.message }),
|
|
462
462
|
});
|
|
463
463
|
handoffHead = await materializeTenderSnapshot(input.scope, tender.data, commit);
|
|
@@ -21,26 +21,26 @@ export declare const deliveryPreviewReportSchema: z.ZodUnion<readonly [z.ZodRead
|
|
|
21
21
|
}, z.core.$strict>>]>>;
|
|
22
22
|
unmetGates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
23
23
|
state: z.ZodLiteral<"missing">;
|
|
24
|
-
gate: z.ZodPipe<z.ZodString, z.ZodTransform<
|
|
24
|
+
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
25
25
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
26
26
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
27
27
|
state: z.ZodLiteral<"unsatisfied">;
|
|
28
28
|
summary: z.ZodExactOptional<z.ZodString>;
|
|
29
|
-
gate: z.ZodPipe<z.ZodString, z.ZodTransform<
|
|
29
|
+
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
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
33
|
previousContentId: z.ZodExactOptional<z.ZodString>;
|
|
34
34
|
currentContentId: z.ZodExactOptional<z.ZodString>;
|
|
35
|
-
gate: z.ZodPipe<z.ZodString, z.ZodTransform<
|
|
35
|
+
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
36
36
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
37
37
|
}, z.core.$strict>>]>>>>;
|
|
38
38
|
unmetPrerequisites: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
39
39
|
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
|
|
40
40
|
state: z.ZodEnum<{
|
|
41
|
-
active: "active";
|
|
42
|
-
abandoned: "abandoned";
|
|
43
41
|
missing: "missing";
|
|
42
|
+
abandoned: "abandoned";
|
|
43
|
+
active: "active";
|
|
44
44
|
}>;
|
|
45
45
|
}, z.core.$strict>>>>>;
|
|
46
46
|
target: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
@@ -68,10 +68,10 @@ export declare const deliveryPreviewReportSchema: z.ZodUnion<readonly [z.ZodRead
|
|
|
68
68
|
kind: z.ZodLiteral<"target-workspace-unavailable">;
|
|
69
69
|
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
|
|
70
70
|
reason: z.ZodEnum<{
|
|
71
|
-
missing: "missing";
|
|
72
|
-
replaced: "replaced";
|
|
73
71
|
unappointed: "unappointed";
|
|
72
|
+
missing: "missing";
|
|
74
73
|
association: "association";
|
|
74
|
+
replaced: "replaced";
|
|
75
75
|
attached: "attached";
|
|
76
76
|
uncommitted: "uncommitted";
|
|
77
77
|
operation: "operation";
|
|
@@ -89,18 +89,18 @@ export declare const deliveryPreviewReportSchema: z.ZodUnion<readonly [z.ZodRead
|
|
|
89
89
|
kind: z.ZodLiteral<"target-workspace-unavailable">;
|
|
90
90
|
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
|
|
91
91
|
reason: z.ZodEnum<{
|
|
92
|
-
missing: "missing";
|
|
93
|
-
replaced: "replaced";
|
|
94
92
|
unappointed: "unappointed";
|
|
93
|
+
missing: "missing";
|
|
95
94
|
association: "association";
|
|
95
|
+
replaced: "replaced";
|
|
96
96
|
attached: "attached";
|
|
97
97
|
uncommitted: "uncommitted";
|
|
98
98
|
operation: "operation";
|
|
99
99
|
}>;
|
|
100
100
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
101
101
|
kind: z.ZodEnum<{
|
|
102
|
-
"worktree-missing": "worktree-missing";
|
|
103
102
|
"target-missing": "target-missing";
|
|
103
|
+
"worktree-missing": "worktree-missing";
|
|
104
104
|
}>;
|
|
105
105
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
106
106
|
kind: z.ZodLiteral<"dirty-workspace">;
|
|
@@ -132,5 +132,7 @@ type PreviewRefusal = Exclude<import("../core/verbs/deliver.js").DeliverRefusal,
|
|
|
132
132
|
kind: "document-moved";
|
|
133
133
|
}> | import("../verification/declaration.js").VerificationDeclarationRefusal;
|
|
134
134
|
/** A native read answer, never an admission or an invitation to run Verification. */
|
|
135
|
-
export declare function previewDeliveryOperation(input: DeliveryPreviewOperationInput): Promise<IntentOutcome<DeliveryPreviewReport, PreviewRefusal
|
|
135
|
+
export declare function previewDeliveryOperation(input: DeliveryPreviewOperationInput): Promise<Exclude<IntentOutcome<DeliveryPreviewReport, PreviewRefusal>, {
|
|
136
|
+
kind: "retry";
|
|
137
|
+
}>>;
|
|
136
138
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { VERIFIED } from "../verification/declaration.js";
|
|
2
3
|
import { changeIdSchema, contractIdSchema, snapshotIdSchema } from "./operations.js";
|
|
3
4
|
import { preparationReasonSchema, checkoutCollisionSchema, targetWorkspaceReasonSchema, compactReason, compactPreparationReason, } from "./result-reasons.js";
|
|
4
5
|
import { previewTargetAnswerSchema, adjudicatePreviewTarget } from "../git/target-placement.js";
|
|
@@ -153,7 +154,7 @@ export async function previewDeliveryOperation(input) {
|
|
|
153
154
|
if (targetRefusal !== undefined)
|
|
154
155
|
return { kind: "refused", refusal: targetRefusal };
|
|
155
156
|
const derivation = input.deriveDocument(state);
|
|
156
|
-
if (derivation.verification.kind === "refused")
|
|
157
|
+
if (state.terms.gates.includes(VERIFIED) && derivation.verification.kind === "refused")
|
|
157
158
|
return { kind: "refused", refusal: derivation.verification.refusal };
|
|
158
159
|
const appointment = await readManagedWorktreeAppointment(input.scope, state.id);
|
|
159
160
|
if (appointment.kind === "failed")
|
|
@@ -168,7 +169,6 @@ export async function previewDeliveryOperation(input) {
|
|
|
168
169
|
}, {
|
|
169
170
|
title: derivation.title,
|
|
170
171
|
document: derivation.bytes,
|
|
171
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
172
172
|
requireBranchesToBeUpToDate: input.requireBranchesToBeUpToDate ?? false,
|
|
173
173
|
includeDirty: input.includeDirty ?? false,
|
|
174
174
|
});
|
|
@@ -23,7 +23,7 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
23
23
|
key: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").DocumentKey, string>>;
|
|
24
24
|
}, z.core.$strict>>;
|
|
25
25
|
segments: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").DocumentSegmentKey, string>>>>;
|
|
26
|
-
gates: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<
|
|
26
|
+
gates: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
27
27
|
requirements: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>>>>>;
|
|
28
28
|
after: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>>>;
|
|
29
29
|
}, z.core.$strict>>;
|
|
@@ -32,7 +32,6 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
32
32
|
contract: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
33
33
|
entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
|
|
34
34
|
at: z.ZodString;
|
|
35
|
-
actor: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ActorId, string>>>;
|
|
36
35
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
37
36
|
kind: z.ZodLiteral<"amend">;
|
|
38
37
|
data: z.ZodReadonly<z.ZodObject<{
|
|
@@ -41,7 +40,7 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
41
40
|
key: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").DocumentKey, string>>;
|
|
42
41
|
}, z.core.$strict>>;
|
|
43
42
|
segments: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").DocumentSegmentKey, string>>>>;
|
|
44
|
-
gates: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<
|
|
43
|
+
gates: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
45
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>>>>>>;
|
|
46
45
|
after: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>>>;
|
|
47
46
|
}, z.core.$strict>>;
|
|
@@ -49,7 +48,6 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
49
48
|
contract: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
50
49
|
entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
|
|
51
50
|
at: z.ZodString;
|
|
52
|
-
actor: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ActorId, string>>>;
|
|
53
51
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
54
52
|
kind: z.ZodLiteral<"deliver">;
|
|
55
53
|
data: z.ZodReadonly<z.ZodObject<{
|
|
@@ -69,7 +67,6 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
69
67
|
contract: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
70
68
|
entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
|
|
71
69
|
at: z.ZodString;
|
|
72
|
-
actor: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ActorId, string>>>;
|
|
73
70
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
74
71
|
kind: z.ZodLiteral<"reintegrated">;
|
|
75
72
|
data: z.ZodReadonly<z.ZodObject<{
|
|
@@ -80,11 +77,10 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
80
77
|
contract: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
81
78
|
entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
|
|
82
79
|
at: z.ZodString;
|
|
83
|
-
actor: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ActorId, string>>>;
|
|
84
80
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
85
81
|
kind: z.ZodLiteral<"attestation">;
|
|
86
82
|
data: z.ZodReadonly<z.ZodObject<{
|
|
87
|
-
gate: z.ZodPipe<z.ZodString, z.ZodTransform<
|
|
83
|
+
gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
88
84
|
requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
|
|
89
85
|
subject: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").DependencyKeySet, string>>;
|
|
90
86
|
verdict: z.ZodEnum<{
|
|
@@ -97,7 +93,6 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
97
93
|
contract: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
98
94
|
entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
|
|
99
95
|
at: z.ZodString;
|
|
100
|
-
actor: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ActorId, string>>>;
|
|
101
96
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
102
97
|
kind: z.ZodLiteral<"claimed">;
|
|
103
98
|
data: z.ZodReadonly<z.ZodObject<{
|
|
@@ -107,7 +102,6 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
107
102
|
contract: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
108
103
|
entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
|
|
109
104
|
at: z.ZodString;
|
|
110
|
-
actor: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ActorId, string>>>;
|
|
111
105
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
112
106
|
kind: z.ZodLiteral<"arc">;
|
|
113
107
|
data: z.ZodReadonly<z.ZodObject<{
|
|
@@ -119,7 +113,6 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
119
113
|
contract: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
120
114
|
entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
|
|
121
115
|
at: z.ZodString;
|
|
122
|
-
actor: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ActorId, string>>>;
|
|
123
116
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
124
117
|
kind: z.ZodLiteral<"abandoned">;
|
|
125
118
|
data: z.ZodReadonly<z.ZodObject<{
|
|
@@ -129,7 +122,6 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
129
122
|
contract: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
130
123
|
entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
|
|
131
124
|
at: z.ZodString;
|
|
132
|
-
actor: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ActorId, string>>>;
|
|
133
125
|
}, z.core.$strict>>]>;
|
|
134
126
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
135
127
|
kind: z.ZodLiteral<"verification">;
|
|
@@ -143,8 +135,8 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
143
135
|
outcome: z.ZodExactOptional<z.ZodString>;
|
|
144
136
|
elapsedMs: z.ZodExactOptional<z.ZodNumber>;
|
|
145
137
|
phase: z.ZodEnum<{
|
|
146
|
-
cleanup: "cleanup";
|
|
147
138
|
materialize: "materialize";
|
|
139
|
+
cleanup: "cleanup";
|
|
148
140
|
setup: "setup";
|
|
149
141
|
declaration: "declaration";
|
|
150
142
|
}>;
|
|
@@ -163,8 +155,8 @@ export declare const executionObservationSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
163
155
|
}>;
|
|
164
156
|
text: z.ZodString;
|
|
165
157
|
phase: z.ZodEnum<{
|
|
166
|
-
cleanup: "cleanup";
|
|
167
158
|
materialize: "materialize";
|
|
159
|
+
cleanup: "cleanup";
|
|
168
160
|
setup: "setup";
|
|
169
161
|
declaration: "declaration";
|
|
170
162
|
}>;
|
|
@@ -6,7 +6,7 @@ import type { GitRepository } from "../git/process.js";
|
|
|
6
6
|
import { type WorktreeLeak } from "../git/scratch.js";
|
|
7
7
|
import type { DecideInput, OfferDecision } from "../core/decide.js";
|
|
8
8
|
import { type ActiveContractRefusal } from "../core/facts/observation.js";
|
|
9
|
-
import type {
|
|
9
|
+
import type { ContractId, Gate, RequirementId, SnapshotId } from "../core/facts/types.js";
|
|
10
10
|
import { type VerificationDeclaration } from "../verification/declaration.js";
|
|
11
11
|
import { type CompanionDecorator, type ProtocolPreparation, type ProtocolResult } from "./run.js";
|
|
12
12
|
type CommonIntentAdmissionOptions<Refusal> = Readonly<{
|
|
@@ -38,7 +38,7 @@ type VerifyRequirementInput = Readonly<{
|
|
|
38
38
|
channel: GitDecodeChannel;
|
|
39
39
|
repository: GitRepository;
|
|
40
40
|
contractId: ContractId;
|
|
41
|
-
|
|
41
|
+
gates: readonly Gate[];
|
|
42
42
|
at: string;
|
|
43
43
|
snapshot: SnapshotId;
|
|
44
44
|
requirement: RequirementId;
|
|
@@ -56,8 +56,8 @@ export declare const verificationRuntimeStopSchema: z.ZodUnion<readonly [z.ZodRe
|
|
|
56
56
|
diagnostic: z.ZodExactOptional<z.ZodString>;
|
|
57
57
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
58
58
|
failure: z.ZodEnum<{
|
|
59
|
-
"spawn-error": "spawn-error";
|
|
60
59
|
"candidate-unavailable": "candidate-unavailable";
|
|
60
|
+
"spawn-error": "spawn-error";
|
|
61
61
|
}>;
|
|
62
62
|
diagnostic: z.ZodString;
|
|
63
63
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
@@ -69,15 +69,12 @@ export declare const verificationRuntimeStopSchema: z.ZodUnion<readonly [z.ZodRe
|
|
|
69
69
|
diagnostic: z.ZodString;
|
|
70
70
|
}, z.core.$strict>>]>;
|
|
71
71
|
type VerificationRuntimeStop = z.infer<typeof verificationRuntimeStopSchema>;
|
|
72
|
-
type VerificationReuseRefusal = Readonly<{
|
|
73
|
-
kind: "verification-reuse";
|
|
74
|
-
}>;
|
|
75
72
|
type VerificationReuseStep = Readonly<{
|
|
76
73
|
kind: "reused";
|
|
77
74
|
}>;
|
|
78
|
-
export type VerificationStep = ProtocolResult<ActiveContractRefusal
|
|
75
|
+
export type VerificationStep = ProtocolResult<ActiveContractRefusal> | VerificationRuntimeStop | VerificationReuseStep;
|
|
79
76
|
export type VerificationResult = Readonly<{
|
|
80
|
-
step
|
|
77
|
+
step?: VerificationStep;
|
|
81
78
|
reuse?: true;
|
|
82
79
|
counts?: Readonly<{
|
|
83
80
|
verdict: "satisfied" | "unsatisfied";
|
|
@@ -86,6 +83,6 @@ export type VerificationResult = Readonly<{
|
|
|
86
83
|
cleanup?: VerificationCleanupFailure;
|
|
87
84
|
leak?: WorktreeLeak;
|
|
88
85
|
}>;
|
|
89
|
-
/** Execute and
|
|
86
|
+
/** Execute one declaration and record testimony only when its gate is selected. */
|
|
90
87
|
export declare function verifyRequirement(input: VerifyRequirementInput): Promise<VerificationResult>;
|
|
91
88
|
export {};
|
|
@@ -75,7 +75,6 @@ export const verificationRuntimeStopSchema = z.union([
|
|
|
75
75
|
function verificationInput(outcome, input, subject) {
|
|
76
76
|
return {
|
|
77
77
|
contractId: input.contractId,
|
|
78
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
79
78
|
at: input.at,
|
|
80
79
|
preparation: {
|
|
81
80
|
kind: "prepared",
|
|
@@ -89,20 +88,10 @@ function verificationInput(outcome, input, subject) {
|
|
|
89
88
|
},
|
|
90
89
|
};
|
|
91
90
|
}
|
|
92
|
-
function reusableVerificationAttestation(current, subject, verdict, summary) {
|
|
93
|
-
if (current === undefined ||
|
|
94
|
-
current.data.subject !== subject ||
|
|
95
|
-
current.data.verdict !== verdict ||
|
|
96
|
-
current.data.summary !== summary)
|
|
97
|
-
return undefined;
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
function retainVerificationReceipt(input, step) {
|
|
101
|
-
if (!("failure" in step) && step.kind === "accepted")
|
|
102
|
-
input.progress?.recordResidue(input.contractId, step);
|
|
103
|
-
}
|
|
104
91
|
async function verificationStep(input, execution, subject) {
|
|
105
92
|
if (execution.outcome.kind === "terminal") {
|
|
93
|
+
if (!input.gates.includes(VERIFIED))
|
|
94
|
+
return undefined;
|
|
106
95
|
const { verdict, summary } = execution.outcome;
|
|
107
96
|
const admission = await admitIntent(input.channel, input.repository, verificationInput(execution.outcome, input, subject), decideAttestation, {
|
|
108
97
|
...(input.progress === undefined ? {} : { progress: input.progress }),
|
|
@@ -115,13 +104,15 @@ async function verificationStep(input, execution, subject) {
|
|
|
115
104
|
.find((attestation) => attestation.data.gate === VERIFIED &&
|
|
116
105
|
attestation.data.requirement === input.requirement &&
|
|
117
106
|
attestation.data.subject === subject);
|
|
118
|
-
|
|
119
|
-
|
|
107
|
+
if (current?.data.verdict === verdict && current.data.summary === summary)
|
|
108
|
+
return { kind: "verification-reuse" };
|
|
109
|
+
return undefined;
|
|
120
110
|
},
|
|
121
111
|
});
|
|
122
|
-
if (admission.kind === "refused"
|
|
123
|
-
return
|
|
124
|
-
|
|
112
|
+
if (admission.kind === "refused")
|
|
113
|
+
return admission.refusal.kind === "verification-reuse"
|
|
114
|
+
? { kind: "reused" }
|
|
115
|
+
: { kind: "refused", refusal: admission.refusal };
|
|
125
116
|
return admission;
|
|
126
117
|
}
|
|
127
118
|
if (execution.outcome.kind === "candidate-unavailable")
|
|
@@ -142,15 +133,7 @@ async function verificationStep(input, execution, subject) {
|
|
|
142
133
|
};
|
|
143
134
|
throw new Error("Verification execution returned an invalid outcome");
|
|
144
135
|
}
|
|
145
|
-
|
|
146
|
-
if (execution.outcome.kind !== "terminal")
|
|
147
|
-
return undefined;
|
|
148
|
-
return {
|
|
149
|
-
verdict: execution.outcome.verdict,
|
|
150
|
-
...(execution.outcome.summary === undefined ? {} : { summary: execution.outcome.summary }),
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
/** Execute and admit one declaration before its caller schedules another check. */
|
|
136
|
+
/** Execute one declaration and record testimony only when its gate is selected. */
|
|
154
137
|
export async function verifyRequirement(input) {
|
|
155
138
|
const snapshot = input.snapshot;
|
|
156
139
|
const subject = dependencyKeySet([{ kind: "snapshot", value: snapshot }]);
|
|
@@ -182,11 +165,15 @@ export async function verifyRequirement(input) {
|
|
|
182
165
|
input.progress?.recordStop(stop);
|
|
183
166
|
step = { failure: "cancelled" };
|
|
184
167
|
}
|
|
185
|
-
const
|
|
186
|
-
|
|
168
|
+
const outcome = execution.outcome;
|
|
169
|
+
const counts = outcome.kind === "terminal"
|
|
170
|
+
? { verdict: outcome.verdict, ...(outcome.summary === undefined ? {} : { summary: outcome.summary }) }
|
|
171
|
+
: undefined;
|
|
172
|
+
if (step !== undefined && !("failure" in step) && step.kind === "accepted")
|
|
173
|
+
input.progress?.recordResidue(input.contractId, step);
|
|
187
174
|
return {
|
|
188
|
-
step,
|
|
189
|
-
...("kind" in step && step.kind === "reused" ? { reuse: true } : {}),
|
|
175
|
+
...(step === undefined ? {} : { step }),
|
|
176
|
+
...(step !== undefined && "kind" in step && step.kind === "reused" ? { reuse: true } : {}),
|
|
190
177
|
...(counts === undefined ? {} : { counts }),
|
|
191
178
|
...(execution.cleanup === undefined ? {} : { cleanup: execution.cleanup }),
|
|
192
179
|
...(execution.leak === undefined ? {} : { leak: execution.leak }),
|