@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
@@ -84,16 +84,36 @@ var ApplicationError = class extends WorkflowFailure {
84
84
  }
85
85
  };
86
86
  var ActivityFailure = class extends WorkflowFailure {
87
- constructor(message, activityId, nodeType, operation, cause) {
87
+ constructor(message, activityId, nodeType, operation, cause, activityName) {
88
88
  super(message, cause instanceof WorkflowFailure ? cause.errorType : "UNKNOWN", { cause });
89
89
  this.activityId = activityId;
90
90
  this.nodeType = nodeType;
91
91
  this.operation = operation;
92
+ this.activityName = activityName;
92
93
  this.name = "ActivityFailure";
93
94
  }
94
95
  activityId;
95
96
  nodeType;
96
97
  operation;
98
+ activityName;
99
+ };
100
+ var ActivityPausedError = class extends ApplicationError {
101
+ constructor(message = "The activity was paused", details) {
102
+ super(message, {
103
+ type: "ActivityPausedError",
104
+ errorType: "TRANSIENT",
105
+ ...details !== void 0 ? { details } : {}
106
+ });
107
+ this.name = "ActivityPausedError";
108
+ }
109
+ };
110
+ var QueryHandlerSideEffect = class extends Error {
111
+ constructor(what) {
112
+ super(
113
+ `${what} is not allowed in a query handler or an update validator; they must not change the run`
114
+ );
115
+ this.name = "QueryHandlerSideEffect";
116
+ }
97
117
  };
98
118
  var ChildRunFailure = class extends WorkflowFailure {
99
119
  constructor(message, childId, childRunId, cause) {
@@ -233,12 +253,14 @@ function failureToError(failure, depth = 0) {
233
253
  }
234
254
 
235
255
  exports.ActivityFailure = ActivityFailure;
256
+ exports.ActivityPausedError = ActivityPausedError;
236
257
  exports.ApplicationError = ApplicationError;
237
258
  exports.CancelledFailure = CancelledFailure;
238
259
  exports.ChildRunFailure = ChildRunFailure;
239
260
  exports.DeterminismViolation = DeterminismViolation;
240
261
  exports.HistoryLimitExceeded = HistoryLimitExceeded;
241
262
  exports.PhaseCFeatureError = PhaseCFeatureError;
263
+ exports.QueryHandlerSideEffect = QueryHandlerSideEffect;
242
264
  exports.ServerFailure = ServerFailure;
243
265
  exports.TerminatedFailure = TerminatedFailure;
244
266
  exports.TimeoutFailure = TimeoutFailure;
@@ -1,5 +1,5 @@
1
- import { N as NodeManifest } from '../manifest-gRI2Q5Fj.cjs';
2
- import '../types-Bb2wRnJ5.cjs';
1
+ import { N as NodeManifest } from '../manifest-DahBQVM8.cjs';
2
+ import '../types-V7jEEUaL.cjs';
3
3
 
4
4
  interface GeneratedClients {
5
5
  path: string;
@@ -1,5 +1,5 @@
1
- import { N as NodeManifest } from '../manifest-BJjrQt77.js';
2
- import '../types-Bb2wRnJ5.js';
1
+ import { N as NodeManifest } from '../manifest-D-I_twys.js';
2
+ import '../types-V7jEEUaL.js';
3
3
 
4
4
  interface GeneratedClients {
5
5
  path: string;
@@ -1,5 +1,5 @@
1
- import { P as Position, a as JsonObject, d as ConnectionRef, i as WorkflowAuthoring, W as WorkflowDefinition, b as WorkflowInterface, k as WorkflowConfig } from './types-Bb2wRnJ5.js';
2
- import { T as Tier1Recording, x as Tier1Workflow } from './workflow-8uRU9rhL.js';
1
+ import { P as Position, J as JsonObject, d as ConnectionRef, i as WorkflowAuthoring, W as WorkflowDefinition, b as WorkflowInterface, k as WorkflowConfig } from './types-V7jEEUaL.js';
2
+ import { T as Tier1Recording, x as Tier1Workflow } from './workflow-B18OeF7g.js';
3
3
 
4
4
  declare const LAYOUT_FORMAT = "fluidgrids.layout";
5
5
  declare const LAYOUT_FORMAT_VERSION = 1;
@@ -71,14 +71,31 @@ interface CollectedDurableWorkflow {
71
71
  trigger?: CollectedTrigger;
72
72
  /** Run-level settings the declaration lowers into `config` (R2). */
73
73
  config?: WorkflowConfig;
74
- /** Runtime features its options use (C-FEATURES): `autoUpgrade`, `runRetry`, `timeouts`. */
74
+ /** Runtime features its options use (C-FEATURES): `autoUpgrade`, `runRetry`, `timeouts`, `dynamic`. */
75
75
  features?: string[];
76
+ /** A dynamic workflow (Phase C): `lower()` writes it as `code.exports.workflows["*"]`. */
77
+ dynamic?: boolean;
78
+ }
79
+ /** An exported user-activity implementation found in the workflow bundle (Phase C). */
80
+ interface CollectedActivityImplementation {
81
+ module: string;
82
+ exportName: string;
83
+ name: string;
76
84
  }
77
85
  interface Tier1Collection {
78
86
  format: typeof COLLECTION_FORMAT;
79
87
  workflows: CollectedWorkflow[];
80
88
  /** Tier-2 functions; absent when the bundle has none. */
81
89
  durable?: CollectedDurableWorkflow[];
90
+ /** User-activity implementations exported by bundle modules; they belong on a worker. */
91
+ activityImplementations?: CollectedActivityImplementation[];
92
+ /**
93
+ * Modules that export a binding named `interceptors`, whatever its value:
94
+ * the runtime registers those exports as workflow interceptors, so
95
+ * `lower()` reports the `interceptors` feature from the evaluated modules
96
+ * rather than from the source text (C-FEATURES).
97
+ */
98
+ interceptorModules?: string[];
82
99
  }
83
100
  /** Collect the workflows exported by each module, as JSON. */
84
101
  declare function collectWorkflowExports(modules: ReadonlyArray<readonly [string, Record<string, unknown>]>): string;
@@ -1,5 +1,5 @@
1
- import { P as Position, a as JsonObject, d as ConnectionRef, i as WorkflowAuthoring, W as WorkflowDefinition, b as WorkflowInterface, k as WorkflowConfig } from './types-Bb2wRnJ5.cjs';
2
- import { T as Tier1Recording, x as Tier1Workflow } from './workflow-CZOXUlQ5.cjs';
1
+ import { P as Position, J as JsonObject, d as ConnectionRef, i as WorkflowAuthoring, W as WorkflowDefinition, b as WorkflowInterface, k as WorkflowConfig } from './types-V7jEEUaL.cjs';
2
+ import { T as Tier1Recording, x as Tier1Workflow } from './workflow-BJPFv3cp.cjs';
3
3
 
4
4
  declare const LAYOUT_FORMAT = "fluidgrids.layout";
5
5
  declare const LAYOUT_FORMAT_VERSION = 1;
@@ -71,14 +71,31 @@ interface CollectedDurableWorkflow {
71
71
  trigger?: CollectedTrigger;
72
72
  /** Run-level settings the declaration lowers into `config` (R2). */
73
73
  config?: WorkflowConfig;
74
- /** Runtime features its options use (C-FEATURES): `autoUpgrade`, `runRetry`, `timeouts`. */
74
+ /** Runtime features its options use (C-FEATURES): `autoUpgrade`, `runRetry`, `timeouts`, `dynamic`. */
75
75
  features?: string[];
76
+ /** A dynamic workflow (Phase C): `lower()` writes it as `code.exports.workflows["*"]`. */
77
+ dynamic?: boolean;
78
+ }
79
+ /** An exported user-activity implementation found in the workflow bundle (Phase C). */
80
+ interface CollectedActivityImplementation {
81
+ module: string;
82
+ exportName: string;
83
+ name: string;
76
84
  }
77
85
  interface Tier1Collection {
78
86
  format: typeof COLLECTION_FORMAT;
79
87
  workflows: CollectedWorkflow[];
80
88
  /** Tier-2 functions; absent when the bundle has none. */
81
89
  durable?: CollectedDurableWorkflow[];
90
+ /** User-activity implementations exported by bundle modules; they belong on a worker. */
91
+ activityImplementations?: CollectedActivityImplementation[];
92
+ /**
93
+ * Modules that export a binding named `interceptors`, whatever its value:
94
+ * the runtime registers those exports as workflow interceptors, so
95
+ * `lower()` reports the `interceptors` feature from the evaluated modules
96
+ * rather than from the source text (C-FEATURES).
97
+ */
98
+ interceptorModules?: string[];
82
99
  }
83
100
  /** Collect the workflows exported by each module, as JSON. */
84
101
  declare function collectWorkflowExports(modules: ReadonlyArray<readonly [string, Record<string, unknown>]>): string;
@@ -1,5 +1,5 @@
1
- import { E as ErrorType, J as Json, a as JsonObject } from './types-Bb2wRnJ5.cjs';
2
- import { e as BuiltInQueryName, W as WorkflowCommand, n as CommandType, F as Failure, P as ParentClosePolicy, Y as RunEventDraft, a as WorkflowTaskFailureCause, Z as RunEventRecord, w as HISTORY_PROTOCOL, ai as WorkflowInfoSnapshot, ak as WorkflowTaskResult } from './types-CQKOhPTa.cjs';
1
+ import { E as ErrorType, a as Json, J as JsonObject } from './types-V7jEEUaL.cjs';
2
+ import { W as WorkflowCommand, s as CommandType, F as Failure, P as ParentClosePolicy, ab as RunEventDraft, a as WorkflowTaskFailureCause, R as RunEventRecord, L as HISTORY_PROTOCOL, b as WorkflowInfoSnapshot, aA as WorkflowTaskResult } from './types-Bv2i4cBX.cjs';
3
3
 
4
4
  declare const RUN_EVENT_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/run-event.schema.json";
5
5
  declare const WORKFLOW_COMMAND_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/workflow-command.schema.json";
@@ -262,6 +262,18 @@ declare const RUN_EVENT_SCHEMA: {
262
262
  readonly idConflictPolicy: {
263
263
  readonly enum: readonly ["FAIL", "USE_EXISTING", "TERMINATE_EXISTING"];
264
264
  };
265
+ readonly fairnessKey: {
266
+ readonly type: "string";
267
+ readonly minLength: 1;
268
+ readonly maxLength: 255;
269
+ readonly description: "Phase C: the fairness key of the task (11 §2.11); default the workspace id.";
270
+ };
271
+ readonly fairnessWeight: {
272
+ readonly type: "number";
273
+ readonly minimum: 0.1;
274
+ readonly maximum: 10;
275
+ readonly description: "Phase C: the weight of the fairness key, 0.1 to 10 (default 1).";
276
+ };
265
277
  };
266
278
  };
267
279
  readonly legacyCanRetryPolicy: {
@@ -330,6 +342,7 @@ declare const RUN_EVENT_SCHEMA: {
330
342
  readonly additionalProperties: {
331
343
  readonly type: "string";
332
344
  };
345
+ readonly description: "Interceptor headers (11 §2.10): string values; a user activity carries at most 16 KiB of JSON (checked by validateCommands).";
333
346
  };
334
347
  };
335
348
  readonly type: "object";
@@ -633,6 +646,18 @@ declare const WORKFLOW_COMMAND_SCHEMA: {
633
646
  readonly idConflictPolicy: {
634
647
  readonly enum: readonly ["FAIL", "USE_EXISTING", "TERMINATE_EXISTING"];
635
648
  };
649
+ readonly fairnessKey: {
650
+ readonly type: "string";
651
+ readonly minLength: 1;
652
+ readonly maxLength: 255;
653
+ readonly description: "Phase C: the fairness key of the task (11 §2.11); default the workspace id.";
654
+ };
655
+ readonly fairnessWeight: {
656
+ readonly type: "number";
657
+ readonly minimum: 0.1;
658
+ readonly maximum: 10;
659
+ readonly description: "Phase C: the weight of the fairness key, 0.1 to 10 (default 1).";
660
+ };
636
661
  };
637
662
  };
638
663
  readonly legacyCanRetryPolicy: {
@@ -701,6 +726,7 @@ declare const WORKFLOW_COMMAND_SCHEMA: {
701
726
  readonly additionalProperties: {
702
727
  readonly type: "string";
703
728
  };
729
+ readonly description: "Interceptor headers (11 §2.10): string values; a user activity carries at most 16 KiB of JSON (checked by validateCommands).";
704
730
  };
705
731
  };
706
732
  readonly type: "object";
@@ -726,7 +752,7 @@ declare const WORKFLOW_COMMAND_SCHEMA: {
726
752
  readonly $schema: "https://json-schema.org/draft/2020-12/schema";
727
753
  readonly $id: "https://docs.fluidgrids.ai/schemas/workflow-command.schema.json";
728
754
  readonly title: "FluidGrids workflow-task command";
729
- readonly 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.";
755
+ readonly 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).";
730
756
  };
731
757
  /** The workflow-task request and result of the runtime ABI. */
732
758
  declare const WORKFLOW_TASK_SCHEMA: {
@@ -912,7 +938,68 @@ declare const WORKFLOW_TASK_SCHEMA: {
912
938
  readonly retry: {
913
939
  readonly $ref: "#/$defs/runRetryPolicy";
914
940
  };
941
+ readonly searchAttributes: {
942
+ readonly type: "object";
943
+ };
944
+ readonly fairnessKey: {
945
+ readonly type: "string";
946
+ readonly minLength: 1;
947
+ readonly maxLength: 255;
948
+ readonly description: "Phase C: the fairness key of the task (11 §2.11); default the workspace id.";
949
+ };
950
+ readonly fairnessWeight: {
951
+ readonly type: "number";
952
+ readonly minimum: 0.1;
953
+ readonly maximum: 10;
954
+ readonly description: "Phase C: the weight of the fairness key, 0.1 to 10 (default 1).";
955
+ };
956
+ };
957
+ };
958
+ readonly updateRequest: {
959
+ readonly type: "object";
960
+ readonly required: readonly ["updateId", "name"];
961
+ readonly 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.";
962
+ readonly properties: {
963
+ readonly updateId: {
964
+ readonly type: "string";
965
+ readonly minLength: 1;
966
+ readonly maxLength: 256;
967
+ };
968
+ readonly name: {
969
+ readonly type: "string";
970
+ readonly minLength: 1;
971
+ readonly maxLength: 256;
972
+ };
973
+ readonly args: {};
974
+ readonly admitted: {
975
+ readonly type: "boolean";
976
+ };
977
+ readonly headers: {
978
+ readonly $ref: "#/$defs/headers";
979
+ };
980
+ };
981
+ readonly additionalProperties: false;
982
+ };
983
+ readonly sinkCall: {
984
+ readonly type: "object";
985
+ readonly required: readonly ["sink", "fn", "args"];
986
+ readonly description: "Phase C: a call of ctx.sinks.<sink>.<fn>(...args), never made on replay.";
987
+ readonly properties: {
988
+ readonly sink: {
989
+ readonly type: "string";
990
+ readonly minLength: 1;
991
+ readonly maxLength: 256;
992
+ };
993
+ readonly fn: {
994
+ readonly type: "string";
995
+ readonly minLength: 1;
996
+ readonly maxLength: 256;
997
+ };
998
+ readonly args: {
999
+ readonly type: "array";
1000
+ };
915
1001
  };
1002
+ readonly additionalProperties: false;
916
1003
  };
917
1004
  readonly localActivityRequest: {
918
1005
  readonly type: "object";
@@ -1018,6 +1105,12 @@ declare const WORKFLOW_TASK_SCHEMA: {
1018
1105
  };
1019
1106
  };
1020
1107
  };
1108
+ readonly updates: {
1109
+ readonly type: "array";
1110
+ readonly items: {
1111
+ readonly $ref: "#/$defs/updateRequest";
1112
+ };
1113
+ };
1021
1114
  readonly queries: {
1022
1115
  readonly type: "array";
1023
1116
  readonly items: {
@@ -1030,12 +1123,24 @@ declare const WORKFLOW_TASK_SCHEMA: {
1030
1123
  readonly maxLength: 256;
1031
1124
  };
1032
1125
  readonly name: {
1033
- readonly enum: readonly BuiltInQueryName[];
1126
+ readonly description: `A built-in query (${string}) or, from C-R1, the name of a custom query.`;
1127
+ readonly type: "string";
1128
+ readonly minLength: 1;
1129
+ readonly maxLength: 256;
1034
1130
  };
1035
1131
  readonly args: {};
1036
1132
  };
1037
1133
  };
1038
1134
  };
1135
+ readonly features: {
1136
+ readonly type: "array";
1137
+ readonly items: {
1138
+ readonly type: "string";
1139
+ readonly minLength: 1;
1140
+ };
1141
+ readonly uniqueItems: true;
1142
+ readonly 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.";
1143
+ };
1039
1144
  };
1040
1145
  };
1041
1146
  readonly result: {
@@ -1096,9 +1201,20 @@ declare const WORKFLOW_TASK_SCHEMA: {
1096
1201
  readonly error: {
1097
1202
  readonly type: "string";
1098
1203
  };
1204
+ readonly rejected: {
1205
+ readonly type: "boolean";
1206
+ readonly description: "Phase C: no handler took the query name (the service answers VALIDATION).";
1207
+ };
1099
1208
  };
1100
1209
  };
1101
1210
  };
1211
+ readonly sinkCalls: {
1212
+ readonly type: "array";
1213
+ readonly maxItems: 256;
1214
+ readonly items: {
1215
+ readonly $ref: "#/$defs/sinkCall";
1216
+ };
1217
+ };
1102
1218
  readonly failure: {
1103
1219
  readonly type: "object";
1104
1220
  readonly required: readonly ["cause", "message"];
@@ -1393,6 +1509,18 @@ declare const WORKFLOW_TASK_SCHEMA: {
1393
1509
  readonly idConflictPolicy: {
1394
1510
  readonly enum: readonly ["FAIL", "USE_EXISTING", "TERMINATE_EXISTING"];
1395
1511
  };
1512
+ readonly fairnessKey: {
1513
+ readonly type: "string";
1514
+ readonly minLength: 1;
1515
+ readonly maxLength: 255;
1516
+ readonly description: "Phase C: the fairness key of the task (11 §2.11); default the workspace id.";
1517
+ };
1518
+ readonly fairnessWeight: {
1519
+ readonly type: "number";
1520
+ readonly minimum: 0.1;
1521
+ readonly maximum: 10;
1522
+ readonly description: "Phase C: the weight of the fairness key, 0.1 to 10 (default 1).";
1523
+ };
1396
1524
  };
1397
1525
  };
1398
1526
  readonly legacyCanRetryPolicy: {
@@ -1461,6 +1589,7 @@ declare const WORKFLOW_TASK_SCHEMA: {
1461
1589
  readonly additionalProperties: {
1462
1590
  readonly type: "string";
1463
1591
  };
1592
+ readonly description: "Interceptor headers (11 §2.10): string values; a user activity carries at most 16 KiB of JSON (checked by validateCommands).";
1464
1593
  };
1465
1594
  };
1466
1595
  };
@@ -1499,7 +1628,7 @@ declare const HISTORY_FILE_SCHEMA: {
1499
1628
  };
1500
1629
  readonly replay: {
1501
1630
  readonly type: "boolean";
1502
- readonly description: "False for histories that use Phase C features (updates); they are parsed and projected but not replayed.";
1631
+ readonly description: "False for histories that are parsed and projected but not replayed (written by hand for a feature the recording runtime did not have).";
1503
1632
  };
1504
1633
  readonly info: {
1505
1634
  readonly $ref: "#/$defs/info";
@@ -1670,6 +1799,21 @@ declare const HISTORY_FILE_SCHEMA: {
1670
1799
  readonly retry: {
1671
1800
  readonly $ref: "#/$defs/runRetryPolicy";
1672
1801
  };
1802
+ readonly searchAttributes: {
1803
+ readonly type: "object";
1804
+ };
1805
+ readonly fairnessKey: {
1806
+ readonly type: "string";
1807
+ readonly minLength: 1;
1808
+ readonly maxLength: 255;
1809
+ readonly description: "Phase C: the fairness key of the task (11 §2.11); default the workspace id.";
1810
+ };
1811
+ readonly fairnessWeight: {
1812
+ readonly type: "number";
1813
+ readonly minimum: 0.1;
1814
+ readonly maximum: 10;
1815
+ readonly description: "Phase C: the weight of the fairness key, 0.1 to 10 (default 1).";
1816
+ };
1673
1817
  };
1674
1818
  };
1675
1819
  readonly json: {
@@ -1924,6 +2068,18 @@ declare const HISTORY_FILE_SCHEMA: {
1924
2068
  readonly idConflictPolicy: {
1925
2069
  readonly enum: readonly ["FAIL", "USE_EXISTING", "TERMINATE_EXISTING"];
1926
2070
  };
2071
+ readonly fairnessKey: {
2072
+ readonly type: "string";
2073
+ readonly minLength: 1;
2074
+ readonly maxLength: 255;
2075
+ readonly description: "Phase C: the fairness key of the task (11 §2.11); default the workspace id.";
2076
+ };
2077
+ readonly fairnessWeight: {
2078
+ readonly type: "number";
2079
+ readonly minimum: 0.1;
2080
+ readonly maximum: 10;
2081
+ readonly description: "Phase C: the weight of the fairness key, 0.1 to 10 (default 1).";
2082
+ };
1927
2083
  };
1928
2084
  };
1929
2085
  readonly legacyCanRetryPolicy: {
@@ -1992,6 +2148,7 @@ declare const HISTORY_FILE_SCHEMA: {
1992
2148
  readonly additionalProperties: {
1993
2149
  readonly type: "string";
1994
2150
  };
2151
+ readonly description: "Interceptor headers (11 §2.10): string values; a user activity carries at most 16 KiB of JSON (checked by validateCommands).";
1995
2152
  };
1996
2153
  };
1997
2154
  };
@@ -2036,7 +2193,15 @@ interface HistoryIssue {
2036
2193
  * `retry` and anything outside {@link CORE_CAN_OPTIONS}.
2037
2194
  * - `parity.workflowIdTarget`: a `SIGNAL_RUN` or `REQUEST_CANCEL_EXTERNAL_RUN`
2038
2195
  * target given as `{ workflowKey, workflowId }`.
2039
- * - `c.*`: reserved for Phase C, never enabled in Phase B.
2196
+ * - `c.updates` (Phase C, `fluidgrids.run-control`): `ACCEPT_UPDATE`,
2197
+ * `REJECT_UPDATE` and `COMPLETE_UPDATE`.
2198
+ * - `c.searchAttributes` (Phase C, `fluidgrids.search-attributes`):
2199
+ * `UPSERT_SEARCH_ATTRIBUTES`.
2200
+ * - `c.userActivity` (Phase C, `fluidgrids.self-hosted-workers`): a
2201
+ * `SCHEDULE_ACTIVITY` of `kind: 'user'`.
2202
+ *
2203
+ * Phase B never enables a `c.*` feature, so a workspace without the Phase C
2204
+ * flags gets exactly the B19 command set (CX1).
2040
2205
  */
2041
2206
  type CommandFeature = 'core' | 'parity.can' | 'parity.context' | 'parity.localActivity' | 'parity.externalCancel' | 'parity.childOptions' | 'parity.canOptions' | 'parity.workflowIdTarget' | 'c.updates' | 'c.searchAttributes' | 'c.userActivity';
2042
2207
  /** Every feature, in a stable order. */
@@ -2045,13 +2210,32 @@ declare const COMMAND_FEATURES: readonly CommandFeature[];
2045
2210
  declare const PHASE_B_CORE_FEATURES: ReadonlySet<CommandFeature>;
2046
2211
  /** Every Phase B feature: the core set plus what `fluidgrids.durable-parity` enables. */
2047
2212
  declare const PHASE_B_PARITY_FEATURES: ReadonlySet<CommandFeature>;
2213
+ /** The Phase C features (C-GATE extension, C-R1). */
2214
+ declare const PHASE_C_FEATURES: readonly CommandFeature[];
2215
+ /**
2216
+ * The platform flag that enables each Phase C feature (PLAN-C §2.1). Each one
2217
+ * also needs `fluidgrids.code-first` and `fluidgrids.durable-functions`.
2218
+ */
2219
+ declare const PHASE_C_FEATURE_FLAGS: Readonly<Record<string, string>>;
2220
+ /**
2221
+ * The platform flag that each bundle feature (C-FEATURES, `code.features`)
2222
+ * needs. The service refuses a push that declares a feature whose flag is off
2223
+ * (`durableRuntimeIssues`). Features without an entry need no flag beyond
2224
+ * `fluidgrids.durable-functions`. `interceptors` is gated with run control so
2225
+ * that a Phase C bundle fails closed until its owner turns the flag on.
2226
+ */
2227
+ declare const CODE_FEATURE_FLAGS: Readonly<Record<string, string>>;
2228
+ /** The bundle features added in Phase C (C-FEATURES, C-R1), in a stable order. */
2229
+ declare const PHASE_C_CODE_FEATURES: readonly string[];
2048
2230
  /**
2049
2231
  * Child options a Phase B core child may carry: every option the R1 runtime
2050
2232
  * already wrote into `START_CHILD_RUN` and the Phase B service accepted (it
2051
2233
  * stored or ignored them). Only the options new in R2 (`retry`,
2052
2234
  * `versioningBehavior`, `idReusePolicy`, `idConflictPolicy`) need
2053
2235
  * `parity.childOptions`, so a Phase B workflow behaves the same with the
2054
- * parity flag off.
2236
+ * parity flag off. The fairness options (C-R1) need only
2237
+ * `fluidgrids.durable-functions` (CWD2): a service without the dispatcher
2238
+ * stores and ignores them.
2055
2239
  */
2056
2240
  declare const CORE_CHILD_OPTIONS: ReadonlySet<string>;
2057
2241
  /**
@@ -2096,24 +2280,38 @@ declare function isCommandEnabled(type: CommandType, enabled?: 'core' | 'parity'
2096
2280
  * True when every feature `command` needs is enabled. With a release level
2097
2281
  * (`core`, `parity`) it answers as R1 did: the command type decides, and
2098
2282
  * `REQUEST_CANCEL_EXTERNAL_RUN` aimed at one of the run's own children is
2099
- * core.
2283
+ * core. A command that needs a Phase C feature (`c.*`, for example a
2284
+ * `SCHEDULE_ACTIVITY` of kind `user`, whose type is core) is refused by every
2285
+ * release level, so the default gate fails closed.
2100
2286
  */
2101
2287
  declare function isWorkflowCommandEnabled(command: WorkflowCommand, enabled?: CommandGate): boolean;
2288
+ /**
2289
+ * The bundle features (C-FEATURES, `code.features` names) a command gate's
2290
+ * flags enable, sorted: a feature is enabled when its flag
2291
+ * ({@link CODE_FEATURE_FLAGS}) is on, and a flag is on when the gate holds a
2292
+ * command feature it enables (`fluidgrids.run-control` for `c.updates`,
2293
+ * `fluidgrids.durable-parity` for a parity feature outside the Phase B core
2294
+ * set). Release levels enable none.
2295
+ * It is what a lease sends as `WorkflowTaskRequest.features`.
2296
+ */
2297
+ declare function codeFeaturesEnabledBy(enabled: CommandGate): string[];
2102
2298
  /** Why a command is refused by the gate, naming the missing features. */
2103
2299
  declare function unsupportedMessage(command: WorkflowCommand, enabled?: CommandGate): string;
2104
2300
  /** What the lease of the current workflow task already granted (C-LEASE). */
2105
2301
  interface CommandRelief {
2106
2302
  /** Local activities the lease asked the worker to run (`localActivityRequested`). */
2107
2303
  grantedLocalActivityIds: readonly string[];
2108
- /** Updates the lease delivered to the task (Phase C). */
2304
+ /** Updates the lease delivered to the task (stamped with its `deliveredTaskId`, Phase C). */
2109
2305
  deliveredUpdateIds: readonly string[];
2110
2306
  }
2111
2307
  /**
2112
- * True for a command that answers work the lease already granted: a
2113
- * `RECORD_LOCAL_ACTIVITY` of a granted local activity, or an update reply to
2114
- * a delivered update. Such commands are accepted even when the flag that
2115
- * enables new requests of their kind is off (BP7), so turning a flag off never
2116
- * strands work that was already started.
2308
+ * True for a command that answers work the service already granted (BP7,
2309
+ * CX2): a `RECORD_LOCAL_ACTIVITY` of a granted local activity,
2310
+ * `ACCEPT_UPDATE` or `REJECT_UPDATE` of an update the lease delivered, and
2311
+ * every `COMPLETE_UPDATE` (it can only finish an update the run accepted,
2312
+ * which `eventsForCommands` checks against the history). Such commands are
2313
+ * accepted even when the flag that enables new requests of their kind is off,
2314
+ * so turning a flag off never strands work that was already started.
2117
2315
  */
2118
2316
  declare function isReliefCommand(command: WorkflowCommand, lease: CommandRelief): boolean;
2119
2317
 
@@ -2133,8 +2331,16 @@ type ActivityStatus = 'SCHEDULED' | 'STARTED' | 'COMPLETED' | 'FAILED' | 'TIMED_
2133
2331
  interface ActivityState {
2134
2332
  status: ActivityStatus;
2135
2333
  attempt: number;
2334
+ /** `node` (a canvas node operation) or `user` (a user activity, Phase C). */
2335
+ kind: 'node' | 'user';
2336
+ /** The node type; empty for a user activity. */
2136
2337
  nodeType: string;
2338
+ /** The node operation; empty for a user activity. */
2137
2339
  operation: string;
2340
+ /** The user activity's name (Phase C). */
2341
+ activityName?: string;
2342
+ /** The user activity's task queue (Phase C). */
2343
+ taskQueue?: string;
2138
2344
  scheduledSeq: number;
2139
2345
  cancellationType?: string;
2140
2346
  summary?: string;
@@ -2170,6 +2376,18 @@ interface ExternalState {
2170
2376
  status: 'PENDING' | 'RESOLVED';
2171
2377
  ok?: boolean;
2172
2378
  }
2379
+ /**
2380
+ * An update as history knows it (Phase C, 11 §2.39): `ADMITTED` (update-with-
2381
+ * start or a reset re-application, before the task accepted it), `ACCEPTED`
2382
+ * and `COMPLETED`. A rejected update leaves no event and is not here.
2383
+ */
2384
+ interface UpdateState {
2385
+ status: 'ADMITTED' | 'ACCEPTED' | 'COMPLETED';
2386
+ name: string;
2387
+ /** Seq of `UPDATE_ADMITTED` or `UPDATE_ACCEPTED`, whichever came first. */
2388
+ seq: number;
2389
+ failed?: boolean;
2390
+ }
2173
2391
  /** A run as its history describes it. */
2174
2392
  interface RunState {
2175
2393
  status: RunStatus;
@@ -2200,6 +2418,10 @@ interface RunState {
2200
2418
  markers: Record<string, Json>;
2201
2419
  signalsReceived: number;
2202
2420
  context: JsonObject;
2421
+ /** Updates by id (Phase C). */
2422
+ updates: Record<string, UpdateState>;
2423
+ /** Search attributes: the start's, merged with every upsert; null removes a key (Phase C). */
2424
+ searchAttributes: JsonObject;
2203
2425
  lastEventAt?: string;
2204
2426
  }
2205
2427
  /** A history that breaks the state machine (an event that cannot follow the ones before it). */
@@ -2209,6 +2431,8 @@ declare class HistoryStateError extends Error {
2209
2431
  }
2210
2432
  /** The state before any event. */
2211
2433
  declare function initialRunState(): RunState;
2434
+ /** Merge search attributes: a null value removes the attribute (11 §2.8). */
2435
+ declare function mergeSearchAttributes(current: JsonObject, entries: JsonObject): JsonObject;
2212
2436
  /** UTF-8 length of a string (the history byte caps count UTF-8). */
2213
2437
  declare function utf8Bytes(text: string): number;
2214
2438
  /** True while an activity may still produce a result. */
@@ -2237,6 +2461,17 @@ interface EventsForCommandsContext {
2237
2461
  enabled?: CommandGate;
2238
2462
  /** What the lease already granted; relief commands pass the gate (see `isReliefCommand`). */
2239
2463
  relief?: CommandRelief;
2464
+ /**
2465
+ * The pending updates the lease delivered, by id (C-ABI-H): `UPDATE_ACCEPTED`
2466
+ * carries the request from here. An update history already admitted
2467
+ * (`UPDATE_ADMITTED`) is found in the run state instead. An update reply
2468
+ * for an id in neither is `INVALID_REQUEST`.
2469
+ */
2470
+ updates?: Readonly<Record<string, {
2471
+ name: string;
2472
+ args?: Json;
2473
+ headers?: Record<string, string>;
2474
+ }>>;
2240
2475
  }
2241
2476
  type EventsForCommandsResult = {
2242
2477
  ok: true;
@@ -2305,4 +2540,4 @@ declare function createHistoryFile(workflowFn: string, events: RunEventRecord[],
2305
2540
  /** Serialise a history file the way the CLI and the fixtures write it. */
2306
2541
  declare function serializeHistoryFile(file: HistoryFile): string;
2307
2542
 
2308
- export { type ActivityState as A, continueAsNewRetryShape as B, type CommandGate as C, createHistoryFile as D, type EventsForCommandsContext as E, eventsForCommands as F, hasUnprocessedInput as G, type HistoryIssue as H, initialRunState as I, isActivityOpen as J, isChildOpen as K, type LocalActivityState as L, isCommandEnabled as M, isReliefCommand as N, isWorkflowCommandEnabled as O, PHASE_B_CORE_FEATURES as P, parseHistoryFile as Q, RUN_EVENT_SCHEMA as R, pendingCounts as S, type TimerState as T, projectRunState as U, serializeHistoryFile as V, WORKFLOW_COMMAND_SCHEMA as W, taskCompletedEvents as X, unsupportedMessage as Y, utf8Bytes as Z, type CommandRelief as a, type ActivityStatus as b, COMMAND_FEATURES as c, CORE_CAN_OPTIONS as d, CORE_CHILD_OPTIONS as e, type ChildState as f, type ChildStatus as g, type CommandFeature as h, type EventsForCommandsResult as i, type ExternalState as j, HISTORY_FILE_FORMAT as k, HISTORY_FILE_SCHEMA as l, HISTORY_FILE_SCHEMA_ID as m, HISTORY_SCHEMA_FILES as n, type HistoryFile as o, HistoryFileError as p, HistoryStateError as q, PHASE_B_PARITY_FEATURES as r, RUN_EVENT_SCHEMA_ID as s, type RunState as t, type RunStatus as u, WORKFLOW_COMMAND_SCHEMA_ID as v, WORKFLOW_TASK_SCHEMA as w, WORKFLOW_TASK_SCHEMA_ID as x, applyEvent as y, commandFeatures as z };
2543
+ export { pendingCounts as $, type ActivityState as A, WORKFLOW_TASK_SCHEMA as B, type CommandGate as C, WORKFLOW_TASK_SCHEMA_ID as D, type EventsForCommandsContext as E, applyEvent as F, codeFeaturesEnabledBy as G, type HistoryIssue as H, commandFeatures as I, continueAsNewRetryShape as J, createHistoryFile as K, type LocalActivityState as L, eventsForCommands as M, hasUnprocessedInput as N, initialRunState as O, PHASE_B_CORE_FEATURES as P, isActivityOpen as Q, RUN_EVENT_SCHEMA as R, isChildOpen as S, type TimerState as T, type UpdateState as U, isCommandEnabled as V, WORKFLOW_COMMAND_SCHEMA as W, isReliefCommand as X, isWorkflowCommandEnabled as Y, mergeSearchAttributes as Z, parseHistoryFile as _, type CommandRelief as a, projectRunState as a0, serializeHistoryFile as a1, taskCompletedEvents as a2, unsupportedMessage as a3, utf8Bytes as a4, type ActivityStatus as b, CODE_FEATURE_FLAGS as c, COMMAND_FEATURES as d, CORE_CAN_OPTIONS as e, CORE_CHILD_OPTIONS as f, type ChildState as g, type ChildStatus as h, type CommandFeature as i, type EventsForCommandsResult as j, type ExternalState as k, HISTORY_FILE_FORMAT as l, HISTORY_FILE_SCHEMA as m, HISTORY_FILE_SCHEMA_ID as n, HISTORY_SCHEMA_FILES as o, type HistoryFile as p, HistoryFileError as q, HistoryStateError as r, PHASE_B_PARITY_FEATURES as s, PHASE_C_CODE_FEATURES as t, PHASE_C_FEATURES as u, PHASE_C_FEATURE_FLAGS as v, RUN_EVENT_SCHEMA_ID as w, type RunState as x, type RunStatus as y, WORKFLOW_COMMAND_SCHEMA_ID as z };