@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/akuma/akuma.js
CHANGED
|
@@ -2,34 +2,83 @@ import { akumaBirthSchema, akumaCallerKey, decodeAkumaCaller } from "./caller.js
|
|
|
2
2
|
import { readdir, stat } from "node:fs/promises";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { boundedListLimit, projectBoundedList } from "../bounded-list.js";
|
|
5
|
+
import { akumaAliasSchema } from "../identity/selector.js";
|
|
5
6
|
import { rosterListRow } from "./akuma-observe.js";
|
|
6
7
|
import { AkumaOwner } from "./akuma-owner.js";
|
|
7
8
|
import { readSoul } from "./heart/index.js";
|
|
8
|
-
import {
|
|
9
|
+
import { akumaIdFromDirectoryName, akumaIdSchema, akumaPaths, akumaRunRoot, parseAkumaId, pathsForAkumaId, } from "./identity.js";
|
|
9
10
|
import { validateAkumaName } from "../identity/normalize.js";
|
|
10
11
|
import { readAkumaLineage, readDirectAkumaLineage, invalidateAkumaLineage, rebuildAkumaLineage, } from "./lineage-cache.js";
|
|
11
12
|
import { activitySnapshotSchema } from "./projection.js";
|
|
12
13
|
import { PAGE_POOL_SIZE, boundedMap } from "./read-pool.js";
|
|
14
|
+
const bornLifeSchema = z.enum(["running", "asleep", "stranded", "hung", "untidy", "killed"]);
|
|
15
|
+
export const listedBornAkumaSchema = z
|
|
16
|
+
.strictObject({
|
|
17
|
+
id: akumaIdSchema,
|
|
18
|
+
life: bornLifeSchema,
|
|
19
|
+
lifeAt: z.string().exactOptional(),
|
|
20
|
+
lastActivityAt: z.string().exactOptional(),
|
|
21
|
+
pending: z.number().int().positive().exactOptional(),
|
|
22
|
+
aliases: z.array(akumaAliasSchema).nonempty().readonly().exactOptional(),
|
|
23
|
+
parentAkumaId: akumaIdSchema.exactOptional(),
|
|
24
|
+
})
|
|
25
|
+
.readonly();
|
|
26
|
+
export const listedUnbornAkumaSchema = z
|
|
27
|
+
.strictObject({
|
|
28
|
+
id: akumaIdSchema,
|
|
29
|
+
life: z.enum(["unborn", "stillborn"]),
|
|
30
|
+
aliases: z.array(akumaAliasSchema).nonempty().readonly().exactOptional(),
|
|
31
|
+
diagnostic: z.string().exactOptional(),
|
|
32
|
+
})
|
|
33
|
+
.readonly();
|
|
34
|
+
export const listedAkumaSchema = z.union([listedBornAkumaSchema, listedUnbornAkumaSchema]);
|
|
35
|
+
export const akumaListSchema = z
|
|
36
|
+
.strictObject({
|
|
37
|
+
observedAt: z.string(),
|
|
38
|
+
rows: z.array(listedAkumaSchema).nonempty().readonly().exactOptional(),
|
|
39
|
+
more: z.literal(true).exactOptional(),
|
|
40
|
+
})
|
|
41
|
+
.readonly();
|
|
42
|
+
function listedAkuma(row) {
|
|
43
|
+
if (row.kind === "unborn")
|
|
44
|
+
return {
|
|
45
|
+
id: row.id,
|
|
46
|
+
life: row.life,
|
|
47
|
+
...(row.diagnostic === undefined ? {} : { diagnostic: row.diagnostic }),
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
id: row.id,
|
|
51
|
+
life: row.life,
|
|
52
|
+
...(row.lifeAt === undefined ? {} : { lifeAt: row.lifeAt }),
|
|
53
|
+
...(row.lastActivityAt === undefined ? {} : { lastActivityAt: row.lastActivityAt }),
|
|
54
|
+
...(row.pending === undefined ? {} : { pending: row.pending }),
|
|
55
|
+
...(row.caller?.kind === "akuma" ? { parentAkumaId: row.caller.akumaId } : {}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
13
58
|
export const akumaStatusSchema = z
|
|
14
59
|
.object({
|
|
15
60
|
id: akumaIdSchema,
|
|
16
61
|
birth: akumaBirthSchema,
|
|
17
62
|
life: z.enum(["running", "asleep", "stranded", "hung", "untidy", "killed"]),
|
|
18
|
-
cwd: z.string().
|
|
19
|
-
provider: z.string().
|
|
20
|
-
model: z.string().
|
|
63
|
+
cwd: z.string().exactOptional(),
|
|
64
|
+
provider: z.string().exactOptional(),
|
|
65
|
+
model: z.string().exactOptional(),
|
|
66
|
+
lastActivityAt: z.string().exactOptional(),
|
|
21
67
|
timeline: activitySnapshotSchema,
|
|
22
|
-
strandedReason: z.literal("resume-unsupported").
|
|
68
|
+
strandedReason: z.literal("resume-unsupported").exactOptional(),
|
|
23
69
|
})
|
|
24
|
-
.strict()
|
|
70
|
+
.strict()
|
|
71
|
+
.readonly();
|
|
25
72
|
function activityAt(row) {
|
|
26
|
-
if (
|
|
73
|
+
if (row.kind === "unborn")
|
|
27
74
|
return null;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
return
|
|
32
|
-
|
|
75
|
+
const lifeAt = row.lifeAt ?? null;
|
|
76
|
+
const lastActivityAt = row.lastActivityAt ?? null;
|
|
77
|
+
if (lifeAt === null)
|
|
78
|
+
return lastActivityAt;
|
|
79
|
+
if (lastActivityAt === null)
|
|
80
|
+
return lifeAt;
|
|
81
|
+
return lifeAt > lastActivityAt ? lifeAt : lastActivityAt;
|
|
33
82
|
}
|
|
34
83
|
function compareActivity(left, right) {
|
|
35
84
|
if (left === right)
|
|
@@ -76,17 +125,17 @@ export async function knownAkuma(path, selected) {
|
|
|
76
125
|
for (const name of names) {
|
|
77
126
|
let physical;
|
|
78
127
|
try {
|
|
79
|
-
physical =
|
|
128
|
+
physical = akumaIdFromDirectoryName(name);
|
|
80
129
|
}
|
|
81
130
|
catch {
|
|
82
131
|
// The run root can contain bytes not produced by Keiyaku. Preserve them.
|
|
83
132
|
continue;
|
|
84
133
|
}
|
|
85
|
-
if (selected !== undefined && physical.
|
|
134
|
+
if (selected !== undefined && physical.akumaName !== selected)
|
|
86
135
|
continue;
|
|
87
136
|
rows.push({
|
|
88
137
|
id: physical.id,
|
|
89
|
-
paths: akumaPaths({ runRoot,
|
|
138
|
+
paths: akumaPaths({ runRoot, akumaName: physical.akumaName, suffix: physical.suffix }),
|
|
90
139
|
});
|
|
91
140
|
}
|
|
92
141
|
return { runRoot, rows };
|
|
@@ -123,13 +172,13 @@ export async function countRunningAkuma(path) {
|
|
|
123
172
|
function rosterInput(input, allowLimit) {
|
|
124
173
|
if (typeof input !== "object" || input === null || Array.isArray(input))
|
|
125
174
|
throw new TypeError("Akuma list input must be an object");
|
|
126
|
-
const allowed = allowLimit ? ["
|
|
175
|
+
const allowed = allowLimit ? ["akumaName", "caller", "limit"] : ["akumaName", "caller"];
|
|
127
176
|
const unknown = Object.keys(input).find((key) => !allowed.includes(key));
|
|
128
177
|
if (unknown !== undefined)
|
|
129
178
|
throw new TypeError(`Akuma list input has unknown field: ${unknown}`);
|
|
130
179
|
const caller = decodeAkumaCaller(input.caller);
|
|
131
180
|
return {
|
|
132
|
-
...(input.
|
|
181
|
+
...(input.akumaName === undefined ? {} : { akumaName: validateAkumaName(input.akumaName) }),
|
|
133
182
|
...(caller === undefined ? {} : { caller }),
|
|
134
183
|
};
|
|
135
184
|
}
|
|
@@ -142,15 +191,15 @@ function callerClosure(lineage, root, world) {
|
|
|
142
191
|
if (root.kind === "akuma" && root.world !== world)
|
|
143
192
|
return new Set();
|
|
144
193
|
const children = new Map();
|
|
145
|
-
for (const [
|
|
194
|
+
for (const [akumaId, caller] of lineage) {
|
|
146
195
|
if (caller === null)
|
|
147
196
|
continue;
|
|
148
197
|
const key = akumaCallerKey(caller);
|
|
149
198
|
const siblings = children.get(key);
|
|
150
199
|
if (siblings === undefined)
|
|
151
|
-
children.set(key, [
|
|
200
|
+
children.set(key, [akumaId]);
|
|
152
201
|
else
|
|
153
|
-
siblings.push(
|
|
202
|
+
siblings.push(akumaId);
|
|
154
203
|
}
|
|
155
204
|
const included = new Set();
|
|
156
205
|
const visited = new Set();
|
|
@@ -161,11 +210,11 @@ function callerClosure(lineage, root, world) {
|
|
|
161
210
|
if (visited.has(key))
|
|
162
211
|
continue;
|
|
163
212
|
visited.add(key);
|
|
164
|
-
for (const
|
|
165
|
-
if (included.has(
|
|
213
|
+
for (const akumaId of children.get(key) ?? []) {
|
|
214
|
+
if (included.has(akumaId))
|
|
166
215
|
continue;
|
|
167
|
-
included.add(
|
|
168
|
-
queue.push({ kind: "akuma", world,
|
|
216
|
+
included.add(akumaId);
|
|
217
|
+
queue.push({ kind: "akuma", world, akumaId });
|
|
169
218
|
}
|
|
170
219
|
}
|
|
171
220
|
return included;
|
|
@@ -175,21 +224,21 @@ function sameCallerEvidence(left, right) {
|
|
|
175
224
|
return left === right;
|
|
176
225
|
return akumaCallerKey(left) === akumaCallerKey(right);
|
|
177
226
|
}
|
|
178
|
-
async function readCallerSoul(world,
|
|
227
|
+
async function readCallerSoul(world, akumaId) {
|
|
179
228
|
try {
|
|
180
|
-
const soul = await readSoul(
|
|
229
|
+
const soul = await readSoul(pathsForAkumaId(world, akumaId));
|
|
181
230
|
return soul === null ? { kind: "absent" } : { kind: "born", caller: soul.caller ?? null };
|
|
182
231
|
}
|
|
183
232
|
catch {
|
|
184
233
|
return { kind: "unreadable" };
|
|
185
234
|
}
|
|
186
235
|
}
|
|
187
|
-
async function soulEdgeFor(verification,
|
|
188
|
-
const observed = verification.souls.get(
|
|
236
|
+
async function soulEdgeFor(verification, akumaId) {
|
|
237
|
+
const observed = verification.souls.get(akumaId);
|
|
189
238
|
if (observed !== undefined)
|
|
190
239
|
return await observed;
|
|
191
|
-
const pending = readCallerSoul(verification.world,
|
|
192
|
-
verification.souls.set(
|
|
240
|
+
const pending = readCallerSoul(verification.world, akumaId);
|
|
241
|
+
verification.souls.set(akumaId, pending);
|
|
193
242
|
return await pending;
|
|
194
243
|
}
|
|
195
244
|
/**
|
|
@@ -222,7 +271,7 @@ async function verifyCallerMember(verification, id, observedCaller) {
|
|
|
222
271
|
return "excluded";
|
|
223
272
|
if (current.world !== verification.world)
|
|
224
273
|
return "excluded";
|
|
225
|
-
const parentId = current.
|
|
274
|
+
const parentId = current.akumaId;
|
|
226
275
|
const parentCached = lineage.get(parentId);
|
|
227
276
|
const edge = await soulEdgeFor(verification, parentId);
|
|
228
277
|
if (edge.kind === "unreadable")
|
|
@@ -282,7 +331,7 @@ async function pageCallerRows(candidates, limit, admit) {
|
|
|
282
331
|
*/
|
|
283
332
|
async function callerCandidates(rows, lineage, root, world, selected) {
|
|
284
333
|
const closure = callerClosure(lineage, root, world);
|
|
285
|
-
return await freshnessOrdered(rows.filter((row) => closure.has(row.id) && (selected === undefined ||
|
|
334
|
+
return await freshnessOrdered(rows.filter((row) => closure.has(row.id) && (selected === undefined || parseAkumaId(row.id).akumaName === selected)));
|
|
286
335
|
}
|
|
287
336
|
/**
|
|
288
337
|
* One caller-scoped page. The World-local record only proposes members: each is
|
|
@@ -295,7 +344,7 @@ async function readCallerPage(path, limit, selected, caller) {
|
|
|
295
344
|
const verification = { world: path, root: caller, lineage: cached, souls: new Map() };
|
|
296
345
|
const attempted = await pageCallerRows(await callerCandidates(known.rows, cached, caller, path, selected), limit,
|
|
297
346
|
// A cache-proposed identity without a born Soul cannot justify inclusion.
|
|
298
|
-
async (row) => ("
|
|
347
|
+
async (row) => (row.kind === "born" ? await verifyCallerMember(verification, row.id, row.caller) : "invalid-cache"));
|
|
299
348
|
if (!attempted.invalid)
|
|
300
349
|
return attempted;
|
|
301
350
|
// One wrong edge makes the whole disposable record untrustworthy.
|
|
@@ -305,11 +354,19 @@ async function readCallerPage(path, limit, selected, caller) {
|
|
|
305
354
|
await rebuildAkumaLineage(path, direct);
|
|
306
355
|
return repaired;
|
|
307
356
|
}
|
|
357
|
+
/** One roster answer: empty rows and known completeness are both omissions. */
|
|
358
|
+
function rosterResult(observedAt, rows, more) {
|
|
359
|
+
return {
|
|
360
|
+
observedAt,
|
|
361
|
+
...(rows.length === 0 ? {} : { rows: rows.map(listedAkuma) }),
|
|
362
|
+
...(more ? { more: true } : {}),
|
|
363
|
+
};
|
|
364
|
+
}
|
|
308
365
|
/** The bounded recent-activity roster input: native membership and observed extent. */
|
|
309
366
|
export async function readAkumaRoster(path, input = {}) {
|
|
310
367
|
const selection = rosterInput(input, true);
|
|
311
368
|
const limit = boundedListLimit(input.limit);
|
|
312
|
-
return observeAkumaRoster(path, limit, selection.
|
|
369
|
+
return observeAkumaRoster(path, limit, selection.akumaName, selection.caller);
|
|
313
370
|
}
|
|
314
371
|
/**
|
|
315
372
|
* The bounded recent-activity roster: native membership, semantic order and
|
|
@@ -321,31 +378,26 @@ export async function observeAkumaRoster(path, limit, selected, caller) {
|
|
|
321
378
|
if (caller !== undefined) {
|
|
322
379
|
const page = await readCallerPage(path, limit, selected, caller);
|
|
323
380
|
const bounded = projectBoundedList(page.rows, limit);
|
|
324
|
-
return
|
|
325
|
-
observedAt,
|
|
326
|
-
// A skipped or unprovable candidate leaves the extent unknowable, never empty.
|
|
327
|
-
hasMore: bounded.hasMore || page.skipped > 0,
|
|
328
|
-
rows: bounded.rows,
|
|
329
|
-
searched: [akumaRunRoot(path)],
|
|
330
|
-
};
|
|
381
|
+
return rosterResult(observedAt, bounded.rows, bounded.hasMore || page.skipped > 0);
|
|
331
382
|
}
|
|
332
383
|
const known = await knownAkuma(path, selected);
|
|
333
384
|
const ranked = await pageCallerRows(await freshnessOrdered(known.rows), limit);
|
|
334
|
-
|
|
385
|
+
const bounded = projectBoundedList(ranked.rows, limit);
|
|
386
|
+
return rosterResult(observedAt, bounded.rows, bounded.hasMore);
|
|
335
387
|
}
|
|
336
388
|
/** The complete native roster for callers whose semantics require a frozen set. */
|
|
337
389
|
export async function readAkumaCompleteRoster(path, input = {}) {
|
|
338
390
|
const selection = rosterInput(input, false);
|
|
339
391
|
const observedAt = new Date().toISOString();
|
|
340
392
|
if (selection.caller !== undefined) {
|
|
341
|
-
const page = await readCallerPage(path, Number.POSITIVE_INFINITY, selection.
|
|
342
|
-
return { observedAt, rows: page.rows
|
|
393
|
+
const page = await readCallerPage(path, Number.POSITIVE_INFINITY, selection.akumaName, selection.caller);
|
|
394
|
+
return { kind: "akumas", observedAt, rows: page.rows };
|
|
343
395
|
}
|
|
344
|
-
const known = await knownAkuma(path, selection.
|
|
396
|
+
const known = await knownAkuma(path, selection.akumaName);
|
|
345
397
|
return {
|
|
398
|
+
kind: "akumas",
|
|
346
399
|
observedAt,
|
|
347
400
|
rows: [...(await readableRows(known.rows)).rows].sort(compareRows),
|
|
348
|
-
searched: [known.runRoot],
|
|
349
401
|
};
|
|
350
402
|
}
|
|
351
403
|
/** Internal timeline observation for composition owners. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
import type { Settings } from "../settings.js";
|
|
3
3
|
import { type ProviderExecution, type ProviderOptions } from "./provider-recipe.js";
|
|
4
4
|
type DecodedArchetype = Readonly<{
|
|
@@ -9,28 +9,41 @@ type DecodedArchetype = Readonly<{
|
|
|
9
9
|
hidden?: boolean;
|
|
10
10
|
options: ProviderOptions;
|
|
11
11
|
}>;
|
|
12
|
+
export declare const archetypeCatalogRowSchema: z.ZodReadonly<z.ZodObject<{
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
model: z.ZodExactOptional<z.ZodString>;
|
|
15
|
+
description: z.ZodExactOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strict>>;
|
|
17
|
+
export declare const archetypeCatalogSchema: z.ZodReadonly<z.ZodObject<{
|
|
18
|
+
rows: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
model: z.ZodExactOptional<z.ZodString>;
|
|
21
|
+
description: z.ZodExactOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strict>>>>>;
|
|
23
|
+
more: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
24
|
+
}, z.core.$strict>>;
|
|
12
25
|
export type ArchetypeCatalogRow = Readonly<{
|
|
13
26
|
name: string;
|
|
14
27
|
model?: string;
|
|
15
28
|
description?: string;
|
|
16
29
|
}>;
|
|
17
|
-
export type ArchetypeCatalog =
|
|
30
|
+
export type ArchetypeCatalog = z.output<typeof archetypeCatalogSchema>;
|
|
18
31
|
/** One closed catalogue request: omitted project means no project scope, never ambient discovery. */
|
|
19
32
|
export type ArchetypeCatalogInput = Readonly<{
|
|
20
33
|
project?: string;
|
|
21
34
|
home?: string;
|
|
22
35
|
limit?: number;
|
|
23
36
|
}>;
|
|
24
|
-
/** One loaded
|
|
37
|
+
/** One loaded akumaName whose provider owner has decoded its execution but not yet admitted its options. */
|
|
25
38
|
type PreparedArchetype = Omit<DecodedArchetype, "provider"> & Readonly<{
|
|
26
39
|
provider: ProviderExecution;
|
|
27
40
|
}>;
|
|
28
41
|
export declare class AkumaArchetypeError extends Error {
|
|
29
|
-
readonly
|
|
42
|
+
readonly akumaName: string;
|
|
30
43
|
readonly searched: readonly string[];
|
|
31
44
|
readonly reason: string;
|
|
32
45
|
readonly kind = "akuma-archetype";
|
|
33
|
-
constructor(
|
|
46
|
+
constructor(akumaName: string, searched: readonly string[], reason: string, guidance?: string);
|
|
34
47
|
}
|
|
35
48
|
type ArchetypeCoordinates = Readonly<{
|
|
36
49
|
project?: string;
|
|
@@ -38,7 +51,7 @@ type ArchetypeCoordinates = Readonly<{
|
|
|
38
51
|
}>;
|
|
39
52
|
export declare function listArchetypes(input?: ArchetypeCoordinates): Promise<readonly string[]>;
|
|
40
53
|
export declare function listArchetypeDefinitions(input?: ArchetypeCatalogInput): Promise<ArchetypeCatalog>;
|
|
41
|
-
/** Resolve one
|
|
54
|
+
/** Resolve one akumaName and decode its provider execution, leaving option admission to the caller. */
|
|
42
55
|
export declare function loadPreparedArchetype(input: Readonly<{
|
|
43
56
|
name: string;
|
|
44
57
|
project?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import { readFile, readdir } from "node:fs/promises";
|
|
2
3
|
import { homedir } from "node:os";
|
|
3
4
|
import { isAbsolute, join } from "node:path";
|
|
@@ -5,14 +6,23 @@ import { parseDocument } from "yaml";
|
|
|
5
6
|
import { boundedListLimit } from "../bounded-list.js";
|
|
6
7
|
import { validateAkumaName } from "../identity/normalize.js";
|
|
7
8
|
import { decodeProviderOptions, decodeProviderRecipe, } from "./provider-recipe.js";
|
|
9
|
+
export const archetypeCatalogRowSchema = z
|
|
10
|
+
.strictObject({ name: z.string(), model: z.string().exactOptional(), description: z.string().exactOptional() })
|
|
11
|
+
.readonly();
|
|
12
|
+
export const archetypeCatalogSchema = z
|
|
13
|
+
.strictObject({
|
|
14
|
+
rows: z.array(archetypeCatalogRowSchema).nonempty().readonly().exactOptional(),
|
|
15
|
+
more: z.literal(true).exactOptional(),
|
|
16
|
+
})
|
|
17
|
+
.readonly();
|
|
8
18
|
export class AkumaArchetypeError extends Error {
|
|
9
|
-
|
|
19
|
+
akumaName;
|
|
10
20
|
searched;
|
|
11
21
|
reason;
|
|
12
22
|
kind = "akuma-archetype";
|
|
13
|
-
constructor(
|
|
14
|
-
super([`\`${
|
|
15
|
-
this.
|
|
23
|
+
constructor(akumaName, searched, reason, guidance) {
|
|
24
|
+
super([`\`${akumaName}\` ${reason}`, ...(guidance === undefined ? [] : [guidance])].join("\n"));
|
|
25
|
+
this.akumaName = akumaName;
|
|
16
26
|
this.searched = searched;
|
|
17
27
|
this.reason = reason;
|
|
18
28
|
this.name = "AkumaArchetypeError";
|
|
@@ -283,9 +293,10 @@ export async function listArchetypeDefinitions(input = {}) {
|
|
|
283
293
|
...(definition.options.model === undefined ? {} : { model: definition.options.model }),
|
|
284
294
|
...(definition.description === undefined ? {} : { description: definition.description }),
|
|
285
295
|
}));
|
|
296
|
+
const rows = limit === undefined ? visible : visible.slice(0, limit);
|
|
286
297
|
return {
|
|
287
|
-
rows
|
|
288
|
-
|
|
298
|
+
...(rows.length === 0 ? {} : { rows }),
|
|
299
|
+
...(limit !== undefined && visible.length > limit ? { more: true } : {}),
|
|
289
300
|
};
|
|
290
301
|
}
|
|
291
302
|
function record(value) {
|
|
@@ -337,8 +348,13 @@ const BUILTIN_EXECUTIONS = {
|
|
|
337
348
|
function providerExecution(settings, name) {
|
|
338
349
|
const view = settings.namespace("providers");
|
|
339
350
|
if (view.kind === "failed")
|
|
340
|
-
throw new TypeError(view.failures
|
|
341
|
-
|
|
351
|
+
throw new TypeError(view.failures
|
|
352
|
+
.map((failure) => {
|
|
353
|
+
const scope = settings.scopes[failure.scope];
|
|
354
|
+
return `${failure.scope}: ${failure.diagnostic ?? (scope.kind === "failed" ? scope.diagnostic : "providers unavailable")}`;
|
|
355
|
+
})
|
|
356
|
+
.join("; "));
|
|
357
|
+
const selected = view.entries?.[name]?.value;
|
|
342
358
|
if (selected !== undefined)
|
|
343
359
|
return configuredProvider(name, selected);
|
|
344
360
|
const builtin = BUILTIN_EXECUTIONS[name];
|
|
@@ -346,7 +362,7 @@ function providerExecution(settings, name) {
|
|
|
346
362
|
return decodeProviderRecipe({ name, ...builtin });
|
|
347
363
|
throw new TypeError(`unknown provider ${name}`);
|
|
348
364
|
}
|
|
349
|
-
/** Resolve one
|
|
365
|
+
/** Resolve one akumaName and decode its provider execution, leaving option admission to the caller. */
|
|
350
366
|
export async function loadPreparedArchetype(input) {
|
|
351
367
|
const name = validateAkumaName(input.name);
|
|
352
368
|
const definition = await resolveArchetype(name, input, undefined);
|
|
@@ -10,8 +10,8 @@ export declare const bodyLaunchSchema: z.ZodObject<{
|
|
|
10
10
|
log: z.ZodString;
|
|
11
11
|
}, z.core.$strict>;
|
|
12
12
|
seed: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<Omit<Readonly<{
|
|
13
|
-
id: import("./identity.js").
|
|
14
|
-
|
|
13
|
+
id: import("./identity.js").AkumaId;
|
|
14
|
+
akumaName: string;
|
|
15
15
|
description?: string;
|
|
16
16
|
provider: import("./provider-recipe.js").ProviderExecution;
|
|
17
17
|
options: import("./provider-recipe.js").ProviderOptions;
|
package/build/src/akuma/body.js
CHANGED
|
@@ -3,7 +3,7 @@ import { appendFile } from "node:fs/promises";
|
|
|
3
3
|
import { abortableDelay } from "./abort.js";
|
|
4
4
|
import { BodySupervisor } from "./body-supervisor.js";
|
|
5
5
|
import { driveTurn } from "./turn-drive.js";
|
|
6
|
-
import { HeldAkumaLeash, BodyControlledError, breakBody, cancelBodyTurns, decidePendingTellDisposition, drainPendingTells, endTurn, failOpenBoundTurns, finishBodyIfIdle, heartExists, isHeartAbsent, probeLeash,
|
|
6
|
+
import { HeldAkumaLeash, BodyControlledError, breakBody, cancelBodyTurns, decidePendingTellDisposition, drainPendingTells, endTurn, failOpenBoundTurns, finishBodyIfIdle, heartExists, isHeartAbsent, probeLeash, readHeart, readLatestTurnForBody, readOpenBoundTurns, readOpenPendingTellDisposition, readTell, readTurn, readTurnParticipants, resolvePendingTellDisposition, } from "./heart/index.js";
|
|
7
7
|
import { worldRootForAkumaPaths } from "./identity.js";
|
|
8
8
|
import { recordAkumaLineage } from "./lineage-cache.js";
|
|
9
9
|
import { emitPluginSignal } from "../plugin/akuma-signals.js";
|
|
@@ -501,7 +501,7 @@ async function settledWake(paths, tellId, after) {
|
|
|
501
501
|
if (tellId !== undefined && !heart.pending.some((tell) => tell.id === tellId))
|
|
502
502
|
return { kind: "told" };
|
|
503
503
|
if (heart.latestBody !== null && heart.latestBody.sequence > after) {
|
|
504
|
-
return { kind: "pursuing"
|
|
504
|
+
return { kind: "pursuing" };
|
|
505
505
|
}
|
|
506
506
|
return null;
|
|
507
507
|
}
|
|
@@ -546,8 +546,8 @@ export async function wakeRecordedTell(paths, tellId, runtime, signal) {
|
|
|
546
546
|
if (tell === null)
|
|
547
547
|
throw new Error(`recorded Tell ${tellId} is missing from Heart`);
|
|
548
548
|
return {
|
|
549
|
-
admission: { tellId
|
|
550
|
-
row:
|
|
549
|
+
admission: { tellId },
|
|
550
|
+
row: { sequence: tell.sequence, at: tell.recordedAt, text: tell.body },
|
|
551
551
|
wake,
|
|
552
552
|
};
|
|
553
553
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import type { WorldRoot } from "../world.js";
|
|
2
3
|
import { type TellFact } from "./heart/index.js";
|
|
3
|
-
import { type
|
|
4
|
-
import type { TellRow } from "./heart/facts.js";
|
|
4
|
+
import { type AkumaId } from "./identity.js";
|
|
5
5
|
export type CallInitialTell = Readonly<{
|
|
6
6
|
tellId: string;
|
|
7
7
|
body: string;
|
|
@@ -9,51 +9,67 @@ export type CallInitialTell = Readonly<{
|
|
|
9
9
|
initiator?: string;
|
|
10
10
|
}>;
|
|
11
11
|
export type InitialTellAdmissionInput = Readonly<{
|
|
12
|
-
id:
|
|
12
|
+
id: AkumaId;
|
|
13
13
|
initialTell: CallInitialTell;
|
|
14
|
-
contractId?: string;
|
|
15
14
|
signal?: AbortSignal;
|
|
16
15
|
}>;
|
|
17
|
-
export
|
|
18
|
-
kind: "told"
|
|
19
|
-
}
|
|
20
|
-
kind: "held"
|
|
21
|
-
}
|
|
22
|
-
kind: "pursuing"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
export declare const tellWakeSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"told">;
|
|
18
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
19
|
+
kind: z.ZodLiteral<"held">;
|
|
20
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
21
|
+
kind: z.ZodLiteral<"pursuing">;
|
|
22
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"failed">;
|
|
24
|
+
diagnostic: z.ZodString;
|
|
25
|
+
child: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
26
|
+
log: z.ZodReadonly<z.ZodObject<{
|
|
27
|
+
path: z.ZodString;
|
|
28
|
+
}, z.core.$strict>>;
|
|
29
|
+
}, z.core.$strict>>>;
|
|
30
|
+
}, z.core.$strict>>]>;
|
|
31
|
+
export declare const tellResultSchema: z.ZodReadonly<z.ZodObject<{
|
|
32
|
+
admission: z.ZodReadonly<z.ZodObject<{
|
|
33
|
+
tellId: z.ZodString;
|
|
34
|
+
}, z.core.$strict>>;
|
|
35
|
+
row: z.ZodReadonly<z.ZodObject<{
|
|
36
|
+
at: z.ZodString;
|
|
37
|
+
sequence: z.ZodNumber;
|
|
38
|
+
text: z.ZodString;
|
|
39
|
+
}, z.core.$strict>>;
|
|
40
|
+
wake: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<"told">;
|
|
42
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
43
|
+
kind: z.ZodLiteral<"held">;
|
|
44
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
45
|
+
kind: z.ZodLiteral<"pursuing">;
|
|
46
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
47
|
+
kind: z.ZodLiteral<"failed">;
|
|
48
|
+
diagnostic: z.ZodString;
|
|
49
|
+
child: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
50
|
+
log: z.ZodReadonly<z.ZodObject<{
|
|
51
|
+
path: z.ZodString;
|
|
52
|
+
}, z.core.$strict>>;
|
|
53
|
+
}, z.core.$strict>>>;
|
|
54
|
+
}, z.core.$strict>>]>;
|
|
55
|
+
interruption: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
56
|
+
kind: z.ZodLiteral<"completed">;
|
|
57
|
+
bodySequence: z.ZodNumber;
|
|
58
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
59
|
+
kind: z.ZodLiteral<"pending">;
|
|
60
|
+
bodySequence: z.ZodNumber;
|
|
61
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
62
|
+
kind: z.ZodLiteral<"unavailable">;
|
|
63
|
+
bodySequence: z.ZodNumber;
|
|
64
|
+
evidence: z.ZodEnum<{
|
|
65
|
+
hung: "hung";
|
|
66
|
+
untidy: "untidy";
|
|
34
67
|
}>;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export type
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
tellId: string;
|
|
41
|
-
}>;
|
|
42
|
-
row: TellRow;
|
|
43
|
-
wake: TellWake;
|
|
44
|
-
interruption?: Readonly<{
|
|
45
|
-
kind: "completed";
|
|
46
|
-
bodySequence: number;
|
|
47
|
-
putDown: "was-idle" | "self-aborted";
|
|
48
|
-
}> | Readonly<{
|
|
49
|
-
kind: "pending";
|
|
50
|
-
bodySequence: number;
|
|
51
|
-
}> | Readonly<{
|
|
52
|
-
kind: "unavailable";
|
|
53
|
-
bodySequence: number;
|
|
54
|
-
evidence: "hung" | "untidy";
|
|
55
|
-
}>;
|
|
56
|
-
}>;
|
|
68
|
+
}, z.core.$strict>>]>>;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
export type TellWake = z.output<typeof tellWakeSchema>;
|
|
71
|
+
/** The progress receipt carries only the Tell coordinates progress needs; Heart keeps the native row. */
|
|
72
|
+
export type TellResult = z.output<typeof tellResultSchema>;
|
|
57
73
|
export type CallInitialTellAdmission = Readonly<{
|
|
58
74
|
kind: "admitted";
|
|
59
75
|
tell: TellFact;
|
|
@@ -66,7 +82,7 @@ export type CallInitialTellAdmission = Readonly<{
|
|
|
66
82
|
}>;
|
|
67
83
|
export declare function admitCallInitialTell(input: Readonly<{
|
|
68
84
|
world: WorldRoot;
|
|
69
|
-
id:
|
|
85
|
+
id: AkumaId;
|
|
70
86
|
initialTell: CallInitialTell;
|
|
71
87
|
signal?: AbortSignal;
|
|
72
88
|
now?: () => string;
|
|
@@ -1,9 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tellRowSchema } from "./projection.js";
|
|
1
3
|
import { bornStatus, defaultWaitComplete, readWaitComplete, waitForObservation } from "./akuma-observe.js";
|
|
2
4
|
import { recordTell } from "./heart/index.js";
|
|
3
|
-
import {
|
|
5
|
+
import { pathsForAkumaId } from "./identity.js";
|
|
4
6
|
import { BIRTH_TIMEOUT_MS } from "./publication.js";
|
|
7
|
+
export const tellWakeSchema = z.union([
|
|
8
|
+
z.strictObject({ kind: z.literal("told") }).readonly(),
|
|
9
|
+
z.strictObject({ kind: z.literal("held") }).readonly(),
|
|
10
|
+
z.strictObject({ kind: z.literal("pursuing") }).readonly(),
|
|
11
|
+
z
|
|
12
|
+
.strictObject({
|
|
13
|
+
kind: z.literal("failed"),
|
|
14
|
+
diagnostic: z.string(),
|
|
15
|
+
child: z
|
|
16
|
+
.strictObject({
|
|
17
|
+
log: z.strictObject({ path: z.string() }).readonly(),
|
|
18
|
+
})
|
|
19
|
+
.readonly()
|
|
20
|
+
.exactOptional(),
|
|
21
|
+
})
|
|
22
|
+
.readonly(),
|
|
23
|
+
]);
|
|
24
|
+
export const tellResultSchema = z
|
|
25
|
+
.strictObject({
|
|
26
|
+
admission: z.strictObject({ tellId: z.string() }).readonly(),
|
|
27
|
+
row: tellRowSchema.unwrap().pick({ sequence: true, at: true, text: true }).strict().readonly(),
|
|
28
|
+
wake: tellWakeSchema,
|
|
29
|
+
interruption: z
|
|
30
|
+
.union([
|
|
31
|
+
z.strictObject({ kind: z.literal("completed"), bodySequence: z.number() }).readonly(),
|
|
32
|
+
z.strictObject({ kind: z.literal("pending"), bodySequence: z.number() }).readonly(),
|
|
33
|
+
z
|
|
34
|
+
.strictObject({
|
|
35
|
+
kind: z.literal("unavailable"),
|
|
36
|
+
bodySequence: z.number(),
|
|
37
|
+
evidence: z.enum(["hung", "untidy"]),
|
|
38
|
+
})
|
|
39
|
+
.readonly(),
|
|
40
|
+
])
|
|
41
|
+
.exactOptional(),
|
|
42
|
+
})
|
|
43
|
+
.readonly();
|
|
5
44
|
export async function admitCallInitialTell(input) {
|
|
6
|
-
const paths =
|
|
45
|
+
const paths = pathsForAkumaId(input.world, input.id);
|
|
7
46
|
const birth = await waitForObservation({
|
|
8
47
|
timeoutMs: BIRTH_TIMEOUT_MS,
|
|
9
48
|
...(input.signal === undefined ? {} : { signal: input.signal }),
|