@astrosheep/keiyaku 4.6.31 → 4.6.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -23
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +24 -15
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +12 -8
- 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 +6 -4
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +24 -15
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +12 -8
- 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 +6 -4
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +24 -15
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +12 -8
- 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 +6 -4
- package/build/plugins/pi/README.md +53 -97
- package/build/plugins/pi/keiyaku.ts +10 -6
- package/build/skills/keiyaku-akuma/SKILL.md +24 -15
- package/build/skills/keiyaku-babysit/SKILL.md +12 -8
- 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 +6 -4
- 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 +50 -303
- package/build/src/akuma/akuma-instance.js +48 -49
- package/build/src/akuma/akuma-observe.d.ts +5 -4
- package/build/src/akuma/akuma-observe.js +74 -21
- 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 +97 -19
- package/build/src/akuma/akuma-selection-execution.js +79 -133
- package/build/src/akuma/akuma-wait.d.ts +43 -4
- package/build/src/akuma/akuma-wait.js +58 -29
- package/build/src/akuma/akuma.d.ts +58 -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 +44 -44
- package/build/src/akuma/call-initial-tell.d.ts +4 -2
- package/build/src/akuma/call-initial-tell.js +9 -2
- 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/activity-schema.d.ts +16 -0
- package/build/src/akuma/heart/activity-schema.js +7 -0
- package/build/src/akuma/heart/facts.d.ts +5 -4
- package/build/src/akuma/heart/facts.js +5 -5
- package/build/src/akuma/heart/index.d.ts +1 -1
- package/build/src/akuma/heart/index.js +9 -1
- package/build/src/akuma/heart/soul.js +20 -4
- package/build/src/akuma/heart/timeline.js +4 -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-read.d.ts +4 -2
- package/build/src/akuma/projection-read.js +21 -14
- package/build/src/akuma/projection.d.ts +97 -2
- package/build/src/akuma/projection.js +47 -47
- package/build/src/akuma/provider-recipe.js +3 -2
- package/build/src/akuma/provider.d.ts +2 -2
- package/build/src/akuma/provider.js +27 -20
- package/build/src/akuma/providers/acp/config.js +11 -10
- package/build/src/akuma/providers/acp/core.js +2 -5
- 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/opencode-sdk/events.d.ts +2 -1
- package/build/src/akuma/providers/opencode-sdk/events.js +31 -1
- 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 +19 -16
- 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 +304 -240
- package/build/src/akuma/selection-observation.js +135 -70
- package/build/src/akuma/status-projection.d.ts +61 -284
- package/build/src/akuma/status-projection.js +216 -138
- package/build/src/akuma/turn-drive.js +21 -15
- package/build/src/body/amend.js +7 -18
- package/build/src/body/arc.js +3 -2
- package/build/src/body/criteria.js +4 -3
- package/build/src/body/decode.js +13 -2
- package/build/src/body/envelope.d.ts +5 -1
- package/build/src/body/envelope.js +6 -3
- package/build/src/body/region.d.ts +1 -3
- package/build/src/body/region.js +3 -8
- package/build/src/body/render.js +4 -6
- 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 +107 -66
- package/build/src/cli/commands/akuma-grammar.js +66 -104
- package/build/src/cli/commands/akuma.d.ts +7 -3
- package/build/src/cli/commands/akuma.js +49 -160
- package/build/src/cli/commands/contract-grammar.d.ts +4 -135
- package/build/src/cli/commands/contract-grammar.js +126 -223
- package/build/src/cli/commands/contract-help.d.ts +26 -22
- package/build/src/cli/commands/contract-help.js +52 -38
- package/build/src/cli/commands/contract.d.ts +6 -18
- package/build/src/cli/commands/contract.js +68 -272
- package/build/src/cli/commands/debt-grammar.d.ts +2 -4
- package/build/src/cli/commands/debt-grammar.js +23 -193
- 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 -19
- package/build/src/cli/render/akuma-activity.d.ts +18 -35
- package/build/src/cli/render/akuma-activity.js +141 -290
- package/build/src/cli/render/akuma.d.ts +2 -8
- package/build/src/cli/render/akuma.js +50 -65
- package/build/src/cli/render/catalog.d.ts +2 -5
- package/build/src/cli/render/catalog.js +3 -37
- package/build/src/cli/render/contract-history.js +3 -2
- package/build/src/cli/render/contract-observation.d.ts +2 -8
- package/build/src/cli/render/contract-observation.js +25 -4
- package/build/src/cli/render/contract-wait.d.ts +2 -2
- package/build/src/cli/render/contract-wait.js +13 -17
- package/build/src/cli/render/contract.d.ts +7 -9
- package/build/src/cli/render/contract.js +46 -72
- package/build/src/cli/render/debt.d.ts +3 -11
- package/build/src/cli/render/debt.js +17 -89
- package/build/src/cli/render/delivery-preview.js +4 -4
- package/build/src/cli/render/execution-progress.js +1 -3
- package/build/src/cli/render/kanshi-akuma.d.ts +5 -3
- package/build/src/cli/render/kanshi-akuma.js +23 -20
- package/build/src/cli/render/kanshi.d.ts +1 -3
- package/build/src/cli/render/kanshi.js +27 -56
- package/build/src/cli/render/receipt.d.ts +21 -12
- package/build/src/cli/render/receipt.js +78 -68
- package/build/src/cli/render/reconcile.js +2 -5
- package/build/src/cli/render/refusal.d.ts +4 -3
- package/build/src/cli/render/refusal.js +17 -22
- package/build/src/cli/render/settings.d.ts +1 -1
- package/build/src/cli/render/terminal.d.ts +11 -12
- package/build/src/cli/render/terminal.js +53 -44
- package/build/src/cli/render/verbs.d.ts +4 -1
- package/build/src/cli/render/verbs.js +88 -128
- package/build/src/cli/runtime.js +65 -70
- 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 +16 -25
- package/build/src/core/facts/eligibility.d.ts +4 -4
- package/build/src/core/facts/eligibility.js +11 -0
- package/build/src/core/facts/errors.d.ts +2 -1
- package/build/src/core/facts/errors.js +3 -3
- package/build/src/core/facts/fold.js +9 -5
- package/build/src/core/facts/gate.d.ts +5 -1
- package/build/src/core/facts/gate.js +14 -10
- package/build/src/core/facts/types.d.ts +7 -14
- package/build/src/core/facts/types.js +8 -6
- package/build/src/core/subject.d.ts +4 -1
- package/build/src/core/subject.js +10 -2
- package/build/src/core/verbs/abandon.d.ts +1 -2
- package/build/src/core/verbs/amend.d.ts +16 -6
- package/build/src/core/verbs/amend.js +19 -9
- 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 -220
- package/build/src/debt/index.js +61 -115
- package/build/src/debt/input.d.ts +21 -6
- package/build/src/debt/input.js +56 -180
- 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/dispatch/index.d.ts +0 -17
- package/build/src/dispatch/index.js +1 -10
- 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/identity.js +16 -45
- package/build/src/git/nuke.js +13 -23
- package/build/src/git/observe.d.ts +6 -0
- package/build/src/git/observe.js +40 -24
- package/build/src/git/process.js +11 -18
- package/build/src/git/read-observation.d.ts +5 -4
- package/build/src/git/reconcile.d.ts +3 -16
- package/build/src/git/reconcile.js +0 -18
- package/build/src/git/repository.d.ts +4 -1
- package/build/src/git/repository.js +16 -4
- package/build/src/git/scratch.js +2 -14
- 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/git/terminal-reconcile.js +1 -13
- 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 +36 -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 +21 -7
- package/build/src/kanshi/index.js +29 -4
- package/build/src/kanshi/read.d.ts +101 -269
- package/build/src/kanshi/read.js +41 -200
- package/build/src/kanshi/report.d.ts +443 -1628
- package/build/src/kanshi/report.js +19 -31
- package/build/src/library/address.d.ts +20 -13
- package/build/src/library/address.js +48 -55
- package/build/src/library/akuma-creation.d.ts +249 -79
- package/build/src/library/akuma-creation.js +200 -247
- 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 +151 -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 +35 -37
- package/build/src/library/contract-outcomes.d.ts +1349 -806
- package/build/src/library/contract-outcomes.js +12 -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 +60 -67
- package/build/src/library/contract-types.js +17 -56
- package/build/src/library/contract-wait.d.ts +47 -3
- package/build/src/library/contract-wait.js +81 -70
- package/build/src/library/delivery.d.ts +391 -389
- package/build/src/library/delivery.js +5 -25
- package/build/src/library/input.d.ts +13 -5
- package/build/src/library/input.js +43 -38
- 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 +484 -25
- 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 +43 -62
- 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 +9 -159
- package/build/src/library/keiyaku-identity.d.ts +3 -3
- package/build/src/library/keiyaku-identity.js +16 -10
- package/build/src/library/keiyaku-verbs.d.ts +4102 -4889
- package/build/src/library/keiyaku-verbs.js +317 -291
- package/build/src/library/keiyaku-wait.d.ts +183 -0
- package/build/src/library/keiyaku-wait.js +213 -0
- package/build/src/library/keiyaku.d.ts +32 -860
- package/build/src/library/keiyaku.js +203 -314
- package/build/src/library/model-tools.d.ts +556 -0
- package/build/src/library/model-tools.js +347 -0
- 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 +166 -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 +45 -29
- package/build/src/library/refusal.js +5 -16
- package/build/src/library/repo.js +4 -3
- package/build/src/library/selection.d.ts +44 -21
- package/build/src/library/selection.js +63 -88
- package/build/src/mcp/adapter.js +37 -51
- package/build/src/mcp/description.d.ts +2 -0
- package/build/src/mcp/description.js +2 -0
- package/build/src/mcp/help.d.ts +1 -1
- package/build/src/mcp/help.js +16 -9
- package/build/src/pi/index.d.ts +3 -0
- package/build/src/pi/index.js +83 -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 +15 -4
- package/build/src/protocol/amend.js +114 -47
- package/build/src/protocol/bind.d.ts +5 -7
- package/build/src/protocol/bind.js +8 -19
- package/build/src/protocol/completion.d.ts +188 -195
- package/build/src/protocol/completion.js +63 -24
- package/build/src/protocol/deliver.d.ts +11 -6
- package/build/src/protocol/deliver.js +37 -50
- package/build/src/protocol/delivery-preview.d.ts +18 -11
- package/build/src/protocol/delivery-preview.js +2 -2
- package/build/src/protocol/execution-observation.d.ts +13 -13
- package/build/src/protocol/intent.d.ts +7 -9
- package/build/src/protocol/intent.js +22 -32
- package/build/src/protocol/operations.d.ts +102 -69
- package/build/src/protocol/operations.js +33 -56
- package/build/src/protocol/outcome.d.ts +3 -1
- package/build/src/protocol/placement.d.ts +1 -2
- package/build/src/protocol/placement.js +7 -1
- package/build/src/protocol/progress.d.ts +1 -0
- package/build/src/protocol/progress.js +0 -6
- package/build/src/protocol/read/status.d.ts +69 -112
- package/build/src/protocol/read/status.js +59 -88
- package/build/src/protocol/reintegrate.d.ts +1 -2
- package/build/src/protocol/reintegrate.js +2 -3
- package/build/src/protocol/result-leaves.d.ts +67 -40
- package/build/src/protocol/result-leaves.js +28 -58
- package/build/src/protocol/result-reasons.d.ts +6 -6
- package/build/src/protocol/review.js +0 -1
- package/build/src/protocol/run.js +1 -4
- package/build/src/protocol/verify.d.ts +202 -146
- package/build/src/protocol/verify.js +61 -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 +19 -72
- 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 +7 -3
- 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 +53 -97
- package/plugins/pi/keiyaku.ts +10 -6
- package/skills/keiyaku-akuma/SKILL.md +24 -15
- package/skills/keiyaku-babysit/SKILL.md +12 -8
- package/skills/keiyaku-bind/SKILL.md +4 -3
- package/skills/keiyaku-debt/SKILL.md +17 -17
- package/skills/keiyaku-workflow/SKILL.md +6 -4
- package/build/plugins/pi/akuma-tools.ts +0 -290
- 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/body/keys.d.ts +0 -4
- package/build/src/body/keys.js +0 -11
- 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/kanshi/roster.d.ts +0 -2
- package/build/src/kanshi/roster.js +0 -2
- 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
- package/plugins/pi/akuma-tools.ts +0 -290
|
@@ -7,14 +7,14 @@ import { prepareDelivery, deliveryIntegrationSnapshots } from "./deliver.js";
|
|
|
7
7
|
import { verifyRequirement } from "./intent.js";
|
|
8
8
|
import { timestamp, unpackVerificationOutcome } from "./operations.js";
|
|
9
9
|
import { executionStop } from "./progress.js";
|
|
10
|
-
import {
|
|
10
|
+
import { placementSchema, normalPlacementSchema } from "./completion.js";
|
|
11
11
|
import { activeReasonSchema, retrySchema, compactRetry, compactReason } from "./result-reasons.js";
|
|
12
12
|
const checkCoordinate = {
|
|
13
13
|
index: z.number().int().positive(),
|
|
14
14
|
requirement: z.string().min(1),
|
|
15
15
|
retainedPath: z.string().exactOptional(),
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
const runtimeStopSchema = z.union([
|
|
18
18
|
z
|
|
19
19
|
.strictObject({ kind: z.enum(["unknown-exit", "cancelled"]), diagnostic: z.string().min(1).exactOptional() })
|
|
20
20
|
.readonly(),
|
|
@@ -32,36 +32,58 @@ export const runtimeStopSchema = z.union([
|
|
|
32
32
|
})
|
|
33
33
|
.readonly(),
|
|
34
34
|
]);
|
|
35
|
-
|
|
35
|
+
const checkAdmissionStopSchema = z
|
|
36
|
+
.union([
|
|
36
37
|
z.strictObject({ kind: z.literal("refused"), reason: activeReasonSchema }).readonly(),
|
|
37
38
|
...retrySchema.options,
|
|
38
39
|
z.strictObject({ kind: z.literal("cancelled") }).readonly(),
|
|
40
|
+
])
|
|
41
|
+
.meta({ id: "verificationAdmissionStop" });
|
|
42
|
+
const normalAdmissionSchema = z.enum(["admitted", "reused", "unrecorded"]);
|
|
43
|
+
export function verificationAdmissionOutcome(admission) {
|
|
44
|
+
switch (admission) {
|
|
45
|
+
case "admitted":
|
|
46
|
+
case "reused":
|
|
47
|
+
case "unrecorded":
|
|
48
|
+
return "benign";
|
|
49
|
+
default:
|
|
50
|
+
switch (admission.kind) {
|
|
51
|
+
case "retry":
|
|
52
|
+
return "retry";
|
|
53
|
+
case "refused":
|
|
54
|
+
case "cancelled":
|
|
55
|
+
return "failed";
|
|
56
|
+
default: {
|
|
57
|
+
const exhaustive = admission;
|
|
58
|
+
return exhaustive;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function terminalCheckSchemas(admission) {
|
|
64
|
+
const terminal = { ...checkCoordinate, kind: z.literal("terminal"), admission };
|
|
65
|
+
return [
|
|
66
|
+
z.strictObject({ ...terminal, verdict: z.literal("satisfied") }).readonly(),
|
|
67
|
+
z.strictObject({ ...terminal, verdict: z.literal("unsatisfied"), summary: z.string() }).readonly(),
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
const normalVerificationCheckSchema = z.union(terminalCheckSchemas(normalAdmissionSchema));
|
|
71
|
+
const verificationCheckSchema = z.union([
|
|
72
|
+
...terminalCheckSchemas(z.union([normalAdmissionSchema, checkAdmissionStopSchema])),
|
|
73
|
+
z.strictObject({ ...checkCoordinate, kind: z.literal("stopped"), stop: runtimeStopSchema }).readonly(),
|
|
39
74
|
]);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export const verificationCheckSchema = z.union([
|
|
43
|
-
z
|
|
44
|
-
.strictObject({ ...checkCoordinate, kind: z.literal("terminal"), verdict: z.literal("satisfied"), admission })
|
|
45
|
-
.readonly(),
|
|
46
|
-
z
|
|
75
|
+
function verifyValue(check, placement) {
|
|
76
|
+
return z
|
|
47
77
|
.strictObject({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
summary: z.string(),
|
|
52
|
-
admission,
|
|
78
|
+
snapshot: snapshotIdSchema,
|
|
79
|
+
checks: z.array(check).readonly(),
|
|
80
|
+
placement: placement.exactOptional(),
|
|
53
81
|
})
|
|
54
|
-
.readonly()
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
export const verifyValueSchema =
|
|
58
|
-
|
|
59
|
-
snapshot: snapshotIdSchema,
|
|
60
|
-
checks: z.array(verificationCheckSchema).readonly(),
|
|
61
|
-
placement: placementSchema.exactOptional(),
|
|
62
|
-
})
|
|
63
|
-
.readonly();
|
|
64
|
-
export function compactVerificationStop(stop) {
|
|
82
|
+
.readonly();
|
|
83
|
+
}
|
|
84
|
+
export const verifyNormalValueSchema = verifyValue(normalVerificationCheckSchema, normalPlacementSchema);
|
|
85
|
+
export const verifyValueSchema = verifyValue(verificationCheckSchema, placementSchema);
|
|
86
|
+
function compactVerificationStop(stop) {
|
|
65
87
|
if ("refusal" in stop)
|
|
66
88
|
return { kind: "refused", reason: compactReason(stop.refusal) };
|
|
67
89
|
if ("retry" in stop)
|
|
@@ -81,14 +103,6 @@ export function compactVerificationStop(stop) {
|
|
|
81
103
|
return { kind: stop.failure, diagnostic: stop.diagnostic };
|
|
82
104
|
}
|
|
83
105
|
}
|
|
84
|
-
export function compactVerify(value) {
|
|
85
|
-
const placement = compactPlacement(value);
|
|
86
|
-
return {
|
|
87
|
-
snapshot: value.snapshot,
|
|
88
|
-
checks: value.checks,
|
|
89
|
-
...(placement === undefined ? {} : { placement }),
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
106
|
async function prepareVerification(input) {
|
|
93
107
|
input.signal?.throwIfAborted();
|
|
94
108
|
const observed = await observeGitForAdmissionAt(input.scope, input.channel, [input.contractId]);
|
|
@@ -102,8 +116,6 @@ async function prepareVerification(input) {
|
|
|
102
116
|
if (derivation.verification.kind === "refused")
|
|
103
117
|
return { kind: "refused", refusal: derivation.verification.refusal };
|
|
104
118
|
const definition = derivation.verification.data;
|
|
105
|
-
if (definition === null)
|
|
106
|
-
return { kind: "refused", refusal: { kind: "verification-not-selected" } };
|
|
107
119
|
if (input.index !== undefined && input.index > definition.declarations.length)
|
|
108
120
|
return {
|
|
109
121
|
kind: "refused",
|
|
@@ -124,7 +136,6 @@ async function prepareVerification(input) {
|
|
|
124
136
|
document: derivation.bytes,
|
|
125
137
|
includeDirty: input.includeDirty,
|
|
126
138
|
requireBranchesToBeUpToDate: input.requireBranchesToBeUpToDate,
|
|
127
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
128
139
|
});
|
|
129
140
|
if (prepared.kind === "refused")
|
|
130
141
|
return prepared;
|
|
@@ -139,15 +150,13 @@ function checkReport(coordinate, checked) {
|
|
|
139
150
|
const stop = compactVerificationStop(checked.stop);
|
|
140
151
|
if (stop.kind === "refused" || stop.kind === "retry")
|
|
141
152
|
throw new Error("nonterminal check requires a runtime stop");
|
|
142
|
-
return { ...fields,
|
|
153
|
+
return { ...fields, kind: "stopped", stop };
|
|
143
154
|
}
|
|
144
|
-
// A terminal verdict only proves admission when custody holds the matching attestation, reuse, or stop.
|
|
145
|
-
const attested = checked.admission?.facts.some((fact) => fact.kind === "attestation" && fact.data.gate === VERIFIED && fact.data.requirement === requirement);
|
|
146
155
|
let admission;
|
|
147
156
|
if (checked.reuse !== undefined)
|
|
148
157
|
admission = "reused";
|
|
149
|
-
else if (
|
|
150
|
-
admission =
|
|
158
|
+
else if (checked.admission !== undefined)
|
|
159
|
+
admission = "admitted";
|
|
151
160
|
else if (checked.stop !== undefined) {
|
|
152
161
|
const stop = compactVerificationStop(checked.stop);
|
|
153
162
|
if (stop.kind === "refused" || stop.kind === "retry")
|
|
@@ -158,15 +167,15 @@ function checkReport(coordinate, checked) {
|
|
|
158
167
|
throw new Error("terminal check admission can only refuse, retry or cancel");
|
|
159
168
|
}
|
|
160
169
|
else
|
|
161
|
-
|
|
162
|
-
const terminal = { ...fields, kind: "terminal",
|
|
170
|
+
admission = "unrecorded";
|
|
171
|
+
const terminal = { ...fields, kind: "terminal", admission };
|
|
163
172
|
if (checked.counts.verdict === "satisfied")
|
|
164
173
|
return { ...terminal, verdict: "satisfied" };
|
|
165
174
|
if (checked.counts.summary === undefined)
|
|
166
175
|
throw new Error("unsatisfied terminal check requires its diagnosis");
|
|
167
176
|
return { ...terminal, verdict: "unsatisfied", summary: checked.counts.summary };
|
|
168
177
|
}
|
|
169
|
-
/** Capture a prospective delivery
|
|
178
|
+
/** Capture a prospective delivery, then independently execute each selected declaration. */
|
|
170
179
|
export async function verifyOperation(input) {
|
|
171
180
|
const prepared = await prepareVerification(input);
|
|
172
181
|
if (prepared.kind === "refused")
|
|
@@ -190,13 +199,14 @@ export async function verifyOperation(input) {
|
|
|
190
199
|
channel: input.channel,
|
|
191
200
|
repository: input.scope,
|
|
192
201
|
contractId: state.id,
|
|
202
|
+
gates: state.terms.gates,
|
|
203
|
+
...(state.targetRevision === undefined ? {} : { targetRevision: state.targetRevision }),
|
|
193
204
|
at: timestamp(),
|
|
194
205
|
snapshot,
|
|
195
206
|
declaration,
|
|
196
207
|
requirement,
|
|
197
208
|
index,
|
|
198
209
|
total: definition.declarations.length,
|
|
199
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
200
210
|
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
201
211
|
...(input.progress === undefined ? {} : { progress: input.progress }),
|
|
202
212
|
});
|
|
@@ -214,5 +224,9 @@ export async function verifyOperation(input) {
|
|
|
214
224
|
if (checked.stop !== undefined)
|
|
215
225
|
break;
|
|
216
226
|
}
|
|
217
|
-
return {
|
|
227
|
+
return {
|
|
228
|
+
kind: "accepted",
|
|
229
|
+
...(state.terms.gates.includes(VERIFIED) ? { checkpoint } : {}),
|
|
230
|
+
value: { snapshot, checks },
|
|
231
|
+
};
|
|
218
232
|
}
|
|
Binary file
|
package/build/src/settings.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
+
import { KeiyakuError } from "./errors.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
export type SettingsScope = "project" | "user";
|
|
3
4
|
export type SettingsScopeState = z.output<typeof settingsScopeStateSchema>;
|
|
4
5
|
export type SettingsEntry = z.output<typeof settingsEntrySchema>;
|
|
5
6
|
export type SettingsNamespaceFailure = z.output<typeof settingsNamespaceFailureSchema>;
|
|
6
7
|
export type SettingsNamespaceView = z.output<typeof settingsNamespaceViewSchema>;
|
|
7
|
-
export type Settings = Readonly<{
|
|
8
|
-
scopes: Readonly<{
|
|
9
|
-
project: SettingsScopeState;
|
|
10
|
-
user: SettingsScopeState;
|
|
11
|
-
}>;
|
|
12
|
-
namespaces?: Readonly<Record<string, SettingsNamespaceView>>;
|
|
8
|
+
export type Settings = z.output<typeof settingsSchema> & Readonly<{
|
|
13
9
|
namespace(name: string): SettingsNamespaceView;
|
|
14
10
|
}>;
|
|
15
11
|
export declare const settingsScopeStateSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
@@ -132,14 +128,17 @@ export declare const settingsSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
132
128
|
}>>>>>;
|
|
133
129
|
}, z.core.$strict>>;
|
|
134
130
|
export type SettingsInput = Readonly<{
|
|
135
|
-
|
|
131
|
+
cwd?: string;
|
|
136
132
|
home?: string;
|
|
137
133
|
}>;
|
|
138
|
-
export declare class SettingsError extends
|
|
134
|
+
export declare class SettingsError extends KeiyakuError {
|
|
139
135
|
readonly kind = "settings";
|
|
140
136
|
constructor(message: string);
|
|
141
137
|
}
|
|
142
|
-
|
|
138
|
+
declare function loadSettings(input?: SettingsInput): Promise<Settings>;
|
|
139
|
+
export declare const Settings: Readonly<{
|
|
140
|
+
load: typeof loadSettings;
|
|
141
|
+
}>;
|
|
143
142
|
/** Read only the project scope owned by a materialized candidate snapshot. */
|
|
144
143
|
export declare function projectSettings(root: string): Promise<Settings>;
|
|
145
144
|
export {};
|
package/build/src/settings.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KeiyakuError } from "./errors.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { readFile, realpath } from "node:fs/promises";
|
|
3
4
|
import { homedir } from "node:os";
|
|
@@ -60,11 +61,10 @@ export const settingsSchema = z
|
|
|
60
61
|
namespaces: keyedValues(settingsNamespaceViewSchema).exactOptional(),
|
|
61
62
|
})
|
|
62
63
|
.readonly();
|
|
63
|
-
export class SettingsError extends
|
|
64
|
+
export class SettingsError extends KeiyakuError {
|
|
64
65
|
kind = "settings";
|
|
65
66
|
constructor(message) {
|
|
66
|
-
super(message);
|
|
67
|
-
this.name = "SettingsError";
|
|
67
|
+
super("invalid-input", message);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
function object(value) {
|
|
@@ -155,7 +155,7 @@ function settingsFromScopes(project, user) {
|
|
|
155
155
|
}
|
|
156
156
|
function namespace(name) {
|
|
157
157
|
if (typeof name !== "string" || name.trim().length === 0)
|
|
158
|
-
throw new
|
|
158
|
+
throw new KeiyakuError("invalid-input", "settings namespace must be nonblank");
|
|
159
159
|
return resolveNamespace(name);
|
|
160
160
|
}
|
|
161
161
|
const names = [...new Set([user, project].flatMap((scope) => Object.keys(scope.root ?? {})))].sort();
|
|
@@ -176,16 +176,18 @@ async function canonicalCoordinate(path) {
|
|
|
176
176
|
return resolvedPath;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
async function loadSettings(input = {}) {
|
|
180
180
|
if (!object(input))
|
|
181
|
-
throw new
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
throw new KeiyakuError("invalid-input", "settings input must be an object");
|
|
182
|
+
for (const key of Object.keys(input))
|
|
183
|
+
if (key !== "cwd" && key !== "home")
|
|
184
|
+
throw new KeiyakuError("invalid-input", `settings input has unknown field: ${key}`);
|
|
185
|
+
for (const field of ["cwd", "home"]) {
|
|
186
|
+
const value = input[field];
|
|
187
|
+
if (value !== undefined && (typeof value !== "string" || value.trim().length === 0))
|
|
188
|
+
throw new KeiyakuError("invalid-input", `settings ${field} must be a nonblank string`);
|
|
184
189
|
}
|
|
185
|
-
|
|
186
|
-
throw new TypeError("settings home must be a nonblank string");
|
|
187
|
-
}
|
|
188
|
-
const projectDirectory = input.root === undefined ? undefined : await canonicalCoordinate(join(input.root, ".keiyaku"));
|
|
190
|
+
const projectDirectory = input.cwd === undefined ? undefined : await canonicalCoordinate(join(input.cwd, ".keiyaku"));
|
|
189
191
|
const userDirectory = await canonicalCoordinate(input.home ?? join(homedir(), ".keiyaku"));
|
|
190
192
|
const project = projectDirectory === undefined || projectDirectory === userDirectory
|
|
191
193
|
? { state: { kind: "absent" } }
|
|
@@ -193,10 +195,11 @@ export async function settings(input = {}) {
|
|
|
193
195
|
const user = await readScope(join(userDirectory, "settings.json"));
|
|
194
196
|
return settingsFromScopes(project, user);
|
|
195
197
|
}
|
|
198
|
+
export const Settings = Object.freeze({ load: loadSettings });
|
|
196
199
|
/** Read only the project scope owned by a materialized candidate snapshot. */
|
|
197
200
|
export async function projectSettings(root) {
|
|
198
201
|
if (typeof root !== "string" || root.trim().length === 0)
|
|
199
|
-
throw new
|
|
202
|
+
throw new KeiyakuError("invalid-input", "settings root must be a nonblank string");
|
|
200
203
|
return settingsFromScopes(await readScope(join(resolve(root), ".keiyaku", "settings.json")), {
|
|
201
204
|
state: { kind: "absent" },
|
|
202
205
|
});
|
|
@@ -4,7 +4,7 @@ import { contractId } from "../core/facts/types.js";
|
|
|
4
4
|
import { GIT_REF, updateGitTree, updateRefsAtomically, writeBlob, writeStateCommit } from "../git/repository.js";
|
|
5
5
|
import { confirmPrivateStatePublication } from "../git/private-state-seat.js";
|
|
6
6
|
import { withGitTargetedReadObservation, } from "../git/read-observation.js";
|
|
7
|
-
import {
|
|
7
|
+
import { canonicalDebtId } from "../debt/identity.js";
|
|
8
8
|
import { acquireDebtSettlementFence } from "./fence.js";
|
|
9
9
|
// The private persisted spelling predates the product rename. Keep its bytes
|
|
10
10
|
// and path stable so an existing held association still settles after upgrade.
|
|
@@ -58,7 +58,7 @@ function decodeHolder(path, bytes) {
|
|
|
58
58
|
let owner;
|
|
59
59
|
try {
|
|
60
60
|
debtId = `debt/${record.taskId.slice("task/".length)}`;
|
|
61
|
-
|
|
61
|
+
canonicalDebtId(debtId);
|
|
62
62
|
owner = contractId(record.contractId);
|
|
63
63
|
}
|
|
64
64
|
catch (error) {
|
|
@@ -54,11 +54,5 @@ export type SettlementInput = Readonly<{
|
|
|
54
54
|
effects: readonly Effect[];
|
|
55
55
|
progress?: SettlementProgress;
|
|
56
56
|
}>;
|
|
57
|
-
export type SettlementBatchInput = Readonly<{
|
|
58
|
-
repository: GitRepository;
|
|
59
|
-
channel: GitDecodeChannel;
|
|
60
|
-
contracts: readonly Readonly<Pick<SettlementInput, "state" | "effects">>[];
|
|
61
|
-
}>;
|
|
62
57
|
export declare function settle(input: SettlementInput): Promise<SettlementReport>;
|
|
63
|
-
export declare function settleAll(input: SettlementBatchInput): Promise<readonly SettlementReport[]>;
|
|
64
58
|
export {};
|
|
@@ -58,6 +58,15 @@ function recordAction(input, action) {
|
|
|
58
58
|
input.actions.push(action);
|
|
59
59
|
input.progress?.recordSettlement(input.candidate.id, { actions: [action], lags: [] });
|
|
60
60
|
}
|
|
61
|
+
function settleFailure(candidate, surface, diagnostic, debtId) {
|
|
62
|
+
return {
|
|
63
|
+
kind: "settlement-failed",
|
|
64
|
+
surface,
|
|
65
|
+
contractId: candidate.id,
|
|
66
|
+
...(debtId === undefined ? {} : { debtId }),
|
|
67
|
+
diagnostic,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
61
70
|
async function observeApplicableHolder(input) {
|
|
62
71
|
const { repository, channel, candidate } = input;
|
|
63
72
|
let observation;
|
|
@@ -72,12 +81,7 @@ async function observeApplicableHolder(input) {
|
|
|
72
81
|
catch (error) {
|
|
73
82
|
if (!operational(error))
|
|
74
83
|
throw error;
|
|
75
|
-
recordLag(input,
|
|
76
|
-
kind: "settlement-failed",
|
|
77
|
-
surface: "debt-holder",
|
|
78
|
-
contractId: candidate.id,
|
|
79
|
-
diagnostic: diagnostic(error),
|
|
80
|
-
});
|
|
84
|
+
recordLag(input, settleFailure(candidate, "debt-holder", diagnostic(error)));
|
|
81
85
|
return null;
|
|
82
86
|
}
|
|
83
87
|
}
|
|
@@ -90,13 +94,7 @@ async function completeHeldDebt(input) {
|
|
|
90
94
|
catch (error) {
|
|
91
95
|
if (!operational(error))
|
|
92
96
|
throw error;
|
|
93
|
-
recordLag(input,
|
|
94
|
-
kind: "settlement-failed",
|
|
95
|
-
surface: "debt",
|
|
96
|
-
contractId: candidate.id,
|
|
97
|
-
debtId,
|
|
98
|
-
diagnostic: diagnostic(error),
|
|
99
|
-
});
|
|
97
|
+
recordLag(input, settleFailure(candidate, "debt", diagnostic(error), debtId));
|
|
100
98
|
return false;
|
|
101
99
|
}
|
|
102
100
|
let result;
|
|
@@ -106,35 +104,17 @@ async function completeHeldDebt(input) {
|
|
|
106
104
|
catch (error) {
|
|
107
105
|
if (!operational(error))
|
|
108
106
|
throw error;
|
|
109
|
-
recordLag(input,
|
|
110
|
-
kind: "settlement-failed",
|
|
111
|
-
surface: "debt",
|
|
112
|
-
contractId: candidate.id,
|
|
113
|
-
debtId,
|
|
114
|
-
diagnostic: diagnostic(error),
|
|
115
|
-
});
|
|
107
|
+
recordLag(input, settleFailure(candidate, "debt", diagnostic(error), debtId));
|
|
116
108
|
return false;
|
|
117
109
|
}
|
|
118
110
|
if (result.kind === "changed")
|
|
119
111
|
recordAction(input, { kind: "debt", debtId, action: "done" });
|
|
120
112
|
if (result.kind === "changed" && result.cleanup !== undefined) {
|
|
121
|
-
recordLag(input,
|
|
122
|
-
kind: "settlement-failed",
|
|
123
|
-
surface: "debt",
|
|
124
|
-
contractId: candidate.id,
|
|
125
|
-
debtId,
|
|
126
|
-
diagnostic: result.cleanup,
|
|
127
|
-
});
|
|
113
|
+
recordLag(input, settleFailure(candidate, "debt", result.cleanup, debtId));
|
|
128
114
|
}
|
|
129
115
|
if (result.kind === "changed" || result.kind === "unchanged")
|
|
130
116
|
return true;
|
|
131
|
-
recordLag(input,
|
|
132
|
-
kind: "settlement-failed",
|
|
133
|
-
surface: "debt",
|
|
134
|
-
contractId: candidate.id,
|
|
135
|
-
debtId,
|
|
136
|
-
diagnostic: debtFailure(result),
|
|
137
|
-
});
|
|
117
|
+
recordLag(input, settleFailure(candidate, "debt", debtFailure(result), debtId));
|
|
138
118
|
return false;
|
|
139
119
|
}
|
|
140
120
|
async function releaseHeldDebtHolder(input) {
|
|
@@ -150,13 +130,7 @@ async function releaseHeldDebtHolder(input) {
|
|
|
150
130
|
return "inert";
|
|
151
131
|
const publication = await publishDebtHolderRelease(repository, channel, observation, candidate.id, seat);
|
|
152
132
|
if (publication.kind === "non-published") {
|
|
153
|
-
recordLag(input, {
|
|
154
|
-
kind: "settlement-failed",
|
|
155
|
-
surface: "debt-holder",
|
|
156
|
-
contractId: candidate.id,
|
|
157
|
-
debtId,
|
|
158
|
-
diagnostic: `Debt holder release requires retry: ${publication.diagnostic}`,
|
|
159
|
-
});
|
|
133
|
+
recordLag(input, settleFailure(candidate, "debt-holder", `Debt holder release requires retry: ${publication.diagnostic}`, debtId));
|
|
160
134
|
return "held";
|
|
161
135
|
}
|
|
162
136
|
return publication.kind === "released" ? "released" : "inert";
|
|
@@ -170,13 +144,7 @@ async function releaseHeldDebtHolder(input) {
|
|
|
170
144
|
catch (error) {
|
|
171
145
|
if (!operational(error))
|
|
172
146
|
throw error;
|
|
173
|
-
recordLag(input,
|
|
174
|
-
kind: "settlement-failed",
|
|
175
|
-
surface: "debt-holder",
|
|
176
|
-
contractId: candidate.id,
|
|
177
|
-
debtId,
|
|
178
|
-
diagnostic: diagnostic(error),
|
|
179
|
-
});
|
|
147
|
+
recordLag(input, settleFailure(candidate, "debt-holder", diagnostic(error), debtId));
|
|
180
148
|
return "held";
|
|
181
149
|
}
|
|
182
150
|
}
|
|
@@ -193,13 +161,7 @@ async function settleDebts(input) {
|
|
|
193
161
|
catch (error) {
|
|
194
162
|
if (!operational(error))
|
|
195
163
|
throw error;
|
|
196
|
-
recordLag(input,
|
|
197
|
-
kind: "settlement-failed",
|
|
198
|
-
surface: "debt",
|
|
199
|
-
contractId: candidate.id,
|
|
200
|
-
debtId,
|
|
201
|
-
diagnostic: diagnostic(error),
|
|
202
|
-
});
|
|
164
|
+
recordLag(input, settleFailure(candidate, "debt", diagnostic(error), debtId));
|
|
203
165
|
return true;
|
|
204
166
|
}
|
|
205
167
|
let failure;
|
|
@@ -240,13 +202,7 @@ async function settleDebts(input) {
|
|
|
240
202
|
throw error;
|
|
241
203
|
// Post-release fence teardown is custodial residue, not an owed holder publication.
|
|
242
204
|
if (holderDisposition !== "released") {
|
|
243
|
-
recordLag(input,
|
|
244
|
-
kind: "settlement-failed",
|
|
245
|
-
surface: "debt-holder",
|
|
246
|
-
contractId: candidate.id,
|
|
247
|
-
debtId,
|
|
248
|
-
diagnostic: diagnostic(error),
|
|
249
|
-
});
|
|
205
|
+
recordLag(input, settleFailure(candidate, "debt-holder", diagnostic(error), debtId));
|
|
250
206
|
}
|
|
251
207
|
}
|
|
252
208
|
}
|
|
@@ -278,12 +234,7 @@ async function settleObserved(input) {
|
|
|
278
234
|
catch (error) {
|
|
279
235
|
if (!operational(error))
|
|
280
236
|
throw error;
|
|
281
|
-
recordLag({ candidate, lags, ...(input.progress === undefined ? {} : { progress: input.progress }) },
|
|
282
|
-
kind: "settlement-failed",
|
|
283
|
-
surface: "debt",
|
|
284
|
-
contractId: candidate.id,
|
|
285
|
-
diagnostic: diagnostic(error),
|
|
286
|
-
});
|
|
237
|
+
recordLag({ candidate, lags, ...(input.progress === undefined ? {} : { progress: input.progress }) }, settleFailure(candidate, "debt", diagnostic(error)));
|
|
287
238
|
}
|
|
288
239
|
}
|
|
289
240
|
return settlementReport(actions, lags, seatClose);
|
|
@@ -295,7 +246,3 @@ export async function settle(input) {
|
|
|
295
246
|
const repository = onPrimaryWorktree(input.repository);
|
|
296
247
|
return await settleObserved({ ...input, repository });
|
|
297
248
|
}
|
|
298
|
-
export async function settleAll(input) {
|
|
299
|
-
const repository = onPrimaryWorktree(input.repository);
|
|
300
|
-
return await Promise.all(input.contracts.map((contract) => settleObserved({ repository, channel: input.channel, ...contract })));
|
|
301
|
-
}
|
|
@@ -13,13 +13,10 @@ export type VerificationDefinition = Readonly<{
|
|
|
13
13
|
export type VerificationDeclarationRefusal = Readonly<{
|
|
14
14
|
kind: "verification-declaration-invalid";
|
|
15
15
|
}>;
|
|
16
|
-
export type VerificationDeclarationPreparation = Preparation<VerificationDefinition
|
|
17
|
-
export declare const VERIFIED:
|
|
16
|
+
export type VerificationDeclarationPreparation = Preparation<VerificationDefinition, VerificationDeclarationRefusal>;
|
|
17
|
+
export declare const VERIFIED: string;
|
|
18
18
|
/** The display index and surrounding document never participate in execution identity. */
|
|
19
19
|
export declare function verificationRequirement(declaration: VerificationDeclaration): RequirementId;
|
|
20
20
|
export declare function singletonRequirement(declaredGate: Gate): RequirementId;
|
|
21
21
|
export declare function gateRequirements(gates: readonly Gate[], definition: VerificationDefinition | null): Readonly<Record<string, readonly RequirementId[]>>;
|
|
22
|
-
export declare function prepareVerificationDeclaration(
|
|
23
|
-
gates: readonly Gate[];
|
|
24
|
-
definition: VerificationDefinition | null;
|
|
25
|
-
}>): VerificationDeclarationPreparation;
|
|
22
|
+
export declare function prepareVerificationDeclaration(definition: VerificationDefinition | null): VerificationDeclarationPreparation;
|
|
@@ -17,11 +17,9 @@ export function gateRequirements(gates, definition) {
|
|
|
17
17
|
: [singletonRequirement(declaredGate)],
|
|
18
18
|
]));
|
|
19
19
|
}
|
|
20
|
-
export function prepareVerificationDeclaration(
|
|
21
|
-
if (
|
|
22
|
-
return { kind: "prepared", data:
|
|
23
|
-
if (input.definition !== null && input.definition.declarations.length > 0)
|
|
24
|
-
return { kind: "prepared", data: input.definition };
|
|
20
|
+
export function prepareVerificationDeclaration(definition) {
|
|
21
|
+
if (definition !== null && definition.declarations.length > 0)
|
|
22
|
+
return { kind: "prepared", data: definition };
|
|
25
23
|
return {
|
|
26
24
|
kind: "refused",
|
|
27
25
|
refusal: { kind: "verification-declaration-invalid" },
|
|
@@ -7,8 +7,8 @@ export declare const verificationObservationSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
7
7
|
outcome: z.ZodExactOptional<z.ZodString>;
|
|
8
8
|
elapsedMs: z.ZodExactOptional<z.ZodNumber>;
|
|
9
9
|
phase: z.ZodEnum<{
|
|
10
|
-
cleanup: "cleanup";
|
|
11
10
|
materialize: "materialize";
|
|
11
|
+
cleanup: "cleanup";
|
|
12
12
|
setup: "setup";
|
|
13
13
|
declaration: "declaration";
|
|
14
14
|
}>;
|
|
@@ -27,8 +27,8 @@ export declare const verificationObservationSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
27
27
|
}>;
|
|
28
28
|
text: z.ZodString;
|
|
29
29
|
phase: z.ZodEnum<{
|
|
30
|
-
cleanup: "cleanup";
|
|
31
30
|
materialize: "materialize";
|
|
31
|
+
cleanup: "cleanup";
|
|
32
32
|
setup: "setup";
|
|
33
33
|
declaration: "declaration";
|
|
34
34
|
}>;
|
package/build/src/world.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KeiyakuError } from "./errors.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
declare const WORLD_BRAND: unique symbol;
|
|
3
4
|
export type WorldRoot = string & {
|
|
@@ -19,11 +20,11 @@ export type WorldResolution = Readonly<{
|
|
|
19
20
|
candidate: WorldRoot | null;
|
|
20
21
|
establish: () => Promise<WorldRoot>;
|
|
21
22
|
}>;
|
|
22
|
-
export declare class WorldError extends
|
|
23
|
+
export declare class WorldError extends KeiyakuError {
|
|
23
24
|
readonly kind: "invalid-world";
|
|
24
25
|
constructor(message: string);
|
|
25
26
|
}
|
|
26
|
-
type WorldInput = string | WorldResolutionInput;
|
|
27
|
+
export type WorldInput = string | WorldResolutionInput;
|
|
27
28
|
export declare const World: Readonly<{
|
|
28
29
|
resolve(input: WorldInput): Promise<WorldResolution>;
|
|
29
30
|
locate(input: WorldInput): Promise<WorldRoot | null>;
|
package/build/src/world.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KeiyakuError } from "./errors.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { lstat, mkdir, realpath, stat } from "node:fs/promises";
|
|
3
4
|
import { dirname, join, parse, resolve } from "node:path";
|
|
@@ -8,17 +9,15 @@ export const worldResolutionSchema = z
|
|
|
8
9
|
.readonly();
|
|
9
10
|
export const worldLocationSchema = worldRootSchema.nullable();
|
|
10
11
|
export const worldEstablishedSchema = z.boolean();
|
|
11
|
-
export class WorldError extends
|
|
12
|
+
export class WorldError extends KeiyakuError {
|
|
12
13
|
kind = "invalid-world";
|
|
13
14
|
constructor(message) {
|
|
14
|
-
super(message);
|
|
15
|
-
this.name = "WorldError";
|
|
16
|
-
this.kind = "invalid-world";
|
|
15
|
+
super("internal", message);
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
async function directory(input, label) {
|
|
20
19
|
if (typeof input !== "string" || input.trim().length === 0) {
|
|
21
|
-
throw new
|
|
20
|
+
throw new KeiyakuError("invalid-input", `${label} must be a nonblank path`);
|
|
22
21
|
}
|
|
23
22
|
const path = resolve(input);
|
|
24
23
|
let real;
|
|
@@ -61,7 +60,7 @@ async function inputValues(input, label) {
|
|
|
61
60
|
if (typeof input === "string")
|
|
62
61
|
return { cwd: await directory(input, label) };
|
|
63
62
|
if (input === null || typeof input !== "object")
|
|
64
|
-
throw new
|
|
63
|
+
throw new KeiyakuError("invalid-input", `${label} must be a path or resolution input`);
|
|
65
64
|
const cwd = await directory(input.cwd, `${label} cwd`);
|
|
66
65
|
if (input.repositoryRoot === undefined)
|
|
67
66
|
return { cwd };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrosheep/keiyaku",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.33",
|
|
4
4
|
"workspaces": [
|
|
5
5
|
"plugins/square",
|
|
6
6
|
"plugins/paseo/forwarder"
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"./plugin": {
|
|
22
22
|
"types": "./build/src/plugin/public.d.ts",
|
|
23
23
|
"import": "./build/src/plugin/public.js"
|
|
24
|
+
},
|
|
25
|
+
"./pi": {
|
|
26
|
+
"types": "./build/src/pi/index.d.ts",
|
|
27
|
+
"import": "./build/src/pi/index.js"
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
"bin": {
|
|
@@ -65,7 +69,7 @@
|
|
|
65
69
|
"@earendil-works/pi-coding-agent": "*"
|
|
66
70
|
},
|
|
67
71
|
"devDependencies": {
|
|
68
|
-
"@earendil-works/pi-coding-agent": "^1.
|
|
72
|
+
"@earendil-works/pi-coding-agent": "^1.5.2",
|
|
69
73
|
"@getpaseo/plugin": "0.14.0",
|
|
70
74
|
"@getpaseo/server": "0.14.0",
|
|
71
75
|
"@types/cross-spawn": "^6.0.6",
|
|
@@ -83,7 +87,7 @@
|
|
|
83
87
|
"@agentclientprotocol/sdk": "^1.3.0",
|
|
84
88
|
"@anthropic-ai/claude-agent-sdk": "^0.3.226",
|
|
85
89
|
"@astrosheep/keiyaku-plugin-square": "0.1.23",
|
|
86
|
-
"@astrosheep/square": "^0.4.
|
|
90
|
+
"@astrosheep/square": "^0.4.9",
|
|
87
91
|
"@getpaseo/client": "0.14.0",
|
|
88
92
|
"@getpaseo/protocol": "0.14.0",
|
|
89
93
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
@@ -14,7 +14,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
14
14
|
const mirror = createProvider(transport, handoff);
|
|
15
15
|
server.registerProvider(mirror.provider);
|
|
16
16
|
server.handle(refreshRpc, (input, context) => refreshOrReopen(context.paseo, input, mirror.refresh));
|
|
17
|
-
server.handle(attachRpc, (input, context) => attach(input, context));
|
|
17
|
+
server.handle(attachRpc, (input, context) => attach(input, context, transport.status));
|
|
18
18
|
const removeModelCorrection = registerModelCorrection(server, transport.status);
|
|
19
19
|
const removeHooks = registerRegistrationHooks(server, handoff);
|
|
20
20
|
return async () => {
|