@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
|
@@ -1 +1,153 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createdDebtObservationSchema } from "../debt/created-observation.js";
|
|
3
|
+
import { akumaStatusSchema } from "./akuma.js";
|
|
4
|
+
import { compactTimelineSchema } from "./status-projection.js";
|
|
5
|
+
import { diffstatSchema } from "./heart/activity-schema.js";
|
|
6
|
+
import { dispatchAssociationSchema } from "./dispatch-association.js";
|
|
7
|
+
import { killEvidenceSchema } from "./heart/facts.js";
|
|
8
|
+
import { akumaIdSchema, turnHistoryIdSchema } from "./identity.js";
|
|
9
|
+
const createdDebtRowSchema = createdDebtObservationSchema.options[0]
|
|
10
|
+
.unwrap()
|
|
11
|
+
.shape.rows.unwrap()
|
|
12
|
+
.unwrap()
|
|
13
|
+
.element.unwrap()
|
|
14
|
+
.pick({ id: true, title: true, priority: true, disposition: true })
|
|
15
|
+
.readonly();
|
|
16
|
+
export const akumaObservationSchema = z
|
|
17
|
+
.strictObject({
|
|
18
|
+
kind: z.literal("akuma"),
|
|
19
|
+
id: akumaIdSchema,
|
|
20
|
+
life: akumaStatusSchema.unwrap().shape.life,
|
|
21
|
+
cwd: z.string(),
|
|
22
|
+
provider: z.string(),
|
|
23
|
+
model: z.string().exactOptional(),
|
|
24
|
+
timeline: compactTimelineSchema,
|
|
25
|
+
lastActivityAt: z.string().exactOptional(),
|
|
26
|
+
strandedReason: z.literal("resume-unsupported").exactOptional(),
|
|
27
|
+
contract: z.union([dispatchAssociationSchema.options[1], dispatchAssociationSchema.options[2]]).exactOptional(),
|
|
28
|
+
createdDebts: z
|
|
29
|
+
.union([z.array(createdDebtRowSchema).nonempty().readonly(), createdDebtObservationSchema.options[1]])
|
|
30
|
+
.exactOptional(),
|
|
31
|
+
changes: z
|
|
32
|
+
.array(z
|
|
33
|
+
.strictObject({
|
|
34
|
+
path: z.string(),
|
|
35
|
+
diffstat: diffstatSchema.strict().readonly().exactOptional(),
|
|
36
|
+
})
|
|
37
|
+
.readonly())
|
|
38
|
+
.nonempty()
|
|
39
|
+
.readonly()
|
|
40
|
+
.exactOptional(),
|
|
41
|
+
moreChanges: z.literal(true).exactOptional(),
|
|
42
|
+
outsideChanges: z.number().int().positive().exactOptional(),
|
|
43
|
+
})
|
|
44
|
+
.readonly();
|
|
45
|
+
// A wait reports the settled outcome, not the timeline row that carries its event coordinates.
|
|
46
|
+
const waitOutcomeSchema = z.union([
|
|
47
|
+
z.strictObject({ kind: z.literal("answered"), historyId: turnHistoryIdSchema, answer: z.string() }).readonly(),
|
|
48
|
+
z.strictObject({ kind: z.literal("failed"), historyId: turnHistoryIdSchema, diagnostic: z.string() }).readonly(),
|
|
49
|
+
z.strictObject({ kind: z.literal("canceled"), historyId: turnHistoryIdSchema }).readonly(),
|
|
50
|
+
]);
|
|
51
|
+
export const akumaWaitItemSchema = z.union([
|
|
52
|
+
z
|
|
53
|
+
.strictObject({
|
|
54
|
+
kind: z.literal("observed"),
|
|
55
|
+
id: akumaIdSchema,
|
|
56
|
+
life: akumaStatusSchema.unwrap().shape.life,
|
|
57
|
+
pending: z.literal(true).exactOptional(),
|
|
58
|
+
outcome: waitOutcomeSchema.exactOptional(),
|
|
59
|
+
strandedReason: z.literal("resume-unsupported").exactOptional(),
|
|
60
|
+
})
|
|
61
|
+
.readonly(),
|
|
62
|
+
z.strictObject({ kind: z.literal("unobserved"), id: akumaIdSchema, diagnostic: z.string() }).readonly(),
|
|
63
|
+
z.strictObject({ kind: z.literal("missing"), id: akumaIdSchema }).readonly(),
|
|
64
|
+
]);
|
|
65
|
+
export const akumaWaitResultSchema = z
|
|
66
|
+
.strictObject({
|
|
67
|
+
kind: z.literal("akuma"),
|
|
68
|
+
reason: z.enum(["completed", "deadline"]),
|
|
69
|
+
results: z.array(akumaWaitItemSchema).readonly(),
|
|
70
|
+
})
|
|
71
|
+
.readonly();
|
|
72
|
+
export const akumaKillResultSchema = z
|
|
73
|
+
.strictObject({
|
|
74
|
+
results: z.array(z.strictObject({ id: akumaIdSchema, outcome: killEvidenceSchema }).readonly()).readonly(),
|
|
75
|
+
})
|
|
76
|
+
.readonly();
|
|
77
|
+
const bodyPositionSchema = z.number().int().positive();
|
|
78
|
+
const failedWakeSchema = z
|
|
79
|
+
.strictObject({
|
|
80
|
+
kind: z.literal("failed"),
|
|
81
|
+
diagnostic: z.string(),
|
|
82
|
+
logPath: z.string().exactOptional(),
|
|
83
|
+
})
|
|
84
|
+
.readonly();
|
|
85
|
+
export const publicWakeSchema = z.union([z.strictObject({ kind: z.literal("pending") }).readonly(), failedWakeSchema]);
|
|
86
|
+
const settledInterruptSchema = z.union([
|
|
87
|
+
z.strictObject({ kind: z.literal("interrupted"), bodySequence: bodyPositionSchema }).readonly(),
|
|
88
|
+
z
|
|
89
|
+
.strictObject({
|
|
90
|
+
kind: z.literal("unavailable"),
|
|
91
|
+
bodySequence: bodyPositionSchema,
|
|
92
|
+
evidence: z.enum(["hung", "untidy"]),
|
|
93
|
+
})
|
|
94
|
+
.readonly(),
|
|
95
|
+
]);
|
|
96
|
+
const interruptSchema = z.union([
|
|
97
|
+
...settledInterruptSchema.options,
|
|
98
|
+
z.strictObject({ kind: z.literal("pending"), bodySequence: bodyPositionSchema }).readonly(),
|
|
99
|
+
]);
|
|
100
|
+
export const akumaTellResultSchema = z
|
|
101
|
+
.strictObject({
|
|
102
|
+
akumaId: akumaIdSchema,
|
|
103
|
+
tellId: z.string(),
|
|
104
|
+
wake: publicWakeSchema.exactOptional(),
|
|
105
|
+
interrupt: settledInterruptSchema.exactOptional(),
|
|
106
|
+
})
|
|
107
|
+
.readonly();
|
|
108
|
+
export const akumaAskObservationSchema = z.union([
|
|
109
|
+
z.strictObject({ kind: z.literal("answered"), answer: z.json() }).readonly(),
|
|
110
|
+
z.strictObject({ kind: z.literal("answered"), answerUndefined: z.literal(true) }).readonly(),
|
|
111
|
+
z.strictObject({ kind: z.literal("failed"), diagnostic: z.string() }).readonly(),
|
|
112
|
+
z.strictObject({ kind: z.literal("invalid-output"), diagnostic: z.string(), answer: z.string() }).readonly(),
|
|
113
|
+
z.strictObject({ kind: z.literal("unanswered") }).readonly(),
|
|
114
|
+
z.strictObject({ kind: z.literal("deadline") }).readonly(),
|
|
115
|
+
]);
|
|
116
|
+
const askSubject = { akumaId: akumaIdSchema, tellId: z.string(), interrupt: interruptSchema.exactOptional() };
|
|
117
|
+
const settledAskSubject = { ...askSubject, wake: failedWakeSchema.exactOptional() };
|
|
118
|
+
const pendingAskSubject = { ...askSubject, wake: publicWakeSchema.exactOptional() };
|
|
119
|
+
export const akumaAskResultSchema = z.union([
|
|
120
|
+
akumaAskObservationSchema.options[0].unwrap().extend(settledAskSubject).readonly(),
|
|
121
|
+
akumaAskObservationSchema.options[1].unwrap().extend(settledAskSubject).readonly(),
|
|
122
|
+
akumaAskObservationSchema.options[2].unwrap().extend(settledAskSubject).readonly(),
|
|
123
|
+
akumaAskObservationSchema.options[3].unwrap().extend(settledAskSubject).readonly(),
|
|
124
|
+
akumaAskObservationSchema.options[4].unwrap().extend(pendingAskSubject).readonly(),
|
|
125
|
+
akumaAskObservationSchema.options[5].unwrap().extend(pendingAskSubject).readonly(),
|
|
126
|
+
]);
|
|
127
|
+
/** Project this invocation's already observed admission, never reread it. */
|
|
128
|
+
export function compactTellResult(akumaId, tell) {
|
|
129
|
+
const interruption = tell.interruption;
|
|
130
|
+
const wake = tell.wake;
|
|
131
|
+
return {
|
|
132
|
+
akumaId,
|
|
133
|
+
tellId: tell.admission.tellId,
|
|
134
|
+
...(wake.kind === "told"
|
|
135
|
+
? {}
|
|
136
|
+
: {
|
|
137
|
+
wake: wake.kind === "failed"
|
|
138
|
+
? {
|
|
139
|
+
kind: "failed",
|
|
140
|
+
diagnostic: wake.diagnostic,
|
|
141
|
+
...(wake.child === undefined ? {} : { logPath: wake.child.log.path }),
|
|
142
|
+
}
|
|
143
|
+
: { kind: "pending" },
|
|
144
|
+
}),
|
|
145
|
+
...(interruption === undefined
|
|
146
|
+
? {}
|
|
147
|
+
: {
|
|
148
|
+
interrupt: interruption.kind === "completed"
|
|
149
|
+
? { kind: "interrupted", bodySequence: interruption.bodySequence }
|
|
150
|
+
: interruption,
|
|
151
|
+
}),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ActivityRow, type ActivitySnapshot, type OutcomeRow } from "./projection.js";
|
|
3
|
+
export declare const compactToolRowSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
4
|
+
call: z.ZodReadonly<z.ZodObject<{
|
|
5
|
+
kind: z.ZodLiteral<"run">;
|
|
6
|
+
command: z.ZodString;
|
|
7
|
+
}, z.core.$strict>>;
|
|
8
|
+
durationMs: z.ZodExactOptional<z.ZodNumber>;
|
|
9
|
+
kind: z.ZodLiteral<"tool">;
|
|
10
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"active">, z.ZodReadonly<z.ZodObject<{
|
|
11
|
+
message: z.ZodExactOptional<z.ZodString>;
|
|
12
|
+
status: z.ZodEnum<{
|
|
13
|
+
error: "error";
|
|
14
|
+
ok: "ok";
|
|
15
|
+
}>;
|
|
16
|
+
}, z.core.$strict>>]>;
|
|
17
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
18
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
19
|
+
call: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
20
|
+
kind: z.ZodLiteral<"read">;
|
|
21
|
+
path: z.ZodString;
|
|
22
|
+
offset: z.ZodExactOptional<z.ZodNumber>;
|
|
23
|
+
limit: z.ZodExactOptional<z.ZodNumber>;
|
|
24
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
25
|
+
kind: z.ZodLiteral<"search">;
|
|
26
|
+
query: z.ZodString;
|
|
27
|
+
scope: z.ZodExactOptional<z.ZodEnum<{
|
|
28
|
+
content: "content";
|
|
29
|
+
files: "files";
|
|
30
|
+
web: "web";
|
|
31
|
+
}>>;
|
|
32
|
+
path: z.ZodExactOptional<z.ZodString>;
|
|
33
|
+
glob: z.ZodExactOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
35
|
+
kind: z.ZodLiteral<"fileChange">;
|
|
36
|
+
changes: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
37
|
+
path: z.ZodString;
|
|
38
|
+
op: z.ZodEnum<{
|
|
39
|
+
add: "add";
|
|
40
|
+
update: "update";
|
|
41
|
+
delete: "delete";
|
|
42
|
+
unspecified: "unspecified";
|
|
43
|
+
}>;
|
|
44
|
+
diffstat: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
45
|
+
added: z.ZodNumber;
|
|
46
|
+
removed: z.ZodNumber;
|
|
47
|
+
}, z.core.$strict>>>;
|
|
48
|
+
}, z.core.$strict>>>>;
|
|
49
|
+
}, z.core.$strict>>]>;
|
|
50
|
+
kind: z.ZodLiteral<"tool">;
|
|
51
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"active">, z.ZodReadonly<z.ZodObject<{
|
|
52
|
+
message: z.ZodExactOptional<z.ZodString>;
|
|
53
|
+
status: z.ZodEnum<{
|
|
54
|
+
error: "error";
|
|
55
|
+
ok: "ok";
|
|
56
|
+
}>;
|
|
57
|
+
}, z.core.$strict>>]>;
|
|
58
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
59
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
60
|
+
call: z.ZodReadonly<z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"other">;
|
|
62
|
+
input: z.ZodExactOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
kind: z.ZodLiteral<"tool">;
|
|
66
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"active">, z.ZodReadonly<z.ZodObject<{
|
|
67
|
+
message: z.ZodExactOptional<z.ZodString>;
|
|
68
|
+
status: z.ZodEnum<{
|
|
69
|
+
error: "error";
|
|
70
|
+
ok: "ok";
|
|
71
|
+
}>;
|
|
72
|
+
}, z.core.$strict>>]>;
|
|
73
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
74
|
+
}, z.core.$strict>>]>;
|
|
75
|
+
export declare const statusPreviewSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
76
|
+
call: z.ZodReadonly<z.ZodObject<{
|
|
77
|
+
kind: z.ZodLiteral<"run">;
|
|
78
|
+
command: z.ZodString;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
durationMs: z.ZodExactOptional<z.ZodNumber>;
|
|
81
|
+
kind: z.ZodLiteral<"tool">;
|
|
82
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"active">, z.ZodReadonly<z.ZodObject<{
|
|
83
|
+
message: z.ZodExactOptional<z.ZodString>;
|
|
84
|
+
status: z.ZodEnum<{
|
|
85
|
+
error: "error";
|
|
86
|
+
ok: "ok";
|
|
87
|
+
}>;
|
|
88
|
+
}, z.core.$strict>>]>;
|
|
89
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
90
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
91
|
+
call: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
92
|
+
kind: z.ZodLiteral<"read">;
|
|
93
|
+
path: z.ZodString;
|
|
94
|
+
offset: z.ZodExactOptional<z.ZodNumber>;
|
|
95
|
+
limit: z.ZodExactOptional<z.ZodNumber>;
|
|
96
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
97
|
+
kind: z.ZodLiteral<"search">;
|
|
98
|
+
query: z.ZodString;
|
|
99
|
+
scope: z.ZodExactOptional<z.ZodEnum<{
|
|
100
|
+
content: "content";
|
|
101
|
+
files: "files";
|
|
102
|
+
web: "web";
|
|
103
|
+
}>>;
|
|
104
|
+
path: z.ZodExactOptional<z.ZodString>;
|
|
105
|
+
glob: z.ZodExactOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
107
|
+
kind: z.ZodLiteral<"fileChange">;
|
|
108
|
+
changes: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
109
|
+
path: z.ZodString;
|
|
110
|
+
op: z.ZodEnum<{
|
|
111
|
+
add: "add";
|
|
112
|
+
update: "update";
|
|
113
|
+
delete: "delete";
|
|
114
|
+
unspecified: "unspecified";
|
|
115
|
+
}>;
|
|
116
|
+
diffstat: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
117
|
+
added: z.ZodNumber;
|
|
118
|
+
removed: z.ZodNumber;
|
|
119
|
+
}, z.core.$strict>>>;
|
|
120
|
+
}, z.core.$strict>>>>;
|
|
121
|
+
}, z.core.$strict>>]>;
|
|
122
|
+
kind: z.ZodLiteral<"tool">;
|
|
123
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"active">, z.ZodReadonly<z.ZodObject<{
|
|
124
|
+
message: z.ZodExactOptional<z.ZodString>;
|
|
125
|
+
status: z.ZodEnum<{
|
|
126
|
+
error: "error";
|
|
127
|
+
ok: "ok";
|
|
128
|
+
}>;
|
|
129
|
+
}, z.core.$strict>>]>;
|
|
130
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
131
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
132
|
+
call: z.ZodReadonly<z.ZodObject<{
|
|
133
|
+
kind: z.ZodLiteral<"other">;
|
|
134
|
+
input: z.ZodExactOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
name: z.ZodString;
|
|
137
|
+
kind: z.ZodLiteral<"tool">;
|
|
138
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"active">, z.ZodReadonly<z.ZodObject<{
|
|
139
|
+
message: z.ZodExactOptional<z.ZodString>;
|
|
140
|
+
status: z.ZodEnum<{
|
|
141
|
+
error: "error";
|
|
142
|
+
ok: "ok";
|
|
143
|
+
}>;
|
|
144
|
+
}, z.core.$strict>>]>;
|
|
145
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
146
|
+
}, z.core.$strict>>]>, z.ZodReadonly<z.ZodObject<{
|
|
147
|
+
kind: z.ZodLiteral<"thought" | "note" | "said">;
|
|
148
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
149
|
+
text: z.ZodString;
|
|
150
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
151
|
+
kind: z.ZodLiteral<"thought" | "note" | "said">;
|
|
152
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
153
|
+
text: z.ZodString;
|
|
154
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
155
|
+
kind: z.ZodLiteral<"thought" | "note" | "said">;
|
|
156
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
157
|
+
text: z.ZodString;
|
|
158
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
159
|
+
kind: z.ZodLiteral<"report">;
|
|
160
|
+
text: z.ZodString;
|
|
161
|
+
}, z.core.$strict>>]>;
|
|
162
|
+
export declare const compactOutcomeSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
163
|
+
kind: z.ZodLiteral<"answered">;
|
|
164
|
+
answer: z.ZodString;
|
|
165
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
166
|
+
kind: z.ZodLiteral<"failed">;
|
|
167
|
+
diagnostic: z.ZodString;
|
|
168
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
169
|
+
kind: z.ZodLiteral<"canceled">;
|
|
170
|
+
}, z.core.$strict>>]>;
|
|
171
|
+
export declare const compactTimelineSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
172
|
+
kind: z.ZodLiteral<"open">;
|
|
173
|
+
entries: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
174
|
+
call: z.ZodReadonly<z.ZodObject<{
|
|
175
|
+
kind: z.ZodLiteral<"run">;
|
|
176
|
+
command: z.ZodString;
|
|
177
|
+
}, z.core.$strict>>;
|
|
178
|
+
durationMs: z.ZodExactOptional<z.ZodNumber>;
|
|
179
|
+
kind: z.ZodLiteral<"tool">;
|
|
180
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"active">, z.ZodReadonly<z.ZodObject<{
|
|
181
|
+
message: z.ZodExactOptional<z.ZodString>;
|
|
182
|
+
status: z.ZodEnum<{
|
|
183
|
+
error: "error";
|
|
184
|
+
ok: "ok";
|
|
185
|
+
}>;
|
|
186
|
+
}, z.core.$strict>>]>;
|
|
187
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
188
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
189
|
+
call: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
190
|
+
kind: z.ZodLiteral<"read">;
|
|
191
|
+
path: z.ZodString;
|
|
192
|
+
offset: z.ZodExactOptional<z.ZodNumber>;
|
|
193
|
+
limit: z.ZodExactOptional<z.ZodNumber>;
|
|
194
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
195
|
+
kind: z.ZodLiteral<"search">;
|
|
196
|
+
query: z.ZodString;
|
|
197
|
+
scope: z.ZodExactOptional<z.ZodEnum<{
|
|
198
|
+
content: "content";
|
|
199
|
+
files: "files";
|
|
200
|
+
web: "web";
|
|
201
|
+
}>>;
|
|
202
|
+
path: z.ZodExactOptional<z.ZodString>;
|
|
203
|
+
glob: z.ZodExactOptional<z.ZodString>;
|
|
204
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
205
|
+
kind: z.ZodLiteral<"fileChange">;
|
|
206
|
+
changes: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
207
|
+
path: z.ZodString;
|
|
208
|
+
op: z.ZodEnum<{
|
|
209
|
+
add: "add";
|
|
210
|
+
update: "update";
|
|
211
|
+
delete: "delete";
|
|
212
|
+
unspecified: "unspecified";
|
|
213
|
+
}>;
|
|
214
|
+
diffstat: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
215
|
+
added: z.ZodNumber;
|
|
216
|
+
removed: z.ZodNumber;
|
|
217
|
+
}, z.core.$strict>>>;
|
|
218
|
+
}, z.core.$strict>>>>;
|
|
219
|
+
}, z.core.$strict>>]>;
|
|
220
|
+
kind: z.ZodLiteral<"tool">;
|
|
221
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"active">, z.ZodReadonly<z.ZodObject<{
|
|
222
|
+
message: z.ZodExactOptional<z.ZodString>;
|
|
223
|
+
status: z.ZodEnum<{
|
|
224
|
+
error: "error";
|
|
225
|
+
ok: "ok";
|
|
226
|
+
}>;
|
|
227
|
+
}, z.core.$strict>>]>;
|
|
228
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
229
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
230
|
+
call: z.ZodReadonly<z.ZodObject<{
|
|
231
|
+
kind: z.ZodLiteral<"other">;
|
|
232
|
+
input: z.ZodExactOptional<z.ZodString>;
|
|
233
|
+
}, z.core.$strict>>;
|
|
234
|
+
name: z.ZodString;
|
|
235
|
+
kind: z.ZodLiteral<"tool">;
|
|
236
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"active">, z.ZodReadonly<z.ZodObject<{
|
|
237
|
+
message: z.ZodExactOptional<z.ZodString>;
|
|
238
|
+
status: z.ZodEnum<{
|
|
239
|
+
error: "error";
|
|
240
|
+
ok: "ok";
|
|
241
|
+
}>;
|
|
242
|
+
}, z.core.$strict>>]>;
|
|
243
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
244
|
+
}, z.core.$strict>>]>, z.ZodReadonly<z.ZodObject<{
|
|
245
|
+
kind: z.ZodLiteral<"thought" | "note" | "said">;
|
|
246
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
247
|
+
text: z.ZodString;
|
|
248
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
249
|
+
kind: z.ZodLiteral<"thought" | "note" | "said">;
|
|
250
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
251
|
+
text: z.ZodString;
|
|
252
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
253
|
+
kind: z.ZodLiteral<"report">;
|
|
254
|
+
text: z.ZodString;
|
|
255
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
256
|
+
kind: z.ZodLiteral<"call">;
|
|
257
|
+
text: z.ZodString;
|
|
258
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
259
|
+
kind: z.ZodLiteral<"tell">;
|
|
260
|
+
text: z.ZodString;
|
|
261
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
262
|
+
kind: z.ZodLiteral<"pending-tell">;
|
|
263
|
+
text: z.ZodString;
|
|
264
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
265
|
+
kind: z.ZodLiteral<"gap">;
|
|
266
|
+
}, z.core.$strict>>]>>>>;
|
|
267
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
268
|
+
kind: z.ZodLiteral<"idle">;
|
|
269
|
+
entries: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
270
|
+
kind: z.ZodLiteral<"pending-tell">;
|
|
271
|
+
text: z.ZodString;
|
|
272
|
+
}, z.core.$strict>>, z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
273
|
+
kind: z.ZodLiteral<"answered">;
|
|
274
|
+
answer: z.ZodString;
|
|
275
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
276
|
+
kind: z.ZodLiteral<"failed">;
|
|
277
|
+
diagnostic: z.ZodString;
|
|
278
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
279
|
+
kind: z.ZodLiteral<"canceled">;
|
|
280
|
+
}, z.core.$strict>>]>]>>>>;
|
|
281
|
+
}, z.core.$strict>>]>;
|
|
282
|
+
export type StatusPreview = z.output<typeof statusPreviewSchema>;
|
|
283
|
+
export type CompactOutcome = z.output<typeof compactOutcomeSchema>;
|
|
284
|
+
export type CompactTimeline = z.output<typeof compactTimelineSchema>;
|
|
285
|
+
/** Contextual static-read narrowing over the owner's retained projection. */
|
|
286
|
+
export declare function projectStatusPreview(row: ActivityRow): StatusPreview | undefined;
|
|
287
|
+
export declare function projectStatusOutcome(row: OutcomeRow): CompactOutcome;
|
|
288
|
+
export declare function projectStatusTimeline(snapshot: ActivitySnapshot): CompactTimeline;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { outcomeSchema, publicChangeCallSchema, publicFileChangeSchema, publicReadCallSchema, publicRunCallSchema, publicSearchCallSchema, publicToolResultSchema, reportRowSchema, textRowSchema, } from "./projection.js";
|
|
3
|
+
const fileChange = publicFileChangeSchema.unwrap().omit({ patch: true }).readonly();
|
|
4
|
+
const changeCall = publicChangeCallSchema
|
|
5
|
+
.unwrap()
|
|
6
|
+
.extend({ changes: z.array(fileChange).readonly() })
|
|
7
|
+
.readonly();
|
|
8
|
+
const otherCall = z.strictObject({ kind: z.literal("other"), input: z.string().exactOptional() }).readonly();
|
|
9
|
+
const result = publicToolResultSchema.unwrap().pick({ status: true, message: true }).readonly();
|
|
10
|
+
const toolFields = {
|
|
11
|
+
kind: z.literal("tool"),
|
|
12
|
+
state: z.union([z.literal("active"), result]),
|
|
13
|
+
truncated: z.literal(true).exactOptional(),
|
|
14
|
+
};
|
|
15
|
+
export const compactToolRowSchema = z.union([
|
|
16
|
+
z
|
|
17
|
+
.strictObject({ ...toolFields, call: publicRunCallSchema, durationMs: z.number().nonnegative().exactOptional() })
|
|
18
|
+
.readonly(),
|
|
19
|
+
z
|
|
20
|
+
.strictObject({ ...toolFields, call: z.union([publicReadCallSchema, publicSearchCallSchema, changeCall]) })
|
|
21
|
+
.readonly(),
|
|
22
|
+
z.strictObject({ ...toolFields, call: otherCall, name: z.string() }).readonly(),
|
|
23
|
+
]);
|
|
24
|
+
const narration = (kind) => textRowSchema(kind).unwrap().pick({ kind: true, text: true, truncated: true }).readonly();
|
|
25
|
+
const report = reportRowSchema.unwrap().pick({ kind: true, text: true }).readonly();
|
|
26
|
+
export const statusPreviewSchema = z.union([
|
|
27
|
+
compactToolRowSchema,
|
|
28
|
+
narration("said"),
|
|
29
|
+
narration("thought"),
|
|
30
|
+
narration("note"),
|
|
31
|
+
report,
|
|
32
|
+
]);
|
|
33
|
+
export const compactOutcomeSchema = z.union([
|
|
34
|
+
outcomeSchema.options[0].unwrap().omit({ foldedSaidSequence: true }).readonly(),
|
|
35
|
+
outcomeSchema.options[1],
|
|
36
|
+
outcomeSchema.options[2],
|
|
37
|
+
]);
|
|
38
|
+
const pendingInput = z.strictObject({ kind: z.literal("pending-tell"), text: z.string() }).readonly();
|
|
39
|
+
const openEntry = z.union([
|
|
40
|
+
compactToolRowSchema,
|
|
41
|
+
narration("said"),
|
|
42
|
+
narration("note"),
|
|
43
|
+
report,
|
|
44
|
+
z.strictObject({ kind: z.literal("call"), text: z.string() }).readonly(),
|
|
45
|
+
z.strictObject({ kind: z.literal("tell"), text: z.string() }).readonly(),
|
|
46
|
+
pendingInput,
|
|
47
|
+
z.strictObject({ kind: z.literal("gap") }).readonly(),
|
|
48
|
+
]);
|
|
49
|
+
export const compactTimelineSchema = z.union([
|
|
50
|
+
z.strictObject({ kind: z.literal("open"), entries: z.array(openEntry).min(1).readonly().exactOptional() }).readonly(),
|
|
51
|
+
z
|
|
52
|
+
.strictObject({
|
|
53
|
+
kind: z.literal("idle"),
|
|
54
|
+
entries: z
|
|
55
|
+
.array(z.union([pendingInput, compactOutcomeSchema]))
|
|
56
|
+
.min(1)
|
|
57
|
+
.readonly()
|
|
58
|
+
.exactOptional(),
|
|
59
|
+
})
|
|
60
|
+
.readonly(),
|
|
61
|
+
]);
|
|
62
|
+
function projectTool(row) {
|
|
63
|
+
if (row.state === "unsettled")
|
|
64
|
+
return undefined;
|
|
65
|
+
const exit = typeof row.state === "string" ? undefined : row.state.exitCode;
|
|
66
|
+
const message = typeof row.state === "string" ? undefined : row.state.message;
|
|
67
|
+
const diagnostic = exit === undefined || exit === 0
|
|
68
|
+
? message
|
|
69
|
+
: [message, `exit ${exit}`].filter((value) => value !== undefined).join(" · ");
|
|
70
|
+
const state = row.state === "active"
|
|
71
|
+
? "active"
|
|
72
|
+
: { status: row.state.status, ...(diagnostic === undefined ? {} : { message: diagnostic }) };
|
|
73
|
+
const fields = { kind: "tool", state, ...(row.truncated === undefined ? {} : { truncated: row.truncated }) };
|
|
74
|
+
const call = row.call;
|
|
75
|
+
switch (call.kind) {
|
|
76
|
+
case "run":
|
|
77
|
+
return { ...fields, call, ...(row.durationMs === undefined ? {} : { durationMs: row.durationMs }) };
|
|
78
|
+
case "read":
|
|
79
|
+
case "search":
|
|
80
|
+
return { ...fields, call };
|
|
81
|
+
case "fileChange":
|
|
82
|
+
return {
|
|
83
|
+
...fields,
|
|
84
|
+
call: {
|
|
85
|
+
kind: "fileChange",
|
|
86
|
+
changes: call.changes.map(({ op, path, diffstat }) => ({
|
|
87
|
+
op,
|
|
88
|
+
path,
|
|
89
|
+
...(diffstat === undefined ? {} : { diffstat }),
|
|
90
|
+
})),
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
case "other":
|
|
94
|
+
return {
|
|
95
|
+
...fields,
|
|
96
|
+
name: row.name,
|
|
97
|
+
call: {
|
|
98
|
+
kind: "other",
|
|
99
|
+
...(call.input === undefined
|
|
100
|
+
? {}
|
|
101
|
+
: { input: `${call.input.json}${call.input.truncated && !call.input.json.endsWith("…") ? "…" : ""}` }),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Contextual static-read narrowing over the owner's retained projection. */
|
|
107
|
+
export function projectStatusPreview(row) {
|
|
108
|
+
if (row.kind === "tool")
|
|
109
|
+
return projectTool(row);
|
|
110
|
+
if (row.kind === "report")
|
|
111
|
+
return { kind: "report", text: row.text };
|
|
112
|
+
if (row.kind === "said" || row.kind === "thought" || row.kind === "note")
|
|
113
|
+
return {
|
|
114
|
+
kind: row.kind,
|
|
115
|
+
text: row.text,
|
|
116
|
+
...(row.truncated === undefined ? {} : { truncated: row.truncated }),
|
|
117
|
+
};
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
export function projectStatusOutcome(row) {
|
|
121
|
+
const outcome = row.outcome;
|
|
122
|
+
if (outcome.kind === "answered")
|
|
123
|
+
return { kind: "answered", answer: outcome.answer };
|
|
124
|
+
if (outcome.kind === "failed")
|
|
125
|
+
return { kind: "failed", diagnostic: outcome.diagnostic };
|
|
126
|
+
return { kind: "canceled" };
|
|
127
|
+
}
|
|
128
|
+
export function projectStatusTimeline(snapshot) {
|
|
129
|
+
if (snapshot.kind === "unborn")
|
|
130
|
+
return { kind: "idle" };
|
|
131
|
+
if (snapshot.kind === "idle") {
|
|
132
|
+
const ordered = snapshot.entries.flatMap((entry) => entry.kind === "row" && entry.row.kind === "tell" && entry.row.state === "pending"
|
|
133
|
+
? [{ sequence: entry.row.sequence, entry: { kind: "pending-tell", text: entry.row.text } }]
|
|
134
|
+
: []);
|
|
135
|
+
if (snapshot.outcome !== undefined)
|
|
136
|
+
ordered.push({ sequence: snapshot.outcome.sequence, entry: projectStatusOutcome(snapshot.outcome) });
|
|
137
|
+
const entries = ordered.sort((left, right) => left.sequence - right.sequence).map(({ entry }) => entry);
|
|
138
|
+
return { kind: "idle", ...(entries.length === 0 ? {} : { entries }) };
|
|
139
|
+
}
|
|
140
|
+
const entries = snapshot.entries.flatMap((entry) => {
|
|
141
|
+
if (entry.kind === "gap")
|
|
142
|
+
return [{ kind: "gap" }];
|
|
143
|
+
const row = entry.row;
|
|
144
|
+
if (row.kind === "thought")
|
|
145
|
+
return [];
|
|
146
|
+
if (row.kind === "call")
|
|
147
|
+
return [{ kind: "call", text: row.text }];
|
|
148
|
+
if (row.kind === "tell")
|
|
149
|
+
return [{ kind: row.state === "pending" ? "pending-tell" : "tell", text: row.text }];
|
|
150
|
+
const preview = projectStatusPreview(row);
|
|
151
|
+
return preview === undefined || preview.kind === "thought" ? [] : [preview];
|
|
152
|
+
});
|
|
153
|
+
return { kind: "open", ...(entries.length === 0 ? {} : { entries }) };
|
|
154
|
+
}
|
|
@@ -79,8 +79,6 @@ function startProviderAttempt(input, setup) {
|
|
|
79
79
|
execution: {
|
|
80
80
|
akumaId: input.soul.id,
|
|
81
81
|
world: input.world,
|
|
82
|
-
bodySequence: input.bodySequence,
|
|
83
|
-
turnSequence: setup.turnSequence,
|
|
84
82
|
},
|
|
85
83
|
...(setup.runtimeInstructions === undefined ? {} : { runtimeInstructions: setup.runtimeInstructions }),
|
|
86
84
|
...(setup.schemaJson === undefined ? {} : { schemaJson: setup.schemaJson }),
|
|
@@ -130,7 +128,6 @@ async function establishTurnDrive(input, turnSequence, recipe) {
|
|
|
130
128
|
recipe,
|
|
131
129
|
tells: boundTells,
|
|
132
130
|
signal: input.supervisor.signal,
|
|
133
|
-
turnSequence,
|
|
134
131
|
schemaJson,
|
|
135
132
|
runtimeInstructions,
|
|
136
133
|
});
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type AkumaId } from "../akuma/identity.js";
|
|
2
3
|
import { type AkumaAlias } from "../identity/selector.js";
|
|
3
4
|
import type { WorldRoot } from "../world.js";
|
|
5
|
+
export declare const aliasBindingSchema: z.ZodReadonly<z.ZodObject<{
|
|
6
|
+
alias: z.ZodPipe<z.ZodString, z.ZodTransform<AkumaAlias, string>>;
|
|
7
|
+
akumaId: z.ZodPipe<z.ZodString, z.ZodTransform<AkumaId, string>>;
|
|
8
|
+
}, z.core.$strict>>;
|
|
4
9
|
export type AliasBinding = Readonly<{
|
|
5
10
|
alias: AkumaAlias;
|
|
6
|
-
|
|
11
|
+
akumaId: AkumaId;
|
|
7
12
|
}>;
|
|
8
13
|
export type AliasMove = Readonly<{
|
|
9
14
|
alias: AliasBinding;
|
|
10
|
-
previous:
|
|
15
|
+
previous: AkumaId | null;
|
|
11
16
|
}>;
|
|
12
17
|
export declare function nukeAliases(world: WorldRoot): Promise<void>;
|
|
13
18
|
export declare function readAliases(world: WorldRoot): Promise<readonly AliasBinding[]>;
|
|
@@ -25,5 +30,5 @@ export declare function tryAcquireAliasCustody(world: WorldRoot): Promise<HeldAl
|
|
|
25
30
|
export declare function moveAlias(input: Readonly<{
|
|
26
31
|
world: WorldRoot;
|
|
27
32
|
alias: AkumaAlias;
|
|
28
|
-
|
|
33
|
+
akumaId: AkumaId;
|
|
29
34
|
}>): Promise<AliasMove>;
|