@proofoftech/flowsafe 0.34.0 → 0.36.0

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 (177) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +15 -3
  3. package/dist/answer-schema.d.ts +30 -0
  4. package/dist/answer-schema.d.ts.map +1 -0
  5. package/dist/answer-schema.js +311 -0
  6. package/dist/answer-schema.js.map +1 -0
  7. package/dist/approval-api/answer-schema.d.ts +2 -0
  8. package/dist/approval-api/answer-schema.d.ts.map +1 -0
  9. package/dist/approval-api/answer-schema.js +3 -0
  10. package/dist/approval-api/answer-schema.js.map +1 -0
  11. package/dist/approval-api/d1-store.d.ts +3 -16
  12. package/dist/approval-api/d1-store.d.ts.map +1 -1
  13. package/dist/approval-api/d1-store.js +117 -33
  14. package/dist/approval-api/d1-store.js.map +1 -1
  15. package/dist/approval-api/grants.d.ts +2 -3
  16. package/dist/approval-api/grants.d.ts.map +1 -1
  17. package/dist/approval-api/grants.js +5 -3
  18. package/dist/approval-api/grants.js.map +1 -1
  19. package/dist/approval-api/human-notifications.d.ts +34 -0
  20. package/dist/approval-api/human-notifications.d.ts.map +1 -0
  21. package/dist/approval-api/human-notifications.js +160 -0
  22. package/dist/approval-api/human-notifications.js.map +1 -0
  23. package/dist/approval-api/index.d.ts +3 -1
  24. package/dist/approval-api/index.d.ts.map +1 -1
  25. package/dist/approval-api/index.js +1 -0
  26. package/dist/approval-api/index.js.map +1 -1
  27. package/dist/approval-api/retention.d.ts +3 -1
  28. package/dist/approval-api/retention.d.ts.map +1 -1
  29. package/dist/approval-api/retention.js +21 -1
  30. package/dist/approval-api/retention.js.map +1 -1
  31. package/dist/approval-api/router.d.ts +1 -1
  32. package/dist/approval-api/router.d.ts.map +1 -1
  33. package/dist/approval-api/router.js +7 -0
  34. package/dist/approval-api/router.js.map +1 -1
  35. package/dist/approval-api/service.d.ts +6 -1
  36. package/dist/approval-api/service.d.ts.map +1 -1
  37. package/dist/approval-api/service.js +55 -10
  38. package/dist/approval-api/service.js.map +1 -1
  39. package/dist/approval-api/store-factory.d.ts +2 -0
  40. package/dist/approval-api/store-factory.d.ts.map +1 -1
  41. package/dist/approval-api/store-factory.js.map +1 -1
  42. package/dist/approval-api/store.d.ts +3 -0
  43. package/dist/approval-api/store.d.ts.map +1 -1
  44. package/dist/approval-api/store.js +2 -1
  45. package/dist/approval-api/store.js.map +1 -1
  46. package/dist/approval-api/types.d.ts +78 -4
  47. package/dist/approval-api/types.d.ts.map +1 -1
  48. package/dist/approval-api/types.js +1 -0
  49. package/dist/approval-api/types.js.map +1 -1
  50. package/dist/do-runner/constants.d.ts +3 -0
  51. package/dist/do-runner/constants.d.ts.map +1 -1
  52. package/dist/do-runner/constants.js +3 -0
  53. package/dist/do-runner/constants.js.map +1 -1
  54. package/dist/do-runner/d1-storage.d.ts.map +1 -1
  55. package/dist/do-runner/d1-storage.js +34 -1
  56. package/dist/do-runner/d1-storage.js.map +1 -1
  57. package/dist/do-runner/durable-object.d.ts +10 -3
  58. package/dist/do-runner/durable-object.d.ts.map +1 -1
  59. package/dist/do-runner/durable-object.js +590 -65
  60. package/dist/do-runner/durable-object.js.map +1 -1
  61. package/dist/do-runner/execution-context.d.ts +6 -0
  62. package/dist/do-runner/execution-context.d.ts.map +1 -1
  63. package/dist/do-runner/execution-context.js +8 -0
  64. package/dist/do-runner/execution-context.js.map +1 -1
  65. package/dist/do-runner/fenced-workflow-capability.d.ts +12 -1
  66. package/dist/do-runner/fenced-workflow-capability.d.ts.map +1 -1
  67. package/dist/do-runner/fenced-workflow-capability.js +17 -0
  68. package/dist/do-runner/fenced-workflow-capability.js.map +1 -1
  69. package/dist/do-runner/fenced-workflows-d1.d.ts.map +1 -1
  70. package/dist/do-runner/fenced-workflows-d1.js +165 -21
  71. package/dist/do-runner/fenced-workflows-d1.js.map +1 -1
  72. package/dist/do-runner/index.d.ts +6 -4
  73. package/dist/do-runner/index.d.ts.map +1 -1
  74. package/dist/do-runner/index.js +4 -2
  75. package/dist/do-runner/index.js.map +1 -1
  76. package/dist/do-runner/init.d.ts +2 -2
  77. package/dist/do-runner/inventory.d.ts +1 -1
  78. package/dist/do-runner/inventory.d.ts.map +1 -1
  79. package/dist/do-runner/inventory.js +57 -1
  80. package/dist/do-runner/inventory.js.map +1 -1
  81. package/dist/do-runner/questions.d.ts +70 -0
  82. package/dist/do-runner/questions.d.ts.map +1 -0
  83. package/dist/do-runner/questions.js +440 -0
  84. package/dist/do-runner/questions.js.map +1 -0
  85. package/dist/do-runner/run-lifecycle.d.ts +25 -7
  86. package/dist/do-runner/run-lifecycle.d.ts.map +1 -1
  87. package/dist/do-runner/run-lifecycle.js +54 -1
  88. package/dist/do-runner/run-lifecycle.js.map +1 -1
  89. package/dist/do-runner/run-storage-tables.d.ts +2 -0
  90. package/dist/do-runner/run-storage-tables.d.ts.map +1 -1
  91. package/dist/do-runner/run-storage-tables.js +2 -0
  92. package/dist/do-runner/run-storage-tables.js.map +1 -1
  93. package/dist/do-runner/run-terminal-state.d.ts +1 -1
  94. package/dist/do-runner/run-terminal-state.d.ts.map +1 -1
  95. package/dist/do-runner/run-terminal-state.js +2 -2
  96. package/dist/do-runner/run-terminal-state.js.map +1 -1
  97. package/dist/do-runner/runtime.d.ts +92 -17
  98. package/dist/do-runner/runtime.d.ts.map +1 -1
  99. package/dist/do-runner/runtime.js +468 -42
  100. package/dist/do-runner/runtime.js.map +1 -1
  101. package/dist/do-runner/schedule-source.d.ts +4 -3
  102. package/dist/do-runner/schedule-source.d.ts.map +1 -1
  103. package/dist/do-runner/schedule-source.js.map +1 -1
  104. package/dist/do-runner/suspension-deadline.d.ts.map +1 -1
  105. package/dist/do-runner/suspension-deadline.js +9 -4
  106. package/dist/do-runner/suspension-deadline.js.map +1 -1
  107. package/dist/do-runner/suspension-kinds.d.ts +6 -0
  108. package/dist/do-runner/suspension-kinds.d.ts.map +1 -0
  109. package/dist/do-runner/suspension-kinds.js +33 -0
  110. package/dist/do-runner/suspension-kinds.js.map +1 -0
  111. package/dist/host-kit/approval-bridge.d.ts +12 -14
  112. package/dist/host-kit/approval-bridge.d.ts.map +1 -1
  113. package/dist/host-kit/approval-bridge.js +40 -18
  114. package/dist/host-kit/approval-bridge.js.map +1 -1
  115. package/dist/host-kit/do-response.d.ts.map +1 -1
  116. package/dist/host-kit/do-response.js +30 -1
  117. package/dist/host-kit/do-response.js.map +1 -1
  118. package/dist/host-kit/do-run-topology.d.ts +8 -3
  119. package/dist/host-kit/do-run-topology.d.ts.map +1 -1
  120. package/dist/host-kit/do-run-topology.js +64 -1
  121. package/dist/host-kit/do-run-topology.js.map +1 -1
  122. package/dist/host-kit/flowsafe-worker.d.ts +23 -6
  123. package/dist/host-kit/flowsafe-worker.d.ts.map +1 -1
  124. package/dist/host-kit/flowsafe-worker.js +121 -16
  125. package/dist/host-kit/flowsafe-worker.js.map +1 -1
  126. package/dist/host-kit/host-approval-service.d.ts +1 -1
  127. package/dist/host-kit/host-approval-service.d.ts.map +1 -1
  128. package/dist/host-kit/host-approval-service.js +10 -4
  129. package/dist/host-kit/host-approval-service.js.map +1 -1
  130. package/dist/host-kit/index.d.ts +3 -1
  131. package/dist/host-kit/index.d.ts.map +1 -1
  132. package/dist/host-kit/index.js +1 -0
  133. package/dist/host-kit/index.js.map +1 -1
  134. package/dist/host-kit/run-router.d.ts +35 -3
  135. package/dist/host-kit/run-router.d.ts.map +1 -1
  136. package/dist/host-kit/run-router.js +119 -6
  137. package/dist/host-kit/run-router.js.map +1 -1
  138. package/dist/human-notification-storage.d.ts +5 -0
  139. package/dist/human-notification-storage.d.ts.map +1 -0
  140. package/dist/human-notification-storage.js +57 -0
  141. package/dist/human-notification-storage.js.map +1 -0
  142. package/dist/notification-retry.d.ts +3 -0
  143. package/dist/notification-retry.d.ts.map +1 -0
  144. package/dist/notification-retry.js +6 -0
  145. package/dist/notification-retry.js.map +1 -0
  146. package/dist/schedules/fire-plan.d.ts +30 -0
  147. package/dist/schedules/fire-plan.d.ts.map +1 -0
  148. package/dist/schedules/fire-plan.js +111 -0
  149. package/dist/schedules/fire-plan.js.map +1 -0
  150. package/dist/schedules/index.d.ts +4 -2
  151. package/dist/schedules/index.d.ts.map +1 -1
  152. package/dist/schedules/index.js +2 -0
  153. package/dist/schedules/index.js.map +1 -1
  154. package/dist/schedules/mutation-contract.d.ts +8 -6
  155. package/dist/schedules/mutation-contract.d.ts.map +1 -1
  156. package/dist/schedules/mutation-contract.js.map +1 -1
  157. package/dist/schedules/router.d.ts +9 -6
  158. package/dist/schedules/router.d.ts.map +1 -1
  159. package/dist/schedules/router.js +362 -94
  160. package/dist/schedules/router.js.map +1 -1
  161. package/dist/schedules/schedule-extensions.d.ts +46 -0
  162. package/dist/schedules/schedule-extensions.d.ts.map +1 -0
  163. package/dist/schedules/schedule-extensions.js +7 -0
  164. package/dist/schedules/schedule-extensions.js.map +1 -0
  165. package/dist/schedules/schedules-d1.d.ts +44 -10
  166. package/dist/schedules/schedules-d1.d.ts.map +1 -1
  167. package/dist/schedules/schedules-d1.js +437 -68
  168. package/dist/schedules/schedules-d1.js.map +1 -1
  169. package/dist/schedules/tick.d.ts +81 -18
  170. package/dist/schedules/tick.d.ts.map +1 -1
  171. package/dist/schedules/tick.js +701 -168
  172. package/dist/schedules/tick.js.map +1 -1
  173. package/dist/signals/notification-dispatch.d.ts +1 -1
  174. package/dist/signals/notification-dispatch.d.ts.map +1 -1
  175. package/dist/signals/notification-dispatch.js +3 -4
  176. package/dist/signals/notification-dispatch.js.map +1 -1
  177. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # @proofoftech/flowsafe
2
2
 
3
+ ## 0.36.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 727db8d: An approval created with `answersSchema` accepts `answers` on decide. Flowsafe validates them, records them with the decision, and passes them to the resumed step under `flowsafe.approvalAnswers`. Decision audit events represent answers by field ID only. Adds columns `answers_schema` and `answers` to `flowsafe_approvals`.
8
+
9
+ An older decide handler records decisions without answers. Deploy the new version to every Worker before any workflow requires approval answers. Before downgrading, decide the open approvals for runs waiting on required answers or terminate those runs.
10
+
11
+ - d9e22b4: `POST /runs/:workflowId/:runId/pause` records a pause that a running workflow run honors at the next persisted top-level step boundary with another step remaining. The run then reads `paused`, holds no execution, keeps its deadline, and can still be terminated. A suspended run keeps its suspension and approvals and can pause at an eligible boundary after resume. Pause requests are available in every execution-fence state. `paused` now occurs on Flowsafe runs.
12
+
13
+ On a pause, a workflow's `onFinish` runs with `status: 'canceled'` and its tracing span ends `canceled`. `isPausedLegFinish(requestContext)` returns true when Flowsafe has persisted the pause before `onFinish`. If `shouldPersistSnapshot` filters out the `canceled` snapshot, Flowsafe can still persist the pause after `onFinish`, so the helper returns false in that callback. A resumed run runs `onFinish` again when it ends.
14
+
15
+ Pause is refused for agent runs, storage without the fenced workflow capability, and runs suspended inside `foreach`. An earlier intent stays pending through a `foreach` resume leg. A scheduled run requires `holdsSchedule: true` because its `skip` or `queue_one` overlap policy can skip or hold fires while it is paused.
16
+
17
+ Before downgrading, resume or terminate paused runs. Earlier versions cannot resume them.
18
+
19
+ - f862216: With `humanNotifications.deliver` configured, approval creation and each SLA escalation write a notification intent in the same D1 transaction as the record. Escalation intent keys include a per-approval counter. A maintenance duty calls the host function while the approval still qualifies for the event. The function receives the intent, approval IDs, title, summary, payload, priority, SLA deadline, and an abort signal. Reads show `deliveryState`. The `notify` sink can run alongside durable delivery. Adds table `flowsafe_human_notification_intents` and requires a database binding with `batch`.
20
+
21
+ Delivery uses at-least-once semantics with a limit of ten claims per intent, including claims interrupted by a crash. Deduplicate by `intent.id` because a crash after delivery can cause another attempt with the same ID.
22
+
23
+ - 332a6d4: Flowsafe retains early answers and checks authorization and answer validity when the question opens. An expired question resumes the run with `answered: false`. The runner recovers stored question outcomes after a restart. Adds table `flowsafe_question_early_answers`.
24
+
25
+ `QuestionAnswerResumeData` represents answers and expiry. Narrow on `answered` before reading `answers` or `answeredBy`, and accept both branches in the step’s resume schema. A run that exhausts question resume retries fails with `QUESTION_RESUME_FAILED`.
26
+
27
+ Deploy every Worker and run object on this release before any workflow suspends on a question. Before downgrading, answer, expire or terminate every question-suspended run. Let pending early answers be processed or purge their runs while this release still manages retention.
28
+
29
+ - 475b6e5: A step can suspend as a typed question (`questionSuspendPayload`). Flowsafe stores a question record bound to that suspension, validates answers against its schema, lets the host authorize who answers, and resumes the run once with the first valid answer. Adds table `flowsafe_questions`.
30
+
31
+ Submit `{ answers, idempotencyKey, suspension: { stepKey, suspendedAt, resumeCount } }` to the question answer route. Copy the suspension fields from the question record and reuse them with the same idempotency key when retrying.
32
+
33
+ `HumanNotificationDeliver` now receives an approval projection or a `QuestionRecord`. Update approval-only handlers to narrow the record before reading approval fields. Deploy every Worker and run object on this release before any workflow suspends on a question. Before downgrading, answer, expire or terminate every question-suspended run.
34
+
35
+ - 7739c72: `POST /runs/:workflowId/:runId/resume-paused` with `expectedGeneration` continues a paused run from its next step or clears a pending pause. A stale generation returns `409 PAUSE_GENERATION_STALE`. `requestContextForRun` providers receive a new leg kind, `restart`. Exhaustive providers must handle the new kind.
36
+
37
+ Restart legs can use run-scoped connector grants. Suspension-bound grants still require their matching suspension. A restart that stops before Mastra's first snapshot write restores the pause with the same generation. Restarting at or after the run deadline returns `409 RUN_TERMINAL_CONFLICT` and leaves settlement to deadline maintenance.
38
+
39
+ The `beforeResume` host hook receives a final `action` argument. `/resume` passes `resume` and `/resume-paused` passes `restart`.
40
+
41
+ - f848b79: `RunSummary.suspensionKinds` names the suspended steps the run object resumes itself (`timer`, `question`, `children`). The approval bridges file no approval for them. A host with its own approval bridge must skip these kinds as it skips `suspensionTimers`.
42
+
43
+ Deploy a release with question support to every Worker and run object before any workflow suspends on a question. Earlier versions can file an approval for that suspension and resume it with approval data. Before downgrading, answer, expire, or terminate every question-suspended run. Once child waits are in use, let each wait finish or expire, or terminate its run before downgrading.
44
+
45
+ ## 0.35.0
46
+
47
+ ### Minor Changes
48
+
49
+ - 03f7755: Schedules accept `at` as epoch milliseconds or an ISO 8601 date-time with `Z` or a numeric offset. Use it in place of `cron` for a schedule that fires once, then reads `paused` with `completedAt`. Resuming a completed schedule returns `409` with `schedule-completed`. Updating its timing reactivates it and preserves trigger history.
50
+
51
+ Start inputs carry a read-only `schedule` origin with the schedule ID, registered owner when configured, creator role, metadata, scheduled time, and timing kind. The claimed trigger keeps the origin under `metadata.scheduleOrigin`.
52
+
53
+ **Breaking change.** Code that constructs `ScheduleTickStartInput`, `ScheduleTickStartAgentInput`, or `ScheduleTickSignalAgentInput` must supply `schedule`.
54
+
55
+ On rollback to Flowsafe 0.31.0, completed one-offs stay paused. Each active one-off takes a slot in the due page and emits an `invalid-cron` failure on every pass until you delete it or give it valid cron timing.
56
+
57
+ - affa82b: The schedule tick takes an optional `admit` hook that runs before a due fire is claimed. A refusal records one `skipped` trigger and audit event without starting a run or consulting the run cap, and can pause the schedule or ask for a bounded retry. A throw, malformed decision, or call that reaches `admitTimeoutMs` records `admission-unavailable`. A cron schedule advances and stays active, and a one-off stays active and retries every minute until the hook answers. A throw or malformed decision affects its own fire. After a call reaches `admitTimeoutMs`, the tick refuses later fires that need admission in that pass as `admission-unavailable` without calling the hook.
58
+
59
+ With `admit` configured, `passBudgetMs` (default 30 s) starts after deferred reconciliation. If the budget cuts an admission call short or expires before the call starts, the affected fire and remaining fires stay due for the next pass. The hook may be called for a fire that is never claimed, so it must be side-effect free or idempotent per scheduled fire.
60
+
61
+ - 910f0e9: After downtime, a schedule with `catchUp` replays the latest eligible occurrence and up to `maxMissed` earlier occurrences inside its window, one per pass. The tick records the dropped occurrences as one skipped trigger. `jitterMs` delays on-time fires by a deterministic offset. The run cap receives the firing schedule's origin, target, and dispatch ID.
62
+
63
+ **Breaking change.** `ScheduleTickRunCap` takes a `ScheduleRunCapInput` argument. Pass it when you call a run cap directly. Existing zero-argument callbacks still work.
64
+
65
+ - d318710: The D1 schedules domain adds columns for one-off timing, completion, admission retries, held fires, jittered fire times, and fire policy. The retry count defaults to zero. The other new columns are nullable. The domain adds them on first use, like `creatorRole`, so no migration file is needed. Include the new columns when copying schedule rows by column name.
66
+
67
+ A trigger's `metadata.scheduleOrigin` is write-once within its schedule. `getTrigger` reads one trigger in any outcome. `FlowsafeSchedule` extends Mastra's `Schedule` without changing `ScheduleStatus`.
68
+
69
+ `listDueSchedules` returns only schedules whose `nextFireAt` has arrived. Use `listHeldSchedules(now, limit)` to find schedules with a held occurrence and a future `nextFireAt`. A scheduler can claim a due fire once its `nextFireAt` has arrived, and a one-off claim must complete the schedule. Completed one-offs free a slot under `maxSchedules`. A skip that advances a jittered schedule can store the next occurrence's nominal time alongside its actual due time.
70
+
71
+ On rollback to 0.31.0 or 0.32.0, completed one-off schedules stay paused. Active one-off schedules occupy a slot and emit a failed `invalid-cron` audit event on each tick until you delete them or give them valid cron timing. Those releases ignore held fires. After upgrading again, a retained held fire can run once its previous run ends, regardless of age. If an older writer advanced `nextFireAt`, the upgraded store treats that `nextFireAt` as the occurrence time and resets the effective admission refusal count to zero.
72
+
73
+ - 22e8daf: A schedule's `overlapPolicy` (`allow`, `skip` or `queue_one`) decides a fire while the schedule's previous run is not terminal, read from the run authority with a deadline. A host sets `defaultOverlapPolicy` for schedules with no stored policy. The default is `allow`, which preserves current behavior. A held fire passes the target checks and the admission hook before it starts. Published triggers keep their `dispatchRef`.
74
+
75
+ Flowsafe 0.31.0 ignores stored overlap policies and held times, keeps them on existing schedule rows, and continues firing due cron occurrences. After re-upgrade, a stored hold can fire on the first pass, even days late. If the latest dispatch record has no `dispatchRef`, as with a 0.31.0 publish, the tick treats the previous run as inactive. The held occurrence can therefore overlap a run that 0.31.0 started.
76
+
77
+ - 86219a9: Schedules accept `overlapPolicy`, `catchUp` and `jitterMs`. `GET /schedules/:id/preview?count=N` returns nominal and due times with deterministic jitter. Hosts can also call the exported `previewScheduleFires` function.
78
+
79
+ Cron times follow the pinned Croner version. A daily time in a daylight-saving gap shifts forward by the size of the gap. A daily time in a repeated hour runs once at the first occurrence.
80
+
81
+ **Breaking change.** `ScheduleOperation` gains `preview`. Add the new member to exhaustive switches.
82
+
83
+ ### Patch Changes
84
+
85
+ - 771f477: A `runCap` or other failure after a schedule fire is claimed settles that fire once as `failed` with reason `run-cap-error` or `post-claim-error`, instead of counting it in two passes and recording a malformed stored dispatch.
86
+
3
87
  ## 0.34.0
4
88
 
5
89
  ### Minor Changes
package/README.md CHANGED
@@ -40,7 +40,7 @@ Compatibility:
40
40
  | `@proofoftech/flowsafe/agent-host` | Server-only guarded-agent catalogs, authenticated run routes, thread hosting, NDJSON observation, and approval-only resume |
41
41
  | `@proofoftech/flowsafe/approval-api` | Approval records, actor resolver, service, deployment store, REST router, grants, SLA, retention, notifications, and stream events |
42
42
  | `@proofoftech/flowsafe/do-runner` | Durable Object runner, D1 storage, deployment sentinel, run summaries, snapshot provenance, identities, pub/sub, and retention |
43
- | `@proofoftech/flowsafe/do-runner/constants` | Suspension deadline values, duration validation, and timeout detection |
43
+ | `@proofoftech/flowsafe/do-runner/constants` | Suspension deadline values, duration validation, timeout detection, and reserved payload keys `SUSPENSION_QUESTION_PAYLOAD_KEY` and `SUSPENSION_AWAIT_CHILDREN_PAYLOAD_KEY` |
44
44
  | `@proofoftech/flowsafe/do-runner/testing` | Timeout resume fixtures for workflow tests |
45
45
  | `@proofoftech/flowsafe/approval-ui` | Styling-library-agnostic React dashboard, DOM-free API client, headless hook, and live transport |
46
46
  | `@proofoftech/flowsafe/host-kit` | Authenticator and verifier seams, topologies, run/stream routers, approval bridges, and composed Worker |
@@ -141,9 +141,21 @@ Durable-agent records produce `tool-call` scope. Workflow gates produce exact `s
141
141
 
142
142
  The same durable tool call may retry with its persisted `toolCallId`; a new model tool call requires approval. Legacy records without explicit scope and legacy connector ID arrays fail closed.
143
143
 
144
+ ## Pause a workflow run
145
+
146
+ Send `POST /runs/:workflowId/:runId/pause` with a `reason` of 1 to 500 characters. See the [runtime lifecycle guide](https://github.com/ProofOfTechOrg/anchorage/blob/main/docs/do-runner-design.md#pause-a-run) for scheduled runs and workflows that suspend inside `foreach`.
147
+
148
+ | Run summary | Workflow state |
149
+ | --- | --- |
150
+ | `running` with `pauseRequestedAt` | The pause is pending. The running entry can finish. |
151
+ | `suspended` with `pauseRequestedAt` | The run still waits on its current suspension. |
152
+ | `paused` with `pausedAt` | The run holds no execution. Its deadline and terminate remain available. |
153
+
154
+ Send `POST /runs/:workflowId/:runId/resume-paused` with `expectedGeneration` set to the run summary's `pauseGeneration` to continue the run.
155
+
144
156
  ## Terminate runs and enforce deadlines
145
157
 
146
- The composed host mounts `POST /runs/:workflowId/:runId/terminate`. It transitions `running`, waiting, retry, and suspended runs to `cancelled`. The summary contains this exact structured reason:
158
+ The composed host mounts `POST /runs/:workflowId/:runId/terminate`. It transitions `running`, waiting, retry, suspended, and paused runs to `cancelled`. The summary contains this exact structured reason:
147
159
 
148
160
  ```json
149
161
  {
@@ -596,7 +608,7 @@ A non-owner's notification, and an unbranded agent's owner notification, are che
596
608
 
597
609
  ### Schedules
598
610
 
599
- `D1SchedulesStorage` implements the schedule domain. `createScheduleRouter()` provides deployment-wide role-gated CRUD and read-only trigger history. `createScheduleTick()` claims due fires with compare-and-swap (CAS), protects reserved context keys, consults the configured unattended-run cap, mints an opaque run id, and starts a workflow or agent through the correct topology. Without the optional cap seam, unattended starts are uncapped.
611
+ `D1SchedulesStorage` implements the schedule domain. `createScheduleRouter()` provides deployment-wide role-gated CRUD and read-only trigger history. `createScheduleTick()` claims due fires with compare-and-swap (CAS), protects reserved context keys, mints an opaque run ID, and starts a workflow or agent through the correct topology. The optional unattended-run cap receives `{ schedule, target, dispatchId }` for workflow and threadless agent starts. Without `runCap`, those starts are uncapped.
600
612
 
601
613
  ### Background tasks
602
614
 
@@ -0,0 +1,30 @@
1
+ import type { AnswerSchema, AnswerValues } from './approval-api/types.js';
2
+ import { DoStatusError } from './do-runner/do-status-error.js';
3
+ export declare class InvalidAnswerSchemaError extends DoStatusError {
4
+ readonly status = 400;
5
+ readonly reason: {
6
+ readonly code: "ANSWER_SCHEMA_INVALID";
7
+ };
8
+ constructor();
9
+ }
10
+ export declare class AnswersInvalidError extends DoStatusError {
11
+ readonly fieldIds: string[];
12
+ readonly status = 400;
13
+ readonly reason: {
14
+ readonly code: 'ANSWERS_INVALID';
15
+ readonly fieldIds: string[];
16
+ readonly unknownFieldCount?: number;
17
+ };
18
+ constructor(fieldIds: string[], unknownFieldCount?: number);
19
+ }
20
+ export declare class AnswersNotAcceptedError extends DoStatusError {
21
+ readonly status = 400;
22
+ readonly reason: {
23
+ readonly code: "ANSWERS_NOT_ACCEPTED";
24
+ };
25
+ constructor();
26
+ }
27
+ export declare function validateAnswerSchema(value: unknown): AnswerSchema;
28
+ export declare function validateAnswers(schema: AnswerSchema, answers: unknown): AnswerValues;
29
+ export declare function answerSchemaToJsonSchema(schema: AnswerSchema): Record<string, unknown>;
30
+ //# sourceMappingURL=answer-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer-schema.d.ts","sourceRoot":"","sources":["../src/answer-schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,YAAY,EACZ,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAQ/D,qBAAa,wBAAyB,SAAQ,aAAa;IACzD,QAAQ,CAAC,MAAM,OAAO;IACtB,QAAQ,CAAC,MAAM;;MAA8C;;CAM9D;AAED,qBAAa,mBAAoB,SAAQ,aAAa;IASlD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE;IAR7B,QAAQ,CAAC,MAAM,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;QACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAC5B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;KACrC,CAAC;gBAGS,QAAQ,EAAE,MAAM,EAAE,EAC3B,iBAAiB,SAAI;CAUxB;AAED,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,QAAQ,CAAC,MAAM,OAAO;IACtB,QAAQ,CAAC,MAAM;;MAA6C;;CAM7D;AAuKD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAqBjE;AA8CD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,GACf,YAAY,CA8Bd;AAsCD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB"}
@@ -0,0 +1,311 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { DoStatusError } from './do-runner/do-status-error.js';
3
+ const MAX_FIELDS = 32;
4
+ const MAX_OPTIONS = 64;
5
+ const MAX_JSON_BYTES = 16_384;
6
+ const MAX_TEXT_LENGTH = 4_000;
7
+ const utf8 = new TextEncoder();
8
+ export class InvalidAnswerSchemaError extends DoStatusError {
9
+ status = 400;
10
+ reason = { code: 'ANSWER_SCHEMA_INVALID' };
11
+ constructor() {
12
+ super('invalid answers schema');
13
+ this.name = 'InvalidAnswerSchemaError';
14
+ }
15
+ }
16
+ export class AnswersInvalidError extends DoStatusError {
17
+ fieldIds;
18
+ status = 400;
19
+ reason;
20
+ constructor(fieldIds, unknownFieldCount = 0) {
21
+ super('answers do not match the schema');
22
+ this.fieldIds = fieldIds;
23
+ this.name = 'AnswersInvalidError';
24
+ this.reason = {
25
+ code: 'ANSWERS_INVALID',
26
+ fieldIds,
27
+ ...(unknownFieldCount > 0 ? { unknownFieldCount } : {}),
28
+ };
29
+ }
30
+ }
31
+ export class AnswersNotAcceptedError extends DoStatusError {
32
+ status = 400;
33
+ reason = { code: 'ANSWERS_NOT_ACCEPTED' };
34
+ constructor() {
35
+ super('this approval does not accept answers');
36
+ this.name = 'AnswersNotAcceptedError';
37
+ }
38
+ }
39
+ function record(value) {
40
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
41
+ return undefined;
42
+ }
43
+ const prototype = Object.getPrototypeOf(value);
44
+ if (prototype !== null && prototype !== Object.prototype)
45
+ return undefined;
46
+ return value;
47
+ }
48
+ function descriptor(value, keys) {
49
+ const object = record(value);
50
+ if (!object || Object.keys(object).some((key) => !keys.includes(key))) {
51
+ throw new InvalidAnswerSchemaError();
52
+ }
53
+ return object;
54
+ }
55
+ function option(value) {
56
+ const { id, label } = descriptor(value, ['id', 'label']);
57
+ if (typeof id !== 'string' || id.length === 0 || typeof label !== 'string') {
58
+ throw new InvalidAnswerSchemaError();
59
+ }
60
+ return { id, label };
61
+ }
62
+ function optionalNumber(value) {
63
+ if (value === undefined)
64
+ return undefined;
65
+ if (typeof value !== 'number' || !Number.isFinite(value)) {
66
+ throw new InvalidAnswerSchemaError();
67
+ }
68
+ return value;
69
+ }
70
+ function optionalCount(value, max = Number.MAX_SAFE_INTEGER) {
71
+ const count = optionalNumber(value);
72
+ if (count !== undefined &&
73
+ (!Number.isInteger(count) || count < 0 || count > max)) {
74
+ throw new InvalidAnswerSchemaError();
75
+ }
76
+ return count;
77
+ }
78
+ function textLengthLimit(maxLength) {
79
+ return Math.min(maxLength ?? MAX_TEXT_LENGTH, MAX_TEXT_LENGTH);
80
+ }
81
+ const FIELD_KEYS = {
82
+ choice: ['multiple', 'options', 'minSelected', 'maxSelected'],
83
+ text: ['minLength', 'maxLength'],
84
+ number: ['min', 'max', 'integer'],
85
+ boolean: [],
86
+ };
87
+ function isFieldKind(kind) {
88
+ return typeof kind === 'string' && Object.hasOwn(FIELD_KEYS, kind);
89
+ }
90
+ function answerField(value) {
91
+ const kind = record(value)?.kind;
92
+ if (!isFieldKind(kind))
93
+ throw new InvalidAnswerSchemaError();
94
+ const field = descriptor(value, [
95
+ 'kind',
96
+ 'id',
97
+ 'label',
98
+ 'required',
99
+ ...FIELD_KEYS[kind],
100
+ ]);
101
+ const { id, label, required } = field;
102
+ if (typeof id !== 'string' ||
103
+ id.length === 0 ||
104
+ typeof label !== 'string' ||
105
+ typeof required !== 'boolean') {
106
+ throw new InvalidAnswerSchemaError();
107
+ }
108
+ const base = { id, label, required };
109
+ switch (kind) {
110
+ case 'choice': {
111
+ const { multiple, options: rawOptions } = field;
112
+ if (typeof multiple !== 'boolean' ||
113
+ !Array.isArray(rawOptions) ||
114
+ rawOptions.length === 0 ||
115
+ rawOptions.length > MAX_OPTIONS) {
116
+ throw new InvalidAnswerSchemaError();
117
+ }
118
+ const options = Array.from(rawOptions, option);
119
+ const ids = new Set(options.map((entry) => entry.id));
120
+ const minSelected = optionalCount(field.minSelected, options.length);
121
+ const maxSelected = optionalCount(field.maxSelected, options.length);
122
+ if (ids.size !== options.length ||
123
+ (!multiple &&
124
+ (minSelected !== undefined || maxSelected !== undefined)) ||
125
+ (minSelected ?? 0) > (maxSelected ?? options.length)) {
126
+ throw new InvalidAnswerSchemaError();
127
+ }
128
+ return {
129
+ ...base,
130
+ kind,
131
+ multiple,
132
+ options,
133
+ ...(minSelected === undefined ? {} : { minSelected }),
134
+ ...(maxSelected === undefined ? {} : { maxSelected }),
135
+ };
136
+ }
137
+ case 'text': {
138
+ const minLength = optionalCount(field.minLength);
139
+ const maxLength = optionalCount(field.maxLength);
140
+ if ((minLength ?? 0) > textLengthLimit(maxLength)) {
141
+ throw new InvalidAnswerSchemaError();
142
+ }
143
+ return {
144
+ ...base,
145
+ kind,
146
+ ...(minLength === undefined ? {} : { minLength }),
147
+ ...(maxLength === undefined ? {} : { maxLength }),
148
+ };
149
+ }
150
+ case 'number': {
151
+ const min = optionalNumber(field.min);
152
+ const max = optionalNumber(field.max);
153
+ const { integer } = field;
154
+ const lowerBound = required && integer === true && min !== undefined
155
+ ? Math.ceil(min)
156
+ : min;
157
+ if ((lowerBound !== undefined && max !== undefined && lowerBound > max) ||
158
+ (integer !== undefined && typeof integer !== 'boolean')) {
159
+ throw new InvalidAnswerSchemaError();
160
+ }
161
+ return {
162
+ ...base,
163
+ kind,
164
+ ...(min === undefined ? {} : { min }),
165
+ ...(max === undefined ? {} : { max }),
166
+ ...(integer === undefined ? {} : { integer }),
167
+ };
168
+ }
169
+ case 'boolean':
170
+ return { ...base, kind };
171
+ }
172
+ }
173
+ function withinJsonLimit(value) {
174
+ const json = JSON.stringify(value);
175
+ return (json.length <= MAX_JSON_BYTES &&
176
+ utf8.encode(json).byteLength <= MAX_JSON_BYTES);
177
+ }
178
+ export function validateAnswerSchema(value) {
179
+ const { version, fields: rawFields } = descriptor(value, [
180
+ 'version',
181
+ 'fields',
182
+ ]);
183
+ if (version !== 1 ||
184
+ !Array.isArray(rawFields) ||
185
+ rawFields.length > MAX_FIELDS) {
186
+ throw new InvalidAnswerSchemaError();
187
+ }
188
+ const fields = Array.from(rawFields, answerField);
189
+ const schema = { version, fields };
190
+ if (new Set(fields.map((field) => field.id)).size !== fields.length ||
191
+ !withinJsonLimit(schema)) {
192
+ throw new InvalidAnswerSchemaError();
193
+ }
194
+ return schema;
195
+ }
196
+ function matchesField(field, value) {
197
+ switch (field.kind) {
198
+ case 'choice': {
199
+ const isOption = (id) => field.options.some((entry) => entry.id === id);
200
+ if (!field.multiple)
201
+ return isOption(value);
202
+ if (!Array.isArray(value) ||
203
+ value.length < (field.minSelected ?? 0) ||
204
+ value.length > (field.maxSelected ?? field.options.length)) {
205
+ return false;
206
+ }
207
+ const selected = new Set(value);
208
+ return (selected.size === value.length && Array.from(selected).every(isOption));
209
+ }
210
+ case 'text': {
211
+ if (typeof value !== 'string' || value.length > MAX_TEXT_LENGTH * 2) {
212
+ return false;
213
+ }
214
+ const length = Array.from(value).length;
215
+ return (length >= (field.minLength ?? 0) &&
216
+ length <= textLengthLimit(field.maxLength));
217
+ }
218
+ case 'number':
219
+ return (typeof value === 'number' &&
220
+ Number.isFinite(value) &&
221
+ (!field.integer || Number.isInteger(value)) &&
222
+ (field.min === undefined || value >= field.min) &&
223
+ (field.max === undefined || value <= field.max));
224
+ case 'boolean':
225
+ return typeof value === 'boolean';
226
+ }
227
+ }
228
+ export function validateAnswers(schema, answers) {
229
+ const object = record(answers);
230
+ if (!object)
231
+ throw new AnswersInvalidError([]);
232
+ const fields = new Map(schema.fields.map((field) => [field.id, field]));
233
+ const invalid = new Set();
234
+ const entries = new Map();
235
+ let unknownFieldCount = 0;
236
+ for (const id of Object.keys(object)) {
237
+ const field = fields.get(id);
238
+ if (!field) {
239
+ unknownFieldCount += 1;
240
+ continue;
241
+ }
242
+ const value = object[id];
243
+ if (!matchesField(field, value)) {
244
+ invalid.add(id);
245
+ }
246
+ else {
247
+ entries.set(id, Array.isArray(value) ? [...value] : value);
248
+ }
249
+ }
250
+ for (const field of schema.fields) {
251
+ if (field.required && !entries.has(field.id))
252
+ invalid.add(field.id);
253
+ }
254
+ if (invalid.size > 0 || unknownFieldCount > 0) {
255
+ throw new AnswersInvalidError([...invalid], unknownFieldCount);
256
+ }
257
+ const canonical = Object.fromEntries(entries);
258
+ if (!withinJsonLimit(canonical))
259
+ throw new AnswersInvalidError([]);
260
+ return canonical;
261
+ }
262
+ function jsonSchemaForField(field) {
263
+ switch (field.kind) {
264
+ case 'choice': {
265
+ const choice = {
266
+ type: 'string',
267
+ oneOf: field.options.map(({ id, label }) => ({
268
+ const: id,
269
+ title: label,
270
+ })),
271
+ };
272
+ if (!field.multiple)
273
+ return choice;
274
+ return {
275
+ type: 'array',
276
+ items: choice,
277
+ uniqueItems: true,
278
+ minItems: field.minSelected ?? 0,
279
+ maxItems: field.maxSelected ?? field.options.length,
280
+ };
281
+ }
282
+ case 'text':
283
+ return {
284
+ type: 'string',
285
+ minLength: field.minLength ?? 0,
286
+ maxLength: textLengthLimit(field.maxLength),
287
+ };
288
+ case 'number':
289
+ return {
290
+ type: field.integer ? 'integer' : 'number',
291
+ ...(field.min === undefined ? {} : { minimum: field.min }),
292
+ ...(field.max === undefined ? {} : { maximum: field.max }),
293
+ };
294
+ case 'boolean':
295
+ return { type: 'boolean' };
296
+ }
297
+ }
298
+ export function answerSchemaToJsonSchema(schema) {
299
+ return {
300
+ type: 'object',
301
+ additionalProperties: false,
302
+ properties: Object.fromEntries(schema.fields.map((field) => [
303
+ field.id,
304
+ { title: field.label, ...jsonSchemaForField(field) },
305
+ ])),
306
+ required: schema.fields
307
+ .filter((field) => field.required)
308
+ .map((field) => field.id),
309
+ };
310
+ }
311
+ //# sourceMappingURL=answer-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer-schema.js","sourceRoot":"","sources":["../src/answer-schema.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAOtC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;AAE/B,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IAChD,MAAM,GAAG,GAAG,CAAC;IACb,MAAM,GAAG,EAAE,IAAI,EAAE,uBAAuB,EAAW,CAAC;IAE7D;QACE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IASzC;IARF,MAAM,GAAG,GAAG,CAAC;IACb,MAAM,CAIb;IAEF,YACW,QAAkB,EAC3B,iBAAiB,GAAG,CAAC;QAErB,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAHhC,aAAQ,GAAR,QAAQ,CAAU;QAI3B,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG;YACZ,IAAI,EAAE,iBAAiB;YACvB,QAAQ;YACR,GAAG,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,C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AC,KAAK,CAAC,QAAQ,CAAC;aACjC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;KAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from '../answer-schema.js';
2
+ //# sourceMappingURL=answer-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer-schema.d.ts","sourceRoot":"","sources":["../../src/approval-api/answer-schema.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ export * from '../answer-schema.js';
3
+ //# sourceMappingURL=answer-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer-schema.js","sourceRoot":"","sources":["../../src/approval-api/answer-schema.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,cAAc,qBAAqB,CAAC"}
@@ -1,20 +1,6 @@
1
1
  import { type ApprovalPatch, type ApprovalStore, type ApprovalTransitionOptions, type CreateResult } from './store.js';
2
- import { type ApprovalListFilter, type ApprovalMetrics, type ApprovalRecord, type ApprovalStatus } from './types.js';
3
- /**
4
- * The subset of D1Database this store uses, held structurally so tests can
5
- * back it with real SQLite (node:sqlite) and Workers pass env.DB directly.
6
- */
7
- export interface ApprovalDatabase {
8
- prepare(query: string): ApprovalPreparedStatement;
9
- }
10
- export interface ApprovalPreparedStatement {
11
- bind(...values: unknown[]): ApprovalPreparedStatement;
12
- first<T = unknown>(): Promise<T | null>;
13
- run(): Promise<unknown>;
14
- all<T = unknown>(): Promise<{
15
- results: T[];
16
- }>;
17
- }
2
+ import { type ApprovalDatabase, type ApprovalListFilter, type ApprovalMetrics, type ApprovalRecord, type ApprovalStatus } from './types.js';
3
+ export type { ApprovalDatabase, ApprovalPreparedStatement } from './types.js';
18
4
  export interface D1ApprovalStoreOptions {
19
5
  /**
20
6
  * Shared schema gate: the factory memoizes one schema-init promise per
@@ -23,6 +9,7 @@ export interface D1ApprovalStoreOptions {
23
9
  ready?: () => Promise<void>;
24
10
  /** Existing Mastra snapshot table used to fence human decisions. */
25
11
  workflowSnapshotTable?: string;
12
+ humanNotifications?: boolean;
26
13
  }
27
14
  /**
28
15
  * One-shot schema creation + fail-closed shape check. Exported for the
@@ -1 +1 @@
1
- {"version":3,"file":"d1-store.d.ts","sourceRoot":"","sources":["../../src/approval-api/d1-store.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EAElB,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,cAAc,EASpB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,yBAAyB,CAAC;CACnD;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,yBAAyB,CAAC;IACtD,KAAK,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACxC,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC,EAAE,CAAA;KAAE,CAAC,CAAC;CAC/C;AA8aD,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,oEAAoE;IACpE,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,gBAAgB,GACnB,OAAO,CAAC,IAAI,CAAC,CA0Df;AAED,qBAAa,eAAgB,YAAW,a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