@temporalio/core-bridge 1.12.0 → 1.12.2

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 (116) hide show
  1. package/Cargo.lock +64 -119
  2. package/Cargo.toml +1 -1
  3. package/index.js +3 -2
  4. package/package.json +3 -3
  5. package/releases/aarch64-apple-darwin/index.node +0 -0
  6. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  7. package/releases/x86_64-apple-darwin/index.node +0 -0
  8. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  9. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  10. package/sdk-core/.cargo/config.toml +1 -2
  11. package/sdk-core/.github/workflows/per-pr.yml +2 -0
  12. package/sdk-core/AGENTS.md +7 -0
  13. package/sdk-core/Cargo.toml +9 -5
  14. package/sdk-core/README.md +6 -5
  15. package/sdk-core/client/Cargo.toml +3 -2
  16. package/sdk-core/client/src/lib.rs +17 -8
  17. package/sdk-core/client/src/metrics.rs +57 -23
  18. package/sdk-core/client/src/raw.rs +33 -15
  19. package/sdk-core/core/Cargo.toml +11 -9
  20. package/sdk-core/core/benches/workflow_replay.rs +114 -15
  21. package/sdk-core/core/src/core_tests/activity_tasks.rs +18 -18
  22. package/sdk-core/core/src/core_tests/child_workflows.rs +4 -4
  23. package/sdk-core/core/src/core_tests/determinism.rs +6 -6
  24. package/sdk-core/core/src/core_tests/local_activities.rs +20 -20
  25. package/sdk-core/core/src/core_tests/mod.rs +40 -5
  26. package/sdk-core/core/src/core_tests/queries.rs +25 -16
  27. package/sdk-core/core/src/core_tests/replay_flag.rs +3 -3
  28. package/sdk-core/core/src/core_tests/updates.rs +3 -3
  29. package/sdk-core/core/src/core_tests/workers.rs +9 -7
  30. package/sdk-core/core/src/core_tests/workflow_tasks.rs +40 -42
  31. package/sdk-core/core/src/ephemeral_server/mod.rs +1 -19
  32. package/sdk-core/core/src/lib.rs +10 -1
  33. package/sdk-core/core/src/pollers/poll_buffer.rs +2 -2
  34. package/sdk-core/core/src/replay/mod.rs +3 -3
  35. package/sdk-core/core/src/telemetry/metrics.rs +306 -152
  36. package/sdk-core/core/src/telemetry/mod.rs +11 -4
  37. package/sdk-core/core/src/telemetry/otel.rs +134 -131
  38. package/sdk-core/core/src/telemetry/prometheus_meter.rs +885 -0
  39. package/sdk-core/core/src/telemetry/prometheus_server.rs +48 -28
  40. package/sdk-core/core/src/test_help/mod.rs +27 -12
  41. package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +7 -7
  42. package/sdk-core/core/src/worker/activities.rs +4 -4
  43. package/sdk-core/core/src/worker/client/mocks.rs +10 -3
  44. package/sdk-core/core/src/worker/client.rs +68 -5
  45. package/sdk-core/core/src/worker/heartbeat.rs +229 -0
  46. package/sdk-core/core/src/worker/mod.rs +35 -14
  47. package/sdk-core/core/src/worker/tuner/resource_based.rs +4 -4
  48. package/sdk-core/core/src/worker/workflow/history_update.rs +71 -19
  49. package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -2
  50. package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +1 -1
  51. package/sdk-core/core/src/worker/workflow/machines/nexus_operation_state_machine.rs +31 -48
  52. package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -2
  53. package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +3 -3
  54. package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +4 -1
  55. package/sdk-core/core/src/worker/workflow/managed_run.rs +1 -1
  56. package/sdk-core/core/src/worker/workflow/mod.rs +15 -15
  57. package/sdk-core/core-api/Cargo.toml +2 -2
  58. package/sdk-core/core-api/src/envconfig.rs +204 -99
  59. package/sdk-core/core-api/src/lib.rs +9 -0
  60. package/sdk-core/core-api/src/telemetry/metrics.rs +548 -100
  61. package/sdk-core/core-api/src/worker.rs +11 -5
  62. package/sdk-core/core-c-bridge/Cargo.toml +49 -0
  63. package/sdk-core/core-c-bridge/build.rs +26 -0
  64. package/sdk-core/core-c-bridge/include/temporal-sdk-core-c-bridge.h +817 -0
  65. package/sdk-core/core-c-bridge/src/client.rs +679 -0
  66. package/sdk-core/core-c-bridge/src/lib.rs +245 -0
  67. package/sdk-core/core-c-bridge/src/metric.rs +682 -0
  68. package/sdk-core/core-c-bridge/src/random.rs +61 -0
  69. package/sdk-core/core-c-bridge/src/runtime.rs +445 -0
  70. package/sdk-core/core-c-bridge/src/testing.rs +282 -0
  71. package/sdk-core/core-c-bridge/src/tests/context.rs +644 -0
  72. package/sdk-core/core-c-bridge/src/tests/mod.rs +178 -0
  73. package/sdk-core/core-c-bridge/src/tests/utils.rs +108 -0
  74. package/sdk-core/core-c-bridge/src/worker.rs +1069 -0
  75. package/sdk-core/etc/deps.svg +64 -64
  76. package/sdk-core/sdk/src/activity_context.rs +6 -4
  77. package/sdk-core/sdk/src/lib.rs +49 -27
  78. package/sdk-core/sdk/src/workflow_future.rs +18 -25
  79. package/sdk-core/sdk-core-protos/protos/api_upstream/README.md +4 -0
  80. package/sdk-core/sdk-core-protos/protos/api_upstream/buf.yaml +0 -2
  81. package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +630 -83
  82. package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +632 -78
  83. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/batch/v1/message.proto +4 -4
  84. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/command/v1/message.proto +6 -4
  85. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +2 -2
  86. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/deployment/v1/message.proto +32 -2
  87. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/common.proto +10 -1
  88. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/deployment.proto +26 -0
  89. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
  90. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/reset.proto +4 -4
  91. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
  92. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +47 -31
  93. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +4 -4
  94. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/schedule/v1/message.proto +7 -1
  95. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/worker/v1/message.proto +134 -0
  96. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +14 -11
  97. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +148 -37
  98. package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +21 -0
  99. package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +4 -4
  100. package/sdk-core/sdk-core-protos/src/history_builder.rs +9 -5
  101. package/sdk-core/sdk-core-protos/src/lib.rs +96 -6
  102. package/sdk-core/test-utils/src/lib.rs +11 -3
  103. package/sdk-core/tests/cloud_tests.rs +3 -3
  104. package/sdk-core/tests/heavy_tests.rs +11 -3
  105. package/sdk-core/tests/integ_tests/client_tests.rs +12 -13
  106. package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +1 -1
  107. package/sdk-core/tests/integ_tests/metrics_tests.rs +188 -83
  108. package/sdk-core/tests/integ_tests/polling_tests.rs +1 -1
  109. package/sdk-core/tests/integ_tests/queries_tests.rs +56 -40
  110. package/sdk-core/tests/integ_tests/update_tests.rs +2 -7
  111. package/sdk-core/tests/integ_tests/worker_tests.rs +3 -4
  112. package/sdk-core/tests/integ_tests/worker_versioning_tests.rs +3 -7
  113. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +3 -5
  114. package/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +24 -17
  115. package/src/client.rs +6 -0
  116. package/src/metrics.rs +6 -6
@@ -45,7 +45,7 @@ message WorkflowExecutionInfo {
45
45
  int64 history_size_bytes = 15;
46
46
  // If set, the most recent worker version stamp that appeared in a workflow task completion
47
47
  // Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
48
- temporal.api.common.v1.WorkerVersionStamp most_recent_worker_version_stamp = 16;
48
+ temporal.api.common.v1.WorkerVersionStamp most_recent_worker_version_stamp = 16 [deprecated = true];
49
49
  // Workflow execution duration is defined as difference between close time and execution time.
50
50
  // This field is only populated if the workflow is closed.
51
51
  google.protobuf.Duration execution_duration = 17;
@@ -137,7 +137,7 @@ message WorkflowExecutionVersioningInfo {
137
137
  // behaviors.
138
138
  // This field is first set after an execution completes its first workflow task on a versioned
139
139
  // worker, and set again on completion of every subsequent workflow task.
140
- // For child workflows of Pinned parents, this will be set to Pinned (along with `version`) when
140
+ // For child workflows of Pinned parents, this will be set to Pinned (along with `deployment_version`) when
141
141
  // the the child starts so that child's first workflow task goes to the same Version as the
142
142
  // parent. After the first workflow task, it depends on the child workflow itself if it wants
143
143
  // to stay pinned or become unpinned (according to Versioning Behavior set in the worker).
@@ -167,7 +167,8 @@ message WorkflowExecutionVersioningInfo {
167
167
  // precedence over SDK-sent `behavior` (and `version` when override is PINNED). An
168
168
  // override can be set when starting a new execution, as well as afterwards by calling the
169
169
  // `UpdateWorkflowExecutionOptions` API.
170
- // Pinned overrides are automatically inherited by child workflows.
170
+ // Pinned overrides are automatically inherited by child workflows, continue-as-new workflows,
171
+ // workflow retries, and cron workflows.
171
172
  VersioningOverride versioning_override = 3;
172
173
  // When present, indicates the workflow is transitioning to a different deployment. Can
173
174
  // indicate one of the following transitions: unversioned -> versioned, versioned -> versioned
@@ -202,7 +203,7 @@ message WorkflowExecutionVersioningInfo {
202
203
  // start a transition to that version and continue execution there.
203
204
  // A version transition can only exist while there is a pending or started workflow task.
204
205
  // Once the pending workflow task completes on the transition's target version, the
205
- // transition completes and the workflow's `behavior`, and `version` fields are updated per the
206
+ // transition completes and the workflow's `behavior`, and `deployment_version` fields are updated per the
206
207
  // worker's task completion response.
207
208
  // Pending activities will not start new attempts during a transition. Once the transition is
208
209
  // completed, pending activities will start their next attempt on the new version.
@@ -260,16 +261,16 @@ message PendingActivityInfo {
260
261
  // independently-assigned build ID to the database. This case heals automatically once the task is dispatched.
261
262
  // Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
262
263
  oneof assigned_build_id {
263
- // When present, it means this activity is assigned to the build ID of its workflow.
264
+ // Deprecated. When present, it means this activity is assigned to the build ID of its workflow.
264
265
  google.protobuf.Empty use_workflow_build_id = 13 [deprecated = true];
265
- // This means the activity is independently versioned and not bound to the build ID of its workflow.
266
+ // Deprecated. This means the activity is independently versioned and not bound to the build ID of its workflow.
266
267
  // The activity will use the build id in this field instead.
267
268
  // If the task fails and is scheduled again, the assigned build ID may change according to the latest versioning
268
269
  // rules.
269
270
  string last_independently_assigned_build_id = 14 [deprecated = true];
270
271
  }
271
- // The version stamp of the worker to whom this activity was most recently dispatched
272
- // Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
272
+ // Deprecated. The version stamp of the worker to whom this activity was most recently dispatched
273
+ // This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
273
274
  temporal.api.common.v1.WorkerVersionStamp last_worker_version_stamp = 15 [deprecated = true];
274
275
 
275
276
  // The time activity will wait until the next retry.
@@ -370,7 +371,7 @@ message ResetPoints {
370
371
  message ResetPointInfo {
371
372
  // Worker build id.
372
373
  string build_id = 7;
373
- // A worker binary version identifier (deprecated).
374
+ // Deprecated. A worker binary version identifier.
374
375
  string binary_checksum = 1 [deprecated = true];
375
376
  // The first run ID in the execution chain that was touched by this worker build.
376
377
  string run_id = 2;
@@ -465,8 +466,8 @@ message PendingNexusOperationInfo {
465
466
 
466
467
  // Operation ID. Only set for asynchronous operations after a successful StartOperation call.
467
468
  //
468
- // Deprecated: Renamed to operation_token.
469
- string operation_id = 4;
469
+ // Deprecated. Renamed to operation_token.
470
+ string operation_id = 4 [deprecated = true];
470
471
 
471
472
  // Schedule-to-close timeout for this operation.
472
473
  // This is the only timeout settable by a workflow.
@@ -535,6 +536,8 @@ message WorkflowExecutionOptions {
535
536
  // `WorkflowExecutionInfo.VersioningInfo` for more information. To remove the override, call
536
537
  // `UpdateWorkflowExecutionOptions` with a null `VersioningOverride`, and use the `update_mask`
537
538
  // to indicate that it should be mutated.
539
+ // Pinned overrides are automatically inherited by child workflows, continue-as-new workflows,
540
+ // workflow retries, and cron workflows.
538
541
  message VersioningOverride {
539
542
  // Indicates whether to override the workflow to be AutoUpgrade or Pinned.
540
543
  oneof override {
@@ -40,6 +40,7 @@ import "temporal/api/batch/v1/message.proto";
40
40
  import "temporal/api/sdk/v1/task_complete_metadata.proto";
41
41
  import "temporal/api/sdk/v1/user_metadata.proto";
42
42
  import "temporal/api/nexus/v1/message.proto";
43
+ import "temporal/api/worker/v1/message.proto";
43
44
 
44
45
  import "google/protobuf/duration.proto";
45
46
  import "google/protobuf/field_mask.proto";
@@ -254,17 +255,20 @@ message PollWorkflowTaskQueueRequest {
254
255
  temporal.api.taskqueue.v1.TaskQueue task_queue = 2;
255
256
  // The identity of the worker/client who is polling this task queue
256
257
  string identity = 3;
257
- // DEPRECATED since 1.21 - use `deployment_options` instead.
258
+ // Deprecated. Use deployment_options instead.
258
259
  // Each worker process should provide an ID unique to the specific set of code it is running
259
260
  // "checksum" in this field name isn't very accurate, it should be though of as an id.
260
261
  string binary_checksum = 4 [deprecated = true];
262
+ // Deprecated. Use deployment_options instead.
261
263
  // Information about this worker's build identifier and if it is choosing to use the versioning
262
264
  // feature. See the `WorkerVersionCapabilities` docstring for more.
263
- // Deprecated. Replaced by deployment_options.
264
265
  temporal.api.common.v1.WorkerVersionCapabilities worker_version_capabilities = 5 [deprecated = true];
265
266
  // Worker deployment options that user has set in the worker.
266
267
  // Experimental. Worker Deployments are experimental and might significantly change in the future.
267
268
  temporal.api.deployment.v1.WorkerDeploymentOptions deployment_options = 6;
269
+
270
+ // Worker info to be sent to the server.
271
+ temporal.api.worker.v1.WorkerHeartbeat worker_heartbeat = 7;
268
272
  }
269
273
 
270
274
  message PollWorkflowTaskQueueResponse {
@@ -339,7 +343,7 @@ message RespondWorkflowTaskCompletedRequest {
339
343
  // something useful, but cannot complete it within the workflow task timeout. Local activities
340
344
  // which run for longer than the task timeout being the prime example.
341
345
  bool force_create_new_workflow_task = 6;
342
- // DEPRECATED since 1.21 - use `deployment_options` instead.
346
+ // Deprecated. Use `deployment_options` instead.
343
347
  // Worker process' unique binary id
344
348
  string binary_checksum = 7 [deprecated = true];
345
349
  // Responses to the `queries` field in the task being responded to
@@ -402,7 +406,7 @@ message RespondWorkflowTaskFailedRequest {
402
406
  temporal.api.failure.v1.Failure failure = 3;
403
407
  // The identity of the worker/client
404
408
  string identity = 4;
405
- // DEPRECATED since 1.21 - use `deployment_options` instead.
409
+ // Deprecated. Use `deployment_options` instead.
406
410
  // Worker process' unique binary id
407
411
  string binary_checksum = 5 [deprecated = true];
408
412
  string namespace = 6;
@@ -436,6 +440,10 @@ message PollActivityTaskQueueRequest {
436
440
  temporal.api.common.v1.WorkerVersionCapabilities worker_version_capabilities = 5 [deprecated = true];
437
441
  // Worker deployment options that user has set in the worker.
438
442
  temporal.api.deployment.v1.WorkerDeploymentOptions deployment_options = 6;
443
+
444
+ // Worker info to be sent to the server.
445
+ temporal.api.worker.v1.WorkerHeartbeat worker_heartbeat = 7;
446
+
439
447
  }
440
448
 
441
449
  message PollActivityTaskQueueResponse {
@@ -713,8 +721,8 @@ message SignalWorkflowExecutionRequest {
713
721
  string identity = 5;
714
722
  // Used to de-dupe sent signals
715
723
  string request_id = 6;
716
- // Deprecated
717
- string control = 7;
724
+ // Deprecated.
725
+ string control = 7 [deprecated = true];
718
726
  // Headers that are passed with the signal to the processing workflow.
719
727
  // These can include things like auth or tracing tokens.
720
728
  temporal.api.common.v1.Header header = 8;
@@ -760,8 +768,8 @@ message SignalWithStartWorkflowExecutionRequest {
760
768
  string signal_name = 12;
761
769
  // Serialized value(s) to provide with the signal
762
770
  temporal.api.common.v1.Payloads signal_input = 13;
763
- // Deprecated
764
- string control = 14;
771
+ // Deprecated.
772
+ string control = 14 [deprecated = true];
765
773
  // Retry policy for the workflow
766
774
  temporal.api.common.v1.RetryPolicy retry_policy = 15;
767
775
  // See https://docs.temporal.io/docs/content/what-is-a-temporal-cron-job/
@@ -809,15 +817,17 @@ message ResetWorkflowExecutionRequest {
809
817
  int64 workflow_task_finish_event_id = 4;
810
818
  // Used to de-dupe reset requests
811
819
  string request_id = 5;
812
- // Event types to be reapplied (deprecated)
820
+ // Deprecated. Use `options`.
813
821
  // Default: RESET_REAPPLY_TYPE_SIGNAL
814
- temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 6;
822
+ temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 6 [deprecated = true];
815
823
  // Event types not to be reapplied
816
824
  repeated temporal.api.enums.v1.ResetReapplyExcludeType reset_reapply_exclude_types = 7;
817
825
  // Operations to perform after the workflow has been reset. These operations will be applied
818
826
  // to the *new* run of the workflow execution in the order they are provided.
819
827
  // All operations are applied to the workflow before the first new workflow task is generated
820
828
  repeated temporal.api.workflow.v1.PostResetOperation post_reset_operations = 8;
829
+ // The identity of the worker/client
830
+ string identity = 9;
821
831
  }
822
832
 
823
833
  message ResetWorkflowExecutionResponse {
@@ -975,6 +985,9 @@ message RespondQueryTaskCompletedRequest {
975
985
  // traces.
976
986
  // Mutually exclusive with `query_result`. Set when the query fails.
977
987
  temporal.api.failure.v1.Failure failure = 7;
988
+ // Why did the task fail? It's important to note that many of the variants in this enum cannot
989
+ // apply to worker responses. See the type's doc for more.
990
+ temporal.api.enums.v1.WorkflowTaskFailedCause cause = 8;
978
991
  }
979
992
 
980
993
  message RespondQueryTaskCompletedResponse {
@@ -993,6 +1006,8 @@ message ShutdownWorkerRequest {
993
1006
  string sticky_task_queue = 2;
994
1007
  string identity = 3;
995
1008
  string reason = 4;
1009
+
1010
+ temporal.api.worker.v1.WorkerHeartbeat worker_heartbeat = 5;
996
1011
  }
997
1012
 
998
1013
  message ShutdownWorkerResponse {
@@ -1032,44 +1047,52 @@ message DescribeWorkflowExecutionResponse {
1032
1047
  // aip.dev/not-precedent: field_behavior annotation not available in our gogo fork --)
1033
1048
  message DescribeTaskQueueRequest {
1034
1049
  string namespace = 1;
1035
- // Sticky queues are not supported in `ENHANCED` mode.
1050
+
1051
+ // Sticky queues are not supported in deprecated ENHANCED mode.
1036
1052
  temporal.api.taskqueue.v1.TaskQueue task_queue = 2;
1037
- // Deprecated. Use `ENHANCED` mode with `task_queue_types`. Ignored in `ENHANCED` mode.
1053
+
1038
1054
  // If unspecified (TASK_QUEUE_TYPE_UNSPECIFIED), then default value (TASK_QUEUE_TYPE_WORKFLOW) will be used.
1055
+ // Only supported in default mode (use `task_queue_types` in ENHANCED mode instead).
1039
1056
  temporal.api.enums.v1.TaskQueueType task_queue_type = 3;
1040
- // Deprecated. Ignored in `ENHANCED` mode.
1041
- bool include_task_queue_status = 4;
1042
1057
 
1043
- // All options except `task_queue_type` and `include_task_queue_status` are only available in the `ENHANCED` mode.
1044
- temporal.api.enums.v1.DescribeTaskQueueMode api_mode = 5;
1058
+ // Report stats for the requested task queue type(s).
1059
+ bool report_stats = 8;
1060
+
1061
+ // Deprecated, use `report_stats` instead.
1062
+ // If true, the task queue status will be included in the response.
1063
+ bool include_task_queue_status = 4 [deprecated = true];
1045
1064
 
1065
+ // Deprecated. ENHANCED mode is also being deprecated.
1066
+ // Select the API mode to use for this request: DEFAULT mode (if unset) or ENHANCED mode.
1067
+ // Consult the documentation for each field to understand which mode it is supported in.
1068
+ temporal.api.enums.v1.DescribeTaskQueueMode api_mode = 5 [deprecated = true];
1069
+
1070
+ // Deprecated (as part of the ENHANCED mode deprecation).
1046
1071
  // Optional. If not provided, the result for the default Build ID will be returned. The default Build ID is the one
1047
1072
  // mentioned in the first unconditional Assignment Rule. If there is no default Build ID, the result for the
1048
1073
  // unversioned queue will be returned.
1049
1074
  // (-- api-linter: core::0140::prepositions --)
1050
- temporal.api.taskqueue.v1.TaskQueueVersionSelection versions = 6;
1075
+ temporal.api.taskqueue.v1.TaskQueueVersionSelection versions = 6 [deprecated = true];
1051
1076
 
1077
+ // Deprecated (as part of the ENHANCED mode deprecation).
1052
1078
  // Task queue types to report info about. If not specified, all types are considered.
1053
- repeated temporal.api.enums.v1.TaskQueueType task_queue_types = 7;
1054
- // Report stats for the requested task queue types and versions
1055
- bool report_stats = 8;
1056
- // Report list of pollers for requested task queue types and versions
1057
- bool report_pollers = 9;
1079
+ repeated temporal.api.enums.v1.TaskQueueType task_queue_types = 7 [deprecated = true];
1080
+
1081
+ // Deprecated (as part of the ENHANCED mode deprecation).
1082
+ // Report list of pollers for requested task queue types and versions.
1083
+ bool report_pollers = 9 [deprecated = true];
1084
+
1085
+ // Deprecated (as part of the ENHANCED mode deprecation).
1058
1086
  // Report task reachability for the requested versions and all task types (task reachability is not reported
1059
1087
  // per task type).
1060
- bool report_task_reachability = 10;
1088
+ bool report_task_reachability = 10 [deprecated = true];
1061
1089
  }
1062
1090
 
1063
1091
  message DescribeTaskQueueResponse {
1064
- // Deprecated. Use `versions_info.types_info.pollers` with `ENHANCED` mode instead.
1065
- // Not set in `ENHANCED` mode.
1066
1092
  repeated temporal.api.taskqueue.v1.PollerInfo pollers = 1;
1067
- // Deprecated. Not set in `ENHANCED` mode.
1068
- temporal.api.taskqueue.v1.TaskQueueStatus task_queue_status = 2;
1069
1093
 
1070
- // This map contains Task Queue information for each Build ID. Empty string as key value means unversioned.
1071
- // Only set in `ENHANCED` mode.
1072
- map<string, temporal.api.taskqueue.v1.TaskQueueVersionInfo> versions_info = 3;
1094
+ // Statistics for the task queue. Only populated when `report_stats` is set to true in the request.
1095
+ temporal.api.taskqueue.v1.TaskQueueStats stats = 5;
1073
1096
 
1074
1097
  // Specifies which Worker Deployment Version(s) Server routes this Task Queue's tasks to.
1075
1098
  // When not present, it means the tasks are routed to Unversioned workers (workers with
@@ -1081,6 +1104,15 @@ message DescribeTaskQueueResponse {
1081
1104
  // are typically not Pinned until they complete their first task (unless they are started with
1082
1105
  // a Pinned VersioningOverride or are Child Workflows of a Pinned parent).
1083
1106
  temporal.api.taskqueue.v1.TaskQueueVersioningInfo versioning_info = 4;
1107
+
1108
+ // Deprecated.
1109
+ // Status of the task queue. Only populated when `include_task_queue_status` is set to true in the request.
1110
+ temporal.api.taskqueue.v1.TaskQueueStatus task_queue_status = 2 [deprecated = true];
1111
+
1112
+ // Deprecated.
1113
+ // Only returned in ENHANCED mode.
1114
+ // This map contains Task Queue information for each Build ID. Empty string as key value means unversioned.
1115
+ map<string, temporal.api.taskqueue.v1.TaskQueueVersionInfo> versions_info = 3 [deprecated = true];
1084
1116
  }
1085
1117
 
1086
1118
  message GetClusterInfoRequest {
@@ -1153,6 +1185,7 @@ message GetSystemInfoResponse {
1153
1185
  // True if the server supports Nexus operations.
1154
1186
  // This flag is dependent both on server version and for Nexus to be enabled via server configuration.
1155
1187
  bool nexus = 11;
1188
+
1156
1189
  }
1157
1190
  }
1158
1191
 
@@ -1737,6 +1770,9 @@ message PollNexusTaskQueueRequest {
1737
1770
  temporal.api.common.v1.WorkerVersionCapabilities worker_version_capabilities = 4 [deprecated = true];
1738
1771
  // Worker deployment options that user has set in the worker.
1739
1772
  temporal.api.deployment.v1.WorkerDeploymentOptions deployment_options = 6;
1773
+
1774
+ // Worker info to be sent to the server.
1775
+ repeated temporal.api.worker.v1.WorkerHeartbeat worker_heartbeat = 7;
1740
1776
  }
1741
1777
 
1742
1778
  message PollNexusTaskQueueResponse {
@@ -1835,13 +1871,20 @@ message UpdateActivityOptionsRequest {
1835
1871
  // Controls which fields from `activity_options` will be applied
1836
1872
  google.protobuf.FieldMask update_mask = 5;
1837
1873
 
1838
- // either activity id or activity type must be provided
1839
- oneof activity {
1840
- // Only activity with this ID will be updated.
1841
- string id = 6;
1842
- // Update all running activities of this type.
1843
- string type = 7;
1844
- }
1874
+ // either activity id or activity type must be provided
1875
+ oneof activity {
1876
+ // Only activity with this ID will be updated.
1877
+ string id = 6;
1878
+ // Update all running activities of this type.
1879
+ string type = 7;
1880
+ }
1881
+
1882
+ // If set, the activity options will be restored to the default.
1883
+ // Default options are then options activity was created with.
1884
+ // They are part of the first SCHEDULE event.
1885
+ // This flag cannot be combined with any other option; if you supply
1886
+ // restore_original together with other options, the request will be rejected.
1887
+ bool restore_original = 8;
1845
1888
  }
1846
1889
 
1847
1890
  message UpdateActivityOptionsResponse {
@@ -1932,6 +1975,12 @@ message ResetActivityRequest {
1932
1975
  // If set, and activity is in backoff, the activity will start at a random time within the specified jitter duration.
1933
1976
  // (unless it is paused and keep_paused is set)
1934
1977
  google.protobuf.Duration jitter = 8;
1978
+
1979
+ // If set, the activity options will be restored to the defaults.
1980
+ // Default options are then options activity was created with.
1981
+ // They are part of the first SCHEDULE event.
1982
+ bool restore_original_options = 9;
1983
+
1935
1984
  }
1936
1985
 
1937
1986
  message ResetActivityResponse {
@@ -1977,10 +2026,22 @@ message DescribeWorkerDeploymentVersionRequest {
1977
2026
  string version = 2 [deprecated = true];
1978
2027
  // Required.
1979
2028
  temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 3;
2029
+ // Report stats for task queues which have been polled by this version.
2030
+ bool report_task_queue_stats = 4;
1980
2031
  }
1981
2032
 
1982
2033
  message DescribeWorkerDeploymentVersionResponse {
1983
2034
  temporal.api.deployment.v1.WorkerDeploymentVersionInfo worker_deployment_version_info = 1;
2035
+
2036
+ // All the Task Queues that have ever polled from this Deployment version.
2037
+ repeated VersionTaskQueue version_task_queues = 2;
2038
+ // (-- api-linter: core::0123::resource-annotation=disabled --)
2039
+ message VersionTaskQueue {
2040
+ string name = 1;
2041
+ temporal.api.enums.v1.TaskQueueType type = 2;
2042
+ // Only set if `report_task_queue_stats` is set on the request.
2043
+ temporal.api.taskqueue.v1.TaskQueueStats stats = 3;
2044
+ }
1984
2045
  }
1985
2046
 
1986
2047
  message DescribeWorkerDeploymentRequest {
@@ -2146,6 +2207,12 @@ message ListWorkerDeploymentsResponse {
2146
2207
  string name = 1;
2147
2208
  google.protobuf.Timestamp create_time = 2;
2148
2209
  temporal.api.deployment.v1.RoutingConfig routing_config = 3;
2210
+ // Summary of the version that was added most recently in the Worker Deployment.
2211
+ temporal.api.deployment.v1.WorkerDeploymentInfo.WorkerDeploymentVersionSummary latest_version_summary = 4;
2212
+ // Summary of the current version of the Worker Deployment.
2213
+ temporal.api.deployment.v1.WorkerDeploymentInfo.WorkerDeploymentVersionSummary current_version_summary = 5;
2214
+ // Summary of the ramping version of the Worker Deployment.
2215
+ temporal.api.deployment.v1.WorkerDeploymentInfo.WorkerDeploymentVersionSummary ramping_version_summary = 6;
2149
2216
  }
2150
2217
  }
2151
2218
 
@@ -2193,6 +2260,8 @@ message UpdateWorkerDeploymentVersionMetadataRequest {
2193
2260
  map<string, temporal.api.common.v1.Payload> upsert_entries = 3;
2194
2261
  // List of keys to remove from the metadata.
2195
2262
  repeated string remove_entries = 4;
2263
+ // Optional. The identity of the client who initiated this request.
2264
+ string identity = 6;
2196
2265
  }
2197
2266
 
2198
2267
  message UpdateWorkerDeploymentVersionMetadataResponse {
@@ -2308,3 +2377,45 @@ message TriggerWorkflowRuleResponse {
2308
2377
  // True is the rule was applied, based on the rule conditions (predicate/visibility_query).
2309
2378
  bool applied = 1;
2310
2379
  }
2380
+ message RecordWorkerHeartbeatRequest {
2381
+ // Namespace this worker belongs to.
2382
+ string namespace = 1;
2383
+
2384
+ // The identity of the client who initiated this request.
2385
+ string identity = 2;
2386
+
2387
+ repeated temporal.api.worker.v1.WorkerHeartbeat worker_heartbeat = 3;
2388
+ }
2389
+
2390
+ message RecordWorkerHeartbeatResponse {
2391
+
2392
+ }
2393
+
2394
+ message ListWorkersRequest {
2395
+ string namespace = 1;
2396
+ int32 page_size = 2;
2397
+ bytes next_page_token = 3;
2398
+
2399
+ // `query` in ListWorkers is used to filter workers based on worker status info.
2400
+ // The following worker status attributes are expected are supported as part of the query:
2401
+ //* WorkerInstanceKey
2402
+ //* WorkerIdentity
2403
+ //* HostName
2404
+ //* TaskQueue
2405
+ //* DeploymentName
2406
+ //* BuildId
2407
+ //* SdkName
2408
+ //* SdkVersion
2409
+ //* StartTime
2410
+ //* LastHeartbeatTime
2411
+ //* Status
2412
+ // Currently metrics are not supported as a part of ListWorkers query.
2413
+ string query = 4;
2414
+ }
2415
+
2416
+ message ListWorkersResponse {
2417
+ repeated temporal.api.worker.v1.WorkerInfo workers_info = 1;
2418
+
2419
+ // Next page token
2420
+ bytes next_page_token = 2;
2421
+ }
@@ -1173,4 +1173,25 @@ service WorkflowService {
1173
1173
  };
1174
1174
  }
1175
1175
 
1176
+ // WorkerHeartbeat receive heartbeat request from the worker.
1177
+ rpc RecordWorkerHeartbeat (RecordWorkerHeartbeatRequest) returns (RecordWorkerHeartbeatResponse) {
1178
+ option (google.api.http) = {
1179
+ post: "/namespaces/{namespace}/workers/heartbeat"
1180
+ body: "*"
1181
+ additional_bindings {
1182
+ post: "/api/v1/namespaces/{namespace}/workers/heartbeat"
1183
+ body: "*"
1184
+ }
1185
+ };
1186
+ };
1187
+
1188
+ // ListWorkers is a visibility API to list worker status information in a specific namespace.
1189
+ rpc ListWorkers (ListWorkersRequest) returns (ListWorkersResponse) {
1190
+ option (google.api.http) = {
1191
+ get: "/namespaces/{namespace}/workers"
1192
+ additional_bindings {
1193
+ get: "/api/v1/namespaces/{namespace}/workers"
1194
+ }
1195
+ };
1196
+ }
1176
1197
  }
@@ -350,10 +350,10 @@ message ResolveNexusOperationStart {
350
350
  // If true the operation "started" but only because it's also already resolved. A
351
351
  // `ResolveNexusOperation` job will be in the same activation.
352
352
  bool started_sync = 3;
353
- // The operation was cancelled before it was ever sent to server (same WFT).
354
- // Note that core will still send a `ResolveNexusOperation` job in the same activation, so
355
- // there does not need to be an exceptional case for this in lang.
356
- temporal.api.failure.v1.Failure cancelled_before_start = 4;
353
+ // The operation either failed to start, was cancelled before it started, timed out, or
354
+ // failed synchronously. Details are included inside the message. In this case, the
355
+ // subsequent ResolveNexusOperation will never be sent.
356
+ temporal.api.failure.v1.Failure failed = 4;
357
357
  }
358
358
  }
359
359
 
@@ -243,12 +243,12 @@ impl TestHistoryBuilder {
243
243
  self.build_and_push_event(EventType::WorkflowTaskFailed, attrs.into());
244
244
  }
245
245
 
246
- pub fn add_timer_started(&mut self, timer_id: String) {
246
+ pub fn add_timer_started(&mut self, timer_id: String) -> i64 {
247
247
  self.add(TimerStartedEventAttributes {
248
248
  timer_id,
249
249
  workflow_task_completed_event_id: self.previous_task_completed_id,
250
250
  ..Default::default()
251
- });
251
+ })
252
252
  }
253
253
 
254
254
  pub fn add_timer_fired(&mut self, timer_started_evt_id: i64, timer_id: String) {
@@ -367,7 +367,6 @@ impl TestHistoryBuilder {
367
367
  run_id: run_id.into(),
368
368
  }),
369
369
  signal_name: signal_name.into(),
370
- control: "".to_string(),
371
370
  ..Default::default()
372
371
  })
373
372
  }
@@ -452,7 +451,7 @@ impl TestHistoryBuilder {
452
451
  update_name: impl Into<String>,
453
452
  ) -> i64 {
454
453
  let protocol_instance_id = instance_id.into();
455
- let last_wft_started_id = self
454
+ let last_wft_scheduled_id = self
456
455
  .events
457
456
  .iter()
458
457
  .rev()
@@ -466,7 +465,7 @@ impl TestHistoryBuilder {
466
465
  .expect("Must have wft scheduled event");
467
466
  let attrs = WorkflowExecutionUpdateAcceptedEventAttributes {
468
467
  accepted_request_message_id: format!("{}/request", &protocol_instance_id),
469
- accepted_request_sequencing_event_id: last_wft_started_id,
468
+ accepted_request_sequencing_event_id: last_wft_scheduled_id,
470
469
  accepted_request: Some(update::v1::Request {
471
470
  meta: Some(update::v1::Meta {
472
471
  update_id: protocol_instance_id.clone(),
@@ -568,6 +567,11 @@ impl TestHistoryBuilder {
568
567
  self.current_event_id
569
568
  }
570
569
 
570
+ /// Get mutable ref to the most recently added event
571
+ pub fn last_event(&mut self) -> Option<&mut HistoryEvent> {
572
+ self.events.last_mut()
573
+ }
574
+
571
575
  fn set_flags<'a>(
572
576
  mut events: impl Iterator<Item = &'a mut HistoryEvent>,
573
577
  core: &[u32],