@astrosheep/keiyaku 4.6.31 → 4.6.32
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 +34 -17
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/pi/README.md +16 -18
- package/build/plugins/pi/akuma-tools.ts +31 -38
- package/build/plugins/pi/keiyaku.ts +15 -4
- package/build/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/src/akuma/akuma-call.d.ts +3 -5
- package/build/src/akuma/akuma-call.js +7 -10
- package/build/src/akuma/akuma-errors.d.ts +7 -4
- package/build/src/akuma/akuma-errors.js +16 -12
- package/build/src/akuma/akuma-instance.d.ts +39 -303
- package/build/src/akuma/akuma-instance.js +48 -48
- package/build/src/akuma/akuma-observe.d.ts +5 -4
- package/build/src/akuma/akuma-observe.js +1 -7
- package/build/src/akuma/akuma-owner.d.ts +14 -6
- package/build/src/akuma/akuma-owner.js +33 -27
- package/build/src/akuma/akuma-selection-execution.d.ts +22 -19
- package/build/src/akuma/akuma-selection-execution.js +71 -124
- package/build/src/akuma/akuma-wait.d.ts +3 -3
- package/build/src/akuma/akuma.d.ts +47 -384
- package/build/src/akuma/akuma.js +8 -58
- package/build/src/akuma/archetype.d.ts +16 -19
- package/build/src/akuma/archetype.js +48 -49
- package/build/src/akuma/body.js +31 -26
- package/build/src/akuma/call-initial-tell.d.ts +4 -1
- package/build/src/akuma/call-initial-tell.js +9 -1
- package/build/src/akuma/call-input.d.ts +8 -1
- package/build/src/akuma/call-input.js +27 -18
- package/build/src/akuma/caller.js +2 -1
- package/build/src/akuma/detached-body.js +1 -1
- package/build/src/akuma/heart/facts.d.ts +5 -4
- package/build/src/akuma/heart/facts.js +5 -5
- package/build/src/akuma/heart/soul.js +20 -4
- package/build/src/akuma/identity.d.ts +1 -1
- package/build/src/akuma/identity.js +9 -4
- package/build/src/akuma/index.d.ts +6 -7
- package/build/src/akuma/index.js +2 -3
- package/build/src/akuma/projection.d.ts +3 -0
- package/build/src/akuma/provider-recipe.js +3 -2
- package/build/src/akuma/providers/acp/config.js +11 -10
- package/build/src/akuma/providers/acp/index.js +2 -1
- package/build/src/akuma/providers/codex-app-server/index.js +7 -1
- package/build/src/akuma/providers/grok-build/index.js +2 -1
- package/build/src/akuma/providers/index.d.ts +0 -1
- package/build/src/akuma/providers/index.js +0 -8
- package/build/src/akuma/providers/paseo/index.js +7 -4
- package/build/src/akuma/providers/pi/index.js +4 -3
- package/build/src/akuma/publication.d.ts +1 -2
- package/build/src/akuma/publication.js +16 -14
- package/build/src/akuma/schema.d.ts +3 -49
- package/build/src/akuma/schema.js +6 -147
- package/build/src/akuma/selection-observation.d.ts +281 -240
- package/build/src/akuma/selection-observation.js +122 -68
- package/build/src/akuma/status-projection.d.ts +49 -285
- package/build/src/akuma/status-projection.js +178 -138
- package/build/src/body/amend.js +2 -1
- package/build/src/body/arc.js +3 -2
- package/build/src/body/criteria.js +4 -3
- package/build/src/body/decode.js +2 -1
- package/build/src/body/envelope.js +2 -1
- package/build/src/body/region.d.ts +1 -3
- package/build/src/body/region.js +3 -8
- package/build/src/body-host.d.ts +4 -11
- package/build/src/body-host.js +5 -4
- package/build/src/bounded-list.js +2 -1
- package/build/src/cli/commands/akuma-grammar.d.ts +109 -66
- package/build/src/cli/commands/akuma-grammar.js +75 -95
- package/build/src/cli/commands/akuma.d.ts +8 -3
- package/build/src/cli/commands/akuma.js +63 -122
- package/build/src/cli/commands/contract-grammar.d.ts +3 -135
- package/build/src/cli/commands/contract-grammar.js +125 -218
- package/build/src/cli/commands/contract-help.d.ts +24 -21
- package/build/src/cli/commands/contract-help.js +43 -35
- package/build/src/cli/commands/contract.d.ts +6 -18
- package/build/src/cli/commands/contract.js +65 -272
- package/build/src/cli/commands/debt-grammar.d.ts +2 -4
- package/build/src/cli/commands/debt-grammar.js +22 -190
- package/build/src/cli/commands/debt.js +10 -87
- package/build/src/cli/commands/report.d.ts +2 -4
- package/build/src/cli/coordinates.d.ts +1 -1
- package/build/src/cli/coordinates.js +1 -1
- package/build/src/cli/main.js +9 -3
- package/build/src/cli/parse.d.ts +80 -3
- package/build/src/cli/parse.js +76 -16
- package/build/src/cli/render/akuma-activity.d.ts +19 -24
- package/build/src/cli/render/akuma-activity.js +164 -259
- package/build/src/cli/render/akuma.d.ts +3 -3
- package/build/src/cli/render/akuma.js +36 -43
- package/build/src/cli/render/catalog.d.ts +2 -5
- package/build/src/cli/render/catalog.js +2 -33
- package/build/src/cli/render/contract-history.js +1 -2
- package/build/src/cli/render/contract-observation.d.ts +0 -7
- package/build/src/cli/render/contract-observation.js +0 -3
- package/build/src/cli/render/contract.d.ts +7 -9
- package/build/src/cli/render/contract.js +35 -64
- package/build/src/cli/render/debt.d.ts +3 -11
- package/build/src/cli/render/debt.js +17 -88
- package/build/src/cli/render/delivery-preview.js +4 -4
- package/build/src/cli/render/kanshi-akuma.d.ts +5 -3
- package/build/src/cli/render/kanshi-akuma.js +22 -18
- package/build/src/cli/render/kanshi.d.ts +1 -3
- package/build/src/cli/render/kanshi.js +16 -39
- package/build/src/cli/render/receipt.d.ts +21 -12
- package/build/src/cli/render/receipt.js +49 -44
- package/build/src/cli/render/refusal.d.ts +4 -3
- package/build/src/cli/render/refusal.js +15 -17
- package/build/src/cli/render/settings.d.ts +1 -1
- package/build/src/cli/render/terminal.d.ts +9 -8
- package/build/src/cli/render/terminal.js +48 -32
- package/build/src/cli/render/verbs.d.ts +3 -1
- package/build/src/cli/render/verbs.js +74 -116
- package/build/src/cli/runtime.js +66 -65
- package/build/src/cli/streams.d.ts +2 -9
- package/build/src/cli/streams.js +8 -1
- package/build/src/cli/usage.d.ts +2 -1
- package/build/src/cli/usage.js +3 -2
- package/build/src/contract-worktree.js +2 -10
- package/build/src/core/facts/codec.js +9 -23
- package/build/src/core/facts/errors.d.ts +2 -1
- package/build/src/core/facts/errors.js +3 -3
- package/build/src/core/facts/types.d.ts +2 -13
- package/build/src/core/facts/types.js +1 -6
- package/build/src/core/verbs/abandon.d.ts +1 -2
- package/build/src/core/verbs/amend.d.ts +1 -2
- package/build/src/core/verbs/arc.d.ts +1 -2
- package/build/src/core/verbs/attestation.d.ts +1 -2
- package/build/src/core/verbs/bind.d.ts +1 -2
- package/build/src/core/verbs/deliver.d.ts +1 -2
- package/build/src/core/verbs/placement.d.ts +1 -2
- package/build/src/core/verbs/reintegrate.d.ts +1 -2
- package/build/src/debt/board.d.ts +14 -94
- package/build/src/debt/board.js +25 -160
- package/build/src/debt/catalog.d.ts +0 -2
- package/build/src/debt/catalog.js +1 -22
- package/build/src/debt/document.d.ts +8 -11
- package/build/src/debt/document.js +19 -62
- package/build/src/debt/identity.d.ts +2 -14
- package/build/src/debt/identity.js +19 -49
- package/build/src/debt/index.d.ts +81 -219
- package/build/src/debt/index.js +61 -110
- package/build/src/debt/input.d.ts +19 -5
- package/build/src/debt/input.js +51 -177
- package/build/src/debt/lifecycle-operations.d.ts +1 -3
- package/build/src/debt/lifecycle-operations.js +1 -73
- package/build/src/debt/operation-types.d.ts +24 -128
- package/build/src/debt/operation-types.js +6 -62
- package/build/src/debt/operations.d.ts +8 -17
- package/build/src/debt/operations.js +58 -154
- package/build/src/debt/store.d.ts +0 -2
- package/build/src/debt/store.js +32 -87
- package/build/src/errors.d.ts +28 -0
- package/build/src/errors.js +26 -0
- package/build/src/git/hooks.d.ts +1 -1
- package/build/src/git/observe.d.ts +3 -0
- package/build/src/git/observe.js +19 -5
- package/build/src/git/reconcile.d.ts +3 -16
- package/build/src/git/reconcile.js +0 -18
- package/build/src/git/repository.d.ts +2 -1
- package/build/src/git/repository.js +3 -3
- package/build/src/git/target-placement.d.ts +4 -4
- package/build/src/git/target.d.ts +2 -2
- package/build/src/git/tender.d.ts +1 -2
- package/build/src/git/tender.js +5 -12
- package/build/src/identity/coordinates.d.ts +1 -1
- package/build/src/identity/coordinates.js +3 -2
- package/build/src/identity/normalize.js +2 -1
- package/build/src/identity/selector.js +4 -3
- package/build/src/index.d.ts +34 -57
- package/build/src/index.js +11 -36
- package/build/src/kanshi/counts.d.ts +3 -8
- package/build/src/kanshi/counts.js +6 -14
- package/build/src/kanshi/index.d.ts +22 -7
- package/build/src/kanshi/index.js +30 -4
- package/build/src/kanshi/read.d.ts +81 -270
- package/build/src/kanshi/read.js +39 -199
- package/build/src/kanshi/report.d.ts +340 -1619
- package/build/src/kanshi/report.js +19 -31
- package/build/src/library/address.d.ts +11 -11
- package/build/src/library/address.js +34 -27
- package/build/src/library/akuma-creation.d.ts +210 -79
- package/build/src/library/akuma-creation.js +201 -242
- package/build/src/library/akumas.d.ts +24 -5
- package/build/src/library/akumas.js +96 -29
- package/build/src/library/bind.d.ts +7 -10
- package/build/src/library/bind.js +2 -8
- package/build/src/library/continuation.d.ts +141 -231
- package/build/src/library/continuation.js +22 -31
- package/build/src/library/contract-address.d.ts +6 -9
- package/build/src/library/contract-address.js +11 -16
- package/build/src/library/contract-composition.d.ts +2 -3
- package/build/src/library/contract-composition.js +12 -19
- package/build/src/library/contract-creation.js +33 -34
- package/build/src/library/contract-outcomes.d.ts +1278 -806
- package/build/src/library/contract-outcomes.js +11 -37
- package/build/src/library/contract-settings.d.ts +1 -2
- package/build/src/library/contract-settings.js +5 -7
- package/build/src/library/contract-types.d.ts +42 -67
- package/build/src/library/contract-types.js +15 -56
- package/build/src/library/contract-wait.d.ts +40 -3
- package/build/src/library/contract-wait.js +28 -21
- package/build/src/library/delivery.d.ts +366 -389
- package/build/src/library/delivery.js +5 -25
- package/build/src/library/input.d.ts +31 -5
- package/build/src/library/input.js +40 -40
- package/build/src/library/invocation.d.ts +13 -11
- package/build/src/library/invocation.js +69 -58
- package/build/src/library/kei.d.ts +16 -8
- package/build/src/library/kei.js +459 -19
- package/build/src/library/keiyaku-attribution.d.ts +0 -8
- package/build/src/library/keiyaku-attribution.js +0 -11
- package/build/src/library/keiyaku-classify.d.ts +2 -2
- package/build/src/library/keiyaku-classify.js +40 -59
- package/build/src/library/keiyaku-coordinates.d.ts +3 -8
- package/build/src/library/keiyaku-coordinates.js +6 -26
- package/build/src/library/keiyaku-debt.d.ts +21 -93
- package/build/src/library/keiyaku-debt.js +8 -157
- package/build/src/library/keiyaku-identity.js +5 -4
- package/build/src/library/keiyaku-verbs.d.ts +4004 -3885
- package/build/src/library/keiyaku-verbs.js +309 -271
- package/build/src/library/keiyaku.d.ts +30 -860
- package/build/src/library/keiyaku.js +169 -256
- package/build/src/library/nuke.d.ts +4 -2
- package/build/src/library/nuke.js +5 -1
- package/build/src/library/outcome.d.ts +424 -307
- package/build/src/library/outcome.js +167 -362
- package/build/src/library/reconcile.d.ts +331 -143
- package/build/src/library/reconcile.js +38 -72
- package/build/src/library/refusal.d.ts +20 -28
- package/build/src/library/refusal.js +1 -11
- package/build/src/library/repo.js +4 -3
- package/build/src/library/selection.d.ts +32 -21
- package/build/src/library/selection.js +63 -87
- package/build/src/mcp/adapter.d.ts +6 -0
- package/build/src/mcp/adapter.js +177 -42
- package/build/src/mcp/help.d.ts +1 -1
- package/build/src/mcp/help.js +12 -7
- package/build/src/mcp/output.d.ts +385 -0
- package/build/src/mcp/output.js +193 -0
- package/build/src/plugin/public.d.ts +4 -0
- package/build/src/plugin/runtime.d.ts +1 -1
- package/build/src/plugin/runtime.js +2 -2
- package/build/src/protocol/amend.d.ts +1 -1
- package/build/src/protocol/amend.js +2 -2
- package/build/src/protocol/bind.d.ts +5 -7
- package/build/src/protocol/bind.js +3 -3
- package/build/src/protocol/completion.d.ts +158 -195
- package/build/src/protocol/completion.js +55 -19
- package/build/src/protocol/deliver.d.ts +11 -6
- package/build/src/protocol/deliver.js +30 -30
- package/build/src/protocol/delivery-preview.d.ts +13 -11
- package/build/src/protocol/delivery-preview.js +2 -2
- package/build/src/protocol/execution-observation.d.ts +5 -13
- package/build/src/protocol/intent.d.ts +6 -9
- package/build/src/protocol/intent.js +18 -31
- package/build/src/protocol/operations.d.ts +48 -53
- package/build/src/protocol/operations.js +16 -25
- package/build/src/protocol/outcome.d.ts +3 -1
- package/build/src/protocol/placement.d.ts +1 -2
- package/build/src/protocol/placement.js +1 -1
- package/build/src/protocol/progress.d.ts +1 -0
- package/build/src/protocol/read/status.d.ts +29 -112
- package/build/src/protocol/read/status.js +52 -78
- package/build/src/protocol/reintegrate.d.ts +1 -2
- package/build/src/protocol/reintegrate.js +0 -1
- package/build/src/protocol/result-leaves.d.ts +11 -32
- package/build/src/protocol/result-leaves.js +18 -57
- package/build/src/protocol/result-reasons.d.ts +6 -6
- package/build/src/protocol/review.js +0 -1
- package/build/src/protocol/verify.d.ts +192 -146
- package/build/src/protocol/verify.js +60 -47
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +8 -9
- package/build/src/settings.js +16 -13
- package/build/src/settlement/holder.js +2 -2
- package/build/src/settlement/settle.d.ts +0 -6
- package/build/src/settlement/settle.js +0 -4
- package/build/src/verification/declaration.d.ts +3 -6
- package/build/src/verification/declaration.js +3 -5
- package/build/src/verification/observation.d.ts +2 -2
- package/build/src/world.d.ts +3 -2
- package/build/src/world.js +5 -6
- package/package.json +1 -1
- package/plugins/paseo/plugin/index.server.ts +1 -1
- package/plugins/paseo/plugin/server/attach.ts +74 -67
- package/plugins/paseo/plugin/server/keiyaku.ts +80 -14
- package/plugins/paseo/plugin/server/message.ts +2 -1
- package/plugins/paseo/plugin/server/mirror-identity.ts +6 -4
- package/plugins/paseo/plugin/server/sdk.ts +9 -11
- package/plugins/paseo/plugin/server/transport.ts +24 -1
- package/plugins/pi/README.md +16 -18
- package/plugins/pi/akuma-tools.ts +31 -38
- package/plugins/pi/keiyaku.ts +15 -4
- package/skills/keiyaku-akuma/SKILL.md +16 -11
- package/skills/keiyaku-babysit/SKILL.md +5 -3
- package/skills/keiyaku-bind/SKILL.md +4 -3
- package/skills/keiyaku-debt/SKILL.md +17 -17
- package/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/src/akuma/providers/codex-app-server/configuration.d.ts +0 -5
- package/build/src/akuma/providers/codex-app-server/configuration.js +0 -72
- package/build/src/cli/commands/debt-query.d.ts +0 -5
- package/build/src/cli/commands/debt-query.js +0 -194
- package/build/src/cli/render/akuma-tool-command.d.ts +0 -6
- package/build/src/cli/render/akuma-tool-command.js +0 -143
- package/build/src/cli/render/akuma-tool.d.ts +0 -29
- package/build/src/cli/render/akuma-tool.js +0 -225
- package/build/src/debt/context.d.ts +0 -28
- package/build/src/debt/context.js +0 -102
- package/build/src/debt/created-observation.d.ts +0 -26
- package/build/src/debt/created-observation.js +0 -38
- package/build/src/debt/query.d.ts +0 -80
- package/build/src/debt/query.js +0 -283
- package/build/src/library/contract-execution.d.ts +0 -28
- package/build/src/library/contract-execution.js +0 -506
- package/build/src/library/keiyaku-policy.d.ts +0 -27
- package/build/src/library/keiyaku-policy.js +0 -44
- package/build/src/library/keiyaku-status.d.ts +0 -1487
- package/build/src/library/keiyaku-status.js +0 -92
|
@@ -9,16 +9,17 @@ import { isOperationalFailure, isOperationalStop, executionStop } from "../proto
|
|
|
9
9
|
import { reconcileAllOperation, reconcileOperation, worldContractStates } from "../protocol/reconcile.js";
|
|
10
10
|
import { settle } from "../settlement/settle.js";
|
|
11
11
|
import { appointManagedWorktrees, placeRegisterPath, releaseManagedWorktrees, } from "../workspace-place.js";
|
|
12
|
-
import { InvocationAccumulator } from "./invocation.js";
|
|
13
12
|
import { invocationIssues, meaningfulEffectSchema, reconcilePublicIssueSchema, withOutcomeReceipt, project, } from "./outcome.js";
|
|
14
13
|
export { reconcileLagScope, reconcileLagIsFailure, reconciliationLagSchema } from "./outcome.js";
|
|
15
|
-
const reconcileEffectSchema = z
|
|
14
|
+
const reconcileEffectSchema = z
|
|
15
|
+
.union([
|
|
16
16
|
meaningfulEffectSchema.options[0],
|
|
17
17
|
meaningfulEffectSchema.options[2],
|
|
18
18
|
meaningfulEffectSchema.options[3],
|
|
19
19
|
meaningfulEffectSchema.options[4],
|
|
20
20
|
meaningfulEffectSchema.options[5],
|
|
21
|
-
])
|
|
21
|
+
])
|
|
22
|
+
.meta({ id: "reconcileEffect" });
|
|
22
23
|
const contractReconcileSchema = z
|
|
23
24
|
.strictObject({
|
|
24
25
|
contractId: contractIdSchema,
|
|
@@ -114,12 +115,12 @@ async function appointForContract(scope, state) {
|
|
|
114
115
|
async function finishTerminalReconcile(input, retained, appointed) {
|
|
115
116
|
const cleanup = isManagedTerminal(retained.state) ? await reconcileOperation({ ...input, ...appointed }) : null;
|
|
116
117
|
if (cleanup !== null)
|
|
117
|
-
input.progress
|
|
118
|
+
input.progress.recordPhysical(input.contractId, cleanup.report);
|
|
118
119
|
const release = releaseEligible(retained.state, cleanup?.report, appointed.place !== undefined)
|
|
119
120
|
? await releaseAppointments(input.scope, [input.contractId])
|
|
120
121
|
: undefined;
|
|
121
122
|
if (release !== undefined)
|
|
122
|
-
input.progress
|
|
123
|
+
input.progress.recordReconciliation(input.contractId, { lag: [release] });
|
|
123
124
|
return { cleanup: cleanup?.report ?? null, release };
|
|
124
125
|
}
|
|
125
126
|
function assembleReconcile(retained, settlement, terminal) {
|
|
@@ -133,7 +134,7 @@ function assembleReconcile(retained, settlement, terminal) {
|
|
|
133
134
|
async function reconcileContractWork(input) {
|
|
134
135
|
const observed = await observeState(input.scope, input.channel, input.contractId);
|
|
135
136
|
if ("failed" in observed) {
|
|
136
|
-
input.progress
|
|
137
|
+
input.progress.recordPhysical(input.contractId, observed.failed);
|
|
137
138
|
return { effects: observed.failed.effects, lag: observed.failed.lag, settlement: emptySettlement() };
|
|
138
139
|
}
|
|
139
140
|
// A legitimately absent Contract has nothing to reconcile.
|
|
@@ -141,7 +142,7 @@ async function reconcileContractWork(input) {
|
|
|
141
142
|
return { effects: [], lag: [], settlement: emptySettlement(), missing: true };
|
|
142
143
|
const appointment = await appointForContract(input.scope, observed.state);
|
|
143
144
|
if ("lag" in appointment) {
|
|
144
|
-
input.progress
|
|
145
|
+
input.progress.recordReconciliation(input.contractId, { lag: [appointment.lag] });
|
|
145
146
|
return { effects: [], lag: [appointment.lag], settlement: emptySettlement() };
|
|
146
147
|
}
|
|
147
148
|
const appointed = appointment.place === undefined ? {} : { place: appointment.place };
|
|
@@ -150,17 +151,17 @@ async function reconcileContractWork(input) {
|
|
|
150
151
|
retainTerminalWorktree: true,
|
|
151
152
|
...appointed,
|
|
152
153
|
});
|
|
153
|
-
input.progress
|
|
154
|
+
input.progress.recordPhysical(input.contractId, retained.report);
|
|
154
155
|
const projection = realizedOrRetainedManagedWorktree(input.scope, retained.report, appointment.place)
|
|
155
156
|
? await projectContractWorktree(input.scope, retained.state, appointment.register)
|
|
156
157
|
: { effects: [], lag: [] };
|
|
157
|
-
input.progress
|
|
158
|
+
input.progress.recordReconciliation(input.contractId, { lag: projection.lag });
|
|
158
159
|
const settlement = await settle({
|
|
159
160
|
repository: input.scope,
|
|
160
161
|
channel: input.channel,
|
|
161
162
|
state: retained.state,
|
|
162
163
|
effects: retained.report.effects,
|
|
163
|
-
|
|
164
|
+
progress: input.progress,
|
|
164
165
|
});
|
|
165
166
|
const terminal = await finishTerminalReconcile(input, retained, appointed);
|
|
166
167
|
return assembleReconcile(retained.report, settlement, terminal);
|
|
@@ -226,7 +227,7 @@ async function reconcileWorldWork(input) {
|
|
|
226
227
|
throw error;
|
|
227
228
|
const lag = registerLag(input.scope, error);
|
|
228
229
|
for (const state of states)
|
|
229
|
-
input.progress
|
|
230
|
+
input.progress.recordReconciliation(state.id, { lag: [lag] });
|
|
230
231
|
return {
|
|
231
232
|
kind: "completed",
|
|
232
233
|
contracts: states.map((state) => ({
|
|
@@ -266,7 +267,7 @@ async function reconcileWorldWork(input) {
|
|
|
266
267
|
const lag = await releaseAppointments(input.scope, released);
|
|
267
268
|
if (lag !== undefined)
|
|
268
269
|
for (const id of released)
|
|
269
|
-
input.progress
|
|
270
|
+
input.progress.recordReconciliation(id, { lag: [lag] });
|
|
270
271
|
return lag === undefined ? { kind: "completed", contracts } : attachReleaseLag(contracts, released, lag);
|
|
271
272
|
}
|
|
272
273
|
async function projectAndSettleWorld(input, retained, appointed) {
|
|
@@ -278,61 +279,38 @@ async function projectAndSettleWorld(input, retained, appointed) {
|
|
|
278
279
|
? await projectContractWorktree(input.scope, contract.state, appointed)
|
|
279
280
|
: { effects: [], lag: [] };
|
|
280
281
|
projections.push(projection);
|
|
281
|
-
input.progress
|
|
282
|
+
input.progress.recordReconciliation(contract.contractId, { lag: projection.lag });
|
|
282
283
|
settlements.push(await settle({
|
|
283
284
|
repository: input.scope,
|
|
284
285
|
channel: input.channel,
|
|
285
286
|
state: contract.state,
|
|
286
287
|
effects: contract.report.effects,
|
|
287
|
-
|
|
288
|
+
progress: input.progress,
|
|
288
289
|
}));
|
|
289
290
|
}
|
|
290
291
|
return { projections, settlements };
|
|
291
292
|
}
|
|
292
|
-
function
|
|
293
|
-
return effects.flatMap((effect) => {
|
|
294
|
-
switch (effect.kind) {
|
|
295
|
-
case "worktree":
|
|
296
|
-
if (effect.action === "unchanged")
|
|
297
|
-
return [];
|
|
298
|
-
if (effect.action === "followed")
|
|
299
|
-
throw new Error("explicit reconcile cannot follow a dependent");
|
|
300
|
-
return [{ kind: effect.action === "created" ? "worktree-created" : "worktree-removed", path: effect.path }];
|
|
301
|
-
case "ref":
|
|
302
|
-
return effect.before === effect.after
|
|
303
|
-
? []
|
|
304
|
-
: [{ kind: "ref", name: effect.name, before: effect.before, after: effect.after }];
|
|
305
|
-
case "target-checkout":
|
|
306
|
-
return [{ kind: effect.kind, path: effect.path, target: effect.target }];
|
|
307
|
-
case "recovery-snapshot":
|
|
308
|
-
return [{ kind: effect.kind, snapshot: effect.snapshot }];
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
function compactReconcile(contractId, effects, records) {
|
|
293
|
+
function compactReconcile(contractId, records, completed = false) {
|
|
313
294
|
const own = records.filter((record) => "contract" in record && record.contract === contractId);
|
|
314
295
|
const issues = invocationIssues(own, contractId).map((issue) => {
|
|
315
296
|
switch (issue.kind) {
|
|
316
297
|
case "worktree-follow-retained":
|
|
317
|
-
case "verification-cleanup":
|
|
318
|
-
case "worktree-leak":
|
|
319
298
|
case "execution-stopped":
|
|
320
|
-
case "decode-channel-retirement":
|
|
321
299
|
throw new Error(`unreachable explicit reconcile issue: ${issue.kind}`);
|
|
322
300
|
default:
|
|
323
301
|
return issue;
|
|
324
302
|
}
|
|
325
303
|
});
|
|
326
|
-
const movements =
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
304
|
+
const movements = own.flatMap((record) => {
|
|
305
|
+
if (record.kind !== "movement")
|
|
306
|
+
return [];
|
|
307
|
+
if (record.effect.kind === "worktree-followed")
|
|
308
|
+
throw new Error("explicit reconcile cannot follow a dependent");
|
|
309
|
+
return [record.effect];
|
|
310
|
+
});
|
|
311
|
+
// Completed receipts retain their established physical-before-settlement order.
|
|
312
|
+
if (completed)
|
|
313
|
+
movements.sort((left, right) => Number(left.kind === "debt-settled") - Number(right.kind === "debt-settled"));
|
|
336
314
|
return {
|
|
337
315
|
contractId,
|
|
338
316
|
...(movements.length === 0
|
|
@@ -345,7 +323,7 @@ export function observedReconcileContracts(accumulator) {
|
|
|
345
323
|
const snapshot = accumulator.snapshot();
|
|
346
324
|
const ids = new Set(snapshot.effects.flatMap((effect) => ("contract" in effect ? [effect.contract] : [])));
|
|
347
325
|
return [...ids]
|
|
348
|
-
.map((id) => compactReconcile(id,
|
|
326
|
+
.map((id) => compactReconcile(id, snapshot.effects))
|
|
349
327
|
.filter((row) => row.effects !== undefined || row.issues !== undefined);
|
|
350
328
|
}
|
|
351
329
|
export function reconcileException(error, accumulator, contractId) {
|
|
@@ -359,29 +337,17 @@ export function reconcileException(error, accumulator, contractId) {
|
|
|
359
337
|
throw new Error("failed reconciliation produced a normal result");
|
|
360
338
|
}
|
|
361
339
|
export async function completeReconcile(input) {
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
return { kind: "missing", contractId: input.contractId };
|
|
367
|
-
return { kind: "contract", ...compactReconcile(input.contractId, report.effects, accumulator.snapshot().effects) };
|
|
368
|
-
}
|
|
369
|
-
catch (error) {
|
|
370
|
-
return reconcileException(error, accumulator, input.contractId);
|
|
371
|
-
}
|
|
340
|
+
const report = await reconcileContractWork({ ...input, progress: input.accumulator });
|
|
341
|
+
if (report.missing === true)
|
|
342
|
+
return { kind: "missing", contractId: input.contractId };
|
|
343
|
+
return { kind: "contract", ...compactReconcile(input.contractId, input.accumulator.snapshot().effects, true) };
|
|
372
344
|
}
|
|
373
345
|
export async function completeRepoReconcile(input) {
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
.filter((row) => row.effects !== undefined || row.issues !== undefined);
|
|
382
|
-
return { kind: "world", ...(contracts.length === 0 ? {} : { contracts }) };
|
|
383
|
-
}
|
|
384
|
-
catch (error) {
|
|
385
|
-
return reconcileException(error, accumulator);
|
|
386
|
-
}
|
|
346
|
+
const report = await reconcileWorldWork({ ...input, progress: input.accumulator });
|
|
347
|
+
if (report.kind === "world-observation-failed")
|
|
348
|
+
return report;
|
|
349
|
+
const contracts = report.contracts
|
|
350
|
+
.map(({ contractId }) => compactReconcile(contractId, input.accumulator.snapshot().effects, true))
|
|
351
|
+
.filter((row) => row.effects !== undefined || row.issues !== undefined);
|
|
352
|
+
return { kind: "world", ...(contracts.length === 0 ? {} : { contracts }) };
|
|
387
353
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type Retry } from "../protocol/result-reasons.js";
|
|
3
3
|
import { placementReasonSchema } from "../protocol/completion.js";
|
|
4
|
-
import type { deliveryPreparationRefusalSchema, deliverRefusalSchema, deliverConflictRefusalSchema, verificationDeclarationRefusalSchema } from "../protocol/operations.js";
|
|
5
4
|
export declare const nukeConfirmationRefusalSchema: z.ZodObject<{
|
|
6
5
|
kind: z.ZodLiteral<"nuke-confirmation-mismatch">;
|
|
7
6
|
world: z.ZodString;
|
|
@@ -27,16 +26,16 @@ export type OperationRetries = {
|
|
|
27
26
|
export declare const operationRefusalSchemas: {
|
|
28
27
|
readonly bind: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
29
28
|
kind: z.ZodEnum<{
|
|
30
|
-
"unborn-head": "unborn-head";
|
|
31
29
|
"target-missing": "target-missing";
|
|
32
|
-
"unknown-prerequisite": "unknown-prerequisite";
|
|
33
30
|
"contract-exists": "contract-exists";
|
|
34
31
|
"invalid-after": "invalid-after";
|
|
35
|
-
"
|
|
32
|
+
"unknown-prerequisite": "unknown-prerequisite";
|
|
36
33
|
"invalid-target": "invalid-target";
|
|
34
|
+
"unborn-head": "unborn-head";
|
|
35
|
+
"target-contract-self": "target-contract-self";
|
|
37
36
|
"fork-source-missing": "fork-source-missing";
|
|
38
37
|
"fork-source-unavailable": "fork-source-unavailable";
|
|
39
|
-
"
|
|
38
|
+
"fork-source-moved": "fork-source-moved";
|
|
40
39
|
}>;
|
|
41
40
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
42
41
|
kind: z.ZodEnum<{
|
|
@@ -48,10 +47,10 @@ export declare const operationRefusalSchemas: {
|
|
|
48
47
|
kind: z.ZodLiteral<"target-workspace-unavailable">;
|
|
49
48
|
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
50
49
|
reason: z.ZodEnum<{
|
|
51
|
-
missing: "missing";
|
|
52
|
-
replaced: "replaced";
|
|
53
50
|
unappointed: "unappointed";
|
|
51
|
+
missing: "missing";
|
|
54
52
|
association: "association";
|
|
53
|
+
replaced: "replaced";
|
|
55
54
|
attached: "attached";
|
|
56
55
|
uncommitted: "uncommitted";
|
|
57
56
|
operation: "operation";
|
|
@@ -61,10 +60,10 @@ export declare const operationRefusalSchemas: {
|
|
|
61
60
|
}, z.core.$strict>>]>;
|
|
62
61
|
readonly amend: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
63
62
|
kind: z.ZodEnum<{
|
|
64
|
-
terminal: "terminal";
|
|
65
63
|
"contract-missing": "contract-missing";
|
|
66
|
-
|
|
64
|
+
terminal: "terminal";
|
|
67
65
|
"unknown-prerequisite": "unknown-prerequisite";
|
|
66
|
+
"terms-moved": "terms-moved";
|
|
68
67
|
"cyclic-prerequisite": "cyclic-prerequisite";
|
|
69
68
|
}>;
|
|
70
69
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
@@ -72,8 +71,8 @@ export declare const operationRefusalSchemas: {
|
|
|
72
71
|
}, z.core.$strict>>]>;
|
|
73
72
|
readonly deliver: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
74
73
|
kind: z.ZodEnum<{
|
|
75
|
-
terminal: "terminal";
|
|
76
74
|
"contract-missing": "contract-missing";
|
|
75
|
+
terminal: "terminal";
|
|
77
76
|
}>;
|
|
78
77
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
79
78
|
kind: z.ZodEnum<{
|
|
@@ -87,18 +86,18 @@ export declare const operationRefusalSchemas: {
|
|
|
87
86
|
kind: z.ZodLiteral<"target-workspace-unavailable">;
|
|
88
87
|
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
89
88
|
reason: z.ZodEnum<{
|
|
90
|
-
missing: "missing";
|
|
91
|
-
replaced: "replaced";
|
|
92
89
|
unappointed: "unappointed";
|
|
90
|
+
missing: "missing";
|
|
93
91
|
association: "association";
|
|
92
|
+
replaced: "replaced";
|
|
94
93
|
attached: "attached";
|
|
95
94
|
uncommitted: "uncommitted";
|
|
96
95
|
operation: "operation";
|
|
97
96
|
}>;
|
|
98
97
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
99
98
|
kind: z.ZodEnum<{
|
|
100
|
-
"worktree-missing": "worktree-missing";
|
|
101
99
|
"target-missing": "target-missing";
|
|
100
|
+
"worktree-missing": "worktree-missing";
|
|
102
101
|
}>;
|
|
103
102
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
104
103
|
kind: z.ZodLiteral<"dirty-workspace">;
|
|
@@ -122,8 +121,8 @@ export declare const operationRefusalSchemas: {
|
|
|
122
121
|
}, z.core.$strict>>]>;
|
|
123
122
|
readonly verify: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
124
123
|
kind: z.ZodEnum<{
|
|
125
|
-
terminal: "terminal";
|
|
126
124
|
"contract-missing": "contract-missing";
|
|
125
|
+
terminal: "terminal";
|
|
127
126
|
}>;
|
|
128
127
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
129
128
|
kind: z.ZodEnum<{
|
|
@@ -137,18 +136,18 @@ export declare const operationRefusalSchemas: {
|
|
|
137
136
|
kind: z.ZodLiteral<"target-workspace-unavailable">;
|
|
138
137
|
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
|
|
139
138
|
reason: z.ZodEnum<{
|
|
140
|
-
missing: "missing";
|
|
141
|
-
replaced: "replaced";
|
|
142
139
|
unappointed: "unappointed";
|
|
140
|
+
missing: "missing";
|
|
143
141
|
association: "association";
|
|
142
|
+
replaced: "replaced";
|
|
144
143
|
attached: "attached";
|
|
145
144
|
uncommitted: "uncommitted";
|
|
146
145
|
operation: "operation";
|
|
147
146
|
}>;
|
|
148
147
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
149
148
|
kind: z.ZodEnum<{
|
|
150
|
-
"worktree-missing": "worktree-missing";
|
|
151
149
|
"target-missing": "target-missing";
|
|
150
|
+
"worktree-missing": "worktree-missing";
|
|
152
151
|
}>;
|
|
153
152
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
154
153
|
kind: z.ZodLiteral<"dirty-workspace">;
|
|
@@ -167,15 +166,13 @@ export declare const operationRefusalSchemas: {
|
|
|
167
166
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
168
167
|
kind: z.ZodLiteral<"integration-unsupported">;
|
|
169
168
|
}, z.core.$strict>>]>]>, z.ZodReadonly<z.ZodObject<{
|
|
170
|
-
kind: z.ZodLiteral<"verification-not-selected">;
|
|
171
|
-
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
172
169
|
kind: z.ZodLiteral<"verification-index-out-of-range">;
|
|
173
170
|
total: z.ZodNumber;
|
|
174
171
|
}, z.core.$strict>>]>;
|
|
175
172
|
readonly review: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
176
173
|
kind: z.ZodEnum<{
|
|
177
|
-
terminal: "terminal";
|
|
178
174
|
"contract-missing": "contract-missing";
|
|
175
|
+
terminal: "terminal";
|
|
179
176
|
}>;
|
|
180
177
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
181
178
|
kind: z.ZodLiteral<"worktree-missing">;
|
|
@@ -185,8 +182,8 @@ export declare const operationRefusalSchemas: {
|
|
|
185
182
|
}, z.core.$strict>>]>;
|
|
186
183
|
readonly "deliver-preview": z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
187
184
|
kind: z.ZodEnum<{
|
|
188
|
-
terminal: "terminal";
|
|
189
185
|
"contract-missing": "contract-missing";
|
|
186
|
+
terminal: "terminal";
|
|
190
187
|
}>;
|
|
191
188
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
192
189
|
kind: z.ZodEnum<{
|
|
@@ -199,14 +196,14 @@ export declare const operationRefusalSchemas: {
|
|
|
199
196
|
}, z.core.$strict>>]>;
|
|
200
197
|
readonly arc: z.ZodReadonly<z.ZodObject<{
|
|
201
198
|
kind: z.ZodEnum<{
|
|
202
|
-
terminal: "terminal";
|
|
203
199
|
"contract-missing": "contract-missing";
|
|
200
|
+
terminal: "terminal";
|
|
204
201
|
}>;
|
|
205
202
|
}, z.core.$strict>>;
|
|
206
203
|
readonly abandon: z.ZodReadonly<z.ZodObject<{
|
|
207
204
|
kind: z.ZodEnum<{
|
|
208
|
-
terminal: "terminal";
|
|
209
205
|
"contract-missing": "contract-missing";
|
|
206
|
+
terminal: "terminal";
|
|
210
207
|
}>;
|
|
211
208
|
}, z.core.$strict>>;
|
|
212
209
|
};
|
|
@@ -217,8 +214,3 @@ export type ForkSourceRefusal = Readonly<{
|
|
|
217
214
|
kind: "fork-source-missing" | "fork-source-unavailable" | "fork-source-moved";
|
|
218
215
|
}>;
|
|
219
216
|
export type KeiyakuRefusal = OperationRefusals[keyof OperationRefusals] | NukeConfirmationRefusal | NukeConfirmationRequiredRefusal | z.output<typeof placementReasonSchema>;
|
|
220
|
-
type RawDeliverRefusal = z.output<typeof deliverRefusalSchema> | z.output<typeof deliveryPreparationRefusalSchema> | z.output<typeof deliverConflictRefusalSchema> | z.output<typeof verificationDeclarationRefusalSchema>;
|
|
221
|
-
export declare function compactDeliverRefusal(reason: RawDeliverRefusal): OperationRefusals["deliver"];
|
|
222
|
-
export declare function compactPreviewRefusal(reason: z.output<typeof deliverRefusalSchema> | z.output<typeof verificationDeclarationRefusalSchema>): OperationRefusals["deliver-preview"];
|
|
223
|
-
export declare function compactVerifyRefusal(reason: z.output<typeof deliverRefusalSchema> | import("../protocol/operations.js").MechanicalPreparationRefusal | z.output<typeof verificationDeclarationRefusalSchema> | z.output<typeof import("../protocol/operations.js").verifyRefusalSchema>): OperationRefusals["verify"];
|
|
224
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { activeReasonSchema, declarationReasonSchema, targetLifecycleReasonSchema, targetWorkspaceReasonSchema, preparationReasonSchema,
|
|
2
|
+
import { activeReasonSchema, declarationReasonSchema, targetLifecycleReasonSchema, targetWorkspaceReasonSchema, preparationReasonSchema, } from "../protocol/result-reasons.js";
|
|
3
3
|
export const nukeConfirmationRefusalSchema = z.strictObject({
|
|
4
4
|
kind: z.literal("nuke-confirmation-mismatch"),
|
|
5
5
|
world: z.string().min(1),
|
|
@@ -48,7 +48,6 @@ export const operationRefusalSchemas = {
|
|
|
48
48
|
verify: z.union([
|
|
49
49
|
previewRefusalSchema,
|
|
50
50
|
preparationReasonSchema,
|
|
51
|
-
z.strictObject({ kind: z.literal("verification-not-selected") }).readonly(),
|
|
52
51
|
z
|
|
53
52
|
.strictObject({ kind: z.literal("verification-index-out-of-range"), total: z.number().int().nonnegative() })
|
|
54
53
|
.readonly(),
|
|
@@ -64,12 +63,3 @@ export const operationRefusalSchemas = {
|
|
|
64
63
|
arc: activeReasonSchema,
|
|
65
64
|
abandon: activeReasonSchema,
|
|
66
65
|
};
|
|
67
|
-
export function compactDeliverRefusal(reason) {
|
|
68
|
-
return compactReason(reason);
|
|
69
|
-
}
|
|
70
|
-
export function compactPreviewRefusal(reason) {
|
|
71
|
-
return compactReason(reason);
|
|
72
|
-
}
|
|
73
|
-
export function compactVerifyRefusal(reason) {
|
|
74
|
-
return compactReason(reason);
|
|
75
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { realpath } from "node:fs/promises";
|
|
2
2
|
import { isAbsolute } from "node:path";
|
|
3
|
+
import { KeiyakuError } from "../errors.js";
|
|
3
4
|
import { currentBranchOperation, scopeOperation } from "../protocol/operations.js";
|
|
4
5
|
import { NoGitWorldError } from "../git/repository.js";
|
|
5
6
|
import { optionalNonblank, requireInput } from "./input.js";
|
|
@@ -8,9 +9,9 @@ const REPO_SCOPES = new WeakMap();
|
|
|
8
9
|
async function resolvePinnedScope(values) {
|
|
9
10
|
const path = values.path;
|
|
10
11
|
if (typeof path !== "string" || path.trim().length === 0)
|
|
11
|
-
throw new
|
|
12
|
+
throw new KeiyakuError("invalid-input", "repository path must be a nonblank string");
|
|
12
13
|
if (!isAbsolute(path))
|
|
13
|
-
throw new
|
|
14
|
+
throw new KeiyakuError("invalid-input", `repository path must be absolute: ${path}`);
|
|
14
15
|
const gitPath = optionalNonblank(values.gitPath, "Git executable path");
|
|
15
16
|
return await scopeOperation({
|
|
16
17
|
coordinate: await realpath(path),
|
|
@@ -35,7 +36,7 @@ export class Repo {
|
|
|
35
36
|
}
|
|
36
37
|
export function scopeForRepo(value) {
|
|
37
38
|
if (!(value instanceof Repo))
|
|
38
|
-
throw new
|
|
39
|
+
throw new KeiyakuError("invalid-input", "repo must be a Repo");
|
|
39
40
|
const scope = REPO_SCOPES.get(value);
|
|
40
41
|
if (scope === undefined)
|
|
41
42
|
throw new TypeError("repo must be a Repo");
|
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import type { BodyLauncher } from "../akuma/body-launch.js";
|
|
4
4
|
import { type AskObserver } from "../akuma/akuma-selection-execution.js";
|
|
5
5
|
import { type AkumaStatus } from "../akuma/akuma.js";
|
|
6
|
-
import { type
|
|
6
|
+
import { type JsonSchemaDocument } from "../akuma/schema.js";
|
|
7
7
|
import type { AkumaAskResult, AkumaKillResult, AkumaObservation, AkumaTellResult, AkumaWaitResult } from "../akuma/selection-observation.js";
|
|
8
8
|
import type { DispatchAssociation } from "../akuma/dispatch-association.js";
|
|
9
9
|
import type { WorldRoot } from "../world.js";
|
|
@@ -16,21 +16,18 @@ export type AkumaWaitInput = AkumaSetAddressInput & Readonly<{
|
|
|
16
16
|
}>;
|
|
17
17
|
export type AkumaTellInput = AkumaAddressInput & Readonly<{
|
|
18
18
|
body: string;
|
|
19
|
-
|
|
20
|
-
initiator?: string;
|
|
21
|
-
signal?: AbortSignal;
|
|
22
|
-
}>;
|
|
23
|
-
export type AkumaAskInput<T = string> = AkumaAddressInput & Readonly<{
|
|
24
|
-
body: string;
|
|
19
|
+
wait?: boolean;
|
|
25
20
|
timeoutMs?: number;
|
|
26
|
-
|
|
21
|
+
observe?: AskObserver;
|
|
27
22
|
interrupt?: boolean;
|
|
28
23
|
initiator?: string;
|
|
29
24
|
signal?: AbortSignal;
|
|
30
|
-
|
|
25
|
+
}>;
|
|
26
|
+
export type AkumaAskInput = Omit<AkumaTellInput, "wait"> & Readonly<{
|
|
27
|
+
schema: JsonSchemaDocument;
|
|
31
28
|
}>;
|
|
32
29
|
export type { AkumaAskResult, AkumaKillResult, AkumaObservation, AkumaTellResult, AkumaWaitResult, } from "../akuma/selection-observation.js";
|
|
33
|
-
export type AkumaKillInput =
|
|
30
|
+
export type AkumaKillInput = AkumaAddressInput & Readonly<{
|
|
34
31
|
signal?: AbortSignal;
|
|
35
32
|
}>;
|
|
36
33
|
export type AkumaHistoryInput = AkumaAddressInput & Readonly<{
|
|
@@ -40,6 +37,20 @@ export type AkumaHistoryInput = AkumaAddressInput & Readonly<{
|
|
|
40
37
|
limit?: number;
|
|
41
38
|
last?: boolean;
|
|
42
39
|
}>;
|
|
40
|
+
export declare const historySelectionSchemas: readonly [...(z.ZodObject<{
|
|
41
|
+
before: z.ZodExactOptional<z.ZodNumber>;
|
|
42
|
+
limit: z.ZodExactOptional<z.ZodNumber>;
|
|
43
|
+
last: z.ZodExactOptional<z.ZodLiteral<false>>;
|
|
44
|
+
}, z.core.$strict> | z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
last: z.ZodExactOptional<z.ZodLiteral<false>>;
|
|
47
|
+
}, z.core.$strict> | z.ZodObject<{
|
|
48
|
+
since: z.ZodNumber;
|
|
49
|
+
limit: z.ZodExactOptional<z.ZodNumber>;
|
|
50
|
+
last: z.ZodExactOptional<z.ZodLiteral<false>>;
|
|
51
|
+
}, z.core.$strict>)[], z.ZodObject<{
|
|
52
|
+
last: z.ZodLiteral<true>;
|
|
53
|
+
}, z.core.$strict>];
|
|
43
54
|
export declare const akumaHistoryResultSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
44
55
|
events: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
45
56
|
kind: z.ZodLiteral<"turn">;
|
|
@@ -183,10 +194,9 @@ export declare const akumaHistoryResultSchema: z.ZodUnion<readonly [z.ZodReadonl
|
|
|
183
194
|
akumaId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../akuma/identity.js").AkumaId, string>>;
|
|
184
195
|
kind: z.ZodLiteral<"akuma">;
|
|
185
196
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
186
|
-
akumaId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../akuma/identity.js").AkumaId, string>>;
|
|
187
|
-
kind: z.ZodLiteral<"akuma-exact">;
|
|
188
|
-
at: z.ZodString;
|
|
189
197
|
sequence: z.ZodNumber;
|
|
198
|
+
turnSequence: z.ZodNumber;
|
|
199
|
+
at: z.ZodString;
|
|
190
200
|
outcome: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
191
201
|
kind: z.ZodLiteral<"answered">;
|
|
192
202
|
answer: z.ZodString;
|
|
@@ -197,15 +207,16 @@ export declare const akumaHistoryResultSchema: z.ZodUnion<readonly [z.ZodReadonl
|
|
|
197
207
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
198
208
|
kind: z.ZodLiteral<"canceled">;
|
|
199
209
|
}, z.core.$strict>>]>;
|
|
200
|
-
turnSequence: z.ZodNumber;
|
|
201
|
-
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
202
210
|
akumaId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../akuma/identity.js").AkumaId, string>>;
|
|
203
|
-
kind: z.ZodLiteral<"akuma-
|
|
204
|
-
|
|
211
|
+
kind: z.ZodLiteral<"akuma-exact">;
|
|
212
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
205
213
|
sequence: z.ZodNumber;
|
|
206
|
-
text: z.ZodString;
|
|
207
214
|
bodySequence: z.ZodNumber;
|
|
208
215
|
turnSequence: z.ZodNumber;
|
|
216
|
+
text: z.ZodString;
|
|
217
|
+
at: z.ZodString;
|
|
218
|
+
akumaId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../akuma/identity.js").AkumaId, string>>;
|
|
219
|
+
kind: z.ZodLiteral<"akuma-report">;
|
|
209
220
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
210
221
|
akumaId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../akuma/identity.js").AkumaId, string>>;
|
|
211
222
|
kind: z.ZodLiteral<"akuma-unknown-history">;
|
|
@@ -230,10 +241,10 @@ export declare function killAkuma(input: AkumaKillInput & Readonly<{
|
|
|
230
241
|
}>, spawn: BodyLauncher): Promise<AkumaKillResult>;
|
|
231
242
|
export declare function tellAkuma(input: AkumaTellInput & Readonly<{
|
|
232
243
|
path: WorldRoot;
|
|
233
|
-
}>, spawn: BodyLauncher): Promise<AkumaTellResult>;
|
|
234
|
-
export declare function askAkuma
|
|
244
|
+
}>, spawn: BodyLauncher, reportDiagnostic?: (message: string) => void): Promise<AkumaTellResult>;
|
|
245
|
+
export declare function askAkuma(input: AkumaAskInput & Readonly<{
|
|
235
246
|
path: WorldRoot;
|
|
236
|
-
}>, spawn: BodyLauncher, reportDiagnostic?: (message: string) => void): Promise<AkumaAskResult
|
|
247
|
+
}>, spawn: BodyLauncher, reportDiagnostic?: (message: string) => void): Promise<AkumaAskResult>;
|
|
237
248
|
export declare function historyAkuma(input: AkumaHistoryInput & Readonly<{
|
|
238
249
|
path: WorldRoot;
|
|
239
250
|
}>, reportDiagnostic?: (message: string) => void): Promise<AkumaHistoryResult>;
|