@proompteng/temporal-bun-sdk 0.1.0 → 0.3.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 (165) hide show
  1. package/README.md +98 -2
  2. package/dist/src/client/serialization.d.ts +30 -1
  3. package/dist/src/client/serialization.d.ts.map +1 -1
  4. package/dist/src/client/serialization.js +76 -3
  5. package/dist/src/client/serialization.js.map +1 -1
  6. package/dist/src/client/types.d.ts +26 -0
  7. package/dist/src/client/types.d.ts.map +1 -1
  8. package/dist/src/client.d.ts +10 -2
  9. package/dist/src/client.d.ts.map +1 -1
  10. package/dist/src/client.js +243 -1
  11. package/dist/src/client.js.map +1 -1
  12. package/dist/src/index.d.ts +1 -1
  13. package/dist/src/index.d.ts.map +1 -1
  14. package/dist/src/index.js.map +1 -1
  15. package/dist/src/proto/temporal/api/activity/v1/message_pb.js +1 -1
  16. package/dist/src/proto/temporal/api/batch/v1/message_pb.js +1 -1
  17. package/dist/src/proto/temporal/api/command/v1/message_pb.js +1 -1
  18. package/dist/src/proto/temporal/api/common/v1/message_pb.js +1 -1
  19. package/dist/src/proto/temporal/api/deployment/v1/message_pb.js +1 -1
  20. package/dist/src/proto/temporal/api/enums/v1/batch_operation_pb.js +1 -1
  21. package/dist/src/proto/temporal/api/enums/v1/command_type_pb.js +1 -1
  22. package/dist/src/proto/temporal/api/enums/v1/common_pb.js +1 -1
  23. package/dist/src/proto/temporal/api/enums/v1/deployment_pb.js +1 -1
  24. package/dist/src/proto/temporal/api/enums/v1/event_type_pb.js +1 -1
  25. package/dist/src/proto/temporal/api/enums/v1/failed_cause_pb.d.ts +7 -1
  26. package/dist/src/proto/temporal/api/enums/v1/failed_cause_pb.d.ts.map +1 -1
  27. package/dist/src/proto/temporal/api/enums/v1/failed_cause_pb.js +8 -2
  28. package/dist/src/proto/temporal/api/enums/v1/failed_cause_pb.js.map +1 -1
  29. package/dist/src/proto/temporal/api/enums/v1/namespace_pb.js +1 -1
  30. package/dist/src/proto/temporal/api/enums/v1/nexus_pb.js +1 -1
  31. package/dist/src/proto/temporal/api/enums/v1/query_pb.js +1 -1
  32. package/dist/src/proto/temporal/api/enums/v1/reset_pb.js +1 -1
  33. package/dist/src/proto/temporal/api/enums/v1/schedule_pb.js +1 -1
  34. package/dist/src/proto/temporal/api/enums/v1/task_queue_pb.js +1 -1
  35. package/dist/src/proto/temporal/api/enums/v1/update_pb.js +1 -1
  36. package/dist/src/proto/temporal/api/enums/v1/workflow_pb.js +1 -1
  37. package/dist/src/proto/temporal/api/errordetails/v1/message_pb.js +1 -1
  38. package/dist/src/proto/temporal/api/export/v1/message_pb.js +1 -1
  39. package/dist/src/proto/temporal/api/failure/v1/message_pb.js +1 -1
  40. package/dist/src/proto/temporal/api/filter/v1/message_pb.js +1 -1
  41. package/dist/src/proto/temporal/api/history/v1/message_pb.js +1 -1
  42. package/dist/src/proto/temporal/api/namespace/v1/message_pb.js +1 -1
  43. package/dist/src/proto/temporal/api/nexus/v1/message_pb.js +1 -1
  44. package/dist/src/proto/temporal/api/operatorservice/v1/request_response_pb.js +1 -1
  45. package/dist/src/proto/temporal/api/operatorservice/v1/service_pb.js +1 -1
  46. package/dist/src/proto/temporal/api/protocol/v1/message_pb.js +1 -1
  47. package/dist/src/proto/temporal/api/query/v1/message_pb.js +1 -1
  48. package/dist/src/proto/temporal/api/replication/v1/message_pb.js +1 -1
  49. package/dist/src/proto/temporal/api/rules/v1/message_pb.js +1 -1
  50. package/dist/src/proto/temporal/api/sdk/v1/enhanced_stack_trace_pb.js +1 -1
  51. package/dist/src/proto/temporal/api/sdk/v1/task_complete_metadata_pb.js +1 -1
  52. package/dist/src/proto/temporal/api/sdk/v1/user_metadata_pb.js +1 -1
  53. package/dist/src/proto/temporal/api/sdk/v1/worker_config_pb.js +1 -1
  54. package/dist/src/proto/temporal/api/sdk/v1/workflow_metadata_pb.js +1 -1
  55. package/dist/src/proto/temporal/api/taskqueue/v1/message_pb.js +1 -1
  56. package/dist/src/proto/temporal/api/update/v1/message_pb.js +1 -1
  57. package/dist/src/proto/temporal/api/version/v1/message_pb.js +1 -1
  58. package/dist/src/proto/temporal/api/worker/v1/message_pb.js +1 -1
  59. package/dist/src/proto/temporal/api/workflow/v1/message_pb.js +1 -1
  60. package/dist/src/proto/temporal/api/workflowservice/v1/request_response_pb.js +1 -1
  61. package/dist/src/proto/temporal/api/workflowservice/v1/service_pb.js +1 -1
  62. package/dist/src/worker/concurrency.d.ts +8 -0
  63. package/dist/src/worker/concurrency.d.ts.map +1 -1
  64. package/dist/src/worker/concurrency.js +5 -9
  65. package/dist/src/worker/concurrency.js.map +1 -1
  66. package/dist/src/worker/runtime.d.ts.map +1 -1
  67. package/dist/src/worker/runtime.js +303 -29
  68. package/dist/src/worker/runtime.js.map +1 -1
  69. package/dist/src/worker/update-protocol.d.ts +33 -0
  70. package/dist/src/worker/update-protocol.d.ts.map +1 -0
  71. package/dist/src/worker/update-protocol.js +228 -0
  72. package/dist/src/worker/update-protocol.js.map +1 -0
  73. package/dist/src/workflow/context.d.ts +52 -1
  74. package/dist/src/workflow/context.d.ts.map +1 -1
  75. package/dist/src/workflow/context.js +212 -2
  76. package/dist/src/workflow/context.js.map +1 -1
  77. package/dist/src/workflow/definition.d.ts +29 -3
  78. package/dist/src/workflow/definition.d.ts.map +1 -1
  79. package/dist/src/workflow/definition.js +30 -4
  80. package/dist/src/workflow/definition.js.map +1 -1
  81. package/dist/src/workflow/determinism.d.ts +59 -0
  82. package/dist/src/workflow/determinism.d.ts.map +1 -1
  83. package/dist/src/workflow/determinism.js +76 -1
  84. package/dist/src/workflow/determinism.js.map +1 -1
  85. package/dist/src/workflow/errors.d.ts +3 -0
  86. package/dist/src/workflow/errors.d.ts.map +1 -1
  87. package/dist/src/workflow/errors.js +6 -0
  88. package/dist/src/workflow/errors.js.map +1 -1
  89. package/dist/src/workflow/executor.d.ts +53 -0
  90. package/dist/src/workflow/executor.d.ts.map +1 -1
  91. package/dist/src/workflow/executor.js +237 -6
  92. package/dist/src/workflow/executor.js.map +1 -1
  93. package/dist/src/workflow/inbound.d.ts +84 -0
  94. package/dist/src/workflow/inbound.d.ts.map +1 -0
  95. package/dist/src/workflow/inbound.js +65 -0
  96. package/dist/src/workflow/inbound.js.map +1 -0
  97. package/dist/src/workflow/index.d.ts +1 -0
  98. package/dist/src/workflow/index.d.ts.map +1 -1
  99. package/dist/src/workflow/index.js +1 -0
  100. package/dist/src/workflow/index.js.map +1 -1
  101. package/dist/src/workflow/replay.d.ts +24 -2
  102. package/dist/src/workflow/replay.d.ts.map +1 -1
  103. package/dist/src/workflow/replay.js +459 -14
  104. package/dist/src/workflow/replay.js.map +1 -1
  105. package/dist/src/workflows/index.d.ts +1 -1
  106. package/dist/src/workflows/index.d.ts.map +1 -1
  107. package/package.json +6 -1
  108. package/dist/bin/start-worker.js +0 -3
  109. package/dist/bin/temporal-bun.js +0 -3
  110. package/dist/src/build_id_preflight.d.ts +0 -7
  111. package/dist/src/build_id_preflight.d.ts.map +0 -1
  112. package/dist/src/build_id_preflight.js +0 -123
  113. package/dist/src/build_id_preflight.js.map +0 -1
  114. package/dist/src/client/serialization.test.d.ts +0 -2
  115. package/dist/src/client/serialization.test.d.ts.map +0 -1
  116. package/dist/src/client/serialization.test.js +0 -251
  117. package/dist/src/client/serialization.test.js.map +0 -1
  118. package/dist/src/core-bridge/client.d.ts +0 -36
  119. package/dist/src/core-bridge/client.d.ts.map +0 -1
  120. package/dist/src/core-bridge/client.js +0 -111
  121. package/dist/src/core-bridge/client.js.map +0 -1
  122. package/dist/src/core-bridge/index.d.ts +0 -4
  123. package/dist/src/core-bridge/index.d.ts.map +0 -1
  124. package/dist/src/core-bridge/index.js +0 -4
  125. package/dist/src/core-bridge/index.js.map +0 -1
  126. package/dist/src/core-bridge/runtime.d.ts +0 -20
  127. package/dist/src/core-bridge/runtime.d.ts.map +0 -1
  128. package/dist/src/core-bridge/runtime.js +0 -62
  129. package/dist/src/core-bridge/runtime.js.map +0 -1
  130. package/dist/src/core-bridge/runtime.test.d.ts +0 -2
  131. package/dist/src/core-bridge/runtime.test.d.ts.map +0 -1
  132. package/dist/src/core-bridge/runtime.test.js +0 -68
  133. package/dist/src/core-bridge/runtime.test.js.map +0 -1
  134. package/dist/src/internal/core-bridge/native.d.ts +0 -176
  135. package/dist/src/internal/core-bridge/native.d.ts.map +0 -1
  136. package/dist/src/internal/core-bridge/native.js +0 -1208
  137. package/dist/src/internal/core-bridge/native.js.map +0 -1
  138. package/dist/src/telemetry/runtime.d.ts +0 -5
  139. package/dist/src/telemetry/runtime.d.ts.map +0 -1
  140. package/dist/src/telemetry/runtime.js +0 -94
  141. package/dist/src/telemetry/runtime.js.map +0 -1
  142. package/dist/src/workflow/runtime/bootstrap.d.ts +0 -15
  143. package/dist/src/workflow/runtime/bootstrap.d.ts.map +0 -1
  144. package/dist/src/workflow/runtime/bootstrap.js +0 -124
  145. package/dist/src/workflow/runtime/bootstrap.js.map +0 -1
  146. package/dist/src/workflow/runtime/engine.d.ts +0 -21
  147. package/dist/src/workflow/runtime/engine.d.ts.map +0 -1
  148. package/dist/src/workflow/runtime/engine.js +0 -73
  149. package/dist/src/workflow/runtime/engine.js.map +0 -1
  150. package/dist/src/workflow/runtime/environment.d.ts +0 -29
  151. package/dist/src/workflow/runtime/environment.d.ts.map +0 -1
  152. package/dist/src/workflow/runtime/environment.js +0 -298
  153. package/dist/src/workflow/runtime/environment.js.map +0 -1
  154. package/dist/src/workflow/runtime/index.d.ts +0 -7
  155. package/dist/src/workflow/runtime/index.d.ts.map +0 -1
  156. package/dist/src/workflow/runtime/index.js +0 -4
  157. package/dist/src/workflow/runtime/index.js.map +0 -1
  158. package/dist/src/workflow/runtime/info.d.ts +0 -5
  159. package/dist/src/workflow/runtime/info.d.ts.map +0 -1
  160. package/dist/src/workflow/runtime/info.js +0 -22
  161. package/dist/src/workflow/runtime/info.js.map +0 -1
  162. package/dist/src/workflow/runtime/replay.d.ts +0 -26
  163. package/dist/src/workflow/runtime/replay.d.ts.map +0 -1
  164. package/dist/src/workflow/runtime/replay.js +0 -254
  165. package/dist/src/workflow/runtime/replay.js.map +0 -1
@@ -1,36 +0,0 @@
1
- import { type NativeClient } from '../internal/core-bridge/native';
2
- import type { Runtime } from './runtime';
3
- export interface ClientTlsOptions {
4
- readonly serverRootCACertificate?: string;
5
- readonly clientCert?: string;
6
- readonly clientPrivateKey?: string;
7
- readonly serverNameOverride?: string;
8
- }
9
- export interface ClientOptions {
10
- readonly address: string;
11
- readonly namespace: string;
12
- readonly identity?: string;
13
- readonly clientName?: string;
14
- readonly clientVersion?: string;
15
- readonly apiKey?: string;
16
- readonly tls?: ClientTlsOptions;
17
- }
18
- export declare class Client {
19
- #private;
20
- private readonly runtime;
21
- private readonly options;
22
- readonly namespace: string;
23
- static connect(runtime: Runtime, options: ClientOptions): Promise<Client>;
24
- private constructor();
25
- get nativeHandle(): NativeClient;
26
- describeNamespace(namespace?: string): Promise<Uint8Array>;
27
- updateHeaders(headers: Record<string, string>): void;
28
- shutdown(): Promise<void>;
29
- }
30
- export declare const createClient: (runtime: Runtime, options: ClientOptions) => Promise<Client>;
31
- export declare const normalizeTemporalAddress: (address: string, useTls?: boolean) => string;
32
- export declare const __TEST__: {
33
- finalizeClient: (client: NativeClient) => void;
34
- serializeTlsOptions: (tls?: ClientTlsOptions) => Record<string, unknown> | undefined;
35
- };
36
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/core-bridge/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,gCAAgC,CAAA;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAA;IACzC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,gBA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mDxF,CAAA"}
@@ -1,111 +0,0 @@
1
- import { native } from '../internal/core-bridge/native';
2
- export class Client {
3
- runtime;
4
- options;
5
- #native;
6
- namespace;
7
- static async connect(runtime, options) {
8
- const client = new Client(runtime, options);
9
- await client.#init();
10
- return client;
11
- }
12
- constructor(runtime, options) {
13
- this.runtime = runtime;
14
- this.options = options;
15
- this.namespace = options.namespace;
16
- }
17
- async #init() {
18
- const nativeRuntime = this.runtime.nativeHandle;
19
- const payload = {
20
- address: normalizeTemporalAddress(this.options.address, Boolean(this.options.tls)),
21
- namespace: this.options.namespace,
22
- identity: this.options.identity,
23
- client_name: this.options.clientName,
24
- client_version: this.options.clientVersion,
25
- };
26
- if (this.options.apiKey) {
27
- payload.api_key = this.options.apiKey;
28
- }
29
- const tlsPayload = serializeTlsOptions(this.options.tls);
30
- if (tlsPayload) {
31
- payload.tls = tlsPayload;
32
- }
33
- this.#native = await native.createClient(nativeRuntime, payload);
34
- clientFinalizer.register(this, this.#native, this);
35
- }
36
- get nativeHandle() {
37
- if (!this.#native) {
38
- throw new Error('Client has already been shut down');
39
- }
40
- return this.#native;
41
- }
42
- async describeNamespace(namespace = this.namespace) {
43
- const handle = this.nativeHandle;
44
- return await native.describeNamespace(handle, namespace);
45
- }
46
- updateHeaders(headers) {
47
- native.updateClientHeaders(this.nativeHandle, headers);
48
- }
49
- async shutdown() {
50
- if (!this.#native)
51
- return;
52
- native.clientShutdown(this.#native);
53
- clientFinalizer.unregister(this);
54
- this.#native = undefined;
55
- }
56
- }
57
- export const createClient = async (runtime, options) => {
58
- return await Client.connect(runtime, options);
59
- };
60
- const finalizeClient = (client) => {
61
- try {
62
- native.clientShutdown(client);
63
- }
64
- catch {
65
- // Best-effort cleanup; ignore errors during GC finalization.
66
- }
67
- };
68
- const serializeTlsOptions = (tls) => {
69
- if (!tls)
70
- return undefined;
71
- const payload = {};
72
- if (tls.serverRootCACertificate) {
73
- payload.serverRootCACertificate = tls.serverRootCACertificate;
74
- payload.server_root_ca_cert = tls.serverRootCACertificate;
75
- }
76
- if (tls.serverNameOverride) {
77
- payload.serverNameOverride = tls.serverNameOverride;
78
- payload.server_name_override = tls.serverNameOverride;
79
- }
80
- if (tls.clientCert && tls.clientPrivateKey) {
81
- payload.clientCertPair = {
82
- crt: tls.clientCert,
83
- key: tls.clientPrivateKey,
84
- };
85
- payload.client_cert = tls.clientCert;
86
- payload.client_private_key = tls.clientPrivateKey;
87
- }
88
- if (tls.clientCert && !tls.clientPrivateKey) {
89
- payload.clientCert = tls.clientCert;
90
- payload.client_cert = tls.clientCert;
91
- }
92
- if (!tls.clientCert && tls.clientPrivateKey) {
93
- payload.clientPrivateKey = tls.clientPrivateKey;
94
- payload.client_private_key = tls.clientPrivateKey;
95
- }
96
- return Object.keys(payload).length > 0 ? payload : undefined;
97
- };
98
- const clientFinalizer = new FinalizationRegistry(finalizeClient);
99
- const ADDRESS_WITH_PROTOCOL = /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//;
100
- export const normalizeTemporalAddress = (address, useTls = false) => {
101
- if (ADDRESS_WITH_PROTOCOL.test(address)) {
102
- return address;
103
- }
104
- const scheme = useTls ? 'https' : 'http';
105
- return `${scheme}://${address}`;
106
- };
107
- export const __TEST__ = {
108
- finalizeClient,
109
- serializeTlsOptions,
110
- };
111
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/core-bridge/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,EAAE,MAAM,gCAAgC,CAAA;AAoB1E,MAAM,OAAO,MAAM;IAWE;IACA;IAXnB,OAAO,CAA0B;IACxB,SAAS,CAAQ;IAE1B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAgB,EAAE,OAAsB;QAC3D,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC3C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;QACpB,OAAO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E,MAAM,GAAG,KAAK,EAAU,EAAE;IAClF,IAAI,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAA;IACxC,OAAO,GAAG,MAAM,MAAM,OAAO,EAAE,CAAA;AACjC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,cAAc;IACd,mBAAmB;CACpB,CAAA"}
@@ -1,4 +0,0 @@
1
- export * as native from '../internal/core-bridge/native.js';
2
- export * as client from './client';
3
- export * as runtime from './runtime';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core-bridge/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mCAAmC,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA"}
@@ -1,4 +0,0 @@
1
- export * as native from '../internal/core-bridge/native.js';
2
- export * as client from './client';
3
- export * as runtime from './runtime';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core-bridge/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mCAAmC,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA"}
@@ -1,20 +0,0 @@
1
- import { type Runtime as NativeRuntime, type TemporalCoreLogger } from '../internal/core-bridge/native';
2
- export interface RuntimeOptions {
3
- readonly options?: Record<string, unknown>;
4
- }
5
- export declare class Runtime {
6
- #private;
7
- static create(options?: RuntimeOptions): Runtime;
8
- private constructor();
9
- get nativeHandle(): NativeRuntime;
10
- configureTelemetry(options?: Record<string, unknown>): void;
11
- installLogger(callback: TemporalCoreLogger): void;
12
- removeLogger(): void;
13
- shutdown(): Promise<void>;
14
- }
15
- export declare const createRuntime: (options?: RuntimeOptions) => Runtime;
16
- export declare const __TEST__: {
17
- finalizeRuntime: (runtime: NativeRuntime) => void;
18
- };
19
- export type { TemporalCoreLogEvent, TemporalCoreLogLevel } from '../internal/core-bridge/native';
20
- //# sourceMappingURL=runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/core-bridge/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,IAAI,aAAa,EAAU,KAAK,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAE/G,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC3C;AAED,qBAAa,OAAO;;IAIlB,MAAM,CAAC,MAAM,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO;IAIpD,OAAO;IAKP,IAAI,YAAY,IAAI,aAAa,CAKhC;IAED,kBAAkB,CAAC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAI/D,aAAa,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAWjD,YAAY,IAAI,IAAI;IAQd,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAUhC;AAYD,eAAO,MAAM,aAAa,GAAI,UAAS,cAAmB,KAAG,OAAkC,CAAA;AAE/F,eAAO,MAAM,QAAQ;+BAZa,aAAa,KAAG,IAAI;CAcrD,CAAA;AAED,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA"}
@@ -1,62 +0,0 @@
1
- import { native } from '../internal/core-bridge/native';
2
- export class Runtime {
3
- #native;
4
- #loggerInstalled = false;
5
- static create(options = {}) {
6
- return new Runtime(options);
7
- }
8
- constructor(options = {}) {
9
- this.#native = native.createRuntime(options.options ?? {});
10
- runtimeFinalizer.register(this, this.#native, this);
11
- }
12
- get nativeHandle() {
13
- if (!this.#native) {
14
- throw new Error('Runtime has already been shut down');
15
- }
16
- return this.#native;
17
- }
18
- configureTelemetry(options = {}) {
19
- native.configureTelemetry(this.nativeHandle, options);
20
- }
21
- installLogger(callback) {
22
- if (this.#loggerInstalled) {
23
- throw new Error('A logger is already installed for this runtime');
24
- }
25
- native.installLogger(this.nativeHandle, callback, () => {
26
- this.#loggerInstalled = false;
27
- });
28
- this.#loggerInstalled = true;
29
- }
30
- removeLogger() {
31
- if (!this.#native || !this.#loggerInstalled) {
32
- return;
33
- }
34
- native.removeLogger(this.#native);
35
- this.#loggerInstalled = false;
36
- }
37
- async shutdown() {
38
- if (!this.#native)
39
- return;
40
- if (this.#loggerInstalled) {
41
- native.removeLogger(this.#native);
42
- this.#loggerInstalled = false;
43
- }
44
- native.runtimeShutdown(this.#native);
45
- runtimeFinalizer.unregister(this);
46
- this.#native = undefined;
47
- }
48
- }
49
- const finalizeRuntime = (runtime) => {
50
- try {
51
- native.runtimeShutdown(runtime);
52
- }
53
- catch {
54
- // Swallow errors during GC finalization to avoid process crashes.
55
- }
56
- };
57
- const runtimeFinalizer = new FinalizationRegistry(finalizeRuntime);
58
- export const createRuntime = (options = {}) => Runtime.create(options);
59
- export const __TEST__ = {
60
- finalizeRuntime,
61
- };
62
- //# sourceMappingURL=runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/core-bridge/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,MAAM,EAA2B,MAAM,gCAAgC,CAAA;AAM/G,MAAM,OAAO,OAAO;IAClB,OAAO,CAA2B;IAClC,gBAAgB,GAAG,KAAK,CAAA;IAExB,MAAM,CAAC,MAAM,CAAC,UAA0B,EAAE;QACxC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAA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AC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YACjC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAA;QAC/B,CAAC;QACD,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACpC,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAA;IAC1B,CAAC;CACF;AAED,MAAM,eAAe,GAAG,CAAC,OAAsB,EAAQ,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,kEAAkE;IACpE,CAAC;AACH,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,IAAI,oBAAoB,CAAgB,eAAe,CAAC,CAAA;AAEjF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAA0B,EAAE,EAAW,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAE/F,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,eAAe;CAChB,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=runtime.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.test.d.ts","sourceRoot":"","sources":["../../../src/core-bridge/runtime.test.ts"],"names":[],"mappings":""}
@@ -1,68 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
- import { native } from '../internal/core-bridge/native';
3
- import { Runtime } from './runtime';
4
- describe('Runtime.installLogger', () => {
5
- it('forwards log events to the registered callback', async () => {
6
- const runtime = Runtime.create();
7
- const events = [];
8
- runtime.installLogger((event) => {
9
- events.push(buildEventSnapshot(event));
10
- });
11
- native.__TEST__.emitSyntheticLog({
12
- level: 'warn',
13
- target: 'core.runtime',
14
- message: 'forwarded',
15
- timestampMillis: 123,
16
- fieldsJson: '{"tenant":"alpha"}',
17
- });
18
- expect(events).toHaveLength(1);
19
- expect(events[0]).toMatchObject({
20
- level: 'warn',
21
- levelIndex: 3,
22
- target: 'core.runtime',
23
- message: 'forwarded',
24
- timestampMillis: 123,
25
- });
26
- expect(events[0].fields).toEqual({ tenant: 'alpha' });
27
- runtime.removeLogger();
28
- await runtime.shutdown();
29
- });
30
- it('rejects duplicate registrations', async () => {
31
- const runtime = Runtime.create();
32
- runtime.installLogger(() => { });
33
- expect(() => runtime.installLogger(() => { })).toThrow(/already installed/i);
34
- runtime.removeLogger();
35
- await runtime.shutdown();
36
- });
37
- it('propagates logger errors and detaches the callback', async () => {
38
- const runtime = Runtime.create();
39
- const error = new Error('logger boom');
40
- runtime.installLogger(() => {
41
- throw error;
42
- });
43
- expect(() => native.__TEST__.emitSyntheticLog({ message: 'first' })).toThrow(error);
44
- expect(() => native.__TEST__.emitSyntheticLog({ message: 'second' })).not.toThrow();
45
- runtime.removeLogger();
46
- await runtime.shutdown();
47
- });
48
- it('allows reinstalling a logger after the native bridge detaches it', async () => {
49
- const runtime = Runtime.create();
50
- runtime.installLogger(() => {
51
- throw new Error('logger failure');
52
- });
53
- expect(() => native.__TEST__.emitSyntheticLog({ message: 'first' })).toThrow();
54
- expect(() => runtime.installLogger(() => { })).not.toThrow();
55
- runtime.removeLogger();
56
- await runtime.shutdown();
57
- });
58
- });
59
- const buildEventSnapshot = (event) => ({
60
- level: event.level,
61
- levelIndex: event.levelIndex,
62
- target: event.target,
63
- message: event.message,
64
- timestampMillis: event.timestampMillis,
65
- fieldsJson: event.fieldsJson,
66
- fields: event.fields,
67
- });
68
- //# sourceMappingURL=runtime.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.test.js","sourceRoot":"","sources":["../../../src/core-bridge/runtime.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AACvD,OAAO,EA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AAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;QAE9E,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAA;QAE3D,OAAO,CAAC,YAAY,EAAE,CAAA;QACtB,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAA;IAC1B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,MAAM,kBAAkB,GAAG,CAAC,KAA2B,EAAE,EAAE,CAAC,CAAC;IAC3D,KAAK,EAAE,KAAK,CAAC,KAAK;IAClB,UAAU,EAAE,KAAK,CAAC,UAAU;IAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;IACpB,OAAO,EAAE,KAAK,CAAC,OAAO;IACtB,eAAe,EAAE,KAAK,CAAC,eAAe;IACtC,UAAU,EAAE,KAAK,CAAC,UAAU;IAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;CACrB,CAAC,CAAA"}
@@ -1,176 +0,0 @@
1
- import { type Pointer } from 'bun:ffi';
2
- type RuntimePtr = Pointer;
3
- type ClientPtr = Pointer;
4
- type WorkerPtr = Pointer;
5
- type WorkerReplayPtr = Pointer;
6
- export interface Runtime {
7
- type: 'runtime';
8
- handle: RuntimePtr;
9
- }
10
- export interface NativeClient {
11
- type: 'client';
12
- handle: ClientPtr;
13
- }
14
- export interface NativeWorker {
15
- type: 'worker';
16
- handle: WorkerPtr;
17
- }
18
- export interface NativeReplayWorker {
19
- type: 'replay-worker';
20
- handle: WorkerReplayPtr;
21
- worker: NativeWorker;
22
- }
23
- export interface NativeBridgeErrorInit {
24
- code: number;
25
- message: string;
26
- details?: unknown;
27
- raw?: string;
28
- }
29
- export declare class NativeBridgeError extends Error {
30
- readonly code: number;
31
- readonly details?: unknown;
32
- readonly raw: string;
33
- constructor(input: string | NativeBridgeErrorInit);
34
- }
35
- export type TemporalCoreLogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';
36
- export interface TemporalCoreLogEvent {
37
- level: TemporalCoreLogLevel;
38
- levelIndex: number;
39
- target: string;
40
- message: string;
41
- timestampMillis: number;
42
- fieldsJson?: string;
43
- fields?: unknown;
44
- }
45
- export type TemporalCoreLogger = (event: TemporalCoreLogEvent) => void;
46
- export declare const bridgeVariant: "zig";
47
- export declare const isZigBridge: boolean;
48
- export declare const nativeLibraryPath: string;
49
- export declare const native: {
50
- bridgeVariant: "zig";
51
- createRuntime(options?: Record<string, unknown>): Runtime;
52
- runtimeShutdown(runtime: Runtime): void;
53
- createClient(runtime: Runtime, config: Record<string, unknown>): Promise<NativeClient>;
54
- clientShutdown(client: NativeClient): void;
55
- describeNamespace(client: NativeClient, namespace: string): Promise<Uint8Array>;
56
- startWorkflow(client: NativeClient, request: Record<string, unknown>): Promise<Uint8Array>;
57
- configureTelemetry(runtime: Runtime, options?: Record<string, unknown>): void;
58
- pendingExecutorWorkerCount(runtime: Runtime): number;
59
- pendingExecutorQueueCapacity(runtime: Runtime): number;
60
- installLogger(runtime: Runtime, callback: TemporalCoreLogger, onDetach?: () => void): void;
61
- removeLogger(runtime: Runtime): void;
62
- __TEST__: {
63
- emitSyntheticLog({ level, target, message, timestampMillis, fieldsJson, }?: {
64
- level?: TemporalCoreLogLevel | number;
65
- target?: string;
66
- message?: string;
67
- timestampMillis?: number;
68
- fieldsJson?: string;
69
- }): void;
70
- getTelemetrySnapshot(runtime: Runtime): {
71
- mode: "none" | "prometheus" | "otlp";
72
- metricPrefix: string;
73
- socketAddr: string;
74
- attachServiceName: boolean;
75
- };
76
- registerClient(runtime: Runtime): boolean;
77
- unregisterClient(runtime: Runtime): void;
78
- registerWorker(runtime: Runtime): boolean;
79
- unregisterWorker(runtime: Runtime): void;
80
- getByteArrayMetrics(): Record<string, unknown>;
81
- resetByteArrayMetrics(): void;
82
- allocateTestByteArray(input: string): number;
83
- freeTestByteArray(pointer: number): void;
84
- };
85
- updateClientHeaders(client: NativeClient, headers: Record<string, string>): void;
86
- signalWorkflow(client: NativeClient, request: Record<string, unknown>): Promise<void>;
87
- queryWorkflow(client: NativeClient, request: Record<string, unknown>): Promise<Uint8Array>;
88
- terminateWorkflow(client: NativeClient, request: Record<string, unknown>): Promise<void>;
89
- cancelWorkflow(client: NativeClient, request: Record<string, unknown>): Promise<void>;
90
- signalWithStart(client: NativeClient, request: Record<string, unknown>): Promise<Uint8Array>;
91
- createWorker(runtime: Runtime, client: NativeClient, config: Record<string, unknown>): NativeWorker;
92
- destroyWorker(worker: NativeWorker): void;
93
- createReplayWorker(runtime: Runtime, config: Record<string, unknown>): NativeReplayWorker;
94
- destroyReplayWorker(replay: NativeReplayWorker): void;
95
- pushReplayHistory(replay: NativeReplayWorker, workflowId: string, history: Uint8Array | Buffer | string): void;
96
- createWorkerHandleForTest(): NativeWorker;
97
- releaseWorkerHandleForTest(handle: Pointer): void;
98
- workerCompleteWorkflowTask(worker: NativeWorker, payload: Uint8Array | Buffer): void;
99
- workerCompleteActivityTask(worker: NativeWorker, payload: Uint8Array | Buffer): void;
100
- workerRecordActivityHeartbeat(worker: NativeWorker, payload: Uint8Array | Buffer): void;
101
- worker: {
102
- pollWorkflowTask(worker: NativeWorker): Promise<Uint8Array>;
103
- completeWorkflowTask(worker: NativeWorker, payload: Uint8Array | Buffer): void;
104
- completeActivityTask(worker: NativeWorker, payload: Uint8Array | Buffer): void;
105
- recordActivityHeartbeat(worker: NativeWorker, payload: Uint8Array | Buffer): void;
106
- initiateShutdown(worker: NativeWorker): void;
107
- finalizeShutdown(worker: NativeWorker): void;
108
- pollActivityTask(worker: NativeWorker): Promise<Uint8Array | null>;
109
- };
110
- };
111
- export declare const __testing: {
112
- pendingByteArrayFfi: {
113
- poll: {
114
- (...args: readonly unknown[]): unknown;
115
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
116
- };
117
- consume: {
118
- (...args: readonly unknown[]): unknown;
119
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
120
- };
121
- free: {
122
- (...args: readonly unknown[]): unknown;
123
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
124
- };
125
- };
126
- workerFfi: {
127
- pollActivityTask: {
128
- (...args: readonly unknown[]): unknown;
129
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
130
- };
131
- pollWorkflowTask: {
132
- (...args: readonly unknown[]): unknown;
133
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
134
- };
135
- completeWorkflowTask: {
136
- (...args: readonly unknown[]): unknown;
137
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
138
- };
139
- completeActivityTask: {
140
- (...args: readonly unknown[]): unknown;
141
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
142
- };
143
- recordActivityHeartbeat: {
144
- (...args: readonly unknown[]): unknown;
145
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
146
- };
147
- initiateShutdown: {
148
- (...args: readonly unknown[]): unknown;
149
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
150
- };
151
- finalizeShutdown: {
152
- (...args: readonly unknown[]): unknown;
153
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
154
- };
155
- };
156
- workerReplayFfi: {
157
- create: {
158
- (...args: readonly unknown[]): unknown;
159
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
160
- };
161
- free: {
162
- (...args: readonly unknown[]): unknown;
163
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
164
- };
165
- push: {
166
- (...args: readonly unknown[]): unknown;
167
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
168
- };
169
- getWorker: {
170
- (...args: readonly unknown[]): unknown;
171
- __ffi_function_callable: typeof import("bun:ffi").FFIFunctionCallableSymbol;
172
- };
173
- };
174
- };
175
- export {};
176
- //# sourceMappingURL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