@stigmer/runner-slim-darwin-arm64 3.0.8-dev.20260612062921

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.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @stigmer/runner-slim-darwin-arm64
2
+
3
+ Platform support package for [@stigmer/runner-slim](https://www.npmjs.com/package/@stigmer/runner-slim). Contains [@temporalio/core-bridge](https://www.npmjs.com/package/@temporalio/core-bridge) 1.16.2 (MIT) pruned to the aarch64-apple-darwin prebuilt release. Installed automatically on darwin/arm64; never depend on it directly.
@@ -0,0 +1,9 @@
1
+ # `@temporalio/core-bridge`
2
+
3
+ [![NPM](https://img.shields.io/npm/v/@temporalio/core-bridge?style=for-the-badge)](https://www.npmjs.com/package/@temporalio/core-bridge)
4
+
5
+ Part of [Temporal](https://temporal.io)'s [TypeScript SDK](https://docs.temporal.io/typescript/introduction/).
6
+
7
+ > [!CAUTION]
8
+ > This package is not intended to be used directly. Any API provided
9
+ > by this package is internal and subject to change without notice.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Shared code for scripts/build.js and index.js
3
+ *
4
+ * @module
5
+ */
6
+
7
+ const os = require('os');
8
+ const path = require('path');
9
+ const fs = require('fs');
10
+
11
+ // List of tested compile targets
12
+ const targets = [
13
+ 'x86_64-apple-darwin',
14
+ 'aarch64-apple-darwin',
15
+ 'x86_64-unknown-linux-gnu',
16
+ 'aarch64-unknown-linux-gnu',
17
+ // TODO: this is not supported on macos
18
+ 'x86_64-pc-windows-msvc',
19
+ 'x86_64-pc-windows-gnu',
20
+ ];
21
+
22
+ const archAlias = { x64: 'x86_64', arm64: 'aarch64' };
23
+ const platformMapping = { darwin: 'apple-darwin', linux: 'unknown-linux-gnu', win32: 'pc-windows-msvc' };
24
+
25
+ class PrebuildError extends Error {
26
+ constructor(message) {
27
+ super(message);
28
+ this.name = 'PrebuildError';
29
+ }
30
+ }
31
+
32
+ function getPrebuiltTargetName() {
33
+ const arch = archAlias[os.arch()];
34
+ if (arch === undefined) {
35
+ throw new PrebuildError(`No prebuilt module for arch ${os.arch()}`);
36
+ }
37
+ const platform = platformMapping[os.platform()];
38
+ if (platform === undefined) {
39
+ throw new PrebuildError(`No prebuilt module for platform ${os.platform()}`);
40
+ }
41
+ return `${arch}-${platform}`;
42
+ }
43
+
44
+ function getPrebuiltPath() {
45
+ const binary = path.resolve(__dirname, 'releases', getPrebuiltTargetName(), 'index.node');
46
+ if (fs.existsSync(binary)) {
47
+ return binary;
48
+ } else {
49
+ throw new PrebuildError(`No prebuilt module found at ${binary}`);
50
+ }
51
+ }
52
+
53
+ module.exports = { targets, archAlias, platformMapping, PrebuildError, getPrebuiltPath, getPrebuiltTargetName };
@@ -0,0 +1,92 @@
1
+ const { isPromise } = require('node:util/types');
2
+ const { getPrebuiltPath } = require('./common');
3
+ const typescriptExports = require('./lib/index');
4
+ const { convertFromNamedError } = require('./lib/errors');
5
+
6
+ /**
7
+ * Wraps calls to native functions to convert "named errors" to the correct error types.
8
+ */
9
+ function wrapErrors(fn) {
10
+ return (...args) => {
11
+ try {
12
+ let res = fn(...args);
13
+ if (isPromise(res)) {
14
+ return res.catch((e) => {
15
+ throw convertFromNamedError(e, false);
16
+ });
17
+ }
18
+ return res;
19
+ } catch (e) {
20
+ throw convertFromNamedError(e, true);
21
+ }
22
+ };
23
+ }
24
+ let wrapper = (f) => wrapErrors(f);
25
+
26
+ /**
27
+ * Wraps calls to native functions to add tracing logs.
28
+ *
29
+ * To enable, set the `TEMPORAL_TRACE_NATIVE_CALLS` environment variable to `true`.
30
+ *
31
+ * IMPORTANT: This is meant for internal SDK debugging only.
32
+ */
33
+ if (process.env.TEMPORAL_TRACE_NATIVE_CALLS?.toLowerCase() === 'true') {
34
+ // Generate a random 5-character ID for the current "execution"
35
+ let execId = Math.random().toString(36).slice(-5);
36
+ let callSequence = 100000;
37
+
38
+ function log(callid, msg) {
39
+ console.log(`${new Date().toISOString()} [call-to-bridge] ${callid} ${msg}`);
40
+ }
41
+
42
+ // Do not trace these functions, they are way too verbose
43
+ const ignoreList = ['get_time_of_day'];
44
+
45
+ function wrapDebug(fn, fnname) {
46
+ // Functions names looks like `temporal_sdk_typescript_bridge::logs::get_time_of_day`
47
+ // Strip the path to retain only the function name
48
+ fnname = fnname.substring(fnname.lastIndexOf('::') + 2);
49
+ if (ignoreList.includes(fnname)) return fn;
50
+
51
+ return (...args) => {
52
+ let callid = `${execId}:${String(callSequence++).slice(-5)}`;
53
+
54
+ try {
55
+ log(callid, `${fnname}() - calling in`);
56
+
57
+ let res = fn(...args);
58
+
59
+ if (isPromise(res)) {
60
+ log(callid, `${fnname}() - received promise`);
61
+ return res.then(
62
+ (x) => {
63
+ log(callid, `${fnname}() - promise resolved`);
64
+ return x;
65
+ },
66
+ (e) => {
67
+ log(callid, `${fnname}() - promise rejected with ${e}`);
68
+ throw convertFromNamedError(e, false);
69
+ }
70
+ );
71
+ } else {
72
+ log(callid, `${fnname}() - returned`);
73
+ }
74
+
75
+ return res;
76
+ } catch (e) {
77
+ log(callid, `${fnname}() - threw an error ${e}`);
78
+ throw convertFromNamedError(e, true);
79
+ }
80
+ };
81
+ }
82
+
83
+ wrapper = (f) => wrapDebug(wrapErrors(f), f.name);
84
+ }
85
+
86
+ try {
87
+ const nativeLibPath = getPrebuiltPath();
88
+ const native = Object.fromEntries(Object.entries(require(nativeLibPath)).map(([name, fn]) => [name, wrapper(fn)]));
89
+ module.exports = { ...typescriptExports, native };
90
+ } catch (err) {
91
+ throw err;
92
+ }
@@ -0,0 +1,46 @@
1
+ import * as grpc from '@grpc/grpc-js';
2
+ import { IllegalStateError } from '@temporalio/common';
3
+ /**
4
+ * The worker has been shut down
5
+ */
6
+ export declare class ShutdownError extends Error {
7
+ }
8
+ /**
9
+ * Thrown after shutdown was requested as a response to a poll function, JS should stop polling
10
+ * once this error is encountered
11
+ */
12
+ export declare class TransportError extends Error {
13
+ }
14
+ /**
15
+ * Something unexpected happened, considered fatal
16
+ */
17
+ export declare class UnexpectedError extends Error {
18
+ cause?: unknown;
19
+ constructor(message: string, cause?: unknown);
20
+ }
21
+ export interface NativeServiceError {
22
+ name: 'ServiceError';
23
+ message: string;
24
+ code: number;
25
+ details: string;
26
+ metadata: Record<string, Buffer | string>;
27
+ stack?: string;
28
+ }
29
+ /**
30
+ * A gRPC call failed. The error carries the gRPC status code, message, and other details.
31
+ */
32
+ export declare class ServiceError extends Error implements grpc.ServiceError {
33
+ readonly code: grpc.StatusObject['code'];
34
+ readonly details: string;
35
+ readonly metadata: grpc.Metadata;
36
+ constructor(message: string, code: grpc.StatusObject['code'], details: string, metadata: grpc.Metadata);
37
+ static fromNative(err: NativeServiceError): ServiceError;
38
+ }
39
+ /**
40
+ * Something unexpected happened, considered fatal
41
+ */
42
+ export declare class NativePromiseDroppedError extends UnexpectedError {
43
+ constructor(message: string);
44
+ }
45
+ export { IllegalStateError };
46
+ export declare function convertFromNamedError(e: unknown, keepStackTrace: boolean): unknown;
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var ServiceError_1;
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.IllegalStateError = exports.NativePromiseDroppedError = exports.ServiceError = exports.UnexpectedError = exports.TransportError = exports.ShutdownError = void 0;
34
+ exports.convertFromNamedError = convertFromNamedError;
35
+ const grpc = __importStar(require("@grpc/grpc-js"));
36
+ const common_1 = require("@temporalio/common");
37
+ Object.defineProperty(exports, "IllegalStateError", { enumerable: true, get: function () { return common_1.IllegalStateError; } });
38
+ const type_helpers_1 = require("@temporalio/common/lib/type-helpers");
39
+ /**
40
+ * The worker has been shut down
41
+ */
42
+ let ShutdownError = class ShutdownError extends Error {
43
+ };
44
+ exports.ShutdownError = ShutdownError;
45
+ exports.ShutdownError = ShutdownError = __decorate([
46
+ (0, type_helpers_1.SymbolBasedInstanceOfError)('ShutdownError')
47
+ ], ShutdownError);
48
+ /**
49
+ * Thrown after shutdown was requested as a response to a poll function, JS should stop polling
50
+ * once this error is encountered
51
+ */
52
+ let TransportError = class TransportError extends Error {
53
+ };
54
+ exports.TransportError = TransportError;
55
+ exports.TransportError = TransportError = __decorate([
56
+ (0, type_helpers_1.SymbolBasedInstanceOfError)('TransportError')
57
+ ], TransportError);
58
+ /**
59
+ * Something unexpected happened, considered fatal
60
+ */
61
+ let UnexpectedError = class UnexpectedError extends Error {
62
+ cause;
63
+ constructor(message, cause) {
64
+ super(message);
65
+ this.cause = cause;
66
+ }
67
+ };
68
+ exports.UnexpectedError = UnexpectedError;
69
+ exports.UnexpectedError = UnexpectedError = __decorate([
70
+ (0, type_helpers_1.SymbolBasedInstanceOfError)('UnexpectedError')
71
+ ], UnexpectedError);
72
+ /**
73
+ * A gRPC call failed. The error carries the gRPC status code, message, and other details.
74
+ */
75
+ let ServiceError = ServiceError_1 = class ServiceError extends Error {
76
+ code;
77
+ details;
78
+ metadata;
79
+ constructor(message, code, details, metadata) {
80
+ super(message);
81
+ this.code = code;
82
+ this.details = details;
83
+ this.metadata = metadata;
84
+ }
85
+ static fromNative(err) {
86
+ const metadata = new grpc.Metadata();
87
+ for (const [k, v] of Object.entries(err.metadata ?? {})) {
88
+ metadata.set(k, v);
89
+ }
90
+ return new ServiceError_1(err.message, err.code ?? 0, err.details ?? '', metadata);
91
+ }
92
+ };
93
+ exports.ServiceError = ServiceError;
94
+ exports.ServiceError = ServiceError = ServiceError_1 = __decorate([
95
+ (0, type_helpers_1.SymbolBasedInstanceOfError)('ServiceError')
96
+ ], ServiceError);
97
+ /**
98
+ * Something unexpected happened, considered fatal
99
+ */
100
+ let NativePromiseDroppedError = class NativePromiseDroppedError extends UnexpectedError {
101
+ constructor(message) {
102
+ super(message);
103
+ }
104
+ };
105
+ exports.NativePromiseDroppedError = NativePromiseDroppedError;
106
+ exports.NativePromiseDroppedError = NativePromiseDroppedError = __decorate([
107
+ (0, type_helpers_1.SymbolBasedInstanceOfError)('NativePromiseDroppedError')
108
+ ], NativePromiseDroppedError);
109
+ // Check if the error's class is exactly Error (not a descendant of it), in a realm-safe way
110
+ function isBareError(e) {
111
+ return (0, type_helpers_1.isError)(e) && Object.getPrototypeOf(e)?.name === 'Error';
112
+ }
113
+ function convertFromNamedError(e, keepStackTrace) {
114
+ if (isBareError(e)) {
115
+ let newerr;
116
+ switch (e.name) {
117
+ case 'TransportError':
118
+ newerr = new TransportError(e.message);
119
+ newerr.stack = keepStackTrace ? e.stack : undefined;
120
+ return newerr;
121
+ case 'IllegalStateError':
122
+ newerr = new common_1.IllegalStateError(e.message);
123
+ newerr.stack = keepStackTrace ? e.stack : undefined;
124
+ return newerr;
125
+ case 'ShutdownError':
126
+ newerr = new ShutdownError(e.message);
127
+ newerr.stack = keepStackTrace ? e.stack : undefined;
128
+ return newerr;
129
+ case 'UnexpectedError':
130
+ newerr = new UnexpectedError(e.message, e);
131
+ newerr.stack = keepStackTrace ? e.stack : undefined;
132
+ return newerr;
133
+ case 'ServiceError':
134
+ newerr = ServiceError.fromNative(e);
135
+ newerr.stack = keepStackTrace ? e.stack : undefined;
136
+ return newerr;
137
+ }
138
+ // Neon ensures that dropping an unsettled Promise results in a rejection, which is
139
+ // much better than just hanging the JS process. Sad though that it does so with an
140
+ // error message that would mean nothing to a user.
141
+ if (e.message === '`neon::types::Deferred` was dropped without being settled') {
142
+ newerr = new NativePromiseDroppedError('Native Promise was dropped without being settled');
143
+ newerr.stack = keepStackTrace ? e.stack : undefined;
144
+ return newerr;
145
+ }
146
+ }
147
+ return e;
148
+ }
149
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,sDAwCC;AAvHD,oDAAsC;AACtC,+CAAuD;AAuE9C,kGAvEA,0BAAiB,OAuEA;AAtE1B,sEAA0F;AAE1F;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,KAAK;CAAG,CAAA;AAA9B,sCAAa;wBAAb,aAAa;IADzB,IAAA,yCAA0B,EAAC,eAAe,CAAC;GAC/B,aAAa,CAAiB;AAE3C;;;GAGG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,KAAK;CAAG,CAAA;AAA/B,wCAAc;yBAAd,cAAc;IAD1B,IAAA,yCAA0B,EAAC,gBAAgB,CAAC;GAChC,cAAc,CAAiB;AAE5C;;GAEG;AAEI,IAAM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C,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;gBACpD,OAAO,MAAM,CAAC;YAEhB,KAAK,cAAc;gBACjB,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,CAAuB,CAAC,CAAC;gBAC1D,MAAM,CAAC,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;gBACpD,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,mFAAmF;QACnF,mFAAmF;QACnF,mDAAmD;QACnD,IAAI,CAAC,CAAC,OAAO,KAAK,2DAA2D,EAAE,CAAC;YAC9E,MAAM,GAAG,IAAI,yBAAyB,CAAC,kDAAkD,CAAC,CAAC;YAC3F,MAAM,CAAC,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;YACpD,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,15 @@
1
+ import * as native from './native';
2
+ import * as errors from './errors';
3
+ export {
4
+ /**
5
+ * @internal This module is not intended to be used directly. Any API provided
6
+ * by this package is internal and subject to change without notice.
7
+ * @hidden
8
+ */
9
+ native,
10
+ /**
11
+ * @internal This module is not intended to be used directly. Any API provided
12
+ * by this package is internal and subject to change without notice.
13
+ * @hidden
14
+ */
15
+ errors, };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.errors = exports.native = void 0;
27
+ const native = __importStar(require("./native"));
28
+ exports.native = native;
29
+ const errors = __importStar(require("./errors"));
30
+ exports.errors = errors;
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AASjC,wBAAM;AARR,iDAAmC;AAejC,wBAAM"}
@@ -0,0 +1,372 @@
1
+ /**
2
+ * Indicates a property that is allowed to be unspecified when calling in or out of
3
+ * native code (the equivalent of the `Option<T>` type in Rust).
4
+ *
5
+ * Always use either this type or the `T | null` idiom to indicate a property that may
6
+ * legitimately be left unspecified when calling into or out of native code. Never use
7
+ * `T | undefined` or `prop?: T` on TS/Rust interfaces.
8
+ *
9
+ * ### Rationale
10
+ *
11
+ * Differentiating between "a property that is set to an unspecified optional value"
12
+ * and "a non-existant property" allows eager detection of some of the most common
13
+ * bug patterns resulting from incoherencies between the JS and Rust type definitions
14
+ * (e.g. optional properties whose names differ between the two languages, or that
15
+ * are missing in the JS interface, etc.).
16
+ *
17
+ * Unfortunately, it is not possible at present in Neon to differentiate between
18
+ * a property that is set to `undefined` and a property that is missing;
19
+ * i.e. `obj.get_value(cx, "prop")` will return `undefined` in both cases.
20
+ *
21
+ * We therefore follow the following principles for our TypeScript/Rust interfaces:
22
+ *
23
+ * - Always use `null` to indicate an intentionally unspecified optional value
24
+ * in TypeScript interfaces. This will be converted to `None` on the Rust side.
25
+ * - Explicitly set _every_ properties on objects sent to the native code,
26
+ * including optional properties (e.g. `{ prop: input.prop ?? null }`).
27
+ * - Never use the "optional property" syntax in TypeScript (i.e. `prop?: T`).
28
+ *
29
+ * Thanks to those conventions, a property that reads as `undefined` is known to to always
30
+ * indicate an _unintentionally missing_ property, which will results in a runtime error.
31
+ */
32
+ type Option<T> = T | null;
33
+ /**
34
+ * Marker for values that are transferred as JSON strings.
35
+ */
36
+ export type JsonString<_T> = string;
37
+ export declare function newRuntime(runtimeOptions: RuntimeOptions): Runtime;
38
+ export declare function runtimeShutdown(runtime: Runtime): void;
39
+ export interface Runtime {
40
+ type: 'runtime';
41
+ }
42
+ export type RuntimeOptions = {
43
+ logExporter: LogExporterOptions;
44
+ telemetry: TelemetryOptions;
45
+ metricsExporter: MetricExporterOptions;
46
+ workerHeartbeatIntervalMillis: Option<number>;
47
+ };
48
+ export type TelemetryOptions = {
49
+ attachServiceName: boolean;
50
+ metricPrefix: string;
51
+ };
52
+ export type LogExporterOptions = {
53
+ type: 'console';
54
+ filter: string;
55
+ } | {
56
+ type: 'forward';
57
+ filter: string;
58
+ receiver: (entries: JsonString<LogEntry>[]) => void;
59
+ };
60
+ export type MetricExporterOptions = PrometheusMetricsExporterOptions | OtelMetricsExporterOptions | BufferedMetricsExporterOptions | null;
61
+ export interface PrometheusMetricsExporterOptions {
62
+ type: 'prometheus';
63
+ socketAddr: string;
64
+ globalTags: Record<string, string>;
65
+ countersTotalSuffix: boolean;
66
+ unitSuffix: boolean;
67
+ useSecondsForDurations: boolean;
68
+ histogramBucketOverrides: Record<string, number[]>;
69
+ }
70
+ export interface OtelMetricsExporterOptions {
71
+ type: 'otel';
72
+ url: string;
73
+ headers: Record<string, string>;
74
+ metricPeriodicity: number;
75
+ metricTemporality: 'cumulative' | 'delta';
76
+ globalTags: Record<string, string>;
77
+ useSecondsForDurations: boolean;
78
+ histogramBucketOverrides: Record<string, number[]>;
79
+ protocol: 'http' | 'grpc';
80
+ }
81
+ export interface BufferedMetricsExporterOptions {
82
+ type: 'buffer';
83
+ maxBufferSize: number;
84
+ useSecondsForDurations: boolean;
85
+ }
86
+ export declare function newClient(runtime: Runtime, clientOptions: ClientOptions): Promise<Client>;
87
+ export declare function clientUpdateHeaders(client: Client, headers: Record<string, MetadataValue>): void;
88
+ export declare function clientUpdateApiKey(client: Client, apiKey: string): void;
89
+ export declare function clientSendWorkflowServiceRequest(client: Client, call: RpcCall): Promise<Buffer>;
90
+ export declare function clientSendOperatorServiceRequest(client: Client, call: RpcCall): Promise<Buffer>;
91
+ export declare function clientSendTestServiceRequest(client: Client, call: RpcCall): Promise<Buffer>;
92
+ export declare function clientSendHealthServiceRequest(client: Client, call: RpcCall): Promise<Buffer>;
93
+ export declare function clientClose(client: Client): void;
94
+ export interface Client {
95
+ type: 'client';
96
+ }
97
+ export interface ClientOptions {
98
+ targetUrl: string;
99
+ clientName: string;
100
+ clientVersion: string;
101
+ tls: Option<TlsOptions>;
102
+ httpConnectProxy: Option<HttpConnectProxy>;
103
+ headers: Option<Record<string, MetadataValue>>;
104
+ apiKey: Option<string>;
105
+ disableErrorCodeMetricTags: boolean;
106
+ }
107
+ export interface TlsOptions {
108
+ domain: Option<string>;
109
+ serverRootCaCert: Option<Buffer>;
110
+ clientTlsOptions: Option<TlsOptionsClientCertPair>;
111
+ }
112
+ export interface TlsOptionsClientCertPair {
113
+ clientCert: Buffer;
114
+ clientPrivateKey: Buffer;
115
+ }
116
+ export interface HttpConnectProxy {
117
+ targetHost: string;
118
+ basicAuth: Option<{
119
+ username: string;
120
+ password: string;
121
+ }>;
122
+ }
123
+ export interface HttpConnectProxyBasicAuth {
124
+ username: string;
125
+ password: string;
126
+ }
127
+ export interface RpcCall {
128
+ rpc: string;
129
+ req: Buffer;
130
+ retry: boolean;
131
+ metadata: Record<string, MetadataValue>;
132
+ timeout: Option<number>;
133
+ }
134
+ export declare function newWorker(client: Client, workerOptions: WorkerOptions): Worker;
135
+ export declare function workerValidate(worker: Worker): Promise<Buffer>;
136
+ export declare function workerPollWorkflowActivation(worker: Worker): Promise<Buffer>;
137
+ export declare function workerCompleteWorkflowActivation(worker: Worker, result: Buffer): Promise<void>;
138
+ export declare function workerPollActivityTask(worker: Worker): Promise<Buffer>;
139
+ export declare function workerCompleteActivityTask(worker: Worker, result: Buffer): Promise<void>;
140
+ export declare function workerRecordActivityHeartbeat(worker: Worker, heartbeat: Buffer): void;
141
+ export declare function workerPollNexusTask(worker: Worker): Promise<Buffer>;
142
+ export declare function workerCompleteNexusTask(worker: Worker, result: Buffer): Promise<void>;
143
+ export declare function workerInitiateShutdown(worker: Worker): void;
144
+ export declare function workerFinalizeShutdown(worker: Worker): Promise<void>;
145
+ export declare function workerReplaceClient(worker: Worker, client: Client): void;
146
+ export interface Worker {
147
+ type: 'worker';
148
+ }
149
+ export type MetadataValue = {
150
+ type: 'ascii';
151
+ value: string;
152
+ } | {
153
+ type: 'binary';
154
+ value: Buffer;
155
+ };
156
+ export interface WorkerOptions {
157
+ identity: string;
158
+ buildId: string;
159
+ useVersioning: boolean;
160
+ workerDeploymentOptions: Option<WorkerDeploymentOptions>;
161
+ taskQueue: string;
162
+ namespace: string;
163
+ tuner: WorkerTunerOptions;
164
+ nonStickyToStickyPollRatio: number;
165
+ workflowTaskPollerBehavior: PollerBehavior;
166
+ activityTaskPollerBehavior: PollerBehavior;
167
+ nexusTaskPollerBehavior: PollerBehavior;
168
+ taskTypes: {
169
+ enableWorkflows: boolean;
170
+ enableLocalActivities: boolean;
171
+ enableRemoteActivities: boolean;
172
+ enableNexus: boolean;
173
+ };
174
+ stickyQueueScheduleToStartTimeout: number;
175
+ maxCachedWorkflows: number;
176
+ maxHeartbeatThrottleInterval: number;
177
+ defaultHeartbeatThrottleInterval: number;
178
+ maxTaskQueueActivitiesPerSecond: Option<number>;
179
+ maxActivitiesPerSecond: Option<number>;
180
+ shutdownGraceTime: number;
181
+ plugins: string[];
182
+ }
183
+ export type PollerBehavior = {
184
+ type: 'simple-maximum';
185
+ maximum: number;
186
+ } | {
187
+ type: 'autoscaling';
188
+ minimum: number;
189
+ maximum: number;
190
+ initial: number;
191
+ };
192
+ export type WorkerDeploymentOptions = {
193
+ version: WorkerDeploymentVersion;
194
+ useWorkerVersioning: boolean;
195
+ defaultVersioningBehavior: Option<VersioningBehavior>;
196
+ };
197
+ export type WorkerDeploymentVersion = {
198
+ buildId: string;
199
+ deploymentName: string;
200
+ };
201
+ export type VersioningBehavior = {
202
+ type: 'pinned';
203
+ } | {
204
+ type: 'auto-upgrade';
205
+ };
206
+ export interface WorkerTunerOptions {
207
+ workflowTaskSlotSupplier: SlotSupplierOptions;
208
+ activityTaskSlotSupplier: SlotSupplierOptions;
209
+ localActivityTaskSlotSupplier: SlotSupplierOptions;
210
+ nexusTaskSlotSupplier: SlotSupplierOptions;
211
+ }
212
+ export type SlotSupplierOptions = FixedSizeSlotSupplierOptions | ResourceBasedSlotSupplierOptions | CustomSlotSupplierOptions<any>;
213
+ interface FixedSizeSlotSupplierOptions {
214
+ type: 'fixed-size';
215
+ numSlots: number;
216
+ }
217
+ interface ResourceBasedSlotSupplierOptions {
218
+ type: 'resource-based';
219
+ minimumSlots: number;
220
+ maximumSlots: number;
221
+ rampThrottle: number;
222
+ tunerOptions: ResourceBasedTunerOptions;
223
+ }
224
+ interface ResourceBasedTunerOptions {
225
+ targetMemoryUsage: number;
226
+ targetCpuUsage: number;
227
+ }
228
+ export interface CustomSlotSupplierOptions<SI extends SlotInfo> {
229
+ type: 'custom';
230
+ reserveSlot(ctx: SlotReserveContext, abortSignal: AbortSignal): Promise<SlotPermit>;
231
+ tryReserveSlot(ctx: SlotReserveContext): Option<SlotPermit>;
232
+ markSlotUsed(ctx: SlotMarkUsedContext<SI>): void;
233
+ releaseSlot(ctx: SlotReleaseContext<SI>): void;
234
+ }
235
+ export type SlotInfo = {
236
+ type: 'workflow';
237
+ workflowType: string;
238
+ isSticky: boolean;
239
+ } | {
240
+ type: 'activity';
241
+ activityType: string;
242
+ } | {
243
+ type: 'local-activity';
244
+ activityType: string;
245
+ } | {
246
+ type: 'nexus';
247
+ service: string;
248
+ operation: string;
249
+ };
250
+ export interface SlotReserveContext {
251
+ slotType: SlotInfo['type'];
252
+ taskQueue: string;
253
+ workerIdentity: string;
254
+ workerDeploymentVersion: Option<WorkerDeploymentVersion>;
255
+ isSticky: boolean;
256
+ }
257
+ export interface SlotMarkUsedContext<SI extends SlotInfo> {
258
+ slotInfo: SI;
259
+ permit: SlotPermit;
260
+ }
261
+ export interface SlotReleaseContext<SI extends SlotInfo> {
262
+ slotInfo: Option<SI>;
263
+ permit: SlotPermit;
264
+ }
265
+ export interface SlotPermit {
266
+ }
267
+ export declare function newReplayWorker(runtime: Runtime, workerOptions: WorkerOptions): [Worker, HistoryPusher];
268
+ export declare function pushHistory(pusher: HistoryPusher, workflowId: string, history: Buffer): Promise<void>;
269
+ export declare function closeHistoryStream(pusher: HistoryPusher): void;
270
+ export interface HistoryPusher {
271
+ type: 'history-pusher';
272
+ }
273
+ export declare function newEphemeralServer(runtime: Runtime, config: EphemeralServerConfig): Promise<EphemeralServer>;
274
+ export declare function ephemeralServerGetTarget(server: EphemeralServer): string;
275
+ export declare function ephemeralServerShutdown(server: EphemeralServer): Promise<void>;
276
+ export interface EphemeralServer {
277
+ type: 'ephemeral-server';
278
+ }
279
+ export type EphemeralServerConfig = TimeSkippingServerConfig | DevServerConfig;
280
+ export interface TimeSkippingServerConfig {
281
+ type: 'time-skipping';
282
+ exe: EphemeralServerExecutableConfig;
283
+ port: Option<number>;
284
+ extraArgs: string[];
285
+ }
286
+ export interface DevServerConfig {
287
+ type: 'dev-server';
288
+ exe: EphemeralServerExecutableConfig;
289
+ namespace: string;
290
+ ip: string;
291
+ port: Option<number>;
292
+ uiPort: Option<number>;
293
+ dbFilename: Option<string>;
294
+ ui: boolean;
295
+ log: DevServerLogConfig;
296
+ extraArgs: string[];
297
+ }
298
+ export interface DevServerLogConfig {
299
+ format: string;
300
+ level: string;
301
+ }
302
+ export type EphemeralServerExecutableConfig = CachedDownloadConfig | ExistingPathConfig;
303
+ export interface CachedDownloadConfig {
304
+ type: 'cached-download';
305
+ downloadDir: Option<string>;
306
+ version: string;
307
+ ttl: number;
308
+ sdkName: string;
309
+ sdkVersion: string;
310
+ }
311
+ export interface ExistingPathConfig {
312
+ type: 'existing-path';
313
+ path: string;
314
+ }
315
+ export declare function getTimeOfDay(): bigint;
316
+ export interface LogEntry {
317
+ target: string;
318
+ message: string;
319
+ timestamp: string;
320
+ level: LogLevel;
321
+ fields: LogEntryMetadata;
322
+ spanContexts: string[];
323
+ }
324
+ type LogLevel = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
325
+ type LogEntryMetadata = {
326
+ [key: string]: string | number | boolean | LogEntryMetadata;
327
+ };
328
+ export interface MetricMeter {
329
+ type: 'metric-meter';
330
+ }
331
+ export interface MetricCounter {
332
+ type: 'metric-counter';
333
+ }
334
+ export interface MetricHistogram {
335
+ type: 'metric-histogram';
336
+ }
337
+ export interface MetricHistogramF64 {
338
+ type: 'metric-histogram-f64';
339
+ }
340
+ export interface MetricGauge {
341
+ type: 'metric-gauge';
342
+ }
343
+ export interface MetricGaugeF64 {
344
+ type: 'metric-gauge-f64';
345
+ }
346
+ export type MetricAttributes = Record<string, string | number | boolean>;
347
+ export declare function newMetricCounter(runtime: Runtime, name: string, unit: string, description: string): MetricCounter;
348
+ export declare function newMetricHistogram(runtime: Runtime, name: string, unit: string, description: string): MetricHistogram;
349
+ export declare function newMetricHistogramF64(runtime: Runtime, name: string, unit: string, description: string): MetricHistogramF64;
350
+ export declare function newMetricGauge(runtime: Runtime, name: string, unit: string, description: string): MetricGauge;
351
+ export declare function newMetricGaugeF64(runtime: Runtime, name: string, unit: string, description: string): MetricGaugeF64;
352
+ export declare function addMetricCounterValue(counter: MetricCounter, value: number, attrs: JsonString<MetricAttributes>): void;
353
+ export declare function recordMetricHistogramValue(histogram: MetricHistogram, value: number, attrs: JsonString<MetricAttributes>): void;
354
+ export declare function recordMetricHistogramF64Value(histogram: MetricHistogramF64, value: number, attrs: JsonString<MetricAttributes>): void;
355
+ export declare function setMetricGaugeValue(gauge: MetricGauge, value: number, attrs: JsonString<MetricAttributes>): void;
356
+ export declare function setMetricGaugeF64Value(gauge: MetricGaugeF64, value: number, attrs: JsonString<MetricAttributes>): void;
357
+ export declare function runtimeRetrieveBufferedMetrics(runtime: Runtime): BufferedMetricUpdate[];
358
+ export interface BufferedMetricUpdate {
359
+ metric: BufferedMetric;
360
+ value: number;
361
+ attributes: MetricAttributes;
362
+ }
363
+ export interface BufferedMetric {
364
+ name: string;
365
+ description: string;
366
+ unit: string;
367
+ kind: BufferedMetricKind;
368
+ valueType: BufferedMetricValueType;
369
+ }
370
+ export type BufferedMetricKind = 'counter' | 'histogram' | 'gauge';
371
+ export type BufferedMetricValueType = 'int' | 'float';
372
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.js","sourceRoot":"","sources":["../ts/native.ts"],"names":[],"mappings":""}
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@temporalio/core-bridge",
3
+ "version": "1.16.2",
4
+ "description": "Temporal.io SDK Core<>Node bridge",
5
+ "main": "index.js",
6
+ "types": "lib/index.d.ts",
7
+ "keywords": [
8
+ "temporal",
9
+ "workflow",
10
+ "core",
11
+ "worker"
12
+ ],
13
+ "author": "Temporal Technologies Inc. <sdk@temporal.io>",
14
+ "license": "MIT",
15
+ "dependencies": {
16
+ "@grpc/grpc-js": "^1.12.4",
17
+ "@temporalio/common": "1.16.2"
18
+ },
19
+ "devDependencies": {
20
+ "arg": "^5.0.2",
21
+ "cargo-cp-artifact": "^0.1.9",
22
+ "tsx": "^4.20.6"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/temporalio/sdk-typescript/issues"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/temporalio/sdk-typescript.git",
30
+ "directory": "packages/core-bridge"
31
+ },
32
+ "homepage": "https://github.com/temporalio/sdk-typescript/tree/main/packages/core-bridge",
33
+ "engines": {
34
+ "node": ">= 20.0.0"
35
+ },
36
+ "files": [
37
+ "bridge-macros",
38
+ "scripts",
39
+ "src",
40
+ "releases",
41
+ "sdk-core",
42
+ "Cargo.toml",
43
+ "Cargo.lock",
44
+ "index.js",
45
+ "common.js",
46
+ "index.d.ts",
47
+ "ts",
48
+ "lib"
49
+ ],
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "scripts": {
54
+ "build-rust": "tsx ./scripts/build.ts --force",
55
+ "build": "pnpm run build-rust",
56
+ "build-rust-release": "pnpm run build-rust --release",
57
+ "format": "cargo fmt",
58
+ "lint": "cargo clippy --fix --allow-staged",
59
+ "lint:check": "cargo clippy"
60
+ }
61
+ }
package/index.cjs ADDED
@@ -0,0 +1,4 @@
1
+ // Re-exports the vendored @temporalio/core-bridge (MIT), pruned to the
2
+ // aarch64-apple-darwin prebuilt release. Loaded via @stigmer/runner-slim's
3
+ // core-bridge shim — never import this package directly.
4
+ module.exports = require("./core-bridge/index.js");
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@stigmer/runner-slim-darwin-arm64",
3
+ "version": "3.0.8-dev.20260612062921",
4
+ "description": "Temporal native bridge for the slim Stigmer runner (darwin-arm64)",
5
+ "license": "MIT",
6
+ "main": "index.cjs",
7
+ "os": [
8
+ "darwin"
9
+ ],
10
+ "cpu": [
11
+ "arm64"
12
+ ],
13
+ "dependencies": {
14
+ "@temporalio/common": "1.16.2",
15
+ "@grpc/grpc-js": "^1.12.4"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/stigmer/stigmer.git",
20
+ "directory": "backend/services/runner"
21
+ }
22
+ }