@astrosheep/keiyaku 4.6.30 → 4.6.31
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 +5 -5
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku/SKILL.md +12 -12
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku/SKILL.md +12 -12
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/plugins/opencode/package.json +1 -1
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +12 -12
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/plugins/pi/README.md +5 -5
- package/build/plugins/pi/akuma-tools.ts +17 -23
- package/build/skills/keiyaku/SKILL.md +12 -12
- package/build/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/src/akuma/akuma-call.d.ts +1 -1
- package/build/src/akuma/akuma-call.js +9 -9
- package/build/src/akuma/akuma-errors.d.ts +5 -5
- package/build/src/akuma/akuma-instance.d.ts +355 -12
- package/build/src/akuma/akuma-instance.js +20 -20
- package/build/src/akuma/akuma-observe.d.ts +11 -12
- package/build/src/akuma/akuma-observe.js +34 -26
- package/build/src/akuma/akuma-owner.d.ts +32 -11
- package/build/src/akuma/akuma-owner.js +35 -16
- package/build/src/akuma/akuma-probe.d.ts +3 -3
- package/build/src/akuma/akuma-probe.js +2 -2
- package/build/src/akuma/akuma-selection-execution.d.ts +985 -1
- package/build/src/akuma/akuma-selection-execution.js +42 -18
- package/build/src/akuma/akuma-stream.d.ts +2 -2
- package/build/src/akuma/akuma-stream.js +1 -1
- package/build/src/akuma/akuma-wait.d.ts +5 -5
- package/build/src/akuma/akuma-wait.js +52 -14
- package/build/src/akuma/akuma.d.ts +245 -271
- package/build/src/akuma/akuma.js +98 -46
- package/build/src/akuma/archetype.d.ts +19 -6
- package/build/src/akuma/archetype.js +25 -9
- package/build/src/akuma/body-launch.d.ts +2 -2
- package/build/src/akuma/body.js +4 -4
- package/build/src/akuma/call-initial-tell.d.ts +60 -44
- package/build/src/akuma/call-initial-tell.js +41 -2
- package/build/src/akuma/caller.d.ts +26 -17
- package/build/src/akuma/caller.js +22 -9
- package/build/src/akuma/coordinate.d.ts +9 -0
- package/build/src/akuma/coordinate.js +13 -0
- package/build/src/akuma/detached-body.js +2 -2
- package/build/src/akuma/dispatch-association.d.ts +4 -4
- package/build/src/akuma/dispatch-association.js +12 -3
- package/build/src/akuma/execution-instructions.js +2 -2
- package/build/src/akuma/heart/facts.d.ts +29 -7
- package/build/src/akuma/heart/facts.js +13 -0
- package/build/src/akuma/heart/index.d.ts +0 -3
- package/build/src/akuma/heart/index.js +3 -6
- package/build/src/akuma/heart/rows.js +2 -2
- package/build/src/akuma/heart/soul.js +5 -5
- package/build/src/akuma/identity.d.ts +17 -16
- package/build/src/akuma/identity.js +20 -19
- package/build/src/akuma/index.d.ts +1 -2
- package/build/src/akuma/lineage-cache.d.ts +4 -4
- package/build/src/akuma/lineage-cache.js +10 -10
- package/build/src/akuma/projection-read.d.ts +2 -5
- package/build/src/akuma/projection-read.js +34 -47
- package/build/src/akuma/projection.d.ts +659 -569
- package/build/src/akuma/projection.js +203 -94
- package/build/src/akuma/providers/acp/index.js +1 -1
- package/build/src/akuma/providers/execution-environment.d.ts +1 -3
- package/build/src/akuma/providers/execution-environment.js +0 -4
- package/build/src/akuma/publication.d.ts +2 -2
- package/build/src/akuma/publication.js +3 -3
- package/build/src/akuma/retention.js +2 -2
- package/build/src/akuma/selection-observation.d.ts +507 -43
- package/build/src/akuma/selection-observation.js +153 -1
- package/build/src/akuma/status-projection.d.ts +288 -0
- package/build/src/akuma/status-projection.js +154 -0
- package/build/src/akuma/turn-drive.js +0 -3
- package/build/src/alias/index.d.ts +9 -4
- package/build/src/alias/index.js +11 -9
- package/build/src/bounded-list.d.ts +8 -0
- package/build/src/bounded-list.js +9 -0
- package/build/src/cli/commands/akuma-grammar.d.ts +2 -2
- package/build/src/cli/commands/akuma-grammar.js +21 -21
- package/build/src/cli/commands/akuma.d.ts +1 -2
- package/build/src/cli/commands/akuma.js +115 -251
- package/build/src/cli/commands/contract-grammar.d.ts +4 -3
- package/build/src/cli/commands/contract-grammar.js +39 -22
- package/build/src/cli/commands/contract-help.d.ts +3 -1
- package/build/src/cli/commands/contract-help.js +4 -3
- package/build/src/cli/commands/contract.d.ts +6 -3
- package/build/src/cli/commands/contract.js +203 -434
- package/build/src/cli/commands/debt.d.ts +2 -3
- package/build/src/cli/commands/debt.js +101 -317
- package/build/src/cli/commands/report.js +11 -28
- package/build/src/cli/commands/whoami.d.ts +3 -43
- package/build/src/cli/commands/whoami.js +8 -121
- package/build/src/cli/coordinates.d.ts +4 -35
- package/build/src/cli/coordinates.js +13 -129
- package/build/src/cli/parse.d.ts +0 -6
- package/build/src/cli/parse.js +5 -48
- package/build/src/cli/render/akuma-activity.d.ts +31 -16
- package/build/src/cli/render/akuma-activity.js +157 -149
- package/build/src/cli/render/akuma-tool.d.ts +3 -6
- package/build/src/cli/render/akuma-tool.js +20 -14
- package/build/src/cli/render/akuma.d.ts +25 -26
- package/build/src/cli/render/akuma.js +100 -129
- package/build/src/cli/render/catalog.d.ts +4 -7
- package/build/src/cli/render/catalog.js +52 -99
- package/build/src/cli/render/contract-history.d.ts +3 -1
- package/build/src/cli/render/contract-history.js +140 -215
- package/build/src/cli/render/contract-observation.d.ts +43 -30
- package/build/src/cli/render/contract-observation.js +64 -31
- package/build/src/cli/render/contract-wait.js +6 -6
- package/build/src/cli/render/contract.d.ts +41 -6
- package/build/src/cli/render/contract.js +274 -370
- package/build/src/cli/render/debt.d.ts +9 -19
- package/build/src/cli/render/debt.js +120 -185
- package/build/src/cli/render/delivery-preview.d.ts +4 -3
- package/build/src/cli/render/delivery-preview.js +68 -96
- package/build/src/cli/render/kanshi-akuma.d.ts +4 -4
- package/build/src/cli/render/kanshi-akuma.js +70 -59
- package/build/src/cli/render/kanshi.d.ts +4 -4
- package/build/src/cli/render/kanshi.js +205 -221
- package/build/src/cli/render/marks.d.ts +11 -2
- package/build/src/cli/render/marks.js +13 -3
- package/build/src/cli/render/nuke.d.ts +3 -3
- package/build/src/cli/render/nuke.js +13 -16
- package/build/src/cli/render/receipt.d.ts +37 -43
- package/build/src/cli/render/receipt.js +313 -236
- package/build/src/cli/render/reconcile.d.ts +6 -4
- package/build/src/cli/render/reconcile.js +53 -137
- package/build/src/cli/render/refusal.d.ts +3 -2
- package/build/src/cli/render/refusal.js +73 -54
- package/build/src/cli/render/region.d.ts +11 -2
- package/build/src/cli/render/region.js +17 -23
- package/build/src/cli/render/settings.d.ts +0 -1
- package/build/src/cli/render/settings.js +8 -17
- package/build/src/cli/render/terminal.d.ts +2 -0
- package/build/src/cli/render/verbs.d.ts +4 -0
- package/build/src/cli/render/verbs.js +312 -0
- package/build/src/cli/render/whoami.d.ts +1 -1
- package/build/src/cli/render/whoami.js +24 -31
- package/build/src/cli/runtime.d.ts +3 -11
- package/build/src/cli/runtime.js +96 -79
- package/build/src/cli/scan.d.ts +1 -1
- package/build/src/cli/streams.js +1 -0
- package/build/src/contract-guidance.js +2 -2
- package/build/src/contract-worktree.d.ts +2 -15
- package/build/src/contract-worktree.js +19 -35
- package/build/src/core/facts/observation.d.ts +4 -5
- package/build/src/core/facts/observation.js +7 -9
- package/build/src/core/verbs/amend.d.ts +0 -1
- package/build/src/core/verbs/amend.js +3 -3
- package/build/src/core/verbs/bind.d.ts +0 -1
- package/build/src/core/verbs/bind.js +5 -5
- package/build/src/core/verbs/deliver.d.ts +3 -2
- package/build/src/core/verbs/deliver.js +2 -2
- package/build/src/core/verbs/placement.d.ts +0 -5
- package/build/src/core/verbs/placement.js +4 -6
- package/build/src/core/verbs/reintegrate.d.ts +0 -1
- package/build/src/core/verbs/reintegrate.js +2 -2
- package/build/src/debt/board.d.ts +132 -116
- package/build/src/debt/board.js +138 -94
- package/build/src/debt/catalog.d.ts +4 -4
- package/build/src/debt/catalog.js +2 -18
- package/build/src/debt/context.d.ts +15 -3
- package/build/src/debt/context.js +12 -1
- package/build/src/debt/created-observation.d.ts +5 -17
- package/build/src/debt/created-observation.js +14 -6
- package/build/src/debt/document.d.ts +20 -15
- package/build/src/debt/document.js +18 -1
- package/build/src/debt/index.d.ts +346 -23
- package/build/src/debt/index.js +68 -22
- package/build/src/debt/input.d.ts +2 -1
- package/build/src/debt/input.js +14 -0
- package/build/src/debt/lifecycle-operations.d.ts +2 -2
- package/build/src/debt/lifecycle-operations.js +14 -22
- package/build/src/debt/operation-types.d.ts +188 -66
- package/build/src/debt/operation-types.js +113 -1
- package/build/src/debt/operations.d.ts +11 -10
- package/build/src/debt/operations.js +46 -71
- package/build/src/debt/query.d.ts +14 -10
- package/build/src/debt/query.js +3 -12
- package/build/src/debt/store.d.ts +4 -2
- package/build/src/debt/store.js +8 -8
- package/build/src/debt/view.d.ts +0 -3
- package/build/src/debt/view.js +0 -4
- package/build/src/dispatch/index.d.ts +22 -5
- package/build/src/dispatch/index.js +46 -37
- package/build/src/git/admission.d.ts +2 -2
- package/build/src/git/admission.js +2 -1
- package/build/src/git/hooks.d.ts +14 -35
- package/build/src/git/hooks.js +45 -25
- package/build/src/git/integration.d.ts +6 -24
- package/build/src/git/integration.js +10 -16
- package/build/src/git/private-state-seat.d.ts +2 -2
- package/build/src/git/private-state-seat.js +2 -1
- package/build/src/git/reconcile.d.ts +17 -79
- package/build/src/git/reconcile.js +37 -52
- package/build/src/git/scratch.d.ts +3 -3
- package/build/src/git/scratch.js +4 -1
- package/build/src/git/target-placement.d.ts +23 -31
- package/build/src/git/target-placement.js +42 -27
- package/build/src/git/target.d.ts +2 -2
- package/build/src/git/target.js +2 -1
- package/build/src/git/tender.d.ts +7 -39
- package/build/src/git/tender.js +21 -54
- package/build/src/git/terminal-reconcile.js +15 -18
- package/build/src/git/terminal-seal.d.ts +2 -4
- package/build/src/git/terminal-seal.js +7 -33
- package/build/src/git/workspace.d.ts +65 -41
- package/build/src/git/workspace.js +45 -14
- package/build/src/identity/selector.d.ts +2 -0
- package/build/src/identity/selector.js +13 -3
- package/build/src/index.d.ts +48 -54
- package/build/src/index.js +31 -43
- package/build/src/kanshi/counts.d.ts +42 -8
- package/build/src/kanshi/counts.js +13 -2
- package/build/src/kanshi/index.d.ts +5 -5
- package/build/src/kanshi/index.js +4 -3
- package/build/src/kanshi/read.d.ts +489 -6
- package/build/src/kanshi/read.js +334 -483
- package/build/src/kanshi/report.d.ts +2504 -103
- package/build/src/kanshi/report.js +165 -1
- package/build/src/kanshi/select.d.ts +0 -8
- package/build/src/kanshi/select.js +20 -59
- package/build/src/library/address.d.ts +8 -8
- package/build/src/library/address.js +7 -7
- package/build/src/library/akuma-creation.d.ts +690 -84
- package/build/src/library/akuma-creation.js +202 -142
- package/build/src/library/akuma-retention.d.ts +2 -2
- package/build/src/library/akuma-retention.js +2 -2
- package/build/src/library/akumas.d.ts +10 -6
- package/build/src/library/akumas.js +24 -7
- package/build/src/library/bind.d.ts +28 -54
- package/build/src/library/bind.js +6 -4
- package/build/src/library/continuation.d.ts +197 -479
- package/build/src/library/continuation.js +40 -23
- package/build/src/library/contract-address.d.ts +6 -5
- package/build/src/library/contract-address.js +5 -7
- package/build/src/library/contract-composition.d.ts +18 -12
- package/build/src/library/contract-composition.js +55 -47
- package/build/src/library/contract-creation.d.ts +3 -2
- package/build/src/library/contract-creation.js +38 -32
- package/build/src/library/contract-execution.js +77 -38
- package/build/src/library/contract-outcomes.d.ts +1877 -27
- package/build/src/library/contract-outcomes.js +93 -10
- package/build/src/library/contract-settings.d.ts +2 -2
- package/build/src/library/contract-settings.js +18 -14
- package/build/src/library/contract-types.d.ts +238 -61
- package/build/src/library/contract-types.js +131 -1
- package/build/src/library/contract-wait.d.ts +38 -17
- package/build/src/library/contract-wait.js +40 -10
- package/build/src/library/delivery.d.ts +588 -36
- package/build/src/library/delivery.js +35 -27
- package/build/src/library/input.d.ts +1 -1
- package/build/src/library/input.js +1 -2
- package/build/src/library/invocation.d.ts +11 -7
- package/build/src/library/invocation.js +42 -51
- package/build/src/library/kei.d.ts +48 -0
- package/build/src/library/kei.js +256 -0
- package/build/src/library/keiyaku-attribution.d.ts +11 -0
- package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +12 -1
- package/build/src/library/keiyaku-classify.d.ts +11 -0
- package/build/src/library/keiyaku-classify.js +146 -0
- package/build/src/library/keiyaku-coordinates.d.ts +31 -0
- package/build/src/library/keiyaku-coordinates.js +103 -0
- package/build/src/library/keiyaku-debt.d.ts +142 -0
- package/build/src/library/keiyaku-debt.js +188 -0
- package/build/src/library/keiyaku-identity.d.ts +58 -0
- package/build/src/library/keiyaku-identity.js +176 -0
- package/build/src/library/keiyaku-policy.d.ts +27 -0
- package/build/src/library/keiyaku-policy.js +44 -0
- package/build/src/library/keiyaku-status.d.ts +1487 -0
- package/build/src/library/keiyaku-status.js +92 -0
- package/build/src/library/keiyaku-verbs.d.ts +6774 -0
- package/build/src/library/keiyaku-verbs.js +458 -0
- package/build/src/library/keiyaku.d.ts +871 -38
- package/build/src/library/keiyaku.js +677 -127
- package/build/src/library/nuke.d.ts +22 -0
- package/build/src/library/nuke.js +4 -1
- package/build/src/library/outcome.d.ts +706 -692
- package/build/src/library/outcome.js +582 -167
- package/build/src/library/reconcile.d.ts +464 -116
- package/build/src/library/reconcile.js +174 -102
- package/build/src/library/refusal.d.ts +113 -577
- package/build/src/library/refusal.js +64 -51
- package/build/src/library/region.d.ts +5 -24
- package/build/src/library/region.js +6 -21
- package/build/src/library/selection.d.ts +181 -32
- package/build/src/library/selection.js +99 -64
- package/build/src/mcp/adapter.d.ts +11 -0
- package/build/src/mcp/adapter.js +106 -0
- package/build/src/mcp/help.d.ts +1 -0
- package/build/src/mcp/help.js +26 -0
- package/build/src/mcp/index.d.ts +2 -0
- package/build/src/mcp/index.js +37 -0
- package/build/src/plugin/public.d.ts +1 -1
- package/build/src/plugin/runtime.js +17 -14
- package/build/src/protocol/arc.d.ts +4 -1
- package/build/src/protocol/arc.js +7 -1
- package/build/src/protocol/attempt.d.ts +2 -3
- package/build/src/protocol/attempt.js +1 -10
- package/build/src/protocol/bind.d.ts +6 -7
- package/build/src/protocol/bind.js +9 -5
- package/build/src/protocol/completion.d.ts +448 -12
- package/build/src/protocol/completion.js +164 -26
- package/build/src/protocol/deliver.d.ts +26 -24
- package/build/src/protocol/deliver.js +24 -52
- package/build/src/protocol/delivery-preview.d.ts +97 -247
- package/build/src/protocol/delivery-preview.js +132 -128
- package/build/src/protocol/execution-observation.d.ts +146 -123
- package/build/src/protocol/execution-observation.js +9 -6
- package/build/src/protocol/intent.d.ts +9 -48
- package/build/src/protocol/intent.js +32 -46
- package/build/src/protocol/operations.d.ts +207 -505
- package/build/src/protocol/operations.js +81 -134
- package/build/src/protocol/placement.d.ts +0 -1
- package/build/src/protocol/placement.js +5 -2
- package/build/src/protocol/progress.d.ts +7 -97
- package/build/src/protocol/progress.js +7 -55
- package/build/src/protocol/read/observation.d.ts +13 -6
- package/build/src/protocol/read/observation.js +10 -9
- package/build/src/protocol/read/status.d.ts +464 -93
- package/build/src/protocol/read/status.js +372 -85
- package/build/src/protocol/reconcile.d.ts +2 -0
- package/build/src/protocol/reconcile.js +12 -11
- package/build/src/protocol/reintegrate.d.ts +0 -1
- package/build/src/protocol/reintegrate.js +4 -4
- package/build/src/protocol/result-leaves.d.ts +528 -0
- package/build/src/protocol/result-leaves.js +195 -0
- package/build/src/protocol/result-reasons.d.ts +129 -0
- package/build/src/protocol/result-reasons.js +87 -0
- package/build/src/protocol/review.d.ts +14 -11
- package/build/src/protocol/review.js +30 -14
- package/build/src/protocol/run.d.ts +4 -4
- package/build/src/protocol/run.js +4 -1
- package/build/src/protocol/verify.d.ts +359 -30
- package/build/src/protocol/verify.js +118 -28
- package/build/src/region.d.ts +26 -0
- package/build/src/region.js +28 -0
- package/build/src/runtime/proc/diagnostic.d.ts +11 -0
- package/build/src/runtime/proc/diagnostic.js +20 -0
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +126 -32
- package/build/src/settings.js +107 -34
- package/build/src/settlement/settle.d.ts +29 -12
- package/build/src/settlement/settle.js +22 -15
- package/build/src/verification/declaration.d.ts +1 -3
- package/build/src/verification/declaration.js +2 -5
- package/build/src/verification/execution.d.ts +7 -19
- package/build/src/verification/execution.js +37 -16
- package/build/src/verification/observation.d.ts +13 -13
- package/build/src/verification/observation.js +9 -7
- package/build/src/world.d.ts +8 -0
- package/build/src/world.js +7 -0
- package/package.json +6 -5
- package/plugins/paseo/plugin/server/keiyaku.ts +13 -46
- package/plugins/paseo/plugin/server/message.ts +8 -30
- package/plugins/paseo/plugin/server/mirror.ts +16 -20
- package/plugins/paseo/plugin/server/provider.ts +1 -1
- package/plugins/paseo/plugin/server/sdk.ts +14 -6
- package/plugins/pi/README.md +5 -5
- package/plugins/pi/akuma-tools.ts +17 -23
- package/skills/keiyaku/SKILL.md +12 -12
- package/skills/keiyaku-akuma/SKILL.md +16 -16
- package/skills/keiyaku-akuma/references/automation.md +14 -14
- package/skills/keiyaku-babysit/SKILL.md +10 -10
- package/skills/keiyaku-bind/SKILL.md +15 -15
- package/skills/keiyaku-debt/SKILL.md +16 -16
- package/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/src/cli/actor.d.ts +0 -10
- package/build/src/cli/actor.js +0 -24
- package/build/src/cli/akuma-caller.d.ts +0 -3
- package/build/src/cli/akuma-caller.js +0 -31
- package/build/src/cli/delivery-identity.d.ts +0 -3
- package/build/src/cli/render/effects.d.ts +0 -26
- package/build/src/cli/render/effects.js +0 -41
- package/build/src/cli/selectors.d.ts +0 -10
- package/build/src/cli/selectors.js +0 -42
- package/build/src/markdown/diff.d.ts +0 -1
- package/build/src/markdown/diff.js +0 -4
package/build/src/git/target.js
CHANGED
|
@@ -14,7 +14,8 @@ export const targetWorkspaceRefusalSchema = z
|
|
|
14
14
|
contractId: contractIdSchema,
|
|
15
15
|
reason: z.enum(["unappointed", "missing", "association", "replaced", "attached", "uncommitted", "operation"]),
|
|
16
16
|
})
|
|
17
|
-
.strict()
|
|
17
|
+
.strict()
|
|
18
|
+
.readonly();
|
|
18
19
|
export function targetRepository(repository, target) {
|
|
19
20
|
return typeof target === "string" ? repository : { ...repository, effectiveCwd: repository.primaryWorktree };
|
|
20
21
|
}
|
|
@@ -10,44 +10,16 @@ type TenderCaptureCoordinates = Readonly<{
|
|
|
10
10
|
place?: string;
|
|
11
11
|
workspacePath?: string;
|
|
12
12
|
captureMergeState?: boolean;
|
|
13
|
-
/** Opt-in real-index UU refusal. Omit or false when authorized capture must read current worktree bytes. */
|
|
14
|
-
rejectUnmerged?: boolean;
|
|
15
13
|
}>;
|
|
16
|
-
export declare const worktreeMissingRefusalSchema: z.ZodObject<{
|
|
14
|
+
export declare const worktreeMissingRefusalSchema: z.ZodReadonly<z.ZodObject<{
|
|
17
15
|
kind: z.ZodLiteral<"worktree-missing">;
|
|
18
|
-
|
|
19
|
-
}, z.core.$strict>;
|
|
16
|
+
}, z.core.$strict>>;
|
|
20
17
|
type WorktreeMissingRefusal = z.infer<typeof worktreeMissingRefusalSchema>;
|
|
21
|
-
export declare const
|
|
22
|
-
kind: z.ZodLiteral<"unmerged-paths">;
|
|
23
|
-
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
24
|
-
paths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
25
|
-
}, z.core.$strict>;
|
|
26
|
-
type TenderCaptureRefusal = WorktreeMissingRefusal | z.infer<typeof unmergedPathsRefusalSchema>;
|
|
27
|
-
export declare const workspaceDirtyDeltaSchema: z.ZodObject<{
|
|
28
|
-
staged: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
29
|
-
unstaged: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
30
|
-
untracked: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
31
|
-
shortStat: z.ZodObject<{
|
|
32
|
-
filesChanged: z.ZodNumber;
|
|
33
|
-
insertions: z.ZodNumber;
|
|
34
|
-
deletions: z.ZodNumber;
|
|
35
|
-
}, z.core.$strict>;
|
|
36
|
-
}, z.core.$strict>;
|
|
37
|
-
type WorkspaceDirtyDelta = z.infer<typeof workspaceDirtyDeltaSchema>;
|
|
38
|
-
export declare const dirtyWorkspaceRefusalSchema: z.ZodObject<{
|
|
18
|
+
export declare const dirtyWorkspaceRefusalSchema: z.ZodReadonly<z.ZodObject<{
|
|
39
19
|
kind: z.ZodLiteral<"dirty-workspace">;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
untracked: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
44
|
-
submodules: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
45
|
-
shortStat: z.ZodObject<{
|
|
46
|
-
filesChanged: z.ZodNumber;
|
|
47
|
-
insertions: z.ZodNumber;
|
|
48
|
-
deletions: z.ZodNumber;
|
|
49
|
-
}, z.core.$strict>;
|
|
50
|
-
}, z.core.$strict>;
|
|
20
|
+
paths: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
21
|
+
submodules: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
22
|
+
}, z.core.$strict>>;
|
|
51
23
|
export type DirtyWorkspaceRefusal = z.infer<typeof dirtyWorkspaceRefusalSchema>;
|
|
52
24
|
export type TenderCapture = Readonly<{
|
|
53
25
|
tree: GitObjectId;
|
|
@@ -58,12 +30,8 @@ export type TenderCapture = Readonly<{
|
|
|
58
30
|
changes: Awaited<ReturnType<typeof captureWorkspaceTree>>["changes"];
|
|
59
31
|
}>;
|
|
60
32
|
/** Capture the complete workspace tree through Git's private index mechanics. */
|
|
61
|
-
export declare function captureTender(repository: GitRepository, input: TenderCaptureCoordinates & Readonly<{
|
|
62
|
-
rejectUnmerged: true;
|
|
63
|
-
}>): Promise<Preparation<TenderCapture, TenderCaptureRefusal>>;
|
|
64
33
|
export declare function captureTender(repository: GitRepository, input: TenderCaptureCoordinates): Promise<Preparation<TenderCapture, WorktreeMissingRefusal>>;
|
|
65
|
-
export declare function dirtyTenderRefusal(
|
|
66
|
-
export declare function dirtyTenderDelta(repository: GitRepository, tender: TenderCapture): Promise<WorkspaceDirtyDelta | undefined>;
|
|
34
|
+
export declare function dirtyTenderRefusal(tender: TenderCapture): DirtyWorkspaceRefusal;
|
|
67
35
|
type GitCommitIdentity = Readonly<{
|
|
68
36
|
name: string;
|
|
69
37
|
email: string;
|
package/build/src/git/tender.js
CHANGED
|
@@ -1,47 +1,27 @@
|
|
|
1
|
-
import { contractIdSchema } from "./identity.js";
|
|
2
1
|
import { z } from "zod";
|
|
3
2
|
import { access } from "node:fs/promises";
|
|
4
3
|
import { gitObjectIdForSnapshot, mintSnapshotId } from "./identity.js";
|
|
5
|
-
import {
|
|
4
|
+
import { registeredWorktreePaths } from "./repository.js";
|
|
6
5
|
import { executeGit, GitPlumbingError } from "./process.js";
|
|
7
|
-
import { captureWorkspaceTree,
|
|
6
|
+
import { captureWorkspaceTree, workspaceMergeHead, worktreePath } from "./workspace.js";
|
|
8
7
|
export const worktreeMissingRefusalSchema = z
|
|
9
|
-
.object({ kind: z.literal("worktree-missing")
|
|
10
|
-
.strict()
|
|
11
|
-
|
|
12
|
-
.object({
|
|
13
|
-
kind: z.literal("unmerged-paths"),
|
|
14
|
-
contractId: contractIdSchema,
|
|
15
|
-
paths: z.array(z.string().refine((value) => value.trim() !== "")).readonly(),
|
|
16
|
-
})
|
|
17
|
-
.strict();
|
|
18
|
-
export const workspaceDirtyDeltaSchema = z
|
|
19
|
-
.object({
|
|
20
|
-
staged: z.array(z.string()).readonly(),
|
|
21
|
-
unstaged: z.array(z.string()).readonly(),
|
|
22
|
-
untracked: z.array(z.string()).readonly(),
|
|
23
|
-
shortStat: z
|
|
24
|
-
.object({ filesChanged: z.number().int(), insertions: z.number().int(), deletions: z.number().int() })
|
|
25
|
-
.strict(),
|
|
26
|
-
})
|
|
27
|
-
.strict();
|
|
8
|
+
.object({ kind: z.literal("worktree-missing") })
|
|
9
|
+
.strict()
|
|
10
|
+
.readonly();
|
|
28
11
|
export const dirtyWorkspaceRefusalSchema = z
|
|
29
12
|
.object({
|
|
30
13
|
kind: z.literal("dirty-workspace"),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
submodules: z
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
insertions: z.number().int().nonnegative(),
|
|
40
|
-
deletions: z.number().int().nonnegative(),
|
|
41
|
-
})
|
|
42
|
-
.strict(),
|
|
14
|
+
paths: z
|
|
15
|
+
.array(z.string().refine((value) => value.trim() !== ""))
|
|
16
|
+
.readonly()
|
|
17
|
+
.exactOptional(),
|
|
18
|
+
submodules: z
|
|
19
|
+
.array(z.string().refine((value) => value.trim() !== ""))
|
|
20
|
+
.readonly()
|
|
21
|
+
.exactOptional(),
|
|
43
22
|
})
|
|
44
|
-
.strict()
|
|
23
|
+
.strict()
|
|
24
|
+
.readonly();
|
|
45
25
|
async function workspaceExists(repository, path) {
|
|
46
26
|
const exists = await access(path).then(() => true, () => false);
|
|
47
27
|
return exists && (await registeredWorktreePaths(repository)).includes(path);
|
|
@@ -51,15 +31,11 @@ function workspaceFor(repository, input) {
|
|
|
51
31
|
return input.workspacePath;
|
|
52
32
|
return input.place === undefined ? undefined : worktreePath(repository, input.place);
|
|
53
33
|
}
|
|
34
|
+
/** Capture the complete workspace tree through Git's private index mechanics. */
|
|
54
35
|
export async function captureTender(repository, input) {
|
|
55
36
|
const workspace = workspaceFor(repository, input);
|
|
56
37
|
if (workspace === undefined || !(await workspaceExists(repository, workspace))) {
|
|
57
|
-
return { kind: "refused", refusal: { kind: "worktree-missing"
|
|
58
|
-
}
|
|
59
|
-
if (input.rejectUnmerged === true) {
|
|
60
|
-
const paths = await unmergedWorkspacePaths(repository, workspace);
|
|
61
|
-
if (paths.length > 0)
|
|
62
|
-
return { kind: "refused", refusal: { kind: "unmerged-paths", contractId: input.contractId, paths } };
|
|
38
|
+
return { kind: "refused", refusal: { kind: "worktree-missing" } };
|
|
63
39
|
}
|
|
64
40
|
const captured = await captureWorkspaceTree(repository, workspace);
|
|
65
41
|
const mergeHead = input.captureMergeState === true ? await workspaceMergeHead(repository, workspace) : undefined;
|
|
@@ -68,23 +44,14 @@ export async function captureTender(repository, input) {
|
|
|
68
44
|
data: { ...captured, ...(mergeHead === undefined ? {} : { mergeHead }) },
|
|
69
45
|
};
|
|
70
46
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
export async function dirtyTenderRefusal(repository, contractId, tender) {
|
|
47
|
+
export function dirtyTenderRefusal(tender) {
|
|
48
|
+
const paths = [...new Set([...tender.changes.staged, ...tender.changes.unstaged, ...tender.changes.untracked])];
|
|
75
49
|
return {
|
|
76
50
|
kind: "dirty-workspace",
|
|
77
|
-
|
|
78
|
-
...tender.changes,
|
|
79
|
-
shortStat: await dirtyShortStat(repository, tender),
|
|
51
|
+
...(paths.length === 0 ? {} : { paths }),
|
|
52
|
+
...(tender.changes.submodules.length === 0 ? {} : { submodules: tender.changes.submodules }),
|
|
80
53
|
};
|
|
81
54
|
}
|
|
82
|
-
export async function dirtyTenderDelta(repository, tender) {
|
|
83
|
-
if (!tender.dirty)
|
|
84
|
-
return undefined;
|
|
85
|
-
const { staged, unstaged, untracked } = tender.changes;
|
|
86
|
-
return { staged, unstaged, untracked, shortStat: await dirtyShortStat(repository, tender) };
|
|
87
|
-
}
|
|
88
55
|
async function effectiveConfig(repository, key) {
|
|
89
56
|
try {
|
|
90
57
|
const value = (await executeGit(repository, ["config", "--get", key])).toString("utf8").trim();
|
|
@@ -49,7 +49,7 @@ async function removeTerminalWorktree(repository, topology, path) {
|
|
|
49
49
|
export async function updateRef(repository, ref, desired) {
|
|
50
50
|
const before = await readRef(repository, ref);
|
|
51
51
|
if (before === desired)
|
|
52
|
-
return { kind: "ref", name: ref,
|
|
52
|
+
return { kind: "ref", name: ref, before, after: desired };
|
|
53
53
|
await executeGit(repository, [
|
|
54
54
|
"update-ref",
|
|
55
55
|
"--no-deref",
|
|
@@ -57,21 +57,21 @@ export async function updateRef(repository, ref, desired) {
|
|
|
57
57
|
gitObjectIdForSnapshot(desired),
|
|
58
58
|
before ?? "0".repeat(desired.length),
|
|
59
59
|
]);
|
|
60
|
-
return { kind: "ref", name: ref,
|
|
60
|
+
return { kind: "ref", name: ref, before, after: desired };
|
|
61
61
|
}
|
|
62
62
|
export async function removeRef(repository, ref) {
|
|
63
63
|
const before = await readRef(repository, ref);
|
|
64
64
|
if (before === null)
|
|
65
|
-
return { kind: "ref", name: ref,
|
|
65
|
+
return { kind: "ref", name: ref, before: null, after: null };
|
|
66
66
|
await executeGit(repository, ["update-ref", "--no-deref", "-d", ref, before]);
|
|
67
|
-
return { kind: "ref", name: ref,
|
|
67
|
+
return { kind: "ref", name: ref, before, after: null };
|
|
68
68
|
}
|
|
69
69
|
async function removeRefWithCustody(repository, ref, custodian, expectedCustodian) {
|
|
70
70
|
const before = await readRef(repository, ref);
|
|
71
71
|
if (before === null)
|
|
72
|
-
return { kind: "ref", name: ref,
|
|
72
|
+
return { kind: "ref", name: ref, before: null, after: null };
|
|
73
73
|
if ((await readRef(repository, custodian)) !== expectedCustodian) {
|
|
74
|
-
return { kind: "ref", name: ref,
|
|
74
|
+
return { kind: "ref", name: ref, before, after: before };
|
|
75
75
|
}
|
|
76
76
|
await executeGit(repository, ["update-ref", "--stdin", "--no-deref"], [
|
|
77
77
|
"start",
|
|
@@ -81,10 +81,10 @@ async function removeRefWithCustody(repository, ref, custodian, expectedCustodia
|
|
|
81
81
|
"commit",
|
|
82
82
|
"",
|
|
83
83
|
].join("\n"));
|
|
84
|
-
return { kind: "ref", name: ref,
|
|
84
|
+
return { kind: "ref", name: ref, before, after: null };
|
|
85
85
|
}
|
|
86
86
|
function retainedRefEffect(ref, snapshot) {
|
|
87
|
-
return { kind: "ref", name: ref,
|
|
87
|
+
return { kind: "ref", name: ref, before: snapshot, after: snapshot };
|
|
88
88
|
}
|
|
89
89
|
async function refRows(repository) {
|
|
90
90
|
const output = (await executeGit(repository, ["for-each-ref", "--format=%(refname)%00%(objectname)"])).toString("utf8");
|
|
@@ -142,13 +142,13 @@ async function hasIncomingLanding(repository, channel, state, head) {
|
|
|
142
142
|
function fromPrimaryWorktree(repository) {
|
|
143
143
|
return { ...repository, effectiveCwd: repository.primaryWorktree };
|
|
144
144
|
}
|
|
145
|
-
function complete(effects = [], lag = []
|
|
146
|
-
return
|
|
145
|
+
function complete(effects = [], lag = []) {
|
|
146
|
+
return { effects, lag };
|
|
147
147
|
}
|
|
148
148
|
function retainTerminalWorktree(path, retainedLag, acc) {
|
|
149
149
|
acc.recordEffect({ kind: "worktree", path, action: "unchanged" });
|
|
150
150
|
acc.recordLag(retainedLag);
|
|
151
|
-
return complete(acc.effects, acc.lag
|
|
151
|
+
return complete(acc.effects, acc.lag);
|
|
152
152
|
}
|
|
153
153
|
async function terminalSealExpectations(channel, state) {
|
|
154
154
|
const snapshots = terminalSealSnapshots(state);
|
|
@@ -178,9 +178,7 @@ async function removeSealedTerminalWorktree({ repository, channel, topology, pat
|
|
|
178
178
|
}));
|
|
179
179
|
const effect = {
|
|
180
180
|
kind: "recovery-snapshot",
|
|
181
|
-
action: "created",
|
|
182
181
|
snapshot,
|
|
183
|
-
retention: "ephemeral",
|
|
184
182
|
};
|
|
185
183
|
acc.recordEffect(effect);
|
|
186
184
|
return { snapshot, workspace };
|
|
@@ -195,7 +193,6 @@ async function removeSealedTerminalWorktree({ repository, channel, topology, pat
|
|
|
195
193
|
recovery = await recordRecovery(beforeWorkspace);
|
|
196
194
|
}
|
|
197
195
|
const hookRun = await runDestroyHooks(path, hooks);
|
|
198
|
-
acc.hookRuns.push(...hookRun.runs.map((name) => ({ phase: "destroy", name })));
|
|
199
196
|
if (hookRun.lag !== null)
|
|
200
197
|
return retainTerminalWorktree(path, hookRun.lag, acc);
|
|
201
198
|
const after = await observeTerminalWorkspace(repository, path, expected);
|
|
@@ -219,7 +216,7 @@ async function removeSealedTerminalWorktree({ repository, channel, topology, pat
|
|
|
219
216
|
const removal = await removeTerminalWorktree(repository, topology, path);
|
|
220
217
|
if (removal.retainedLag !== undefined) {
|
|
221
218
|
acc.recordLag(removal.retainedLag);
|
|
222
|
-
return complete(acc.effects, acc.lag
|
|
219
|
+
return complete(acc.effects, acc.lag);
|
|
223
220
|
}
|
|
224
221
|
if (removal.effect !== undefined)
|
|
225
222
|
acc.recordEffect(removal.effect);
|
|
@@ -292,9 +289,9 @@ export async function reconcileTerminalManagedWorktree({ repository, channel, ho
|
|
|
292
289
|
const resolveSeal = async () => await terminalSealExpectations(channel, state);
|
|
293
290
|
if (path === undefined) {
|
|
294
291
|
if (retainTerminalWorktree === true)
|
|
295
|
-
return complete(acc.effects, acc.lag
|
|
292
|
+
return complete(acc.effects, acc.lag);
|
|
296
293
|
await releaseTerminalCustody({ repository: primary, state, resolveSeal, ref, pin, acc });
|
|
297
|
-
return complete(acc.effects, acc.lag
|
|
294
|
+
return complete(acc.effects, acc.lag);
|
|
298
295
|
}
|
|
299
296
|
const expected = await resolveSeal();
|
|
300
297
|
acc.recordEffect(await updateRef(primary, ref, state.delivery?.data.tenderSnapshot ?? state.coordinates.start));
|
|
@@ -320,5 +317,5 @@ export async function reconcileTerminalManagedWorktree({ repository, channel, ho
|
|
|
320
317
|
if (retained !== null)
|
|
321
318
|
return retained;
|
|
322
319
|
await releaseTerminalCustody({ repository: primary, state, resolveSeal: async () => expected, ref, pin, acc });
|
|
323
|
-
return complete(acc.effects, acc.lag
|
|
320
|
+
return complete(acc.effects, acc.lag);
|
|
324
321
|
}
|
|
@@ -3,12 +3,10 @@ import type { ContractState, SnapshotId } from "../core/facts/types.js";
|
|
|
3
3
|
import { type GitObjectId } from "./identity.js";
|
|
4
4
|
import type { GitOid } from "./repository.js";
|
|
5
5
|
import { type GitRepository } from "./process.js";
|
|
6
|
-
export declare const unsealedBytesSchema: z.ZodObject<{
|
|
6
|
+
export declare const unsealedBytesSchema: z.ZodReadonly<z.ZodObject<{
|
|
7
7
|
kind: z.ZodLiteral<"unsealed-bytes">;
|
|
8
8
|
path: z.ZodString;
|
|
9
|
-
|
|
10
|
-
head: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>>;
|
|
11
|
-
}, z.core.$strict>;
|
|
9
|
+
}, z.core.$strict>>;
|
|
12
10
|
type UnsealedBytes = z.infer<typeof unsealedBytesSchema>;
|
|
13
11
|
export type TerminalSealExpectations = Readonly<{
|
|
14
12
|
heads: readonly SnapshotId[];
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { mintedSnapshotInputSchema } from "./identity.js";
|
|
2
1
|
import { z } from "zod";
|
|
3
2
|
import { gitObjectId, gitObjectIdForSnapshot, mintSnapshotId } from "./identity.js";
|
|
4
|
-
import { executeGit } from "./process.js";
|
|
5
3
|
import { captureWorkspaceTree } from "./workspace.js";
|
|
6
4
|
export const unsealedBytesSchema = z
|
|
7
5
|
.object({
|
|
8
6
|
kind: z.literal("unsealed-bytes"),
|
|
9
7
|
path: z.string().refine((value) => value.trim() !== ""),
|
|
10
|
-
paths: z.array(z.string().refine((value) => value.trim() !== "")).readonly(),
|
|
11
|
-
head: mintedSnapshotInputSchema.optional(),
|
|
12
8
|
})
|
|
13
|
-
.strict()
|
|
9
|
+
.strict()
|
|
10
|
+
.readonly();
|
|
14
11
|
export function terminalSealSnapshots(state) {
|
|
15
12
|
return [
|
|
16
13
|
...new Set([
|
|
@@ -70,36 +67,13 @@ export function terminalSealExpectations(state, objects) {
|
|
|
70
67
|
treeBySnapshot,
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
|
-
async function
|
|
74
|
-
const fields = (await executeGit(repository, ["diff", "--name-only", "-z", left, right]))
|
|
75
|
-
.toString("utf8")
|
|
76
|
-
.split("\0");
|
|
77
|
-
if (fields.at(-1) !== "")
|
|
78
|
-
throw new Error("Git tree diff paths are not NUL terminated");
|
|
79
|
-
return fields.slice(0, -1).sort();
|
|
80
|
-
}
|
|
81
|
-
async function unsealedWorkspaceBytes(repository, path, expected, workspace) {
|
|
70
|
+
async function unsealedWorkspaceBytes(path, expected, workspace) {
|
|
82
71
|
const headIsSealed = expected.heads.includes(workspace.head);
|
|
83
|
-
if (workspace.changes.submodules.length > 0)
|
|
84
|
-
return {
|
|
85
|
-
kind: "unsealed-bytes",
|
|
86
|
-
path,
|
|
87
|
-
paths: workspace.changes.submodules,
|
|
88
|
-
...(headIsSealed ? {} : { head: workspace.head }),
|
|
89
|
-
};
|
|
90
|
-
}
|
|
72
|
+
if (workspace.changes.submodules.length > 0)
|
|
73
|
+
return { kind: "unsealed-bytes", path };
|
|
91
74
|
if (headIsSealed && expected.trees.includes(workspace.tree))
|
|
92
75
|
return null;
|
|
93
|
-
|
|
94
|
-
for (const tree of expected.trees)
|
|
95
|
-
alternatives.push(await changedPaths(repository, tree, workspace.tree));
|
|
96
|
-
alternatives.sort((left, right) => left.length - right.length || left.join("\0").localeCompare(right.join("\0")));
|
|
97
|
-
return {
|
|
98
|
-
kind: "unsealed-bytes",
|
|
99
|
-
path,
|
|
100
|
-
paths: alternatives[0] ?? [],
|
|
101
|
-
...(headIsSealed ? {} : { head: workspace.head }),
|
|
102
|
-
};
|
|
76
|
+
return { kind: "unsealed-bytes", path };
|
|
103
77
|
}
|
|
104
78
|
export async function observeTerminalWorkspace(repository, path, expected) {
|
|
105
79
|
const captured = await captureWorkspaceTree(repository, path);
|
|
@@ -109,6 +83,6 @@ export async function observeTerminalWorkspace(repository, path, expected) {
|
|
|
109
83
|
head: captured.head,
|
|
110
84
|
submodules: captured.changes.submodules,
|
|
111
85
|
},
|
|
112
|
-
unsealed: await unsealedWorkspaceBytes(
|
|
86
|
+
unsealed: await unsealedWorkspaceBytes(path, expected, captured),
|
|
113
87
|
};
|
|
114
88
|
}
|
|
@@ -43,59 +43,83 @@ export declare function workspaceMergeHead(repository: GitRepository, workspace:
|
|
|
43
43
|
export declare function workspaceMergeStatePresent(repository: GitRepository, workspace: string): Promise<boolean>;
|
|
44
44
|
/** Sorted unique unmerged index paths from porcelain status. */
|
|
45
45
|
export declare function unmergedWorkspacePaths(repository: GitRepository, workspace: string): Promise<readonly string[]>;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, z.core.$strict
|
|
46
|
+
export declare const conflictRecoverySchema: z.ZodReadonly<z.ZodObject<{
|
|
47
|
+
materialize: z.ZodReadonly<z.ZodObject<{
|
|
48
|
+
kind: z.ZodLiteral<"deliver">;
|
|
49
|
+
materializeConflict: z.ZodLiteral<true>;
|
|
50
|
+
includeDirty: z.ZodLiteral<true>;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
deliver: z.ZodReadonly<z.ZodObject<{
|
|
53
|
+
kind: z.ZodLiteral<"deliver">;
|
|
54
|
+
includeDirty: z.ZodLiteral<true>;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
57
|
type ConflictRecovery = z.infer<typeof conflictRecoverySchema>;
|
|
58
58
|
export declare const conflictRecovery: ConflictRecovery;
|
|
59
|
-
type
|
|
60
|
-
|
|
61
|
-
unmergedPaths: readonly string[];
|
|
62
|
-
handoffBase?: SnapshotId;
|
|
63
|
-
recovery?: ConflictRecovery;
|
|
64
|
-
}>;
|
|
65
|
-
export type ContractWorkspaceObservation = Readonly<{
|
|
66
|
-
kind: "clean" | "dirty";
|
|
67
|
-
location: ContractWorkspaceLocation;
|
|
68
|
-
counts: WorkspaceChangeCounts;
|
|
69
|
-
merge: ContractWorkspaceMerge | null;
|
|
70
|
-
}> | Readonly<{
|
|
71
|
-
kind: "unavailable";
|
|
72
|
-
location: ContractWorkspaceLocation;
|
|
73
|
-
}> | Readonly<{
|
|
74
|
-
kind: "unappointed";
|
|
75
|
-
}> | Readonly<{
|
|
76
|
-
kind: "failed";
|
|
77
|
-
diagnostic: string;
|
|
78
|
-
}>;
|
|
79
|
-
export declare const worktreeWorkspaceSchema: z.ZodObject<{
|
|
59
|
+
export type ContractWorkspaceObservation = z.output<typeof contractWorkspaceObservationSchema>;
|
|
60
|
+
export declare const worktreeWorkspaceSchema: z.ZodReadonly<z.ZodObject<{
|
|
80
61
|
kind: z.ZodLiteral<"worktree">;
|
|
81
62
|
path: z.ZodString;
|
|
82
|
-
}, z.core.$strict
|
|
83
|
-
export declare const
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
export declare const contractWorkspaceObservationSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
65
|
+
kind: z.ZodEnum<{
|
|
66
|
+
clean: "clean";
|
|
67
|
+
dirty: "dirty";
|
|
68
|
+
}>;
|
|
69
|
+
location: z.ZodReadonly<z.ZodObject<{
|
|
70
|
+
kind: z.ZodLiteral<"worktree">;
|
|
71
|
+
path: z.ZodString;
|
|
72
|
+
}, z.core.$strict>>;
|
|
73
|
+
counts: z.ZodReadonly<z.ZodObject<{
|
|
74
|
+
staged: z.ZodNumber;
|
|
75
|
+
unstaged: z.ZodNumber;
|
|
76
|
+
untracked: z.ZodNumber;
|
|
77
|
+
submodules: z.ZodNumber;
|
|
78
|
+
}, z.core.$strict>>;
|
|
79
|
+
merge: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
|
|
80
|
+
head: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
81
|
+
unmergedPaths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
82
|
+
handoffBase: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>>;
|
|
83
|
+
recovery: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
84
|
+
materialize: z.ZodReadonly<z.ZodObject<{
|
|
85
|
+
kind: z.ZodLiteral<"deliver">;
|
|
86
|
+
materializeConflict: z.ZodLiteral<true>;
|
|
87
|
+
includeDirty: z.ZodLiteral<true>;
|
|
88
|
+
}, z.core.$strict>>;
|
|
89
|
+
deliver: z.ZodReadonly<z.ZodObject<{
|
|
90
|
+
kind: z.ZodLiteral<"deliver">;
|
|
91
|
+
includeDirty: z.ZodLiteral<true>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
}, z.core.$strict>>>;
|
|
94
|
+
}, z.core.$strict>>>;
|
|
95
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
96
|
+
kind: z.ZodLiteral<"unavailable">;
|
|
97
|
+
location: z.ZodReadonly<z.ZodObject<{
|
|
98
|
+
kind: z.ZodLiteral<"worktree">;
|
|
99
|
+
path: z.ZodString;
|
|
100
|
+
}, z.core.$strict>>;
|
|
101
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
102
|
+
kind: z.ZodLiteral<"unappointed">;
|
|
103
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
104
|
+
kind: z.ZodLiteral<"failed">;
|
|
105
|
+
diagnostic: z.ZodString;
|
|
106
|
+
}, z.core.$strict>>]>;
|
|
107
|
+
export declare const contractTargetLagSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
84
108
|
kind: z.ZodLiteral<"none">;
|
|
85
|
-
}, z.core.$strict
|
|
109
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
86
110
|
kind: z.ZodLiteral<"unknown">;
|
|
87
|
-
subject: z.
|
|
111
|
+
subject: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
88
112
|
kind: z.ZodLiteral<"worktree">;
|
|
89
113
|
path: z.ZodString;
|
|
90
|
-
}, z.core.$strict
|
|
91
|
-
}, z.core.$strict
|
|
114
|
+
}, z.core.$strict>>>;
|
|
115
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
92
116
|
kind: z.ZodLiteral<"counted">;
|
|
93
117
|
behind: z.ZodNumber;
|
|
94
|
-
subject: z.
|
|
118
|
+
subject: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
95
119
|
kind: z.ZodLiteral<"worktree">;
|
|
96
120
|
path: z.ZodString;
|
|
97
|
-
}, z.core.$strict
|
|
98
|
-
}, z.core.$strict
|
|
121
|
+
}, z.core.$strict>>>;
|
|
122
|
+
}, z.core.$strict>>]>;
|
|
99
123
|
export type ContractTargetLag = z.infer<typeof contractTargetLagSchema>;
|
|
100
124
|
export declare function observeWorkspace(repository: GitRepository, location: ContractWorkspaceLocation, workspace: string): Promise<ContractWorkspaceObservation>;
|
|
101
125
|
export declare function observeTargetLag(repository: GitRepository, workspace: string, head: SnapshotId | null | undefined): Promise<ContractTargetLag>;
|
|
@@ -3,7 +3,7 @@ import { access, mkdtemp, rm } from "node:fs/promises";
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join, resolve } from "node:path";
|
|
5
5
|
import { AuthorityCorruptionError } from "../core/facts/errors.js";
|
|
6
|
-
import { contractPhysicalName, gitObjectId, mintSnapshotId } from "./identity.js";
|
|
6
|
+
import { contractPhysicalName, gitObjectId, mintSnapshotId, snapshotIdSchema } from "./identity.js";
|
|
7
7
|
import { executeGit, GitPlumbingError } from "./process.js";
|
|
8
8
|
import { HANDOFF_RECEIPT_REF_NAMESPACE, readBlob, readRef, readRefs, worktreeGitDirectory, writeBlob, } from "./repository.js";
|
|
9
9
|
const WORKTREE_DIRECTORY = [".keiyaku", "wt"];
|
|
@@ -197,30 +197,61 @@ export async function unmergedWorkspacePaths(repository, workspace) {
|
|
|
197
197
|
return (await workspaceStatus(repository, workspace)).unmergedPaths;
|
|
198
198
|
}
|
|
199
199
|
export const conflictRecoverySchema = z
|
|
200
|
-
.
|
|
201
|
-
materialize: z
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
.strictObject({
|
|
201
|
+
materialize: z
|
|
202
|
+
.strictObject({ kind: z.literal("deliver"), materializeConflict: z.literal(true), includeDirty: z.literal(true) })
|
|
203
|
+
.readonly(),
|
|
204
|
+
deliver: z.strictObject({ kind: z.literal("deliver"), includeDirty: z.literal(true) }).readonly(),
|
|
204
205
|
})
|
|
205
|
-
.
|
|
206
|
+
.readonly();
|
|
206
207
|
export const conflictRecovery = Object.freeze({
|
|
207
|
-
materialize: "deliver
|
|
208
|
-
deliver: "deliver
|
|
209
|
-
staging: "not-required",
|
|
208
|
+
materialize: { kind: "deliver", materializeConflict: true, includeDirty: true },
|
|
209
|
+
deliver: { kind: "deliver", includeDirty: true },
|
|
210
210
|
});
|
|
211
211
|
export const worktreeWorkspaceSchema = z
|
|
212
212
|
.object({ kind: z.literal("worktree"), path: z.string().refine((value) => value.trim() !== "") })
|
|
213
|
-
.strict()
|
|
213
|
+
.strict()
|
|
214
|
+
.readonly();
|
|
215
|
+
export const contractWorkspaceObservationSchema = z.union([
|
|
216
|
+
z
|
|
217
|
+
.strictObject({
|
|
218
|
+
kind: z.enum(["clean", "dirty"]),
|
|
219
|
+
location: worktreeWorkspaceSchema,
|
|
220
|
+
counts: z
|
|
221
|
+
.strictObject({ staged: z.number(), unstaged: z.number(), untracked: z.number(), submodules: z.number() })
|
|
222
|
+
.readonly(),
|
|
223
|
+
merge: z
|
|
224
|
+
.strictObject({
|
|
225
|
+
head: snapshotIdSchema,
|
|
226
|
+
unmergedPaths: z.array(z.string()).readonly(),
|
|
227
|
+
handoffBase: snapshotIdSchema.exactOptional(),
|
|
228
|
+
recovery: conflictRecoverySchema.exactOptional(),
|
|
229
|
+
})
|
|
230
|
+
.readonly()
|
|
231
|
+
.nullable(),
|
|
232
|
+
})
|
|
233
|
+
.readonly(),
|
|
234
|
+
z.strictObject({ kind: z.literal("unavailable"), location: worktreeWorkspaceSchema }).readonly(),
|
|
235
|
+
z.strictObject({ kind: z.literal("unappointed") }).readonly(),
|
|
236
|
+
z.strictObject({ kind: z.literal("failed"), diagnostic: z.string() }).readonly(),
|
|
237
|
+
]);
|
|
214
238
|
export const contractTargetLagSchema = z.union([
|
|
215
|
-
z
|
|
216
|
-
|
|
239
|
+
z
|
|
240
|
+
.object({ kind: z.literal("none") })
|
|
241
|
+
.strict()
|
|
242
|
+
.readonly(),
|
|
243
|
+
z
|
|
244
|
+
.object({ kind: z.literal("unknown"), subject: worktreeWorkspaceSchema.exactOptional() })
|
|
245
|
+
.strict()
|
|
246
|
+
.readonly(),
|
|
217
247
|
z
|
|
218
248
|
.object({
|
|
219
249
|
kind: z.literal("counted"),
|
|
220
250
|
behind: z.number().int().nonnegative(),
|
|
221
|
-
subject: worktreeWorkspaceSchema.
|
|
251
|
+
subject: worktreeWorkspaceSchema.exactOptional(),
|
|
222
252
|
})
|
|
223
|
-
.strict()
|
|
253
|
+
.strict()
|
|
254
|
+
.readonly(),
|
|
224
255
|
]);
|
|
225
256
|
function countsOf(changes) {
|
|
226
257
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
declare const AKUMA_ALIAS: unique symbol;
|
|
2
3
|
declare const AKUMA_GLOB: unique symbol;
|
|
3
4
|
export type AkumaAlias = string & {
|
|
@@ -6,6 +7,7 @@ export type AkumaAlias = string & {
|
|
|
6
7
|
export type AkumaGlob = string & {
|
|
7
8
|
readonly [AKUMA_GLOB]: true;
|
|
8
9
|
};
|
|
10
|
+
export declare const akumaAliasSchema: z.ZodPipe<z.ZodString, z.ZodTransform<AkumaAlias, string>>;
|
|
9
11
|
export declare function parseReadableAkumaAlias(value: string): AkumaAlias;
|
|
10
12
|
export declare function parseAkumaAlias(value: string): AkumaAlias;
|
|
11
13
|
export declare function parseAkumaGlob(value: string): AkumaGlob;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import { MAX_AKUMA_NAME_BYTES, normalizeIdentityStem, validateAkumaName } from "./normalize.js";
|
|
3
|
+
export const akumaAliasSchema = z.string().transform((value, context) => {
|
|
4
|
+
try {
|
|
5
|
+
return parseReadableAkumaAlias(value);
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
context.addIssue({ code: "custom", message: "invalid Akuma alias" });
|
|
9
|
+
return z.NEVER;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
2
12
|
const AKUMA_GLOB_SUFFIX = /^[0-9a-f*]+$/u;
|
|
3
13
|
const LEGACY_AKUMA_ALIAS_PATTERN = /^@[a-z][a-z0-9-]{0,63}$/u;
|
|
4
14
|
// Old alias spellings remain readable, but new bindings use canonical Akuma names.
|
|
@@ -20,12 +30,12 @@ export function parseAkumaAlias(value) {
|
|
|
20
30
|
}
|
|
21
31
|
export function parseAkumaGlob(value) {
|
|
22
32
|
const segments = value.split("/");
|
|
23
|
-
const
|
|
24
|
-
const archetypeProbe =
|
|
33
|
+
const akumaName = segments[1] ?? "";
|
|
34
|
+
const archetypeProbe = akumaName.replaceAll("*", "x");
|
|
25
35
|
if (segments.length !== 3 ||
|
|
26
36
|
segments[0] !== "aku" ||
|
|
27
37
|
!value.includes("*") ||
|
|
28
|
-
|
|
38
|
+
akumaName.length === 0 ||
|
|
29
39
|
normalizeIdentityStem({ source: archetypeProbe }) !== archetypeProbe ||
|
|
30
40
|
!AKUMA_GLOB_SUFFIX.test(segments[2] ?? "")) {
|
|
31
41
|
throw new TypeError("Akuma glob must be aku/<akuma-pattern>/<hex-pattern> and contain *");
|