@astrosheep/keiyaku 4.5.29 → 4.6.2
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/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +0 -13
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +47 -78
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/references/automation.md +54 -41
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +10 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +27 -9
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +68 -71
- package/build/src/akuma/akuma-call.d.ts +53 -0
- package/build/src/akuma/akuma-call.js +113 -0
- package/build/src/akuma/akuma-instance.d.ts +20 -18
- package/build/src/akuma/akuma-instance.js +65 -175
- package/build/src/akuma/akuma-observe.d.ts +3 -21
- package/build/src/akuma/akuma-observe.js +7 -24
- package/build/src/akuma/{akuma-handle.d.ts → akuma-owner.d.ts} +55 -27
- package/build/src/akuma/{akuma-handle.js → akuma-owner.js} +24 -23
- package/build/src/akuma/akuma-selection-execution.d.ts +51 -0
- package/build/src/akuma/akuma-selection-execution.js +134 -0
- package/build/src/akuma/{fleet-execution.d.ts → akuma-wait.d.ts} +24 -44
- package/build/src/akuma/akuma-wait.js +113 -0
- package/build/src/akuma/akuma.d.ts +35 -89
- package/build/src/akuma/akuma.js +148 -30
- package/build/src/akuma/archetype.d.ts +12 -0
- package/build/src/akuma/archetype.js +47 -19
- package/build/src/akuma/body.d.ts +76 -36
- package/build/src/akuma/body.js +84 -49
- package/build/src/akuma/call-initial-tell.d.ts +131 -22
- package/build/src/akuma/call-initial-tell.js +31 -1
- package/build/src/akuma/call-request.d.ts +237 -31
- package/build/src/akuma/call-request.js +67 -94
- package/build/src/akuma/coordinate.d.ts +15 -5
- package/build/src/akuma/coordinate.js +12 -22
- package/build/src/akuma/dispatch-association.d.ts +1 -1
- package/build/src/akuma/dispatch-association.js +1 -10
- package/build/src/akuma/heart/activity-schema.d.ts +325 -0
- package/build/src/akuma/heart/activity-schema.js +53 -0
- package/build/src/akuma/heart/facts.d.ts +1 -6
- package/build/src/akuma/heart/index.d.ts +3 -1
- package/build/src/akuma/heart/index.js +4 -1
- package/build/src/akuma/heart/rows.d.ts +49 -2
- package/build/src/akuma/heart/rows.js +16 -2
- package/build/src/akuma/heart/soul.d.ts +1 -0
- package/build/src/akuma/heart/soul.js +6 -4
- package/build/src/akuma/heart/tells.d.ts +1 -0
- package/build/src/akuma/heart/tells.js +18 -0
- package/build/src/akuma/identity.d.ts +10 -7
- package/build/src/akuma/identity.js +23 -0
- package/build/src/akuma/index.d.ts +10 -8
- package/build/src/akuma/index.js +2 -2
- package/build/src/akuma/nuke.d.ts +3 -0
- package/build/src/akuma/nuke.js +13 -7
- package/build/src/akuma/projection.d.ts +0 -5
- package/build/src/akuma/projection.js +22 -43
- package/build/src/akuma/provider-recipe.d.ts +58 -13
- package/build/src/akuma/provider-recipe.js +62 -80
- package/build/src/akuma/provider.d.ts +6 -76
- package/build/src/akuma/provider.js +11 -219
- package/build/src/akuma/providers/acp/config.d.ts +2 -0
- package/build/src/akuma/providers/acp/config.js +26 -1
- package/build/src/akuma/providers/acp/core.d.ts +7 -0
- package/build/src/akuma/providers/acp/core.js +49 -18
- package/build/src/akuma/providers/acp/index.js +14 -6
- package/build/src/akuma/providers/grok-build/index.js +44 -13
- package/build/src/akuma/providers/index.d.ts +3 -3
- package/build/src/akuma/providers/index.js +2 -13
- package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +28 -0
- package/build/src/akuma/providers/opencode-sdk/event-stream.js +92 -0
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +0 -1
- package/build/src/akuma/providers/opencode-sdk/index.js +200 -64
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +41 -1
- package/build/src/akuma/providers/opencode-sdk/session.js +69 -2
- package/build/src/akuma/providers/pi/events.js +5 -2
- package/build/src/akuma/providers/pi/index.d.ts +3 -4
- package/build/src/akuma/providers/pi/index.js +99 -45
- package/build/src/akuma/publication.d.ts +84 -3
- package/build/src/akuma/publication.js +145 -2
- package/build/src/akuma/read-pool.d.ts +2 -0
- package/build/src/akuma/read-pool.js +15 -0
- package/build/src/akuma/request-rendezvous.js +10 -0
- package/build/src/akuma/request-serve.js +7 -0
- package/build/src/akuma/request-wire.d.ts +14 -26
- package/build/src/akuma/request-wire.js +4 -0
- package/build/src/akuma/requests.d.ts +0 -2
- package/build/src/akuma/requests.js +0 -17
- package/build/src/akuma/{fleet-observation.d.ts → selection-observation.d.ts} +37 -36
- package/build/src/akuma/selection-observation.js +65 -0
- package/build/src/akuma/{fleet-owner-port.d.ts → selection-owner-port.d.ts} +3 -3
- package/build/src/akuma/{fleet-owner-port.js → selection-owner-port.js} +11 -17
- package/build/src/akuma/{fleet-request.d.ts → selection-request.d.ts} +42 -82
- package/build/src/akuma/{fleet-request.js → selection-request.js} +92 -136
- package/build/src/akuma/turn-drive.js +73 -14
- package/build/src/akuma-body.js +91 -56
- package/build/src/body/amend.d.ts +5 -0
- package/build/src/body/amend.js +26 -50
- package/build/src/body/arc.d.ts +4 -2
- package/build/src/body/arc.js +19 -26
- package/build/src/body/criteria.d.ts +6 -0
- package/build/src/body/criteria.js +37 -0
- package/build/src/body/decode.js +5 -42
- package/build/src/body/region.d.ts +5 -0
- package/build/src/body/region.js +45 -2
- package/build/src/body/render.js +2 -4
- package/build/src/cli/activity.d.ts +26 -0
- package/build/src/cli/activity.js +75 -0
- package/build/src/cli/actor.d.ts +3 -1
- package/build/src/cli/actor.js +15 -2
- package/build/src/cli/commands/akuma-grammar.d.ts +75 -0
- package/build/src/cli/commands/akuma-grammar.js +414 -0
- package/build/src/cli/commands/akuma.d.ts +5 -69
- package/build/src/cli/commands/akuma.js +352 -319
- package/build/src/cli/commands/amend.d.ts +4 -5
- package/build/src/cli/commands/amend.js +1 -2
- package/build/src/cli/commands/bind.d.ts +4 -5
- package/build/src/cli/commands/bind.js +7 -10
- package/build/src/cli/commands/contract-grammar.d.ts +112 -0
- package/build/src/cli/commands/contract-grammar.js +282 -0
- package/build/src/cli/commands/contract-help.d.ts +17 -22
- package/build/src/cli/commands/contract-help.js +37 -24
- package/build/src/cli/commands/contract.d.ts +18 -97
- package/build/src/cli/commands/contract.js +621 -233
- package/build/src/cli/commands/install.d.ts +1 -1
- package/build/src/cli/commands/install.js +2 -2
- package/build/src/cli/commands/task-grammar.d.ts +19 -0
- package/build/src/cli/commands/task-grammar.js +438 -0
- package/build/src/cli/commands/task-query.js +23 -104
- package/build/src/cli/commands/task.d.ts +5 -20
- package/build/src/cli/commands/task.js +414 -364
- package/build/src/cli/coordinates.d.ts +10 -0
- package/build/src/cli/coordinates.js +20 -0
- package/build/src/cli/draft.d.ts +7 -1
- package/build/src/cli/main.js +10 -1
- package/build/src/cli/parse.d.ts +8 -9
- package/build/src/cli/parse.js +62 -62
- package/build/src/cli/render/akuma-activity.d.ts +54 -36
- package/build/src/cli/render/akuma-activity.js +262 -242
- package/build/src/cli/render/akuma-tool.d.ts +8 -4
- package/build/src/cli/render/akuma-tool.js +6 -5
- package/build/src/cli/render/akuma.d.ts +36 -16
- package/build/src/cli/render/akuma.js +65 -132
- package/build/src/cli/render/audit.d.ts +6 -2
- package/build/src/cli/render/audit.js +59 -28
- package/build/src/cli/render/catalog.d.ts +11 -2
- package/build/src/cli/render/catalog.js +75 -95
- package/build/src/cli/render/contract-history.d.ts +3 -1
- package/build/src/cli/render/contract-history.js +215 -22
- package/build/src/cli/render/contract-observation.d.ts +10 -5
- package/build/src/cli/render/contract-observation.js +29 -46
- package/build/src/cli/render/contract.d.ts +10 -3
- package/build/src/cli/render/contract.js +252 -103
- package/build/src/cli/render/effects.d.ts +26 -0
- package/build/src/cli/render/effects.js +41 -0
- package/build/src/cli/render/execution-progress.d.ts +18 -6
- package/build/src/cli/render/execution-progress.js +34 -31
- package/build/src/cli/render/kanshi-akuma.d.ts +1 -2
- package/build/src/cli/render/kanshi-akuma.js +5 -26
- package/build/src/cli/render/kanshi.js +107 -128
- package/build/src/cli/render/marks.d.ts +13 -0
- package/build/src/cli/render/marks.js +74 -0
- package/build/src/cli/render/nuke.js +18 -7
- package/build/src/cli/render/receipt.d.ts +10 -4
- package/build/src/cli/render/receipt.js +124 -44
- package/build/src/cli/render/reconcile.d.ts +5 -0
- package/build/src/cli/render/reconcile.js +152 -0
- package/build/src/cli/render/refusal.d.ts +21 -4
- package/build/src/cli/render/refusal.js +60 -33
- package/build/src/cli/render/region.js +3 -2
- package/build/src/cli/render/settings.js +2 -12
- package/build/src/cli/render/task.d.ts +37 -6
- package/build/src/cli/render/task.js +161 -157
- package/build/src/cli/render/terminal.d.ts +20 -1
- package/build/src/cli/render/terminal.js +92 -18
- package/build/src/cli/runtime.d.ts +32 -8
- package/build/src/cli/runtime.js +157 -165
- package/build/src/cli/selectors.d.ts +5 -2
- package/build/src/cli/selectors.js +11 -3
- package/build/src/cli/streams.d.ts +11 -0
- package/build/src/cli/streams.js +32 -0
- package/build/src/cli/usage.d.ts +2 -0
- package/build/src/cli/usage.js +12 -8
- package/build/src/contract-guidance.js +3 -7
- package/build/src/contract-worktree.d.ts +20 -28
- package/build/src/contract-worktree.js +18 -70
- package/build/src/coordination/durable-file.d.ts +2 -2
- package/build/src/coordination/durable-file.js +0 -27
- package/build/src/core/facts/codec.d.ts +1 -2
- package/build/src/core/facts/codec.js +6 -7
- package/build/src/core/facts/gate.d.ts +0 -1
- package/build/src/core/facts/gate.js +0 -82
- package/build/src/core/facts/types.d.ts +1 -2
- package/build/src/core/verbs/abandon.d.ts +2 -6
- package/build/src/core/verbs/abandon.js +0 -16
- package/build/src/core/verbs/amend.d.ts +0 -1
- package/build/src/core/verbs/amend.js +0 -20
- package/build/src/core/verbs/arc.d.ts +7 -8
- package/build/src/core/verbs/arc.js +2 -19
- package/build/src/core/verbs/attestation.d.ts +2 -6
- package/build/src/core/verbs/attestation.js +0 -16
- package/build/src/core/verbs/bind.d.ts +0 -1
- package/build/src/core/verbs/bind.js +0 -16
- package/build/src/core/verbs/deliver.d.ts +0 -1
- package/build/src/core/verbs/deliver.js +0 -16
- package/build/src/core/verbs/placement.d.ts +2 -1
- package/build/src/core/verbs/placement.js +10 -59
- package/build/src/git/admission.d.ts +6 -4
- package/build/src/git/admission.js +4 -0
- package/build/src/git/hooks.d.ts +55 -30
- package/build/src/git/hooks.js +30 -3
- package/build/src/git/identity.d.ts +6 -0
- package/build/src/git/identity.js +47 -0
- package/build/src/git/integration.d.ts +31 -13
- package/build/src/git/integration.js +32 -1
- package/build/src/git/nuke.d.ts +10 -1
- package/build/src/git/nuke.js +31 -11
- package/build/src/git/observe.js +2 -15
- package/build/src/git/private-state-seat.d.ts +6 -7
- package/build/src/git/private-state-seat.js +8 -6
- package/build/src/git/read-observation.d.ts +6 -1
- package/build/src/git/read-observation.js +81 -46
- package/build/src/git/reconcile.d.ts +117 -40
- package/build/src/git/reconcile.js +169 -40
- package/build/src/git/scratch.d.ts +7 -4
- package/build/src/git/scratch.js +28 -6
- package/build/src/git/target-placement.d.ts +53 -38
- package/build/src/git/target-placement.js +69 -54
- package/build/src/git/tender.d.ts +37 -28
- package/build/src/git/tender.js +39 -0
- package/build/src/git/terminal-reconcile.js +21 -23
- package/build/src/git/terminal-seal.d.ts +8 -6
- package/build/src/git/terminal-seal.js +10 -0
- package/build/src/git/workspace.d.ts +29 -15
- package/build/src/git/workspace.js +28 -2
- package/build/src/identity/normalize.js +19 -6
- package/build/src/index.d.ts +78 -7
- package/build/src/index.js +52 -4
- package/build/src/kanshi/read.d.ts +3 -3
- package/build/src/kanshi/read.js +21 -21
- package/build/src/kanshi/report.d.ts +9 -8
- package/build/src/kanshi/roster.d.ts +2 -0
- package/build/src/kanshi/roster.js +2 -0
- package/build/src/kanshi/select.js +7 -3
- package/build/src/library/address.d.ts +3 -7
- package/build/src/library/address.js +7 -7
- package/build/src/library/akuma-creation.d.ts +21 -32
- package/build/src/library/akuma-creation.js +148 -165
- package/build/src/library/akumas.d.ts +20 -22
- package/build/src/library/akumas.js +43 -20
- package/build/src/library/bind.d.ts +107 -13
- package/build/src/library/bind.js +29 -23
- package/build/src/library/continuation.d.ts +556 -28
- package/build/src/library/continuation.js +29 -54
- package/build/src/library/contract-composition.d.ts +40 -0
- package/build/src/library/contract-composition.js +105 -0
- package/build/src/library/contract-creation.d.ts +7 -0
- package/build/src/library/contract-creation.js +192 -0
- package/build/src/library/contract-execution.d.ts +29 -40
- package/build/src/library/contract-execution.js +503 -128
- package/build/src/library/contract-operations.d.ts +275 -134
- package/build/src/library/contract-operations.js +83 -92
- package/build/src/library/contract-outcomes.d.ts +71 -0
- package/build/src/library/contract-outcomes.js +32 -0
- package/build/src/library/contract-settings.d.ts +25 -0
- package/build/src/library/contract-settings.js +135 -0
- package/build/src/library/contract-types.d.ts +17 -38
- package/build/src/library/delivery.d.ts +530 -10
- package/build/src/library/delivery.js +20 -45
- package/build/src/library/input.d.ts +3 -1
- package/build/src/library/input.js +11 -16
- package/build/src/library/invocation.d.ts +87 -0
- package/build/src/library/invocation.js +290 -0
- package/build/src/library/keiyaku.d.ts +45 -22
- package/build/src/library/keiyaku.js +134 -8
- package/build/src/library/nuke.d.ts +2 -11
- package/build/src/library/nuke.js +70 -57
- package/build/src/library/outcome.d.ts +13196 -0
- package/build/src/library/outcome.js +487 -0
- package/build/src/library/reconcile.d.ts +96 -24
- package/build/src/library/reconcile.js +102 -42
- package/build/src/library/refusal.d.ts +470 -42
- package/build/src/library/refusal.js +55 -143
- package/build/src/library/region.d.ts +15 -7
- package/build/src/library/region.js +23 -3
- package/build/src/library/repo.d.ts +2 -12
- package/build/src/library/repo.js +1 -22
- package/build/src/library/selection.d.ts +121 -0
- package/build/src/library/{fleet.js → selection.js} +169 -152
- package/build/src/plugin/public.d.ts +2 -0
- package/build/src/protocol/abandon.d.ts +2 -2
- package/build/src/protocol/abandon.js +1 -0
- package/build/src/protocol/amend.js +1 -0
- package/build/src/protocol/arc.d.ts +6 -4
- package/build/src/protocol/attempt.d.ts +4 -2
- package/build/src/protocol/attempt.js +10 -0
- package/build/src/protocol/audit.d.ts +255 -52
- package/build/src/protocol/audit.js +63 -5
- package/build/src/protocol/bind.d.ts +18 -17
- package/build/src/protocol/bind.js +9 -28
- package/build/src/protocol/completion.d.ts +256 -22
- package/build/src/protocol/completion.js +100 -12
- package/build/src/protocol/deliver.d.ts +34 -23
- package/build/src/protocol/deliver.js +39 -25
- package/build/src/protocol/execution-observation.d.ts +36 -37
- package/build/src/protocol/execution-observation.js +7 -9
- package/build/src/protocol/intent.d.ts +101 -30
- package/build/src/protocol/intent.js +74 -1
- package/build/src/protocol/operations.d.ts +570 -64
- package/build/src/protocol/operations.js +189 -9
- package/build/src/protocol/outcome.d.ts +2 -1
- package/build/src/protocol/placement.d.ts +2 -2
- package/build/src/protocol/placement.js +3 -1
- package/build/src/protocol/progress.d.ts +108 -65
- package/build/src/protocol/progress.js +82 -132
- package/build/src/protocol/read/status.d.ts +4 -3
- package/build/src/protocol/read/status.js +6 -5
- package/build/src/protocol/reconcile.d.ts +3 -3
- package/build/src/protocol/reconcile.js +4 -0
- package/build/src/protocol/reintegrate.d.ts +2 -2
- package/build/src/protocol/review.d.ts +30 -12
- package/build/src/protocol/review.js +15 -24
- package/build/src/protocol/run.d.ts +34 -5
- package/build/src/protocol/run.js +24 -12
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +0 -10
- package/build/src/settings.js +0 -76
- package/build/src/settlement/holder.d.ts +1 -1
- package/build/src/settlement/settle.d.ts +25 -16
- package/build/src/settlement/settle.js +80 -20
- package/build/src/task/board.d.ts +3 -1
- package/build/src/task/board.js +13 -17
- package/build/src/task/catalog.d.ts +0 -4
- package/build/src/task/catalog.js +0 -15
- package/build/src/task/compose-language.d.ts +19 -9
- package/build/src/task/compose-language.js +30 -20
- package/build/src/task/compose.d.ts +7 -37
- package/build/src/task/compose.js +20 -2
- package/build/src/task/created-observation.d.ts +0 -1
- package/build/src/task/created-observation.js +1 -4
- package/build/src/task/document.d.ts +12 -2
- package/build/src/task/document.js +4 -0
- package/build/src/task/identity.d.ts +4 -1
- package/build/src/task/identity.js +21 -17
- package/build/src/task/index.d.ts +36 -16
- package/build/src/task/index.js +103 -96
- package/build/src/task/lifecycle-operations.d.ts +1 -1
- package/build/src/task/mutation-result.d.ts +647 -586
- package/build/src/task/mutation-result.js +79 -46
- package/build/src/task/mutation.d.ts +298 -270
- package/build/src/task/mutation.js +93 -110
- package/build/src/task/operation-types.d.ts +6 -49
- package/build/src/task/operations.d.ts +2 -1
- package/build/src/task/operations.js +35 -12
- package/build/src/task/query.d.ts +9 -3
- package/build/src/task/query.js +42 -16
- package/build/src/task/store.d.ts +2 -1
- package/build/src/task/store.js +10 -14
- package/build/src/verification/declaration.d.ts +0 -1
- package/build/src/verification/declaration.js +1 -18
- package/build/src/verification/execution.d.ts +6 -2
- package/build/src/verification/observation.d.ts +1 -1
- package/package.json +2 -18
- package/build/src/akuma/akuma-product.d.ts +0 -58
- package/build/src/akuma/akuma-product.js +0 -276
- package/build/src/akuma/fleet-execution.js +0 -234
- package/build/src/akuma/fleet-observation.js +0 -97
- package/build/src/cli/accepted.d.ts +0 -24
- package/build/src/cli/accepted.js +0 -167
- package/build/src/cli/catalog.d.ts +0 -45
- package/build/src/cli/catalog.js +0 -1
- package/build/src/cli/commands/akuma-invoke.d.ts +0 -114
- package/build/src/cli/commands/akuma-invoke.js +0 -375
- package/build/src/cli/commands/contract-invoke.d.ts +0 -34
- package/build/src/cli/commands/contract-invoke.js +0 -259
- package/build/src/cli/commands/nuke.d.ts +0 -10
- package/build/src/cli/commands/nuke.js +0 -20
- package/build/src/cli/commands/status-set.d.ts +0 -4
- package/build/src/cli/commands/status-set.js +0 -52
- package/build/src/cli/commands/task-invoke.d.ts +0 -49
- package/build/src/cli/commands/task-invoke.js +0 -306
- package/build/src/cli/invoke.d.ts +0 -27
- package/build/src/cli/invoke.js +0 -521
- package/build/src/cli/render/board.d.ts +0 -3
- package/build/src/cli/render/board.js +0 -25
- package/build/src/cli/render/status-set.d.ts +0 -5
- package/build/src/cli/render/status-set.js +0 -19
- package/build/src/cli/render/text.d.ts +0 -3
- package/build/src/cli/render/text.js +0 -33
- package/build/src/cli/result.d.ts +0 -240
- package/build/src/cli/result.js +0 -1
- package/build/src/git/result-codec.d.ts +0 -29
- package/build/src/git/result-codec.js +0 -309
- package/build/src/kanshi/fleet.d.ts +0 -6
- package/build/src/kanshi/fleet.js +0 -27
- package/build/src/library/audit.d.ts +0 -29
- package/build/src/library/audit.js +0 -41
- package/build/src/library/composition.d.ts +0 -15
- package/build/src/library/composition.js +0 -28
- package/build/src/library/configuration.d.ts +0 -4
- package/build/src/library/configuration.js +0 -2
- package/build/src/library/contract-bind.d.ts +0 -31
- package/build/src/library/contract-bind.js +0 -140
- package/build/src/library/contract-forwarding.d.ts +0 -55
- package/build/src/library/contract-forwarding.js +0 -67
- package/build/src/library/contract-handle.d.ts +0 -50
- package/build/src/library/contract-handle.js +0 -385
- package/build/src/library/contract.d.ts +0 -46
- package/build/src/library/contract.js +0 -73
- package/build/src/library/execution-result.d.ts +0 -243
- package/build/src/library/execution-result.js +0 -101
- package/build/src/library/execution.d.ts +0 -8
- package/build/src/library/execution.js +0 -102
- package/build/src/library/fleet.d.ts +0 -83
- package/build/src/library/mutation.d.ts +0 -501
- package/build/src/library/mutation.js +0 -248
- package/build/src/library/result-codec.d.ts +0 -2
- package/build/src/library/result-codec.js +0 -12
- package/build/src/protocol/result-codec.d.ts +0 -23
- package/build/src/protocol/result-codec.js +0 -488
- package/build/src/settlement/result-codec.d.ts +0 -2
- package/build/src/settlement/result-codec.js +0 -56
- package/build/src/task/public.d.ts +0 -2
- package/build/src/task/public.js +0 -1
package/build/src/settings.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readFile, realpath } from "node:fs/promises";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
|
-
import { gateWord } from "./core/facts/types.js";
|
|
5
4
|
export class SettingsError extends Error {
|
|
6
5
|
kind = "settings";
|
|
7
6
|
constructor(message) {
|
|
@@ -129,78 +128,3 @@ export async function projectSettings(root) {
|
|
|
129
128
|
state: { kind: "absent" },
|
|
130
129
|
});
|
|
131
130
|
}
|
|
132
|
-
function namespaceFailure(view) {
|
|
133
|
-
if (view.kind !== "failed")
|
|
134
|
-
throw new Error("settings namespace failure expected");
|
|
135
|
-
throw new SettingsError(view.failures.map((failure) => `${failure.scope}: ${failure.diagnostic}`).join("; "));
|
|
136
|
-
}
|
|
137
|
-
function bundleGates(name, value) {
|
|
138
|
-
if (!object(value))
|
|
139
|
-
throw new SettingsError(`gate bundle '${name}' must be an object`);
|
|
140
|
-
if (value.kind !== "bundle") {
|
|
141
|
-
throw new SettingsError(`gate bundle '${name}' has unsupported kind: ${String(value.kind)}`);
|
|
142
|
-
}
|
|
143
|
-
for (const field of Object.keys(value)) {
|
|
144
|
-
if (field !== "kind" && field !== "gates") {
|
|
145
|
-
throw new SettingsError(`gate bundle '${name}' has unknown field: ${field}`);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (!Array.isArray(value.gates)) {
|
|
149
|
-
throw new SettingsError(`gate bundle '${name}'.gates must be an array`);
|
|
150
|
-
}
|
|
151
|
-
return value.gates.map((gate) => {
|
|
152
|
-
if (!gateWord(gate)) {
|
|
153
|
-
throw new SettingsError(`gate bundle '${name}' contains an invalid gate word`);
|
|
154
|
-
}
|
|
155
|
-
return gate;
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
export function gatesFrom(input) {
|
|
159
|
-
if (!object(input))
|
|
160
|
-
throw new TypeError("gatesFrom input must be an object");
|
|
161
|
-
if (input.names !== undefined && !Array.isArray(input.names)) {
|
|
162
|
-
throw new TypeError("gatesFrom names must be an array");
|
|
163
|
-
}
|
|
164
|
-
const names = input.names ?? ["default"];
|
|
165
|
-
for (const name of names) {
|
|
166
|
-
if (!gateWord(name))
|
|
167
|
-
throw new SettingsError("gate or bundle name must match ^[a-z][a-z0-9-]{0,63}$");
|
|
168
|
-
}
|
|
169
|
-
if (names.length === 0)
|
|
170
|
-
return Object.freeze([]);
|
|
171
|
-
const view = input.settings.namespace("gates");
|
|
172
|
-
if (view.kind === "failed")
|
|
173
|
-
namespaceFailure(view);
|
|
174
|
-
const expanded = [];
|
|
175
|
-
const seen = new Set();
|
|
176
|
-
for (const name of names) {
|
|
177
|
-
const selected = view.entries.find((entry) => entry.name === name);
|
|
178
|
-
const gates = selected === undefined ? [input.names === undefined ? "reviewed" : name] : bundleGates(name, selected.value);
|
|
179
|
-
for (const gate of gates) {
|
|
180
|
-
if (seen.has(gate))
|
|
181
|
-
continue;
|
|
182
|
-
seen.add(gate);
|
|
183
|
-
expanded.push(gate);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return Object.freeze(expanded);
|
|
187
|
-
}
|
|
188
|
-
export function requireBranchesToBeUpToDateFrom(input) {
|
|
189
|
-
if (!object(input))
|
|
190
|
-
throw new TypeError("requireBranchesToBeUpToDateFrom input must be an object");
|
|
191
|
-
const view = input.settings.namespace("git");
|
|
192
|
-
if (view.kind === "failed")
|
|
193
|
-
namespaceFailure(view);
|
|
194
|
-
for (const entry of view.entries) {
|
|
195
|
-
if (entry.name !== "requireBranchesToBeUpToDate") {
|
|
196
|
-
throw new SettingsError(`git has unknown entry: ${entry.name}`);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
const selected = view.entries.find((entry) => entry.name === "requireBranchesToBeUpToDate");
|
|
200
|
-
if (selected === undefined)
|
|
201
|
-
return false;
|
|
202
|
-
if (typeof selected.value !== "boolean") {
|
|
203
|
-
throw new SettingsError("git.requireBranchesToBeUpToDate must be a boolean");
|
|
204
|
-
}
|
|
205
|
-
return selected.value;
|
|
206
|
-
}
|
|
@@ -17,7 +17,7 @@ export declare function claimTaskHolder(taskId: TaskId, owner: ContractId): Tree
|
|
|
17
17
|
type AdmissionOutcome = Readonly<{
|
|
18
18
|
kind: string;
|
|
19
19
|
}>;
|
|
20
|
-
|
|
20
|
+
type TaskHolderAdmission<T extends AdmissionOutcome> = Readonly<{
|
|
21
21
|
kind: "completed";
|
|
22
22
|
result: T;
|
|
23
23
|
}> | Readonly<{
|
|
@@ -1,33 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import { type ContractId, type ContractState } from "../core/facts/types.js";
|
|
2
3
|
import { type PrivateStateSeatCloseLag } from "../git/private-state-seat.js";
|
|
3
4
|
import type { GitDecodeChannel } from "../git/read-observation.js";
|
|
4
5
|
import type { Effect } from "../git/reconcile.js";
|
|
5
|
-
import type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
import { type GitRepository } from "../git/process.js";
|
|
7
|
+
export declare const settlementActionSchema: z.ZodObject<{
|
|
8
|
+
kind: z.ZodLiteral<"task">;
|
|
9
|
+
taskId: z.ZodPipe<z.ZodString, z.ZodTransform<`task/${string}`, string>>;
|
|
10
|
+
action: z.ZodLiteral<"done">;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type SettlementAction = z.infer<typeof settlementActionSchema>;
|
|
13
|
+
export declare const settlementLagSchema: z.ZodObject<{
|
|
14
|
+
kind: z.ZodLiteral<"settlement-failed">;
|
|
15
|
+
surface: z.ZodEnum<{
|
|
16
|
+
task: "task";
|
|
17
|
+
"task-holder": "task-holder";
|
|
18
|
+
}>;
|
|
19
|
+
contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
20
|
+
taskId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`task/${string}`, string>>>;
|
|
21
|
+
path: z.ZodOptional<z.ZodString>;
|
|
22
|
+
diagnostic: z.ZodString;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export type SettlementLag = z.infer<typeof settlementLagSchema>;
|
|
21
25
|
export type SettlementReport = Readonly<{
|
|
22
26
|
actions: readonly SettlementAction[];
|
|
23
27
|
lags: readonly SettlementLag[];
|
|
24
28
|
seatClose?: readonly PrivateStateSeatCloseLag[];
|
|
25
29
|
}>;
|
|
30
|
+
type SettlementProgress = Readonly<{
|
|
31
|
+
recordSettlement(contractId: ContractId, report: SettlementReport): void;
|
|
32
|
+
}>;
|
|
26
33
|
export type SettlementInput = Readonly<{
|
|
27
34
|
repository: GitRepository;
|
|
28
35
|
channel: GitDecodeChannel;
|
|
29
36
|
state: ContractState | null;
|
|
30
37
|
effects: readonly Effect[];
|
|
38
|
+
progress?: SettlementProgress;
|
|
31
39
|
}>;
|
|
32
40
|
export type SettlementBatchInput = Readonly<{
|
|
33
41
|
repository: GitRepository;
|
|
@@ -36,3 +44,4 @@ export type SettlementBatchInput = Readonly<{
|
|
|
36
44
|
}>;
|
|
37
45
|
export declare function settle(input: SettlementInput): Promise<SettlementReport>;
|
|
38
46
|
export declare function settleAll(input: SettlementBatchInput): Promise<readonly SettlementReport[]>;
|
|
47
|
+
export {};
|
|
@@ -1,10 +1,38 @@
|
|
|
1
|
+
import { contractIdSchema } from "../git/identity.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { taskIdSchema } from "../task/identity.js";
|
|
1
4
|
import { observeContractsForAdmissionAt } from "../git/observe.js";
|
|
2
5
|
import { appendPrivateStateSeatClose, withPrivateStatePublicationSeat, } from "../git/private-state-seat.js";
|
|
6
|
+
import { GitPlumbingError } from "../git/process.js";
|
|
7
|
+
import { SqliteTransactionLockError } from "../coordination/sqlite-transaction-lock.js";
|
|
8
|
+
import { AuthorityCorruptionError } from "../core/facts/errors.js";
|
|
3
9
|
import { settleTask } from "../task/operations.js";
|
|
4
10
|
import { publishTaskHolderRelease, readTaskHolderProjectionFromDecision, taskHolderObservationSelection, } from "./holder.js";
|
|
5
11
|
import { acquireTaskSettlementFence } from "./fence.js";
|
|
6
12
|
import { World } from "../world.js";
|
|
7
|
-
export
|
|
13
|
+
export const settlementActionSchema = z
|
|
14
|
+
.object({ kind: z.literal("task"), taskId: taskIdSchema, action: z.literal("done") })
|
|
15
|
+
.strict();
|
|
16
|
+
export const settlementLagSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
kind: z.literal("settlement-failed"),
|
|
19
|
+
surface: z.enum(["task-holder", "task"]),
|
|
20
|
+
contractId: contractIdSchema,
|
|
21
|
+
taskId: taskIdSchema.optional(),
|
|
22
|
+
path: z
|
|
23
|
+
.string()
|
|
24
|
+
.refine((value) => value.trim() !== "")
|
|
25
|
+
.optional(),
|
|
26
|
+
diagnostic: z.string().refine((value) => value.trim() !== ""),
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
29
|
+
function operational(error) {
|
|
30
|
+
return (error instanceof Error &&
|
|
31
|
+
!(error instanceof AuthorityCorruptionError) &&
|
|
32
|
+
(error instanceof GitPlumbingError ||
|
|
33
|
+
error instanceof SqliteTransactionLockError ||
|
|
34
|
+
("code" in error && typeof error.code === "string" && /^E[A-Z0-9]+$/u.test(error.code))));
|
|
35
|
+
}
|
|
8
36
|
function diagnostic(error) {
|
|
9
37
|
return error instanceof Error ? error.message : String(error);
|
|
10
38
|
}
|
|
@@ -13,8 +41,16 @@ function taskFailure(result) {
|
|
|
13
41
|
? `Task settlement requires retry: ${result.reason}`
|
|
14
42
|
: `Task settlement refused: ${JSON.stringify(result.refusal)}`;
|
|
15
43
|
}
|
|
44
|
+
function recordLag(input, lag) {
|
|
45
|
+
input.lags.push(lag);
|
|
46
|
+
input.progress?.recordSettlement(input.candidate.id, { actions: [], lags: [lag] });
|
|
47
|
+
}
|
|
48
|
+
function recordAction(input, action) {
|
|
49
|
+
input.actions.push(action);
|
|
50
|
+
input.progress?.recordSettlement(input.candidate.id, { actions: [action], lags: [] });
|
|
51
|
+
}
|
|
16
52
|
async function observeApplicableHolder(input) {
|
|
17
|
-
const { repository, channel, candidate
|
|
53
|
+
const { repository, channel, candidate } = input;
|
|
18
54
|
let observation;
|
|
19
55
|
try {
|
|
20
56
|
observation = await observeContractsForAdmissionAt(repository, channel, [candidate.id], taskHolderObservationSelection());
|
|
@@ -25,7 +61,9 @@ async function observeApplicableHolder(input) {
|
|
|
25
61
|
return holder?.disposition === "held" ? holder : null;
|
|
26
62
|
}
|
|
27
63
|
catch (error) {
|
|
28
|
-
|
|
64
|
+
if (!operational(error))
|
|
65
|
+
throw error;
|
|
66
|
+
recordLag(input, {
|
|
29
67
|
kind: "settlement-failed",
|
|
30
68
|
surface: "task-holder",
|
|
31
69
|
contractId: candidate.id,
|
|
@@ -35,13 +73,15 @@ async function observeApplicableHolder(input) {
|
|
|
35
73
|
}
|
|
36
74
|
}
|
|
37
75
|
async function completeHeldTask(input) {
|
|
38
|
-
const { repository, candidate,
|
|
76
|
+
const { repository, candidate, taskId } = input;
|
|
39
77
|
let world;
|
|
40
78
|
try {
|
|
41
79
|
world = await World.at(repository.primaryWorktree);
|
|
42
80
|
}
|
|
43
81
|
catch (error) {
|
|
44
|
-
|
|
82
|
+
if (!operational(error))
|
|
83
|
+
throw error;
|
|
84
|
+
recordLag(input, {
|
|
45
85
|
kind: "settlement-failed",
|
|
46
86
|
surface: "task",
|
|
47
87
|
contractId: candidate.id,
|
|
@@ -55,7 +95,9 @@ async function completeHeldTask(input) {
|
|
|
55
95
|
result = await settleTask(world, taskId);
|
|
56
96
|
}
|
|
57
97
|
catch (error) {
|
|
58
|
-
|
|
98
|
+
if (!operational(error))
|
|
99
|
+
throw error;
|
|
100
|
+
recordLag(input, {
|
|
59
101
|
kind: "settlement-failed",
|
|
60
102
|
surface: "task",
|
|
61
103
|
contractId: candidate.id,
|
|
@@ -65,10 +107,10 @@ async function completeHeldTask(input) {
|
|
|
65
107
|
return false;
|
|
66
108
|
}
|
|
67
109
|
if (result.kind === "changed")
|
|
68
|
-
|
|
110
|
+
recordAction(input, { kind: "task", taskId, action: "done" });
|
|
69
111
|
if (result.kind === "changed" && result.cleanup !== undefined) {
|
|
70
112
|
for (const detail of result.cleanup.diagnostics) {
|
|
71
|
-
|
|
113
|
+
recordLag(input, {
|
|
72
114
|
kind: "settlement-failed",
|
|
73
115
|
surface: "task",
|
|
74
116
|
contractId: candidate.id,
|
|
@@ -79,7 +121,7 @@ async function completeHeldTask(input) {
|
|
|
79
121
|
}
|
|
80
122
|
if (result.kind === "changed" || result.kind === "unchanged")
|
|
81
123
|
return true;
|
|
82
|
-
|
|
124
|
+
recordLag(input, {
|
|
83
125
|
kind: "settlement-failed",
|
|
84
126
|
surface: "task",
|
|
85
127
|
contractId: candidate.id,
|
|
@@ -89,7 +131,7 @@ async function completeHeldTask(input) {
|
|
|
89
131
|
return false;
|
|
90
132
|
}
|
|
91
133
|
async function releaseHeldTaskHolder(input) {
|
|
92
|
-
const { repository, channel, candidate,
|
|
134
|
+
const { repository, channel, candidate, seatClose, taskId } = input;
|
|
93
135
|
try {
|
|
94
136
|
const outcome = await withPrivateStatePublicationSeat(repository, async (seat) => {
|
|
95
137
|
const observation = await observeContractsForAdmissionAt(repository, channel, [candidate.id], taskHolderObservationSelection());
|
|
@@ -101,7 +143,7 @@ async function releaseHeldTaskHolder(input) {
|
|
|
101
143
|
return "inert";
|
|
102
144
|
const publication = await publishTaskHolderRelease(repository, channel, observation, candidate.id, seat);
|
|
103
145
|
if (publication.kind === "non-published") {
|
|
104
|
-
|
|
146
|
+
recordLag(input, {
|
|
105
147
|
kind: "settlement-failed",
|
|
106
148
|
surface: "task-holder",
|
|
107
149
|
contractId: candidate.id,
|
|
@@ -114,11 +156,14 @@ async function releaseHeldTaskHolder(input) {
|
|
|
114
156
|
});
|
|
115
157
|
if (outcome.closeLag !== undefined) {
|
|
116
158
|
seatClose.push(...appendPrivateStateSeatClose(undefined, outcome.closeLag));
|
|
159
|
+
input.progress?.recordSettlement(candidate.id, { actions: [], lags: [], seatClose: [outcome.closeLag] });
|
|
117
160
|
}
|
|
118
161
|
return outcome.value;
|
|
119
162
|
}
|
|
120
163
|
catch (error) {
|
|
121
|
-
|
|
164
|
+
if (!operational(error))
|
|
165
|
+
throw error;
|
|
166
|
+
recordLag(input, {
|
|
122
167
|
kind: "settlement-failed",
|
|
123
168
|
surface: "task-holder",
|
|
124
169
|
contractId: candidate.id,
|
|
@@ -129,8 +174,8 @@ async function releaseHeldTaskHolder(input) {
|
|
|
129
174
|
}
|
|
130
175
|
}
|
|
131
176
|
async function settleTasks(input) {
|
|
132
|
-
const { repository, channel, candidate,
|
|
133
|
-
const hint = await observeApplicableHolder(
|
|
177
|
+
const { repository, channel, candidate, lags, seatClose } = input;
|
|
178
|
+
const hint = await observeApplicableHolder(input);
|
|
134
179
|
if (hint === null)
|
|
135
180
|
return false;
|
|
136
181
|
const taskId = hint.taskId;
|
|
@@ -139,7 +184,9 @@ async function settleTasks(input) {
|
|
|
139
184
|
fence = await acquireTaskSettlementFence(repository, taskId);
|
|
140
185
|
}
|
|
141
186
|
catch (error) {
|
|
142
|
-
|
|
187
|
+
if (!operational(error))
|
|
188
|
+
throw error;
|
|
189
|
+
recordLag(input, {
|
|
143
190
|
kind: "settlement-failed",
|
|
144
191
|
surface: "task",
|
|
145
192
|
contractId: candidate.id,
|
|
@@ -148,13 +195,14 @@ async function settleTasks(input) {
|
|
|
148
195
|
});
|
|
149
196
|
return true;
|
|
150
197
|
}
|
|
198
|
+
let failure;
|
|
151
199
|
let taskSettled = false;
|
|
152
200
|
let holderDisposition = null;
|
|
153
201
|
try {
|
|
154
|
-
const holder = await observeApplicableHolder(
|
|
202
|
+
const holder = await observeApplicableHolder(input);
|
|
155
203
|
if (holder === null || holder.taskId !== taskId)
|
|
156
204
|
return false;
|
|
157
|
-
taskSettled = await completeHeldTask({
|
|
205
|
+
taskSettled = await completeHeldTask({ ...input, taskId });
|
|
158
206
|
if (!taskSettled)
|
|
159
207
|
return true;
|
|
160
208
|
holderDisposition = await releaseHeldTaskHolder({
|
|
@@ -164,19 +212,28 @@ async function settleTasks(input) {
|
|
|
164
212
|
taskId,
|
|
165
213
|
lags,
|
|
166
214
|
seatClose,
|
|
215
|
+
...(input.progress === undefined ? {} : { progress: input.progress }),
|
|
167
216
|
});
|
|
168
217
|
return true;
|
|
169
218
|
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
failure = { error };
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
170
223
|
finally {
|
|
171
224
|
try {
|
|
172
225
|
await fence.close();
|
|
173
226
|
}
|
|
174
227
|
catch (error) {
|
|
175
|
-
if (!
|
|
228
|
+
if (!operational(error)) {
|
|
229
|
+
if (failure === undefined)
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
else if (!taskSettled && failure === undefined)
|
|
176
233
|
throw error;
|
|
177
234
|
// Post-release fence teardown is custodial residue, not an owed holder publication.
|
|
178
235
|
if (holderDisposition !== "released") {
|
|
179
|
-
|
|
236
|
+
recordLag(input, {
|
|
180
237
|
kind: "settlement-failed",
|
|
181
238
|
surface: "task-holder",
|
|
182
239
|
contractId: candidate.id,
|
|
@@ -208,10 +265,13 @@ async function settleObserved(input) {
|
|
|
208
265
|
actions,
|
|
209
266
|
lags,
|
|
210
267
|
seatClose,
|
|
268
|
+
...(input.progress === undefined ? {} : { progress: input.progress }),
|
|
211
269
|
});
|
|
212
270
|
}
|
|
213
271
|
catch (error) {
|
|
214
|
-
|
|
272
|
+
if (!operational(error))
|
|
273
|
+
throw error;
|
|
274
|
+
recordLag({ candidate, lags, ...(input.progress === undefined ? {} : { progress: input.progress }) }, {
|
|
215
275
|
kind: "settlement-failed",
|
|
216
276
|
surface: "task",
|
|
217
277
|
contractId: candidate.id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TaskDocument, type TaskPriority, type TaskState } from "./document.js";
|
|
2
2
|
import { type TaskId } from "./identity.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { type BoundedList } from "../bounded-list.js";
|
|
@@ -87,6 +87,8 @@ export type TaskTreeNode = Readonly<{
|
|
|
87
87
|
export type TaskBoard = Readonly<{
|
|
88
88
|
tasks: ReadonlyMap<TaskId, TaskDocument>;
|
|
89
89
|
}>;
|
|
90
|
+
/** The local ids occupied across one namespace of the current board. */
|
|
91
|
+
export declare function occupiedLocalIds(board: TaskBoard, namespace: readonly string[]): Set<string>;
|
|
90
92
|
type TaskRelation = "needs" | "parent" | "supersedes" | "relates";
|
|
91
93
|
export type TaskDoctorIssue = Readonly<{
|
|
92
94
|
kind: "missing-target";
|
package/build/src/task/board.js
CHANGED
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { taskNonblankTextSchema, taskStateSchema, taskPrioritySchema, } from "./document.js";
|
|
2
|
+
import { taskIdSchema, parseTaskId, sameNamespace } from "./identity.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { boundedListLimit, projectBoundedList } from "../bounded-list.js";
|
|
4
|
-
const taskRowIdSchema = z.string().transform((value, context) => {
|
|
5
|
-
try {
|
|
6
|
-
const id = formatTaskId(parseTaskId(value));
|
|
7
|
-
if (id !== value)
|
|
8
|
-
throw new Error("not canonical");
|
|
9
|
-
return id;
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
context.addIssue({ code: "custom", message: "expected canonical TaskId" });
|
|
13
|
-
return z.NEVER;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
5
|
const taskRowTimestampSchema = z.string().refine((value) => Number.isFinite(Date.parse(value)), "expected timestamp");
|
|
17
6
|
export const taskRowSchema = z
|
|
18
7
|
.object({
|
|
19
|
-
id:
|
|
20
|
-
title:
|
|
21
|
-
state:
|
|
22
|
-
priority:
|
|
8
|
+
id: taskIdSchema,
|
|
9
|
+
title: taskNonblankTextSchema,
|
|
10
|
+
state: taskStateSchema,
|
|
11
|
+
priority: taskPrioritySchema,
|
|
23
12
|
disposition: z.enum(["ready", "blocked", "in_progress", "on_hold", "done", "drop"]),
|
|
24
13
|
updatedAt: taskRowTimestampSchema,
|
|
25
14
|
bodyPresent: z.boolean(),
|
|
@@ -30,6 +19,13 @@ export const taskRowSchema = z
|
|
|
30
19
|
})
|
|
31
20
|
.strict();
|
|
32
21
|
export const taskRowsSchema = z.array(taskRowSchema).readonly();
|
|
22
|
+
/** The local ids occupied across one namespace of the current board. */
|
|
23
|
+
export function occupiedLocalIds(board, namespace) {
|
|
24
|
+
return new Set([...board.tasks.values()].flatMap((task) => {
|
|
25
|
+
const coordinate = parseTaskId(task.id);
|
|
26
|
+
return sameNamespace(coordinate.namespace, namespace) ? [coordinate.localId] : [];
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
33
29
|
const terminal = (state) => state === "done" || state === "drop";
|
|
34
30
|
const none = Object.freeze([]);
|
|
35
31
|
const sorted = (values) => [...values].sort((a, b) => Buffer.compare(Buffer.from(a.id), Buffer.from(b.id)));
|
|
@@ -9,7 +9,3 @@ export declare function observeRecentTaskStatus(world: WorldRoot, input?: Readon
|
|
|
9
9
|
namespace?: readonly string[];
|
|
10
10
|
limit?: number;
|
|
11
11
|
}>): Promise<BoundedList<RecentTaskStatusRow>>;
|
|
12
|
-
export declare function observeTaskCatalog(world: WorldRoot, input?: Readonly<{
|
|
13
|
-
namespace?: readonly string[];
|
|
14
|
-
limit?: number;
|
|
15
|
-
}>): Promise<BoundedList<TaskRow>>;
|
|
@@ -60,18 +60,3 @@ async function recentTaskStatus(world, input) {
|
|
|
60
60
|
export async function observeRecentTaskStatus(world, input = {}) {
|
|
61
61
|
return recentTaskStatus(world, input);
|
|
62
62
|
}
|
|
63
|
-
export async function observeTaskCatalog(world, input = {}) {
|
|
64
|
-
const { namespace } = input;
|
|
65
|
-
if (namespace !== undefined && !namespace.every(isTaskSegment)) {
|
|
66
|
-
throw new TypeError("namespace must contain canonical segments");
|
|
67
|
-
}
|
|
68
|
-
const documents = await readRecentTaskDocuments(world, {
|
|
69
|
-
...(namespace === undefined ? {} : { namespace }),
|
|
70
|
-
...(input.limit === undefined ? {} : { limit: input.limit }),
|
|
71
|
-
});
|
|
72
|
-
const known = new Map(documents.rows.map((document) => [document.id, document]));
|
|
73
|
-
return {
|
|
74
|
-
rows: (await Promise.all(documents.rows.map((document) => catalogRow(world, document, known)))).map(({ blockers: _blockers, ...row }) => row),
|
|
75
|
-
hasMore: documents.hasMore,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TaskBoard } from "./board.js";
|
|
2
|
+
import type { TaskCompositionResult } from "./mutation-result.js";
|
|
2
3
|
import { type TaskDocument } from "./document.js";
|
|
3
4
|
import { type TaskId } from "./identity.js";
|
|
4
5
|
import { type TaskCompositionDiagnostic } from "./operations.js";
|
|
@@ -6,16 +7,17 @@ export declare function taskCompositionNamespaceHeader(markdown: string): Readon
|
|
|
6
7
|
specified: boolean;
|
|
7
8
|
namespace?: readonly string[];
|
|
8
9
|
}>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
taskId: TaskId;
|
|
10
|
+
type PlannedComposition = Extract<TaskCompositionResult, {
|
|
11
|
+
kind: "planned";
|
|
12
12
|
}>;
|
|
13
|
-
export type
|
|
14
|
-
|
|
15
|
-
bytes: number;
|
|
16
|
-
firstLine: string;
|
|
17
|
-
lastLine: string;
|
|
13
|
+
export type AcceptedComposition = Extract<TaskCompositionResult, {
|
|
14
|
+
kind: "accepted";
|
|
18
15
|
}>;
|
|
16
|
+
export type TaskCompositionAlias = Readonly<AcceptedComposition["aliases"][number]>;
|
|
17
|
+
export type TaskCompositionPlanAlias = Readonly<PlannedComposition["aliases"][number]>;
|
|
18
|
+
export type TaskCompositionPlanOrder = Readonly<PlannedComposition["admissionOrder"][number]>;
|
|
19
|
+
export type TaskCompositionBodyPreview = Readonly<PlannedComposition["bodies"][number]>;
|
|
20
|
+
export type TaskCompositionAdmission = Readonly<PlannedComposition["admissions"][number]>;
|
|
19
21
|
export type PlannedTask = Readonly<{
|
|
20
22
|
index: number;
|
|
21
23
|
line: number;
|
|
@@ -29,6 +31,13 @@ export type TaskCompositionPlan = Readonly<{
|
|
|
29
31
|
aliases: readonly TaskCompositionAlias[];
|
|
30
32
|
admissionOrder: readonly TaskId[];
|
|
31
33
|
bodies: readonly TaskCompositionBodyPreview[];
|
|
34
|
+
admissions: readonly Readonly<{
|
|
35
|
+
position: number;
|
|
36
|
+
kind: "new" | "existing";
|
|
37
|
+
taskId: TaskId;
|
|
38
|
+
alias?: string | undefined;
|
|
39
|
+
title: string;
|
|
40
|
+
}>[];
|
|
32
41
|
tasks: readonly PlannedTask[];
|
|
33
42
|
}>;
|
|
34
43
|
export type TaskCompositionPlanning = Readonly<{
|
|
@@ -45,3 +54,4 @@ export declare function planTaskComposition(input: Readonly<{
|
|
|
45
54
|
at: string;
|
|
46
55
|
actor?: string;
|
|
47
56
|
}>): TaskCompositionPlanning;
|
|
57
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { occupiedLocalIds } from "./board.js";
|
|
1
2
|
import { serializeTaskDocument } from "./document.js";
|
|
2
|
-
import { allocateLocalId, deriveLocalStem, formatTaskId, parseTaskId
|
|
3
|
+
import { allocateLocalId, deriveLocalStem, formatTaskId, parseTaskId } from "./identity.js";
|
|
3
4
|
import { parseTaskComposition } from "./compose-parser.js";
|
|
4
5
|
import { advanceTaskTimestamp } from "./operations.js";
|
|
5
6
|
export function taskCompositionNamespaceHeader(markdown) {
|
|
@@ -12,12 +13,6 @@ export function taskCompositionNamespaceHeader(markdown) {
|
|
|
12
13
|
function diagnostic(line, reason, token) {
|
|
13
14
|
return { line, reason, token };
|
|
14
15
|
}
|
|
15
|
-
function occupied(board, namespace) {
|
|
16
|
-
return new Set([...board.tasks.values()].flatMap((task) => {
|
|
17
|
-
const coordinate = parseTaskId(task.id);
|
|
18
|
-
return sameNamespace(coordinate.namespace, namespace) ? [coordinate.localId] : [];
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
16
|
function createdTask(id, title, at, actor) {
|
|
22
17
|
return {
|
|
23
18
|
id,
|
|
@@ -39,7 +34,7 @@ function aliasFor(node) {
|
|
|
39
34
|
return node.assignments.find((item) => item.field === "as");
|
|
40
35
|
}
|
|
41
36
|
function allocateNodes(input, diagnostics) {
|
|
42
|
-
const ids =
|
|
37
|
+
const ids = occupiedLocalIds(input.board, input.namespace);
|
|
43
38
|
const allocations = new Map();
|
|
44
39
|
for (const node of input.parsed.nodes) {
|
|
45
40
|
if (node.kind !== "new")
|
|
@@ -275,17 +270,38 @@ function stableAdmissionOrder(tasks, diagnostics) {
|
|
|
275
270
|
}
|
|
276
271
|
return ordered;
|
|
277
272
|
}
|
|
278
|
-
function bodyPreview(node,
|
|
273
|
+
function bodyPreview(node, title) {
|
|
279
274
|
if (node.body?.kind !== "replace")
|
|
280
275
|
return null;
|
|
281
276
|
const lines = node.body.value.split(/\r\n|\n|\r/u);
|
|
282
277
|
return {
|
|
283
|
-
|
|
278
|
+
position: node.index + 1,
|
|
279
|
+
title,
|
|
284
280
|
bytes: Buffer.byteLength(node.body.value),
|
|
285
281
|
firstLine: lines[0] ?? "",
|
|
286
282
|
lastLine: lines.at(-1) ?? "",
|
|
287
283
|
};
|
|
288
284
|
}
|
|
285
|
+
function planPresentation(ordered, tasks, parsed, aliases) {
|
|
286
|
+
const aliasBindings = [...aliases].map(([alias, taskId]) => ({ alias, taskId }));
|
|
287
|
+
const admissions = ordered.map((task) => task.kind === "new"
|
|
288
|
+
? {
|
|
289
|
+
position: task.index + 1,
|
|
290
|
+
kind: "new",
|
|
291
|
+
...(task.alias === undefined ? {} : { alias: task.alias }),
|
|
292
|
+
title: task.after.title,
|
|
293
|
+
taskId: task.after.id,
|
|
294
|
+
}
|
|
295
|
+
: { position: task.index + 1, kind: "existing", taskId: task.after.id, title: task.after.title });
|
|
296
|
+
const bodies = parsed.nodes.flatMap((node) => {
|
|
297
|
+
const task = tasks.find((candidate) => candidate.index === node.index);
|
|
298
|
+
if (task === undefined)
|
|
299
|
+
return [];
|
|
300
|
+
const preview = bodyPreview(node, task.after.title);
|
|
301
|
+
return preview === null ? [] : [preview];
|
|
302
|
+
});
|
|
303
|
+
return { aliases: aliasBindings, admissions, bodies };
|
|
304
|
+
}
|
|
289
305
|
export function planTaskComposition(input) {
|
|
290
306
|
const parsed = parseTaskComposition(input.markdown);
|
|
291
307
|
const diagnostics = [...parsed.diagnostics];
|
|
@@ -333,21 +349,15 @@ export function planTaskComposition(input) {
|
|
|
333
349
|
const ordered = stableAdmissionOrder(tasks, diagnostics);
|
|
334
350
|
if (diagnostics.length > 0)
|
|
335
351
|
return { kind: "refused", diagnostics };
|
|
336
|
-
const
|
|
337
|
-
const bodies = parsed.nodes.flatMap((node) => {
|
|
338
|
-
const task = tasks.find((candidate) => candidate.index === node.index);
|
|
339
|
-
if (task === undefined)
|
|
340
|
-
return [];
|
|
341
|
-
const preview = bodyPreview(node, task.after.id);
|
|
342
|
-
return preview === null ? [] : [preview];
|
|
343
|
-
});
|
|
352
|
+
const presentation = planPresentation(ordered, tasks, parsed, aliases);
|
|
344
353
|
return {
|
|
345
354
|
kind: "planned",
|
|
346
355
|
plan: {
|
|
347
356
|
namespace,
|
|
348
|
-
aliases:
|
|
357
|
+
aliases: presentation.aliases,
|
|
349
358
|
admissionOrder: ordered.map((task) => task.after.id),
|
|
350
|
-
|
|
359
|
+
admissions: presentation.admissions,
|
|
360
|
+
bodies: presentation.bodies,
|
|
351
361
|
tasks: ordered,
|
|
352
362
|
},
|
|
353
363
|
};
|