@temporalio/core-bridge 1.9.2 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/Cargo.lock +754 -473
  2. package/Cargo.toml +3 -3
  3. package/lib/index.d.ts +33 -2
  4. package/lib/index.js.map +1 -1
  5. package/package.json +4 -4
  6. package/releases/aarch64-apple-darwin/index.node +0 -0
  7. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  8. package/releases/x86_64-apple-darwin/index.node +0 -0
  9. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  10. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  11. package/scripts/build.js +4 -3
  12. package/sdk-core/.cargo/config.toml +2 -4
  13. package/sdk-core/.github/workflows/heavy.yml +1 -1
  14. package/sdk-core/.github/workflows/per-pr.yml +6 -4
  15. package/sdk-core/Cargo.toml +10 -3
  16. package/sdk-core/README.md +4 -6
  17. package/sdk-core/client/Cargo.toml +13 -5
  18. package/sdk-core/client/src/lib.rs +123 -34
  19. package/sdk-core/client/src/metrics.rs +70 -18
  20. package/sdk-core/client/src/proxy.rs +85 -0
  21. package/sdk-core/client/src/raw.rs +67 -5
  22. package/sdk-core/client/src/worker_registry/mod.rs +5 -3
  23. package/sdk-core/client/src/workflow_handle/mod.rs +3 -1
  24. package/sdk-core/core/Cargo.toml +31 -37
  25. package/sdk-core/core/src/abstractions/take_cell.rs +3 -3
  26. package/sdk-core/core/src/abstractions.rs +176 -108
  27. package/sdk-core/core/src/core_tests/activity_tasks.rs +4 -13
  28. package/sdk-core/core/src/core_tests/determinism.rs +2 -1
  29. package/sdk-core/core/src/core_tests/local_activities.rs +3 -3
  30. package/sdk-core/core/src/core_tests/mod.rs +3 -3
  31. package/sdk-core/core/src/core_tests/queries.rs +42 -5
  32. package/sdk-core/core/src/core_tests/workers.rs +2 -3
  33. package/sdk-core/core/src/core_tests/workflow_tasks.rs +115 -15
  34. package/sdk-core/core/src/ephemeral_server/mod.rs +109 -136
  35. package/sdk-core/core/src/internal_flags.rs +8 -8
  36. package/sdk-core/core/src/lib.rs +16 -11
  37. package/sdk-core/core/src/pollers/mod.rs +11 -5
  38. package/sdk-core/core/src/pollers/poll_buffer.rs +48 -29
  39. package/sdk-core/core/src/protosext/mod.rs +32 -32
  40. package/sdk-core/core/src/protosext/protocol_messages.rs +14 -24
  41. package/sdk-core/core/src/retry_logic.rs +2 -2
  42. package/sdk-core/core/src/telemetry/log_export.rs +10 -9
  43. package/sdk-core/core/src/telemetry/metrics.rs +233 -330
  44. package/sdk-core/core/src/telemetry/mod.rs +11 -38
  45. package/sdk-core/core/src/telemetry/otel.rs +355 -0
  46. package/sdk-core/core/src/telemetry/prometheus_server.rs +36 -23
  47. package/sdk-core/core/src/test_help/mod.rs +80 -59
  48. package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +6 -6
  49. package/sdk-core/core/src/worker/activities/local_activities.rs +46 -43
  50. package/sdk-core/core/src/worker/activities.rs +45 -46
  51. package/sdk-core/core/src/worker/client/mocks.rs +8 -7
  52. package/sdk-core/core/src/worker/client.rs +40 -39
  53. package/sdk-core/core/src/worker/mod.rs +72 -42
  54. package/sdk-core/core/src/worker/slot_provider.rs +28 -28
  55. package/sdk-core/core/src/worker/slot_supplier.rs +1 -0
  56. package/sdk-core/core/src/worker/tuner/fixed_size.rs +52 -0
  57. package/sdk-core/core/src/worker/tuner/resource_based.rs +561 -0
  58. package/sdk-core/core/src/worker/tuner.rs +122 -0
  59. package/sdk-core/core/src/worker/workflow/driven_workflow.rs +6 -6
  60. package/sdk-core/core/src/worker/workflow/history_update.rs +27 -53
  61. package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +4 -17
  62. package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -10
  63. package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +4 -11
  64. package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +17 -35
  65. package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +0 -8
  66. package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +1 -5
  67. package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +0 -5
  68. package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +0 -5
  69. package/sdk-core/core/src/worker/workflow/machines/mod.rs +0 -14
  70. package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +0 -5
  71. package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +0 -5
  72. package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -10
  73. package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +3 -10
  74. package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +12 -8
  75. package/sdk-core/core/src/worker/workflow/machines/update_state_machine.rs +0 -10
  76. package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +6 -13
  77. package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +27 -37
  78. package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +3 -14
  79. package/sdk-core/core/src/worker/workflow/managed_run.rs +84 -54
  80. package/sdk-core/core/src/worker/workflow/mod.rs +63 -160
  81. package/sdk-core/core/src/worker/workflow/run_cache.rs +22 -13
  82. package/sdk-core/core/src/worker/workflow/wft_extraction.rs +16 -3
  83. package/sdk-core/core/src/worker/workflow/wft_poller.rs +15 -12
  84. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +39 -78
  85. package/sdk-core/core-api/Cargo.toml +6 -5
  86. package/sdk-core/core-api/src/errors.rs +8 -0
  87. package/sdk-core/core-api/src/telemetry/metrics.rs +75 -4
  88. package/sdk-core/core-api/src/telemetry.rs +7 -1
  89. package/sdk-core/core-api/src/worker.rs +212 -56
  90. package/sdk-core/fsm/Cargo.toml +3 -0
  91. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
  92. package/sdk-core/sdk/Cargo.toml +5 -7
  93. package/sdk-core/sdk/src/app_data.rs +3 -3
  94. package/sdk-core/sdk/src/lib.rs +5 -3
  95. package/sdk-core/sdk/src/workflow_context/options.rs +1 -1
  96. package/sdk-core/sdk/src/workflow_context.rs +10 -9
  97. package/sdk-core/sdk/src/workflow_future.rs +1 -1
  98. package/sdk-core/sdk-core-protos/Cargo.toml +8 -6
  99. package/sdk-core/sdk-core-protos/build.rs +1 -10
  100. package/sdk-core/sdk-core-protos/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +3 -0
  101. package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/ci.yml +26 -0
  102. package/sdk-core/sdk-core-protos/protos/api_upstream/Makefile +42 -20
  103. package/sdk-core/sdk-core-protos/protos/api_upstream/README.md +2 -0
  104. package/sdk-core/sdk-core-protos/protos/api_upstream/api-linter.yaml +36 -26
  105. package/sdk-core/sdk-core-protos/protos/api_upstream/buf.lock +2 -0
  106. package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/struct.proto +95 -0
  107. package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +9632 -0
  108. package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +7337 -0
  109. package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/payload_description.txt +2 -0
  110. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/command/v1/message.proto +45 -11
  111. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +22 -4
  112. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/command_type.proto +2 -0
  113. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/common.proto +44 -0
  114. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/event_type.proto +18 -3
  115. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +20 -0
  116. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +30 -0
  117. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/update.proto +7 -8
  118. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/workflow.proto +23 -5
  119. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/errordetails/v1/message.proto +20 -0
  120. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/failure/v1/message.proto +25 -0
  121. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +141 -15
  122. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/namespace/v1/message.proto +12 -0
  123. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +193 -0
  124. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +73 -6
  125. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +46 -4
  126. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/schedule/v1/message.proto +4 -0
  127. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +2 -2
  128. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +116 -0
  129. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +134 -0
  130. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +274 -29
  131. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +57 -1
  132. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +10 -12
  133. package/sdk-core/sdk-core-protos/src/history_builder.rs +1 -1
  134. package/sdk-core/sdk-core-protos/src/lib.rs +54 -51
  135. package/sdk-core/sdk-core-protos/src/task_token.rs +11 -2
  136. package/sdk-core/test-utils/Cargo.toml +7 -4
  137. package/sdk-core/test-utils/src/histfetch.rs +1 -1
  138. package/sdk-core/test-utils/src/lib.rs +44 -62
  139. package/sdk-core/tests/fuzzy_workflow.rs +5 -2
  140. package/sdk-core/tests/heavy_tests.rs +114 -17
  141. package/sdk-core/tests/integ_tests/activity_functions.rs +1 -1
  142. package/sdk-core/tests/integ_tests/client_tests.rs +2 -2
  143. package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +38 -26
  144. package/sdk-core/tests/integ_tests/metrics_tests.rs +126 -17
  145. package/sdk-core/tests/integ_tests/polling_tests.rs +118 -2
  146. package/sdk-core/tests/integ_tests/update_tests.rs +3 -5
  147. package/sdk-core/tests/integ_tests/visibility_tests.rs +3 -3
  148. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +1 -1
  149. package/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +1 -1
  150. package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -1
  151. package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
  152. package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +3 -3
  153. package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +5 -4
  154. package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -2
  155. package/sdk-core/tests/integ_tests/workflow_tests/eager.rs +6 -10
  156. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +9 -7
  157. package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +1 -1
  158. package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +14 -9
  159. package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -1
  160. package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +6 -13
  161. package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +9 -6
  162. package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +5 -5
  163. package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +1 -1
  164. package/sdk-core/tests/integ_tests/workflow_tests.rs +115 -11
  165. package/sdk-core/tests/main.rs +2 -2
  166. package/src/conversions.rs +57 -0
  167. package/src/lib.rs +1 -0
  168. package/src/runtime.rs +51 -35
  169. package/ts/index.ts +67 -3
  170. package/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +0 -117
  171. package/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +0 -24
  172. package/sdk-core/sdk/src/payload_converter.rs +0 -11
  173. package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/Dockerfile +0 -2
  174. package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/docker-compose.yml +0 -15
  175. package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/pipeline.yml +0 -10
  176. package/sdk-core/test-utils/src/wf_input_saver.rs +0 -50
  177. package/sdk-core/tests/wf_input_replay.rs +0 -32
@@ -0,0 +1,2 @@
1
+ Arbitrary payload data in an unconstrained format.
2
+ This may be activity input parameters, a workflow result, a memo, etc.
@@ -81,10 +81,9 @@ message ScheduleActivityTaskCommandAttributes {
81
81
  // Request to start the activity directly bypassing matching service and worker polling
82
82
  // The slot for executing the activity should be reserved when setting this field to true.
83
83
  bool request_eager_execution = 12;
84
- // If this is set, the workflow executing this command wishes to start the activity using
85
- // a version compatible with the version that this workflow most recently ran on, if such
86
- // behavior is possible.
87
- bool use_compatible_version = 13;
84
+ // If this is set, the activity would be assigned to the Build ID of the workflow. Otherwise,
85
+ // Assignment rules of the activity's Task Queue will be used to determine the Build ID.
86
+ bool use_workflow_build_id = 13;
88
87
  }
89
88
 
90
89
  message RequestCancelActivityTaskCommandAttributes {
@@ -193,9 +192,9 @@ message ContinueAsNewWorkflowExecutionCommandAttributes {
193
192
  temporal.api.common.v1.Header header = 12;
194
193
  temporal.api.common.v1.Memo memo = 13;
195
194
  temporal.api.common.v1.SearchAttributes search_attributes = 14;
196
- // If this is set, the workflow executing this command wishes to continue as new using a version
197
- // compatible with the version that this workflow most recently ran on.
198
- bool use_compatible_version = 15;
195
+ // If this is set, the new execution inherits the Build ID of the current execution. Otherwise,
196
+ // the assignment rules will be used to independently assign a Build ID to the new execution.
197
+ bool inherit_build_id = 15;
199
198
 
200
199
  // `workflow_execution_timeout` is omitted as it shouldn't be overridden from within a workflow.
201
200
  }
@@ -223,10 +222,9 @@ message StartChildWorkflowExecutionCommandAttributes {
223
222
  temporal.api.common.v1.Header header = 14;
224
223
  temporal.api.common.v1.Memo memo = 15;
225
224
  temporal.api.common.v1.SearchAttributes search_attributes = 16;
226
- // If this is set, the workflow executing this command wishes to start the child workflow using
227
- // a version compatible with the version that this workflow most recently ran on, if such
228
- // behavior is possible.
229
- bool use_compatible_version = 17;
225
+ // If this is set, the child workflow inherits the Build ID of the parent. Otherwise, the assignment
226
+ // rules of the child's Task Queue will be used to independently assign a Build ID to it.
227
+ bool inherit_build_id = 17;
230
228
  }
231
229
 
232
230
  message ProtocolMessageCommandAttributes {
@@ -234,6 +232,39 @@ message ProtocolMessageCommandAttributes {
234
232
  string message_id = 1;
235
233
  }
236
234
 
235
+ message ScheduleNexusOperationCommandAttributes {
236
+ // Endpoint name, must exist in the endpoint registry or this command will fail.
237
+ string endpoint = 1;
238
+ // Service name.
239
+ string service = 2;
240
+ // Operation name.
241
+ string operation = 3;
242
+ // Input for the operation. The server converts this into Nexus request content and the appropriate content headers
243
+ // internally when sending the StartOperation request. On the handler side, if it is also backed by Temporal, the
244
+ // content is transformed back to the original Payload sent in this command.
245
+ temporal.api.common.v1.Payload input = 4;
246
+ // Schedule-to-close timeout for this operation.
247
+ // Indicates how long the caller is willing to wait for operation completion.
248
+ // Calls are retried internally by the server.
249
+ // (-- api-linter: core::0140::prepositions=disabled
250
+ // aip.dev/not-precedent: "to" is used to indicate interval. --)
251
+ google.protobuf.Duration schedule_to_close_timeout = 5;
252
+
253
+ // Header to attach to the Nexus request.
254
+ // Users are responsible for encrypting sensitive data in this header as it is stored in workflow history and
255
+ // transmitted to external services as-is.
256
+ // This is useful for propagating tracing information.
257
+ // Note these headers are not the same as Temporal headers on internal activities and child workflows, these are
258
+ // transmitted to Nexus operations that may be external and are not traditional payloads.
259
+ map<string, string> nexus_header = 6;
260
+ }
261
+
262
+ message RequestCancelNexusOperationCommandAttributes {
263
+ // The `NEXUS_OPERATION_SCHEDULED` event ID (a unique identifier) for the operation to be canceled.
264
+ // The operation may ignore cancellation and end up with any completion state.
265
+ int64 scheduled_event_id = 1;
266
+ }
267
+
237
268
  message Command {
238
269
  temporal.api.enums.v1.CommandType command_type = 1;
239
270
  oneof attributes {
@@ -253,5 +284,8 @@ message Command {
253
284
  ProtocolMessageCommandAttributes protocol_message_command_attributes = 15;
254
285
  // 16 is available for use - it was used as part of a prototype that never made it into a release
255
286
  ModifyWorkflowPropertiesCommandAttributes modify_workflow_properties_command_attributes = 17;
287
+
288
+ ScheduleNexusOperationCommandAttributes schedule_nexus_operation_command_attributes = 18;
289
+ RequestCancelNexusOperationCommandAttributes request_cancel_nexus_operation_command_attributes = 19;
256
290
  }
257
291
  }
@@ -127,13 +127,12 @@ message WorkerVersionStamp {
127
127
  // An opaque whole-worker identifier. Replaces the deprecated `binary_checksum` field when this
128
128
  // message is included in requests which previously used that.
129
129
  string build_id = 1;
130
- // Set if the worker used a dynamically loadable bundle to process
131
- // the task. The bundle could be a WASM blob, JS bundle, etc.
132
- string bundle_id = 2;
133
130
 
134
131
  // If set, the worker is opting in to worker versioning. Otherwise, this is used only as a
135
132
  // marker for workflow reset points and the BuildIDs search attribute.
136
133
  bool use_versioning = 3;
134
+
135
+ // Later, may include bundle id that could be used for WASM and/or JS dynamically loadable bundles.
137
136
  }
138
137
 
139
138
  // Identifies the version(s) that a worker is compatible with when polling or identifying itself,
@@ -171,10 +170,29 @@ message ResetOptions {
171
170
  string build_id = 4;
172
171
  }
173
172
 
174
- // History event reapply options.
173
+ // Event types to be reapplied (deprecated)
174
+ // Default: RESET_REAPPLY_TYPE_SIGNAL
175
175
  temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 10;
176
176
 
177
177
  // If true, limit the reset to only within the current run. (Applies to build_id targets and
178
178
  // possibly others in the future.)
179
179
  bool current_run_only = 11;
180
+
181
+ // Event types not to be reapplied
182
+ repeated temporal.api.enums.v1.ResetReapplyExcludeType reset_reapply_exclude_types = 12;
180
183
  }
184
+
185
+ // Callback to attach to various events in the system, e.g. workflow run completion.
186
+ message Callback {
187
+ message Nexus {
188
+ // Callback URL.
189
+ string url = 1;
190
+ // Header to attach to callback request.
191
+ map<string, string> header = 2;
192
+ }
193
+
194
+ reserved 1; // For a generic callback mechanism to be added later.
195
+ oneof variant {
196
+ Nexus nexus = 2;
197
+ }
198
+ }
@@ -49,4 +49,6 @@ enum CommandType {
49
49
  COMMAND_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES = 13;
50
50
  COMMAND_TYPE_PROTOCOL_MESSAGE = 14;
51
51
  COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES = 16;
52
+ COMMAND_TYPE_SCHEDULE_NEXUS_OPERATION = 17;
53
+ COMMAND_TYPE_REQUEST_CANCEL_NEXUS_OPERATION = 18;
52
54
  }
@@ -54,3 +54,47 @@ enum Severity {
54
54
  SEVERITY_MEDIUM = 2;
55
55
  SEVERITY_LOW = 3;
56
56
  }
57
+
58
+ // State of a callback.
59
+ enum CallbackState {
60
+ // Default value, unspecified state.
61
+ CALLBACK_STATE_UNSPECIFIED = 0;
62
+ // Callback is standing by, waiting to be triggered.
63
+ CALLBACK_STATE_STANDBY = 1;
64
+ // Callback is in the queue waiting to be executed or is currently executing.
65
+ CALLBACK_STATE_SCHEDULED = 2;
66
+ // Callback has failed with a retryable error and is backing off before the next attempt.
67
+ CALLBACK_STATE_BACKING_OFF = 3;
68
+ // Callback has failed.
69
+ CALLBACK_STATE_FAILED = 4;
70
+ // Callback has succeeded.
71
+ CALLBACK_STATE_SUCCEEDED = 5;
72
+ }
73
+
74
+ // State of a pending Nexus operation.
75
+ enum PendingNexusOperationState {
76
+ // Default value, unspecified state.
77
+ PENDING_NEXUS_OPERATION_STATE_UNSPECIFIED = 0;
78
+ // Operation is in the queue waiting to be executed or is currently executing.
79
+ PENDING_NEXUS_OPERATION_STATE_SCHEDULED = 1;
80
+ // Operation has failed with a retryable error and is backing off before the next attempt.
81
+ PENDING_NEXUS_OPERATION_STATE_BACKING_OFF = 2;
82
+ // Operation was started and will complete asynchronously.
83
+ PENDING_NEXUS_OPERATION_STATE_STARTED = 3;
84
+ }
85
+
86
+ // State of a Nexus operation cancellation.
87
+ enum NexusOperationCancellationState {
88
+ // Default value, unspecified state.
89
+ NEXUS_OPERATION_CANCELLATION_STATE_UNSPECIFIED = 0;
90
+ // Cancellation request is in the queue waiting to be executed or is currently executing.
91
+ NEXUS_OPERATION_CANCELLATION_STATE_SCHEDULED = 1;
92
+ // Cancellation request has failed with a retryable error and is backing off before the next attempt.
93
+ NEXUS_OPERATION_CANCELLATION_STATE_BACKING_OFF = 2;
94
+ // Cancellation request succeeded.
95
+ NEXUS_OPERATION_CANCELLATION_STATE_SUCCEEDED = 3;
96
+ // Cancellation request failed with a non-retryable error.
97
+ NEXUS_OPERATION_CANCELLATION_STATE_FAILED = 4;
98
+ // The associated operation timed out - exceeded the user supplied schedule-to-close timeout.
99
+ NEXUS_OPERATION_CANCELLATION_STATE_TIMED_OUT = 5;
100
+ }
@@ -167,8 +167,23 @@ enum EventType {
167
167
  EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY = 45;
168
168
  // Workflow properties modified by user workflow code
169
169
  EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED = 46;
170
- // An update was requested. Note that not all update requests result in this
171
- // event. See UpdateRequestedEventOrigin for situations in which this event
170
+ // An update was admitted. Note that not all admitted updates result in this
171
+ // event. See UpdateAdmittedEventOrigin for situations in which this event
172
172
  // is created.
173
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REQUESTED = 47;
173
+ EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ADMITTED = 47;
174
+
175
+ // A Nexus operation was scheduled using a ScheduleNexusOperation command.
176
+ EVENT_TYPE_NEXUS_OPERATION_SCHEDULED = 48;
177
+ // An asynchronous Nexus operation was started by a Nexus handler.
178
+ EVENT_TYPE_NEXUS_OPERATION_STARTED = 49;
179
+ // A Nexus operation completed successfully.
180
+ EVENT_TYPE_NEXUS_OPERATION_COMPLETED = 50;
181
+ // A Nexus operation failed.
182
+ EVENT_TYPE_NEXUS_OPERATION_FAILED = 51;
183
+ // A Nexus operation completed as canceled.
184
+ EVENT_TYPE_NEXUS_OPERATION_CANCELED = 52;
185
+ // A Nexus operation timed out.
186
+ EVENT_TYPE_NEXUS_OPERATION_TIMED_OUT = 53;
187
+ // A Nexus operation was requested to be canceled using a RequestCancelNexusOperation command.
188
+ EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUESTED = 54;
174
189
  }
@@ -90,6 +90,17 @@ enum WorkflowTaskFailedCause {
90
90
  WORKFLOW_TASK_FAILED_CAUSE_BAD_UPDATE_WORKFLOW_EXECUTION_MESSAGE = 30;
91
91
  // Similar to WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND, but for updates.
92
92
  WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_UPDATE = 31;
93
+
94
+ // A workflow task completed with an invalid ScheduleNexusOperation command.
95
+ WORKFLOW_TASK_FAILED_CAUSE_BAD_SCHEDULE_NEXUS_OPERATION_ATTRIBUTES = 32;
96
+ // A workflow task completed requesting to schedule a Nexus Operation exceeding the server configured limit.
97
+ WORKFLOW_TASK_FAILED_CAUSE_PENDING_NEXUS_OPERATIONS_LIMIT_EXCEEDED = 33;
98
+ // A workflow task completed with an invalid RequestCancelNexusOperation command.
99
+ WORKFLOW_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_NEXUS_OPERATION_ATTRIBUTES = 34;
100
+ // A workflow task completed requesting a feature that's disabled on the server (either system wide or - typically -
101
+ // for the workflow's namespace).
102
+ // Check the workflow task failure message for more information.
103
+ WORKFLOW_TASK_FAILED_CAUSE_FEATURE_DISABLED = 35;
93
104
  }
94
105
 
95
106
  enum StartChildWorkflowExecutionFailedCause {
@@ -127,3 +138,12 @@ enum ResourceExhaustedCause {
127
138
  // Caller exceeds action per second limit.
128
139
  RESOURCE_EXHAUSTED_CAUSE_APS_LIMIT = 6;
129
140
  }
141
+
142
+ enum ResourceExhaustedScope {
143
+ RESOURCE_EXHAUSTED_SCOPE_UNSPECIFIED = 0;
144
+ // Exhausted resource is a system-level resource.
145
+ RESOURCE_EXHAUSTED_SCOPE_NAMESPACE = 1;
146
+ // Exhausted resource is a namespace-level resource.
147
+ RESOURCE_EXHAUSTED_SCOPE_SYSTEM = 2;
148
+ }
149
+
@@ -56,10 +56,13 @@ enum TaskQueueType {
56
56
  TASK_QUEUE_TYPE_WORKFLOW = 1;
57
57
  // Activity type of task queue.
58
58
  TASK_QUEUE_TYPE_ACTIVITY = 2;
59
+ // Task queue type for dispatching Nexus requests.
60
+ TASK_QUEUE_TYPE_NEXUS = 3;
59
61
  }
60
62
 
61
63
  // Specifies which category of tasks may reach a worker on a versioned task queue.
62
64
  // Used both in a reachability query and its response.
65
+ // Deprecated.
63
66
  enum TaskReachability {
64
67
  TASK_REACHABILITY_UNSPECIFIED = 0;
65
68
  // There's a possiblity for a worker to receive new workflow tasks. Workers should *not* be retired.
@@ -76,3 +79,30 @@ enum TaskReachability {
76
79
  TASK_REACHABILITY_CLOSED_WORKFLOWS = 4;
77
80
  }
78
81
 
82
+ // Specifies which category of tasks may reach a versioned worker of a certain Build ID.
83
+ // Note: future activities who inherit their workflow's Build ID but not its Task Queue will not be
84
+ // accounted for reachability as server cannot not know if they'll happen as they do not use
85
+ // assignment rules of their Task Queue. Same goes for Child Workflows or Continue-As-New Workflows
86
+ // who inherit the parent/previous workflow's Build ID but not its Task Queue. In those cases, make
87
+ // sure to query reachability for the parent/previous workflow's Task Queue as well.
88
+ enum BuildIdTaskReachability {
89
+ // Task reachability is not reported
90
+ BUILD_ID_TASK_REACHABILITY_UNSPECIFIED = 0;
91
+ // Build ID may be used by new workflows or activities (base on versioning rules), or there are
92
+ // open workflows or backlogged activities assigned to it.
93
+ BUILD_ID_TASK_REACHABILITY_REACHABLE = 1;
94
+ // Build ID does not have open workflows and is not reachable by new workflows,
95
+ // but MAY have closed workflows within the namespace retention period.
96
+ // Not applicable to activity-only task queues.
97
+ BUILD_ID_TASK_REACHABILITY_CLOSED_WORKFLOWS_ONLY = 2;
98
+ // Build ID is not used for new executions, nor it has been used by any existing execution
99
+ // within the retention period.
100
+ BUILD_ID_TASK_REACHABILITY_UNREACHABLE = 3;
101
+ }
102
+
103
+ enum DescribeTaskQueueMode {
104
+ // Unspecified means legacy behavior.
105
+ DESCRIBE_TASK_QUEUE_MODE_UNSPECIFIED = 0;
106
+ // Enhanced mode reports aggregated results for all partitions, supports Build IDs, and reports richer info.
107
+ DESCRIBE_TASK_QUEUE_MODE_ENHANCED = 1;
108
+ }
@@ -55,13 +55,12 @@ enum UpdateWorkflowExecutionLifecycleStage {
55
55
  UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED = 3;
56
56
  }
57
57
 
58
- // UpdateRequestedEventOrigin records why an
59
- // WorkflowExecutionUpdateRequestedEvent was written to history. Note that not
60
- // all update requests result in a WorkflowExecutionUpdateRequestedEvent.
61
- enum UpdateRequestedEventOrigin {
62
- UPDATE_REQUESTED_EVENT_ORIGIN_UNSPECIFIED = 0;
63
- // The UpdateRequested event was created when reapplying events during reset
58
+ // Records why a WorkflowExecutionUpdateAdmittedEvent was written to history.
59
+ // Note that not all admitted updates result in this event.
60
+ enum UpdateAdmittedEventOrigin {
61
+ UPDATE_ADMITTED_EVENT_ORIGIN_UNSPECIFIED = 0;
62
+ // The UpdateAdmitted event was created when reapplying events during reset
64
63
  // or replication. I.e. an accepted update on one branch of workflow history
65
- // was converted into a requested update on a different branch.
66
- UPDATE_REQUESTED_EVENT_ORIGIN_REAPPLY = 1;
64
+ // was converted into an admitted update on a different branch.
65
+ UPDATE_ADMITTED_EVENT_ORIGIN_REAPPLY = 1;
67
66
  }
@@ -31,8 +31,10 @@ option java_outer_classname = "WorkflowProto";
31
31
  option ruby_package = "Temporalio::Api::Enums::V1";
32
32
  option csharp_namespace = "Temporalio.Api.Enums.V1";
33
33
 
34
- // Defines how new runs of a workflow with a particular ID may or may not be allowed. Note that
35
- // it is *never* valid to have two actively running instances of the same workflow id.
34
+ // Defines whether to allow re-using a workflow id from a previously *closed* workflow.
35
+ // If the request is denied, a `WorkflowExecutionAlreadyStartedFailure` is returned.
36
+ //
37
+ // See `WorkflowIdConflictPolicy` for handling workflow id duplication with a *running* workflow.
36
38
  enum WorkflowIdReusePolicy {
37
39
  WORKFLOW_ID_REUSE_POLICY_UNSPECIFIED = 0;
38
40
  // Allow starting a workflow execution using the same workflow id.
@@ -43,11 +45,27 @@ enum WorkflowIdReusePolicy {
43
45
  // Do not permit re-use of the workflow id for this workflow. Future start workflow requests
44
46
  // could potentially change the policy, allowing re-use of the workflow id.
45
47
  WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE = 3;
46
- // If a workflow is running using the same workflow ID, terminate it and start a new one.
47
- // If no running workflow, then the behavior is the same as ALLOW_DUPLICATE
48
+ // This option belongs in WorkflowIdConflictPolicy but is here for backwards compatibility.
49
+ // If specified, it acts like ALLOW_DUPLICATE, but also the WorkflowId*Conflict*Policy on
50
+ // the request is treated as WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING.
51
+ // If no running workflow, then the behavior is the same as ALLOW_DUPLICATE.
48
52
  WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING = 4;
49
53
  }
50
54
 
55
+ // Defines what to do when trying to start a workflow with the same workflow id as a *running* workflow.
56
+ // Note that it is *never* valid to have two actively running instances of the same workflow id.
57
+ //
58
+ // See `WorkflowIdReusePolicy` for handling workflow id duplication with a *closed* workflow.
59
+ enum WorkflowIdConflictPolicy {
60
+ WORKFLOW_ID_CONFLICT_POLICY_UNSPECIFIED = 0;
61
+ // Don't start a new workflow; instead return `WorkflowExecutionAlreadyStartedFailure`.
62
+ WORKFLOW_ID_CONFLICT_POLICY_FAIL = 1;
63
+ // Don't start a new workflow; instead return a workflow handle for the running workflow.
64
+ WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING = 2;
65
+ // Terminate the running workflow before starting a new one.
66
+ WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING = 3;
67
+ }
68
+
51
69
  // Defines how child workflows will react to their parent completing
52
70
  enum ParentClosePolicy {
53
71
  PARENT_CLOSE_POLICY_UNSPECIFIED = 0;
@@ -119,4 +137,4 @@ enum TimeoutType {
119
137
  TIMEOUT_TYPE_SCHEDULE_TO_START = 2;
120
138
  TIMEOUT_TYPE_SCHEDULE_TO_CLOSE = 3;
121
139
  TIMEOUT_TYPE_HEARTBEAT = 4;
122
- }
140
+ }
@@ -34,6 +34,7 @@ option java_outer_classname = "MessageProto";
34
34
  option ruby_package = "Temporalio::Api::ErrorDetails::V1";
35
35
  option csharp_namespace = "Temporalio.Api.ErrorDetails.V1";
36
36
 
37
+ import "google/protobuf/any.proto";
37
38
  import "temporal/api/common/v1/message.proto";
38
39
 
39
40
  import "temporal/api/enums/v1/failed_cause.proto";
@@ -94,6 +95,7 @@ message PermissionDeniedFailure {
94
95
 
95
96
  message ResourceExhaustedFailure {
96
97
  temporal.api.enums.v1.ResourceExhaustedCause cause = 1;
98
+ temporal.api.enums.v1.ResourceExhaustedScope scope = 2;
97
99
  }
98
100
 
99
101
  message SystemWorkflowFailure {
@@ -111,3 +113,21 @@ message NewerBuildExistsFailure {
111
113
  // The current default compatible build ID which will receive tasks
112
114
  string default_build_id = 1;
113
115
  }
116
+
117
+ message MultiOperationExecutionFailure {
118
+ // One status for each requested operation from the failed MultiOperation. The failed
119
+ // operation(s) have the same error details as if it was executed separately. All other operations have the
120
+ // status code `Aborted` and `MultiOperationExecutionAborted` is added to the details field.
121
+ repeated OperationStatus statuses = 1;
122
+
123
+ // NOTE: `OperationStatus` is modelled after
124
+ // [`google.rpc.Status`](https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto).
125
+ //
126
+ // (-- api-linter: core::0146::any=disabled
127
+ // aip.dev/not-precedent: details are meant to hold arbitrary payloads. --)
128
+ message OperationStatus {
129
+ int32 code = 1;
130
+ string message = 2;
131
+ repeated google.protobuf.Any details = 3;
132
+ }
133
+ }
@@ -34,10 +34,19 @@ option csharp_namespace = "Temporalio.Api.Failure.V1";
34
34
  import "temporal/api/common/v1/message.proto";
35
35
  import "temporal/api/enums/v1/workflow.proto";
36
36
 
37
+ import "google/protobuf/duration.proto";
38
+
37
39
  message ApplicationFailureInfo {
38
40
  string type = 1;
39
41
  bool non_retryable = 2;
40
42
  temporal.api.common.v1.Payloads details = 3;
43
+ // next_retry_delay can be used by the client to override the activity
44
+ // retry interval calculated by the retry policy. Retry attempts will
45
+ // still be subject to the maximum retries limit and total time limit
46
+ // defined by the policy.
47
+ // ATTENTION: this value will be ignored if set for failures produced by
48
+ // the workflow.
49
+ google.protobuf.Duration next_retry_delay = 4;
41
50
  }
42
51
 
43
52
  message TimeoutFailureInfo {
@@ -78,6 +87,19 @@ message ChildWorkflowExecutionFailureInfo {
78
87
  temporal.api.enums.v1.RetryState retry_state = 6;
79
88
  }
80
89
 
90
+ message NexusOperationFailureInfo {
91
+ // The NexusOperationScheduled event ID.
92
+ int64 scheduled_event_id = 1;
93
+ // Endpoint name.
94
+ string endpoint = 2;
95
+ // Service name.
96
+ string service = 3;
97
+ // Operation name.
98
+ string operation = 4;
99
+ // Operation ID - may be empty if the operation completed synchronously.
100
+ string operation_id = 5;
101
+ }
102
+
81
103
  message Failure {
82
104
  string message = 1;
83
105
  // The source this Failure originated in, e.g. TypeScriptSDK / JavaSDK
@@ -110,5 +132,8 @@ message Failure {
110
132
  ResetWorkflowFailureInfo reset_workflow_failure_info = 10;
111
133
  ActivityFailureInfo activity_failure_info = 11;
112
134
  ChildWorkflowExecutionFailureInfo child_workflow_execution_failure_info = 12;
135
+ NexusOperationFailureInfo nexus_operation_execution_failure_info = 13;
113
136
  }
114
137
  }
138
+
139
+ message MultiOperationExecutionAborted {}