@fluidgrids/workflows 2026.1029.1 → 2026.1030.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 (118) hide show
  1. package/README.md +112 -4
  2. package/dist/{activation-CESehfYi.d.cts → activation-DqUfpHzk.d.cts} +1 -1
  3. package/dist/{activation-BnVQMv9y.d.ts → activation-xpx1oWuo.d.ts} +1 -1
  4. package/dist/{chunk-MJ5TGYVG.js → chunk-2D3MYIIF.js} +969 -153
  5. package/dist/{chunk-2B37XAFQ.cjs → chunk-3U2NU7YC.cjs} +24 -11
  6. package/dist/{chunk-NEIUQASE.cjs → chunk-4QKB4ARC.cjs} +3 -3
  7. package/dist/{chunk-GBQ33SIZ.cjs → chunk-54FLQNUM.cjs} +12 -1
  8. package/dist/{chunk-2DDULZFM.js → chunk-5HIVIV53.js} +86 -75
  9. package/dist/chunk-5MFVJM76.js +1222 -0
  10. package/dist/{chunk-EWYADREB.cjs → chunk-672KMMBK.cjs} +2 -2
  11. package/dist/{chunk-KXJDRQ6G.js → chunk-6A2FGSUS.js} +22 -2
  12. package/dist/{chunk-OIX4O6UR.js → chunk-6OLN6BMB.js} +16 -3
  13. package/dist/{chunk-6FSHT5IL.js → chunk-7EZIANC7.js} +1 -1
  14. package/dist/chunk-A5SXCA62.cjs +93 -0
  15. package/dist/chunk-AC6ZEXVR.js +85 -0
  16. package/dist/{chunk-FWBRQWRX.js → chunk-AE5Q6ZAJ.js} +167 -10
  17. package/dist/{chunk-7ILGCUI6.js → chunk-C4F5KJTI.js} +142 -3
  18. package/dist/{chunk-WXXNCHUY.js → chunk-G5H32GIG.js} +1 -1
  19. package/dist/{chunk-OMY3CKUZ.cjs → chunk-GEQDGUGB.cjs} +1042 -226
  20. package/dist/{chunk-25BKWR2O.js → chunk-HCM7ZC7Q.js} +1 -1
  21. package/dist/{chunk-I47EENR4.cjs → chunk-HMZUGSMU.cjs} +673 -156
  22. package/dist/{chunk-NXFBVDOI.cjs → chunk-IQPXHQQQ.cjs} +8 -4
  23. package/dist/{chunk-RUQIMTN5.cjs → chunk-ISOIA7NV.cjs} +178 -15
  24. package/dist/chunk-JSC75O5C.cjs +167 -0
  25. package/dist/{chunk-BD7ZPG53.js → chunk-NWQ5WRLE.js} +10 -2
  26. package/dist/chunk-ODZ2IAR2.cjs +1247 -0
  27. package/dist/{chunk-FQSJI5NV.js → chunk-SR7TR5KX.js} +6 -2
  28. package/dist/{chunk-OKX3FYIM.cjs → chunk-TCTE7DX5.cjs} +3 -3
  29. package/dist/{chunk-3FIDHONL.cjs → chunk-TYF56RGB.cjs} +99 -80
  30. package/dist/{chunk-J3PYFGKA.cjs → chunk-VA4OFR72.cjs} +162 -4
  31. package/dist/chunk-VU5S5A7V.js +150 -0
  32. package/dist/{chunk-A36CCOWS.js → chunk-YEHR4NNE.js} +633 -128
  33. package/dist/{chunk-ELL2RBML.cjs → chunk-ZCGKGDCL.cjs} +23 -1
  34. package/dist/codegen/index.d.cts +2 -2
  35. package/dist/codegen/index.d.ts +2 -2
  36. package/dist/{collect-BTHjQaSp.d.ts → collect-6NIEufHd.d.ts} +20 -3
  37. package/dist/{collect-CSyOg5XC.d.cts → collect-CcTCKqx6.d.cts} +20 -3
  38. package/dist/{file-cgL9l9l8.d.cts → file-BxYpwjRQ.d.cts} +250 -15
  39. package/dist/{file-olQudcx5.d.ts → file-CFdPQJI9.d.ts} +250 -15
  40. package/dist/history/index.cjs +283 -106
  41. package/dist/history/index.d.cts +549 -10
  42. package/dist/history/index.d.ts +549 -10
  43. package/dist/history/index.js +5 -4
  44. package/dist/index.cjs +146 -53
  45. package/dist/index.d.cts +38 -14
  46. package/dist/index.d.ts +38 -14
  47. package/dist/index.js +6 -5
  48. package/dist/interceptors-CNcr2dlk.d.ts +159 -0
  49. package/dist/interceptors-CqkNZVfI.d.cts +159 -0
  50. package/dist/ir/index.cjs +339 -36
  51. package/dist/ir/index.d.cts +244 -8
  52. package/dist/ir/index.d.ts +244 -8
  53. package/dist/ir/index.js +306 -21
  54. package/dist/{lower-3S6PsqjJ.d.cts → lower-BtRfIW2A.d.cts} +23 -9
  55. package/dist/{lower-DmZpQ8hJ.d.ts → lower-CpsMFOFX.d.ts} +23 -9
  56. package/dist/{manifest-BJjrQt77.d.ts → manifest-D-I_twys.d.ts} +1 -1
  57. package/dist/{manifest-gRI2Q5Fj.d.cts → manifest-DahBQVM8.d.cts} +1 -1
  58. package/dist/node-evaluator-DGQDPSPI.cjs +24 -0
  59. package/dist/node-evaluator-LEEVD7H7.js +14 -0
  60. package/dist/payload-fields-BVRQn2yH.d.cts +122 -0
  61. package/dist/payload-fields-oOBWxDiG.d.ts +122 -0
  62. package/dist/quickjs/index.cjs +27 -27
  63. package/dist/quickjs/index.d.cts +6 -6
  64. package/dist/quickjs/index.d.ts +6 -6
  65. package/dist/quickjs/index.js +9 -9
  66. package/dist/roundtrip/index.cjs +72 -66
  67. package/dist/roundtrip/index.d.cts +25 -11
  68. package/dist/roundtrip/index.d.ts +25 -11
  69. package/dist/roundtrip/index.js +13 -11
  70. package/dist/runtime/index.cjs +19 -19
  71. package/dist/runtime/index.d.cts +139 -12
  72. package/dist/runtime/index.d.ts +139 -12
  73. package/dist/runtime/index.js +6 -6
  74. package/dist/testing/index.cjs +688 -121
  75. package/dist/testing/index.d.cts +174 -10
  76. package/dist/testing/index.d.ts +174 -10
  77. package/dist/testing/index.js +646 -82
  78. package/dist/{types-CnIOinoz.d.ts → types-Bv2i4cBX.d.cts} +126 -23
  79. package/dist/{types-CQKOhPTa.d.cts → types-DGx-b9eq.d.ts} +126 -23
  80. package/dist/{types-Bb2wRnJ5.d.cts → types-V7jEEUaL.d.cts} +1 -1
  81. package/dist/{types-Bb2wRnJ5.d.ts → types-V7jEEUaL.d.ts} +1 -1
  82. package/dist/{workflow-8uRU9rhL.d.ts → workflow-B18OeF7g.d.ts} +2 -2
  83. package/dist/{workflow-DWTPHFbt.d.ts → workflow-BGnv8SS6.d.ts} +261 -14
  84. package/dist/{workflow-CZOXUlQ5.d.cts → workflow-BJPFv3cp.d.cts} +2 -2
  85. package/dist/{workflow-O6e64ZcG.d.cts → workflow-DS32Gtws.d.cts} +261 -14
  86. package/fixtures/histories/activity-options-updated.history.json +159 -0
  87. package/fixtures/histories/activity-paused-unpaused.history.json +160 -0
  88. package/fixtures/histories/codec-opaque.history.json +229 -0
  89. package/fixtures/histories/dynamic-workflow.history.json +150 -0
  90. package/fixtures/histories/interceptor-headers.history.json +339 -0
  91. package/fixtures/histories/query-custom.history.json +213 -0
  92. package/fixtures/histories/query-default-handler.history.json +120 -0
  93. package/fixtures/histories/reset-forked-reapplied-signals.history.json +239 -0
  94. package/fixtures/histories/reset-reapplied-update-admitted.history.json +228 -0
  95. package/fixtures/histories/search-attributes-upserted.history.json +177 -0
  96. package/fixtures/histories/update-accepted-completed.history.json +45 -30
  97. package/fixtures/histories/update-default-handler.history.json +246 -0
  98. package/fixtures/histories/update-handler-awaits-activity.history.json +196 -0
  99. package/fixtures/histories/update-not-handled.history.json +138 -0
  100. package/fixtures/histories/update-rejected-no-event.history.json +190 -0
  101. package/fixtures/histories/update-with-start-admitted.history.json +150 -0
  102. package/fixtures/histories/user-activity-cancel.history.json +149 -0
  103. package/fixtures/histories/user-activity-retry.history.json +143 -0
  104. package/fixtures/histories/user-activity.history.json +149 -0
  105. package/package.json +1 -1
  106. package/schema/bridge-v2.schema.json +1062 -0
  107. package/schema/history-file.schema.json +255 -81
  108. package/schema/ir-v2.schema.json +246 -1
  109. package/schema/payload-fields.json +162 -0
  110. package/schema/run-event.schema.json +239 -80
  111. package/schema/workflow-command.schema.json +210 -84
  112. package/schema/workflow-task.schema.json +532 -167
  113. package/dist/chunk-6QPOJZT6.cjs +0 -1180
  114. package/dist/chunk-A2OHX3UQ.js +0 -1156
  115. package/dist/chunk-PWIUEWC3.js +0 -81
  116. package/dist/chunk-YHBVMOMK.cjs +0 -87
  117. package/dist/node-evaluator-SOADN23V.js +0 -14
  118. package/dist/node-evaluator-YGDEXK4U.cjs +0 -24
@@ -1,10 +1,367 @@
1
1
  'use strict';
2
2
 
3
+ var chunkJSC75O5C_cjs = require('./chunk-JSC75O5C.cjs');
3
4
  var chunkSAENRNBJ_cjs = require('./chunk-SAENRNBJ.cjs');
4
- var chunkRUQIMTN5_cjs = require('./chunk-RUQIMTN5.cjs');
5
- var chunk3FIDHONL_cjs = require('./chunk-3FIDHONL.cjs');
5
+ var chunkISOIA7NV_cjs = require('./chunk-ISOIA7NV.cjs');
6
+ var chunkA5SXCA62_cjs = require('./chunk-A5SXCA62.cjs');
7
+ var chunkTYF56RGB_cjs = require('./chunk-TYF56RGB.cjs');
6
8
  var _2020_js = require('ajv/dist/2020.js');
7
9
 
10
+ // src/history/bridge.ts
11
+ var BRIDGE_PROTOCOL_VERSION = 2;
12
+ var BRIDGE_PATH = "/runner-bridge";
13
+ var BRIDGE_PING_SECONDS = 20;
14
+ var BRIDGE_WORKER_HEARTBEAT_SECONDS = 30;
15
+ var BRIDGE_IDLE_TIMEOUT_MS = 65e3;
16
+ var BRIDGE_MAX_FRAME_BYTES = 10 * 1024 * 1024;
17
+ var BRIDGE_MAX_HISTORY_TAIL_BYTES = 4 * 1024 * 1024;
18
+ var BridgeCloseCode = {
19
+ Unauthorized: 4001,
20
+ Revoked: 4002,
21
+ Replaced: 4003,
22
+ /** Also a v2 hello on a RUNNER token, or a v1 hello on a WORKER token. */
23
+ ProtocolError: 4004,
24
+ IdleTimeout: 4008,
25
+ /** The service is shutting down, or `WORKER_BRIDGE_ENABLED` is off. */
26
+ ShuttingDown: 4009,
27
+ /** The workspace has no free worker seat (`fluidgrids.workers.count`). */
28
+ QuotaExceeded: 4010,
29
+ /** The token does not allow a task queue the hello names. */
30
+ QueueNotAllowed: 4011,
31
+ /** `fluidgrids.self-hosted-workers` (or a prerequisite) is off for the workspace. */
32
+ FeatureDisabled: 4012
33
+ };
34
+ var BRIDGE_REQUEST_METHODS = ["history.page", "activity.connection"];
35
+ var ID = { type: "string", minLength: 1, maxLength: 256 };
36
+ var COUNT = { type: "integer", minimum: 0 };
37
+ var POSITIVE = { type: "integer", minimum: 1 };
38
+ var STRINGS = { type: "array", items: { type: "string", minLength: 1 } };
39
+ function frame(type, required, properties) {
40
+ return {
41
+ type: "object",
42
+ required: ["type", ...required],
43
+ properties: { type: { const: type }, ...properties },
44
+ additionalProperties: false
45
+ };
46
+ }
47
+ var SLOT_USAGE = {
48
+ type: "object",
49
+ required: ["used", "total"],
50
+ properties: { used: COUNT, total: COUNT },
51
+ additionalProperties: false
52
+ };
53
+ var TASK_FAILURE = {
54
+ type: "object",
55
+ required: ["cause", "message"],
56
+ properties: {
57
+ cause: { enum: [...chunkTYF56RGB_cjs.TASK_FAILURE_CAUSES] },
58
+ message: { type: "string" },
59
+ stackTrace: { type: "string" },
60
+ seq: { type: "integer" },
61
+ errorType: { type: "string" }
62
+ },
63
+ additionalProperties: false
64
+ };
65
+ var BRIDGE_V2_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/bridge-v2.schema.json";
66
+ var BRIDGE_V2_SCHEMA = {
67
+ $schema: "https://json-schema.org/draft/2020-12/schema",
68
+ $id: BRIDGE_V2_SCHEMA_ID,
69
+ title: "FluidGrids worker bridge, protocol 2",
70
+ description: "Frames between a self-hosted worker and wspace-sandbox-svc over /runner-bridge (JSON text frames, Bearer fgr_ token of kind WORKER, ping every 20 s, 65 s idle timeout, 10 MiB frame cap). Close codes: 4001 Unauthorized, 4002 Revoked, 4003 Replaced, 4004 ProtocolError, 4008 IdleTimeout, 4009 ShuttingDown, 4010 QuotaExceeded, 4011 QueueNotAllowed, 4012 FeatureDisabled.",
71
+ oneOf: [{ $ref: "#/$defs/workerFrame" }, { $ref: "#/$defs/serviceFrame" }],
72
+ $defs: {
73
+ workflowTaskRef: {
74
+ type: "object",
75
+ required: ["kind", "runId", "taskId", "attempt", "expectedHistoryLength"],
76
+ properties: {
77
+ kind: { const: "workflow" },
78
+ runId: ID,
79
+ taskId: ID,
80
+ attempt: POSITIVE,
81
+ expectedHistoryLength: POSITIVE
82
+ },
83
+ additionalProperties: false
84
+ },
85
+ queryTaskRef: {
86
+ type: "object",
87
+ required: ["kind", "runId", "queryTaskId"],
88
+ properties: { kind: { const: "query" }, runId: ID, queryTaskId: ID },
89
+ additionalProperties: false
90
+ },
91
+ activityTaskRef: {
92
+ type: "object",
93
+ required: ["kind", "runId", "activityId", "attempt"],
94
+ properties: { kind: { const: "activity" }, runId: ID, activityId: ID, attempt: POSITIVE },
95
+ additionalProperties: false
96
+ },
97
+ taskRef: {
98
+ oneOf: [
99
+ { $ref: "#/$defs/workflowTaskRef" },
100
+ { $ref: "#/$defs/queryTaskRef" },
101
+ { $ref: "#/$defs/activityTaskRef" }
102
+ ]
103
+ },
104
+ historyPage: {
105
+ type: "object",
106
+ required: ["events", "from", "nextAfter", "hasMore"],
107
+ properties: {
108
+ events: { type: "array", items: { type: "object" } },
109
+ from: POSITIVE,
110
+ nextAfter: { oneOf: [{ type: "null" }, POSITIVE] },
111
+ hasMore: { type: "boolean" }
112
+ },
113
+ additionalProperties: false
114
+ },
115
+ queryRequests: {
116
+ type: "array",
117
+ items: {
118
+ type: "object",
119
+ required: ["queryId", "name"],
120
+ properties: { queryId: ID, name: ID, args: {} },
121
+ additionalProperties: false
122
+ }
123
+ },
124
+ queryResults: {
125
+ type: "array",
126
+ items: {
127
+ type: "object",
128
+ required: ["queryId"],
129
+ properties: {
130
+ queryId: ID,
131
+ value: {},
132
+ error: { type: "string" },
133
+ rejected: { type: "boolean" }
134
+ },
135
+ additionalProperties: false
136
+ }
137
+ },
138
+ hello: frame(
139
+ "hello",
140
+ [
141
+ "protocol",
142
+ "kind",
143
+ "sdk",
144
+ "identity",
145
+ "taskQueues",
146
+ "buildIds",
147
+ "workflows",
148
+ "activities",
149
+ "slots",
150
+ "host",
151
+ "encodings"
152
+ ],
153
+ {
154
+ protocol: { const: BRIDGE_PROTOCOL_VERSION },
155
+ kind: { const: "worker" },
156
+ sdk: {
157
+ type: "object",
158
+ required: ["language", "version"],
159
+ properties: { language: { enum: ["typescript", "python"] }, version: ID },
160
+ additionalProperties: false
161
+ },
162
+ identity: ID,
163
+ taskQueues: { ...STRINGS, minItems: 1 },
164
+ buildIds: STRINGS,
165
+ workflows: STRINGS,
166
+ activities: STRINGS,
167
+ slots: {
168
+ type: "object",
169
+ required: ["workflow", "activity", "localActivity"],
170
+ properties: { workflow: COUNT, activity: COUNT, localActivity: COUNT },
171
+ additionalProperties: false
172
+ },
173
+ host: {
174
+ type: "object",
175
+ properties: {
176
+ os: { type: "string" },
177
+ arch: { type: "string" },
178
+ hostname: { type: "string" },
179
+ runtime: { type: "string" }
180
+ },
181
+ additionalProperties: false
182
+ },
183
+ encodings: STRINGS
184
+ }
185
+ ),
186
+ ping: frame("ping", [], { t: { type: "number" } }),
187
+ pollers: frame("pollers", ["workflow", "activity"], { workflow: COUNT, activity: COUNT }),
188
+ taskResult: {
189
+ oneOf: [
190
+ frame("taskResult", ["taskRef", "commands", "logs", "cachedUpTo"], {
191
+ taskRef: { $ref: "#/$defs/workflowTaskRef" },
192
+ commands: { type: "array", items: { type: "object" } },
193
+ logs: { type: "array", items: { type: "object" } },
194
+ cachedUpTo: COUNT,
195
+ queryResults: { $ref: "#/$defs/queryResults" },
196
+ unfinishedHandlers: { type: "array", items: { type: "object" } }
197
+ }),
198
+ frame("taskResult", ["taskRef", "result"], {
199
+ taskRef: { $ref: "#/$defs/activityTaskRef" },
200
+ result: {}
201
+ }),
202
+ frame("taskResult", ["taskRef", "queryResults"], {
203
+ taskRef: { $ref: "#/$defs/queryTaskRef" },
204
+ queryResults: { $ref: "#/$defs/queryResults" }
205
+ })
206
+ ]
207
+ },
208
+ taskFailed: {
209
+ oneOf: [
210
+ frame("taskFailed", ["taskRef", "failure"], {
211
+ taskRef: {
212
+ oneOf: [{ $ref: "#/$defs/workflowTaskRef" }, { $ref: "#/$defs/queryTaskRef" }]
213
+ },
214
+ failure: TASK_FAILURE
215
+ }),
216
+ frame("taskFailed", ["taskRef", "failure"], {
217
+ taskRef: { $ref: "#/$defs/activityTaskRef" },
218
+ failure: {
219
+ type: "object",
220
+ required: ["errorType", "message"],
221
+ description: "An activity failure (run-event failure shape)."
222
+ }
223
+ })
224
+ ]
225
+ },
226
+ heartbeat: frame("heartbeat", ["reqId", "taskRef"], {
227
+ reqId: ID,
228
+ taskRef: { $ref: "#/$defs/activityTaskRef" },
229
+ details: {}
230
+ }),
231
+ workerHeartbeat: frame("workerHeartbeat", ["slots", "pollers", "tasksInFlight", "cachedRuns"], {
232
+ slots: {
233
+ type: "object",
234
+ required: ["workflow", "activity", "localActivity"],
235
+ properties: { workflow: SLOT_USAGE, activity: SLOT_USAGE, localActivity: SLOT_USAGE },
236
+ additionalProperties: false
237
+ },
238
+ pollers: {
239
+ type: "object",
240
+ required: ["workflow", "activity"],
241
+ properties: { workflow: COUNT, activity: COUNT },
242
+ additionalProperties: false
243
+ },
244
+ tasksInFlight: COUNT,
245
+ cachedRuns: COUNT
246
+ }),
247
+ req: frame("req", ["id", "method", "params"], {
248
+ id: ID,
249
+ method: { enum: [...BRIDGE_REQUEST_METHODS] },
250
+ params: { type: "object" }
251
+ }),
252
+ bye: frame("bye", ["reason"], { reason: { type: "string" } }),
253
+ welcome: frame(
254
+ "welcome",
255
+ [
256
+ "protocol",
257
+ "sessionId",
258
+ "workerId",
259
+ "workspaceId",
260
+ "heartbeatSeconds",
261
+ "workerHeartbeatSeconds",
262
+ "maxFrameBytes"
263
+ ],
264
+ {
265
+ protocol: { const: BRIDGE_PROTOCOL_VERSION },
266
+ sessionId: ID,
267
+ workerId: { type: "string", pattern: "^worker:.+$" },
268
+ workspaceId: ID,
269
+ heartbeatSeconds: POSITIVE,
270
+ workerHeartbeatSeconds: POSITIVE,
271
+ maxFrameBytes: POSITIVE
272
+ }
273
+ ),
274
+ task: {
275
+ oneOf: [
276
+ frame("task", ["taskRef", "lease", "request", "history"], {
277
+ taskRef: { $ref: "#/$defs/workflowTaskRef" },
278
+ lease: { type: "object" },
279
+ request: {
280
+ type: "object",
281
+ required: ["workflowFn", "info", "nowMs"],
282
+ properties: {
283
+ workflowFn: ID,
284
+ info: { type: "object" },
285
+ nowMs: { type: "number" },
286
+ updates: { type: "array", items: { type: "object" } },
287
+ queries: { $ref: "#/$defs/queryRequests" }
288
+ },
289
+ additionalProperties: false
290
+ },
291
+ history: { $ref: "#/$defs/historyPage" }
292
+ }),
293
+ frame("task", ["taskRef", "request", "history"], {
294
+ taskRef: { $ref: "#/$defs/queryTaskRef" },
295
+ request: {
296
+ type: "object",
297
+ required: ["workflowFn", "info", "queries"],
298
+ properties: {
299
+ workflowFn: ID,
300
+ info: { type: "object" },
301
+ queries: { $ref: "#/$defs/queryRequests" }
302
+ },
303
+ additionalProperties: false
304
+ },
305
+ history: { $ref: "#/$defs/historyPage" }
306
+ }),
307
+ frame("task", ["taskRef", "lease"], {
308
+ taskRef: { $ref: "#/$defs/activityTaskRef" },
309
+ lease: { type: "object" }
310
+ })
311
+ ]
312
+ },
313
+ heartbeatAck: frame("heartbeatAck", ["reqId", "cancelRequested", "paused"], {
314
+ reqId: ID,
315
+ cancelRequested: { type: "boolean" },
316
+ paused: { type: "boolean" },
317
+ pauseReason: { type: "string" }
318
+ }),
319
+ cancel: frame("cancel", ["taskRef", "reason"], {
320
+ taskRef: { $ref: "#/$defs/taskRef" },
321
+ reason: { type: "string" }
322
+ }),
323
+ res: {
324
+ ...frame("res", ["id", "ok"], {
325
+ id: ID,
326
+ ok: { type: "boolean" },
327
+ result: {},
328
+ error: {
329
+ type: "object",
330
+ required: ["code", "message"],
331
+ properties: { code: { type: "string" }, message: { type: "string" } },
332
+ additionalProperties: false
333
+ }
334
+ }),
335
+ if: { properties: { ok: { const: false } }, required: ["ok"] },
336
+ then: { required: ["error"] }
337
+ },
338
+ pong: frame("pong", [], { t: { type: "number" } }),
339
+ workerFrame: {
340
+ oneOf: [
341
+ { $ref: "#/$defs/hello" },
342
+ { $ref: "#/$defs/ping" },
343
+ { $ref: "#/$defs/pollers" },
344
+ { $ref: "#/$defs/taskResult" },
345
+ { $ref: "#/$defs/taskFailed" },
346
+ { $ref: "#/$defs/heartbeat" },
347
+ { $ref: "#/$defs/workerHeartbeat" },
348
+ { $ref: "#/$defs/req" },
349
+ { $ref: "#/$defs/bye" }
350
+ ]
351
+ },
352
+ serviceFrame: {
353
+ oneOf: [
354
+ { $ref: "#/$defs/welcome" },
355
+ { $ref: "#/$defs/task" },
356
+ { $ref: "#/$defs/heartbeatAck" },
357
+ { $ref: "#/$defs/cancel" },
358
+ { $ref: "#/$defs/res" },
359
+ { $ref: "#/$defs/pong" }
360
+ ]
361
+ }
362
+ }
363
+ };
364
+
8
365
  // src/history/schema.ts
9
366
  var BASE = "https://docs.fluidgrids.ai/schemas";
10
367
  var RUN_EVENT_SCHEMA_ID = `${BASE}/run-event.schema.json`;
@@ -12,9 +369,27 @@ var WORKFLOW_COMMAND_SCHEMA_ID = `${BASE}/workflow-command.schema.json`;
12
369
  var WORKFLOW_TASK_SCHEMA_ID = `${BASE}/workflow-task.schema.json`;
13
370
  var HISTORY_FILE_SCHEMA_ID = `${BASE}/history-file.schema.json`;
14
371
  var HISTORY_FILE_FORMAT = "fluidgrids.history";
15
- var ID = { type: "string", minLength: 1, maxLength: 256 };
372
+ var ID2 = { type: "string", minLength: 1, maxLength: 256 };
16
373
  var NON_NEGATIVE_MS = { type: "integer", minimum: 0 };
17
- var STRING_MAP = { type: "object", additionalProperties: { type: "string" } };
374
+ var STRING_MAP = {
375
+ type: "object",
376
+ additionalProperties: { type: "string" },
377
+ description: "Interceptor headers (11 \xA72.10): string values; a user activity carries at most 16 KiB of JSON (checked by validateCommands)."
378
+ };
379
+ var FAIRNESS_KEY = {
380
+ type: "string",
381
+ minLength: 1,
382
+ maxLength: chunkTYF56RGB_cjs.FAIRNESS_KEY_MAX_LENGTH,
383
+ description: "Phase C: the fairness key of the task (11 \xA72.11); default the workspace id."
384
+ };
385
+ var FAIRNESS_WEIGHT = {
386
+ type: "number",
387
+ minimum: chunkTYF56RGB_cjs.FAIRNESS_WEIGHT_MIN,
388
+ maximum: chunkTYF56RGB_cjs.FAIRNESS_WEIGHT_MAX,
389
+ description: "Phase C: the weight of the fairness key, 0.1 to 10 (default 1)."
390
+ };
391
+ var ACTIVITY_NAME = { type: "string", pattern: chunkTYF56RGB_cjs.ACTIVITY_NAME_PATTERN };
392
+ var TASK_QUEUE_NAME = { type: "string", pattern: chunkTYF56RGB_cjs.TASK_QUEUE_NAME_PATTERN };
18
393
  var SHARED_DEFS = {
19
394
  json: {
20
395
  description: "Any JSON value."
@@ -23,7 +398,7 @@ var SHARED_DEFS = {
23
398
  type: "object",
24
399
  required: ["errorType", "message"],
25
400
  properties: {
26
- errorType: { enum: [...chunk3FIDHONL_cjs.ERROR_TYPES] },
401
+ errorType: { enum: [...chunkTYF56RGB_cjs.ERROR_TYPES] },
27
402
  message: { type: "string" },
28
403
  type: { type: "string" },
29
404
  details: {},
@@ -46,7 +421,7 @@ var SHARED_DEFS = {
46
421
  retryDelay: NON_NEGATIVE_MS,
47
422
  backoffMultiplier: { type: "number", minimum: 1 },
48
423
  maxDelay: NON_NEGATIVE_MS,
49
- retryOnErrorTypes: { type: "array", items: { enum: [...chunk3FIDHONL_cjs.ERROR_TYPES] } },
424
+ retryOnErrorTypes: { type: "array", items: { enum: [...chunkTYF56RGB_cjs.ERROR_TYPES] } },
50
425
  nonRetryableErrorTypes: { type: "array", items: { type: "string" } }
51
426
  },
52
427
  additionalProperties: false
@@ -56,7 +431,7 @@ var SHARED_DEFS = {
56
431
  {
57
432
  type: "object",
58
433
  required: ["runId"],
59
- properties: { runId: ID },
434
+ properties: { runId: ID2 },
60
435
  additionalProperties: false
61
436
  },
62
437
  {
@@ -68,14 +443,14 @@ var SHARED_DEFS = {
68
443
  {
69
444
  type: "object",
70
445
  required: ["childId"],
71
- properties: { childId: ID },
446
+ properties: { childId: ID2 },
72
447
  additionalProperties: false
73
448
  },
74
449
  {
75
450
  type: "object",
76
451
  required: ["workflowKey", "workflowId"],
77
452
  description: "The open run of a workflow id, following its continue-as-new chain; firstRunId pins the chain (R2).",
78
- properties: { workflowKey: ID, workflowId: ID, firstRunId: ID },
453
+ properties: { workflowKey: ID2, workflowId: ID2, firstRunId: ID2 },
79
454
  additionalProperties: false
80
455
  }
81
456
  ]
@@ -89,7 +464,7 @@ var SHARED_DEFS = {
89
464
  initialDelayMs: NON_NEGATIVE_MS,
90
465
  backoffMultiplier: { type: "number", minimum: 1 },
91
466
  maxDelayMs: NON_NEGATIVE_MS,
92
- retryOnErrorTypes: { type: "array", items: { enum: [...chunk3FIDHONL_cjs.ERROR_TYPES] } },
467
+ retryOnErrorTypes: { type: "array", items: { enum: [...chunkTYF56RGB_cjs.ERROR_TYPES] } },
93
468
  nonRetryableErrorTypes: { type: "array", items: { type: "string" } }
94
469
  },
95
470
  additionalProperties: false
@@ -108,10 +483,10 @@ var SHARED_DEFS = {
108
483
  type: "object",
109
484
  required: ["parentClosePolicy"],
110
485
  properties: {
111
- parentClosePolicy: { enum: [...chunk3FIDHONL_cjs.PARENT_CLOSE_POLICIES] },
112
- cancellationType: { enum: [...chunk3FIDHONL_cjs.CHILD_CANCELLATION_TYPES] },
113
- taskQueue: ID,
114
- workflowId: ID,
486
+ parentClosePolicy: { enum: [...chunkTYF56RGB_cjs.PARENT_CLOSE_POLICIES] },
487
+ cancellationType: { enum: [...chunkTYF56RGB_cjs.CHILD_CANCELLATION_TYPES] },
488
+ taskQueue: ID2,
489
+ workflowId: ID2,
115
490
  priority: { type: "integer", minimum: 1, maximum: 5 },
116
491
  summary: { type: "string", maxLength: 200 },
117
492
  details: { type: "string" },
@@ -121,9 +496,11 @@ var SHARED_DEFS = {
121
496
  workflowTaskTimeout: NON_NEGATIVE_MS,
122
497
  startDelay: NON_NEGATIVE_MS,
123
498
  retry: { $ref: "#/$defs/runRetryPolicy" },
124
- versioningBehavior: { enum: [...chunk3FIDHONL_cjs.VERSIONING_BEHAVIORS] },
125
- idReusePolicy: { enum: [...chunk3FIDHONL_cjs.WORKFLOW_ID_REUSE_POLICIES] },
126
- idConflictPolicy: { enum: [...chunk3FIDHONL_cjs.WORKFLOW_ID_CONFLICT_POLICIES] }
499
+ versioningBehavior: { enum: [...chunkTYF56RGB_cjs.VERSIONING_BEHAVIORS] },
500
+ idReusePolicy: { enum: [...chunkTYF56RGB_cjs.WORKFLOW_ID_REUSE_POLICIES] },
501
+ idConflictPolicy: { enum: [...chunkTYF56RGB_cjs.WORKFLOW_ID_CONFLICT_POLICIES] },
502
+ fairnessKey: FAIRNESS_KEY,
503
+ fairnessWeight: FAIRNESS_WEIGHT
127
504
  }
128
505
  },
129
506
  legacyCanRetryPolicy: {
@@ -144,13 +521,13 @@ var SHARED_DEFS = {
144
521
  type: "object",
145
522
  description: "Options of a CONTINUE_AS_NEW command (C-SCHEMA, frozen in R2). retry is the R2 run-retry policy of the new run, or the R1 activity shape (retryDelay, maxRetries, maxDelay) that R1 bundles wrote and R2 bundles still write for that shape: it never had a meaning, and the service ignores it instead of reading it as a run-retry policy.",
146
523
  properties: {
147
- taskQueue: ID,
524
+ taskQueue: ID2,
148
525
  retry: {
149
526
  oneOf: [{ $ref: "#/$defs/runRetryPolicy" }, { $ref: "#/$defs/legacyCanRetryPolicy" }]
150
527
  },
151
528
  workflowTaskTimeout: NON_NEGATIVE_MS,
152
529
  context: { type: "object" },
153
- versioningBehavior: { enum: [...chunk3FIDHONL_cjs.VERSIONING_BEHAVIORS] }
530
+ versioningBehavior: { enum: [...chunkTYF56RGB_cjs.VERSIONING_BEHAVIORS] }
154
531
  },
155
532
  additionalProperties: false
156
533
  },
@@ -164,41 +541,68 @@ function command(type, required, properties) {
164
541
  additionalProperties: false
165
542
  };
166
543
  }
544
+ var ACTIVITY_COMMON = {
545
+ activityId: ID2,
546
+ args: {},
547
+ retry: { $ref: "#/$defs/retryPolicy" },
548
+ startToCloseTimeout: NON_NEGATIVE_MS,
549
+ scheduleToCloseTimeout: NON_NEGATIVE_MS,
550
+ scheduleToStartTimeout: NON_NEGATIVE_MS,
551
+ heartbeatTimeout: NON_NEGATIVE_MS,
552
+ cancellationType: { enum: [...chunkTYF56RGB_cjs.ACTIVITY_CANCELLATION_TYPES] },
553
+ priority: { type: "integer", minimum: 1, maximum: 5 },
554
+ summary: { type: "string", maxLength: 200 },
555
+ fairnessKey: FAIRNESS_KEY,
556
+ fairnessWeight: FAIRNESS_WEIGHT
557
+ };
558
+ var NODE_ACTIVITY = {
559
+ kind: { const: "node" },
560
+ nodeType: ID2,
561
+ nodeVersion: { type: "string" },
562
+ operation: ID2,
563
+ connection: ID2,
564
+ runOn: { type: "string" }
565
+ };
566
+ var USER_ACTIVITY = {
567
+ kind: { const: "user" },
568
+ activityName: ACTIVITY_NAME,
569
+ taskQueue: TASK_QUEUE_NAME,
570
+ connections: {
571
+ type: "array",
572
+ maxItems: chunkTYF56RGB_cjs.MAX_ACTIVITY_CONNECTIONS,
573
+ uniqueItems: true,
574
+ items: ID2,
575
+ description: "Connection names the worker may resolve for each started attempt (H2: declared by the definition and on the worker token allow-list)."
576
+ }
577
+ };
578
+ var NODE_ACTIVITY_REQUIRED = ["activityId", "kind", "nodeType", "operation", "args", "retry"];
579
+ var USER_ACTIVITY_REQUIRED = ["activityId", "kind", "activityName", "taskQueue", "args", "retry"];
167
580
  var COMMAND_DEFS = {
168
- SCHEDULE_ACTIVITY: command(
169
- "SCHEDULE_ACTIVITY",
170
- ["activityId", "kind", "nodeType", "operation", "args", "retry"],
171
- {
172
- activityId: ID,
173
- kind: { const: "node" },
174
- nodeType: ID,
175
- nodeVersion: { type: "string" },
176
- operation: ID,
177
- args: {},
178
- connection: ID,
179
- retry: { $ref: "#/$defs/retryPolicy" },
180
- startToCloseTimeout: NON_NEGATIVE_MS,
181
- scheduleToCloseTimeout: NON_NEGATIVE_MS,
182
- scheduleToStartTimeout: NON_NEGATIVE_MS,
183
- heartbeatTimeout: NON_NEGATIVE_MS,
184
- cancellationType: { enum: [...chunk3FIDHONL_cjs.ACTIVITY_CANCELLATION_TYPES] },
185
- priority: { type: "integer", minimum: 1, maximum: 5 },
186
- summary: { type: "string", maxLength: 200 },
187
- runOn: { type: "string" }
188
- }
189
- ),
190
- REQUEST_CANCEL_ACTIVITY: command("REQUEST_CANCEL_ACTIVITY", ["activityId"], { activityId: ID }),
581
+ SCHEDULE_ACTIVITY: {
582
+ description: "A oneOf on kind (C-CMD-C): node runs a canvas node operation; user (Phase C) runs a user activity on a self-hosted task queue.",
583
+ oneOf: [
584
+ command("SCHEDULE_ACTIVITY", NODE_ACTIVITY_REQUIRED.slice(), {
585
+ ...ACTIVITY_COMMON,
586
+ ...NODE_ACTIVITY
587
+ }),
588
+ command("SCHEDULE_ACTIVITY", USER_ACTIVITY_REQUIRED.slice(), {
589
+ ...ACTIVITY_COMMON,
590
+ ...USER_ACTIVITY
591
+ })
592
+ ]
593
+ },
594
+ REQUEST_CANCEL_ACTIVITY: command("REQUEST_CANCEL_ACTIVITY", ["activityId"], { activityId: ID2 }),
191
595
  START_TIMER: command("START_TIMER", ["timerId", "durationMs"], {
192
- timerId: ID,
596
+ timerId: ID2,
193
597
  durationMs: { type: "integer", minimum: 1 },
194
598
  summary: { type: "string", maxLength: 200 }
195
599
  }),
196
- CANCEL_TIMER: command("CANCEL_TIMER", ["timerId"], { timerId: ID }),
600
+ CANCEL_TIMER: command("CANCEL_TIMER", ["timerId"], { timerId: ID2 }),
197
601
  START_CHILD_RUN: {
198
602
  ...command("START_CHILD_RUN", ["childId", "input", "options"], {
199
- childId: ID,
200
- workflowKey: ID,
201
- workflowFn: ID,
603
+ childId: ID2,
604
+ workflowKey: ID2,
605
+ workflowFn: ID2,
202
606
  version: { type: "string", minLength: 1 },
203
607
  input: {},
204
608
  options: { $ref: "#/$defs/childOptions" }
@@ -206,16 +610,16 @@ var COMMAND_DEFS = {
206
610
  oneOf: [{ required: ["workflowKey"] }, { required: ["workflowFn"] }]
207
611
  },
208
612
  SIGNAL_RUN: command("SIGNAL_RUN", ["externalId", "target", "name", "payload"], {
209
- externalId: ID,
613
+ externalId: ID2,
210
614
  target: { $ref: "#/$defs/runTarget" },
211
- name: ID,
615
+ name: ID2,
212
616
  payload: {}
213
617
  }),
214
618
  RECORD_SIDE_EFFECT: command("RECORD_SIDE_EFFECT", ["sideEffectId", "value"], {
215
- sideEffectId: ID,
619
+ sideEffectId: ID2,
216
620
  value: {}
217
621
  }),
218
- RECORD_MARKER: command("RECORD_MARKER", ["markerId", "data"], { markerId: ID, data: {} }),
622
+ RECORD_MARKER: command("RECORD_MARKER", ["markerId", "data"], { markerId: ID2, data: {} }),
219
623
  COMPLETE_WORKFLOW: command("COMPLETE_WORKFLOW", ["output"], { output: {} }),
220
624
  FAIL_WORKFLOW: command("FAIL_WORKFLOW", ["failure"], {
221
625
  failure: { $ref: "#/$defs/failure" }
@@ -224,12 +628,12 @@ var COMMAND_DEFS = {
224
628
  UPSERT_CONTEXT: command("UPSERT_CONTEXT", ["entries"], { entries: { type: "object" } }),
225
629
  RECORD_LOCAL_ACTIVITY: {
226
630
  ...command("RECORD_LOCAL_ACTIVITY", ["localActivityId", "attempts"], {
227
- localActivityId: ID,
631
+ localActivityId: ID2,
228
632
  result: {},
229
633
  failure: { $ref: "#/$defs/failure" },
230
634
  attempts: { type: "integer", minimum: 1 },
231
- nodeType: ID,
232
- operation: ID,
635
+ nodeType: ID2,
636
+ operation: ID2,
233
637
  summary: { type: "string", maxLength: 200 }
234
638
  }),
235
639
  oneOf: [{ required: ["result"] }, { required: ["failure"] }]
@@ -239,19 +643,19 @@ var COMMAND_DEFS = {
239
643
  options: { $ref: "#/$defs/canOptions" }
240
644
  }),
241
645
  REQUEST_CANCEL_EXTERNAL_RUN: command("REQUEST_CANCEL_EXTERNAL_RUN", ["externalId", "target"], {
242
- externalId: ID,
646
+ externalId: ID2,
243
647
  target: { $ref: "#/$defs/runTarget" }
244
648
  }),
245
649
  UPSERT_SEARCH_ATTRIBUTES: command("UPSERT_SEARCH_ATTRIBUTES", ["attributes"], {
246
650
  attributes: { type: "object" }
247
651
  }),
248
- ACCEPT_UPDATE: command("ACCEPT_UPDATE", ["updateId"], { updateId: ID }),
652
+ ACCEPT_UPDATE: command("ACCEPT_UPDATE", ["updateId"], { updateId: ID2 }),
249
653
  REJECT_UPDATE: command("REJECT_UPDATE", ["updateId", "failure"], {
250
- updateId: ID,
654
+ updateId: ID2,
251
655
  failure: { $ref: "#/$defs/failure" }
252
656
  }),
253
657
  COMPLETE_UPDATE: command("COMPLETE_UPDATE", ["updateId"], {
254
- updateId: ID,
658
+ updateId: ID2,
255
659
  result: {},
256
660
  failure: { $ref: "#/$defs/failure" }
257
661
  })
@@ -262,7 +666,7 @@ function payload(required, properties) {
262
666
  var FAILURE_REF = { $ref: "#/$defs/failure" };
263
667
  var EVENT_PAYLOADS = {
264
668
  WORKFLOW_STARTED: payload(["workflowFn", "input"], {
265
- workflowFn: ID,
669
+ workflowFn: ID2,
266
670
  input: {},
267
671
  workflowKey: { type: "string" },
268
672
  version: {},
@@ -272,7 +676,7 @@ var EVENT_PAYLOADS = {
272
676
  rootRunId: { type: ["string", "null"] },
273
677
  firstRunId: { type: ["string", "null"] },
274
678
  continuedFromRunId: { type: ["string", "null"] },
275
- parentClosePolicy: { enum: [...chunk3FIDHONL_cjs.PARENT_CLOSE_POLICIES] },
679
+ parentClosePolicy: { enum: [...chunkTYF56RGB_cjs.PARENT_CLOSE_POLICIES] },
276
680
  startDelay: NON_NEGATIVE_MS,
277
681
  lastCompletionResult: {},
278
682
  lastFailure: { oneOf: [{ type: "null" }, FAILURE_REF] },
@@ -282,9 +686,9 @@ var EVENT_PAYLOADS = {
282
686
  executionTimeout: NON_NEGATIVE_MS,
283
687
  runTimeout: NON_NEGATIVE_MS,
284
688
  workflowTaskTimeout: NON_NEGATIVE_MS,
285
- versioningBehavior: { enum: [...chunk3FIDHONL_cjs.VERSIONING_BEHAVIORS] },
689
+ versioningBehavior: { enum: [...chunkTYF56RGB_cjs.VERSIONING_BEHAVIORS] },
286
690
  /** Seed of `ctx.random()`/`ctx.uuid()`; the service writes the run id. Absent: `info.runId`. */
287
- randomnessSeed: ID,
691
+ randomnessSeed: ID2,
288
692
  startDelayMs: {
289
693
  ...NON_NEGATIVE_MS,
290
694
  description: "R2: the start delay of a delayed run (11 \xA72.23); the first task waits for it."
@@ -301,14 +705,21 @@ var EVENT_PAYLOADS = {
301
705
  workflowId: { type: "string", description: "R2: the same value as businessId." },
302
706
  timeouts: { $ref: "#/$defs/timeouts" },
303
707
  retry: { $ref: "#/$defs/runRetryPolicy" },
304
- priority: { type: "integer", minimum: 1, maximum: 5 }
708
+ priority: { type: "integer", minimum: 1, maximum: 5 },
709
+ headers: { $ref: "#/$defs/headers" },
710
+ searchAttributes: {
711
+ type: "object",
712
+ description: "Phase C: the search attributes the start set (11 \xA72.8)."
713
+ },
714
+ fairnessKey: FAIRNESS_KEY,
715
+ fairnessWeight: FAIRNESS_WEIGHT
305
716
  }),
306
717
  WORKFLOW_TASK_SCHEDULED: payload(["taskId"], {
307
- taskId: ID,
718
+ taskId: ID2,
308
719
  attempt: { type: "integer", minimum: 1 }
309
720
  }),
310
721
  WORKFLOW_TASK_STARTED: payload(["taskId", "attempt"], {
311
- taskId: ID,
722
+ taskId: ID2,
312
723
  attempt: { type: "integer", minimum: 1 },
313
724
  workerId: { type: "string" },
314
725
  buildId: { type: "string" },
@@ -326,115 +737,138 @@ var EVENT_PAYLOADS = {
326
737
  }
327
738
  }),
328
739
  WORKFLOW_TASK_COMPLETED: payload(["taskId"], {
329
- taskId: ID,
740
+ taskId: ID2,
330
741
  buildId: { type: "string" },
331
742
  workerId: { type: "string" }
332
743
  }),
333
744
  WORKFLOW_TASK_FAILED: payload(["taskId", "attempt", "cause"], {
334
- taskId: ID,
745
+ taskId: ID2,
335
746
  attempt: { type: "integer", minimum: 1 },
336
- cause: { enum: [...chunk3FIDHONL_cjs.TASK_FAILURE_CAUSES] },
747
+ cause: { enum: [...chunkTYF56RGB_cjs.TASK_FAILURE_CAUSES] },
337
748
  message: { type: "string" },
338
749
  stackTrace: { type: "string" },
339
750
  buildId: { type: "string" }
340
751
  }),
341
752
  WORKFLOW_TASK_TIMED_OUT: payload(["taskId", "attempt"], {
342
- taskId: ID,
753
+ taskId: ID2,
343
754
  attempt: { type: "integer", minimum: 1 }
344
755
  }),
345
- ACTIVITY_SCHEDULED: payload(["activityId", "kind", "nodeType", "operation", "args", "retry"], {
346
- ...COMMAND_DEFS.SCHEDULE_ACTIVITY.properties,
347
- type: void 0
348
- }),
756
+ ACTIVITY_SCHEDULED: {
757
+ description: "The SCHEDULE_ACTIVITY command as the service accepted it: kind node, or kind user (Phase C) with activityName, taskQueue, fairness, connections and headers.",
758
+ oneOf: [
759
+ payload(NODE_ACTIVITY_REQUIRED.slice(), {
760
+ ...ACTIVITY_COMMON,
761
+ ...NODE_ACTIVITY,
762
+ headers: { $ref: "#/$defs/headers" }
763
+ }),
764
+ payload(USER_ACTIVITY_REQUIRED.slice(), {
765
+ ...ACTIVITY_COMMON,
766
+ ...USER_ACTIVITY,
767
+ headers: { $ref: "#/$defs/headers" }
768
+ })
769
+ ]
770
+ },
349
771
  ACTIVITY_STARTED: payload(["activityId", "attempt"], {
350
- activityId: ID,
772
+ activityId: ID2,
351
773
  attempt: { type: "integer", minimum: 1 },
352
774
  workerId: { type: "string" }
353
775
  }),
354
- ACTIVITY_HEARTBEAT: payload(["activityId"], { activityId: ID, details: {} }),
776
+ ACTIVITY_HEARTBEAT: payload(["activityId"], { activityId: ID2, details: {} }),
355
777
  ACTIVITY_COMPLETED: payload(["activityId", "attempt"], {
356
- activityId: ID,
778
+ activityId: ID2,
357
779
  attempt: { type: "integer", minimum: 1 },
358
780
  result: {}
359
781
  }),
360
782
  ACTIVITY_FAILED: payload(["activityId", "attempt", "failure"], {
361
- activityId: ID,
783
+ activityId: ID2,
362
784
  attempt: { type: "integer", minimum: 1 },
363
785
  failure: FAILURE_REF
364
786
  }),
365
787
  ACTIVITY_TIMED_OUT: payload(["activityId", "attempt", "timeoutType"], {
366
- activityId: ID,
788
+ activityId: ID2,
367
789
  attempt: { type: "integer", minimum: 1 },
368
790
  timeoutType: {
369
791
  enum: ["START_TO_CLOSE", "SCHEDULE_TO_START", "SCHEDULE_TO_CLOSE", "HEARTBEAT"]
370
792
  },
371
793
  failure: FAILURE_REF
372
794
  }),
373
- ACTIVITY_CANCEL_REQUESTED: payload(["activityId"], { activityId: ID }),
374
- ACTIVITY_CANCELLED: payload(["activityId"], { activityId: ID, details: {} }),
375
- ACTIVITY_PAUSED: payload(["activityId"], { activityId: ID, reason: { type: "string" } }),
376
- ACTIVITY_UNPAUSED: payload(["activityId"], { activityId: ID }),
377
- ACTIVITY_RESET: payload(["activityId"], { activityId: ID }),
795
+ ACTIVITY_CANCEL_REQUESTED: payload(["activityId"], { activityId: ID2 }),
796
+ ACTIVITY_CANCELLED: payload(["activityId"], { activityId: ID2, details: {} }),
797
+ ACTIVITY_PAUSED: payload(["activityId"], { activityId: ID2, reason: { type: "string" } }),
798
+ ACTIVITY_UNPAUSED: payload(["activityId"], { activityId: ID2 }),
799
+ ACTIVITY_RESET: payload(["activityId"], { activityId: ID2 }),
378
800
  ACTIVITY_OPTIONS_UPDATED: payload(["activityId"], {
379
- activityId: ID,
801
+ activityId: ID2,
380
802
  options: { type: "object" }
381
803
  }),
382
804
  TIMER_STARTED: payload(["timerId", "durationMs", "fireAt"], {
383
- timerId: ID,
805
+ timerId: ID2,
384
806
  durationMs: { type: "integer", minimum: 1 },
385
807
  fireAt: { type: "string" },
386
808
  summary: { type: "string" }
387
809
  }),
388
- TIMER_FIRED: payload(["timerId"], { timerId: ID }),
389
- TIMER_CANCELLED: payload(["timerId"], { timerId: ID }),
810
+ TIMER_FIRED: payload(["timerId"], { timerId: ID2 }),
811
+ TIMER_CANCELLED: payload(["timerId"], { timerId: ID2 }),
390
812
  SIGNAL_RECEIVED: payload(["name"], {
391
- name: ID,
813
+ name: ID2,
392
814
  payload: {},
393
815
  receivedAt: { type: "string" },
394
816
  actor: {},
395
- idempotencyKey: { type: "string" }
817
+ idempotencyKey: { type: "string" },
818
+ headers: { $ref: "#/$defs/headers" }
819
+ }),
820
+ UPDATE_ADMITTED: payload(["updateId", "name"], {
821
+ updateId: ID2,
822
+ name: ID2,
823
+ args: {},
824
+ headers: { $ref: "#/$defs/headers" }
396
825
  }),
397
- UPDATE_ADMITTED: payload(["updateId", "name"], { updateId: ID, name: ID, args: {} }),
398
- UPDATE_ACCEPTED: payload(["updateId", "name"], { updateId: ID, name: ID, args: {} }),
399
- UPDATE_COMPLETED: payload(["updateId"], { updateId: ID, result: {}, failure: FAILURE_REF }),
826
+ UPDATE_ACCEPTED: payload(["updateId", "name"], {
827
+ updateId: ID2,
828
+ name: ID2,
829
+ args: {},
830
+ headers: { $ref: "#/$defs/headers" }
831
+ }),
832
+ UPDATE_COMPLETED: payload(["updateId"], { updateId: ID2, result: {}, failure: FAILURE_REF }),
400
833
  CHILD_RUN_INITIATED: payload(["childId", "input", "options"], {
401
- childId: ID,
402
- workflowKey: ID,
403
- workflowFn: ID,
834
+ childId: ID2,
835
+ workflowKey: ID2,
836
+ workflowFn: ID2,
404
837
  version: { type: "string" },
405
838
  input: {},
406
839
  options: { $ref: "#/$defs/childOptions" },
407
840
  childRunId: { type: "string" },
408
- executionKind: { enum: ["GRAPH", "DURABLE_FN"] }
841
+ executionKind: { enum: ["GRAPH", "DURABLE_FN"] },
842
+ headers: { $ref: "#/$defs/headers" }
409
843
  }),
410
844
  CHILD_RUN_STARTED: payload(["childId", "childRunId"], {
411
- childId: ID,
412
- childRunId: ID,
845
+ childId: ID2,
846
+ childRunId: ID2,
413
847
  executionKind: { enum: ["GRAPH", "DURABLE_FN"] }
414
848
  }),
415
- CHILD_RUN_COMPLETED: payload(["childId"], { childId: ID, childRunId: ID, result: {} }),
849
+ CHILD_RUN_COMPLETED: payload(["childId"], { childId: ID2, childRunId: ID2, result: {} }),
416
850
  CHILD_RUN_FAILED: payload(["childId", "failure"], {
417
- childId: ID,
418
- childRunId: ID,
851
+ childId: ID2,
852
+ childRunId: ID2,
419
853
  failure: FAILURE_REF
420
854
  }),
421
- CHILD_RUN_CANCELLED: payload(["childId"], { childId: ID, childRunId: ID }),
855
+ CHILD_RUN_CANCELLED: payload(["childId"], { childId: ID2, childRunId: ID2 }),
422
856
  CHILD_RUN_TERMINATED: payload(["childId"], {
423
- childId: ID,
424
- childRunId: ID,
857
+ childId: ID2,
858
+ childRunId: ID2,
425
859
  reason: { type: "string" }
426
860
  }),
427
861
  CHILD_RUN_TIMED_OUT: payload(["childId"], {
428
- childId: ID,
429
- childRunId: ID,
430
- timeoutType: { enum: [...chunk3FIDHONL_cjs.WORKFLOW_TIMEOUT_TYPES] }
862
+ childId: ID2,
863
+ childRunId: ID2,
864
+ timeoutType: { enum: [...chunkTYF56RGB_cjs.WORKFLOW_TIMEOUT_TYPES] }
431
865
  }),
432
866
  EXTERNAL_RUN_CANCEL_REQUESTED: payload(["externalId", "target"], {
433
- externalId: ID,
867
+ externalId: ID2,
434
868
  target: { $ref: "#/$defs/runTarget" }
435
869
  }),
436
870
  EXTERNAL_RUN_CANCEL_RESOLVED: payload(["externalId", "ok"], {
437
- externalId: ID,
871
+ externalId: ID2,
438
872
  ok: { type: "boolean" },
439
873
  targetRunId: { type: "string" },
440
874
  failure: FAILURE_REF
@@ -444,9 +878,9 @@ var EVENT_PAYLOADS = {
444
878
  required: ["externalId"],
445
879
  description: "Two forms. Initiated (appended for the SIGNAL_RUN command): {externalId, target, name, payload}. Resolved (appended by the service after delivery, dedupeKey signal-out:<runId>:<externalId>): {externalId, resolved: true, ok, failure?, targetRunId?}.",
446
880
  properties: {
447
- externalId: ID,
881
+ externalId: ID2,
448
882
  target: { $ref: "#/$defs/runTarget" },
449
- name: ID,
883
+ name: ID2,
450
884
  payload: {},
451
885
  resolved: { const: true },
452
886
  ok: { type: "boolean" },
@@ -457,34 +891,37 @@ var EVENT_PAYLOADS = {
457
891
  then: { required: ["ok"] },
458
892
  else: { required: ["target", "name"] }
459
893
  },
460
- SIDE_EFFECT_RECORDED: payload(["sideEffectId", "value"], { sideEffectId: ID, value: {} }),
894
+ SIDE_EFFECT_RECORDED: payload(["sideEffectId", "value"], { sideEffectId: ID2, value: {} }),
461
895
  LOCAL_ACTIVITY_COMPLETED: payload(["localActivityId", "attempts"], {
462
- localActivityId: ID,
896
+ localActivityId: ID2,
463
897
  result: {},
464
898
  attempts: { type: "integer", minimum: 1 },
465
- nodeType: ID,
466
- operation: ID,
899
+ nodeType: ID2,
900
+ operation: ID2,
467
901
  summary: { type: "string" }
468
902
  }),
469
903
  LOCAL_ACTIVITY_FAILED: payload(["localActivityId", "attempts", "failure"], {
470
- localActivityId: ID,
904
+ localActivityId: ID2,
471
905
  failure: FAILURE_REF,
472
906
  attempts: { type: "integer", minimum: 1 },
473
- nodeType: ID,
474
- operation: ID,
907
+ nodeType: ID2,
908
+ operation: ID2,
475
909
  summary: { type: "string" }
476
910
  }),
477
911
  SEARCH_ATTRIBUTES_UPSERTED: payload(["attributes"], { attributes: { type: "object" } }),
478
912
  CONTEXT_UPSERTED: payload(["entries"], { entries: { type: "object" } }),
479
913
  MARKER_RECORDED: payload(["markerId", "data"], {
480
- markerId: ID,
914
+ markerId: ID2,
481
915
  data: {}
482
916
  }),
483
917
  WORKFLOW_CANCEL_REQUESTED: payload([], { actor: {}, reason: { type: "string" } }),
484
918
  WORKFLOW_RESET: payload(["fromRunId", "toSeq"], {
485
- fromRunId: ID,
919
+ fromRunId: ID2,
486
920
  toSeq: { type: "integer", minimum: 1 },
487
- reason: { type: "string" }
921
+ reason: { type: "string" },
922
+ actor: {},
923
+ reapplySignals: { type: "boolean" },
924
+ reapplyUpdates: { type: "boolean" }
488
925
  }),
489
926
  VERSIONING_OVERRIDE_SET: payload(["override"], {
490
927
  override: {
@@ -513,7 +950,7 @@ var EVENT_PAYLOADS = {
513
950
  WORKFLOW_CANCELLED: payload([], { details: {} }),
514
951
  WORKFLOW_TERMINATED: payload([], { reason: { type: "string" }, actor: {} }),
515
952
  WORKFLOW_TIMED_OUT: payload(["timeoutType"], {
516
- timeoutType: { enum: [...chunk3FIDHONL_cjs.WORKFLOW_TIMEOUT_TYPES] },
953
+ timeoutType: { enum: [...chunkTYF56RGB_cjs.WORKFLOW_TIMEOUT_TYPES] },
517
954
  failure: FAILURE_REF
518
955
  }),
519
956
  WORKFLOW_CONTINUED_AS_NEW: payload(["input", "options"], {
@@ -541,32 +978,32 @@ var RUN_EVENT_RECORD = {
541
978
  required: ["seq", "type", "payload", "createdAt"],
542
979
  properties: {
543
980
  seq: { type: "integer", minimum: 1 },
544
- type: { enum: [...chunk3FIDHONL_cjs.EVENT_TYPES] },
981
+ type: { enum: [...chunkTYF56RGB_cjs.EVENT_TYPES] },
545
982
  taskId: { type: ["string", "null"] },
546
983
  payload: { type: "object" },
547
984
  createdAt: { type: "string", minLength: 1 },
548
985
  dedupeKey: { type: ["string", "null"] }
549
986
  },
550
- allOf: chunk3FIDHONL_cjs.EVENT_TYPES.map((type) => ({
987
+ allOf: chunkTYF56RGB_cjs.EVENT_TYPES.map((type) => ({
551
988
  if: { properties: { type: { const: type } }, required: ["type"] },
552
989
  then: { properties: { payload: { $ref: `#/$defs/payload_${type}` } } }
553
990
  }))
554
991
  };
555
992
  function payloadDefs() {
556
993
  const defs = {};
557
- for (const type of chunk3FIDHONL_cjs.EVENT_TYPES) defs[`payload_${type}`] = compact(EVENT_PAYLOADS[type]);
994
+ for (const type of chunkTYF56RGB_cjs.EVENT_TYPES) defs[`payload_${type}`] = compact(EVENT_PAYLOADS[type]);
558
995
  return defs;
559
996
  }
560
997
  function commandDefs() {
561
998
  const defs = {};
562
- for (const type of chunk3FIDHONL_cjs.COMMAND_TYPES) defs[`command_${type}`] = COMMAND_DEFS[type];
999
+ for (const type of chunkTYF56RGB_cjs.COMMAND_TYPES) defs[`command_${type}`] = COMMAND_DEFS[type];
563
1000
  return defs;
564
1001
  }
565
1002
  var COMMAND_ONE_OF = {
566
1003
  type: "object",
567
1004
  required: ["type"],
568
- properties: { type: { enum: [...chunk3FIDHONL_cjs.COMMAND_TYPES] } },
569
- allOf: chunk3FIDHONL_cjs.COMMAND_TYPES.map((type) => ({
1005
+ properties: { type: { enum: [...chunkTYF56RGB_cjs.COMMAND_TYPES] } },
1006
+ allOf: chunkTYF56RGB_cjs.COMMAND_TYPES.map((type) => ({
570
1007
  if: { properties: { type: { const: type } }, required: ["type"] },
571
1008
  then: { $ref: `#/$defs/command_${type}` }
572
1009
  }))
@@ -583,7 +1020,7 @@ var WORKFLOW_COMMAND_SCHEMA = {
583
1020
  $schema: "https://json-schema.org/draft/2020-12/schema",
584
1021
  $id: WORKFLOW_COMMAND_SCHEMA_ID,
585
1022
  title: "FluidGrids workflow-task command",
586
- description: "A flat object discriminated by an UPPER_SNAKE type. Commands travel as [JSON!]! (DB4). UPSERT_SEARCH_ATTRIBUTES, ACCEPT_UPDATE, REJECT_UPDATE and COMPLETE_UPDATE are defined but refused in Phase B.",
1023
+ description: "A flat object discriminated by an UPPER_SNAKE type. Commands travel as [JSON!]! (DB4). UPSERT_SEARCH_ATTRIBUTES, ACCEPT_UPDATE, REJECT_UPDATE, COMPLETE_UPDATE and SCHEDULE_ACTIVITY of kind user are Phase C: the service accepts them only for the C-GATE features its flags enable (c.searchAttributes, c.updates, c.userActivity).",
587
1024
  ...COMMAND_ONE_OF,
588
1025
  $defs: { ...SHARED_DEFS, ...commandDefs() }
589
1026
  };
@@ -603,8 +1040,8 @@ var WORKFLOW_TASK_SCHEMA = {
603
1040
  type: "object",
604
1041
  required: ["runId", "workspaceId"],
605
1042
  properties: {
606
- runId: ID,
607
- workspaceId: ID,
1043
+ runId: ID2,
1044
+ workspaceId: ID2,
608
1045
  workflowKey: { type: "string" },
609
1046
  version: {},
610
1047
  buildId: { type: "string" },
@@ -636,10 +1073,37 @@ var WORKFLOW_TASK_SCHEMA = {
636
1073
  details: { type: "string" },
637
1074
  context: { type: "object" },
638
1075
  memo: { type: "object" },
639
- versioningBehavior: { enum: [...chunk3FIDHONL_cjs.VERSIONING_BEHAVIORS] },
640
- retry: { $ref: "#/$defs/runRetryPolicy" }
1076
+ versioningBehavior: { enum: [...chunkTYF56RGB_cjs.VERSIONING_BEHAVIORS] },
1077
+ retry: { $ref: "#/$defs/runRetryPolicy" },
1078
+ searchAttributes: { type: "object" },
1079
+ fairnessKey: FAIRNESS_KEY,
1080
+ fairnessWeight: FAIRNESS_WEIGHT
641
1081
  }
642
1082
  },
1083
+ updateRequest: {
1084
+ type: "object",
1085
+ required: ["updateId", "name"],
1086
+ description: "Phase C (C-ABI-H): a pending update the lease delivers. admitted marks one history already holds as UPDATE_ADMITTED; the runtime delivers that one from the event.",
1087
+ properties: {
1088
+ updateId: ID2,
1089
+ name: ID2,
1090
+ args: {},
1091
+ admitted: { type: "boolean" },
1092
+ headers: { $ref: "#/$defs/headers" }
1093
+ },
1094
+ additionalProperties: false
1095
+ },
1096
+ sinkCall: {
1097
+ type: "object",
1098
+ required: ["sink", "fn", "args"],
1099
+ description: "Phase C: a call of ctx.sinks.<sink>.<fn>(...args), never made on replay.",
1100
+ properties: {
1101
+ sink: ID2,
1102
+ fn: ID2,
1103
+ args: { type: "array" }
1104
+ },
1105
+ additionalProperties: false
1106
+ },
643
1107
  localActivityRequest: {
644
1108
  type: "object",
645
1109
  required: [
@@ -655,18 +1119,18 @@ var WORKFLOW_TASK_SCHEMA = {
655
1119
  ],
656
1120
  description: "R2: a local activity the task needs (11 \xA72.12). Run attempt `attempt` after waiting backoffMs, then run the same task again with the outcome in localActivityResults.",
657
1121
  properties: {
658
- localActivityId: ID,
1122
+ localActivityId: ID2,
659
1123
  kind: { const: "node" },
660
- nodeType: ID,
1124
+ nodeType: ID2,
661
1125
  nodeVersion: { type: "string" },
662
- operation: ID,
1126
+ operation: ID2,
663
1127
  args: {},
664
- connection: ID,
1128
+ connection: ID2,
665
1129
  retry: { $ref: "#/$defs/retryPolicy" },
666
1130
  startToCloseTimeout: {
667
1131
  type: "integer",
668
1132
  minimum: 1,
669
- maximum: chunk3FIDHONL_cjs.LOCAL_ACTIVITY_MAX_TIMEOUT_MS
1133
+ maximum: chunkTYF56RGB_cjs.LOCAL_ACTIVITY_MAX_TIMEOUT_MS
670
1134
  },
671
1135
  attempt: { type: "integer", minimum: 1 },
672
1136
  backoffMs: NON_NEGATIVE_MS,
@@ -678,9 +1142,9 @@ var WORKFLOW_TASK_SCHEMA = {
678
1142
  type: "object",
679
1143
  required: ["protocol", "kind", "workflowFn", "info", "history", "nowMs"],
680
1144
  properties: {
681
- protocol: { const: chunk3FIDHONL_cjs.HISTORY_PROTOCOL },
1145
+ protocol: { const: chunkTYF56RGB_cjs.HISTORY_PROTOCOL },
682
1146
  kind: { enum: ["task", "query", "verify"] },
683
- workflowFn: ID,
1147
+ workflowFn: ID2,
684
1148
  info: { $ref: "#/$defs/info" },
685
1149
  history: { type: "array", items: { $ref: "#/$defs/event" } },
686
1150
  nowMs: { type: "number" },
@@ -690,24 +1154,37 @@ var WORKFLOW_TASK_SCHEMA = {
690
1154
  type: "object",
691
1155
  required: ["localActivityId", "attempts"],
692
1156
  properties: {
693
- localActivityId: ID,
1157
+ localActivityId: ID2,
694
1158
  result: {},
695
1159
  failure: FAILURE_REF,
696
1160
  attempts: { type: "integer", minimum: 1 }
697
1161
  }
698
1162
  }
699
1163
  },
1164
+ updates: {
1165
+ type: "array",
1166
+ items: { $ref: "#/$defs/updateRequest" }
1167
+ },
700
1168
  queries: {
701
1169
  type: "array",
702
1170
  items: {
703
1171
  type: "object",
704
1172
  required: ["queryId", "name"],
705
1173
  properties: {
706
- queryId: ID,
707
- name: { enum: [...chunk3FIDHONL_cjs.BUILT_IN_QUERIES] },
1174
+ queryId: ID2,
1175
+ name: {
1176
+ ...ID2,
1177
+ description: `A built-in query (${chunkTYF56RGB_cjs.BUILT_IN_QUERIES.join(", ")}) or, from C-R1, the name of a custom query.`
1178
+ },
708
1179
  args: {}
709
1180
  }
710
1181
  }
1182
+ },
1183
+ features: {
1184
+ type: "array",
1185
+ items: { type: "string", minLength: 1 },
1186
+ uniqueItems: true,
1187
+ description: "The bundle features (code.features names) the workspace enables for this task. From C-R1 the runtime reads `interceptors`: a task of a bundle that exports interceptors fails with UNSUPPORTED_COMMAND unless it is listed."
711
1188
  }
712
1189
  }
713
1190
  },
@@ -715,7 +1192,7 @@ var WORKFLOW_TASK_SCHEMA = {
715
1192
  type: "object",
716
1193
  required: ["protocol", "outcome", "commands", "logs"],
717
1194
  properties: {
718
- protocol: { const: chunk3FIDHONL_cjs.HISTORY_PROTOCOL },
1195
+ protocol: { const: chunkTYF56RGB_cjs.HISTORY_PROTOCOL },
719
1196
  outcome: { enum: ["commands", "failed", "localActivityRequested"] },
720
1197
  commands: { type: "array", items: { $ref: "#/$defs/command" } },
721
1198
  localActivityRequests: {
@@ -741,14 +1218,27 @@ var WORKFLOW_TASK_SCHEMA = {
741
1218
  items: {
742
1219
  type: "object",
743
1220
  required: ["queryId"],
744
- properties: { queryId: ID, value: {}, error: { type: "string" } }
1221
+ properties: {
1222
+ queryId: ID2,
1223
+ value: {},
1224
+ error: { type: "string" },
1225
+ rejected: {
1226
+ type: "boolean",
1227
+ description: "Phase C: no handler took the query name (the service answers VALIDATION)."
1228
+ }
1229
+ }
745
1230
  }
746
1231
  },
1232
+ sinkCalls: {
1233
+ type: "array",
1234
+ maxItems: chunkTYF56RGB_cjs.MAX_SINK_CALLS,
1235
+ items: { $ref: "#/$defs/sinkCall" }
1236
+ },
747
1237
  failure: {
748
1238
  type: "object",
749
1239
  required: ["cause", "message"],
750
1240
  properties: {
751
- cause: { enum: [...chunk3FIDHONL_cjs.TASK_FAILURE_CAUSES] },
1241
+ cause: { enum: [...chunkTYF56RGB_cjs.TASK_FAILURE_CAUSES] },
752
1242
  message: { type: "string" },
753
1243
  stackTrace: { type: "string" },
754
1244
  seq: { type: "integer" },
@@ -780,10 +1270,10 @@ var HISTORY_FILE_SCHEMA = {
780
1270
  required: ["format", "formatVersion", "workflowFn", "events"],
781
1271
  properties: {
782
1272
  format: { const: HISTORY_FILE_FORMAT },
783
- formatVersion: { const: chunk3FIDHONL_cjs.HISTORY_PROTOCOL },
1273
+ formatVersion: { const: chunkTYF56RGB_cjs.HISTORY_PROTOCOL },
784
1274
  name: { type: "string" },
785
1275
  description: { type: "string" },
786
- workflowFn: ID,
1276
+ workflowFn: ID2,
787
1277
  source: { type: "string", description: "Fixture source module, relative to the file." },
788
1278
  replaySource: {
789
1279
  type: "string",
@@ -791,7 +1281,7 @@ var HISTORY_FILE_SCHEMA = {
791
1281
  },
792
1282
  replay: {
793
1283
  type: "boolean",
794
- description: "False for histories that use Phase C features (updates); they are parsed and projected but not replayed."
1284
+ description: "False for histories that are parsed and projected but not replayed (written by hand for a feature the recording runtime did not have)."
795
1285
  },
796
1286
  info: { $ref: "#/$defs/info" },
797
1287
  nowMs: {
@@ -815,7 +1305,9 @@ var HISTORY_SCHEMA_FILES = [
815
1305
  ["run-event.schema.json", RUN_EVENT_SCHEMA],
816
1306
  ["workflow-command.schema.json", WORKFLOW_COMMAND_SCHEMA],
817
1307
  ["workflow-task.schema.json", WORKFLOW_TASK_SCHEMA],
818
- ["history-file.schema.json", HISTORY_FILE_SCHEMA]
1308
+ ["history-file.schema.json", HISTORY_FILE_SCHEMA],
1309
+ ["bridge-v2.schema.json", BRIDGE_V2_SCHEMA],
1310
+ ["payload-fields.json", chunkJSC75O5C_cjs.PAYLOAD_FIELDS_DOCUMENT]
819
1311
  ];
820
1312
  var tools;
821
1313
  function schemaTools() {
@@ -825,7 +1317,8 @@ function schemaTools() {
825
1317
  ajv,
826
1318
  command: ajv.compile(WORKFLOW_COMMAND_SCHEMA),
827
1319
  event: ajv.compile(RUN_EVENT_SCHEMA),
828
- file: ajv.compile(HISTORY_FILE_SCHEMA)
1320
+ file: ajv.compile(HISTORY_FILE_SCHEMA),
1321
+ bridge: ajv.compile(BRIDGE_V2_SCHEMA)
829
1322
  };
830
1323
  }
831
1324
  return tools;
@@ -898,12 +1391,12 @@ function validateCommands(commands, options = {}) {
898
1391
  return;
899
1392
  }
900
1393
  const command2 = checked.command;
901
- if (!chunkRUQIMTN5_cjs.isWorkflowCommandEnabled(command2, options.enabled) && !(options.relief !== void 0 && chunkRUQIMTN5_cjs.isReliefCommand(command2, options.relief))) {
1394
+ if (!chunkISOIA7NV_cjs.isWorkflowCommandEnabled(command2, options.enabled) && !(options.relief !== void 0 && chunkISOIA7NV_cjs.isReliefCommand(command2, options.relief))) {
902
1395
  unsupported = true;
903
1396
  issues.push({
904
1397
  index,
905
1398
  code: "commands.unsupported",
906
- message: chunkRUQIMTN5_cjs.unsupportedMessage(command2, options.enabled)
1399
+ message: chunkISOIA7NV_cjs.unsupportedMessage(command2, options.enabled)
907
1400
  });
908
1401
  }
909
1402
  const id = idOf(command2);
@@ -912,19 +1405,26 @@ function validateCommands(commands, options = {}) {
912
1405
  issues.push({ index, code: "commands.duplicateId", message: `${id} is used twice` });
913
1406
  ids.add(id);
914
1407
  }
915
- if (chunk3FIDHONL_cjs.TERMINAL_COMMANDS.has(command2.type) && index !== commands.length - 1)
1408
+ if (chunkTYF56RGB_cjs.TERMINAL_COMMANDS.has(command2.type) && index !== commands.length - 1)
916
1409
  issues.push({
917
1410
  index,
918
1411
  code: "commands.terminalNotLast",
919
1412
  message: `${command2.type} must be the last command of the batch`
920
1413
  });
921
- if (command2.type === "SCHEDULE_ACTIVITY" && !chunk3FIDHONL_cjs.isActivityNodeTypeAllowed(command2.nodeType))
1414
+ if (command2.type === "SCHEDULE_ACTIVITY" && command2.kind === "node" && !chunkA5SXCA62_cjs.isActivityNodeTypeAllowed(command2.nodeType))
922
1415
  issues.push({
923
1416
  index,
924
1417
  code: "durable.activityTypeNotAllowed",
925
1418
  message: `${command2.nodeType} cannot run as a durable activity`,
926
1419
  path: "/nodeType"
927
1420
  });
1421
+ if (command2.type === "SCHEDULE_ACTIVITY" && command2.kind === "user" && command2.headers !== void 0 && chunkISOIA7NV_cjs.utf8Bytes(JSON.stringify(command2.headers)) > chunkTYF56RGB_cjs.MAX_HEADERS_BYTES)
1422
+ issues.push({
1423
+ index,
1424
+ code: "commands.headersTooLarge",
1425
+ message: `The headers of ${command2.type} exceed ${chunkTYF56RGB_cjs.MAX_HEADERS_BYTES} bytes`,
1426
+ path: "/headers"
1427
+ });
928
1428
  valid.push(command2);
929
1429
  });
930
1430
  if (issues.length > 0)
@@ -958,6 +1458,11 @@ function validateHistoryFile(value) {
958
1458
  if (validate(value)) return validateHistory(chunkSAENRNBJ_cjs.isRecord(value) ? value["events"] : void 0);
959
1459
  return { ok: false, issues: issuesOf(0, validate.errors) };
960
1460
  }
1461
+ function validateBridgeFrame(value) {
1462
+ const { bridge: validate } = schemaTools();
1463
+ if (validate(value)) return { ok: true, frame: value };
1464
+ return { ok: false, issues: issuesOf(0, validate.errors) };
1465
+ }
961
1466
  function compilePayloadValidator(schema) {
962
1467
  const { ajv } = schemaTools();
963
1468
  const validate = ajv.compile(schema);
@@ -1005,7 +1510,7 @@ function parseHistoryFile(input) {
1005
1510
  function createHistoryFile(workflowFn, events, extra = {}) {
1006
1511
  return {
1007
1512
  format: HISTORY_FILE_FORMAT,
1008
- formatVersion: chunk3FIDHONL_cjs.HISTORY_PROTOCOL,
1513
+ formatVersion: chunkTYF56RGB_cjs.HISTORY_PROTOCOL,
1009
1514
  ...extra,
1010
1515
  workflowFn,
1011
1516
  events
@@ -1016,6 +1521,17 @@ function serializeHistoryFile(file) {
1016
1521
  `;
1017
1522
  }
1018
1523
 
1524
+ exports.BRIDGE_IDLE_TIMEOUT_MS = BRIDGE_IDLE_TIMEOUT_MS;
1525
+ exports.BRIDGE_MAX_FRAME_BYTES = BRIDGE_MAX_FRAME_BYTES;
1526
+ exports.BRIDGE_MAX_HISTORY_TAIL_BYTES = BRIDGE_MAX_HISTORY_TAIL_BYTES;
1527
+ exports.BRIDGE_PATH = BRIDGE_PATH;
1528
+ exports.BRIDGE_PING_SECONDS = BRIDGE_PING_SECONDS;
1529
+ exports.BRIDGE_PROTOCOL_VERSION = BRIDGE_PROTOCOL_VERSION;
1530
+ exports.BRIDGE_REQUEST_METHODS = BRIDGE_REQUEST_METHODS;
1531
+ exports.BRIDGE_V2_SCHEMA = BRIDGE_V2_SCHEMA;
1532
+ exports.BRIDGE_V2_SCHEMA_ID = BRIDGE_V2_SCHEMA_ID;
1533
+ exports.BRIDGE_WORKER_HEARTBEAT_SECONDS = BRIDGE_WORKER_HEARTBEAT_SECONDS;
1534
+ exports.BridgeCloseCode = BridgeCloseCode;
1019
1535
  exports.HISTORY_FILE_FORMAT = HISTORY_FILE_FORMAT;
1020
1536
  exports.HISTORY_FILE_SCHEMA = HISTORY_FILE_SCHEMA;
1021
1537
  exports.HISTORY_FILE_SCHEMA_ID = HISTORY_FILE_SCHEMA_ID;
@@ -1031,6 +1547,7 @@ exports.compilePayloadValidator = compilePayloadValidator;
1031
1547
  exports.createHistoryFile = createHistoryFile;
1032
1548
  exports.parseHistoryFile = parseHistoryFile;
1033
1549
  exports.serializeHistoryFile = serializeHistoryFile;
1550
+ exports.validateBridgeFrame = validateBridgeFrame;
1034
1551
  exports.validateCommand = validateCommand;
1035
1552
  exports.validateCommands = validateCommands;
1036
1553
  exports.validateHistory = validateHistory;