@nylorun/runtime 0.10.0-beta → 0.12.0-beta

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 (194) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +53 -51
  3. package/dist/adapters/execution/restate.d.ts +130 -0
  4. package/dist/adapters/execution/restate.js +442 -0
  5. package/dist/adapters/sandbox/virtual.js +1 -1
  6. package/dist/adapters/streams/s2.d.ts +18 -0
  7. package/dist/adapters/streams/s2.js +361 -0
  8. package/dist/core/executors.d.ts +4 -1
  9. package/dist/core/executors.js +20 -1
  10. package/dist/core/flow-host.d.ts +93 -132
  11. package/dist/core/flow-host.js +282 -547
  12. package/dist/core/sandbox-routes.d.ts +13 -4
  13. package/dist/core/sandbox-routes.js +14 -12
  14. package/dist/execution/memory.d.ts +54 -0
  15. package/dist/execution/memory.js +217 -0
  16. package/dist/execution/types.d.ts +125 -0
  17. package/dist/execution/types.js +52 -0
  18. package/dist/host/config-for.d.ts +2 -1
  19. package/dist/host/config-for.js +3 -21
  20. package/dist/host/config.d.ts +0 -8
  21. package/dist/host/create-host.d.ts +36 -1
  22. package/dist/host/create-host.js +51 -24
  23. package/dist/host/execution.d.ts +61 -0
  24. package/dist/host/execution.js +69 -0
  25. package/dist/host/http.d.ts +4 -0
  26. package/dist/host/http.js +6 -0
  27. package/dist/host/index.d.ts +3 -1
  28. package/dist/host/index.js +2 -0
  29. package/dist/host/main.js +106 -47
  30. package/dist/host/stack-config.d.ts +72 -0
  31. package/dist/host/stack-config.js +193 -0
  32. package/dist/index.d.ts +1 -1
  33. package/dist/infra/database.d.ts +16 -0
  34. package/dist/infra/database.js +31 -0
  35. package/dist/infra/execution.d.ts +39 -0
  36. package/dist/infra/execution.js +68 -0
  37. package/dist/infra/index.d.ts +42 -0
  38. package/dist/infra/index.js +56 -0
  39. package/dist/infra/readiness.d.ts +33 -0
  40. package/dist/infra/readiness.js +53 -0
  41. package/dist/infra/streams.d.ts +17 -0
  42. package/dist/infra/streams.js +33 -0
  43. package/dist/infra/workers.d.ts +39 -0
  44. package/dist/infra/workers.js +31 -0
  45. package/dist/model/pi-model.d.ts +2 -2
  46. package/dist/model/pi-model.js +5 -5
  47. package/dist/sandbox/manager.d.ts +26 -8
  48. package/dist/sandbox/manager.js +95 -47
  49. package/dist/sandbox/select.d.ts +1 -1
  50. package/dist/sandbox/select.js +4 -5
  51. package/dist/sandbox/types.d.ts +2 -2
  52. package/dist/store/canonical.d.ts +5 -0
  53. package/dist/store/canonical.js +17 -0
  54. package/dist/store/cursor.d.ts +9 -0
  55. package/dist/store/cursor.js +18 -0
  56. package/dist/store/memory.d.ts +57 -0
  57. package/dist/store/memory.js +645 -0
  58. package/dist/store/ownership.d.ts +19 -0
  59. package/dist/store/ownership.js +33 -0
  60. package/dist/store/postgres/connect.d.ts +25 -0
  61. package/dist/store/postgres/connect.js +25 -0
  62. package/dist/store/postgres/locking.d.ts +16 -0
  63. package/dist/store/postgres/locking.js +22 -0
  64. package/dist/store/postgres/migrations/001_initial.d.ts +27 -0
  65. package/dist/store/postgres/migrations/001_initial.js +196 -0
  66. package/dist/store/postgres/migrations/002_session_owner.d.ts +6 -0
  67. package/dist/store/postgres/migrations/002_session_owner.js +13 -0
  68. package/dist/store/postgres/migrations/index.d.ts +49 -0
  69. package/dist/store/postgres/migrations/index.js +76 -0
  70. package/dist/store/postgres/names.d.ts +11 -0
  71. package/dist/store/postgres/names.js +42 -0
  72. package/dist/store/postgres/store.d.ts +11 -0
  73. package/dist/store/postgres/store.js +797 -0
  74. package/dist/store/postgres/tenants.d.ts +90 -0
  75. package/dist/store/postgres/tenants.js +214 -0
  76. package/dist/store/types.d.ts +442 -0
  77. package/dist/store/types.js +10 -0
  78. package/dist/streams/basin.d.ts +23 -0
  79. package/dist/streams/basin.js +51 -0
  80. package/dist/streams/memory.d.ts +25 -0
  81. package/dist/streams/memory.js +124 -0
  82. package/dist/streams/relay.d.ts +37 -0
  83. package/dist/streams/relay.js +254 -0
  84. package/dist/streams/types.d.ts +115 -0
  85. package/dist/streams/types.js +86 -0
  86. package/dist/tenant/actions.d.ts +153 -0
  87. package/dist/tenant/actions.js +191 -0
  88. package/dist/tenant/advance.d.ts +15 -0
  89. package/dist/tenant/advance.js +439 -0
  90. package/dist/tenant/auth.d.ts +32 -0
  91. package/dist/tenant/auth.js +169 -0
  92. package/dist/tenant/commands.d.ts +3 -0
  93. package/dist/tenant/commands.js +393 -0
  94. package/dist/tenant/context.d.ts +147 -0
  95. package/dist/tenant/context.js +48 -0
  96. package/dist/tenant/effects.d.ts +20 -0
  97. package/dist/tenant/effects.js +564 -0
  98. package/dist/tenant/envelope.d.ts +0 -3
  99. package/dist/tenant/envelope.js +2 -34
  100. package/dist/tenant/ephemeral.d.ts +15 -4
  101. package/dist/tenant/ephemeral.js +106 -38
  102. package/dist/tenant/http.d.ts +38 -0
  103. package/dist/tenant/http.js +53 -0
  104. package/dist/tenant/live.d.ts +92 -0
  105. package/dist/tenant/live.js +290 -0
  106. package/dist/tenant/model-setting.d.ts +16 -0
  107. package/dist/tenant/model-setting.js +12 -0
  108. package/dist/tenant/module.d.ts +29 -8
  109. package/dist/tenant/module.js +165 -158
  110. package/dist/tenant/paths.d.ts +12 -8
  111. package/dist/tenant/paths.js +38 -12
  112. package/dist/tenant/principals.d.ts +12 -13
  113. package/dist/tenant/principals.js +50 -38
  114. package/dist/tenant/quarantine-error.d.ts +1 -1
  115. package/dist/tenant/quarantine-error.js +2 -8
  116. package/dist/tenant/quarantine.d.ts +0 -8
  117. package/dist/tenant/quarantine.js +8 -30
  118. package/dist/tenant/reset.d.ts +7 -6
  119. package/dist/tenant/reset.js +7 -51
  120. package/dist/tenant/routes-tenant.d.ts +12 -0
  121. package/dist/tenant/routes-tenant.js +137 -0
  122. package/dist/tenant/routes.d.ts +9 -0
  123. package/dist/tenant/routes.js +151 -0
  124. package/dist/tenant/runtime.d.ts +59 -58
  125. package/dist/tenant/runtime.js +243 -2201
  126. package/dist/tenant/scheduler.d.ts +25 -0
  127. package/dist/tenant/scheduler.js +84 -0
  128. package/dist/tenant/session.d.ts +60 -0
  129. package/dist/tenant/session.js +94 -0
  130. package/dist/tenant/sessions.d.ts +40 -0
  131. package/dist/tenant/sessions.js +163 -0
  132. package/dist/tenant/status.d.ts +13 -4
  133. package/dist/tenant/status.js +76 -41
  134. package/dist/tenant/store-memory.d.ts +9 -12
  135. package/dist/tenant/store-memory.js +79 -68
  136. package/dist/tenant/store-pg.d.ts +15 -0
  137. package/dist/tenant/store-pg.js +140 -0
  138. package/dist/tenant/streams.d.ts +126 -0
  139. package/dist/tenant/streams.js +419 -0
  140. package/dist/tenant/sweep.d.ts +15 -0
  141. package/dist/tenant/sweep.js +122 -0
  142. package/dist/tenant/transcript.d.ts +104 -0
  143. package/dist/tenant/transcript.js +58 -0
  144. package/dist/tenant/types.d.ts +101 -15
  145. package/dist/tenant/types.js +23 -1
  146. package/dist/tenant/worker.d.ts +84 -0
  147. package/dist/tenant/worker.js +189 -0
  148. package/dist/vault/service.d.ts +44 -31
  149. package/dist/vault/service.js +454 -360
  150. package/dist/version.d.ts +1 -1
  151. package/dist/version.js +1 -1
  152. package/package.json +15 -14
  153. package/dist/adapters/sandbox/microsandbox.d.ts +0 -2
  154. package/dist/adapters/sandbox/microsandbox.js +0 -238
  155. package/dist/core/store.d.ts +0 -32
  156. package/dist/core/store.js +0 -143
  157. package/dist/launcher/commands.d.ts +0 -24
  158. package/dist/launcher/commands.js +0 -260
  159. package/dist/launcher/ensure-config.d.ts +0 -16
  160. package/dist/launcher/ensure-config.js +0 -79
  161. package/dist/launcher/errors.d.ts +0 -12
  162. package/dist/launcher/errors.js +0 -22
  163. package/dist/launcher/host-config.d.ts +0 -17
  164. package/dist/launcher/host-config.js +0 -64
  165. package/dist/launcher/host-state.d.ts +0 -17
  166. package/dist/launcher/host-state.js +0 -61
  167. package/dist/launcher/lifecycle.d.ts +0 -66
  168. package/dist/launcher/lifecycle.js +0 -407
  169. package/dist/launcher/locks.d.ts +0 -26
  170. package/dist/launcher/locks.js +0 -117
  171. package/dist/launcher/logs.d.ts +0 -18
  172. package/dist/launcher/logs.js +0 -117
  173. package/dist/launcher/main.d.ts +0 -2
  174. package/dist/launcher/main.js +0 -66
  175. package/dist/launcher/output.d.ts +0 -11
  176. package/dist/launcher/output.js +0 -68
  177. package/dist/launcher/paths.d.ts +0 -20
  178. package/dist/launcher/paths.js +0 -36
  179. package/dist/launcher/probe.d.ts +0 -23
  180. package/dist/launcher/probe.js +0 -72
  181. package/dist/launcher/protocol.d.ts +0 -62
  182. package/dist/launcher/protocol.js +0 -1
  183. package/dist/launcher/schema-guard.d.ts +0 -6
  184. package/dist/launcher/schema-guard.js +0 -36
  185. package/dist/launcher/spawn.d.ts +0 -22
  186. package/dist/launcher/spawn.js +0 -85
  187. package/dist/launcher/status.d.ts +0 -6
  188. package/dist/launcher/status.js +0 -65
  189. package/dist/tenant/migration.d.ts +0 -16
  190. package/dist/tenant/migration.js +0 -116
  191. package/dist/tenant/schema.d.ts +0 -23
  192. package/dist/tenant/schema.js +0 -151
  193. package/dist/tenant/store-fs.d.ts +0 -16
  194. package/dist/tenant/store-fs.js +0 -205
@@ -1,6 +1,8 @@
1
- import type { Action, LiveEvent } from "@nylorun/core/contracts";
1
+ import type { Action, ActionOutcome } from "@nylorun/core/contracts";
2
2
  import type { JsonValue, WorkflowManifest } from "@nylorun/core/define";
3
- import type { EffectResolution, HostEffect } from "@nylorun/harness/run";
3
+ import type { HostEffect } from "@nylorun/harness/run";
4
+ import type { Wake } from "../execution/types.js";
5
+ import type { EffectDoc, Tx } from "../store/types.js";
4
6
  import { type FlowLimits } from "./limits.js";
5
7
  /** Deterministic agent session id: derive(workflowSessionId, path, …parts). */
6
8
  export declare function deriveSessionId(workflowSessionId: string, path: string, ...parts: string[]): string;
@@ -24,12 +26,6 @@ export type FlowLink = {
24
26
  readonly effectId: string;
25
27
  readonly turnId: string;
26
28
  };
27
- export type FlowHostStore = {
28
- get<T = any>(table: string, id: string): T | undefined;
29
- put(table: string, id: string, body: unknown): void;
30
- all<T = any>(table: string): T[];
31
- event(sessionId: string, turnId: string | null, type: string, payload: unknown): LiveEvent;
32
- };
33
29
  export type FlowHostSession = {
34
30
  id: string;
35
31
  agentId: string;
@@ -45,8 +41,20 @@ export type FlowHostSession = {
45
41
  creation?: unknown;
46
42
  waits?: unknown;
47
43
  lastOutput?: JsonValue;
44
+ /** The turn `status`, `lastOutput` and `error` describe, once it ended. */
45
+ lastTurnId?: string;
48
46
  error?: string;
49
47
  };
48
+ /** How a linked agent turn ended. */
49
+ export type LinkedTurnEnd = {
50
+ readonly turnId: string;
51
+ } & ({
52
+ readonly status: "completed";
53
+ readonly output: JsonValue;
54
+ } | {
55
+ readonly status: "failed" | "cancelled";
56
+ readonly error?: string;
57
+ });
50
58
  export type FlowWait = {
51
59
  readonly sessionId: string;
52
60
  readonly path: string;
@@ -67,121 +75,72 @@ export type CascadeCancelPlan = {
67
75
  readonly pendingActionIds: string[];
68
76
  readonly claimedActionIds: string[];
69
77
  };
78
+ /** Wakes a session after commit (`DurableExecution.wake` through the Tenant context). */
79
+ type Schedule = (sessionId: string, wake: Wake) => void | Promise<void>;
80
+ /** Effect documents as the flow host writes them. */
81
+ export type FlowEffect = EffectDoc & {
82
+ agentSessionId?: string;
83
+ outcome?: ActionOutcome;
84
+ error?: string;
85
+ };
86
+ /** Active agent turns + pending/claimed actions for one workflow turn. */
87
+ export declare function countActiveFlowWork(t: Tx, workflowSessionId: string, turnId: string): Promise<number>;
88
+ /** The `commands` document key of a session command's idempotency key (`tenant/commands.ts`). */
89
+ export declare function commandKey(sessionId: string, idempotencyKey: string): string;
90
+ /** The idempotency key of the message a flow `agent` effect sends its linked session. */
91
+ export declare function linkedMessageKey(request: HostEffect): string;
70
92
  /**
71
- * Resolve flow effects: agent (via session contract), tool nodes, fn, verify.
72
- * Runtime never writes agent session state — only issues commands.
93
+ * The linked turn an `agent` effect started: the turn its message opened, or undefined until
94
+ * that message commits.
95
+ */
96
+ export declare function linkedTurnOf(t: Tx, agentSessionId: string, request: HostEffect): Promise<string | undefined>;
97
+ /**
98
+ * How the linked turn an `agent` effect started ended, or undefined while it has not: before
99
+ * its message commits, the linked session's status and `lastOutput` describe an earlier turn.
100
+ * `agent` is the linked session, read in the caller's transaction.
101
+ */
102
+ export declare function linkedTurnEnd(t: Tx, effect: Pick<FlowEffect, "request" | "agentSessionId">, agent: FlowHostSession | undefined): Promise<LinkedTurnEnd | undefined>;
103
+ /**
104
+ * After a linked agent turn ends, settle the `agent` effect that started it and wake the
105
+ * workflow. `turnId` is the linked session's turn that ended; an effect bound to another turn
106
+ * (a later iteration whose message has not committed yet) is left alone.
73
107
  */
74
- export declare function resolveFlowEffect(input: {
75
- readonly request: HostEffect;
76
- readonly store: FlowHostStore;
77
- readonly session: FlowHostSession;
78
- readonly limits?: FlowLimits;
79
- readonly putLinkedSession: (args: {
80
- id: string;
81
- agentId: string;
82
- ownerUserId: string;
83
- vaultIds?: readonly string[];
84
- credentialSelections?: readonly unknown[];
85
- }) => FlowHostSession;
86
- readonly sendMessage: (args: {
87
- sessionId: string;
88
- content?: string;
89
- data?: JsonValue;
90
- idempotencyKey: string;
91
- requestId: string;
92
- }) => {
93
- turnId: string | null;
94
- };
95
- readonly readSession: (id: string) => FlowHostSession | undefined;
96
- readonly publish: (event: LiveEvent) => void;
97
- readonly notify: () => void;
98
- readonly schedule: (sessionId: string) => void;
99
- }): EffectResolution;
100
- /** Active agent turns + pending/claimed actions for one workflow turn. */
101
- export declare function countActiveFlowWork(store: FlowHostStore, workflowSessionId: string, turnId: string): number;
102
- /** After an agent turn settles, wake the owning workflow if linked. */
103
108
  export declare function wakeLinkedWorkflow(input: {
109
+ readonly t: Tx;
104
110
  readonly agentSessionId: string;
105
- readonly store: FlowHostStore;
111
+ readonly turnId: string | null;
106
112
  readonly output?: JsonValue;
107
113
  readonly failed?: boolean;
108
114
  readonly cancelled?: boolean;
109
115
  readonly error?: string;
110
- readonly schedule: (sessionId: string) => void;
111
- readonly publish: (event: LiveEvent) => void;
112
- }): void;
113
- /** On Runtime start: settle pending agent effects whose linked turns already finished. */
114
- export declare function reconcilePendingAgentEffects(input: {
115
- readonly store: FlowHostStore;
116
- readonly schedule: (sessionId: string) => void;
117
- readonly publish: (event: LiveEvent) => void;
118
- }): void;
119
- /** Re-offer orphaned fn/verify claims after a process restart (SD-P7 / WF-C9). */
120
- export declare function reofferOrphanedFnVerifyClaims(store: FlowHostStore): number;
116
+ readonly schedule: Schedule;
117
+ }): Promise<void>;
118
+ /** Pending workflow `agent` effects with a linked session, for the Tenant sweep. */
119
+ export declare function pendingAgentEffects(t: Tx): Promise<FlowEffect[]>;
121
120
  /**
122
- * On lease expiry: fn/verify → pending again; tool nodes → uncertain (WF-R35, WF-R38).
123
- * Returns whether any fn/verify was redelivered.
121
+ * Tenant sweep: settle one pending `agent` effect whose linked turn already finished (the
122
+ * linked settle normally does this in its own transaction). Runs in its own transaction and
123
+ * locks the linked agent (child) session before the workflow (parent), per the lock order in
124
+ * `store/types.ts`. Only the linked turn the effect started settles it (`linkedTurnEnd`): the
125
+ * linked session may still show an earlier iteration's settled turn while this effect's message
126
+ * is not committed. A linked session still `running` or `runnable` is left to the sweep's
127
+ * orphan re-wake; a paused one surfaces on the workflow when the workflow settles. Returns
128
+ * true when it changed something.
124
129
  */
125
- export declare function applyFlowLeaseExpiry(input: {
126
- readonly store: FlowHostStore;
127
- readonly action: Action;
128
- readonly now?: number;
129
- }): "reoffer" | "uncertain" | "skip";
130
- /** Emit loop.verified / loop.decided after fn/verify actions complete. */
131
- export declare function emitLoopActionEvents(input: {
132
- readonly store: FlowHostStore;
133
- readonly session: FlowHostSession;
134
- readonly action: Action;
135
- readonly value: unknown;
136
- readonly publish: (event: LiveEvent) => void;
137
- }): void;
138
- export declare function emitNodeStarted(input: {
139
- readonly store: FlowHostStore;
140
- readonly session: FlowHostSession;
141
- readonly publish: (event: LiveEvent) => void;
142
- }, payload: {
143
- path: string;
144
- kind: string;
145
- key: string;
146
- iterations?: string;
147
- }): LiveEvent;
148
- export declare function emitNodeCompleted(input: {
149
- readonly store: FlowHostStore;
150
- readonly session: FlowHostSession;
151
- readonly publish: (event: LiveEvent) => void;
152
- }, payload: {
153
- path: string;
154
- iterations?: string;
155
- }): LiveEvent;
156
- export declare function emitNodeFailed(input: {
157
- readonly store: FlowHostStore;
158
- readonly session: FlowHostSession;
159
- readonly publish: (event: LiveEvent) => void;
160
- }, payload: {
161
- path: string;
162
- iterations?: string;
163
- error: {
164
- code: string;
165
- message: string;
166
- path?: string;
167
- };
168
- }): LiveEvent;
169
- export declare function emitSwitchSelected(input: {
170
- readonly store: FlowHostStore;
171
- readonly session: FlowHostSession;
172
- readonly publish: (event: LiveEvent) => void;
173
- }, payload: {
174
- path: string;
175
- case: string;
176
- }): LiveEvent;
177
- export declare function emitMapItems(input: {
178
- readonly store: FlowHostStore;
179
- readonly session: FlowHostSession;
180
- readonly publish: (event: LiveEvent) => void;
181
- }, payload: {
182
- path: string;
183
- count: number;
184
- }): LiveEvent;
130
+ export declare function reconcilePendingAgentEffect(input: {
131
+ readonly t: Tx;
132
+ readonly effectId: string;
133
+ readonly schedule: Schedule;
134
+ }): Promise<boolean>;
135
+ /** Claimed `fn`/`verify` Actions, for the re-offer after a Tenant opens. */
136
+ export declare function claimedFnVerifyActions(t: Tx): Promise<Action[]>;
137
+ /**
138
+ * Re-offer one claimed `fn`/`verify` Action (SD-P7 / WF-C9): they are pure or repeat-safe, so
139
+ * a claim left by an executor of an earlier process is offered again at once rather than
140
+ * after its lease. The next claim bumps the generation, which fences a late result. Locks
141
+ * only the Action's session. Returns true when it re-offered.
142
+ */
143
+ export declare function reofferFnVerifyClaim(t: Tx, actionId: string): Promise<boolean>;
185
144
  /** Path depth for deepest-first cancel ordering. */
186
145
  export declare function pathDepth(path: string): number;
187
146
  /**
@@ -189,10 +148,10 @@ export declare function pathDepth(path: string): number;
189
148
  * then pending → cancelled and claimed → uncertain actions (SD-P11 / WF-R53).
190
149
  */
191
150
  export declare function planCancelCascade(input: {
192
- readonly store: FlowHostStore;
151
+ readonly t: Tx;
193
152
  readonly workflowSessionId: string;
194
153
  readonly turnId: string | null;
195
- }): CascadeCancelPlan;
154
+ }): Promise<CascadeCancelPlan>;
196
155
  /**
197
156
  * Cancel sibling work under a Parallel/Map parent when one branch fails (PAR-R6).
198
157
  * Agent turns listed in `agentSessionIds` are returned for the caller to cancel;
@@ -201,64 +160,66 @@ export declare function planCancelCascade(input: {
201
160
  * paths are included in the sibling path set.
202
161
  */
203
162
  export declare function cancelSiblingWork(input: {
204
- readonly store: FlowHostStore;
163
+ readonly t: Tx;
205
164
  readonly workflowSessionId: string;
206
165
  readonly turnId: string;
207
166
  /** Paths of siblings still running (not the failed branch). */
208
167
  readonly siblingPaths?: readonly string[];
209
168
  /** Effect ids the flow engine marked for fail-fast cancel. */
210
169
  readonly cancelEffectIds?: readonly string[];
211
- }): CancelSiblingResult;
170
+ }): Promise<CancelSiblingResult>;
212
171
  /**
213
172
  * Apply cancel fencing to workflow-session actions (pending→cancelled, claimed→uncertain).
214
173
  */
215
174
  export declare function fenceWorkflowActions(input: {
216
- readonly store: FlowHostStore;
175
+ readonly t: Tx;
217
176
  readonly workflowSessionId: string;
218
177
  readonly turnId: string | null;
219
- }): {
178
+ }): Promise<{
220
179
  cancelled: string[];
221
180
  uncertain: string[];
222
- };
181
+ }>;
223
182
  /**
224
183
  * Aggregate human waits across the workflow session and linked agent sessions (WF-R51).
225
184
  */
226
185
  export declare function aggregateWaits(input: {
227
- readonly store: FlowHostStore;
186
+ readonly t: Tx;
228
187
  readonly workflowSessionId: string;
229
- }): FlowWait[];
188
+ }): Promise<FlowWait[]>;
230
189
  /**
231
190
  * Look up which session owns an interaction id. Used for 409 foreign approvals (WF-R52).
232
191
  */
233
192
  export declare function findInteractionOwner(input: {
234
- readonly store: FlowHostStore;
193
+ readonly t: Tx;
235
194
  readonly workflowSessionId: string;
236
195
  readonly interactionId: string;
237
- }): {
196
+ }): Promise<{
238
197
  sessionId: string;
239
198
  path: string;
240
- } | undefined;
199
+ } | undefined>;
241
200
  /**
242
201
  * If approve/respond targets an interaction owned by a linked agent session,
243
202
  * return a 409 message naming that session (WF-R52 / LOOP-A4).
244
203
  */
245
204
  export declare function foreignInteractionConflict(input: {
246
- readonly store: FlowHostStore;
205
+ readonly t: Tx;
247
206
  readonly workflowSessionId: string;
248
207
  readonly interactionId: string;
249
- }): {
208
+ }): Promise<{
250
209
  status: 409;
251
210
  message: string;
252
211
  ownerSessionId: string;
253
- } | undefined;
212
+ } | undefined>;
254
213
  /**
255
214
  * When concurrency slots free, re-enter the workflow so queued effects can start
256
- * (status stays `queued` until `resolveFlowEffect` dispatches them).
215
+ * (status stays `queued` until the effect resolver dispatches them). Returns
216
+ * true when a wake was scheduled.
257
217
  */
258
218
  export declare function wakeForQueuedEffects(input: {
259
- readonly store: FlowHostStore;
219
+ readonly t: Tx;
260
220
  readonly workflowSessionId: string;
261
221
  readonly turnId: string;
262
222
  readonly limits: FlowLimits;
263
- readonly schedule: (sessionId: string) => void;
264
- }): boolean;
223
+ readonly schedule: Schedule;
224
+ }): Promise<boolean>;
225
+ export {};