@astrosheep/keiyaku 4.6.4 → 4.6.7

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.
Files changed (247) hide show
  1. package/README.md +7 -0
  2. package/build/{integrations/marketplace → plugins}/.agents/plugins/marketplace.json +1 -1
  3. package/build/plugins/.claude-plugin/marketplace.json +5 -0
  4. package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/.claude-plugin/plugin.json +1 -1
  5. package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-akuma/SKILL.md +43 -8
  6. package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-bind/SKILL.md +7 -8
  7. package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-workflow/SKILL.md +3 -3
  8. package/build/{integrations/marketplace/plugins/keiyaku → plugins/codex}/.codex-plugin/plugin.json +1 -1
  9. package/build/plugins/codex/skills/keiyaku/SKILL.md +44 -0
  10. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +130 -0
  11. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +269 -0
  12. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +65 -0
  13. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +216 -0
  14. package/build/plugins/codex/skills/keiyaku-bind/agents/openai.yaml +4 -0
  15. package/build/plugins/codex/skills/keiyaku-task/SKILL.md +104 -0
  16. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +129 -0
  17. package/build/plugins/opencode/package.json +6 -0
  18. package/build/plugins/opencode/skills/keiyaku/SKILL.md +44 -0
  19. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +130 -0
  20. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +269 -0
  21. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +65 -0
  22. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +216 -0
  23. package/build/plugins/opencode/skills/keiyaku-bind/agents/openai.yaml +4 -0
  24. package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +104 -0
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +129 -0
  26. package/build/skills/keiyaku/SKILL.md +44 -0
  27. package/build/skills/keiyaku-akuma/SKILL.md +130 -0
  28. package/build/skills/keiyaku-akuma/references/automation.md +269 -0
  29. package/build/skills/keiyaku-babysit/SKILL.md +65 -0
  30. package/build/skills/keiyaku-bind/SKILL.md +216 -0
  31. package/build/skills/keiyaku-bind/agents/openai.yaml +4 -0
  32. package/build/skills/keiyaku-task/SKILL.md +104 -0
  33. package/build/skills/keiyaku-workflow/SKILL.md +129 -0
  34. package/build/src/akuma/akuma-instance.js +7 -5
  35. package/build/src/akuma/akuma-observe.d.ts +22 -15
  36. package/build/src/akuma/akuma-observe.js +87 -16
  37. package/build/src/akuma/akuma-owner.d.ts +3 -2
  38. package/build/src/akuma/akuma-owner.js +28 -10
  39. package/build/src/akuma/akuma-selection-execution.d.ts +3 -1
  40. package/build/src/akuma/akuma-selection-execution.js +2 -1
  41. package/build/src/akuma/akuma-wait.d.ts +6 -4
  42. package/build/src/akuma/akuma-wait.js +78 -53
  43. package/build/src/akuma/akuma.d.ts +6 -4
  44. package/build/src/akuma/akuma.js +4 -0
  45. package/build/src/akuma/body.d.ts +1 -0
  46. package/build/src/akuma/body.js +12 -23
  47. package/build/src/akuma/call-initial-tell.d.ts +2 -2
  48. package/build/src/akuma/call-initial-tell.js +1 -1
  49. package/build/src/akuma/call-request.d.ts +2 -2
  50. package/build/src/akuma/heart/index.d.ts +7 -2
  51. package/build/src/akuma/heart/index.js +50 -5
  52. package/build/src/akuma/heart/tells.d.ts +33 -2
  53. package/build/src/akuma/heart/tells.js +24 -18
  54. package/build/src/akuma/heart/timeline.d.ts +23 -1
  55. package/build/src/akuma/heart/timeline.js +28 -21
  56. package/build/src/akuma/projection.d.ts +10 -10
  57. package/build/src/akuma/providers/pi/index.js +72 -39
  58. package/build/src/akuma/selection-observation.d.ts +20 -20
  59. package/build/src/akuma/selection-owner-port.d.ts +1 -1
  60. package/build/src/akuma/selection-owner-port.js +16 -5
  61. package/build/src/akuma/selection-request.d.ts +2 -0
  62. package/build/src/akuma/selection-request.js +2 -1
  63. package/build/src/akuma-body.js +5 -2
  64. package/build/src/alias/index.d.ts +0 -1
  65. package/build/src/alias/index.js +0 -4
  66. package/build/src/body/amend.d.ts +0 -4
  67. package/build/src/body/amend.js +0 -3
  68. package/build/src/body/region.d.ts +0 -1
  69. package/build/src/body/region.js +0 -3
  70. package/build/src/body/verification.d.ts +0 -1
  71. package/build/src/cli/commands/akuma-grammar.js +23 -66
  72. package/build/src/cli/commands/akuma.js +23 -42
  73. package/build/src/cli/commands/contract-grammar.d.ts +14 -1
  74. package/build/src/cli/commands/contract-grammar.js +54 -21
  75. package/build/src/cli/commands/contract-help.d.ts +9 -8
  76. package/build/src/cli/commands/contract-help.js +14 -7
  77. package/build/src/cli/commands/contract.js +57 -117
  78. package/build/src/cli/commands/install.d.ts +5 -5
  79. package/build/src/cli/commands/install.js +4 -7
  80. package/build/src/cli/commands/task-grammar.js +10 -66
  81. package/build/src/cli/commands/task.d.ts +0 -1
  82. package/build/src/cli/commands/task.js +34 -53
  83. package/build/src/cli/coordinates.d.ts +1 -2
  84. package/build/src/cli/coordinates.js +1 -4
  85. package/build/src/cli/parse.d.ts +2 -3
  86. package/build/src/cli/parse.js +24 -66
  87. package/build/src/cli/render/akuma.d.ts +3 -16
  88. package/build/src/cli/render/akuma.js +1 -13
  89. package/build/src/cli/render/audit.js +1 -1
  90. package/build/src/cli/render/contract.js +34 -32
  91. package/build/src/cli/render/kanshi-akuma.d.ts +8 -2
  92. package/build/src/cli/render/kanshi-akuma.js +14 -7
  93. package/build/src/cli/render/kanshi.d.ts +3 -1
  94. package/build/src/cli/render/kanshi.js +44 -32
  95. package/build/src/cli/render/receipt.js +6 -1
  96. package/build/src/cli/render/task.d.ts +1 -1
  97. package/build/src/cli/render/task.js +3 -27
  98. package/build/src/cli/render/terminal.d.ts +6 -2
  99. package/build/src/cli/render/terminal.js +8 -2
  100. package/build/src/cli/runtime.js +3 -16
  101. package/build/src/cli/scan.d.ts +26 -0
  102. package/build/src/cli/scan.js +82 -0
  103. package/build/src/cli/streams.d.ts +5 -0
  104. package/build/src/cli/streams.js +11 -0
  105. package/build/src/contract-worktree.js +38 -21
  106. package/build/src/core/facts/codec.d.ts +1 -2
  107. package/build/src/core/facts/codec.js +5 -11
  108. package/build/src/core/facts/types.d.ts +16 -2
  109. package/build/src/core/facts/types.js +15 -0
  110. package/build/src/core/verbs/abandon.js +3 -9
  111. package/build/src/core/verbs/amend.js +2 -9
  112. package/build/src/core/verbs/arc.js +6 -13
  113. package/build/src/core/verbs/attestation.js +2 -9
  114. package/build/src/core/verbs/bind.js +2 -9
  115. package/build/src/core/verbs/deliver.js +2 -9
  116. package/build/src/core/verbs/placement.d.ts +1 -1
  117. package/build/src/core/verbs/placement.js +2 -9
  118. package/build/src/core/verbs/reintegrate.d.ts +1 -1
  119. package/build/src/core/verbs/reintegrate.js +2 -9
  120. package/build/src/dispatch/index.d.ts +2 -2
  121. package/build/src/dispatch/index.js +33 -11
  122. package/build/src/git/hooks.d.ts +2 -4
  123. package/build/src/git/hooks.js +0 -12
  124. package/build/src/git/integration.d.ts +5 -3
  125. package/build/src/git/integration.js +36 -25
  126. package/build/src/git/nuke.js +4 -4
  127. package/build/src/git/observe.d.ts +4 -4
  128. package/build/src/git/observe.js +5 -5
  129. package/build/src/git/process.d.ts +1 -4
  130. package/build/src/git/process.js +1 -11
  131. package/build/src/git/read-observation.js +1 -1
  132. package/build/src/git/reconcile.d.ts +1 -1
  133. package/build/src/git/reconcile.js +15 -13
  134. package/build/src/git/repository.d.ts +2 -6
  135. package/build/src/git/repository.js +18 -31
  136. package/build/src/git/scratch.d.ts +6 -6
  137. package/build/src/git/scratch.js +110 -46
  138. package/build/src/git/target-placement.d.ts +5 -5
  139. package/build/src/git/target-placement.js +18 -33
  140. package/build/src/git/tender.d.ts +6 -2
  141. package/build/src/git/tender.js +19 -12
  142. package/build/src/git/terminal-reconcile.js +24 -13
  143. package/build/src/git/terminal-seal.d.ts +2 -5
  144. package/build/src/git/terminal-seal.js +5 -3
  145. package/build/src/git/workspace.d.ts +17 -13
  146. package/build/src/git/workspace.js +58 -41
  147. package/build/src/kanshi/index.d.ts +2 -2
  148. package/build/src/kanshi/index.js +1 -1
  149. package/build/src/kanshi/read.d.ts +8 -1
  150. package/build/src/kanshi/read.js +72 -7
  151. package/build/src/kanshi/report.d.ts +12 -0
  152. package/build/src/library/akuma-creation.d.ts +4 -4
  153. package/build/src/library/akuma-creation.js +21 -19
  154. package/build/src/library/bind.d.ts +1 -63
  155. package/build/src/library/bind.js +3 -9
  156. package/build/src/library/contract-creation.js +2 -30
  157. package/build/src/library/contract-execution.d.ts +0 -1
  158. package/build/src/library/contract-execution.js +9 -34
  159. package/build/src/library/contract-operations.d.ts +5 -1
  160. package/build/src/library/contract-operations.js +7 -3
  161. package/build/src/library/contract-types.d.ts +1 -1
  162. package/build/src/library/delivery.d.ts +91 -93
  163. package/build/src/library/delivery.js +2 -1
  164. package/build/src/library/input.d.ts +0 -2
  165. package/build/src/library/input.js +0 -4
  166. package/build/src/library/invocation.d.ts +0 -1
  167. package/build/src/library/invocation.js +3 -25
  168. package/build/src/library/outcome.d.ts +651 -602
  169. package/build/src/library/outcome.js +4 -4
  170. package/build/src/library/reconcile.d.ts +6 -0
  171. package/build/src/library/reconcile.js +31 -1
  172. package/build/src/library/repo.d.ts +0 -1
  173. package/build/src/library/selection.d.ts +1 -10
  174. package/build/src/library/selection.js +19 -17
  175. package/build/src/plugin/akuma-signals.d.ts +10 -11
  176. package/build/src/plugin/akuma-signals.js +36 -20
  177. package/build/src/plugin/public.d.ts +5 -0
  178. package/build/src/plugin/runtime.d.ts +1 -0
  179. package/build/src/plugin/runtime.js +34 -23
  180. package/build/src/protocol/abandon.d.ts +1 -1
  181. package/build/src/protocol/abandon.js +3 -10
  182. package/build/src/protocol/amend.js +2 -5
  183. package/build/src/protocol/arc.d.ts +1 -1
  184. package/build/src/protocol/arc.js +2 -9
  185. package/build/src/protocol/attempt.d.ts +3 -20
  186. package/build/src/protocol/attempt.js +6 -5
  187. package/build/src/protocol/audit.d.ts +1 -0
  188. package/build/src/protocol/audit.js +10 -11
  189. package/build/src/protocol/completion.d.ts +129 -55
  190. package/build/src/protocol/completion.js +62 -73
  191. package/build/src/protocol/deliver.d.ts +7 -5
  192. package/build/src/protocol/deliver.js +74 -44
  193. package/build/src/protocol/execution-observation.d.ts +2 -4
  194. package/build/src/protocol/execution-observation.js +3 -7
  195. package/build/src/protocol/intent.d.ts +1 -1
  196. package/build/src/protocol/intent.js +1 -0
  197. package/build/src/protocol/operations.d.ts +24 -12
  198. package/build/src/protocol/operations.js +36 -15
  199. package/build/src/protocol/placement.d.ts +2 -1
  200. package/build/src/protocol/placement.js +21 -5
  201. package/build/src/protocol/progress.d.ts +1 -1
  202. package/build/src/protocol/read/status.js +58 -41
  203. package/build/src/protocol/reintegrate.d.ts +1 -1
  204. package/build/src/protocol/reintegrate.js +10 -19
  205. package/build/src/protocol/review.d.ts +3 -28
  206. package/build/src/protocol/review.js +10 -37
  207. package/build/src/protocol/run.d.ts +19 -7
  208. package/build/src/protocol/run.js +19 -9
  209. package/build/src/runtime/proc/windows-launch.exe +0 -0
  210. package/build/src/settlement/holder.d.ts +2 -4
  211. package/build/src/settlement/holder.js +3 -6
  212. package/build/src/task/board.d.ts +6 -0
  213. package/build/src/task/board.js +30 -1
  214. package/build/src/task/catalog.js +1 -4
  215. package/build/src/task/compose.d.ts +0 -1
  216. package/build/src/task/compose.js +0 -1
  217. package/build/src/task/context.d.ts +0 -1
  218. package/build/src/task/context.js +0 -3
  219. package/build/src/task/created-observation.d.ts +5 -1
  220. package/build/src/task/created-observation.js +12 -5
  221. package/build/src/task/index.d.ts +1 -1
  222. package/build/src/task/index.js +7 -6
  223. package/build/src/task/input.d.ts +0 -6
  224. package/build/src/task/input.js +2 -14
  225. package/build/src/task/mutation.d.ts +3 -4
  226. package/build/src/task/mutation.js +11 -39
  227. package/build/src/task/operations.d.ts +2 -7
  228. package/build/src/task/operations.js +37 -49
  229. package/build/src/task/query.d.ts +0 -1
  230. package/build/src/task/query.js +1 -4
  231. package/build/src/task/store.d.ts +0 -2
  232. package/build/src/task/store.js +27 -11
  233. package/build/src/verification/declaration.js +3 -2
  234. package/build/src/verification/execution.d.ts +3 -2
  235. package/build/src/verification/execution.js +10 -6
  236. package/build/src/workspace-place.d.ts +0 -1
  237. package/build/src/workspace-place.js +0 -11
  238. package/package.json +13 -9
  239. package/build/integrations/marketplace/.claude-plugin/marketplace.json +0 -5
  240. package/build/integrations/marketplace/plugins/keiyaku/package.json +0 -17
  241. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku/SKILL.md +0 -0
  242. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-akuma/references/automation.md +0 -0
  243. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-babysit/SKILL.md +0 -0
  244. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-bind/agents/openai.yaml +0 -0
  245. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-task/SKILL.md +0 -0
  246. /package/build/{integrations/marketplace/plugins/keiyaku/opencode.js → plugins/opencode/index.js} +0 -0
  247. /package/build/{integrations → plugins}/pi/keiyaku.ts +0 -0
@@ -10,7 +10,7 @@ import { HeldAkumaLeash, breakBody, decidePendingTellDisposition, drainPendingTe
10
10
  import { akumaPathsSchema, pathsForAkuId, worldRootForAkumaPaths } from "./identity.js";
11
11
  import { admitCallInitialTell, } from "./call-initial-tell.js";
12
12
  import { akumaExecutionEnvironment } from "./providers/execution-environment.js";
13
- import { pluginRuntime } from "../plugin/runtime.js";
13
+ import { emitPluginSignal } from "../plugin/akuma-signals.js";
14
14
  import { World } from "../world.js";
15
15
  import { resolveProviderExecution } from "./providers/index.js";
16
16
  import { clearBodyRequestTransport, settleBodyRequests } from "./request-serve.js";
@@ -156,7 +156,7 @@ function boundedDiagnostic(error) {
156
156
  const text = diagnostic(error);
157
157
  return text.length <= 500 ? text : `${text.slice(0, 500)}...`;
158
158
  }
159
- async function recordPluginDiagnostic(paths, occurrence, error) {
159
+ export async function recordPluginDiagnostic(paths, occurrence, error) {
160
160
  try {
161
161
  await appendFile(paths.log, `plugin ${occurrence} failed: ${boundedDiagnostic(error)}\n`);
162
162
  }
@@ -306,8 +306,7 @@ async function recoverBodyRequests(input) {
306
306
  }
307
307
  return false;
308
308
  }
309
- function turnOutcomeEmitter(launch, soul) {
310
- let plugins;
309
+ function turnOutcomeEmitter(launch, soul, world) {
311
310
  const reportDiagnostic = (message) => {
312
311
  void recordPluginDiagnostic(launch.paths, "turn outcome", message);
313
312
  };
@@ -318,11 +317,7 @@ function turnOutcomeEmitter(launch, soul) {
318
317
  if (turn === null)
319
318
  throw new Error(`Committed Turn ${turnSequence} is missing from Heart`);
320
319
  const participants = await readTurnParticipants(launch.paths, turnSequence);
321
- plugins ??= pluginRuntime({
322
- world: await World.at(worldRootForAkumaPaths(launch.paths)),
323
- reportDiagnostic,
324
- });
325
- await (await plugins).emit({
320
+ await emitPluginSignal({ world, reportDiagnostic }, {
326
321
  kind: "akuma.turn-outcome",
327
322
  akumaId: soul.id,
328
323
  bodySequence: turn.bodySequence,
@@ -333,7 +328,7 @@ function turnOutcomeEmitter(launch, soul) {
333
328
  ? { kind: "answered", text: outcome.answer }
334
329
  : { kind: "failed", reason: outcome.diagnostic },
335
330
  ...(launch.completion?.contractId === undefined ? {} : { contractId: launch.completion.contractId }),
336
- }, reportDiagnostic);
331
+ });
337
332
  }
338
333
  catch (error) {
339
334
  await recordPluginDiagnostic(launch.paths, "turn outcome", error);
@@ -341,22 +336,16 @@ function turnOutcomeEmitter(launch, soul) {
341
336
  },
342
337
  };
343
338
  }
344
- function bodyEndEmitter(launch, soul) {
345
- let plugins;
339
+ function bodyEndEmitter(launch, soul, world) {
346
340
  const reportDiagnostic = (message) => {
347
341
  void recordPluginDiagnostic(launch.paths, "body end", message);
348
342
  };
349
- return (bodySequence, end, diagnostic) => (async () => {
343
+ return async (bodySequence, end, diagnostic) => {
350
344
  try {
351
345
  const latestTurn = await readLatestTurnForBody(launch.paths, bodySequence);
352
346
  const initiator = latestTurn?.initiator;
353
347
  const participants = latestTurn === null ? [] : await readTurnParticipants(launch.paths, latestTurn.sequence);
354
- plugins ??= pluginRuntime({
355
- world: await World.at(worldRootForAkumaPaths(launch.paths)),
356
- reportDiagnostic,
357
- });
358
- const runtime = await plugins;
359
- await runtime.emit({
348
+ await emitPluginSignal({ world, reportDiagnostic }, {
360
349
  kind: "akuma.body-ended",
361
350
  akumaId: soul.id,
362
351
  bodySequence,
@@ -365,12 +354,12 @@ function bodyEndEmitter(launch, soul) {
365
354
  ...(participants.length === 0 ? {} : { participants }),
366
355
  ...(diagnostic === undefined ? {} : { diagnostic }),
367
356
  ...(launch.completion?.contractId === undefined ? {} : { contractId: launch.completion.contractId }),
368
- }, reportDiagnostic);
357
+ });
369
358
  }
370
359
  catch (error) {
371
360
  await recordPluginDiagnostic(launch.paths, "body end", error);
372
361
  }
373
- })();
362
+ };
374
363
  }
375
364
  async function admitInitialCallTell(runtime, input) {
376
365
  const paths = pathsForAkuId(runtime.world, input.id);
@@ -575,8 +564,8 @@ export async function driveAkumaBody(launch, adapter, runtimeInput = {}) {
575
564
  const prepared = await prepareBodyExecution(launch, leash, runtime, adapter);
576
565
  if (prepared === null)
577
566
  return;
578
- emitBodyEnd = bodyEndEmitter(launch, prepared.soul);
579
- emitTurnOutcome = turnOutcomeEmitter(launch, prepared.soul);
567
+ emitBodyEnd = bodyEndEmitter(launch, prepared.soul, world);
568
+ emitTurnOutcome = turnOutcomeEmitter(launch, prepared.soul, world);
580
569
  const body = await leash.recordBody(launch.paths, { leashTakenAt: runtime.now() });
581
570
  bodySequence = body.sequence;
582
571
  const supervisor = await BodySupervisor.open(launch.paths, body.sequence, leash);
@@ -78,8 +78,8 @@ export declare const tellResultSchema: z.ZodObject<{
78
78
  }>;
79
79
  turnSequence: z.ZodNumber;
80
80
  receipt: z.ZodOptional<z.ZodEnum<{
81
- required: "required";
82
81
  unavailable: "unavailable";
82
+ required: "required";
83
83
  }>>;
84
84
  }, z.core.$strict>, z.ZodTransform<Readonly<{
85
85
  turnSequence: number;
@@ -90,7 +90,7 @@ export declare const tellResultSchema: z.ZodObject<{
90
90
  deliveredAt: string;
91
91
  route: "live" | "launch";
92
92
  turnSequence: number;
93
- receipt?: "required" | "unavailable" | undefined;
93
+ receipt?: "unavailable" | "required" | undefined;
94
94
  }>>>>;
95
95
  }, z.core.$strict>;
96
96
  wake: z.ZodUnion<readonly [z.ZodObject<{
@@ -37,7 +37,7 @@ export async function admitCallInitialTell(input) {
37
37
  const birth = await waitForObservation({
38
38
  timeoutMs: BIRTH_TIMEOUT_MS,
39
39
  ...(input.signal === undefined ? {} : { signal: input.signal }),
40
- probe: async () => await readWaitComplete(input.world, input.id),
40
+ probe: async () => await readWaitComplete(input.world, [input.id], "all", input.signal),
41
41
  observe: async () => (await bornStatus(paths, input.id, { aperture: "receipt" })).status,
42
42
  complete: defaultWaitComplete,
43
43
  });
@@ -206,8 +206,8 @@ declare const liveResultSchema: z.ZodObject<{
206
206
  }>;
207
207
  turnSequence: z.ZodNumber;
208
208
  receipt: z.ZodOptional<z.ZodEnum<{
209
- required: "required";
210
209
  unavailable: "unavailable";
210
+ required: "required";
211
211
  }>>;
212
212
  }, z.core.$strict>, z.ZodTransform<Readonly<{
213
213
  turnSequence: number;
@@ -218,7 +218,7 @@ declare const liveResultSchema: z.ZodObject<{
218
218
  deliveredAt: string;
219
219
  route: "live" | "launch";
220
220
  turnSequence: number;
221
- receipt?: "required" | "unavailable" | undefined;
221
+ receipt?: "unavailable" | "required" | undefined;
222
222
  }>>>>;
223
223
  }, z.core.$strict>;
224
224
  wake: z.ZodUnion<readonly [z.ZodObject<{
@@ -23,12 +23,17 @@ export type ActivitySlice = ActivityFactSlice;
23
23
  export type { ActivityFact };
24
24
  export type { TimelineFact } from "./timeline.js";
25
25
  export declare function activitySlice(paths: AkumaPaths): Promise<ActivitySlice>;
26
- export declare function readStatusFacts(paths: AkumaPaths, input: StatusFactInput): Promise<ActivitySlice["rows"]>;
26
+ export declare function readStatusFacts(paths: AkumaPaths, input: StatusFactInput, signal?: AbortSignal): Promise<ActivitySlice["rows"]>;
27
+ /** One live observation's successful raw input and decoded frontier, never a connection. */
28
+ export declare function createStatusFactReader(paths: AkumaPaths): {
29
+ clear(): void;
30
+ read(input: StatusFactInput, signal?: AbortSignal): Promise<ActivitySlice["rows"]>;
31
+ };
27
32
  type LifeSnapshot = Pick<HeartSnapshot, "soul" | "latestBody" | "latestSession" | "latestKill"> & Readonly<{
28
33
  hasPendingTell: boolean;
29
34
  }>;
30
35
  /** Lifecycle probes do not load narration, Tell bodies, or delivery histories. */
31
- export declare function readLifeSnapshot(paths: AkumaPaths): Promise<LifeSnapshot>;
36
+ export declare function readLifeSnapshot(paths: AkumaPaths, signal?: AbortSignal): Promise<LifeSnapshot>;
32
37
  export declare function recordTell(paths: AkumaPaths, tell: Omit<TellFact, "sequence" | "state" | "deliveries" | "binding">, options?: Readonly<{
33
38
  interrupt?: boolean;
34
39
  }>): Promise<Readonly<{
@@ -1,7 +1,7 @@
1
1
  import { parsePublicHistoryId } from "../identity.js";
2
2
  import { answeredTurnFact, endBodyFact, finishBodyFact, deleteStopControl, insertActivityFact, insertTurnEndFact, insertTurnStartFact, insertPauseControl, insertKillFact, insertSessionFact, insertStopControl, killFactForBody, latestBodyFact, latestKillFact, latestSessionFact, latestTurnFactForBody, lastAnsweredTurnFact, pauseFact, sessionFactForCoordinate, stopFact, turnFact, } from "./rows.js";
3
3
  import { insertTellDeliveryFact, dispositionSnapshotProven, insertTellBindingFact, insertTellDispositionSnapshot, insertTellFact, insertTellReceiptFact, insertUndeliveredTellReceipts, latestOpenTellDisposition, openBoundTurns, openTellDispositionIds, pendingTellFacts, hasPendingTell, resolveTellDispositionSnapshot, tellDispositionResolved, tellFact, tellIdsForFence, turnParticipants, } from "./tells.js";
4
- import { activityFactSlice, statusFacts, lastActivityAt as readLastActivityAt, pruneActivityFacts, } from "./timeline.js";
4
+ import { activityFactSlice, statusFacts, readStatusBatch, decodeTimelineBatch, lastActivityAt as readLastActivityAt, pruneActivityFacts, } from "./timeline.js";
5
5
  import { isHeartAbsent, readSealFromLeash, withHeartTransaction, withReadOnlyHeart } from "./storage.js";
6
6
  import { soulFact } from "./soul.js";
7
7
  import { AkumaBusyError, HeartAuthorityCorruptionError } from "./facts.js";
@@ -53,11 +53,56 @@ export async function appendActivity(paths, input) {
53
53
  export async function activitySlice(paths) {
54
54
  return await withReadOnlyHeart(paths, (heart) => activityFactSlice(heart));
55
55
  }
56
- export async function readStatusFacts(paths, input) {
57
- return await withReadOnlyHeart(paths, (heart) => statusFacts(heart, input));
56
+ export async function readStatusFacts(paths, input, signal) {
57
+ return await withReadOnlyHeart(paths, (heart) => statusFacts(heart, input), signal);
58
+ }
59
+ // Each query returns a fixed set of scalar columns; compare JSON columns as text.
60
+ function sameRawRows(left, right) {
61
+ if (left.length !== right.length)
62
+ return false;
63
+ if (left.length === 0)
64
+ return true;
65
+ const columns = Object.keys(left[0]);
66
+ return left.every((row, index) => columns.every((column) => row[column] === right[index][column]));
67
+ }
68
+ function sameStatusBatch(left, right) {
69
+ return (left.frontier === right.frontier &&
70
+ sameRawRows(left.rows, right.rows) &&
71
+ sameRawRows(left.turns, right.turns) &&
72
+ sameRawRows(left.calls, right.calls) &&
73
+ sameRawRows(left.activity, right.activity) &&
74
+ sameRawRows(left.tells.rows, right.tells.rows) &&
75
+ sameRawRows(left.tells.deliveries, right.tells.deliveries) &&
76
+ sameRawRows(left.tells.bindings, right.tells.bindings));
77
+ }
78
+ /** One live observation's successful raw input and decoded frontier, never a connection. */
79
+ export function createStatusFactReader(paths) {
80
+ let memo;
81
+ return {
82
+ clear() {
83
+ memo = undefined;
84
+ },
85
+ async read(input, signal) {
86
+ try {
87
+ const next = await withReadOnlyHeart(paths, (heart) => {
88
+ const batch = readStatusBatch(heart, input);
89
+ if (memo !== undefined && sameStatusBatch(batch, memo.batch))
90
+ return memo;
91
+ return { batch, facts: decodeTimelineBatch(batch) };
92
+ }, signal);
93
+ // Publication follows COMMIT, so failed reads can never supply a fallback.
94
+ memo = next;
95
+ return next.facts;
96
+ }
97
+ catch (error) {
98
+ memo = undefined;
99
+ throw error;
100
+ }
101
+ },
102
+ };
58
103
  }
59
104
  /** Lifecycle probes do not load narration, Tell bodies, or delivery histories. */
60
- export async function readLifeSnapshot(paths) {
105
+ export async function readLifeSnapshot(paths, signal) {
61
106
  try {
62
107
  return await withReadOnlyHeart(paths, (heart) => ({
63
108
  soul: soulFact(heart),
@@ -65,7 +110,7 @@ export async function readLifeSnapshot(paths) {
65
110
  latestSession: latestSessionFact(heart),
66
111
  latestKill: latestKillFact(heart),
67
112
  hasPendingTell: hasPendingTell(heart),
68
- }));
113
+ }), signal);
69
114
  }
70
115
  catch (error) {
71
116
  if (isHeartAbsent(error))
@@ -1,9 +1,39 @@
1
1
  import type { DatabaseSync } from "node:sqlite";
2
- import { type TellDeliveryInput, type TellFact, type TellReceiptInput } from "./facts.js";
2
+ import { type TellDelivery, type TellDeliveryInput, type TellFact, type TellReceiptInput } from "./facts.js";
3
+ type TellRow = Readonly<{
4
+ sequence: number;
5
+ id: string;
6
+ body: string;
7
+ schema_json: string | null;
8
+ initiator: string | null;
9
+ recorded_at: string;
10
+ state: TellFact["state"];
11
+ }>;
12
+ type TellDeliveryRow = Readonly<{
13
+ turn_sequence: number;
14
+ route: TellDelivery["route"];
15
+ receipt: TellDelivery["receipt"] | null;
16
+ delivered_at: string;
17
+ }>;
3
18
  export declare const tellStateSql = "CASE\n WHEN EXISTS (\n SELECT 1 FROM tell_deliveries d\n WHERE d.tell_id = tells.id AND (d.route = 'launch' OR d.receipt = 'unavailable')\n ) THEN 'told'\n WHEN EXISTS (SELECT 1 FROM tell_receipts r WHERE r.evidence = 'exact' AND r.tell_id = tells.id) THEN 'told'\n WHEN EXISTS (\n SELECT 1 FROM tell_receipts r\n JOIN tell_deliveries d ON d.turn_sequence = r.turn_sequence AND d.fence = r.fence\n WHERE r.evidence = 'fence' AND d.tell_id = tells.id\n ) THEN 'told'\n ELSE 'pending'\nEND";
4
19
  export declare const pendingTellSequencesSql = "SELECT tells.sequence FROM tells WHERE CASE\n WHEN EXISTS (\n SELECT 1 FROM tell_deliveries d\n WHERE d.tell_id = tells.id AND (d.route = 'launch' OR d.receipt = 'unavailable')\n ) THEN 'told'\n WHEN EXISTS (SELECT 1 FROM tell_receipts r WHERE r.evidence = 'exact' AND r.tell_id = tells.id) THEN 'told'\n WHEN EXISTS (\n SELECT 1 FROM tell_receipts r\n JOIN tell_deliveries d ON d.turn_sequence = r.turn_sequence AND d.fence = r.fence\n WHERE r.evidence = 'fence' AND d.tell_id = tells.id\n ) THEN 'told'\n ELSE 'pending'\nEND = 'pending'\n UNION SELECT tells.sequence FROM tells JOIN tell_disposition_members m ON m.tell_id = tells.id";
5
20
  export declare const pendingTellProtectionSql = "SELECT d.turn_sequence FROM tell_deliveries d\n JOIN tells ON tells.id = d.tell_id WHERE CASE\n WHEN EXISTS (\n SELECT 1 FROM tell_deliveries d\n WHERE d.tell_id = tells.id AND (d.route = 'launch' OR d.receipt = 'unavailable')\n ) THEN 'told'\n WHEN EXISTS (SELECT 1 FROM tell_receipts r WHERE r.evidence = 'exact' AND r.tell_id = tells.id) THEN 'told'\n WHEN EXISTS (\n SELECT 1 FROM tell_receipts r\n JOIN tell_deliveries d ON d.turn_sequence = r.turn_sequence AND d.fence = r.fence\n WHERE r.evidence = 'fence' AND d.tell_id = tells.id\n ) THEN 'told'\n ELSE 'pending'\nEND = 'pending'\n UNION SELECT d.turn_sequence FROM tell_deliveries d JOIN tell_disposition_members m ON m.tell_id = d.tell_id";
6
- export declare function tellFactsAtSequences(database: DatabaseSync, sequences: readonly number[]): readonly TellFact[];
21
+ type TellBatch = Readonly<{
22
+ rows: readonly TellRow[];
23
+ deliveries: readonly (TellDeliveryRow & {
24
+ sequence: number;
25
+ tell_id: string;
26
+ fence: string;
27
+ })[];
28
+ bindings: readonly {
29
+ sequence: number;
30
+ tell_id: string;
31
+ turn_sequence: number;
32
+ bound_at: string;
33
+ }[];
34
+ }>;
35
+ export declare function decodeTellBatch(batch: TellBatch): readonly TellFact[];
36
+ export declare function tellBatchAtSequences(database: DatabaseSync, sequences: readonly number[]): TellBatch;
7
37
  export declare function hasPendingTell(database: DatabaseSync): boolean;
8
38
  export declare function insertTellFact(database: DatabaseSync, tell: Omit<TellFact, "sequence" | "state" | "deliveries">): number;
9
39
  export declare function tellFact(database: DatabaseSync, id: string): TellFact | null;
@@ -30,3 +60,4 @@ export declare function insertTellBindingFact(database: DatabaseSync, input: Rea
30
60
  export declare function turnParticipants(database: DatabaseSync, turnSequence: number): readonly string[];
31
61
  export declare function drainPendingTells(pending: readonly TellFact[], activeTurnSequences?: readonly number[]): readonly TellFact[];
32
62
  export declare function openBoundTurns(database: DatabaseSync, bodySequence: number): readonly number[];
63
+ export {};
@@ -18,16 +18,26 @@ export const pendingTellSequencesSql = `SELECT tells.sequence FROM tells WHERE $
18
18
  export const pendingTellProtectionSql = `SELECT d.turn_sequence FROM tell_deliveries d
19
19
  JOIN tells ON tells.id = d.tell_id WHERE ${tellStateSql} = 'pending'
20
20
  UNION SELECT d.turn_sequence FROM tell_deliveries d JOIN tell_disposition_members m ON m.tell_id = d.tell_id`;
21
- function decodeTellRows(database, rows) {
21
+ function readTellBatch(database, rows) {
22
22
  if (rows.length === 0)
23
- return [];
23
+ return { rows, deliveries: [], bindings: [] };
24
24
  const ids = JSON.stringify(rows.map((row) => row.id));
25
- const deliveries = new Map();
26
- const deliveryRows = database
27
- .prepare(`SELECT tell_id, turn_sequence, route, receipt, delivered_at
25
+ const deliveries = database
26
+ .prepare(`SELECT sequence, tell_id, turn_sequence, fence, route, receipt, delivered_at
28
27
  FROM tell_deliveries WHERE tell_id IN (SELECT value FROM json_each(?)) ORDER BY sequence`)
29
28
  .all(ids);
30
- for (const row of deliveryRows) {
29
+ const bindings = database
30
+ .prepare(`SELECT sequence, tell_id, turn_sequence, bound_at FROM tell_bindings
31
+ WHERE sequence IN (
32
+ SELECT MAX(sequence) FROM tell_bindings
33
+ WHERE tell_id IN (SELECT value FROM json_each(?)) GROUP BY tell_id
34
+ ) ORDER BY sequence`)
35
+ .all(ids);
36
+ return { rows, deliveries, bindings };
37
+ }
38
+ export function decodeTellBatch(batch) {
39
+ const deliveries = new Map();
40
+ for (const row of batch.deliveries) {
31
41
  const group = deliveries.get(row.tell_id) ?? [];
32
42
  group.push({
33
43
  turnSequence: row.turn_sequence,
@@ -38,16 +48,9 @@ function decodeTellRows(database, rows) {
38
48
  deliveries.set(row.tell_id, group);
39
49
  }
40
50
  const bindings = new Map();
41
- const bindingRows = database
42
- .prepare(`SELECT tell_id, turn_sequence, bound_at FROM tell_bindings
43
- WHERE sequence IN (
44
- SELECT MAX(sequence) FROM tell_bindings
45
- WHERE tell_id IN (SELECT value FROM json_each(?)) GROUP BY tell_id
46
- )`)
47
- .all(ids);
48
- for (const row of bindingRows)
51
+ for (const row of batch.bindings)
49
52
  bindings.set(row.tell_id, { turnSequence: row.turn_sequence, boundAt: row.bound_at });
50
- return rows.map((row) => ({
53
+ return batch.rows.map((row) => ({
51
54
  kind: "tell",
52
55
  sequence: row.sequence,
53
56
  id: row.id,
@@ -60,14 +63,17 @@ function decodeTellRows(database, rows) {
60
63
  ...(bindings.has(row.id) ? { binding: bindings.get(row.id) } : {}),
61
64
  }));
62
65
  }
63
- export function tellFactsAtSequences(database, sequences) {
66
+ function decodeTellRows(database, rows) {
67
+ return decodeTellBatch(readTellBatch(database, rows));
68
+ }
69
+ export function tellBatchAtSequences(database, sequences) {
64
70
  if (sequences.length === 0)
65
- return [];
71
+ return { rows: [], deliveries: [], bindings: [] };
66
72
  const rows = database
67
73
  .prepare(`SELECT sequence, id, body, initiator, schema_json, recorded_at, ${tellStateSql} AS state
68
74
  FROM tells WHERE sequence IN (SELECT value FROM json_each(?)) ORDER BY sequence`)
69
75
  .all(JSON.stringify(sequences));
70
- return decodeTellRows(database, rows);
76
+ return readTellBatch(database, rows);
71
77
  }
72
78
  export function hasPendingTell(database) {
73
79
  return database.prepare(`SELECT 1 FROM tells WHERE ${tellStateSql} = 'pending' LIMIT 1`).get() !== undefined;
@@ -1,6 +1,7 @@
1
1
  import type { DatabaseSync } from "node:sqlite";
2
2
  import type { CallFact, TellFact, TurnEndFact, TurnStartFact } from "./facts.js";
3
- import { type ActivityFact } from "./rows.js";
3
+ import { type ActivityFact, type ActivityRow, type CallRow, type TurnRow } from "./rows.js";
4
+ import { tellBatchAtSequences } from "./tells.js";
4
5
  export type TimelineFact = TurnStartFact | CallFact | ActivityFact | TellFact | TurnEndFact;
5
6
  export type ActivityFactSlice = Readonly<{
6
7
  rows: readonly TimelineFact[];
@@ -9,10 +10,31 @@ export type ActivityFactSlice = Readonly<{
9
10
  }>;
10
11
  export declare function lastActivityAt(database: DatabaseSync): string | null;
11
12
  export declare function pruneActivityFacts(database: DatabaseSync, limit: number, protectionReleased?: boolean): void;
13
+ type TimelineRow = Readonly<{
14
+ sequence: number;
15
+ kind: "turn-start" | "call" | "activity" | "tell" | "turn-end";
16
+ }>;
17
+ type TimelineBatch = Readonly<{
18
+ rows: readonly TimelineRow[];
19
+ turns: readonly TurnRow[];
20
+ calls: readonly CallRow[];
21
+ activity: readonly ActivityRow[];
22
+ tells: ReturnType<typeof tellBatchAtSequences>;
23
+ }>;
24
+ export declare function decodeTimelineBatch(batch: TimelineBatch): readonly TimelineFact[];
12
25
  export type StatusFactInput = Readonly<{
13
26
  aperture: "monitoring" | "receipt";
14
27
  admittedTellId?: string;
15
28
  }>;
16
29
  /** Select the frontier and its delivered Tells, plus aperture-required Tell pins. */
30
+ export declare function readStatusBatch(database: DatabaseSync, input: StatusFactInput): {
31
+ rows: readonly TimelineRow[];
32
+ turns: readonly TurnRow[];
33
+ calls: readonly CallRow[];
34
+ activity: readonly ActivityRow[];
35
+ tells: ReturnType<typeof tellBatchAtSequences>;
36
+ frontier: number | null;
37
+ };
17
38
  export declare function statusFacts(database: DatabaseSync, input: StatusFactInput): readonly TimelineFact[];
18
39
  export declare function activityFactSlice(database: DatabaseSync): ActivityFactSlice;
40
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { decodeActivityRow, decodeCallRow, decodeTurnRow, } from "./rows.js";
2
- import { tellFactsAtSequences, tellStateSql, pendingTellProtectionSql, pendingTellSequencesSql } from "./tells.js";
2
+ import { decodeTellBatch, tellBatchAtSequences, tellStateSql, pendingTellProtectionSql, pendingTellSequencesSql, } from "./tells.js";
3
3
  export function lastActivityAt(database) {
4
4
  const row = database
5
5
  .prepare(`SELECT CASE timeline.kind
@@ -52,36 +52,40 @@ export function pruneActivityFacts(database, limit, protectionReleased = false)
52
52
  DELETE FROM timeline WHERE sequence < ? AND sequence NOT IN protected`)
53
53
  .run(cutoff.sequence, cutoff.sequence, cutoff.sequence, cutoff.sequence);
54
54
  }
55
- function decodeTimelineRows(database, rows) {
55
+ function readTimelineBatch(database, rows) {
56
56
  const sequences = (kind) => JSON.stringify(rows.filter((row) => row.kind === kind).map((row) => row.sequence));
57
- const facts = new Map();
58
57
  const turns = database
59
58
  .prepare(`SELECT sequence, body_sequence, started_at, end_sequence, outcome,
60
59
  history_id, session_json, answer, answer_json, schema_json, initiator, diagnostic, completed_at FROM turns
61
- WHERE sequence IN (SELECT value FROM json_each(?)) OR end_sequence IN (SELECT value FROM json_each(?))`)
60
+ WHERE sequence IN (SELECT value FROM json_each(?)) OR end_sequence IN (SELECT value FROM json_each(?))
61
+ ORDER BY sequence`)
62
62
  .all(sequences("turn-start"), sequences("turn-end"));
63
- for (const row of turns) {
64
- const { end, ...start } = decodeTurnRow(row);
65
- facts.set(start.sequence, start);
66
- if (end !== undefined)
67
- facts.set(end.sequence, end);
68
- }
69
63
  const calls = database
70
64
  .prepare(`SELECT sequence, turn_sequence, body, at FROM calls
71
- WHERE sequence IN (SELECT value FROM json_each(?))`)
65
+ WHERE sequence IN (SELECT value FROM json_each(?)) ORDER BY sequence`)
72
66
  .all(sequences("call"));
73
- for (const row of calls)
74
- facts.set(row.sequence, decodeCallRow(row));
75
67
  const activity = database
76
68
  .prepare(`SELECT sequence, turn_sequence, event_json, at FROM activity
77
- WHERE sequence IN (SELECT value FROM json_each(?))`)
69
+ WHERE sequence IN (SELECT value FROM json_each(?)) ORDER BY sequence`)
78
70
  .all(sequences("activity"));
79
- for (const row of activity)
71
+ const tells = tellBatchAtSequences(database, rows.filter((row) => row.kind === "tell").map((row) => row.sequence));
72
+ return { rows, turns, calls, activity, tells };
73
+ }
74
+ export function decodeTimelineBatch(batch) {
75
+ const facts = new Map();
76
+ for (const row of batch.turns) {
77
+ const { end, ...start } = decodeTurnRow(row);
78
+ facts.set(start.sequence, start);
79
+ if (end !== undefined)
80
+ facts.set(end.sequence, end);
81
+ }
82
+ for (const row of batch.calls)
83
+ facts.set(row.sequence, decodeCallRow(row));
84
+ for (const row of batch.activity)
80
85
  facts.set(row.sequence, decodeActivityRow(row));
81
- const tells = tellFactsAtSequences(database, rows.filter((row) => row.kind === "tell").map((row) => row.sequence));
82
- for (const fact of tells)
86
+ for (const fact of decodeTellBatch(batch.tells))
83
87
  facts.set(fact.sequence, fact);
84
- return rows.map((row) => {
88
+ return batch.rows.map((row) => {
85
89
  const fact = facts.get(row.sequence);
86
90
  if (fact === undefined || fact.kind !== row.kind)
87
91
  throw new Error(`Akuma timeline references missing ${row.kind} ${row.sequence}`);
@@ -89,7 +93,7 @@ function decodeTimelineRows(database, rows) {
89
93
  });
90
94
  }
91
95
  /** Select the frontier and its delivered Tells, plus aperture-required Tell pins. */
92
- export function statusFacts(database, input) {
96
+ export function readStatusBatch(database, input) {
93
97
  const frontier = database.prepare("SELECT sequence FROM turns ORDER BY sequence DESC LIMIT 1").get();
94
98
  const rows = database
95
99
  .prepare(`WITH selected(sequence) AS (
@@ -104,7 +108,10 @@ export function statusFacts(database, input) {
104
108
  UNION SELECT sequence FROM tells WHERE ? AND ${tellStateSql} = 'pending'
105
109
  ) SELECT timeline.sequence, timeline.kind FROM timeline JOIN selected USING(sequence) ORDER BY sequence`)
106
110
  .all(frontier?.sequence ?? null, frontier?.sequence ?? null, frontier?.sequence ?? null, frontier?.sequence ?? null, frontier?.sequence ?? null, input.admittedTellId ?? null, input.aperture === "monitoring" || input.admittedTellId === undefined ? 1 : 0);
107
- return decodeTimelineRows(database, rows);
111
+ return { frontier: frontier?.sequence ?? null, ...readTimelineBatch(database, rows) };
112
+ }
113
+ export function statusFacts(database, input) {
114
+ return decodeTimelineBatch(readStatusBatch(database, input));
108
115
  }
109
116
  export function activityFactSlice(database) {
110
117
  const bounds = database.prepare("SELECT MIN(sequence) AS lowest, MAX(sequence) AS highest FROM timeline").get();
@@ -112,7 +119,7 @@ export function activityFactSlice(database) {
112
119
  .prepare("SELECT sequence, kind FROM timeline ORDER BY sequence")
113
120
  .all();
114
121
  return {
115
- rows: decodeTimelineRows(database, rows),
122
+ rows: decodeTimelineBatch(readTimelineBatch(database, rows)),
116
123
  lowestRetained: bounds.lowest,
117
124
  highest: bounds.highest,
118
125
  };
@@ -41,8 +41,8 @@ export declare const tellRowSchema: z.ZodObject<{
41
41
  }>;
42
42
  turnSequence: z.ZodNumber;
43
43
  receipt: z.ZodOptional<z.ZodEnum<{
44
- required: "required";
45
44
  unavailable: "unavailable";
45
+ required: "required";
46
46
  }>>;
47
47
  }, z.core.$strict>, z.ZodTransform<Readonly<{
48
48
  turnSequence: number;
@@ -53,7 +53,7 @@ export declare const tellRowSchema: z.ZodObject<{
53
53
  deliveredAt: string;
54
54
  route: "live" | "launch";
55
55
  turnSequence: number;
56
- receipt?: "required" | "unavailable" | undefined;
56
+ receipt?: "unavailable" | "required" | undefined;
57
57
  }>>>>;
58
58
  }, z.core.$strict>;
59
59
  declare const outcomeSchema: z.ZodUnion<readonly [z.ZodObject<{
@@ -283,8 +283,8 @@ declare const openSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
283
283
  }>;
284
284
  turnSequence: z.ZodNumber;
285
285
  receipt: z.ZodOptional<z.ZodEnum<{
286
- required: "required";
287
286
  unavailable: "unavailable";
287
+ required: "required";
288
288
  }>>;
289
289
  }, z.core.$strict>, z.ZodTransform<Readonly<{
290
290
  turnSequence: number;
@@ -295,7 +295,7 @@ declare const openSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
295
295
  deliveredAt: string;
296
296
  route: "live" | "launch";
297
297
  turnSequence: number;
298
- receipt?: "required" | "unavailable" | undefined;
298
+ receipt?: "unavailable" | "required" | undefined;
299
299
  }>>>>;
300
300
  }, z.core.$strict>]>, z.ZodObject<{
301
301
  kind: z.ZodLiteral<"tool">;
@@ -449,8 +449,8 @@ declare const idleSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
449
449
  }>;
450
450
  turnSequence: z.ZodNumber;
451
451
  receipt: z.ZodOptional<z.ZodEnum<{
452
- required: "required";
453
452
  unavailable: "unavailable";
453
+ required: "required";
454
454
  }>>;
455
455
  }, z.core.$strict>, z.ZodTransform<Readonly<{
456
456
  turnSequence: number;
@@ -461,7 +461,7 @@ declare const idleSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
461
461
  deliveredAt: string;
462
462
  route: "live" | "launch";
463
463
  turnSequence: number;
464
- receipt?: "required" | "unavailable" | undefined;
464
+ receipt?: "unavailable" | "required" | undefined;
465
465
  }>>>>;
466
466
  }, z.core.$strict>]>, z.ZodObject<{
467
467
  kind: z.ZodLiteral<"tool">;
@@ -638,8 +638,8 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
638
638
  }>;
639
639
  turnSequence: z.ZodNumber;
640
640
  receipt: z.ZodOptional<z.ZodEnum<{
641
- required: "required";
642
641
  unavailable: "unavailable";
642
+ required: "required";
643
643
  }>>;
644
644
  }, z.core.$strict>, z.ZodTransform<Readonly<{
645
645
  turnSequence: number;
@@ -650,7 +650,7 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
650
650
  deliveredAt: string;
651
651
  route: "live" | "launch";
652
652
  turnSequence: number;
653
- receipt?: "required" | "unavailable" | undefined;
653
+ receipt?: "unavailable" | "required" | undefined;
654
654
  }>>>>;
655
655
  }, z.core.$strict>]>, z.ZodObject<{
656
656
  kind: z.ZodLiteral<"tool">;
@@ -845,8 +845,8 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
845
845
  }>;
846
846
  turnSequence: z.ZodNumber;
847
847
  receipt: z.ZodOptional<z.ZodEnum<{
848
- required: "required";
849
848
  unavailable: "unavailable";
849
+ required: "required";
850
850
  }>>;
851
851
  }, z.core.$strict>, z.ZodTransform<Readonly<{
852
852
  turnSequence: number;
@@ -857,7 +857,7 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
857
857
  deliveredAt: string;
858
858
  route: "live" | "launch";
859
859
  turnSequence: number;
860
- receipt?: "required" | "unavailable" | undefined;
860
+ receipt?: "unavailable" | "required" | undefined;
861
861
  }>>>>;
862
862
  }, z.core.$strict>]>, z.ZodObject<{
863
863
  kind: z.ZodLiteral<"tool">;