botmux 2.33.0 → 2.33.1

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 (281) hide show
  1. package/README.en.md +12 -1
  2. package/README.md +45 -1
  3. package/dist/adapters/cli/claude-code.d.ts.map +1 -1
  4. package/dist/adapters/cli/claude-code.js +11 -0
  5. package/dist/adapters/cli/claude-code.js.map +1 -1
  6. package/dist/cli/bots-list-output.d.ts +21 -0
  7. package/dist/cli/bots-list-output.d.ts.map +1 -0
  8. package/dist/cli/bots-list-output.js +23 -0
  9. package/dist/cli/bots-list-output.js.map +1 -0
  10. package/dist/cli/workflow.d.ts +13 -0
  11. package/dist/cli/workflow.d.ts.map +1 -0
  12. package/dist/cli/workflow.js +781 -0
  13. package/dist/cli/workflow.js.map +1 -0
  14. package/dist/cli.js +69 -14
  15. package/dist/cli.js.map +1 -1
  16. package/dist/core/command-handler.d.ts.map +1 -1
  17. package/dist/core/command-handler.js +211 -4
  18. package/dist/core/command-handler.js.map +1 -1
  19. package/dist/core/session-manager.d.ts +6 -1
  20. package/dist/core/session-manager.d.ts.map +1 -1
  21. package/dist/core/session-manager.js +22 -12
  22. package/dist/core/session-manager.js.map +1 -1
  23. package/dist/core/worker-pool.d.ts +13 -0
  24. package/dist/core/worker-pool.d.ts.map +1 -1
  25. package/dist/core/worker-pool.js +100 -6
  26. package/dist/core/worker-pool.js.map +1 -1
  27. package/dist/daemon.d.ts +3 -0
  28. package/dist/daemon.d.ts.map +1 -1
  29. package/dist/daemon.js +884 -3
  30. package/dist/daemon.js.map +1 -1
  31. package/dist/dashboard/auth.d.ts +36 -0
  32. package/dist/dashboard/auth.d.ts.map +1 -1
  33. package/dist/dashboard/auth.js +22 -0
  34. package/dist/dashboard/auth.js.map +1 -1
  35. package/dist/dashboard/web/app.js +20 -1
  36. package/dist/dashboard/web/app.js.map +1 -1
  37. package/dist/dashboard/web/i18n.d.ts.map +1 -1
  38. package/dist/dashboard/web/i18n.js +356 -0
  39. package/dist/dashboard/web/i18n.js.map +1 -1
  40. package/dist/dashboard/web/workflow-catalog.d.ts +2 -0
  41. package/dist/dashboard/web/workflow-catalog.d.ts.map +1 -0
  42. package/dist/dashboard/web/workflow-catalog.js +323 -0
  43. package/dist/dashboard/web/workflow-catalog.js.map +1 -0
  44. package/dist/dashboard/web/workflows.d.ts +2 -0
  45. package/dist/dashboard/web/workflows.d.ts.map +1 -0
  46. package/dist/dashboard/web/workflows.js +1618 -0
  47. package/dist/dashboard/web/workflows.js.map +1 -0
  48. package/dist/dashboard/workflow-api.d.ts +23 -0
  49. package/dist/dashboard/workflow-api.d.ts.map +1 -0
  50. package/dist/dashboard/workflow-api.js +463 -0
  51. package/dist/dashboard/workflow-api.js.map +1 -0
  52. package/dist/dashboard-web/app.js +494 -199
  53. package/dist/dashboard-web/index.html +1 -0
  54. package/dist/dashboard-web/style.css +160 -6
  55. package/dist/dashboard-web/terminal-replay.html +227 -0
  56. package/dist/dashboard.js +29 -12
  57. package/dist/dashboard.js.map +1 -1
  58. package/dist/i18n/en.d.ts.map +1 -1
  59. package/dist/i18n/en.js +12 -0
  60. package/dist/i18n/en.js.map +1 -1
  61. package/dist/i18n/zh.d.ts.map +1 -1
  62. package/dist/i18n/zh.js +12 -0
  63. package/dist/i18n/zh.js.map +1 -1
  64. package/dist/im/lark/card-handler.d.ts +3 -0
  65. package/dist/im/lark/card-handler.d.ts.map +1 -1
  66. package/dist/im/lark/card-handler.js +27 -1
  67. package/dist/im/lark/card-handler.js.map +1 -1
  68. package/dist/im/lark/client.d.ts +19 -2
  69. package/dist/im/lark/client.d.ts.map +1 -1
  70. package/dist/im/lark/client.js +21 -2
  71. package/dist/im/lark/client.js.map +1 -1
  72. package/dist/im/lark/workflow-card-handler.d.ts +50 -0
  73. package/dist/im/lark/workflow-card-handler.d.ts.map +1 -0
  74. package/dist/im/lark/workflow-card-handler.js +152 -0
  75. package/dist/im/lark/workflow-card-handler.js.map +1 -0
  76. package/dist/im/lark/workflow-cards.d.ts +46 -0
  77. package/dist/im/lark/workflow-cards.d.ts.map +1 -0
  78. package/dist/im/lark/workflow-cards.js +226 -0
  79. package/dist/im/lark/workflow-cards.js.map +1 -0
  80. package/dist/im/lark/workflow-progress-card.d.ts +76 -0
  81. package/dist/im/lark/workflow-progress-card.d.ts.map +1 -0
  82. package/dist/im/lark/workflow-progress-card.js +279 -0
  83. package/dist/im/lark/workflow-progress-card.js.map +1 -0
  84. package/dist/im/lark/workflow-slash-command.d.ts +92 -0
  85. package/dist/im/lark/workflow-slash-command.d.ts.map +1 -0
  86. package/dist/im/lark/workflow-slash-command.js +185 -0
  87. package/dist/im/lark/workflow-slash-command.js.map +1 -0
  88. package/dist/services/group-creator.d.ts.map +1 -1
  89. package/dist/services/group-creator.js +17 -4
  90. package/dist/services/group-creator.js.map +1 -1
  91. package/dist/services/groups-store.d.ts +11 -0
  92. package/dist/services/groups-store.d.ts.map +1 -1
  93. package/dist/services/groups-store.js +26 -0
  94. package/dist/services/groups-store.js.map +1 -1
  95. package/dist/services/jsonl-cursor.d.ts +12 -0
  96. package/dist/services/jsonl-cursor.d.ts.map +1 -0
  97. package/dist/services/jsonl-cursor.js +45 -0
  98. package/dist/services/jsonl-cursor.js.map +1 -0
  99. package/dist/services/schedule-store.d.ts +35 -0
  100. package/dist/services/schedule-store.d.ts.map +1 -1
  101. package/dist/services/schedule-store.js +108 -1
  102. package/dist/services/schedule-store.js.map +1 -1
  103. package/dist/skills/definitions.d.ts.map +1 -1
  104. package/dist/skills/definitions.js +399 -0
  105. package/dist/skills/definitions.js.map +1 -1
  106. package/dist/types.d.ts +4 -0
  107. package/dist/types.d.ts.map +1 -1
  108. package/dist/utils/cli-usage-limit.d.ts.map +1 -1
  109. package/dist/utils/cli-usage-limit.js +4 -0
  110. package/dist/utils/cli-usage-limit.js.map +1 -1
  111. package/dist/worker.js +118 -14
  112. package/dist/worker.js.map +1 -1
  113. package/dist/workflows/attempt-resume.d.ts +114 -0
  114. package/dist/workflows/attempt-resume.d.ts.map +1 -0
  115. package/dist/workflows/attempt-resume.js +385 -0
  116. package/dist/workflows/attempt-resume.js.map +1 -0
  117. package/dist/workflows/attempt-terminal.d.ts +21 -0
  118. package/dist/workflows/attempt-terminal.d.ts.map +1 -0
  119. package/dist/workflows/attempt-terminal.js +7 -0
  120. package/dist/workflows/attempt-terminal.js.map +1 -0
  121. package/dist/workflows/blob.d.ts +27 -0
  122. package/dist/workflows/blob.d.ts.map +1 -0
  123. package/dist/workflows/blob.js +39 -0
  124. package/dist/workflows/blob.js.map +1 -0
  125. package/dist/workflows/cancel-run.d.ts +45 -0
  126. package/dist/workflows/cancel-run.d.ts.map +1 -0
  127. package/dist/workflows/cancel-run.js +99 -0
  128. package/dist/workflows/cancel-run.js.map +1 -0
  129. package/dist/workflows/cancel.d.ts +111 -0
  130. package/dist/workflows/cancel.d.ts.map +1 -0
  131. package/dist/workflows/cancel.js +120 -0
  132. package/dist/workflows/cancel.js.map +1 -0
  133. package/dist/workflows/catalog.d.ts +60 -0
  134. package/dist/workflows/catalog.d.ts.map +1 -0
  135. package/dist/workflows/catalog.js +119 -0
  136. package/dist/workflows/catalog.js.map +1 -0
  137. package/dist/workflows/cold-attach.d.ts +30 -0
  138. package/dist/workflows/cold-attach.d.ts.map +1 -0
  139. package/dist/workflows/cold-attach.js +40 -0
  140. package/dist/workflows/cold-attach.js.map +1 -0
  141. package/dist/workflows/cold-scan.d.ts +21 -0
  142. package/dist/workflows/cold-scan.d.ts.map +1 -0
  143. package/dist/workflows/cold-scan.js +70 -0
  144. package/dist/workflows/cold-scan.js.map +1 -0
  145. package/dist/workflows/daemon-spawn.d.ts +117 -0
  146. package/dist/workflows/daemon-spawn.d.ts.map +1 -0
  147. package/dist/workflows/daemon-spawn.js +551 -0
  148. package/dist/workflows/daemon-spawn.js.map +1 -0
  149. package/dist/workflows/definition.d.ts +1309 -0
  150. package/dist/workflows/definition.d.ts.map +1 -0
  151. package/dist/workflows/definition.js +334 -0
  152. package/dist/workflows/definition.js.map +1 -0
  153. package/dist/workflows/effect-input.d.ts +4 -0
  154. package/dist/workflows/effect-input.d.ts.map +1 -0
  155. package/dist/workflows/effect-input.js +18 -0
  156. package/dist/workflows/effect-input.js.map +1 -0
  157. package/dist/workflows/events/append.d.ts +77 -0
  158. package/dist/workflows/events/append.d.ts.map +1 -0
  159. package/dist/workflows/events/append.js +214 -0
  160. package/dist/workflows/events/append.js.map +1 -0
  161. package/dist/workflows/events/idempotency.d.ts +77 -0
  162. package/dist/workflows/events/idempotency.d.ts.map +1 -0
  163. package/dist/workflows/events/idempotency.js +116 -0
  164. package/dist/workflows/events/idempotency.js.map +1 -0
  165. package/dist/workflows/events/index.d.ts +7 -0
  166. package/dist/workflows/events/index.d.ts.map +1 -0
  167. package/dist/workflows/events/index.js +7 -0
  168. package/dist/workflows/events/index.js.map +1 -0
  169. package/dist/workflows/events/payloads.d.ts +917 -0
  170. package/dist/workflows/events/payloads.d.ts.map +1 -0
  171. package/dist/workflows/events/payloads.js +337 -0
  172. package/dist/workflows/events/payloads.js.map +1 -0
  173. package/dist/workflows/events/replay.d.ts +238 -0
  174. package/dist/workflows/events/replay.d.ts.map +1 -0
  175. package/dist/workflows/events/replay.js +608 -0
  176. package/dist/workflows/events/replay.js.map +1 -0
  177. package/dist/workflows/events/schema.d.ts +5242 -0
  178. package/dist/workflows/events/schema.d.ts.map +1 -0
  179. package/dist/workflows/events/schema.js +295 -0
  180. package/dist/workflows/events/schema.js.map +1 -0
  181. package/dist/workflows/events/types.d.ts +34 -0
  182. package/dist/workflows/events/types.d.ts.map +1 -0
  183. package/dist/workflows/events/types.js +2 -0
  184. package/dist/workflows/events/types.js.map +1 -0
  185. package/dist/workflows/fanout.d.ts +36 -0
  186. package/dist/workflows/fanout.d.ts.map +1 -0
  187. package/dist/workflows/fanout.js +114 -0
  188. package/dist/workflows/fanout.js.map +1 -0
  189. package/dist/workflows/hostExecutors/botmux-schedule.d.ts +41 -0
  190. package/dist/workflows/hostExecutors/botmux-schedule.d.ts.map +1 -0
  191. package/dist/workflows/hostExecutors/botmux-schedule.js +121 -0
  192. package/dist/workflows/hostExecutors/botmux-schedule.js.map +1 -0
  193. package/dist/workflows/hostExecutors/feishu-im.d.ts +12 -0
  194. package/dist/workflows/hostExecutors/feishu-im.d.ts.map +1 -0
  195. package/dist/workflows/hostExecutors/feishu-im.js +49 -0
  196. package/dist/workflows/hostExecutors/feishu-im.js.map +1 -0
  197. package/dist/workflows/hostExecutors/feishu-reply.d.ts +24 -0
  198. package/dist/workflows/hostExecutors/feishu-reply.d.ts.map +1 -0
  199. package/dist/workflows/hostExecutors/feishu-reply.js +88 -0
  200. package/dist/workflows/hostExecutors/feishu-reply.js.map +1 -0
  201. package/dist/workflows/hostExecutors/feishu-send.d.ts +23 -0
  202. package/dist/workflows/hostExecutors/feishu-send.d.ts.map +1 -0
  203. package/dist/workflows/hostExecutors/feishu-send.js +124 -0
  204. package/dist/workflows/hostExecutors/feishu-send.js.map +1 -0
  205. package/dist/workflows/hostExecutors/index.d.ts +8 -0
  206. package/dist/workflows/hostExecutors/index.d.ts.map +1 -0
  207. package/dist/workflows/hostExecutors/index.js +8 -0
  208. package/dist/workflows/hostExecutors/index.js.map +1 -0
  209. package/dist/workflows/hostExecutors/protocol.d.ts +42 -0
  210. package/dist/workflows/hostExecutors/protocol.d.ts.map +1 -0
  211. package/dist/workflows/hostExecutors/protocol.js +181 -0
  212. package/dist/workflows/hostExecutors/protocol.js.map +1 -0
  213. package/dist/workflows/hostExecutors/registry.d.ts +10 -0
  214. package/dist/workflows/hostExecutors/registry.d.ts.map +1 -0
  215. package/dist/workflows/hostExecutors/registry.js +36 -0
  216. package/dist/workflows/hostExecutors/registry.js.map +1 -0
  217. package/dist/workflows/hostExecutors/types.d.ts +78 -0
  218. package/dist/workflows/hostExecutors/types.d.ts.map +1 -0
  219. package/dist/workflows/hostExecutors/types.js +2 -0
  220. package/dist/workflows/hostExecutors/types.js.map +1 -0
  221. package/dist/workflows/loader.d.ts +16 -0
  222. package/dist/workflows/loader.d.ts.map +1 -0
  223. package/dist/workflows/loader.js +56 -0
  224. package/dist/workflows/loader.js.map +1 -0
  225. package/dist/workflows/loop.d.ts +50 -0
  226. package/dist/workflows/loop.d.ts.map +1 -0
  227. package/dist/workflows/loop.js +350 -0
  228. package/dist/workflows/loop.js.map +1 -0
  229. package/dist/workflows/ops-projection.d.ts +168 -0
  230. package/dist/workflows/ops-projection.d.ts.map +1 -0
  231. package/dist/workflows/ops-projection.js +707 -0
  232. package/dist/workflows/ops-projection.js.map +1 -0
  233. package/dist/workflows/orchestrator.d.ts +107 -0
  234. package/dist/workflows/orchestrator.d.ts.map +1 -0
  235. package/dist/workflows/orchestrator.js +197 -0
  236. package/dist/workflows/orchestrator.js.map +1 -0
  237. package/dist/workflows/output-binding.d.ts +70 -0
  238. package/dist/workflows/output-binding.d.ts.map +1 -0
  239. package/dist/workflows/output-binding.js +265 -0
  240. package/dist/workflows/output-binding.js.map +1 -0
  241. package/dist/workflows/params.d.ts +61 -0
  242. package/dist/workflows/params.d.ts.map +1 -0
  243. package/dist/workflows/params.js +195 -0
  244. package/dist/workflows/params.js.map +1 -0
  245. package/dist/workflows/resume.d.ts +263 -0
  246. package/dist/workflows/resume.d.ts.map +1 -0
  247. package/dist/workflows/resume.js +808 -0
  248. package/dist/workflows/resume.js.map +1 -0
  249. package/dist/workflows/run-id.d.ts +2 -0
  250. package/dist/workflows/run-id.d.ts.map +1 -0
  251. package/dist/workflows/run-id.js +7 -0
  252. package/dist/workflows/run-id.js.map +1 -0
  253. package/dist/workflows/run-init.d.ts +48 -0
  254. package/dist/workflows/run-init.d.ts.map +1 -0
  255. package/dist/workflows/run-init.js +99 -0
  256. package/dist/workflows/run-init.js.map +1 -0
  257. package/dist/workflows/runs-dir.d.ts +4 -0
  258. package/dist/workflows/runs-dir.d.ts.map +1 -0
  259. package/dist/workflows/runs-dir.js +15 -0
  260. package/dist/workflows/runs-dir.js.map +1 -0
  261. package/dist/workflows/runtime.d.ts +211 -0
  262. package/dist/workflows/runtime.d.ts.map +1 -0
  263. package/dist/workflows/runtime.js +594 -0
  264. package/dist/workflows/runtime.js.map +1 -0
  265. package/dist/workflows/spawn-bot.d.ts +165 -0
  266. package/dist/workflows/spawn-bot.d.ts.map +1 -0
  267. package/dist/workflows/spawn-bot.js +215 -0
  268. package/dist/workflows/spawn-bot.js.map +1 -0
  269. package/dist/workflows/system.d.ts +49 -0
  270. package/dist/workflows/system.d.ts.map +1 -0
  271. package/dist/workflows/system.js +48 -0
  272. package/dist/workflows/system.js.map +1 -0
  273. package/dist/workflows/trigger-run.d.ts +70 -0
  274. package/dist/workflows/trigger-run.d.ts.map +1 -0
  275. package/dist/workflows/trigger-run.js +88 -0
  276. package/dist/workflows/trigger-run.js.map +1 -0
  277. package/dist/workflows/wait.d.ts +120 -0
  278. package/dist/workflows/wait.d.ts.map +1 -0
  279. package/dist/workflows/wait.js +181 -0
  280. package/dist/workflows/wait.js.map +1 -0
  281. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payloads.d.ts","sourceRoot":"","sources":["../../../src/workflows/events/payloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa,QAA0B,CAAC;AACrD,eAAO,MAAM,YAAY,aAA6D,CAAC;AAEvF,eAAO,MAAM,SAAS,qFAOpB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAE9C,eAAO,MAAM,cAAc,0DAAwD,CAAC;AACpF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD,eAAO,MAAM,aAAa,kTA0BxB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEtD,eAAO,MAAM,kBAAkB;;;;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AIjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAIlC,CAAC;AAIH,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;EAMjC,CAAC"}
@@ -0,0 +1,337 @@
1
+ import { z } from 'zod';
2
+ // ─── Shared primitives ──────────────────────────────────────────────────────
3
+ export const Sha256Pattern = /^sha256:[0-9a-f]{64}$/;
4
+ export const Sha256Schema = z.string().regex(Sha256Pattern, 'must be sha256:<64-hex>');
5
+ export const ActorEnum = z.enum([
6
+ 'scheduler',
7
+ 'worker',
8
+ 'hostExecutor',
9
+ 'human',
10
+ 'supervisor',
11
+ 'system',
12
+ ]);
13
+ export const ErrorClassEnum = z.enum(['retryable', 'fatal', 'userFault', 'manual']);
14
+ export const ErrorCodeEnum = z.enum([
15
+ 'LeaseExpired',
16
+ 'WorkerCrashed',
17
+ 'NetworkError',
18
+ 'ProviderRateLimited',
19
+ 'IdempotencyInputMismatch',
20
+ 'IdempotencyConflict',
21
+ 'InputValidationFailed',
22
+ // Author wrote a `{ "$ref": ... }` that couldn't be resolved against
23
+ // upstream output at dispatch time — missing node, not-yet-succeeded,
24
+ // path-not-found, missing output blob. Always userFault: it's a
25
+ // workflow definition / authoring mistake, not a provider issue.
26
+ 'InputBindingFailed',
27
+ 'OutputSchemaViolation',
28
+ 'WaitDeadlineExceeded',
29
+ 'TtlExpired',
30
+ 'UnknownProviderError',
31
+ // Step 7 round 1 recovery codes:
32
+ // InputUnrecoverable — reconciler requires the original effect input
33
+ // to re-submit, but the daemon cannot load it (no callback, callback
34
+ // threw, or returned undefined). Always manual class.
35
+ // CorruptLog — replay/recovery detected an inconsistent event log
36
+ // (e.g. reconcileResult{decision=replayed} but no terminal event
37
+ // found). Always manual class.
38
+ 'InputUnrecoverable',
39
+ 'CorruptLog',
40
+ ]);
41
+ export const ErrorPayloadSchema = z.object({
42
+ errorCode: ErrorCodeEnum,
43
+ errorClass: ErrorClassEnum,
44
+ errorMessage: z.string().max(4096),
45
+ stackRef: z.string().optional(),
46
+ });
47
+ export const OutputRefSchema = z.object({
48
+ outputHash: Sha256Schema,
49
+ outputPath: z.string().optional(),
50
+ outputBytes: z.number().int().nonnegative(),
51
+ outputSchemaVersion: z.number().int().positive(),
52
+ contentType: z.string().optional(),
53
+ });
54
+ export const ReconcileCapabilityEnum = z.enum(['readOnlyLookup', 'idempotentSubmit', 'none']);
55
+ export const ReconcileDecisionEnum = z.enum([
56
+ 'replayed',
57
+ 'completedByIdempotentSubmit',
58
+ 'manual',
59
+ 'freshRetry',
60
+ ]);
61
+ export const WaitKindEnum = z.enum(['human-gate', 'time', 'condition']);
62
+ export const WaitResolutionEnum = z.enum(['approved', 'rejected', 'external']);
63
+ export const CancelTargetSchema = z.discriminatedUnion('kind', [
64
+ z.object({ kind: z.literal('run'), runId: z.string() }),
65
+ z.object({ kind: z.literal('node'), nodeId: z.string() }),
66
+ z.object({ kind: z.literal('activity'), activityId: z.string() }),
67
+ ]);
68
+ export const BackoffPolicySchema = z.object({
69
+ kind: z.enum(['fixed', 'exponential']),
70
+ baseMs: z.number().int().positive(),
71
+ factor: z.number().positive().optional(),
72
+ jitter: z.boolean().optional(),
73
+ });
74
+ // ─── Group 1 — Lifecycle (14) ───────────────────────────────────────────────
75
+ /**
76
+ * Immutable identity snapshot of a workflow bot at run-creation time.
77
+ * Frozen here so subsequent rename / re-wire in bots.json doesn't drift
78
+ * the historical run view (UI doc §3.4). All fields optional so a bot
79
+ * with partial registry data still serializes cleanly.
80
+ */
81
+ export const BotSnapshotSchema = z.object({
82
+ larkAppId: z.string().optional(),
83
+ cliId: z.string().optional(),
84
+ displayName: z.string().optional(),
85
+ workingDir: z.string().optional(),
86
+ });
87
+ export const RunCreatedPayload = z.object({
88
+ workflowId: z.string(),
89
+ revisionId: z.string(),
90
+ inputRef: OutputRefSchema,
91
+ initiator: z.string(),
92
+ // Non-breaking extension (UI doc §11): bot name → identity snapshot
93
+ // for every subagent bot referenced in the workflow definition.
94
+ botSnapshots: z.record(BotSnapshotSchema).optional(),
95
+ });
96
+ export const RunStartedPayload = z.object({}).strict();
97
+ export const RunSucceededPayload = z.object({
98
+ outputRef: OutputRefSchema,
99
+ });
100
+ export const RunFailedPayload = z.object({
101
+ failedNodeId: z.string(),
102
+ rootCauseEventId: z.string(),
103
+ });
104
+ export const RunCanceledPayload = z.object({
105
+ cancelOriginEventId: z.string(),
106
+ });
107
+ export const NodeWaitingPayload = z.object({
108
+ nodeId: z.string(),
109
+ waitReason: z.string(),
110
+ deadlineAt: z.number().int().positive().optional(),
111
+ });
112
+ export const NodeRetryingPayload = z.object({
113
+ nodeId: z.string(),
114
+ lastAttemptId: z.string(),
115
+ nextBackoffMs: z.number().int().nonnegative(),
116
+ });
117
+ export const NodeSucceededPayload = z.object({
118
+ nodeId: z.string(),
119
+ lastActivityId: z.string(),
120
+ });
121
+ export const NodeFailedPayload = z.object({
122
+ nodeId: z.string(),
123
+ lastActivityId: z.string(),
124
+ errorClass: ErrorClassEnum,
125
+ });
126
+ export const NodeSkippedPayload = z.object({
127
+ nodeId: z.string(),
128
+ conditionEventId: z.string(),
129
+ });
130
+ export const NodeCanceledPayload = z.object({
131
+ nodeId: z.string(),
132
+ cancelOriginEventId: z.string(),
133
+ });
134
+ export const ActivityRunningPayload = z.object({
135
+ activityId: z.string(),
136
+ attemptId: z.string(),
137
+ leaseId: z.string(),
138
+ });
139
+ export const ActivityWaitingPayload = z.object({
140
+ activityId: z.string(),
141
+ reason: z.string(),
142
+ });
143
+ export const ActivityTimedOutPayload = z.object({
144
+ activityId: z.string(),
145
+ attemptId: z.string(),
146
+ runningMs: z.number().int().nonnegative(),
147
+ reason: z.literal('LeaseExpired'),
148
+ errorClass: z.literal('retryable'),
149
+ });
150
+ // ─── Group 2 — Scheduling (5) ───────────────────────────────────────────────
151
+ export const ConditionEvaluatedPayload = z.object({
152
+ nodeId: z.string(),
153
+ conditionExpr: z.string(),
154
+ resultTrue: z.boolean(),
155
+ evaluatedInputs: z.record(z.unknown()).optional(),
156
+ });
157
+ export const LeaseSignedPayload = z.object({
158
+ activityId: z.string(),
159
+ attemptId: z.string(),
160
+ leaseId: z.string(),
161
+ timeoutMs: z.number().int().positive(),
162
+ maxOutputBytes: z.number().int().positive(),
163
+ });
164
+ export const AttemptCreatedPayload = z.object({
165
+ // Codex round 4 finding 3: nodeId is REQUIRED. Without it, replay
166
+ // can't project node.status idle→triggered when the first attempt is
167
+ // created, so node state stays idle until an explicit terminal
168
+ // node event arrives — and no event in the schema covers
169
+ // "triggered/running" entry. attemptCreated.nodeId fills that gap.
170
+ nodeId: z.string(),
171
+ activityId: z.string(),
172
+ attemptId: z.string(),
173
+ attemptNumber: z.number().int().positive(),
174
+ inputRef: OutputRefSchema,
175
+ });
176
+ export const BackoffScheduledPayload = z.object({
177
+ nodeId: z.string(),
178
+ lastAttemptId: z.string(),
179
+ nextAttemptAt: z.number().int().positive(),
180
+ backoffPolicy: BackoffPolicySchema,
181
+ });
182
+ export const BackoffElapsedPayload = z.object({
183
+ nodeId: z.string(),
184
+ scheduledAttemptId: z.string(),
185
+ });
186
+ // ─── Group 3 — Side Effect (3) ──────────────────────────────────────────────
187
+ export const EffectAttemptedPayload = z.object({
188
+ activityId: z.string(),
189
+ attemptId: z.string(),
190
+ // idempotencyKey is the 50-char-bounded provider uuid derived from
191
+ // hash(workflowId:revisionId:runId:nodeId:attemptId). Feishu uuid field
192
+ // accepts ≤ 50 chars; spike report Section 1.6.
193
+ idempotencyKey: z.string().min(1).max(50),
194
+ inputHash: Sha256Schema,
195
+ idempotencyTtlMs: z.number().int().positive(),
196
+ provider: z.string(),
197
+ });
198
+ export const ActivitySucceededPayload = z.object({
199
+ activityId: z.string(),
200
+ attemptId: z.string(),
201
+ outputRef: OutputRefSchema,
202
+ // type-specific external refs returned by provider on side-effecting
203
+ // succeeded events: send/reply → { messageId }, schedule → { taskId },
204
+ // pure skills omit. v0 keeps the shape open; v0.x+ standardizes per provider.
205
+ externalRefs: z.record(z.unknown()).optional(),
206
+ });
207
+ export const ActivityFailedPayload = z.object({
208
+ activityId: z.string(),
209
+ attemptId: z.string(),
210
+ error: ErrorPayloadSchema,
211
+ });
212
+ // ─── Group 4 — Wait / Human (3) ─────────────────────────────────────────────
213
+ /**
214
+ * Spec §6 open question #7 resolved at Step 8: `onTimeout` is part of
215
+ * the wait creation payload, not external node IR. Recording it on the
216
+ * event lets resume materialize the right terminal for a dangling
217
+ * `waitDeadlineExceeded` without consulting external workflow state.
218
+ * Default is `fail` at the consumer (matches spec default behavior).
219
+ */
220
+ export const WaitOnTimeoutEnum = z.enum(['fail', 'success']);
221
+ export const WaitCreatedPayload = z.object({
222
+ activityId: z.string(),
223
+ nodeId: z.string(),
224
+ waitKind: WaitKindEnum,
225
+ deadlineAt: z.number().int().positive().optional(),
226
+ // `prompt` is the inline form: small prompts (producer policy ≤1024B) live
227
+ // here directly. NO `.max()` on the schema — historical waitCreated events
228
+ // wrote 2-3KB inline prompts and must still replay/parse. The producer
229
+ // strategy split is enforced in `runtime.dispatchGate`, not the wire format.
230
+ prompt: z.string().optional(),
231
+ // Blob-spill form: large prompts go to a content-addressed file via
232
+ // `writeBlob`, and the event carries the resulting `OutputRef` plus a short
233
+ // preview for cards / dashboard. Mutual exclusion with `prompt` is enforced
234
+ // by `checkWaitCreatedPromptInvariant`.
235
+ promptRef: OutputRefSchema.optional(),
236
+ promptPreview: z.string().max(500).optional(),
237
+ approvers: z.array(z.string()).optional(),
238
+ onTimeout: WaitOnTimeoutEnum.optional(),
239
+ });
240
+ export const WaitResolvedPayload = z.object({
241
+ activityId: z.string(),
242
+ resolution: WaitResolutionEnum,
243
+ by: z.string(),
244
+ comment: z.string().optional(),
245
+ });
246
+ export const WaitDeadlineExceededPayload = z.object({
247
+ activityId: z.string(),
248
+ deadlineAt: z.number().int().positive(),
249
+ exceededAtMs: z.number().int().positive(),
250
+ });
251
+ // ─── Group 5 — Control (3) ──────────────────────────────────────────────────
252
+ export const CancelRequestedPayload = z.object({
253
+ target: CancelTargetSchema,
254
+ reason: z.string(),
255
+ by: z.string(),
256
+ });
257
+ export const CancelDeliveredPayload = z.object({
258
+ target: CancelTargetSchema,
259
+ activityId: z.string(),
260
+ });
261
+ export const ActivityCanceledPayload = z.object({
262
+ activityId: z.string(),
263
+ attemptId: z.string(),
264
+ cancelOriginEventId: z.string(),
265
+ });
266
+ // ─── Group 6 — System / Recovery (3) ────────────────────────────────────────
267
+ export const WorkerLostPayload = z.object({
268
+ workerId: z.string(),
269
+ lostActivityIds: z.array(z.string()).min(1),
270
+ });
271
+ export const ResumeStartedPayload = z.object({
272
+ daemonId: z.string(),
273
+ lastSeenEventId: z.string(),
274
+ });
275
+ /**
276
+ * `reconcileResult.evidence` v0 convention (spec §6 Q4 — standardization
277
+ * deferred to v0.x+, but the per-provider shape used by the v0 runtime
278
+ * is fixed here so dashboards and resume recovery can parse it without
279
+ * provider-specific knowledge).
280
+ *
281
+ * Common keys (any provider, any decision):
282
+ * - `externalRefs`?: Record<string, unknown>
283
+ * Provider-returned ref (messageId / taskId / ...) — required
284
+ * for `completedByIdempotentSubmit` decisions, recovery uses it
285
+ * to materialize `activitySucceeded.payload.externalRefs`.
286
+ * - `errorCode`?: string
287
+ * Recorded errorCode for `manual` decisions — recovery uses it
288
+ * to materialize `activityFailed.payload.error.errorCode`.
289
+ *
290
+ * Manual-only keys (decision='manual'):
291
+ * - `reason`?: 'ttl_expired' | 'no_reconciler' | 'no_capability'
292
+ * | 'input_unrecoverable' | 'missing_external_refs'
293
+ * - `attemptedAtMs`, `nowMs`, `idempotencyTtlMs`?: number
294
+ * Populated when reason='ttl_expired' for forensics.
295
+ * - `originalDecision`?: ReconcileDecision
296
+ * When recovery escalates from a corrupt prior decision (e.g.
297
+ * replayed/manual without terminal), the original decision the
298
+ * prior reconcile wrote is preserved here.
299
+ * - `corruptReason`?: 'missing_external_refs'
300
+ * - `reconcileEventId`?: string
301
+ * eventId of the originating reconcileResult (recovery cross-ref).
302
+ *
303
+ * Cancel-coupled keys (Step 9 round 2 — when reconcile fires under
304
+ * cancel, any decision):
305
+ * - `cancelOriginEventId`?: string — eventId of the originating
306
+ * `cancelRequested` so dashboard / forensics can correlate the
307
+ * cancel × reconcile pair structurally instead of parsing
308
+ * `activityFailed.errorMessage`.
309
+ * - `cancelReason`?: string — `cancelRequested.payload.reason`
310
+ * - `cancelRequestedBy`?: string — `cancelRequested.payload.by`
311
+ *
312
+ * These keys are written ONLY by `recoverCancelWithReconcile`'s fresh
313
+ * reconcile cycle; they are absent on regular reconciles and on F1
314
+ * recovery (the prior reconcileResult was written before cancel
315
+ * landed and is immutable).
316
+ *
317
+ * `freshRetry` evidence is provider-specific; v0 puts whatever the
318
+ * reconciler returned from `readOnlyLookup({ found: false })` here.
319
+ *
320
+ * Per-provider conventions (v0):
321
+ * - `botmux-schedule` readOnlyLookup: `{ source: 'getTask',
322
+ * returned: 'task' | 'undefined' }`
323
+ * - `feishu-im` idempotentSubmit: `{ source: 'create-or-reply' }` or
324
+ * similar; provider just returns externalRefs on success.
325
+ *
326
+ * Future work: lock these per-provider shapes via discriminated
327
+ * schemas keyed on `(decision, capability, provider)`. Tracked in
328
+ * spec §6 Q4.
329
+ */
330
+ export const ReconcileResultPayload = z.object({
331
+ activityId: z.string(),
332
+ idempotencyKey: z.string().min(1).max(50),
333
+ capability: ReconcileCapabilityEnum,
334
+ decision: ReconcileDecisionEnum,
335
+ evidence: z.record(z.unknown()),
336
+ });
337
+ //# sourceMappingURL=payloads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payloads.js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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IACzC,UAAU,EAAE,uBAAuB;IACnC,QAAQ,EAAE,qBAAqB;IAC/B,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;CAChC,CAAC,CAAC"}
@@ -0,0 +1,238 @@
1
+ import type { WorkflowEvent } from './schema.js';
2
+ import type { ErrorClass, ErrorPayload, OutputRef } from './payloads.js';
3
+ export type RunStatus = 'pending' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
4
+ export type NodeStatus = 'idle' | 'triggered' | 'running' | 'waiting' | 'retrying' | 'succeeded' | 'failed' | 'skipped' | 'cancelled';
5
+ export type ActivityStatus = 'pending' | 'acquired' | 'running' | 'waiting' | 'effectAttempting' | 'succeeded' | 'failed' | 'timedOut' | 'cancelled';
6
+ export type AttemptState = {
7
+ attemptId: string;
8
+ attemptNumber: number;
9
+ inputRef: OutputRef;
10
+ status: ActivityStatus;
11
+ leaseId?: string;
12
+ timeoutMs?: number;
13
+ maxOutputBytes?: number;
14
+ effectAttempted?: {
15
+ idempotencyKey: string;
16
+ inputHash: string;
17
+ idempotencyTtlMs: number;
18
+ provider: string;
19
+ attemptedAtEventId: string;
20
+ /** Wall-clock timestamp the effectAttempted envelope landed (ms epoch).
21
+ * Resume uses this to evaluate the TTL boundary against `now()` —
22
+ * cheaper and more deterministic than re-deriving the time from
23
+ * `eventId` parsing. */
24
+ attemptedAtMs: number;
25
+ };
26
+ /**
27
+ * Latest reconcileResult matched to this attempt by idempotencyKey.
28
+ * Resume consults this BEFORE re-running the decision tree: if a
29
+ * previous resume crashed between writing reconcileResult and the
30
+ * terminal event, replay surfaces the prior decision so the next
31
+ * resume can finish what the first started (codex Step 7 round 1
32
+ * finding 1). reconcileResult.payload doesn't carry attemptId — we
33
+ * match by idempotencyKey, which uniquely identifies the attempt.
34
+ */
35
+ latestReconcileResult?: {
36
+ decision: 'replayed' | 'completedByIdempotentSubmit' | 'manual' | 'freshRetry';
37
+ capability: 'readOnlyLookup' | 'idempotentSubmit' | 'none';
38
+ evidence: Record<string, unknown>;
39
+ eventId: string;
40
+ };
41
+ /**
42
+ * Cancel-in-flight marker (Step 9). Populated when a `cancelRequested`
43
+ * targets this activity (directly via `kind=activity`, or — Step 10
44
+ * scheduler concern — fan-out from node/run cancel). Resume reads
45
+ * this to detect dangling cancels (cancelRequested written, terminal
46
+ * missing) and complete them with `activityCanceled`.
47
+ *
48
+ * Cleared / superseded once `activityCanceled` writes a terminal —
49
+ * but we keep `cancelOriginEventId` recoverable from the request
50
+ * event itself, so resume doesn't need an in-flight pointer post-
51
+ * terminal.
52
+ */
53
+ cancelRequest?: {
54
+ cancelOriginEventId: string;
55
+ requestedBy: string;
56
+ reason: string;
57
+ delivered: boolean;
58
+ };
59
+ /**
60
+ * Wait state for human-gate / time / condition activities (Step 8).
61
+ * Populated by `waitCreated` and updated by `waitResolved` /
62
+ * `waitDeadlineExceeded`. Resume reads this to recover dangling
63
+ * wait resolutions (resolved/exceeded but no terminal written).
64
+ */
65
+ wait?: {
66
+ waitKind: 'human-gate' | 'time' | 'condition';
67
+ deadlineAt?: number;
68
+ /** Inline prompt — only set for small prompts (≤1 KiB producer policy)
69
+ * AND for historical pre-v0.1.3 events. When the prompt was spilled
70
+ * to a blob, `prompt` is undefined and consumers must use `promptRef`
71
+ * (full text on demand) or `promptPreview` (cheap, card-safe). */
72
+ prompt?: string;
73
+ /** Blob spill ref (v0.1.3+). Replay never reads the blob; cards
74
+ * must render `promptPreview` only and dashboard reads on demand. */
75
+ promptRef?: OutputRef;
76
+ /** Short preview carried inline on waitCreated when promptRef is set;
77
+ * ≤500 chars by schema, byte-budgeted by the producer. */
78
+ promptPreview?: string;
79
+ /** Default `fail` at the consumer. Recorded only when waitCreated
80
+ * carries the field; absent means caller never specified. */
81
+ onTimeout?: 'fail' | 'success';
82
+ /** Open when neither resolution nor deadline event has landed. */
83
+ resolution?: {
84
+ kind: 'resolved';
85
+ resolution: 'approved' | 'rejected' | 'external';
86
+ by: string;
87
+ comment?: string;
88
+ eventId: string;
89
+ } | {
90
+ kind: 'deadlineExceeded';
91
+ deadlineAt: number;
92
+ exceededAtMs: number;
93
+ eventId: string;
94
+ };
95
+ };
96
+ output?: OutputRef;
97
+ externalRefs?: Record<string, unknown>;
98
+ error?: ErrorPayload;
99
+ runningMs?: number;
100
+ cancelOriginEventId?: string;
101
+ };
102
+ export type ActivityState = {
103
+ activityId: string;
104
+ attempts: AttemptState[];
105
+ status: ActivityStatus;
106
+ currentAttemptId?: string;
107
+ /**
108
+ * Node that owns this Activity (recorded from `attemptCreated.nodeId`).
109
+ * Lets us project node.status when activity-level events arrive
110
+ * (e.g. activityRunning → node.status = 'running').
111
+ */
112
+ ownerNodeId?: string;
113
+ };
114
+ export type NodeState = {
115
+ nodeId: string;
116
+ status: NodeStatus;
117
+ activityId?: string;
118
+ retryCount: number;
119
+ nextAttemptAt?: number;
120
+ errorClass?: ErrorClass;
121
+ conditionEventId?: string;
122
+ cancelOriginEventId?: string;
123
+ };
124
+ export type RunState = {
125
+ runId: string;
126
+ status: RunStatus;
127
+ workflowId?: string;
128
+ revisionId?: string;
129
+ initiator?: string;
130
+ input?: OutputRef;
131
+ output?: OutputRef;
132
+ failedNodeId?: string;
133
+ rootCauseEventId?: string;
134
+ cancelOriginEventId?: string;
135
+ /**
136
+ * Immutable bot identity snapshot captured at runCreated time
137
+ * (UI doc §3.4). Read by the runtime when spawning workers so that
138
+ * subsequent bot-registry rename / re-wire doesn't drift execution
139
+ * away from what was authored. Absent on legacy runs created before
140
+ * v0.1.3 introduced the field.
141
+ */
142
+ botSnapshots?: Record<string, {
143
+ larkAppId?: string;
144
+ cliId?: string;
145
+ displayName?: string;
146
+ workingDir?: string;
147
+ }>;
148
+ };
149
+ export type Snapshot = {
150
+ run: RunState;
151
+ nodes: Map<string, NodeState>;
152
+ activities: Map<string, ActivityState>;
153
+ /** Convenience: terminal outputs by activityId (succeeded events only). */
154
+ outputs: Map<string, OutputRef>;
155
+ /** Last seq seen. 0 if the log is empty. */
156
+ lastSeq: number;
157
+ /**
158
+ * activityIds with attemptCreated but whose latest attempt has no terminal
159
+ * event (succeeded/failed/timedOut/cancelled). Consumed by resume in
160
+ * Step 7 to drive reconcile decisions.
161
+ */
162
+ danglingActivities: string[];
163
+ /**
164
+ * activityIds whose latest attempt wrote effectAttempted but never reached
165
+ * a terminal event for that attempt. Subset of danglingActivities.
166
+ */
167
+ danglingEffectAttempted: string[];
168
+ /**
169
+ * activityIds with waitCreated but no waitResolved / waitDeadlineExceeded.
170
+ */
171
+ danglingWaits: string[];
172
+ /**
173
+ * activityIds whose wait was resolved (either by waitResolved or by
174
+ * waitDeadlineExceeded) but whose attempt never reached a terminal
175
+ * event. Step 8 resume recovery materializes the terminal from the
176
+ * recorded resolution. Disjoint from `danglingWaits`.
177
+ */
178
+ danglingWaitResolutions: string[];
179
+ /**
180
+ * activityIds with a `cancelRequested` targeting them (directly or
181
+ * via fan-out — Step 10 scheduler concern), but no terminal yet.
182
+ *
183
+ * NOT disjoint from `danglingEffectAttempted` (Step 9 round 1
184
+ * finding 1): cancel + effectAttempted is the central case that
185
+ * `recoverCancelWithReconcile` handles — reconcile fires FIRST to
186
+ * capture provider evidence, then writes the cancel-flavored
187
+ * terminal (`activityCanceled` for completedByIdempotentSubmit /
188
+ * freshRetry; `activityFailed{manual}` when reconcile is
189
+ * inconclusive). The orchestrator routes the intersection through
190
+ * the cancel-with-reconcile path; remaining cancels (no effect)
191
+ * go through plain `recoverCancel`.
192
+ *
193
+ * Disjoint from `danglingWaitResolutions` is still upheld — cancel
194
+ * + wait combinations are skipped by wait recovery; cancel wins.
195
+ */
196
+ danglingCancels: string[];
197
+ /**
198
+ * Run-level cancel intent (Step 9 codex round 1 finding 3). Set when
199
+ * a `cancelRequested{kind:run}` lands and not yet `runCanceled`. Replay
200
+ * surfaces it so schedulers / dashboards can see "this run is being
201
+ * cancelled" without re-scanning the event list. Cleared when
202
+ * `runCanceled` lands (run.status === 'cancelled').
203
+ */
204
+ cancelledRunIntent?: {
205
+ cancelOriginEventId: string;
206
+ requestedBy: string;
207
+ reason: string;
208
+ };
209
+ /**
210
+ * Per-node cancel intents. Same shape and role as `cancelledRunIntent`
211
+ * but scoped to a node — set when `cancelRequested{kind:node}` lands
212
+ * and the node hasn't yet reached `nodeCanceled`. First request wins
213
+ * on overlap (consistent with the activity-level fan-out semantics).
214
+ */
215
+ cancelledNodeIntents: Map<string, {
216
+ cancelOriginEventId: string;
217
+ requestedBy: string;
218
+ reason: string;
219
+ }>;
220
+ };
221
+ /**
222
+ * Fold an event log into a state snapshot. Read-only — never executes
223
+ * activity logic, never calls providers, never writes to the log. Events
224
+ * doc §5.2.
225
+ *
226
+ * Throws on:
227
+ * - empty event list (caller must supply at least the runCreated event
228
+ * to derive runId)
229
+ * - first event is not runCreated (state machine forbids — events doc §2.1)
230
+ * - event.runId mismatch (cross-contamination)
231
+ *
232
+ * Does NOT validate state-machine transitions semantically — the log is
233
+ * authoritative. If transitions look wrong (e.g. activitySucceeded without
234
+ * attemptCreated), the resulting snapshot will simply have weird state;
235
+ * verification is the producer's job.
236
+ */
237
+ export declare function replay(events: WorkflowEvent[]): Snapshot;
238
+ //# sourceMappingURL=replay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../../src/workflows/events/replay.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CA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