@temporalio/core-bridge 1.11.2 → 1.11.4

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 (119) hide show
  1. package/Cargo.lock +396 -489
  2. package/Cargo.toml +3 -2
  3. package/lib/errors.d.ts +2 -0
  4. package/lib/errors.js +7 -3
  5. package/lib/errors.js.map +1 -1
  6. package/lib/index.d.ts +8 -2
  7. package/lib/index.js.map +1 -1
  8. package/lib/worker-tuner.d.ts +111 -1
  9. package/package.json +3 -3
  10. package/releases/aarch64-apple-darwin/index.node +0 -0
  11. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  12. package/releases/x86_64-apple-darwin/index.node +0 -0
  13. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  14. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  15. package/sdk-core/.github/workflows/per-pr.yml +3 -3
  16. package/sdk-core/Cargo.toml +0 -1
  17. package/sdk-core/client/Cargo.toml +1 -2
  18. package/sdk-core/client/src/lib.rs +21 -13
  19. package/sdk-core/client/src/metrics.rs +1 -1
  20. package/sdk-core/client/src/raw.rs +46 -1
  21. package/sdk-core/core/Cargo.toml +7 -7
  22. package/sdk-core/core/benches/workflow_replay.rs +1 -1
  23. package/sdk-core/core/src/abstractions/take_cell.rs +1 -1
  24. package/sdk-core/core/src/abstractions.rs +98 -10
  25. package/sdk-core/core/src/core_tests/activity_tasks.rs +8 -2
  26. package/sdk-core/core/src/core_tests/local_activities.rs +1 -1
  27. package/sdk-core/core/src/core_tests/mod.rs +3 -3
  28. package/sdk-core/core/src/core_tests/updates.rs +104 -9
  29. package/sdk-core/core/src/core_tests/workers.rs +72 -3
  30. package/sdk-core/core/src/core_tests/workflow_tasks.rs +6 -7
  31. package/sdk-core/core/src/debug_client.rs +78 -0
  32. package/sdk-core/core/src/ephemeral_server/mod.rs +15 -5
  33. package/sdk-core/core/src/lib.rs +30 -4
  34. package/sdk-core/core/src/pollers/mod.rs +1 -1
  35. package/sdk-core/core/src/pollers/poll_buffer.rs +7 -7
  36. package/sdk-core/core/src/replay/mod.rs +4 -4
  37. package/sdk-core/core/src/telemetry/log_export.rs +2 -2
  38. package/sdk-core/core/src/telemetry/metrics.rs +69 -1
  39. package/sdk-core/core/src/telemetry/otel.rs +2 -2
  40. package/sdk-core/core/src/test_help/mod.rs +3 -3
  41. package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +3 -3
  42. package/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +1 -1
  43. package/sdk-core/core/src/worker/activities/local_activities.rs +68 -24
  44. package/sdk-core/core/src/worker/activities.rs +26 -15
  45. package/sdk-core/core/src/worker/client/mocks.rs +10 -4
  46. package/sdk-core/core/src/worker/client.rs +17 -0
  47. package/sdk-core/core/src/worker/mod.rs +71 -13
  48. package/sdk-core/core/src/worker/slot_provider.rs +5 -7
  49. package/sdk-core/core/src/worker/tuner/fixed_size.rs +4 -3
  50. package/sdk-core/core/src/worker/tuner/resource_based.rs +171 -32
  51. package/sdk-core/core/src/worker/tuner.rs +18 -6
  52. package/sdk-core/core/src/worker/workflow/history_update.rs +43 -13
  53. package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +6 -6
  54. package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +6 -5
  55. package/sdk-core/core/src/worker/workflow/managed_run.rs +3 -3
  56. package/sdk-core/core/src/worker/workflow/mod.rs +13 -7
  57. package/sdk-core/core/src/worker/workflow/wft_extraction.rs +7 -7
  58. package/sdk-core/core/src/worker/workflow/wft_poller.rs +2 -2
  59. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +11 -11
  60. package/sdk-core/core-api/Cargo.toml +1 -0
  61. package/sdk-core/core-api/src/worker.rs +84 -30
  62. package/sdk-core/sdk/Cargo.toml +1 -2
  63. package/sdk-core/sdk/src/lib.rs +1 -1
  64. package/sdk-core/sdk/src/workflow_context.rs +9 -8
  65. package/sdk-core/sdk/src/workflow_future.rs +19 -14
  66. package/sdk-core/sdk-core-protos/Cargo.toml +2 -0
  67. package/sdk-core/sdk-core-protos/build.rs +6 -1
  68. package/sdk-core/sdk-core-protos/protos/api_upstream/buf.yaml +1 -0
  69. package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +3207 -158
  70. package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +2934 -118
  71. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/activity/v1/message.proto +67 -0
  72. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +47 -1
  73. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/event_type.proto +6 -7
  74. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
  75. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/reset.proto +5 -3
  76. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +3 -3
  77. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/update.proto +14 -13
  78. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/failure/v1/message.proto +1 -3
  79. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +22 -0
  80. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +13 -2
  81. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +26 -6
  82. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/schedule/v1/message.proto +5 -0
  83. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +6 -0
  84. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +46 -12
  85. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/update/v1/message.proto +18 -19
  86. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +27 -0
  87. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +192 -19
  88. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +279 -12
  89. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/activity_result/activity_result.proto +1 -1
  90. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/activity_task/activity_task.proto +1 -1
  91. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +1 -1
  92. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/common/common.proto +1 -1
  93. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/core_interface.proto +17 -1
  94. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/external_data/external_data.proto +1 -1
  95. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +1 -1
  96. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +1 -1
  97. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +1 -1
  98. package/sdk-core/sdk-core-protos/src/lib.rs +30 -6
  99. package/sdk-core/test-utils/Cargo.toml +1 -2
  100. package/sdk-core/test-utils/src/lib.rs +2 -2
  101. package/sdk-core/tests/heavy_tests.rs +1 -1
  102. package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +2 -2
  103. package/sdk-core/tests/integ_tests/metrics_tests.rs +144 -7
  104. package/sdk-core/tests/integ_tests/queries_tests.rs +1 -1
  105. package/sdk-core/tests/integ_tests/update_tests.rs +109 -5
  106. package/sdk-core/tests/integ_tests/worker_tests.rs +44 -8
  107. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +1 -1
  108. package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -1
  109. package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +1 -1
  110. package/sdk-core/tests/integ_tests/workflow_tests.rs +3 -2
  111. package/src/conversions/slot_supplier_bridge.rs +287 -0
  112. package/src/conversions.rs +23 -15
  113. package/src/helpers.rs +35 -1
  114. package/src/runtime.rs +7 -3
  115. package/src/worker.rs +1 -1
  116. package/ts/errors.ts +9 -2
  117. package/ts/index.ts +19 -4
  118. package/ts/worker-tuner.ts +123 -1
  119. package/sdk-core/sdk-core-protos/protos/api_upstream/.gitmodules +0 -3
@@ -0,0 +1,67 @@
1
+ // The MIT License
2
+ //
3
+ // Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
4
+ //
5
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ // of this software and associated documentation files (the "Software"), to deal
7
+ // in the Software without restriction, including without limitation the rights
8
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ // copies of the Software, and to permit persons to whom the Software is
10
+ // furnished to do so, subject to the following conditions:
11
+ //
12
+ // The above copyright notice and this permission notice shall be included in
13
+ // all copies or substantial portions of the Software.
14
+ //
15
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ // THE SOFTWARE.
22
+
23
+ syntax = "proto3";
24
+
25
+ package temporal.api.activity.v1;
26
+
27
+ option go_package = "go.temporal.io/api/activity/v1;activity";
28
+ option java_package = "io.temporal.api.activity.v1";
29
+ option java_multiple_files = true;
30
+ option java_outer_classname = "MessageProto";
31
+ option ruby_package = "Temporalio::Api::Activity::V1";
32
+ option csharp_namespace = "Temporalio.Api.Activity.V1";
33
+
34
+ import "temporal/api/common/v1/message.proto";
35
+ import "temporal/api/taskqueue/v1/message.proto";
36
+
37
+ import "google/protobuf/duration.proto";
38
+
39
+ message ActivityOptions {
40
+ temporal.api.taskqueue.v1.TaskQueue task_queue = 1;
41
+
42
+ // Indicates how long the caller is willing to wait for an activity completion. Limits how long
43
+ // retries will be attempted. Either this or `start_to_close_timeout` must be specified.
44
+ //
45
+ // (-- api-linter: core::0140::prepositions=disabled
46
+ // aip.dev/not-precedent: "to" is used to indicate interval. --)
47
+ google.protobuf.Duration schedule_to_close_timeout = 2;
48
+ // Limits time an activity task can stay in a task queue before a worker picks it up. This
49
+ // timeout is always non retryable, as all a retry would achieve is to put it back into the same
50
+ // queue. Defaults to `schedule_to_close_timeout` or workflow execution timeout if not
51
+ // specified.
52
+ //
53
+ // (-- api-linter: core::0140::prepositions=disabled
54
+ // aip.dev/not-precedent: "to" is used to indicate interval. --)
55
+ google.protobuf.Duration schedule_to_start_timeout = 3;
56
+ // Maximum time an activity is allowed to execute after being picked up by a worker. This
57
+ // timeout is always retryable. Either this or `schedule_to_close_timeout` must be
58
+ // specified.
59
+ //
60
+ // (-- api-linter: core::0140::prepositions=disabled
61
+ // aip.dev/not-precedent: "to" is used to indicate interval. --)
62
+ google.protobuf.Duration start_to_close_timeout = 4;
63
+ // Maximum permitted time between successful worker heartbeats.
64
+ google.protobuf.Duration heartbeat_timeout = 5;
65
+
66
+ temporal.api.common.v1.RetryPolicy retry_policy = 6;
67
+ }
@@ -35,6 +35,7 @@ import "google/protobuf/duration.proto";
35
35
  import "google/protobuf/empty.proto";
36
36
 
37
37
  import "temporal/api/enums/v1/common.proto";
38
+ import "temporal/api/enums/v1/event_type.proto";
38
39
  import "temporal/api/enums/v1/reset.proto";
39
40
 
40
41
  message DataBlob {
@@ -191,8 +192,53 @@ message Callback {
191
192
  map<string, string> header = 2;
192
193
  }
193
194
 
195
+ // Callbacks to be delivered internally within the system.
196
+ // This variant is not settable in the API and will be rejected by the service with an INVALID_ARGUMENT error.
197
+ // The only reason that this is exposed is because callbacks are replicated across clusters via the
198
+ // WorkflowExecutionStarted event, which is defined in the public API.
199
+ message Internal {
200
+ // Opaque internal data.
201
+ bytes data = 1;
202
+ }
203
+
194
204
  reserved 1; // For a generic callback mechanism to be added later.
195
205
  oneof variant {
196
206
  Nexus nexus = 2;
207
+ Internal internal = 3;
208
+ }
209
+ }
210
+
211
+ // Link can be associated with history events. It might contain information about an external entity
212
+ // related to the history event. For example, workflow A makes a Nexus call that starts workflow B:
213
+ // in this case, a history event in workflow A could contain a Link to the workflow started event in
214
+ // workflow B, and vice-versa.
215
+ message Link {
216
+ message WorkflowEvent {
217
+ message EventReference {
218
+ int64 event_id = 1;
219
+ temporal.api.enums.v1.EventType event_type = 2;
220
+ }
221
+
222
+ string namespace = 1;
223
+ string workflow_id = 2;
224
+ string run_id = 3;
225
+
226
+ // Additional information about the workflow event.
227
+ // Eg: the caller workflow can send the history event details that made the Nexus call.
228
+ oneof reference {
229
+ EventReference event_ref = 100;
230
+ }
197
231
  }
198
- }
232
+
233
+ // A link to a built-in batch job.
234
+ // Batch jobs can be used to perform operations on a set of workflows (e.g. terminate, signal, cancel, etc).
235
+ // This link can be put on workflow history events generated by actions taken by a batch job.
236
+ message BatchJob {
237
+ string job_id = 1;
238
+ }
239
+
240
+ oneof variant {
241
+ WorkflowEvent workflow_event = 1;
242
+ BatchJob batch_job = 2;
243
+ }
244
+ }
@@ -151,9 +151,13 @@ enum EventType {
151
151
  EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_SIGNALED = 39;
152
152
  // Workflow search attributes should be updated and synchronized with the visibility store
153
153
  EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES = 40;
154
- // An update was accepted (i.e. validated)
154
+ // An update was admitted. Note that not all admitted updates result in this
155
+ // event. See UpdateAdmittedEventOrigin for situations in which this event
156
+ // is created.
157
+ EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ADMITTED = 47;
158
+ // An update was accepted (i.e. passed validation, perhaps because no validator was defined)
155
159
  EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ACCEPTED = 41;
156
- // An update was rejected (i.e. failed validation)
160
+ // This event is never written to history.
157
161
  EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REJECTED = 42;
158
162
  // An update completed
159
163
  EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_COMPLETED = 43;
@@ -167,11 +171,6 @@ enum EventType {
167
171
  EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY = 45;
168
172
  // Workflow properties modified by user workflow code
169
173
  EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED = 46;
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
- // is created.
173
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ADMITTED = 47;
174
-
175
174
  // A Nexus operation was scheduled using a ScheduleNexusOperation command.
176
175
  EVENT_TYPE_NEXUS_OPERATION_SCHEDULED = 48;
177
176
  // An asynchronous Nexus operation was started by a Nexus handler.
@@ -139,6 +139,8 @@ enum ResourceExhaustedCause {
139
139
  RESOURCE_EXHAUSTED_CAUSE_APS_LIMIT = 6;
140
140
  // Persistence storage limit exceeded.
141
141
  RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_STORAGE_LIMIT = 7;
142
+ // Circuit breaker is open/half-open.
143
+ RESOURCE_EXHAUSTED_CAUSE_CIRCUIT_BREAKER_OPEN = 8;
142
144
  }
143
145
 
144
146
  enum ResourceExhaustedScope {
@@ -31,13 +31,15 @@ option java_outer_classname = "ResetProto";
31
31
  option ruby_package = "Temporalio::Api::Enums::V1";
32
32
  option csharp_namespace = "Temporalio.Api.Enums.V1";
33
33
 
34
- // Event types to exclude when reapplying events.
34
+ // Event types to exclude when reapplying events beyond the reset point.
35
35
  enum ResetReapplyExcludeType {
36
36
  RESET_REAPPLY_EXCLUDE_TYPE_UNSPECIFIED = 0;
37
- // Exclude signals when reapplying events.
37
+ // Exclude signals when reapplying events beyond the reset point.
38
38
  RESET_REAPPLY_EXCLUDE_TYPE_SIGNAL = 1;
39
- // Exclude updates when reapplying events.
39
+ // Exclude updates when reapplying events beyond the reset point.
40
40
  RESET_REAPPLY_EXCLUDE_TYPE_UPDATE = 2;
41
+ // Exclude nexus events when reapplying events beyond the reset point.
42
+ RESET_REAPPLY_EXCLUDE_TYPE_NEXUS = 3;
41
43
  }
42
44
 
43
45
  // Event types to include when reapplying events. Deprecated: applications
@@ -81,9 +81,9 @@ enum TaskReachability {
81
81
 
82
82
  // Specifies which category of tasks may reach a versioned worker of a certain Build ID.
83
83
  //
84
- // Task Reachability is eventually consistent; there may be a delay until it converges to the most
85
- // accurate value but it is designed in a way to take the more conservative side until it converges.
86
- // For example REACHABLE is more conservative than CLOSED_WORKFLOWS_ONLY.
84
+ // Task Reachability is eventually consistent; there may be a delay (up to few minutes) until it
85
+ // converges to the most accurate value but it is designed in a way to take the more conservative
86
+ // side until it converges. For example REACHABLE is more conservative than CLOSED_WORKFLOWS_ONLY.
87
87
  //
88
88
  // Note: future activities who inherit their workflow's Build ID but not its Task Queue will not be
89
89
  // accounted for reachability as server cannot know if they'll happen as they do not use
@@ -32,35 +32,36 @@ option ruby_package = "Temporalio::Api::Enums::V1";
32
32
  option csharp_namespace = "Temporalio.Api.Enums.V1";
33
33
 
34
34
  // UpdateWorkflowExecutionLifecycleStage is specified by clients invoking
35
- // workflow execution updates and used to indicate to the server how long the
36
- // client wishes to wait for a return value from the RPC. If any value other
35
+ // Workflow Updates and used to indicate to the server how long the
36
+ // client wishes to wait for a return value from the API. If any value other
37
37
  // than UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED is sent by the
38
- // client then the RPC will complete before the update is finished and will
39
- // return a handle to the running update so that it can later be polled for
38
+ // client then the API will complete before the Update is finished and will
39
+ // return a handle to the running Update so that it can later be polled for
40
40
  // completion.
41
+ // If specified stage wasn't reached before server timeout, server returns
42
+ // actual stage reached.
41
43
  enum UpdateWorkflowExecutionLifecycleStage {
42
- // An unspecified vale for this enum.
44
+ // An unspecified value for this enum.
43
45
  UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_UNSPECIFIED = 0;
44
- // The gRPC call will not return until the update request has been admitted
46
+ // The API call will not return until the Update request has been admitted
45
47
  // by the server - it may be the case that due to a considerations like load
46
- // or resource limits that an update is made to wait before the server will
48
+ // or resource limits that an Update is made to wait before the server will
47
49
  // indicate that it has been received and will be processed. This value
48
50
  // does not wait for any sort of acknowledgement from a worker.
49
51
  UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED = 1;
50
- // The gRPC call will not return until the update has passed validation on
51
- // a worker.
52
+ // The API call will not return until the Update has passed validation on a worker.
52
53
  UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED = 2;
53
- // The gRPC call will not return until the update has executed to completion
54
+ // The API call will not return until the Update has executed to completion
54
55
  // on a worker and has either been rejected or returned a value or an error.
55
56
  UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED = 3;
56
57
  }
57
58
 
58
59
  // Records why a WorkflowExecutionUpdateAdmittedEvent was written to history.
59
- // Note that not all admitted updates result in this event.
60
+ // Note that not all admitted Updates result in this event.
60
61
  enum UpdateAdmittedEventOrigin {
61
62
  UPDATE_ADMITTED_EVENT_ORIGIN_UNSPECIFIED = 0;
62
63
  // The UpdateAdmitted event was created when reapplying events during reset
63
- // or replication. I.e. an accepted update on one branch of workflow history
64
- // was converted into an admitted update on a different branch.
64
+ // or replication. I.e. an accepted Update on one branch of Workflow history
65
+ // was converted into an admitted Update on a different branch.
65
66
  UPDATE_ADMITTED_EVENT_ORIGIN_REAPPLY = 1;
66
67
  }
@@ -44,8 +44,6 @@ message ApplicationFailureInfo {
44
44
  // retry interval calculated by the retry policy. Retry attempts will
45
45
  // still be subject to the maximum retries limit and total time limit
46
46
  // defined by the policy.
47
- // ATTENTION: this value will be ignored if set for failures produced by
48
- // the workflow.
49
47
  google.protobuf.Duration next_retry_delay = 4;
50
48
  }
51
49
 
@@ -111,7 +109,7 @@ message Failure {
111
109
  // The `encoded_attributes` Payload could represent any serializable object, e.g. JSON object or a `Failure` proto
112
110
  // message.
113
111
  //
114
- // SDK authors:
112
+ // SDK authors:
115
113
  // - The SDK should provide a default `encodeFailureAttributes` and `decodeFailureAttributes` implementation that:
116
114
  // - Uses a JSON object to represent `{ message, stack_trace }`.
117
115
  // - Overwrites the original message with "Encoded failure" to indicate that more information could be extracted.
@@ -822,6 +822,11 @@ message NexusOperationScheduledEventAttributes {
822
822
  // A unique ID generated by the history service upon creation of this event.
823
823
  // The ID will be transmitted with all nexus StartOperation requests and is used as an idempotentency key.
824
824
  string request_id = 8;
825
+
826
+ // Endpoint ID as resolved in the endpoint registry at the time this event was generated.
827
+ // This is stored on the event and used internally by the server in case the endpoint is renamed from the time the
828
+ // event was originally scheduled.
829
+ string endpoint_id = 9;
825
830
  }
826
831
 
827
832
  // Event marking an asynchronous operation was started by the responding Nexus handler.
@@ -834,6 +839,9 @@ message NexusOperationStartedEventAttributes {
834
839
  // The operation ID returned by the Nexus handler in the response to the StartOperation request.
835
840
  // This ID is used when canceling the operation.
836
841
  string operation_id = 3;
842
+
843
+ // The request ID allocated at schedule time.
844
+ string request_id = 4;
837
845
  }
838
846
 
839
847
  // Nexus operation completed successfully.
@@ -843,6 +851,9 @@ message NexusOperationCompletedEventAttributes {
843
851
  // Serialized result of the Nexus operation. The response of the Nexus handler.
844
852
  // Delivered either via a completion callback or as a response to a synchronous operation.
845
853
  temporal.api.common.v1.Payload result = 2;
854
+
855
+ // The request ID allocated at schedule time.
856
+ string request_id = 3;
846
857
  }
847
858
 
848
859
  // Nexus operation failed.
@@ -851,6 +862,9 @@ message NexusOperationFailedEventAttributes {
851
862
  int64 scheduled_event_id = 1;
852
863
  // Failure details. A NexusOperationFailureInfo wrapping an ApplicationFailureInfo.
853
864
  temporal.api.failure.v1.Failure failure = 2;
865
+
866
+ // The request ID allocated at schedule time.
867
+ string request_id = 3;
854
868
  }
855
869
 
856
870
  // Nexus operation timed out.
@@ -859,6 +873,9 @@ message NexusOperationTimedOutEventAttributes {
859
873
  int64 scheduled_event_id = 1;
860
874
  // Failure details. A NexusOperationFailureInfo wrapping a CanceledFailureInfo.
861
875
  temporal.api.failure.v1.Failure failure = 2;
876
+
877
+ // The request ID allocated at schedule time.
878
+ string request_id = 3;
862
879
  }
863
880
 
864
881
  // Nexus operation completed as canceled. May or may not have been due to a cancellation request by the workflow.
@@ -867,6 +884,9 @@ message NexusOperationCanceledEventAttributes {
867
884
  int64 scheduled_event_id = 1;
868
885
  // Cancellation details.
869
886
  temporal.api.failure.v1.Failure failure = 2;
887
+
888
+ // The request ID allocated at schedule time.
889
+ string request_id = 3;
870
890
  }
871
891
 
872
892
  message NexusOperationCancelRequestedEventAttributes {
@@ -902,6 +922,8 @@ message HistoryEvent {
902
922
  // * timer_started_event_attributes - summary represents an identifier for the timer for use by
903
923
  // user interfaces.
904
924
  temporal.api.sdk.v1.UserMetadata user_metadata = 301;
925
+ // Links associated with the event.
926
+ repeated temporal.api.common.v1.Link links = 302;
905
927
  // The event details. The type must match that in `event_type`.
906
928
  oneof attributes {
907
929
  WorkflowExecutionStartedEventAttributes workflow_execution_started_event_attributes = 6;
@@ -31,7 +31,6 @@ option csharp_namespace = "Temporalio.Api.Nexus.V1";
31
31
 
32
32
  import "google/protobuf/timestamp.proto";
33
33
  import "temporal/api/common/v1/message.proto";
34
- import "temporal/api/sdk/v1/user_metadata.proto";
35
34
 
36
35
  // A general purpose failure message.
37
36
  // See: https://github.com/nexus-rpc/api/blob/main/SPEC.md#failure
@@ -53,6 +52,12 @@ message UnsuccessfulOperationError {
53
52
  Failure failure = 2;
54
53
  }
55
54
 
55
+ message Link {
56
+ // See https://github.com/nexus-rpc/api/blob/main/SPEC.md#links.
57
+ string url = 1;
58
+ string type = 2;
59
+ }
60
+
56
61
  // A request to start an operation.
57
62
  message StartOperationRequest {
58
63
  // Name of service to start the operation in.
@@ -67,6 +72,8 @@ message StartOperationRequest {
67
72
  temporal.api.common.v1.Payload payload = 5;
68
73
  // Header that is expected to be attached to the callback request when the operation completes.
69
74
  map<string, string> callback_header = 6;
75
+ // Links contain caller information and can be attached to the operations started by the handler.
76
+ repeated Link links = 7;
70
77
  }
71
78
 
72
79
  // A request to cancel an operation.
@@ -107,6 +114,7 @@ message StartOperationResponse {
107
114
  // The returned ID can be used to reference this operation.
108
115
  message Async {
109
116
  string operation_id = 1;
117
+ repeated Link links = 2;
110
118
  }
111
119
 
112
120
  oneof variant {
@@ -162,7 +170,10 @@ message EndpointSpec {
162
170
  // Renaming an endpoint breaks all workflow callers that reference this endpoint, causing operations to fail.
163
171
  string name = 1;
164
172
 
165
- temporal.api.sdk.v1.UserMetadata metadata = 2;
173
+ // Markdown description serialized as a single JSON string.
174
+ // If the Payload is encrypted, the UI and CLI may decrypt with the configured codec server endpoint.
175
+ // By default, the server enforces a limit of 20,000 bytes for this entire payload.
176
+ temporal.api.common.v1.Payload description = 2;
166
177
 
167
178
  // Target to route requests to.
168
179
  EndpointTarget target = 3;
@@ -58,7 +58,10 @@ service OperatorService {
58
58
  // ListSearchAttributes returns comprehensive information about search attributes.
59
59
  rpc ListSearchAttributes (ListSearchAttributesRequest) returns (ListSearchAttributesResponse) {
60
60
  option (google.api.http) = {
61
- get: "/namespaces/{namespace}/search-attributes",
61
+ get: "/cluster/namespaces/{namespace}/search-attributes"
62
+ additional_bindings {
63
+ get: "/api/v1/namespaces/{namespace}/search-attributes"
64
+ }
62
65
  };
63
66
  }
64
67
 
@@ -81,7 +84,10 @@ service OperatorService {
81
84
  // Get a registered Nexus endpoint by ID. The returned version can be used for optimistic updates.
82
85
  rpc GetNexusEndpoint(GetNexusEndpointRequest) returns (GetNexusEndpointResponse) {
83
86
  option (google.api.http) = {
84
- get: "/nexus/endpoints/{id}"
87
+ get: "/cluster/nexus/endpoints/{id}"
88
+ additional_bindings {
89
+ get: "/api/v1/nexus/endpoints/{id}"
90
+ }
85
91
  };
86
92
  }
87
93
 
@@ -90,8 +96,12 @@ service OperatorService {
90
96
  // Returns the created endpoint with its initial version. You may use this version for subsequent updates.
91
97
  rpc CreateNexusEndpoint(CreateNexusEndpointRequest) returns (CreateNexusEndpointResponse) {
92
98
  option (google.api.http) = {
93
- post: "/nexus/endpoints"
99
+ post: "/cluster/nexus/endpoints"
94
100
  body: "*"
101
+ additional_bindings {
102
+ post: "/api/v1/nexus/endpoints"
103
+ body: "*"
104
+ }
95
105
  };
96
106
  }
97
107
 
@@ -102,15 +112,22 @@ service OperatorService {
102
112
  // need to increment the version yourself. The server will increment the version for you after each update.
103
113
  rpc UpdateNexusEndpoint(UpdateNexusEndpointRequest) returns (UpdateNexusEndpointResponse) {
104
114
  option (google.api.http) = {
105
- post: "/nexus/endpoints/{id}/update"
115
+ post: "/cluster/nexus/endpoints/{id}/update"
106
116
  body: "*"
117
+ additional_bindings {
118
+ post: "/api/v1/nexus/endpoints/{id}/update"
119
+ body: "*"
120
+ }
107
121
  };
108
122
  }
109
123
 
110
124
  // Delete an incoming Nexus service by ID.
111
125
  rpc DeleteNexusEndpoint(DeleteNexusEndpointRequest) returns (DeleteNexusEndpointResponse) {
112
126
  option (google.api.http) = {
113
- delete: "/nexus/endpoints/{id}"
127
+ delete: "/cluster/nexus/endpoints/{id}"
128
+ additional_bindings {
129
+ delete: "/api/v1/nexus/endpoints/{id}"
130
+ }
114
131
  };
115
132
  }
116
133
 
@@ -120,7 +137,10 @@ service OperatorService {
120
137
  // earlier than the previous page's last endpoint's ID may be missed.
121
138
  rpc ListNexusEndpoints(ListNexusEndpointsRequest) returns (ListNexusEndpointsResponse) {
122
139
  option (google.api.http) = {
123
- get: "/nexus/endpoints"
140
+ get: "/cluster/nexus/endpoints"
141
+ additional_bindings {
142
+ get: "/api/v1/nexus/endpoints"
143
+ }
124
144
  };
125
145
  }
126
146
  }
@@ -41,6 +41,7 @@ import "google/protobuf/timestamp.proto";
41
41
 
42
42
  import "temporal/api/common/v1/message.proto";
43
43
  import "temporal/api/enums/v1/schedule.proto";
44
+ import "temporal/api/enums/v1/workflow.proto";
44
45
  import "temporal/api/workflow/v1/message.proto";
45
46
 
46
47
  // CalendarSpec describes an event specification relative to the calendar,
@@ -269,6 +270,10 @@ message ScheduleActionResult {
269
270
 
270
271
  // If action was start_workflow:
271
272
  temporal.api.common.v1.WorkflowExecution start_workflow_result = 11;
273
+
274
+ // If the action was start_workflow, this field will reflect an
275
+ // eventually-consistent view of the started workflow's status.
276
+ temporal.api.enums.v1.WorkflowExecutionStatus start_workflow_status = 12;
272
277
  }
273
278
 
274
279
  message ScheduleState {
@@ -45,8 +45,14 @@ message WorkflowDefinition {
45
45
  // A name scoped by the task queue that maps to this workflow definition.
46
46
  // If missing, this workflow is a dynamic workflow.
47
47
  string type = 1;
48
+
49
+ // Query definitions, sorted by name.
48
50
  repeated WorkflowInteractionDefinition query_definitions = 2;
51
+
52
+ // Signal definitions, sorted by name.
49
53
  repeated WorkflowInteractionDefinition signal_definitions = 3;
54
+
55
+ // Update definitions, sorted by name.
50
56
  repeated WorkflowInteractionDefinition update_definitions = 4;
51
57
  }
52
58
 
@@ -60,8 +60,8 @@ message TaskQueueVersionSelection {
60
60
  repeated string build_ids = 1;
61
61
  // Include the unversioned queue.
62
62
  bool unversioned = 2;
63
- // Include all active versions. A version is considered active if it has had new
64
- // tasks or polls recently.
63
+ // Include all active versions. A version is considered active if, in the last few minutes,
64
+ // it has had new tasks or polls, or it has been the subject of certain task queue API calls.
65
65
  bool all_active = 3;
66
66
  }
67
67
 
@@ -87,20 +87,54 @@ message TaskQueueTypeInfo {
87
87
  TaskQueueStats stats = 2;
88
88
  }
89
89
 
90
- // For workflow task queues, we only report the normal queue stats, not sticky queues. This means the stats
91
- // reported here do not count all workflow tasks. However, because the tasks queued in sticky queues only remain
92
- // valid for a few seconds, the inaccuracy becomes less significant as the backlog age grows.
90
+ // TaskQueueStats contains statistics about task queue backlog and activity.
91
+ //
92
+ // For workflow task queue type, this result is partial because tasks sent to sticky queues are not included. Read
93
+ // comments above each metric to understand the impact of sticky queue exclusion on that metric accuracy.
93
94
  message TaskQueueStats {
94
- // The approximate number of tasks backlogged in this task queue. May count expired tasks but eventually converges
95
- // to the right value.
95
+ // The approximate number of tasks backlogged in this task queue. May count expired tasks but eventually
96
+ // converges to the right value. Can be relied upon for scaling decisions.
97
+ //
98
+ // Special note for workflow task queue type: this metric does not count sticky queue tasks. However, because
99
+ // those tasks only remain valid for a few seconds, the inaccuracy becomes less significant as the backlog size
100
+ // grows.
96
101
  int64 approximate_backlog_count = 1;
97
- // Approximate age of the oldest task in the backlog based on the create timestamp of the task at the head of the queue.
102
+ // Approximate age of the oldest task in the backlog based on the creation time of the task at the head of
103
+ // the queue. Can be relied upon for scaling decisions.
104
+ //
105
+ // Special note for workflow task queue type: this metric does not count sticky queue tasks. However, because
106
+ // those tasks only remain valid for a few seconds, they should not affect the result when backlog is older than
107
+ // few seconds.
98
108
  google.protobuf.Duration approximate_backlog_age = 2;
99
- // Approximate tasks per second added to the task queue based on activity within a fixed window. This includes both backlogged and
100
- // sync-matched tasks.
109
+ // The approximate tasks per second added to the task queue, averaging the last 30 seconds. These includes tasks
110
+ // whether or not they were added to/dispatched from the backlog or they were dispatched immediately without going
111
+ // to the backlog (sync-matched).
112
+ //
113
+ // The difference between `tasks_add_rate` and `tasks_dispatch_rate` is a reliable metric for the rate at which
114
+ // backlog grows/shrinks.
115
+ //
116
+ // Note: the actual tasks delivered to the workers may significantly be higher than the numbers reported by
117
+ // tasks_add_rate, because:
118
+ // - Tasks can be sent to workers without going to the task queue. This is called Eager dispatch. Eager dispatch is
119
+ // enable for activities by default in the latest SDKs.
120
+ // - Tasks going to Sticky queue are not accounted for. Note that, typically, only the first workflow task of each
121
+ // workflow goes to a normal queue, and the rest workflow tasks go to the Sticky queue associated with a specific
122
+ // worker instance.
101
123
  float tasks_add_rate = 3;
102
- // Approximate tasks per second dispatched to workers based on activity within a fixed window. This includes both backlogged and
103
- // sync-matched tasks.
124
+ // The approximate tasks per second dispatched from the task queue, averaging the last 30 seconds. These includes
125
+ // tasks whether or not they were added to/dispatched from the backlog or they were dispatched immediately without
126
+ // going to the backlog (sync-matched).
127
+ //
128
+ // The difference between `tasks_add_rate` and `tasks_dispatch_rate` is a reliable metric for the rate at which
129
+ // backlog grows/shrinks.
130
+ //
131
+ // Note: the actual tasks delivered to the workers may significantly be higher than the numbers reported by
132
+ // tasks_dispatch_rate, because:
133
+ // - Tasks can be sent to workers without going to the task queue. This is called Eager dispatch. Eager dispatch is
134
+ // enable for activities by default in the latest SDKs.
135
+ // - Tasks going to Sticky queue are not accounted for. Note that, typically, only the first workflow task of each
136
+ // workflow goes to a normal queue, and the rest workflow tasks go to the Sticky queue associated with a specific
137
+ // worker instance.
104
138
  float tasks_dispatch_rate = 4;
105
139
  }
106
140