@tasker-systems/tasker 0.1.3 → 0.1.5
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 +47 -86
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.js +374 -295
- package/dist/events/index.js.map +1 -1
- package/dist/ffi/index.d.ts +323 -242
- package/dist/ffi/index.js +66 -1896
- package/dist/ffi/index.js.map +1 -1
- package/dist/{index-CTl8lGpU.d.ts → index-Bvdub2HH.d.ts} +77 -36
- package/dist/index.d.ts +75 -141
- package/dist/index.js +622 -2491
- package/dist/index.js.map +1 -1
- package/package.json +14 -7
- package/{native/libtasker_ts-darwin-arm64.dylib → tasker_ts.darwin-arm64.node} +0 -0
- package/{native/libtasker_ts-linux-x64.so → tasker_ts.linux-x64-gnu.node} +0 -0
- package/dist/koffi-3HFAASOB.node +0 -0
- package/dist/koffi-AHHUCM3C.node +0 -0
- package/dist/koffi-AVDVVSXH.node +0 -0
- package/dist/koffi-BMO5K7B3.node +0 -0
- package/dist/koffi-G4D35B2D.node +0 -0
- package/dist/koffi-GG4SDSYA.node +0 -0
- package/dist/koffi-GOENU54R.node +0 -0
- package/dist/koffi-IDX6JEDH.node +0 -0
- package/dist/koffi-KFZAXWPQ.node +0 -0
- package/dist/koffi-LOH6WKRQ.node +0 -0
- package/dist/koffi-LUY2JHJP.node +0 -0
- package/dist/koffi-OMHWL3D6.node +0 -0
- package/dist/koffi-QKY2KSXW.node +0 -0
- package/dist/koffi-ROB3FRHA.node +0 -0
- package/dist/koffi-SE4ZI36U.node +0 -0
- package/dist/koffi-X3YT67KE.node +0 -0
- package/dist/koffi-X7JMBSZH.node +0 -0
- package/dist/koffi-YNQDUF3Q.node +0 -0
- package/dist/runtime-interface-D940vUzy.d.ts +0 -694
package/dist/ffi/index.d.ts
CHANGED
|
@@ -1,308 +1,389 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/** Configuration for bootstrapping the worker. */
|
|
4
|
+
interface BootstrapConfig {
|
|
5
|
+
namespace?: string
|
|
6
|
+
configPath?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Result of bootstrapping the worker. */
|
|
10
|
+
interface BootstrapResult {
|
|
11
|
+
success: boolean
|
|
12
|
+
status: string
|
|
13
|
+
message: string
|
|
14
|
+
workerId?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Checkpoint yield data for batch processing (TAS-125). */
|
|
18
|
+
interface NapiCheckpointYieldData {
|
|
19
|
+
stepUuid: string
|
|
20
|
+
cursor: any
|
|
21
|
+
itemsProcessed: number
|
|
22
|
+
accumulatedResults?: any
|
|
23
|
+
}
|
|
3
24
|
|
|
4
25
|
/**
|
|
5
|
-
*
|
|
26
|
+
* Client operation result.
|
|
6
27
|
*
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Supported JavaScript/TypeScript runtimes
|
|
28
|
+
* Maintains the existing TypeScript API surface with success/data/error envelope.
|
|
11
29
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
interface NapiClientResult {
|
|
31
|
+
success: boolean
|
|
32
|
+
data?: any
|
|
33
|
+
error?: string
|
|
34
|
+
recoverable?: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface NapiDependencyResult {
|
|
38
|
+
stepUuid: string
|
|
39
|
+
success: boolean
|
|
40
|
+
result: any
|
|
41
|
+
status: string
|
|
42
|
+
errorMessage?: string
|
|
43
|
+
errorType?: string
|
|
44
|
+
errorRetryable?: boolean
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** FFI dispatch metrics. */
|
|
48
|
+
interface NapiDispatchMetrics {
|
|
49
|
+
pendingCount: number
|
|
50
|
+
starvationDetected: boolean
|
|
51
|
+
starvingEventCount: number
|
|
52
|
+
oldestPendingAgeMs?: number
|
|
53
|
+
newestPendingAgeMs?: number
|
|
54
|
+
oldestEventId?: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Domain event from in-process event bus (fast path). */
|
|
58
|
+
interface NapiDomainEvent {
|
|
59
|
+
eventId: string
|
|
60
|
+
eventName: string
|
|
61
|
+
eventVersion: string
|
|
62
|
+
metadata: NapiDomainEventMetadata
|
|
63
|
+
payload: any
|
|
21
64
|
}
|
|
65
|
+
|
|
66
|
+
/** Metadata attached to domain events. */
|
|
67
|
+
interface NapiDomainEventMetadata {
|
|
68
|
+
taskUuid: string
|
|
69
|
+
stepUuid?: string
|
|
70
|
+
stepName?: string
|
|
71
|
+
namespace: string
|
|
72
|
+
correlationId: string
|
|
73
|
+
firedAt: string
|
|
74
|
+
firedBy?: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Parameters for listing tasks. */
|
|
78
|
+
interface NapiListTasksParams {
|
|
79
|
+
limit?: number
|
|
80
|
+
offset?: number
|
|
81
|
+
namespace?: string
|
|
82
|
+
status?: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface NapiStepDefinition {
|
|
86
|
+
name: string
|
|
87
|
+
description?: string
|
|
88
|
+
handlerCallable: string
|
|
89
|
+
handlerMethod?: string
|
|
90
|
+
handlerResolver?: string
|
|
91
|
+
handlerInitialization: any
|
|
92
|
+
systemDependency?: string
|
|
93
|
+
dependencies: Array<string>
|
|
94
|
+
timeoutSeconds?: number
|
|
95
|
+
retryRetryable: boolean
|
|
96
|
+
retryMaxAttempts: number
|
|
97
|
+
retryBackoff: string
|
|
98
|
+
retryBackoffBaseMs?: number
|
|
99
|
+
retryMaxBackoffMs?: number
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** A step event dispatched to the TypeScript handler. */
|
|
103
|
+
interface NapiStepEvent {
|
|
104
|
+
eventId: string
|
|
105
|
+
taskUuid: string
|
|
106
|
+
stepUuid: string
|
|
107
|
+
correlationId: string
|
|
108
|
+
traceId?: string
|
|
109
|
+
spanId?: string
|
|
110
|
+
taskCorrelationId: string
|
|
111
|
+
parentCorrelationId?: string
|
|
112
|
+
task: NapiTaskInfo
|
|
113
|
+
workflowStep: NapiWorkflowStep
|
|
114
|
+
stepDefinition: NapiStepDefinition
|
|
115
|
+
dependencyResults: Record<string, NapiDependencyResult>
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface NapiTaskInfo {
|
|
119
|
+
taskUuid: string
|
|
120
|
+
namedTaskUuid: string
|
|
121
|
+
name: string
|
|
122
|
+
namespace: string
|
|
123
|
+
version: string
|
|
124
|
+
context?: any
|
|
125
|
+
correlationId: string
|
|
126
|
+
parentCorrelationId?: string
|
|
127
|
+
complete: boolean
|
|
128
|
+
priority: number
|
|
129
|
+
initiator?: string
|
|
130
|
+
sourceSystem?: string
|
|
131
|
+
reason?: string
|
|
132
|
+
tags?: any
|
|
133
|
+
identityHash: string
|
|
134
|
+
createdAt: string
|
|
135
|
+
updatedAt: string
|
|
136
|
+
requestedAt: string
|
|
137
|
+
}
|
|
138
|
+
|
|
22
139
|
/**
|
|
23
|
-
*
|
|
140
|
+
* Task creation request — crosses FFI as native JS object.
|
|
24
141
|
*
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Check if running in Bun
|
|
30
|
-
*/
|
|
31
|
-
declare function isBun(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Check if running in Node.js
|
|
142
|
+
* In koffi, this was serialized to JSON and parsed with
|
|
143
|
+
* `serde_json::Deserializer::from_str` to tolerate trailing bytes.
|
|
144
|
+
* In napi-rs, no serialization needed. No trailing bytes. No TAS-283.
|
|
34
145
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
146
|
+
interface NapiTaskRequest {
|
|
147
|
+
name: string
|
|
148
|
+
namespace: string
|
|
149
|
+
version: string
|
|
150
|
+
/** Native JS object — napi-rs handles this via serde-json feature */
|
|
151
|
+
context: any
|
|
152
|
+
initiator: string
|
|
153
|
+
sourceSystem: string
|
|
154
|
+
reason: string
|
|
155
|
+
tags?: Array<string>
|
|
156
|
+
priority?: number
|
|
157
|
+
correlationId?: string
|
|
158
|
+
parentCorrelationId?: string
|
|
159
|
+
idempotencyKey?: string
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
interface NapiWorkflowStep {
|
|
163
|
+
workflowStepUuid: string
|
|
164
|
+
taskUuid: string
|
|
165
|
+
namedStepUuid: string
|
|
166
|
+
name: string
|
|
167
|
+
templateStepName: string
|
|
168
|
+
retryable: boolean
|
|
169
|
+
maxAttempts: number
|
|
170
|
+
attempts: number
|
|
171
|
+
inProcess: boolean
|
|
172
|
+
processed: boolean
|
|
173
|
+
inputs?: any
|
|
174
|
+
results?: any
|
|
175
|
+
backoffRequestSeconds?: number
|
|
176
|
+
processedAt?: string
|
|
177
|
+
lastAttemptedAt?: string
|
|
178
|
+
createdAt: string
|
|
179
|
+
updatedAt: string
|
|
180
|
+
checkpoint?: any
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** Worker status information. */
|
|
184
|
+
interface WorkerStatus {
|
|
185
|
+
success: boolean
|
|
186
|
+
running: boolean
|
|
187
|
+
workerId?: string
|
|
188
|
+
status?: string
|
|
189
|
+
environment?: string
|
|
190
|
+
}
|
|
191
|
+
|
|
40
192
|
/**
|
|
41
|
-
*
|
|
193
|
+
* Step execution result sent back to Rust from TypeScript handlers.
|
|
194
|
+
*
|
|
195
|
+
* Mirrors: bridge.rs `NapiStepExecutionResult` with `#[napi(object)]`.
|
|
196
|
+
* Uses `| null` instead of `?:` because we explicitly construct these.
|
|
42
197
|
*/
|
|
43
|
-
|
|
198
|
+
interface NapiStepExecutionResult {
|
|
199
|
+
stepUuid: string;
|
|
200
|
+
success: boolean;
|
|
201
|
+
result: unknown;
|
|
202
|
+
status: 'completed' | 'failed' | 'error';
|
|
203
|
+
metadata: NapiStepExecutionMetadata;
|
|
204
|
+
error?: NapiStepExecutionError;
|
|
205
|
+
orchestrationMetadata?: NapiOrchestrationMetadata;
|
|
206
|
+
}
|
|
207
|
+
interface NapiStepExecutionMetadata {
|
|
208
|
+
executionTimeMs: number;
|
|
209
|
+
workerId?: string;
|
|
210
|
+
completedAt: string;
|
|
211
|
+
retryable?: boolean;
|
|
212
|
+
errorType?: string;
|
|
213
|
+
errorCode?: string;
|
|
214
|
+
custom?: Record<string, unknown>;
|
|
215
|
+
}
|
|
216
|
+
interface NapiStepExecutionError {
|
|
217
|
+
message: string;
|
|
218
|
+
errorType?: string;
|
|
219
|
+
retryable?: boolean;
|
|
220
|
+
statusCode?: number;
|
|
221
|
+
backtrace?: string[];
|
|
222
|
+
context?: Record<string, unknown>;
|
|
223
|
+
}
|
|
44
224
|
/**
|
|
45
|
-
*
|
|
225
|
+
* Orchestration metadata for workflow coordination hints.
|
|
46
226
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
227
|
+
* Handlers can return this to influence orchestration decisions — e.g.,
|
|
228
|
+
* passing Retry-After headers from external APIs, requesting explicit
|
|
229
|
+
* backoff, or providing domain-specific routing hints.
|
|
49
230
|
*
|
|
50
|
-
*
|
|
51
|
-
|
|
231
|
+
* Matches: tasker_shared::messaging::message::OrchestrationMetadata
|
|
232
|
+
*/
|
|
233
|
+
interface NapiOrchestrationMetadata {
|
|
234
|
+
headers?: Record<string, string>;
|
|
235
|
+
errorContext?: string | null;
|
|
236
|
+
backoffHint?: NapiBackoffHint | null;
|
|
237
|
+
custom?: Record<string, unknown>;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Backoff hint from handler to orchestration system.
|
|
52
241
|
*
|
|
53
|
-
*
|
|
54
|
-
* @returns Path to the native library
|
|
55
|
-
* @throws Error if TASKER_FFI_LIBRARY_PATH is not set and no basePath provided
|
|
242
|
+
* Matches: tasker_shared::messaging::message::BackoffHint
|
|
56
243
|
*/
|
|
57
|
-
|
|
244
|
+
interface NapiBackoffHint {
|
|
245
|
+
backoffType: string;
|
|
246
|
+
delaySeconds: number;
|
|
247
|
+
context?: string | null;
|
|
248
|
+
}
|
|
249
|
+
/** @deprecated Use NapiStepEvent directly */
|
|
250
|
+
type FfiStepEvent = NapiStepEvent;
|
|
251
|
+
/** @deprecated Use NapiDispatchMetrics directly */
|
|
252
|
+
type FfiDispatchMetrics = NapiDispatchMetrics;
|
|
253
|
+
/** @deprecated Use NapiDomainEvent directly */
|
|
254
|
+
type FfiDomainEvent = NapiDomainEvent;
|
|
255
|
+
/** @deprecated Use NapiDomainEventMetadata directly */
|
|
256
|
+
type FfiDomainEventMetadata = NapiDomainEventMetadata;
|
|
257
|
+
/** @deprecated Use NapiStepExecutionResult directly */
|
|
258
|
+
type StepExecutionResult = NapiStepExecutionResult;
|
|
259
|
+
/** Log fields for structured logging */
|
|
260
|
+
interface LogFields {
|
|
261
|
+
[key: string]: string | number | boolean | null;
|
|
262
|
+
}
|
|
263
|
+
/** Checkpoint yield data alias */
|
|
264
|
+
type CheckpointYieldData = NapiCheckpointYieldData;
|
|
265
|
+
/** Stop result alias */
|
|
266
|
+
type StopResult = WorkerStatus;
|
|
58
267
|
|
|
59
268
|
/**
|
|
60
|
-
* FfiLayer - Owns
|
|
269
|
+
* FfiLayer - Owns napi-rs module loading and lifecycle.
|
|
61
270
|
*
|
|
62
|
-
*
|
|
63
|
-
* -
|
|
64
|
-
*
|
|
65
|
-
* - Runtime loading and unloading
|
|
271
|
+
* TAS-290: Simplified from the multi-runtime koffi approach.
|
|
272
|
+
* The napi-rs `.node` file IS the runtime — no runtime detection,
|
|
273
|
+
* no NodeRuntime/DenoRuntime adapters, no JSON serialization.
|
|
66
274
|
*
|
|
67
275
|
* Design principles:
|
|
68
276
|
* - Explicit construction: No singleton pattern
|
|
69
|
-
* - Clear ownership: Owns the
|
|
277
|
+
* - Clear ownership: Owns the napi module instance
|
|
70
278
|
* - Explicit lifecycle: load() and unload() methods
|
|
71
279
|
*/
|
|
72
280
|
|
|
281
|
+
/**
|
|
282
|
+
* Interface for the napi-rs native module.
|
|
283
|
+
*
|
|
284
|
+
* These are the functions exported by the Rust `#[napi]` bindings.
|
|
285
|
+
* Function names are auto-camelCased by napi-rs from Rust snake_case.
|
|
286
|
+
*/
|
|
287
|
+
interface NapiModule {
|
|
288
|
+
getVersion(): string;
|
|
289
|
+
getRustVersion(): string;
|
|
290
|
+
healthCheck(): boolean;
|
|
291
|
+
bootstrapWorker(config: BootstrapConfig): BootstrapResult;
|
|
292
|
+
isWorkerRunning(): boolean;
|
|
293
|
+
getWorkerStatus(): WorkerStatus;
|
|
294
|
+
stopWorker(): WorkerStatus;
|
|
295
|
+
transitionToGracefulShutdown(): WorkerStatus;
|
|
296
|
+
pollStepEvents(): NapiStepEvent | null;
|
|
297
|
+
completeStepEvent(eventId: string, result: NapiStepExecutionResult): boolean;
|
|
298
|
+
pollInProcessEvents(): NapiDomainEvent | null;
|
|
299
|
+
checkpointYieldStepEvent(eventId: string, checkpoint: NapiCheckpointYieldData): boolean;
|
|
300
|
+
getFfiDispatchMetrics(): NapiDispatchMetrics;
|
|
301
|
+
checkStarvationWarnings(): void;
|
|
302
|
+
cleanupTimeouts(): void;
|
|
303
|
+
clientCreateTask(request: NapiTaskRequest): NapiClientResult;
|
|
304
|
+
clientGetTask(taskUuid: string): NapiClientResult;
|
|
305
|
+
clientListTasks(params: NapiListTasksParams): NapiClientResult;
|
|
306
|
+
clientCancelTask(taskUuid: string): NapiClientResult;
|
|
307
|
+
clientListTaskSteps(taskUuid: string): NapiClientResult;
|
|
308
|
+
clientGetStep(taskUuid: string, stepUuid: string): NapiClientResult;
|
|
309
|
+
clientGetStepAuditHistory(taskUuid: string, stepUuid: string): NapiClientResult;
|
|
310
|
+
clientHealthCheck(): NapiClientResult;
|
|
311
|
+
logError(message: string, fields?: Record<string, unknown>): void;
|
|
312
|
+
logWarn(message: string, fields?: Record<string, unknown>): void;
|
|
313
|
+
logInfo(message: string, fields?: Record<string, unknown>): void;
|
|
314
|
+
logDebug(message: string, fields?: Record<string, unknown>): void;
|
|
315
|
+
logTrace(message: string, fields?: Record<string, unknown>): void;
|
|
316
|
+
}
|
|
73
317
|
/**
|
|
74
318
|
* Configuration for FfiLayer.
|
|
75
319
|
*/
|
|
76
320
|
interface FfiLayerConfig {
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
/** Custom library path (overrides discovery) */
|
|
80
|
-
libraryPath?: string;
|
|
321
|
+
/** Custom module path (overrides discovery) */
|
|
322
|
+
modulePath?: string;
|
|
81
323
|
}
|
|
82
324
|
/**
|
|
83
|
-
* Owns
|
|
84
|
-
*
|
|
85
|
-
* Unlike RuntimeFactory, this class:
|
|
86
|
-
* - Is NOT a singleton - created and passed explicitly
|
|
87
|
-
* - Owns the runtime instance directly
|
|
88
|
-
* - Has clear load/unload lifecycle
|
|
325
|
+
* Owns napi-rs module loading and lifecycle.
|
|
89
326
|
*
|
|
90
327
|
* @example
|
|
91
328
|
* ```typescript
|
|
92
329
|
* const ffiLayer = new FfiLayer();
|
|
93
330
|
* await ffiLayer.load();
|
|
94
|
-
* const
|
|
95
|
-
*
|
|
331
|
+
* const module = ffiLayer.getModule();
|
|
332
|
+
* const result = module.bootstrapWorker({ namespace: 'default' });
|
|
96
333
|
* await ffiLayer.unload();
|
|
97
334
|
* ```
|
|
98
335
|
*/
|
|
99
336
|
declare class FfiLayer {
|
|
100
|
-
private
|
|
101
|
-
private
|
|
102
|
-
private readonly
|
|
103
|
-
private readonly configuredLibraryPath;
|
|
104
|
-
/**
|
|
105
|
-
* Create a new FfiLayer.
|
|
106
|
-
*
|
|
107
|
-
* @param config - Optional configuration for runtime type and library path
|
|
108
|
-
*/
|
|
337
|
+
private module;
|
|
338
|
+
private modulePath;
|
|
339
|
+
private readonly configuredModulePath;
|
|
109
340
|
constructor(config?: FfiLayerConfig);
|
|
110
341
|
/**
|
|
111
|
-
* Load the
|
|
112
|
-
*
|
|
113
|
-
* Discovers and loads the native library for the current runtime.
|
|
342
|
+
* Load the napi-rs native module.
|
|
114
343
|
*
|
|
115
|
-
* @param customPath - Optional override for
|
|
116
|
-
* @throws Error if
|
|
344
|
+
* @param customPath - Optional override for module path
|
|
345
|
+
* @throws Error if module not found or failed to load
|
|
117
346
|
*/
|
|
118
347
|
load(customPath?: string): Promise<void>;
|
|
119
348
|
/**
|
|
120
|
-
* Unload the
|
|
121
|
-
*
|
|
122
|
-
* Safe to call even if not loaded.
|
|
349
|
+
* Unload the native module and release resources.
|
|
123
350
|
*/
|
|
124
351
|
unload(): Promise<void>;
|
|
125
352
|
/**
|
|
126
|
-
* Check if the
|
|
353
|
+
* Check if the native module is loaded.
|
|
127
354
|
*/
|
|
128
355
|
isLoaded(): boolean;
|
|
129
356
|
/**
|
|
130
|
-
* Get the loaded
|
|
357
|
+
* Get the loaded napi-rs module.
|
|
131
358
|
*
|
|
132
|
-
* @throws Error if
|
|
133
|
-
*/
|
|
134
|
-
getRuntime(): TaskerRuntime;
|
|
135
|
-
/**
|
|
136
|
-
* Get the path to the loaded library.
|
|
359
|
+
* @throws Error if module is not loaded
|
|
137
360
|
*/
|
|
138
|
-
|
|
361
|
+
getModule(): NapiModule;
|
|
139
362
|
/**
|
|
140
|
-
*
|
|
141
|
-
*/
|
|
142
|
-
getRuntimeType(): RuntimeType;
|
|
143
|
-
/**
|
|
144
|
-
* Find the FFI library path.
|
|
145
|
-
*
|
|
146
|
-
* Static method for finding the library path without creating an instance.
|
|
147
|
-
* Useful for test utilities and pre-flight checks.
|
|
148
|
-
*
|
|
149
|
-
* Resolution order:
|
|
150
|
-
* 1. TASKER_FFI_LIBRARY_PATH environment variable (explicit override)
|
|
151
|
-
* 2. Bundled native library in the package's native/ directory
|
|
363
|
+
* Backward-compatible alias for getModule().
|
|
152
364
|
*
|
|
153
|
-
* @
|
|
154
|
-
* @returns Path to the library if found and exists, null otherwise
|
|
365
|
+
* @deprecated Use getModule() instead
|
|
155
366
|
*/
|
|
156
|
-
|
|
367
|
+
getRuntime(): NapiModule;
|
|
157
368
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* Instance method that delegates to the static findLibraryPath.
|
|
369
|
+
* Get the path to the loaded module.
|
|
161
370
|
*/
|
|
162
|
-
|
|
371
|
+
getModulePath(): string | null;
|
|
163
372
|
/**
|
|
164
|
-
*
|
|
373
|
+
* Find the napi-rs module path.
|
|
165
374
|
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* - See: https://bun.sh/docs/runtime/node-api
|
|
375
|
+
* Resolution order:
|
|
376
|
+
* 1. TASKER_FFI_MODULE_PATH environment variable (explicit override, for unusual setups)
|
|
377
|
+
* 2. Bundled .node file in package directory (standard path — `napi build --platform` places it here)
|
|
170
378
|
*/
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Node.js FFI runtime adapter using koffi.
|
|
176
|
-
*
|
|
177
|
-
* This adapter uses the koffi package to interface with the Rust native library.
|
|
178
|
-
* Koffi is a modern, actively maintained FFI library with prebuilt binaries.
|
|
179
|
-
*
|
|
180
|
-
* Install: npm install koffi
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Node.js FFI runtime implementation using koffi
|
|
185
|
-
*/
|
|
186
|
-
declare class NodeRuntime extends BaseTaskerRuntime {
|
|
187
|
-
readonly name: string;
|
|
188
|
-
private lib;
|
|
189
|
-
private koffi;
|
|
190
|
-
get isLoaded(): boolean;
|
|
191
|
-
load(libraryPath: string): Promise<void>;
|
|
192
|
-
unload(): void;
|
|
193
|
-
private ensureLoaded;
|
|
379
|
+
static findModulePath(): string | null;
|
|
194
380
|
/**
|
|
195
|
-
*
|
|
381
|
+
* Backward-compatible alias for findModulePath().
|
|
196
382
|
*
|
|
197
|
-
*
|
|
383
|
+
* @deprecated Use findModulePath() instead
|
|
198
384
|
*/
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
getRustVersion(): string;
|
|
202
|
-
healthCheck(): boolean;
|
|
203
|
-
bootstrapWorker(config?: BootstrapConfig): BootstrapResult;
|
|
204
|
-
isWorkerRunning(): boolean;
|
|
205
|
-
getWorkerStatus(): WorkerStatus;
|
|
206
|
-
stopWorker(): StopResult;
|
|
207
|
-
transitionToGracefulShutdown(): StopResult;
|
|
208
|
-
pollStepEvents(): FfiStepEvent | null;
|
|
209
|
-
pollInProcessEvents(): FfiDomainEvent | null;
|
|
210
|
-
completeStepEvent(eventId: string, result: StepExecutionResult): boolean;
|
|
211
|
-
checkpointYieldStepEvent(eventId: string, checkpointData: CheckpointYieldData): boolean;
|
|
212
|
-
getFfiDispatchMetrics(): FfiDispatchMetrics;
|
|
213
|
-
checkStarvationWarnings(): void;
|
|
214
|
-
cleanupTimeouts(): void;
|
|
215
|
-
logError(message: string, fields?: LogFields): void;
|
|
216
|
-
logWarn(message: string, fields?: LogFields): void;
|
|
217
|
-
logInfo(message: string, fields?: LogFields): void;
|
|
218
|
-
logDebug(message: string, fields?: LogFields): void;
|
|
219
|
-
logTrace(message: string, fields?: LogFields): void;
|
|
220
|
-
private parseClientResult;
|
|
221
|
-
clientCreateTask(requestJson: string): ClientResult;
|
|
222
|
-
clientGetTask(taskUuid: string): ClientResult;
|
|
223
|
-
clientListTasks(paramsJson: string): ClientResult;
|
|
224
|
-
clientCancelTask(taskUuid: string): ClientResult;
|
|
225
|
-
clientListTaskSteps(taskUuid: string): ClientResult;
|
|
226
|
-
clientGetStep(taskUuid: string, stepUuid: string): ClientResult;
|
|
227
|
-
clientGetStepAuditHistory(taskUuid: string, stepUuid: string): ClientResult;
|
|
228
|
-
clientHealthCheck(): ClientResult;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Bun FFI runtime adapter using koffi (via Node-API).
|
|
233
|
-
*
|
|
234
|
-
* Bun supports Node-API modules natively, so we use koffi (the same FFI
|
|
235
|
-
* library as NodeRuntime) rather than bun:ffi. This gives us:
|
|
236
|
-
* - Stable, well-tested string/pointer handling
|
|
237
|
-
* - Identical behavior across Node.js and Bun
|
|
238
|
-
* - No manual Buffer→pointer conversion bugs
|
|
239
|
-
*
|
|
240
|
-
* See: https://bun.sh/docs/runtime/node-api
|
|
241
|
-
*/
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Bun FFI runtime implementation using koffi (Node-API).
|
|
245
|
-
*
|
|
246
|
-
* Extends NodeRuntime since both use koffi for FFI. The only difference
|
|
247
|
-
* is the runtime name identifier used for logging and diagnostics.
|
|
248
|
-
*/
|
|
249
|
-
declare class BunRuntime extends NodeRuntime {
|
|
250
|
-
readonly name = "bun";
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Deno FFI runtime adapter using Deno.dlopen.
|
|
255
|
-
*
|
|
256
|
-
* This adapter uses Deno's built-in FFI to interface with the Rust native library.
|
|
257
|
-
* It requires --unstable-ffi and --allow-ffi flags.
|
|
258
|
-
*/
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Deno FFI runtime implementation using Deno.dlopen
|
|
262
|
-
*/
|
|
263
|
-
declare class DenoRuntime extends BaseTaskerRuntime {
|
|
264
|
-
readonly name = "deno";
|
|
265
|
-
private lib;
|
|
266
|
-
private encoder;
|
|
267
|
-
get isLoaded(): boolean;
|
|
268
|
-
load(libraryPath: string): Promise<void>;
|
|
269
|
-
unload(): void;
|
|
270
|
-
private ensureLoaded;
|
|
271
|
-
/**
|
|
272
|
-
* Creates a null-terminated C string buffer.
|
|
273
|
-
* With 'buffer' FFI type, we return Uint8Array directly.
|
|
274
|
-
*/
|
|
275
|
-
private toCString;
|
|
276
|
-
private fromCString;
|
|
277
|
-
getVersion(): string;
|
|
278
|
-
getRustVersion(): string;
|
|
279
|
-
healthCheck(): boolean;
|
|
280
|
-
bootstrapWorker(config?: BootstrapConfig): BootstrapResult;
|
|
281
|
-
isWorkerRunning(): boolean;
|
|
282
|
-
getWorkerStatus(): WorkerStatus;
|
|
283
|
-
stopWorker(): StopResult;
|
|
284
|
-
transitionToGracefulShutdown(): StopResult;
|
|
285
|
-
pollStepEvents(): FfiStepEvent | null;
|
|
286
|
-
pollInProcessEvents(): FfiDomainEvent | null;
|
|
287
|
-
completeStepEvent(eventId: string, result: StepExecutionResult): boolean;
|
|
288
|
-
checkpointYieldStepEvent(eventId: string, checkpointData: CheckpointYieldData): boolean;
|
|
289
|
-
getFfiDispatchMetrics(): FfiDispatchMetrics;
|
|
290
|
-
checkStarvationWarnings(): void;
|
|
291
|
-
cleanupTimeouts(): void;
|
|
292
|
-
logError(message: string, fields?: LogFields): void;
|
|
293
|
-
logWarn(message: string, fields?: LogFields): void;
|
|
294
|
-
logInfo(message: string, fields?: LogFields): void;
|
|
295
|
-
logDebug(message: string, fields?: LogFields): void;
|
|
296
|
-
logTrace(message: string, fields?: LogFields): void;
|
|
297
|
-
private parseClientResult;
|
|
298
|
-
clientCreateTask(requestJson: string): ClientResult;
|
|
299
|
-
clientGetTask(taskUuid: string): ClientResult;
|
|
300
|
-
clientListTasks(paramsJson: string): ClientResult;
|
|
301
|
-
clientCancelTask(taskUuid: string): ClientResult;
|
|
302
|
-
clientListTaskSteps(taskUuid: string): ClientResult;
|
|
303
|
-
clientGetStep(taskUuid: string, stepUuid: string): ClientResult;
|
|
304
|
-
clientGetStepAuditHistory(taskUuid: string, stepUuid: string): ClientResult;
|
|
305
|
-
clientHealthCheck(): ClientResult;
|
|
385
|
+
static findLibraryPath(_callerDir?: string): string | null;
|
|
386
|
+
private discoverModulePath;
|
|
306
387
|
}
|
|
307
388
|
|
|
308
|
-
export {
|
|
389
|
+
export { type BootstrapConfig, type BootstrapResult, type CheckpointYieldData, type FfiDispatchMetrics, type FfiDomainEvent, type FfiDomainEventMetadata, FfiLayer, type FfiLayerConfig, type FfiStepEvent, type LogFields, type NapiBackoffHint, type NapiCheckpointYieldData, type NapiClientResult, type NapiDependencyResult, type NapiDispatchMetrics, type NapiDomainEvent, type NapiDomainEventMetadata, type NapiListTasksParams, type NapiModule, type NapiOrchestrationMetadata, type NapiStepDefinition, type NapiStepEvent, type NapiStepExecutionError, type NapiStepExecutionMetadata, type NapiStepExecutionResult, type NapiTaskInfo, type NapiTaskRequest, type NapiWorkflowStep, type StepExecutionResult, type StopResult, type WorkerStatus };
|