@temporalio/core-bridge 1.10.3 → 1.11.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 (126) hide show
  1. package/Cargo.lock +563 -676
  2. package/Cargo.toml +3 -3
  3. package/lib/index.d.ts +16 -5
  4. package/lib/index.js.map +1 -1
  5. package/lib/worker-tuner.d.ts +57 -0
  6. package/lib/worker-tuner.js +3 -0
  7. package/lib/worker-tuner.js.map +1 -0
  8. package/package.json +3 -3
  9. package/releases/aarch64-apple-darwin/index.node +0 -0
  10. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  11. package/releases/x86_64-apple-darwin/index.node +0 -0
  12. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  13. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  14. package/sdk-core/.github/workflows/heavy.yml +6 -11
  15. package/sdk-core/.github/workflows/per-pr.yml +23 -41
  16. package/sdk-core/Cargo.toml +5 -5
  17. package/sdk-core/README.md +2 -0
  18. package/sdk-core/client/Cargo.toml +4 -2
  19. package/sdk-core/client/src/lib.rs +60 -17
  20. package/sdk-core/client/src/metrics.rs +1 -1
  21. package/sdk-core/client/src/proxy.rs +17 -12
  22. package/sdk-core/client/src/raw.rs +218 -69
  23. package/sdk-core/client/src/retry.rs +19 -9
  24. package/sdk-core/core/Cargo.toml +12 -12
  25. package/sdk-core/core/src/abstractions.rs +3 -3
  26. package/sdk-core/core/src/core_tests/activity_tasks.rs +2 -1
  27. package/sdk-core/core/src/core_tests/determinism.rs +1 -1
  28. package/sdk-core/core/src/core_tests/local_activities.rs +73 -10
  29. package/sdk-core/core/src/core_tests/queries.rs +2 -1
  30. package/sdk-core/core/src/core_tests/updates.rs +162 -4
  31. package/sdk-core/core/src/core_tests/workers.rs +38 -2
  32. package/sdk-core/core/src/core_tests/workflow_tasks.rs +158 -27
  33. package/sdk-core/core/src/internal_flags.rs +17 -7
  34. package/sdk-core/core/src/lib.rs +9 -3
  35. package/sdk-core/core/src/pollers/poll_buffer.rs +1 -10
  36. package/sdk-core/core/src/protosext/mod.rs +0 -1
  37. package/sdk-core/core/src/protosext/protocol_messages.rs +105 -16
  38. package/sdk-core/core/src/retry_logic.rs +22 -2
  39. package/sdk-core/core/src/telemetry/otel.rs +44 -12
  40. package/sdk-core/core/src/test_help/mod.rs +65 -12
  41. package/sdk-core/core/src/worker/activities/local_activities.rs +1 -4
  42. package/sdk-core/core/src/worker/activities.rs +3 -4
  43. package/sdk-core/core/src/worker/client/mocks.rs +7 -6
  44. package/sdk-core/core/src/worker/client.rs +11 -2
  45. package/sdk-core/core/src/worker/mod.rs +49 -24
  46. package/sdk-core/core/src/worker/tuner/resource_based.rs +48 -48
  47. package/sdk-core/core/src/worker/tuner.rs +124 -4
  48. package/sdk-core/core/src/worker/workflow/driven_workflow.rs +1 -1
  49. package/sdk-core/core/src/worker/workflow/history_update.rs +11 -2
  50. package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +18 -3
  51. package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -0
  52. package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +1 -0
  53. package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +1 -0
  54. package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +1 -0
  55. package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +1 -0
  56. package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +1 -0
  57. package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +4 -4
  58. package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +1 -0
  59. package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +1 -0
  60. package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -0
  61. package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +3 -1
  62. package/sdk-core/core/src/worker/workflow/machines/update_state_machine.rs +38 -28
  63. package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +4 -2
  64. package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +95 -71
  65. package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +1 -1
  66. package/sdk-core/core/src/worker/workflow/managed_run.rs +214 -14
  67. package/sdk-core/core/src/worker/workflow/mod.rs +49 -36
  68. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +1 -2
  69. package/sdk-core/core-api/src/errors.rs +13 -7
  70. package/sdk-core/core-api/src/lib.rs +9 -1
  71. package/sdk-core/sdk/Cargo.toml +1 -1
  72. package/sdk-core/sdk/src/activity_context.rs +3 -4
  73. package/sdk-core/sdk/src/lib.rs +96 -49
  74. package/sdk-core/sdk/src/workflow_context/options.rs +8 -4
  75. package/sdk-core/sdk/src/workflow_context.rs +53 -49
  76. package/sdk-core/sdk/src/workflow_future.rs +10 -4
  77. package/sdk-core/sdk-core-protos/Cargo.toml +4 -3
  78. package/sdk-core/sdk-core-protos/build.rs +2 -0
  79. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/.github/workflows/build.yaml +18 -0
  80. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/LICENSE +21 -0
  81. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/Makefile +59 -0
  82. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/README.md +25 -0
  83. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/VERSION +1 -0
  84. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/buf.gen.yaml +14 -0
  85. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/buf.lock +8 -0
  86. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/buf.yaml +9 -0
  87. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/request_response.proto +520 -0
  88. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto +263 -0
  89. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/identity/v1/message.proto +173 -0
  90. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/namespace/v1/message.proto +164 -0
  91. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/operation/v1/message.proto +36 -0
  92. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/region/v1/message.proto +22 -0
  93. package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +50 -8
  94. package/sdk-core/sdk-core-protos/protos/api_upstream/.gitmodules +3 -0
  95. package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +132 -54
  96. package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +177 -81
  97. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/command/v1/message.proto +13 -0
  98. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
  99. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +8 -3
  100. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +10 -0
  101. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +3 -3
  102. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +6 -6
  103. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/sdk/v1/enhanced_stack_trace.proto +96 -0
  104. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/sdk/v1/user_metadata.proto +49 -0
  105. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +6 -7
  106. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +55 -24
  107. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +7 -0
  108. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +21 -4
  109. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +64 -45
  110. package/sdk-core/sdk-core-protos/src/history_builder.rs +8 -1
  111. package/sdk-core/sdk-core-protos/src/lib.rs +40 -10
  112. package/sdk-core/test-utils/src/canned_histories.rs +1 -1
  113. package/sdk-core/tests/fuzzy_workflow.rs +4 -2
  114. package/sdk-core/tests/heavy_tests.rs +3 -3
  115. package/sdk-core/tests/integ_tests/activity_functions.rs +2 -2
  116. package/sdk-core/tests/integ_tests/client_tests.rs +234 -6
  117. package/sdk-core/tests/integ_tests/update_tests.rs +180 -47
  118. package/sdk-core/tests/integ_tests/worker_tests.rs +32 -0
  119. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +47 -3
  120. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +10 -10
  121. package/sdk-core/tests/main.rs +1 -0
  122. package/src/conversions.rs +84 -11
  123. package/src/runtime.rs +5 -17
  124. package/src/worker.rs +27 -6
  125. package/ts/index.ts +24 -5
  126. package/ts/worker-tuner.ts +71 -0
@@ -38,6 +38,7 @@ import "temporal/api/enums/v1/command_type.proto";
38
38
  import "temporal/api/common/v1/message.proto";
39
39
  import "temporal/api/failure/v1/message.proto";
40
40
  import "temporal/api/taskqueue/v1/message.proto";
41
+ import "temporal/api/sdk/v1/user_metadata.proto";
41
42
 
42
43
  message ScheduleActivityTaskCommandAttributes {
43
44
  string activity_id = 1;
@@ -267,6 +268,18 @@ message RequestCancelNexusOperationCommandAttributes {
267
268
 
268
269
  message Command {
269
270
  temporal.api.enums.v1.CommandType command_type = 1;
271
+ // Metadata on the command. This is sometimes carried over to the history event if one is
272
+ // created as a result of the command. Most commands won't have this information, and how this
273
+ // information is used is dependent upon the interface that reads it.
274
+ //
275
+ // Current well-known uses:
276
+ // * start_child_workflow_execution_command_attributes - populates
277
+ // temporal.api.workflow.v1.WorkflowExecutionInfo.user_metadata where the summary and details
278
+ // are used by user interfaces to show fixed as-of-start workflow summary and details.
279
+ // * start_timer_command_attributes - populates temporal.api.history.v1.HistoryEvent for timer
280
+ // started where the summary is used to identify the timer.
281
+ temporal.api.sdk.v1.UserMetadata user_metadata = 301;
282
+ // The command details. The type must match that in `command_type`.
270
283
  oneof attributes {
271
284
  ScheduleActivityTaskCommandAttributes schedule_activity_task_command_attributes = 2;
272
285
  StartTimerCommandAttributes start_timer_command_attributes = 3;
@@ -137,6 +137,8 @@ enum ResourceExhaustedCause {
137
137
  RESOURCE_EXHAUSTED_CAUSE_BUSY_WORKFLOW = 5;
138
138
  // Caller exceeds action per second limit.
139
139
  RESOURCE_EXHAUSTED_CAUSE_APS_LIMIT = 6;
140
+ // Persistence storage limit exceeded.
141
+ RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_STORAGE_LIMIT = 7;
140
142
  }
141
143
 
142
144
  enum ResourceExhaustedScope {
@@ -80,16 +80,21 @@ enum TaskReachability {
80
80
  }
81
81
 
82
82
  // Specifies which category of tasks may reach a versioned worker of a certain Build ID.
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.
87
+ //
83
88
  // 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
89
+ // accounted for reachability as server cannot know if they'll happen as they do not use
85
90
  // assignment rules of their Task Queue. Same goes for Child Workflows or Continue-As-New Workflows
86
91
  // who inherit the parent/previous workflow's Build ID but not its Task Queue. In those cases, make
87
92
  // sure to query reachability for the parent/previous workflow's Task Queue as well.
88
93
  enum BuildIdTaskReachability {
89
94
  // Task reachability is not reported
90
95
  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.
96
+ // Build ID may be used by new workflows or activities (base on versioning rules), or there MAY
97
+ // be open workflows or backlogged activities assigned to it.
93
98
  BUILD_ID_TASK_REACHABILITY_REACHABLE = 1;
94
99
  // Build ID does not have open workflows and is not reachable by new workflows,
95
100
  // but MAY have closed workflows within the namespace retention period.
@@ -44,6 +44,7 @@ import "temporal/api/taskqueue/v1/message.proto";
44
44
  import "temporal/api/update/v1/message.proto";
45
45
  import "temporal/api/workflow/v1/message.proto";
46
46
  import "temporal/api/sdk/v1/task_complete_metadata.proto";
47
+ import "temporal/api/sdk/v1/user_metadata.proto";
47
48
 
48
49
  // Always the first event in workflow history
49
50
  message WorkflowExecutionStartedEventAttributes {
@@ -892,6 +893,15 @@ message HistoryEvent {
892
893
  // type which it does not understand, it must error unless this is true. If it is true, it's
893
894
  // acceptable for the event type and/or attributes to be uninterpretable.
894
895
  bool worker_may_ignore = 300;
896
+ // Metadata on the event. This is often carried over from commands and client calls. Most events
897
+ // won't have this information, and how this information is used is dependent upon the interface
898
+ // that reads it.
899
+ //
900
+ // Current well-known uses:
901
+ // * workflow_execution_started_event_attributes - summary and details from start workflow.
902
+ // * timer_started_event_attributes - summary represents an identifier for the timer for use by
903
+ // user interfaces.
904
+ temporal.api.sdk.v1.UserMetadata user_metadata = 301;
895
905
  // The event details. The type must match that in `event_type`.
896
906
  oneof attributes {
897
907
  WorkflowExecutionStartedEventAttributes workflow_execution_started_event_attributes = 6;
@@ -31,6 +31,7 @@ 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";
34
35
 
35
36
  // A general purpose failure message.
36
37
  // See: https://github.com/nexus-rpc/api/blob/main/SPEC.md#failure
@@ -160,9 +161,8 @@ message EndpointSpec {
160
161
  // Endpoint name, unique for this cluster. Must match `[a-zA-Z_][a-zA-Z0-9_]*`.
161
162
  // Renaming an endpoint breaks all workflow callers that reference this endpoint, causing operations to fail.
162
163
  string name = 1;
163
- // Markdown description serialized as a single JSON string.
164
- // If the Payload is encrypted, the UI and CLI may decrypt with the configured codec server endpoint.
165
- temporal.api.common.v1.Payload description = 2;
164
+
165
+ temporal.api.sdk.v1.UserMetadata metadata = 2;
166
166
 
167
167
  // Target to route requests to.
168
168
  EndpointTarget target = 3;
@@ -58,7 +58,7 @@ 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: "/api/v1/namespaces/{namespace}/search-attributes",
61
+ get: "/namespaces/{namespace}/search-attributes",
62
62
  };
63
63
  }
64
64
 
@@ -81,7 +81,7 @@ service OperatorService {
81
81
  // Get a registered Nexus endpoint by ID. The returned version can be used for optimistic updates.
82
82
  rpc GetNexusEndpoint(GetNexusEndpointRequest) returns (GetNexusEndpointResponse) {
83
83
  option (google.api.http) = {
84
- get: "/api/v1/nexus/endpoints/{id}"
84
+ get: "/nexus/endpoints/{id}"
85
85
  };
86
86
  }
87
87
 
@@ -90,7 +90,7 @@ service OperatorService {
90
90
  // Returns the created endpoint with its initial version. You may use this version for subsequent updates.
91
91
  rpc CreateNexusEndpoint(CreateNexusEndpointRequest) returns (CreateNexusEndpointResponse) {
92
92
  option (google.api.http) = {
93
- post: "/api/v1/nexus/endpoints"
93
+ post: "/nexus/endpoints"
94
94
  body: "*"
95
95
  };
96
96
  }
@@ -102,7 +102,7 @@ service OperatorService {
102
102
  // need to increment the version yourself. The server will increment the version for you after each update.
103
103
  rpc UpdateNexusEndpoint(UpdateNexusEndpointRequest) returns (UpdateNexusEndpointResponse) {
104
104
  option (google.api.http) = {
105
- post: "/api/v1/nexus/endpoints/{id}/update"
105
+ post: "/nexus/endpoints/{id}/update"
106
106
  body: "*"
107
107
  };
108
108
  }
@@ -110,7 +110,7 @@ service OperatorService {
110
110
  // Delete an incoming Nexus service by ID.
111
111
  rpc DeleteNexusEndpoint(DeleteNexusEndpointRequest) returns (DeleteNexusEndpointResponse) {
112
112
  option (google.api.http) = {
113
- delete: "/api/v1/nexus/endpoints/{id}"
113
+ delete: "/nexus/endpoints/{id}"
114
114
  };
115
115
  }
116
116
 
@@ -120,7 +120,7 @@ service OperatorService {
120
120
  // earlier than the previous page's last endpoint's ID may be missed.
121
121
  rpc ListNexusEndpoints(ListNexusEndpointsRequest) returns (ListNexusEndpointsResponse) {
122
122
  option (google.api.http) = {
123
- get: "/api/v1/nexus/endpoints"
123
+ get: "/nexus/endpoints"
124
124
  };
125
125
  }
126
126
  }
@@ -0,0 +1,96 @@
1
+ // The MIT License
2
+ //
3
+ // Copyright (c) 2024 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.sdk.v1;
26
+
27
+ option go_package = "go.temporal.io/api/sdk/v1;sdk";
28
+ option java_package = "io.temporal.api.sdk.v1";
29
+ option java_multiple_files = true;
30
+ option java_outer_classname = "EnhancedStackTraceProto";
31
+ option ruby_package = "Temporalio::Api::Sdk::V1";
32
+ option csharp_namespace = "Temporalio.Api.Sdk.V1";
33
+
34
+ // Internal structure used to create worker stack traces with references to code.
35
+ message EnhancedStackTrace {
36
+ // Information pertaining to the SDK that the trace has been captured from.
37
+ StackTraceSDKInfo sdk = 1;
38
+
39
+ // Mapping of file path to file contents.
40
+ map<string, StackTraceFileSlice> sources = 2;
41
+
42
+ // Collection of stacks captured.
43
+ repeated StackTrace stacks = 3;
44
+ }
45
+
46
+ // Information pertaining to the SDK that the trace has been captured from.
47
+ // (-- api-linter: core::0123::resource-annotation=disabled
48
+ // aip.dev/not-precedent: Naming SDK version is optional. --)
49
+ message StackTraceSDKInfo {
50
+ // Name of the SDK
51
+ string name = 1;
52
+
53
+ // Version string of the SDK
54
+ string version = 2;
55
+ }
56
+
57
+ // "Slice" of a file starting at line_offset -- a line offset and code fragment corresponding to the worker's stack.
58
+ message StackTraceFileSlice {
59
+ // Only used (possibly) to trim the file without breaking syntax highlighting. This is not optional, unlike
60
+ // the `line` property of a `StackTraceFileLocation`.
61
+ // (-- api-linter: core::0141::forbidden-types=disabled
62
+ // aip.dev/not-precedent: These really shouldn't have negative values. --)
63
+ uint32 line_offset = 1;
64
+
65
+ // Slice of a file with the respective OS-specific line terminator.
66
+ string content = 2;
67
+ }
68
+
69
+ // More specific location details of a file: its path, precise line and column numbers if applicable, and function name if available.
70
+ // In essence, a pointer to a location in a file
71
+ message StackTraceFileLocation {
72
+ // Path to source file (absolute or relative).
73
+ // If the paths are relative, ensure that they are all relative to the same root.
74
+ string file_path = 1;
75
+
76
+ // Optional; If possible, SDK should send this -- this is required for displaying the code location.
77
+ // If not provided, set to -1.
78
+ int32 line = 2;
79
+
80
+ // Optional; if possible, SDK should send this.
81
+ // If not provided, set to -1.
82
+ int32 column = 3;
83
+
84
+ // Function name this line belongs to, if applicable.
85
+ // Used for falling back to stack trace view.
86
+ string function_name = 4;
87
+
88
+ // Flag to communicate whether a location should be hidden by default in the stack view.
89
+ bool internal_code = 5;
90
+ }
91
+
92
+ // Collection of FileLocation messages from a single stack.
93
+ message StackTrace {
94
+ // Collection of `FileLocation`s, each for a stack frame that comprise a stack trace.
95
+ repeated StackTraceFileLocation locations = 1;
96
+ }
@@ -0,0 +1,49 @@
1
+ // The MIT License
2
+ //
3
+ // Copyright (c) 2024 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.sdk.v1;
26
+
27
+ option go_package = "go.temporal.io/api/sdk/v1;sdk";
28
+ option java_package = "io.temporal.api.sdk.v1";
29
+ option java_multiple_files = true;
30
+ option java_outer_classname = "UserMetadataProto";
31
+ option ruby_package = "Temporalio::Api::Sdk::V1";
32
+ option csharp_namespace = "Temporalio.Api.Sdk.V1";
33
+
34
+
35
+ import "temporal/api/common/v1/message.proto";
36
+
37
+ // Information a user can set, often for use by user interfaces.
38
+ message UserMetadata {
39
+ // Short-form text that provides a summary. This payload should be a "json/plain"-encoded payload
40
+ // that is a single JSON string for use in user interfaces. User interface formatting may not
41
+ // apply to this text when used in "title" situations. The payload data section is limited to 400
42
+ // bytes by default.
43
+ temporal.api.common.v1.Payload summary = 1;
44
+
45
+ // Long-form text that provides details. This payload should be a "json/plain"-encoded payload
46
+ // that is a single JSON string for use in user interfaces. User interface formatting may apply to
47
+ // this text in common use. The payload data section is limited to 20000 bytes by default.
48
+ temporal.api.common.v1.Payload details = 2;
49
+ }
@@ -35,6 +35,9 @@ option csharp_namespace = "Temporalio.Api.Sdk.V1";
35
35
  message WorkflowMetadata {
36
36
  // Metadata provided at declaration or creation time.
37
37
  WorkflowDefinition definition = 1;
38
+ // Current long-form details of the workflow's state. This is used by user interfaces to show
39
+ // long-form text. This text may be formatted by the user interface.
40
+ string current_details = 2;
38
41
  }
39
42
 
40
43
  // (-- api-linter: core::0203::optional=disabled --)
@@ -42,13 +45,9 @@ message WorkflowDefinition {
42
45
  // A name scoped by the task queue that maps to this workflow definition.
43
46
  // If missing, this workflow is a dynamic workflow.
44
47
  string type = 1;
45
- // An optional workflow description provided by the application.
46
- // By convention, external tools may interpret its first part,
47
- // i.e., ending with a line break, as a summary of the description.
48
- string description = 2;
49
- repeated WorkflowInteractionDefinition query_definitions = 3;
50
- repeated WorkflowInteractionDefinition signal_definitions = 4;
51
- repeated WorkflowInteractionDefinition update_definitions = 5;
48
+ repeated WorkflowInteractionDefinition query_definitions = 2;
49
+ repeated WorkflowInteractionDefinition signal_definitions = 3;
50
+ repeated WorkflowInteractionDefinition update_definitions = 4;
52
51
  }
53
52
 
54
53
  // (-- api-linter: core::0123::resource-annotation=disabled
@@ -68,12 +68,40 @@ message TaskQueueVersionSelection {
68
68
  message TaskQueueVersionInfo {
69
69
  // Task Queue info per Task Type. Key is the numerical value of the temporal.api.enums.v1.TaskQueueType enum.
70
70
  map<int32, TaskQueueTypeInfo> types_info = 1;
71
+
72
+ // Task Reachability is eventually consistent; there may be a delay until it converges to the most
73
+ // accurate value but it is designed in a way to take the more conservative side until it converges.
74
+ // For example REACHABLE is more conservative than CLOSED_WORKFLOWS_ONLY.
75
+ //
76
+ // Note: future activities who inherit their workflow's Build ID but not its Task Queue will not be
77
+ // accounted for reachability as server cannot know if they'll happen as they do not use
78
+ // assignment rules of their Task Queue. Same goes for Child Workflows or Continue-As-New Workflows
79
+ // who inherit the parent/previous workflow's Build ID but not its Task Queue. In those cases, make
80
+ // sure to query reachability for the parent/previous workflow's Task Queue as well.
71
81
  temporal.api.enums.v1.BuildIdTaskReachability task_reachability = 2;
72
82
  }
73
83
 
74
84
  message TaskQueueTypeInfo {
75
85
  // Unversioned workers (with `useVersioning=false`) are reported in unversioned result even if they set a Build ID.
76
86
  repeated PollerInfo pollers = 1;
87
+ TaskQueueStats stats = 2;
88
+ }
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.
93
+ 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.
96
+ 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.
98
+ 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.
101
+ 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.
104
+ float tasks_dispatch_rate = 4;
77
105
  }
78
106
 
79
107
  // Deprecated. Use `InternalTaskQueueStatus`. This is kept until `DescribeTaskQueue` supports legacy behavior.
@@ -140,29 +168,31 @@ message RampByPercentage {
140
168
  float ramp_percentage = 1;
141
169
  }
142
170
 
143
- // These rules assign a Build ID to Unassigned Workflow Executions and
144
- // Activities.
171
+ // Assignment rules are applied to *new* Workflow and Activity executions at
172
+ // schedule time to assign them to a Build ID.
145
173
  //
146
- // Specifically, assignment rules are applied to the following Executions or
147
- // Activities when they are scheduled in a Task Queue:
148
- // - Generally, any new Workflow Execution, except:
149
- // - When A Child Workflow or a Continue-As-New Execution inherits the
150
- // Build ID from its parent/previous execution by setting the
151
- // `inherit_build_id` flag.
152
- // - Workflow Executions started Eagerly are assigned to the Build ID of
153
- // the Starter.
154
- // - An Activity that is scheduled on a Task Queue different from the one
155
- // their Workflow runs on, unless the `use_workflow_build_id` flag is set.
174
+ // Assignment rules will not be used in the following cases:
175
+ // - Child Workflows or Continue-As-New Executions who inherit their
176
+ // parent/previous Workflow's assigned Build ID (by setting the
177
+ // `inherit_build_id` flag - default behavior in SDKs when the same Task Queue
178
+ // is used.)
179
+ // - An Activity that inherits the assigned Build ID of its Workflow (by
180
+ // setting the `use_workflow_build_id` flag - default behavior in SDKs
181
+ // when the same Task Queue is used.)
156
182
  //
157
183
  // In absence of (applicable) redirect rules (`CompatibleBuildIdRedirectRule`s)
158
184
  // the task will be dispatched to Workers of the Build ID determined by the
159
- // assignment rules. Otherwise, the final Build ID will be determined by the
160
- // redirect rules.
185
+ // assignment rules (or inherited). Otherwise, the final Build ID will be
186
+ // determined by the redirect rules.
187
+ //
188
+ // Once a Workflow completes its first Workflow Task in a particular Build ID it
189
+ // stays in that Build ID regardless of changes to assignment rules. Redirect
190
+ // rules can be used to move the workflow to another compatible Build ID.
161
191
  //
162
- // When using Worker Versioning, in the steady state, for a given Task Queue,
163
- // there should typically be exactly one assignment rule to send all Unassigned
164
- // tasks to the latest Build ID. Existence of at least one such "unconditional"
165
- // rule at all times is enforce by the system, unless the `force` flag is used
192
+ // When using Worker Versioning on a Task Queue, in the steady state,
193
+ // there should typically be a single assignment rule to send all new executions
194
+ // to the latest Build ID. Existence of at least one such "unconditional"
195
+ // rule at all times is enforces by the system, unless the `force` flag is used
166
196
  // by the user when replacing/deleting these rules (for exceptional cases).
167
197
  //
168
198
  // During a deployment, one or more additional rules can be added to assign a
@@ -173,10 +203,8 @@ message RampByPercentage {
173
203
  // applied and the rest will be ignored.
174
204
  //
175
205
  // In the event that no assignment rule is applicable on a task (or the Task
176
- // Queue is simply not versioned), the tasks will be sent to unversioned
177
- // workers, if available. Otherwise, they remain Unassigned, and will be
178
- // retried for assignment, or dispatch to unversioned workers, at a later time
179
- // depending on the availability of workers.
206
+ // Queue is simply not versioned), the tasks will be dispatched to an
207
+ // unversioned Worker.
180
208
  message BuildIdAssignmentRule {
181
209
  string target_build_id = 1;
182
210
 
@@ -211,10 +239,13 @@ message BuildIdAssignmentRule {
211
239
  // - To be able to Reset an old Execution so it can run on the current
212
240
  // (compatible) Build ID.
213
241
  //
214
- // Redirect rules can be chained, but only the last rule in the chain can have
215
- // a ramp.
242
+ // Redirect rules can be chained.
216
243
  message CompatibleBuildIdRedirectRule {
217
244
  string source_build_id = 1;
245
+ // Target Build ID must be compatible with the Source Build ID; that is it
246
+ // must be able to process event histories made by the Source Build ID by
247
+ // using [Patching](https://docs.temporal.io/workflows#patching) or other
248
+ // means.
218
249
  string target_build_id = 2;
219
250
  }
220
251
 
@@ -40,6 +40,7 @@ import "temporal/api/enums/v1/workflow.proto";
40
40
  import "temporal/api/common/v1/message.proto";
41
41
  import "temporal/api/failure/v1/message.proto";
42
42
  import "temporal/api/taskqueue/v1/message.proto";
43
+ import "temporal/api/sdk/v1/user_metadata.proto";
43
44
 
44
45
  message WorkflowExecutionInfo {
45
46
  temporal.api.common.v1.WorkflowExecution execution = 1;
@@ -97,6 +98,8 @@ message WorkflowExecutionConfig {
97
98
  google.protobuf.Duration workflow_execution_timeout = 2;
98
99
  google.protobuf.Duration workflow_run_timeout = 3;
99
100
  google.protobuf.Duration default_workflow_task_timeout = 4;
101
+ // User metadata provided on start workflow.
102
+ temporal.api.sdk.v1.UserMetadata user_metadata = 5;
100
103
  }
101
104
 
102
105
  message PendingActivityInfo {
@@ -197,6 +200,10 @@ message NewWorkflowExecutionInfo {
197
200
  temporal.api.common.v1.Memo memo = 11;
198
201
  temporal.api.common.v1.SearchAttributes search_attributes = 12;
199
202
  temporal.api.common.v1.Header header = 13;
203
+ // Metadata on the workflow if it is started. This is carried over to the WorkflowExecutionConfig
204
+ // for use by user interfaces to display the fixed as-of-start summary and details of the
205
+ // workflow.
206
+ temporal.api.sdk.v1.UserMetadata user_metadata = 14;
200
207
  }
201
208
 
202
209
  // CallbackInfo contains the state of an attached workflow callback.
@@ -56,6 +56,7 @@ import "temporal/api/update/v1/message.proto";
56
56
  import "temporal/api/version/v1/message.proto";
57
57
  import "temporal/api/batch/v1/message.proto";
58
58
  import "temporal/api/sdk/v1/task_complete_metadata.proto";
59
+ import "temporal/api/sdk/v1/user_metadata.proto";
59
60
  import "temporal/api/nexus/v1/message.proto";
60
61
 
61
62
  import "google/protobuf/duration.proto";
@@ -192,6 +193,10 @@ message StartWorkflowExecutionRequest {
192
193
  // If the workflow continues-as-new, these callbacks will be carried over to the new execution.
193
194
  // Callback addresses must be whitelisted in the server's dynamic configuration.
194
195
  repeated temporal.api.common.v1.Callback completion_callbacks = 21;
196
+ // Metadata on the workflow if it is started. This is carried over to the WorkflowExecutionInfo
197
+ // for use by user interfaces to display the fixed as-of-start summary and details of the
198
+ // workflow.
199
+ temporal.api.sdk.v1.UserMetadata user_metadata = 23;
195
200
  }
196
201
 
197
202
  message StartWorkflowExecutionResponse {
@@ -273,8 +278,16 @@ message PollWorkflowTaskQueueResponse {
273
278
  int64 started_event_id = 5;
274
279
  // Starting at 1, the number of attempts to complete this task by any worker.
275
280
  int32 attempt = 6;
276
- // A hint that there are more tasks already present in this task queue. Can be used to
277
- // prioritize draining a sticky queue before polling from a normal queue.
281
+ // A hint that there are more tasks already present in this task queue
282
+ // partition. Can be used to prioritize draining a sticky queue.
283
+ //
284
+ // Specifically, the returned number is the number of tasks remaining in
285
+ // the in-memory buffer for this partition, which is currently capped at
286
+ // 1000. Because sticky queues only have one partition, this number is
287
+ // more useful when draining them. Normal queues, typically having more than one
288
+ // partition, will return a number representing only some portion of the
289
+ // overall backlog. Subsequent RPCs may not hit the same partition as
290
+ // this call.
278
291
  int64 backlog_count_hint = 7;
279
292
  // The history for this workflow, which will either be complete or partial. Partial histories
280
293
  // are sent to workers who have signaled that they are using a sticky queue when completing
@@ -676,6 +689,10 @@ message SignalWithStartWorkflowExecutionRequest {
676
689
  google.protobuf.Duration workflow_start_delay = 20;
677
690
  // Indicates that a new workflow task should not be generated when this signal is received.
678
691
  bool skip_generate_workflow_task = 21;
692
+ // Metadata on the workflow if it is started. This is carried over to the WorkflowExecutionInfo
693
+ // for use by user interfaces to display the fixed as-of-start summary and details of the
694
+ // workflow.
695
+ temporal.api.sdk.v1.UserMetadata user_metadata = 23;
679
696
  }
680
697
 
681
698
  message SignalWithStartWorkflowExecutionResponse {
@@ -902,8 +919,8 @@ message DescribeTaskQueueRequest {
902
919
 
903
920
  // Task queue types to report info about. If not specified, all types are considered.
904
921
  repeated temporal.api.enums.v1.TaskQueueType task_queue_types = 7;
905
- // Report backlog info for the requested task queue types and versions
906
- // bool report_backlog_info = 8;
922
+ // Report stats for the requested task queue types and versions
923
+ bool report_stats = 8;
907
924
  // Report list of pollers for requested task queue types and versions
908
925
  bool report_pollers = 9;
909
926
  // Report task reachability for the requested versions and all task types (task reachability is not reported