@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
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ContractTerms, type ContractTarget } from "../core/facts/types.js";
|
|
2
|
+
import { type TargetWorkspaceRefusal } from "../git/target.js";
|
|
2
3
|
import { type AmendRefusal } from "../core/verbs/amend.js";
|
|
3
|
-
import type
|
|
4
|
+
import { type VerificationDeclarationPreparation, type VerificationDeclarationRefusal } from "../verification/declaration.js";
|
|
4
5
|
import type { MutationOperationInput, IntentOutcome } from "./operations.js";
|
|
5
6
|
type AmendOperationInput = MutationOperationInput & Readonly<{
|
|
6
7
|
source?: ContractTerms;
|
|
8
|
+
target?: string;
|
|
7
9
|
deriveAmendment?: (source: ContractTerms) => Readonly<{
|
|
8
|
-
terms:
|
|
10
|
+
terms: ContractTerms;
|
|
9
11
|
verification: VerificationDeclarationPreparation;
|
|
10
12
|
}>;
|
|
11
13
|
}>;
|
|
12
14
|
type Amendment = Readonly<{
|
|
13
15
|
source: ContractTerms;
|
|
16
|
+
target?: ContractTarget;
|
|
14
17
|
}> & ReturnType<NonNullable<AmendOperationInput["deriveAmendment"]>>;
|
|
15
|
-
|
|
18
|
+
type TargetInputRefusal = Readonly<{
|
|
19
|
+
kind: "invalid-target" | "target-missing";
|
|
20
|
+
}> | TargetWorkspaceRefusal;
|
|
21
|
+
type AmendmentRefusal = AmendRefusal | VerificationDeclarationRefusal | TargetInputRefusal;
|
|
22
|
+
/** An amendment either admits terms or answers that the Contract already stands as asked. */
|
|
23
|
+
export type AmendAdmission = IntentOutcome<Amendment, AmendmentRefusal> | Readonly<{
|
|
24
|
+
kind: "unchanged";
|
|
25
|
+
}>;
|
|
26
|
+
export declare function amendOperation(input: AmendOperationInput): Promise<AmendAdmission>;
|
|
16
27
|
export {};
|
|
@@ -1,11 +1,76 @@
|
|
|
1
|
-
import { extendContractsForAdmissionAt, observeContractsForAdmissionAt } from "../git/observe.js";
|
|
1
|
+
import { extendContractsForAdmissionAt, observeContractsForAdmissionAt, selectExplicitTarget, } from "../git/observe.js";
|
|
2
2
|
import { withPrivateStatePublicationSeat } from "../git/private-state-seat.js";
|
|
3
3
|
import { contractState } from "../core/facts/observation.js";
|
|
4
|
+
import { sameTarget } from "../core/facts/types.js";
|
|
5
|
+
import { readRef } from "../git/repository.js";
|
|
6
|
+
import { resolveContractTarget } from "../git/target.js";
|
|
7
|
+
import { acquireTargetPlacementFence } from "../git/target-placement.js";
|
|
4
8
|
import { decideAmend } from "../core/verbs/amend.js";
|
|
9
|
+
import { VERIFIED, } from "../verification/declaration.js";
|
|
5
10
|
import { admitDecidedOffer, mintAttempts } from "./attempt.js";
|
|
6
11
|
import { admitted } from "./outcome.js";
|
|
7
12
|
import { protocolSeatClose } from "./run.js";
|
|
8
13
|
import { timestamp } from "./operations.js";
|
|
14
|
+
/** No target selection and no document derivation is one amendment that requests no change. */
|
|
15
|
+
function requestsEdit(input) {
|
|
16
|
+
return input.target !== undefined || input.deriveAmendment !== undefined;
|
|
17
|
+
}
|
|
18
|
+
/** Empty intent keeps the owner's existence and terminal judgment and admits nothing. */
|
|
19
|
+
async function unchangedAmend(input) {
|
|
20
|
+
const observation = await observeContractsForAdmissionAt(input.scope, input.channel, [input.contractId]);
|
|
21
|
+
const decision = decideAmend({
|
|
22
|
+
input: { contractId: input.contractId, at: timestamp() },
|
|
23
|
+
attempt: { entryUlids: [] },
|
|
24
|
+
observation: observation.decision,
|
|
25
|
+
});
|
|
26
|
+
return decision.kind === "offer" ? { kind: "unchanged" } : decision;
|
|
27
|
+
}
|
|
28
|
+
async function prepareAmendmentAt(input, selection, amendment, observation) {
|
|
29
|
+
const state = contractState(observation.decision, input.contractId);
|
|
30
|
+
observation = await extendPrerequisiteClosureAt(input.channel, observation, [
|
|
31
|
+
...new Set([...(state?.terms.after ?? []), ...amendment.terms.after]),
|
|
32
|
+
]);
|
|
33
|
+
let target;
|
|
34
|
+
let refusal;
|
|
35
|
+
if (selection?.kind === "contract") {
|
|
36
|
+
observation = await extendTargetClosureAt(input.channel, observation, selection.contractId);
|
|
37
|
+
const resolved = await resolveContractTarget(input.scope, selection.contractId);
|
|
38
|
+
if (resolved.kind === "refused")
|
|
39
|
+
refusal = resolved.refusal;
|
|
40
|
+
else
|
|
41
|
+
target = resolved.target;
|
|
42
|
+
}
|
|
43
|
+
else if (selection?.kind === "explicit") {
|
|
44
|
+
if ((await readRef(input.scope, selection.target)) === null)
|
|
45
|
+
refusal = { kind: "target-missing" };
|
|
46
|
+
else
|
|
47
|
+
target = selection.target;
|
|
48
|
+
}
|
|
49
|
+
if (sameTarget(state?.coordinates.target, target))
|
|
50
|
+
target = undefined;
|
|
51
|
+
const preparation = refusal !== undefined
|
|
52
|
+
? { kind: "refused", refusal }
|
|
53
|
+
: amendment.verification.kind === "prepared" || !amendment.terms.gates.includes(VERIFIED)
|
|
54
|
+
? { kind: "prepared", data: { ...amendment.terms, ...(target === undefined ? {} : { target }) } }
|
|
55
|
+
: { kind: "refused", refusal: amendment.verification.refusal };
|
|
56
|
+
return {
|
|
57
|
+
observation,
|
|
58
|
+
...(target === undefined ? {} : { target }),
|
|
59
|
+
preparation,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async function extendTargetClosureAt(channel, observation, seed) {
|
|
63
|
+
let current = observation;
|
|
64
|
+
const visited = new Set();
|
|
65
|
+
let id = seed;
|
|
66
|
+
while (id !== undefined && !visited.has(id)) {
|
|
67
|
+
visited.add(id);
|
|
68
|
+
current = await extendContractsForAdmissionAt(channel, current, [id]);
|
|
69
|
+
const target = contractState(current.decision, id)?.coordinates.target;
|
|
70
|
+
id = typeof target === "object" ? target.contractId : undefined;
|
|
71
|
+
}
|
|
72
|
+
return current;
|
|
73
|
+
}
|
|
9
74
|
async function extendPrerequisiteClosureAt(channel, observation, seeds) {
|
|
10
75
|
let current = observation;
|
|
11
76
|
const visited = new Set();
|
|
@@ -26,6 +91,11 @@ async function extendPrerequisiteClosureAt(channel, observation, seeds) {
|
|
|
26
91
|
return current;
|
|
27
92
|
}
|
|
28
93
|
export async function amendOperation(input) {
|
|
94
|
+
if (!requestsEdit(input))
|
|
95
|
+
return await unchangedAmend(input);
|
|
96
|
+
const selection = input.target === undefined ? undefined : await selectExplicitTarget(input.scope, input.target);
|
|
97
|
+
if (selection === null)
|
|
98
|
+
return { kind: "refused", refusal: { kind: "invalid-target" } };
|
|
29
99
|
let source = input.source;
|
|
30
100
|
if (source === undefined) {
|
|
31
101
|
const initial = await observeContractsForAdmissionAt(input.scope, input.channel, [input.contractId]);
|
|
@@ -35,51 +105,48 @@ export async function amendOperation(input) {
|
|
|
35
105
|
const amendment = source === undefined || input.deriveAmendment === undefined
|
|
36
106
|
? undefined
|
|
37
107
|
: { source, ...input.deriveAmendment(source) };
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
]);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
throw new Error("accepted amendment is missing its document derivation");
|
|
76
|
-
return admitted(admission, amendment);
|
|
108
|
+
// A requested edit must carry observed terms; only a Contract that appeared after observation has none.
|
|
109
|
+
if (amendment === undefined)
|
|
110
|
+
throw new Error("requested amendment is missing its observed source terms");
|
|
111
|
+
const incoming = selection?.kind === "contract" ? await acquireTargetPlacementFence(input.scope, selection.contractId) : undefined;
|
|
112
|
+
try {
|
|
113
|
+
return protocolSeatClose(await withPrivateStatePublicationSeat(input.scope, async (seat) => {
|
|
114
|
+
const attempts = mintAttempts({ entryCount: 1 });
|
|
115
|
+
for (let index = 0; index < attempts.length; index += 1) {
|
|
116
|
+
const { observation, target, preparation } = await prepareAmendmentAt(input, selection, amendment, await observeContractsForAdmissionAt(input.scope, input.channel, [input.contractId]));
|
|
117
|
+
const decision = decideAmend({
|
|
118
|
+
input: {
|
|
119
|
+
contractId: input.contractId,
|
|
120
|
+
at: timestamp(),
|
|
121
|
+
edit: {
|
|
122
|
+
source: amendment.source,
|
|
123
|
+
preparation,
|
|
124
|
+
...(selection?.kind === "contract" ? { targetContract: selection.contractId } : {}),
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
attempt: attempts[index],
|
|
128
|
+
observation: observation.decision,
|
|
129
|
+
});
|
|
130
|
+
if (decision.kind !== "offer")
|
|
131
|
+
return decision;
|
|
132
|
+
const admission = await admitDecidedOffer({
|
|
133
|
+
...input,
|
|
134
|
+
seat,
|
|
135
|
+
observation,
|
|
136
|
+
attempt: attempts[index],
|
|
137
|
+
offer: decision.offer,
|
|
138
|
+
});
|
|
139
|
+
if (admission.kind === "accepted")
|
|
140
|
+
return admitted(admission, { ...amendment, ...(target === undefined ? {} : { target }) });
|
|
141
|
+
if (admission.kind === "publication-failed")
|
|
142
|
+
return { kind: "retry", reason: admission };
|
|
143
|
+
if (admission.kind === "collision" && index + 1 === attempts.length)
|
|
144
|
+
return { kind: "retry", reason: admission };
|
|
77
145
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}));
|
|
146
|
+
return { kind: "retry", reason: { kind: "exhausted" } };
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
incoming?.close();
|
|
151
|
+
}
|
|
85
152
|
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import
|
|
2
|
+
import type { BindData, ContractId } from "../core/facts/types.js";
|
|
3
3
|
import { type TargetWorkspaceRefusal } from "../git/target.js";
|
|
4
4
|
import { type BindRefusal } from "../core/verbs/bind.js";
|
|
5
5
|
import { type BindTargetSelection } from "../git/observe.js";
|
|
6
6
|
import type { GitRepository } from "../git/process.js";
|
|
7
7
|
import type { GitDecodeChannel } from "../git/read-observation.js";
|
|
8
|
-
import type
|
|
8
|
+
import { type VerificationDeclarationPreparation, type VerificationDeclarationRefusal } from "../verification/declaration.js";
|
|
9
9
|
import { type IntentOutcome } from "./outcome.js";
|
|
10
10
|
import type { CompanionDecorator } from "./run.js";
|
|
11
11
|
export type { BindRefusal } from "../core/verbs/bind.js";
|
|
12
12
|
export type { BindTargetSelection };
|
|
13
13
|
export declare const targetInputRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
14
14
|
kind: z.ZodEnum<{
|
|
15
|
-
"unborn-head": "unborn-head";
|
|
16
15
|
"target-missing": "target-missing";
|
|
17
16
|
"invalid-target": "invalid-target";
|
|
17
|
+
"unborn-head": "unborn-head";
|
|
18
18
|
}>;
|
|
19
19
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
20
20
|
kind: z.ZodLiteral<"target-workspace-unavailable">;
|
|
21
21
|
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
22
22
|
reason: z.ZodEnum<{
|
|
23
|
-
missing: "missing";
|
|
24
|
-
replaced: "replaced";
|
|
25
23
|
unappointed: "unappointed";
|
|
24
|
+
missing: "missing";
|
|
26
25
|
association: "association";
|
|
26
|
+
replaced: "replaced";
|
|
27
27
|
attached: "attached";
|
|
28
28
|
uncommitted: "uncommitted";
|
|
29
29
|
operation: "operation";
|
|
@@ -40,8 +40,6 @@ type BindOperationInput = Readonly<{
|
|
|
40
40
|
terms: BindData["terms"];
|
|
41
41
|
verification: VerificationDeclarationPreparation;
|
|
42
42
|
targetSelection: BindTargetSelection;
|
|
43
|
-
workspace: "worktree";
|
|
44
|
-
actor?: ActorId;
|
|
45
43
|
decorateOffer?: CompanionDecorator;
|
|
46
44
|
contractId: ContractId;
|
|
47
45
|
coordinates?: Readonly<{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { contractId } from "../core/facts/types.js";
|
|
3
2
|
import { resolveContractTarget, targetRef, targetWorkspaceRefusalSchema, } from "../git/target.js";
|
|
4
3
|
import { acquireTargetPlacementFence } from "../git/target-placement.js";
|
|
5
4
|
import { decideBind } from "../core/verbs/bind.js";
|
|
6
5
|
import { gitObjectIdForSnapshot } from "../git/identity.js";
|
|
7
|
-
import {
|
|
6
|
+
import { selectExplicitTarget, observeBindCoordinates, } from "../git/observe.js";
|
|
7
|
+
import { VERIFIED, } from "../verification/declaration.js";
|
|
8
8
|
import { admitPreparedIntent } from "./intent.js";
|
|
9
9
|
import { complete } from "./outcome.js";
|
|
10
10
|
export const targetInputRefusalSchema = z.union([
|
|
@@ -23,7 +23,7 @@ export const forkSourceMovedRefusalSchema = z
|
|
|
23
23
|
* observed start/target plus the expected ref assertions that publication must still confirm.
|
|
24
24
|
*/
|
|
25
25
|
async function prepareBindCoordinates(input, selection) {
|
|
26
|
-
if (input.verification.kind === "refused") {
|
|
26
|
+
if (input.terms.gates.includes(VERIFIED) && input.verification.kind === "refused") {
|
|
27
27
|
return { kind: "prepared", prepared: { kind: "declaration-refused", preparation: input.verification } };
|
|
28
28
|
}
|
|
29
29
|
if (selection.kind === "contract") {
|
|
@@ -108,7 +108,7 @@ async function assembleBindInput(input, selection, seed, prepared) {
|
|
|
108
108
|
coordinates: {
|
|
109
109
|
start: input.coordinates?.start ?? observed.start,
|
|
110
110
|
...(observed.target === undefined ? {} : { target: observed.target }),
|
|
111
|
-
workspace:
|
|
111
|
+
workspace: "worktree",
|
|
112
112
|
},
|
|
113
113
|
terms: input.terms,
|
|
114
114
|
},
|
|
@@ -119,20 +119,10 @@ async function assembleBindInput(input, selection, seed, prepared) {
|
|
|
119
119
|
export async function bindOperation(input) {
|
|
120
120
|
let selection = input.targetSelection;
|
|
121
121
|
if (selection.kind === "explicit") {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
catch {
|
|
127
|
-
return { kind: "refused", refusal: { kind: "invalid-target" } };
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
const normalized = await normalizeTargetBranch(input.scope, selection.target);
|
|
132
|
-
if (normalized === null)
|
|
133
|
-
return { kind: "refused", refusal: { kind: "invalid-target" } };
|
|
134
|
-
selection = { kind: "explicit", target: normalized };
|
|
135
|
-
}
|
|
122
|
+
const explicit = await selectExplicitTarget(input.scope, selection.target);
|
|
123
|
+
if (explicit === null)
|
|
124
|
+
return { kind: "refused", refusal: { kind: "invalid-target" } };
|
|
125
|
+
selection = explicit;
|
|
136
126
|
}
|
|
137
127
|
const at = new Date().toISOString();
|
|
138
128
|
const id = input.contractId;
|
|
@@ -140,7 +130,6 @@ export async function bindOperation(input) {
|
|
|
140
130
|
try {
|
|
141
131
|
return complete(await admitPreparedIntent(input.channel, input.scope, {
|
|
142
132
|
contractId: id,
|
|
143
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
144
133
|
at,
|
|
145
134
|
}, decideBind, {
|
|
146
135
|
observedContracts: [
|