@temporalio/core-bridge 1.13.1 → 1.14.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 (422) hide show
  1. package/Cargo.lock +350 -436
  2. package/Cargo.toml +14 -13
  3. package/{sdk-core/fsm/rustfsm_procmacro/LICENSE.txt → LICENSE} +5 -5
  4. package/README.md +0 -1
  5. package/bridge-macros/Cargo.toml +16 -0
  6. package/bridge-macros/src/derive_js_function.rs +126 -0
  7. package/bridge-macros/src/derive_tryfromjs.rs +138 -0
  8. package/bridge-macros/src/derive_tryintojs.rs +151 -0
  9. package/bridge-macros/src/lib.rs +42 -0
  10. package/lib/native.d.ts +23 -9
  11. package/package.json +6 -5
  12. package/releases/aarch64-apple-darwin/index.node +0 -0
  13. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  14. package/releases/x86_64-apple-darwin/index.node +0 -0
  15. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  16. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  17. package/sdk-core/.cargo/config.toml +78 -12
  18. package/sdk-core/.clippy.toml +1 -0
  19. package/sdk-core/.github/workflows/heavy.yml +2 -0
  20. package/sdk-core/.github/workflows/per-pr.yml +90 -21
  21. package/sdk-core/AGENTS.md +17 -19
  22. package/sdk-core/ARCHITECTURE.md +44 -48
  23. package/sdk-core/Cargo.toml +25 -7
  24. package/sdk-core/README.md +16 -15
  25. package/sdk-core/arch_docs/diagrams/TimerMachine_Coverage.puml +14 -0
  26. package/sdk-core/arch_docs/diagrams/deps.svg +102 -0
  27. package/sdk-core/arch_docs/diagrams/initial_event_history.png +0 -0
  28. package/sdk-core/arch_docs/sdks_intro.md +299 -0
  29. package/sdk-core/{client → crates/client}/Cargo.toml +15 -16
  30. package/sdk-core/{client → crates/client}/src/callback_based.rs +1 -2
  31. package/sdk-core/{client → crates/client}/src/lib.rs +594 -457
  32. package/sdk-core/{client → crates/client}/src/metrics.rs +32 -8
  33. package/sdk-core/crates/client/src/proxy.rs +209 -0
  34. package/sdk-core/{client → crates/client}/src/raw.rs +648 -328
  35. package/sdk-core/crates/client/src/replaceable.rs +253 -0
  36. package/sdk-core/crates/client/src/request_extensions.rs +40 -0
  37. package/sdk-core/{client → crates/client}/src/retry.rs +32 -22
  38. package/sdk-core/crates/client/src/worker/mod.rs +1468 -0
  39. package/sdk-core/{client → crates/client}/src/workflow_handle/mod.rs +24 -21
  40. package/sdk-core/{core-api → crates/common}/Cargo.toml +21 -12
  41. package/sdk-core/{sdk-core-protos → crates/common}/build.rs +10 -23
  42. package/sdk-core/crates/common/protos/api_cloud_upstream/VERSION +1 -0
  43. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/account/v1/message.proto +18 -0
  44. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/request_response.proto +38 -11
  45. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto +21 -4
  46. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/operation/v1/message.proto +6 -6
  47. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/sink/v1/message.proto +22 -0
  48. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/create-release.yml +13 -0
  49. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv2.json +254 -5
  50. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv3.yaml +234 -5
  51. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/common/v1/message.proto +1 -1
  52. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/deployment/v1/message.proto +6 -0
  53. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -2
  54. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +60 -2
  55. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +30 -6
  56. package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +2 -0
  57. package/sdk-core/{core-api → crates/common}/src/envconfig.rs +155 -56
  58. package/sdk-core/{core-api → crates/common}/src/errors.rs +8 -1
  59. package/sdk-core/{fsm/rustfsm_trait/src/lib.rs → crates/common/src/fsm_trait.rs} +1 -27
  60. package/sdk-core/{core-api → crates/common}/src/lib.rs +92 -9
  61. package/sdk-core/{test-utils/src → crates/common/src/protos}/canned_histories.rs +5 -5
  62. package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_builder.rs +3 -3
  63. package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_info.rs +2 -2
  64. package/sdk-core/{sdk-core-protos/src/lib.rs → crates/common/src/protos/mod.rs} +43 -26
  65. package/sdk-core/crates/common/src/protos/test_utils.rs +89 -0
  66. package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/utilities.rs +14 -5
  67. package/sdk-core/{core-api → crates/common}/src/telemetry/metrics.rs +449 -51
  68. package/sdk-core/{core-api → crates/common}/src/telemetry.rs +16 -1
  69. package/sdk-core/{core-api → crates/common}/src/worker.rs +112 -18
  70. package/sdk-core/crates/common/tests/worker_task_types_test.rs +129 -0
  71. package/sdk-core/crates/macros/Cargo.toml +23 -0
  72. package/sdk-core/{fsm/rustfsm_procmacro → crates/macros}/src/lib.rs +12 -12
  73. package/sdk-core/{sdk → crates/sdk}/Cargo.toml +18 -12
  74. package/sdk-core/{sdk → crates/sdk}/src/activity_context.rs +9 -7
  75. package/sdk-core/{sdk → crates/sdk}/src/app_data.rs +1 -1
  76. package/sdk-core/{sdk → crates/sdk}/src/interceptors.rs +2 -5
  77. package/sdk-core/{sdk → crates/sdk}/src/lib.rs +43 -42
  78. package/sdk-core/{sdk → crates/sdk}/src/workflow_context/options.rs +12 -3
  79. package/sdk-core/{sdk → crates/sdk}/src/workflow_context.rs +21 -19
  80. package/sdk-core/{sdk → crates/sdk}/src/workflow_future.rs +2 -2
  81. package/sdk-core/crates/sdk-core/Cargo.toml +222 -0
  82. package/sdk-core/{core/benches/workflow_replay.rs → crates/sdk-core/benches/workflow_replay_bench.rs} +15 -10
  83. package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +32 -0
  84. package/sdk-core/crates/sdk-core/machine_coverage/CancelExternalMachine_Coverage.puml +9 -0
  85. package/sdk-core/crates/sdk-core/machine_coverage/CancelWorkflowMachine_Coverage.puml +6 -0
  86. package/sdk-core/crates/sdk-core/machine_coverage/ChildWorkflowMachine_Coverage.puml +27 -0
  87. package/sdk-core/crates/sdk-core/machine_coverage/CompleteWorkflowMachine_Coverage.puml +6 -0
  88. package/sdk-core/crates/sdk-core/machine_coverage/ContinueAsNewWorkflowMachine_Coverage.puml +6 -0
  89. package/sdk-core/crates/sdk-core/machine_coverage/FailWorkflowMachine_Coverage.puml +6 -0
  90. package/sdk-core/crates/sdk-core/machine_coverage/LocalActivityMachine_Coverage.puml +23 -0
  91. package/sdk-core/crates/sdk-core/machine_coverage/ModifyWorkflowPropertiesMachine_Coverage.puml +5 -0
  92. package/sdk-core/crates/sdk-core/machine_coverage/PatchMachine_Coverage.puml +8 -0
  93. package/sdk-core/crates/sdk-core/machine_coverage/SignalExternalMachine_Coverage.puml +12 -0
  94. package/sdk-core/crates/sdk-core/machine_coverage/TimerMachine_Coverage.puml +13 -0
  95. package/sdk-core/crates/sdk-core/machine_coverage/UpdateMachine_Coverage.puml +19 -0
  96. package/sdk-core/crates/sdk-core/machine_coverage/UpsertSearchAttributesMachine_Coverage.puml +5 -0
  97. package/sdk-core/crates/sdk-core/machine_coverage/WorkflowTaskMachine_Coverage.puml +11 -0
  98. package/sdk-core/{core → crates/sdk-core}/src/abstractions.rs +62 -6
  99. package/sdk-core/crates/sdk-core/src/antithesis.rs +60 -0
  100. package/sdk-core/{core → crates/sdk-core}/src/core_tests/activity_tasks.rs +85 -250
  101. package/sdk-core/{core → crates/sdk-core}/src/core_tests/mod.rs +13 -16
  102. package/sdk-core/{core → crates/sdk-core}/src/core_tests/queries.rs +25 -24
  103. package/sdk-core/{core → crates/sdk-core}/src/core_tests/replay_flag.rs +11 -68
  104. package/sdk-core/{core → crates/sdk-core}/src/core_tests/updates.rs +21 -20
  105. package/sdk-core/{core → crates/sdk-core}/src/core_tests/workers.rs +242 -16
  106. package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_cancels.rs +10 -7
  107. package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_tasks.rs +150 -326
  108. package/sdk-core/{core → crates/sdk-core}/src/debug_client.rs +1 -1
  109. package/sdk-core/{core → crates/sdk-core}/src/ephemeral_server/mod.rs +18 -6
  110. package/sdk-core/{test-utils → crates/sdk-core}/src/histfetch.rs +9 -4
  111. package/sdk-core/{core → crates/sdk-core}/src/internal_flags.rs +15 -4
  112. package/sdk-core/{core → crates/sdk-core}/src/lib.rs +128 -72
  113. package/sdk-core/{core → crates/sdk-core}/src/pollers/mod.rs +13 -11
  114. package/sdk-core/{core → crates/sdk-core}/src/pollers/poll_buffer.rs +53 -18
  115. package/sdk-core/{core → crates/sdk-core}/src/protosext/mod.rs +14 -6
  116. package/sdk-core/{core → crates/sdk-core}/src/protosext/protocol_messages.rs +5 -12
  117. package/sdk-core/{core → crates/sdk-core}/src/replay/mod.rs +14 -11
  118. package/sdk-core/crates/sdk-core/src/retry_logic.rs +390 -0
  119. package/sdk-core/{core → crates/sdk-core}/src/telemetry/log_export.rs +2 -2
  120. package/sdk-core/{core → crates/sdk-core}/src/telemetry/metrics.rs +80 -33
  121. package/sdk-core/{core → crates/sdk-core}/src/telemetry/mod.rs +12 -6
  122. package/sdk-core/{core → crates/sdk-core}/src/telemetry/otel.rs +1 -1
  123. package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_meter.rs +14 -14
  124. package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_server.rs +2 -2
  125. package/sdk-core/{core/src/test_help/mod.rs → crates/sdk-core/src/test_help/integ_helpers.rs} +284 -329
  126. package/sdk-core/crates/sdk-core/src/test_help/mod.rs +13 -0
  127. package/sdk-core/crates/sdk-core/src/test_help/unit_helpers.rs +220 -0
  128. package/sdk-core/{core → crates/sdk-core}/src/worker/activities/activity_heartbeat_manager.rs +44 -8
  129. package/sdk-core/{core → crates/sdk-core}/src/worker/activities/local_activities.rs +33 -31
  130. package/sdk-core/{core → crates/sdk-core}/src/worker/activities.rs +31 -15
  131. package/sdk-core/{core → crates/sdk-core}/src/worker/client/mocks.rs +28 -15
  132. package/sdk-core/{core → crates/sdk-core}/src/worker/client.rs +275 -145
  133. package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +246 -0
  134. package/sdk-core/crates/sdk-core/src/worker/mod.rs +1462 -0
  135. package/sdk-core/{core → crates/sdk-core}/src/worker/nexus.rs +24 -12
  136. package/sdk-core/{core → crates/sdk-core}/src/worker/slot_provider.rs +18 -10
  137. package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/fixed_size.rs +5 -1
  138. package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/resource_based.rs +453 -57
  139. package/sdk-core/{core → crates/sdk-core}/src/worker/tuner.rs +179 -3
  140. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/driven_workflow.rs +1 -1
  141. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/history_update.rs +5 -267
  142. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/activity_state_machine.rs +147 -90
  143. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -91
  144. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_nexus_op_state_machine.rs +14 -12
  145. package/sdk-core/crates/sdk-core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +97 -0
  146. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/child_workflow_state_machine.rs +32 -229
  147. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/complete_workflow_state_machine.rs +13 -8
  148. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +6 -50
  149. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/fail_workflow_state_machine.rs +6 -7
  150. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/local_activity_state_machine.rs +39 -584
  151. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/mod.rs +22 -17
  152. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +4 -74
  153. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/nexus_operation_state_machine.rs +118 -21
  154. package/sdk-core/crates/sdk-core/src/worker/workflow/machines/patch_state_machine.rs +273 -0
  155. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/signal_external_state_machine.rs +9 -151
  156. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/timer_state_machine.rs +27 -132
  157. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/transition_coverage.rs +1 -2
  158. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/update_state_machine.rs +19 -13
  159. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +25 -80
  160. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines/local_acts.rs +1 -1
  161. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines.rs +68 -72
  162. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_task_state_machine.rs +13 -15
  163. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/managed_run.rs +55 -37
  164. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/mod.rs +171 -61
  165. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/run_cache.rs +10 -7
  166. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_extraction.rs +4 -2
  167. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_poller.rs +15 -4
  168. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/workflow_stream.rs +38 -19
  169. package/sdk-core/crates/sdk-core/tests/c_bridge_smoke_test.c +10 -0
  170. package/sdk-core/crates/sdk-core/tests/cloud_tests.rs +25 -0
  171. package/sdk-core/crates/sdk-core/tests/common/fake_grpc_server.rs +106 -0
  172. package/sdk-core/crates/sdk-core/tests/common/http_proxy.rs +134 -0
  173. package/sdk-core/{test-utils/src/lib.rs → crates/sdk-core/tests/common/mod.rs} +286 -334
  174. package/sdk-core/{test-utils/src → crates/sdk-core/tests/common}/workflows.rs +6 -4
  175. package/sdk-core/crates/sdk-core/tests/fsm_procmacro.rs +6 -0
  176. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dupe_transitions_fail.rs +1 -3
  177. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/dupe_transitions_fail.stderr +12 -0
  178. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dynamic_dest_pass.rs +2 -4
  179. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.rs +1 -3
  180. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.stderr +4 -4
  181. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_arg_pass.rs +2 -4
  182. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_pass.rs +2 -4
  183. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/medium_complex_pass.rs +2 -4
  184. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/no_handle_conversions_require_into_fail.rs +2 -4
  185. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/no_handle_conversions_require_into_fail.stderr +15 -0
  186. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/simple_pass.rs +2 -4
  187. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/struct_event_variant_fail.rs +1 -3
  188. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/struct_event_variant_fail.stderr +5 -0
  189. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_more_item_event_variant_fail.rs +1 -3
  190. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_more_item_event_variant_fail.stderr +5 -0
  191. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_zero_item_event_variant_fail.rs +1 -3
  192. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_zero_item_event_variant_fail.stderr +5 -0
  193. package/sdk-core/{tests → crates/sdk-core/tests}/global_metric_tests.rs +22 -22
  194. package/sdk-core/{tests → crates/sdk-core/tests/heavy_tests}/fuzzy_workflow.rs +4 -4
  195. package/sdk-core/{tests → crates/sdk-core/tests}/heavy_tests.rs +25 -14
  196. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/activity_functions.rs +1 -1
  197. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/client_tests.rs +115 -123
  198. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/ephemeral_server_tests.rs +19 -15
  199. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/heartbeat_tests.rs +24 -20
  200. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/metrics_tests.rs +241 -67
  201. package/sdk-core/crates/sdk-core/tests/integ_tests/pagination_tests.rs +273 -0
  202. package/sdk-core/crates/sdk-core/tests/integ_tests/polling_tests.rs +513 -0
  203. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/queries_tests.rs +13 -11
  204. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/update_tests.rs +47 -29
  205. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/visibility_tests.rs +49 -27
  206. package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +1061 -0
  207. package/sdk-core/crates/sdk-core/tests/integ_tests/worker_tests.rs +920 -0
  208. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_versioning_tests.rs +58 -40
  209. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/activities.rs +268 -30
  210. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/appdata_propagation.rs +4 -4
  211. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +155 -0
  212. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +121 -0
  213. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +717 -0
  214. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +109 -0
  215. package/sdk-core/{core/src/core_tests → crates/sdk-core/tests/integ_tests/workflow_tests}/determinism.rs +108 -20
  216. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/eager.rs +10 -5
  217. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +2884 -0
  218. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +119 -0
  219. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/nexus.rs +174 -46
  220. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/patches.rs +740 -0
  221. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/replay.rs +78 -27
  222. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/resets.rs +46 -28
  223. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs +294 -0
  224. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/stickyness.rs +9 -8
  225. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs +249 -0
  226. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/upsert_search_attrs.rs +72 -7
  227. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests.rs +97 -33
  228. package/sdk-core/{tests → crates/sdk-core/tests}/main.rs +40 -25
  229. package/sdk-core/{tests → crates/sdk-core/tests}/manual_tests.rs +25 -15
  230. package/sdk-core/{tests → crates/sdk-core/tests}/runner.rs +23 -41
  231. package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/mod.rs +11 -6
  232. package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/priority.rs +6 -6
  233. package/sdk-core/crates/sdk-core-c-bridge/Cargo.toml +59 -0
  234. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/include/temporal-sdk-core-c-bridge.h +215 -44
  235. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/client.rs +515 -214
  236. package/sdk-core/crates/sdk-core-c-bridge/src/envconfig.rs +314 -0
  237. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/lib.rs +2 -1
  238. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/metric.rs +1 -1
  239. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/random.rs +4 -4
  240. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/runtime.rs +42 -28
  241. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/testing.rs +2 -5
  242. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/context.rs +42 -41
  243. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/mod.rs +38 -34
  244. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/utils.rs +10 -11
  245. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/worker.rs +427 -121
  246. package/sdk-core/docker-cgroup-tests.sh +24 -0
  247. package/sdk-core/{docker → etc/docker}/docker-compose-ci.yaml +9 -9
  248. package/sdk-core/{docker → etc/docker}/docker-compose-telem.yaml +11 -11
  249. package/sdk-core/{docker → etc/docker}/docker-compose.yaml +8 -8
  250. package/sdk-core/{integ-with-otel.sh → etc/integ-with-otel.sh} +1 -1
  251. package/sdk-core/etc/regen-depgraph.sh +2 -2
  252. package/src/client.rs +117 -49
  253. package/src/helpers/callbacks.rs +4 -4
  254. package/src/helpers/errors.rs +7 -1
  255. package/src/helpers/handles.rs +1 -0
  256. package/src/helpers/try_from_js.rs +5 -4
  257. package/src/lib.rs +3 -2
  258. package/src/logs.rs +1 -1
  259. package/src/metrics.rs +6 -3
  260. package/src/runtime.rs +41 -24
  261. package/src/testing.rs +3 -3
  262. package/src/worker.rs +77 -44
  263. package/ts/native.ts +26 -9
  264. package/LICENSE.md +0 -23
  265. package/sdk-core/arch_docs/diagrams/workflow_internals.svg +0 -1
  266. package/sdk-core/client/src/proxy.rs +0 -90
  267. package/sdk-core/client/src/worker_registry/mod.rs +0 -266
  268. package/sdk-core/core/Cargo.toml +0 -146
  269. package/sdk-core/core/src/core_tests/child_workflows.rs +0 -281
  270. package/sdk-core/core/src/core_tests/local_activities.rs +0 -1442
  271. package/sdk-core/core/src/retry_logic.rs +0 -224
  272. package/sdk-core/core/src/worker/heartbeat.rs +0 -231
  273. package/sdk-core/core/src/worker/mod.rs +0 -980
  274. package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +0 -165
  275. package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +0 -801
  276. package/sdk-core/core-c-bridge/Cargo.toml +0 -51
  277. package/sdk-core/etc/deps.svg +0 -162
  278. package/sdk-core/fsm/Cargo.toml +0 -21
  279. package/sdk-core/fsm/README.md +0 -3
  280. package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +0 -27
  281. package/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +0 -8
  282. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +0 -12
  283. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +0 -15
  284. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +0 -5
  285. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +0 -5
  286. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +0 -5
  287. package/sdk-core/fsm/rustfsm_trait/Cargo.toml +0 -14
  288. package/sdk-core/fsm/rustfsm_trait/LICENSE.txt +0 -21
  289. package/sdk-core/fsm/src/lib.rs +0 -2
  290. package/sdk-core/sdk-core-protos/Cargo.toml +0 -37
  291. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/VERSION +0 -1
  292. package/sdk-core/test-utils/Cargo.toml +0 -38
  293. package/sdk-core/test-utils/src/interceptors.rs +0 -46
  294. package/sdk-core/tests/cloud_tests.rs +0 -23
  295. package/sdk-core/tests/integ_tests/polling_tests.rs +0 -294
  296. package/sdk-core/tests/integ_tests/worker_tests.rs +0 -203
  297. package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +0 -74
  298. package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +0 -57
  299. package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +0 -246
  300. package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +0 -65
  301. package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +0 -85
  302. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +0 -908
  303. package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +0 -51
  304. package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +0 -206
  305. package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +0 -164
  306. package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +0 -123
  307. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/build.yaml +0 -0
  308. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/push-to-buf.yml +0 -0
  309. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/CODEOWNERS +0 -0
  310. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/LICENSE +0 -0
  311. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/Makefile +0 -0
  312. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/README.md +0 -0
  313. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.gen.yaml +0 -0
  314. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.lock +0 -0
  315. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.yaml +0 -0
  316. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/connectivityrule/v1/message.proto +0 -0
  317. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/identity/v1/message.proto +0 -0
  318. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/namespace/v1/message.proto +0 -0
  319. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/nexus/v1/message.proto +0 -0
  320. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/region/v1/message.proto +0 -0
  321. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/resource/v1/message.proto +0 -0
  322. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/usage/v1/message.proto +0 -0
  323. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/CODEOWNERS +0 -0
  324. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  325. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/ci.yml +0 -0
  326. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/publish-docs.yml +0 -0
  327. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/push-to-buf.yml +0 -0
  328. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-delete-release.yml +0 -0
  329. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-publish-release.yml +0 -0
  330. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +0 -0
  331. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/LICENSE +0 -0
  332. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/Makefile +0 -0
  333. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/README.md +0 -0
  334. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/api-linter.yaml +0 -0
  335. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.gen.yaml +0 -0
  336. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.lock +0 -0
  337. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.yaml +0 -0
  338. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/annotations.proto +0 -0
  339. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/http.proto +0 -0
  340. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/any.proto +0 -0
  341. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/descriptor.proto +0 -0
  342. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/duration.proto +0 -0
  343. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/empty.proto +0 -0
  344. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/struct.proto +0 -0
  345. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/timestamp.proto +0 -0
  346. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/wrappers.proto +0 -0
  347. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/payload_description.txt +0 -0
  348. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/activity/v1/message.proto +0 -0
  349. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/batch/v1/message.proto +0 -0
  350. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/command/v1/message.proto +0 -0
  351. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -0
  352. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/command_type.proto +0 -0
  353. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/common.proto +0 -0
  354. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/deployment.proto +0 -0
  355. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/event_type.proto +0 -0
  356. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +0 -0
  357. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/namespace.proto +0 -0
  358. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/nexus.proto +0 -0
  359. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/query.proto +0 -0
  360. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/reset.proto +0 -0
  361. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/schedule.proto +0 -0
  362. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -0
  363. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/update.proto +0 -0
  364. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/workflow.proto +0 -0
  365. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/errordetails/v1/message.proto +0 -0
  366. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/export/v1/message.proto +0 -0
  367. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/failure/v1/message.proto +0 -0
  368. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/filter/v1/message.proto +0 -0
  369. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/history/v1/message.proto +0 -0
  370. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/nexus/v1/message.proto +0 -0
  371. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +0 -0
  372. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -0
  373. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/protocol/v1/message.proto +0 -0
  374. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/query/v1/message.proto +0 -0
  375. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/replication/v1/message.proto +0 -0
  376. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/rules/v1/message.proto +0 -0
  377. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/schedule/v1/message.proto +0 -0
  378. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/enhanced_stack_trace.proto +0 -0
  379. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +0 -0
  380. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/user_metadata.proto +0 -0
  381. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/worker_config.proto +0 -0
  382. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +0 -0
  383. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +0 -0
  384. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/update/v1/message.proto +0 -0
  385. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/version/v1/message.proto +0 -0
  386. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/worker/v1/message.proto +0 -0
  387. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflow/v1/message.proto +0 -0
  388. /package/sdk-core/{sdk-core-protos → crates/common}/protos/google/rpc/status.proto +0 -0
  389. /package/sdk-core/{sdk-core-protos → crates/common}/protos/grpc/health/v1/health.proto +0 -0
  390. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_result/activity_result.proto +0 -0
  391. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_task/activity_task.proto +0 -0
  392. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -0
  393. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/common/common.proto +0 -0
  394. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/core_interface.proto +0 -0
  395. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/external_data/external_data.proto +0 -0
  396. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/nexus/nexus.proto +0 -0
  397. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +0 -0
  398. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -0
  399. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/Makefile +0 -0
  400. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/api-linter.yaml +0 -0
  401. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/buf.yaml +0 -0
  402. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -0
  403. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -0
  404. /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/constants.rs +0 -0
  405. /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/task_token.rs +0 -0
  406. /package/sdk-core/{fsm → crates/macros}/LICENSE.txt +0 -0
  407. /package/sdk-core/{core → crates/sdk-core}/src/abstractions/take_cell.rs +0 -0
  408. /package/sdk-core/{core → crates/sdk-core}/src/worker/slot_supplier.rs +0 -0
  409. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/ends_empty_wft_complete.bin +0 -0
  410. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-16_history.bin +0 -0
  411. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-23_history.bin +0 -0
  412. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-85_history.bin +0 -0
  413. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/fail_wf_task.bin +0 -0
  414. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-0_history.bin +0 -0
  415. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-1_history.bin +0 -0
  416. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-2_history.bin +0 -0
  417. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-3_history.bin +0 -0
  418. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/old_change_marker_format.bin +0 -0
  419. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/timer_workflow_history.bin +0 -0
  420. /package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/priority.rs +0 -0
  421. /package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/build.rs +0 -0
  422. /package/sdk-core/{cargo-tokio-console.sh → etc/cargo-tokio-console.sh} +0 -0
@@ -26,18 +26,16 @@ installed to build Core.
26
26
 
27
27
  This repo is composed of multiple crates:
28
28
 
29
- - temporal-sdk-core-protos `./sdk-core-protos` - Holds the generated proto code and extensions.
30
- - temporal-client `./client` - Defines client(s) for interacting with the Temporal gRPC service.
31
- - temporal-sdk-core-api `./core-api` - Defines the API surface exposed by Core.
32
- - temporal-sdk-core `./core` - The Core implementation.
33
- - temporal-sdk-core-c-bridge `./core-c-bridge` - Provides C bindings for Core.
34
- - temporal-sdk `./sdk` - A (currently prototype) Rust SDK built on top of Core. Used for testing.
35
- - rustfsm `./fsm` - Implements a procedural macro used by core for defining state machines
36
- (contains subcrates). It is Temporal-agnostic.
29
+ - temporalio-client `./crates/client` - Defines client(s) for interacting with the Temporal gRPC service.
30
+ - temporalio-common `./crates/common` - Common code & protobuf definitions
31
+ - temporalio-sdk-core `./crates/core` - The Core implementation.
32
+ - temporalio-sdk-core-c-bridge `./crates/core-c-bridge` - Provides C bindings for Core.
33
+ - temporalio-macros `./crates/macros` - Implements procedural macros used by core and the SDK.
34
+ - temporalio-sdk `./crates/sdk` - A (currently prototype) Rust SDK built on top of Core. Used for testing.
37
35
 
38
36
  Visualized (dev dependencies are in blue):
39
37
 
40
- ![Crate dependency graph](./etc/deps.svg)
38
+ ![Crate dependency graph](./arch_docs/diagrams/deps.svg)
41
39
 
42
40
  All the following commands are enforced for each pull request:
43
41
 
@@ -52,6 +50,10 @@ use an already-running server by passing `-s external`.
52
50
 
53
51
  Run load tests with `cargo test --test heavy_tests`.
54
52
 
53
+ NOTE: Integration tests should pass locally, if running on MacOS and you see integration tests consistently failing
54
+ with an error that mentions `Too many open files`, this is likely due to `ulimit -n` being too low. You can raise
55
+ it temporarily (current shell) with `ulimit -n 65535`, or add it to your `~/.zshrc` file to apply to all shells.
56
+
55
57
  ## Formatting
56
58
 
57
59
  To format all code run:
@@ -60,8 +62,8 @@ To format all code run:
60
62
  ## Linting
61
63
 
62
64
  We are using [clippy](https://github.com/rust-lang/rust-clippy) for linting.
63
- You can run it using:
64
- `cargo clippy --all -- -D warnings`
65
+ We have a couple aliases for linting that make sure various targets are hit:
66
+ `cargo lint` and `cargo test-lint`.
65
67
 
66
68
  ## Debugging
67
69
 
@@ -75,10 +77,10 @@ crate::telemetry::telemetry_init_fallback();
75
77
 
76
78
  The passed in options to initialization can be customized to export to an OTel collector, etc.
77
79
 
78
- To run integ tests with OTel collection on, you can use `integ-with-otel.sh`. You will want to make
79
- sure you are running the collector via docker, which can be done like so:
80
+ To run integ tests with OTel collection on, you can use `etc/integ-with-otel.sh`. You will want to
81
+ make sure you are running the collector via docker, which can be done like so:
80
82
 
81
- `docker-compose -f docker/docker-compose.yaml -f docker/docker-compose-telem.yaml up`
83
+ `docker-compose -f etc/docker/docker-compose.yaml -f etc/docker/docker-compose-telem.yaml up`
82
84
 
83
85
  If you are working on a language SDK, you are expected to initialize tracing early in your `main`
84
86
  equivalent.
@@ -133,4 +135,3 @@ pre-alpha in terms of its API surface. Since it's still using Core underneath, i
133
135
  functional. We do not currently have any firm plans to productionize this SDK. If you want to write
134
136
  workflows and activities in Rust, feel free to use it - but be aware that the API may change at any
135
137
  time without warning and we do not provide any support guarantees.
136
-
@@ -0,0 +1,14 @@
1
+ @startuml
2
+ [*] --> Created
3
+ Created -[#blue]-> StartCommandCreated: Schedule
4
+ StartCommandCreated -[#blue]-> StartCommandCreated: CommandStartTimer
5
+ StartCommandCreated -[#blue]-> StartCommandRecorded: TimerStarted
6
+ StartCommandCreated -[#blue]-> Canceled: Cancel
7
+ StartCommandRecorded -[#blue]-> Fired: TimerFired
8
+ StartCommandRecorded -[#blue]-> CancelTimerCommandCreated: Cancel
9
+ CancelTimerCommandCreated --> CancelTimerCommandCreated: Cancel
10
+ CancelTimerCommandCreated -[#blue]-> CancelTimerCommandSent: CommandCancelTimer
11
+ CancelTimerCommandSent --> Canceled: TimerCanceled
12
+ Canceled -[#blue]-> Canceled: Cancel
13
+ Fired -[#blue]-> Fired: Cancel
14
+ @enduml
@@ -0,0 +1,102 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <!-- Generated by graphviz version 14.0.1 (0)
5
+ -->
6
+ <!-- Pages: 1 -->
7
+ <svg width="274pt" height="332pt"
8
+ viewBox="0.00 0.00 274.00 332.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9
+ <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 328)">
10
+ <polygon fill="white" stroke="none" points="-4,4 -4,-328 270,-328 270,4 -4,4"/>
11
+ <!-- 0 -->
12
+ <g id="node1" class="node">
13
+ <title>0</title>
14
+ <polygon fill="none" stroke="black" points="126.25,-252 0,-252 0,-216 126.25,-216 126.25,-252"/>
15
+ <text xml:space="preserve" text-anchor="middle" x="63.12" y="-228.95" font-family="Times,serif" font-size="14.00">temporalio&#45;sdk&#45;core</text>
16
+ </g>
17
+ <!-- 1 -->
18
+ <g id="node2" class="node">
19
+ <title>1</title>
20
+ <polygon fill="none" stroke="black" points="191,-108 81.25,-108 81.25,-72 191,-72 191,-108"/>
21
+ <text xml:space="preserve" text-anchor="middle" x="136.12" y="-84.95" font-family="Times,serif" font-size="14.00">temporalio&#45;client</text>
22
+ </g>
23
+ <!-- 0&#45;&gt;1 -->
24
+ <g id="edge1" class="edge">
25
+ <title>0&#45;&gt;1</title>
26
+ <path fill="none" stroke="black" d="M88.81,-215.72C100.5,-206.5 113.43,-194.14 121.12,-180 131.16,-161.58 134.8,-138.08 135.99,-119.85"/>
27
+ <polygon fill="black" stroke="black" points="139.48,-120.13 136.4,-109.99 132.49,-119.83 139.48,-120.13"/>
28
+ </g>
29
+ <!-- 2 -->
30
+ <g id="node3" class="node">
31
+ <title>2</title>
32
+ <polygon fill="none" stroke="black" points="158.38,-36 29.88,-36 29.88,0 158.38,0 158.38,-36"/>
33
+ <text xml:space="preserve" text-anchor="middle" x="94.12" y="-12.95" font-family="Times,serif" font-size="14.00">temporalio&#45;common</text>
34
+ </g>
35
+ <!-- 0&#45;&gt;2 -->
36
+ <g id="edge2" class="edge">
37
+ <title>0&#45;&gt;2</title>
38
+ <path fill="none" stroke="black" d="M35.48,-215.54C23.8,-206.51 11.45,-194.35 5.12,-180 -1.33,-165.36 0.25,-159.24 5.12,-144 17.5,-105.3 46.72,-68.34 68.32,-44.79"/>
39
+ <polygon fill="black" stroke="black" points="70.83,-47.23 75.14,-37.55 65.73,-42.43 70.83,-47.23"/>
40
+ </g>
41
+ <!-- 3 -->
42
+ <g id="node4" class="node">
43
+ <title>3</title>
44
+ <polygon fill="none" stroke="black" points="112.38,-180 13.88,-180 13.88,-144 112.38,-144 112.38,-180"/>
45
+ <text xml:space="preserve" text-anchor="middle" x="63.12" y="-156.95" font-family="Times,serif" font-size="14.00">temporalio&#45;sdk</text>
46
+ </g>
47
+ <!-- 0&#45;&gt;3 -->
48
+ <g id="edge3" class="edge">
49
+ <title>0&#45;&gt;3</title>
50
+ <path fill="none" stroke="blue" d="M57.21,-215.7C56.46,-208.41 56.21,-199.73 56.48,-191.54"/>
51
+ <polygon fill="blue" stroke="blue" points="59.97,-191.82 57.13,-181.61 52.98,-191.36 59.97,-191.82"/>
52
+ </g>
53
+ <!-- 1&#45;&gt;2 -->
54
+ <g id="edge4" class="edge">
55
+ <title>1&#45;&gt;2</title>
56
+ <path fill="none" stroke="black" d="M125.74,-71.7C121.06,-63.9 115.43,-54.51 110.22,-45.83"/>
57
+ <polygon fill="black" stroke="black" points="113.31,-44.18 105.17,-37.4 107.31,-47.78 113.31,-44.18"/>
58
+ </g>
59
+ <!-- 3&#45;&gt;0 -->
60
+ <g id="edge7" class="edge">
61
+ <title>3&#45;&gt;0</title>
62
+ <path fill="none" stroke="black" d="M69.02,-180.1C69.78,-187.37 70.03,-196.04 69.78,-204.24"/>
63
+ <polygon fill="black" stroke="black" points="66.29,-203.98 69.14,-214.19 73.27,-204.43 66.29,-203.98"/>
64
+ </g>
65
+ <!-- 3&#45;&gt;1 -->
66
+ <g id="edge5" class="edge">
67
+ <title>3&#45;&gt;1</title>
68
+ <path fill="none" stroke="black" d="M81.17,-143.7C89.86,-135.37 100.44,-125.22 109.98,-116.07"/>
69
+ <polygon fill="black" stroke="black" points="112.15,-118.84 116.94,-109.39 107.3,-113.79 112.15,-118.84"/>
70
+ </g>
71
+ <!-- 3&#45;&gt;2 -->
72
+ <g id="edge6" class="edge">
73
+ <title>3&#45;&gt;2</title>
74
+ <path fill="none" stroke="black" d="M63.38,-143.68C64,-125.56 65.97,-96.39 72.12,-72 74.27,-63.5 77.54,-54.58 80.91,-46.53"/>
75
+ <polygon fill="black" stroke="black" points="84.01,-48.17 84.85,-37.61 77.61,-45.34 84.01,-48.17"/>
76
+ </g>
77
+ <!-- 4 -->
78
+ <g id="node5" class="node">
79
+ <title>4</title>
80
+ <polygon fill="none" stroke="black" points="266,-324 90.25,-324 90.25,-288 266,-288 266,-324"/>
81
+ <text xml:space="preserve" text-anchor="middle" x="178.12" y="-300.95" font-family="Times,serif" font-size="14.00">temporalio&#45;sdk&#45;core&#45;c&#45;bridge</text>
82
+ </g>
83
+ <!-- 4&#45;&gt;0 -->
84
+ <g id="edge10" class="edge">
85
+ <title>4&#45;&gt;0</title>
86
+ <path fill="none" stroke="black" d="M149.4,-287.52C134.75,-278.6 116.73,-267.63 100.96,-258.03"/>
87
+ <polygon fill="black" stroke="black" points="103.14,-255.26 92.77,-253.05 99.5,-261.24 103.14,-255.26"/>
88
+ </g>
89
+ <!-- 4&#45;&gt;1 -->
90
+ <g id="edge8" class="edge">
91
+ <title>4&#45;&gt;1</title>
92
+ <path fill="none" stroke="black" d="M174.76,-287.85C167.54,-251.07 150.51,-164.29 141.67,-119.24"/>
93
+ <polygon fill="black" stroke="black" points="145.16,-118.86 139.8,-109.72 138.29,-120.2 145.16,-118.86"/>
94
+ </g>
95
+ <!-- 4&#45;&gt;2 -->
96
+ <g id="edge9" class="edge">
97
+ <title>4&#45;&gt;2</title>
98
+ <path fill="none" stroke="black" d="M186.41,-287.59C204.63,-246.52 243.27,-141.82 200.12,-72 192.07,-58.97 179.74,-49.04 166.3,-41.5"/>
99
+ <polygon fill="black" stroke="black" points="168.21,-38.55 157.71,-37.12 165.03,-44.78 168.21,-38.55"/>
100
+ </g>
101
+ </g>
102
+ </svg>
@@ -0,0 +1,299 @@
1
+ # Intro to Temporal SDKs
2
+
3
+ This document is primarily meant as an onboarding guide for new Temporal SDK developers, to be
4
+ accompanied by a live presentation. Hence, content does not have maximal context. If reading this
5
+ independently, you will also want to refer to our documentation [site](https://docs.temporal.io).
6
+
7
+ ## Primary SDK Concepts
8
+
9
+ See also our
10
+ [official docs on basic concepts](https://docs.temporal.io/evaluate/understanding-temporal).
11
+
12
+ ### Workflows
13
+
14
+ Workflows are durable programs. Their state is materialized from event history and they can be
15
+ replayed zero or more times. Workflow code must be deterministic and must use SDK Workflow-specific
16
+ APIs. Side effects and non-deterministic APIs should be placed in Activities.
17
+
18
+ **Example Workflow Code (Python):**
19
+
20
+ ```python
21
+ from datetime import timedelta
22
+ from temporalio import workflow
23
+
24
+ @workflow.defn
25
+ class SayHello:
26
+ @workflow.run
27
+ async def run(self, name: str) -> str:
28
+ return await workflow.execute_activity(
29
+ say_hello, name, schedule_to_close_timeout=timedelta(seconds=5)
30
+ )
31
+ ```
32
+
33
+ ### Activities
34
+
35
+ Activities are invoked from a Workflow and can run arbitrary code. They can be retried, are subject
36
+ to timeouts, and should be idempotent/reentrant. Activities can be short or long-running and can
37
+ heartbeat.
38
+
39
+ **Example Activity Code (Python):**
40
+
41
+ ```python
42
+ from temporalio import activity
43
+
44
+ @activity.defn
45
+ async def say_hello(name: str) -> str:
46
+ return f"Hello, {name}!"
47
+ ```
48
+
49
+ ### Clients
50
+
51
+ Clients serve as a driver for interaction with the Temporal server. They provide a high-level API
52
+ for a subset of gRPC calls, including Workflow "CRUD" operations, Activity completion, and
53
+ Schedules.
54
+
55
+ **Example Client Code (Python):**
56
+
57
+ ``` python
58
+ from temporalio.client import Client
59
+
60
+ # Import the workflow from the previous code
61
+ from .workflows import SayHello
62
+
63
+ async def main():
64
+ client = await Client.connect("localhost:7233")
65
+
66
+ result = await client.execute_workflow(
67
+ SayHello.run, "my name", id="my-workflow-id", task_queue="my-task-queue")
68
+
69
+ print(f"Result: {result}")
70
+ ```
71
+
72
+ ### Workers
73
+
74
+ Workers are stateless entities that poll the server for Workflow, Activity, and Nexus tasks. They
75
+ run user-defined Workflows, Activities, and Nexus Operations, manage concurrency and rate limits,
76
+ and provide the language runtime for workflows.
77
+
78
+ **Example Worker Code (Python):**
79
+
80
+ ``` python
81
+ from temporalio.client import Client
82
+ from temporalio.worker import Worker
83
+
84
+ from .activities import say_hello
85
+ from .workflows import SayHello
86
+
87
+ async def main():
88
+ client = await Client.connect("localhost:7233")
89
+
90
+ worker = Worker(
91
+ client,
92
+ task_queue="my-task-queue",
93
+ workflows=[SayHello],
94
+ activities=[say_hello])
95
+ await worker.run()
96
+ ```
97
+
98
+ ## SDK \<-\> Server Interaction
99
+
100
+ ### Event History and it's construction
101
+
102
+ Event history is a record of all events that have occurred in a Workflow. Workflow tasks are the
103
+ fundamental unit of progress for Workflows. Any time your Workflow code makes progress, it does so
104
+ because your worker processed one of these Workflow tasks. Workflow tasks contain some or all of the
105
+ Workflow’s history, along with possibly queries and other bits of information the worker might care
106
+ about.
107
+
108
+ The first few events in a workflow's history always look like this:
109
+
110
+ ![initial_event_history.png](diagrams/initial_event_history.png)
111
+
112
+ The first Workflow task for a Workflow always includes the initial events. When the SDK receives a
113
+ task, it processes the history, runs your Workflow code, and eventually responds with commands to
114
+ the server. Commands are actions like "start a timer" or "run an Activity."
115
+
116
+ A sequence diagram of this process is shown below. Not everything may make sense yet, but we can
117
+ refer back to this diagram during later explanations.
118
+
119
+ ```mermaid
120
+ %%{ init : { "theme" : "default", "themeVariables" : { "background" : "#fff" }}}%%
121
+ sequenceDiagram
122
+ box rgb(255, 255, 255)
123
+ participant Client
124
+ participant Server
125
+ participant SDK
126
+ participant UserCode as "User Code"
127
+ end
128
+
129
+ Client ->> Server: StartWorkflowExecution RPC
130
+ Server ->> Server: Generate Workflow Task & persist
131
+ Server -->> Client: runID
132
+
133
+ loop Workflow Task Polling
134
+ rect rgb(200, 230, 200)
135
+ SDK ->> Server: PollWorkflowTaskQueueRequest
136
+ opt Something triggers new Workflow Task
137
+ Server ->> Server: Generate Workflow Task & persist
138
+ end
139
+ Server -->> SDK: PollWorkflowTaskQueueResponse
140
+ end
141
+
142
+ rect rgb(220, 200, 220)
143
+ loop Processing one Workflow Task
144
+ SDK ->> SDK: Apply workflow history to state
145
+ SDK ->> UserCode: Activate & Unblock Awaitables
146
+ UserCode -->> SDK: Blocked on some awaitable or complete
147
+ end
148
+
149
+ SDK ->> Server: RespondWorkflowTaskCompletedRequest
150
+ Server ->> Server: Persist & possibly reply with new Workflow Task
151
+ Server -->> SDK: RespondWorkflowTaskCompletedResponse
152
+ end
153
+ end
154
+ ```
155
+
156
+ **How History is Constructed:**
157
+
158
+ Workflow tasks contain history and are responded to with commands. Every command is turned into a
159
+ corresponding event (referred to as "dual" or "command-events"). The Temporal server takes action on
160
+ received commands, and the consequences of those actions also become events (e.g., `TimerFired`,
161
+ `ActivityTaskCompleted`). When events that trigger a new Workflow task occur, the Temporal server
162
+ generates a new Workflow task because a worker needs to run the Workflow code to process this new
163
+ information.
164
+
165
+ This cycle continues until the Workflow is complete: new Workflow Tasks are created, processed by
166
+ the SDK, responded to with commands, until a new Workflow task begins, and so on.
167
+
168
+ We will use the following example Workflow to illustrate this process:
169
+
170
+ ```python
171
+ @activity.defn
172
+ async def say_hello(name: str) -> str:
173
+ return f"Hello, {name}!"
174
+
175
+ @workflow.defn
176
+ class ReplayExampleWorkflow:
177
+ @workflow.run
178
+ async def run(self, name: str) -> str:
179
+ my_hello = workflow.execute_activity(
180
+ say_hello, name, schedule_to_close_timeout=timedelta(seconds=5)
181
+ )
182
+ timer = workflow.sleep(10)
183
+ (activity_result, _) = await asyncio.gather(my_hello, timer)
184
+ return activity_result
185
+ ```
186
+
187
+ **Example Workflow History Analysis:**
188
+
189
+ 1. The initial Workflow task is processed. The `execute_activity` call creates a command for
190
+ scheduling an Activity, and `workflow.sleep` creates a command for a timer.
191
+ 2. The `asyncio.gather` line indicates a wait for both the activity and timer to resolve.
192
+ 3. The SDK knows when to respond to the task because the Workflow cannot make any more progress. All
193
+ buffered commands are sent to the server (activity and timer commands, in that order). This
194
+ completes the first Workflow task.
195
+ 4. The server receives these commands, which are converted into `ActivityTaskScheduled` and
196
+ `TimerStarted` events (duals of the commands).
197
+ 5. When the Activity completes, an `ActivityTaskCompleted` event is added to the history. This
198
+ triggers a new Workflow task.
199
+ 6. The worker processes this new task, and the future `my_hello` is resolved. The Workflow code,
200
+ however, is still blocked on `gather` because the timer hasn't fired. The SDK replies with an
201
+ empty list of commands, indicating no new actions.
202
+ 7. The timer fires, resulting in a `TimerFired` event. This generates another Workflow task.
203
+ 8. When this task is processed, the `gather` call resolves. The Workflow function returns, producing
204
+ a `CompleteWorkflowExecution` command.
205
+ 9. This command is converted into a `WorkflowExecutionCompleted` event, and the Workflow finishes.
206
+
207
+ The complete history at the end of all this is the following:
208
+
209
+ 1. Workflow Execution Started
210
+ 2. Workflow Task Scheduled
211
+ 3. Workflow Task Started
212
+ 4. Workflow Task Completed
213
+ 5. Activity Task Scheduled `say_hello`
214
+ 6. Timer Started `1 (1s)`
215
+ 7. Activity Task Started `say_hello`
216
+ 8. Activity Task Completed `say_hello`
217
+ 9. Workflow Task Scheduled
218
+ 10. Workflow Task Started
219
+ 11. Workflow Task Completed `Notice: No commands sent`
220
+ 12. Timer Fired `1 (1s)`
221
+ 13. Workflow Task Scheduled
222
+ 14. Workflow Task Started
223
+ 15. Workflow Task Completed
224
+ 16. Workflow Execution Completed
225
+
226
+ This repetitive nature of processing Workflow tasks, where the SDK polls for tasks, processes
227
+ history, unblocks user code, and sends new commands, continues until Workflow completion.
228
+
229
+ ### How Replay Works
230
+
231
+ Above we described the sequence of events as if the Python objects remained in memory between
232
+ workflow tasks, with asyncio futures "waiting" to be resolved. That is indeed typically the case,
233
+ but technically it's a performance optimization (we refer to it as the "sticky" optimization), where
234
+ history is delivered in incremental pieces rather than in its entirety. When a worker doesn't have
235
+ the workflow already in-cache, it "replays" the workflow code from the beginning (this is why we
236
+ said workers are stateless), making use of the supplied history to deterministically reach precisely
237
+ the state it had reached previously.
238
+
239
+ Replay is fundamental to Temporal's durability and determinism, and so we'll now look at it in a bit
240
+ more detail.
241
+
242
+ **History Processing:**
243
+
244
+ SDKs process events from history serially, one at a time. Each event is fed to a specific instance
245
+ of a state machine. There is a type of state machine for every command, as well as some non-command
246
+ events/concepts. The state of a particular Workflow run consists of the combination of the states of
247
+ these state machines, and importantly, the order in which they are created.
248
+
249
+ **Timer State Machine in Core (Example):**
250
+
251
+ We can use the Timer state machine to illustrate how determinism is enforced:
252
+
253
+ <img src="https://uml.planttext.com/plantuml/svg/fL912iCW4Bpx2g6tWX_eeGI4Fg3s5d8mkj206h3w_oOR8q9jfFJaBhCpiuvsho1zYDQG_ZnGngwKUv01D4adPVrfD1661HBhB9-jbKud-4A5UeAE1aW5RP9JZzXZik1_KRc3chrUPP2AqB9uGu5Bfy2WELQa9baIRfFF7bWt6Pim4Zukl7b-dTYUu1_-qHe2NCYX5t15Rnqjbia9x2tPYyDiCQzAc0dkmEdbxxq1" width="500" alt="Timer FSM Diagram"/>
254
+
255
+ When we first create the timer, we immediately schedule it, which produces the `StartTimer` command,
256
+ which becomes the `TimerStarted` event. The `Created` state isn’t really necessary here, but the
257
+ schedule transition serves as a convenient way to produce the start timer command.
258
+
259
+ When we see a `TimerStarted` event on history, we know that the command we issued exists in Workflow
260
+ history, and we move to the StartCommandRecorded state and wait to see what happens - it can either
261
+ fire or be canceled.
262
+
263
+ In our example, there’s a `TimerFired` event, so when the SDK processes that event, we’d take that
264
+ transition, and the machine ends up in the final fired state
265
+
266
+ At this point, you might be wondering - why does that `StartCommandRecorded` state matter? Why have
267
+ a transition for `TimerStarted` at all? We know we sent the command to the server, so why not just
268
+ wait to see if the timer fires or is canceled from the `StartCommandCreated` state? The answer is
269
+ that's a big part of the secret sauce for how we enforce determinism.
270
+
271
+ **Enforcing Determinism:**
272
+
273
+ A Workflow must always emit the same commands in the same sequence. Temporal can detect violations
274
+ of this rule because of the "dual" events that each command produces. The `TimerStarted` transition
275
+ ensures that when replaying a Workflow, the current code attempting to start a timer does so at the
276
+ same point and in the same way as what exists in history. The order in which state machines are
277
+ created by Workflow code also matters to ensure the same sequence of commands is produced. This
278
+ prevents scenarios where changed code might run a command that should have been mutually exclusive
279
+ with a command already in history.
280
+
281
+ **Example of Nondeterminism:**
282
+
283
+ If the order of arguments to `asyncio.gather` is swapped in the previous example Workflow, replaying
284
+ the Workflow will result in a nondeterminism error (often referred to as an "NDE"):
285
+
286
+ ```
287
+ temporalio.workflow.NondeterminismError: Workflow activation completion failed: Failure { failure:
288
+ Some(Failure { message: "[TMPRL1100] Nondeterminism error: Timer machine does not handle this event:
289
+ HistoryEvent(id: 5, ActivityTaskScheduled)", source: "", stack_trace: "", encoded_attributes: None,
290
+ cause: None, failure_info: Some(ApplicationFailureInfo(ApplicationFailureInfo { r#type: "",
291
+ non_retryable: false, details: None, next_retry_delay: None })) }), force_cause:
292
+ NonDeterministicError }
293
+ ```
294
+
295
+ This error occurs because the "dual" events in the history are not in the same order as the commands
296
+ produced by the modified Workflow code. The timer machine, expecting a `TimerStarted` event,
297
+ encounters an `ActivityTaskScheduled` event instead, leading to a nondeterminism error. In other
298
+ words, we did not produce the same commands in the same order. This mechanism ensures Workflow state
299
+ consistency.
@@ -1,10 +1,10 @@
1
1
  [package]
2
- name = "temporal-client"
2
+ name = "temporalio-client"
3
3
  version = "0.1.0"
4
4
  edition = "2024"
5
- authors = ["Spencer Judge <spencer@temporal.io>"]
5
+ authors = ["Temporal Technologies Inc. <sdk@temporal.io>"]
6
6
  license-file = { workspace = true }
7
- description = "Clients for interacting with Temporal Clusters"
7
+ description = "Clients for interacting with Temporal"
8
8
  homepage = "https://temporal.io/"
9
9
  repository = "https://github.com/temporalio/sdk-core"
10
10
  keywords = ["temporal", "workflow"]
@@ -18,36 +18,35 @@ anyhow = "1.0"
18
18
  async-trait = "0.1"
19
19
  backoff = "0.4"
20
20
  base64 = "0.22"
21
- derive_builder = { workspace = true }
21
+ bon = "3"
22
22
  derive_more = { workspace = true }
23
+ dyn-clone = "1.0"
23
24
  bytes = "1.10"
24
25
  futures-util = { version = "0.3", default-features = false }
25
26
  futures-retry = "0.6.0"
26
- http = "1.1"
27
+ http = "1.3"
27
28
  http-body-util = "0.1"
28
- hyper = { version = "1.4.1" }
29
- hyper-util = "0.1.6"
29
+ hyper = { version = "1.7.0" }
30
+ hyper-util = "0.1.16"
30
31
  opentelemetry = { workspace = true, features = ["metrics"], optional = true }
31
32
  parking_lot = "0.12"
32
33
  slotmap = "1.0"
33
34
  thiserror = { workspace = true }
34
- tokio = "1.1"
35
+ tokio = "1.47"
35
36
  tonic = { workspace = true, features = ["tls-ring", "tls-native-roots"] }
36
37
  tower = { version = "0.5", features = ["util"] }
37
38
  tracing = "0.1"
38
- url = "2.2"
39
- uuid = { version = "1.1", features = ["v4"] }
39
+ url = "2.5"
40
+ uuid = { version = "1.18", features = ["v4"] }
41
+ rand = "0.9.2"
40
42
 
41
- [dependencies.temporal-sdk-core-protos]
42
- path = "../sdk-core-protos"
43
-
44
- [dependencies.temporal-sdk-core-api]
45
- path = "../core-api"
43
+ [dependencies.temporalio-common]
44
+ path = "../common"
46
45
 
47
46
  [dev-dependencies]
48
47
  assert_matches = "1"
49
48
  mockall = "0.13"
50
- rstest = "0.25"
49
+ rstest = "0.26"
51
50
 
52
51
  [lints]
53
52
  workspace = true
@@ -3,8 +3,7 @@
3
3
 
4
4
  use anyhow::anyhow;
5
5
  use bytes::{BufMut, BytesMut};
6
- use futures_util::future::BoxFuture;
7
- use futures_util::stream;
6
+ use futures_util::{future::BoxFuture, stream};
8
7
  use http::{HeaderMap, Request, Response};
9
8
  use http_body_util::{BodyExt, StreamBody, combinators::BoxBody};
10
9
  use hyper::body::{Bytes, Frame};