@tasker-systems/tasker 0.1.3 → 0.1.4
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 +7 -7
- package/dist/ffi/index.d.ts +30 -51
- package/dist/ffi/index.js +1468 -1469
- package/dist/ffi/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1468 -1469
- package/dist/index.js.map +1 -1
- package/native/libtasker_ts-darwin-arm64.dylib +0 -0
- package/native/libtasker_ts-linux-x64.so +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @tasker-systems/tasker
|
|
2
2
|
|
|
3
|
-
TypeScript worker for the Tasker workflow orchestration system. Supports Bun
|
|
3
|
+
TypeScript worker for the Tasker workflow orchestration system. Supports Bun, Node.js (both via koffi/Node-API), and Deno runtimes.
|
|
4
4
|
|
|
5
5
|
## Status
|
|
6
6
|
|
|
@@ -9,10 +9,10 @@ Production ready. TypeScript worker bindings provide full step handler execution
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
# Bun (recommended
|
|
13
|
-
bun add @tasker-systems/tasker
|
|
12
|
+
# Bun (recommended)
|
|
13
|
+
bun add @tasker-systems/tasker koffi
|
|
14
14
|
|
|
15
|
-
# Node.js
|
|
15
|
+
# Node.js
|
|
16
16
|
npm install @tasker-systems/tasker koffi
|
|
17
17
|
```
|
|
18
18
|
|
|
@@ -97,7 +97,7 @@ workers/typescript/
|
|
|
97
97
|
|
|
98
98
|
## Technology Stack
|
|
99
99
|
|
|
100
|
-
- **FFI Layer**:
|
|
100
|
+
- **FFI Layer**: koffi (Node-API, works with both Bun and Node.js)
|
|
101
101
|
- **Build Tool**: tsup
|
|
102
102
|
- **Runtime**: Bun, Node.js 18+, or Deno
|
|
103
103
|
- **Testing**: Bun test runner
|
|
@@ -109,8 +109,8 @@ workers/typescript/
|
|
|
109
109
|
|
|
110
110
|
| Runtime | FFI Mechanism | Status |
|
|
111
111
|
|---------|---------------|--------|
|
|
112
|
-
| Bun |
|
|
113
|
-
| Node.js | koffi | Supported |
|
|
112
|
+
| Bun | koffi (Node-API) | Recommended |
|
|
113
|
+
| Node.js | koffi (Node-API) | Supported |
|
|
114
114
|
| Deno | `Deno.dlopen` | Experimental |
|
|
115
115
|
|
|
116
116
|
## License
|
package/dist/ffi/index.d.ts
CHANGED
|
@@ -60,10 +60,12 @@ declare function getLibraryPath(basePath?: string): string;
|
|
|
60
60
|
* FfiLayer - Owns FFI runtime loading and lifecycle.
|
|
61
61
|
*
|
|
62
62
|
* This class encapsulates the FFI runtime management:
|
|
63
|
-
* - Runtime detection (
|
|
63
|
+
* - Runtime detection (Node.js, Bun, Deno)
|
|
64
64
|
* - Library path discovery
|
|
65
65
|
* - Runtime loading and unloading
|
|
66
66
|
*
|
|
67
|
+
* Both Node.js and Bun use koffi (Node-API) for stable FFI.
|
|
68
|
+
*
|
|
67
69
|
* Design principles:
|
|
68
70
|
* - Explicit construction: No singleton pattern
|
|
69
71
|
* - Clear ownership: Owns the runtime instance
|
|
@@ -163,40 +165,37 @@ declare class FfiLayer {
|
|
|
163
165
|
/**
|
|
164
166
|
* Create a runtime adapter for the configured runtime type.
|
|
165
167
|
*
|
|
166
|
-
* NOTE: We use koffi (NodeRuntime) for both Node.js and Bun
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* - See: https://bun.sh/docs/runtime/node-api
|
|
168
|
+
* NOTE: We use koffi (NodeRuntime) for both Node.js and Bun.
|
|
169
|
+
* koffi is stable and works with both runtimes via Node-API.
|
|
170
|
+
* See: https://bun.sh/docs/runtime/node-api
|
|
170
171
|
*/
|
|
171
172
|
private createRuntime;
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
/**
|
|
175
|
-
*
|
|
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.
|
|
176
|
+
* Deno FFI runtime adapter using Deno.dlopen.
|
|
179
177
|
*
|
|
180
|
-
*
|
|
178
|
+
* This adapter uses Deno's built-in FFI to interface with the Rust native library.
|
|
179
|
+
* It requires --unstable-ffi and --allow-ffi flags.
|
|
181
180
|
*/
|
|
182
181
|
|
|
183
182
|
/**
|
|
184
|
-
*
|
|
183
|
+
* Deno FFI runtime implementation using Deno.dlopen
|
|
185
184
|
*/
|
|
186
|
-
declare class
|
|
187
|
-
readonly name
|
|
185
|
+
declare class DenoRuntime extends BaseTaskerRuntime {
|
|
186
|
+
readonly name = "deno";
|
|
188
187
|
private lib;
|
|
189
|
-
private
|
|
188
|
+
private encoder;
|
|
190
189
|
get isLoaded(): boolean;
|
|
191
190
|
load(libraryPath: string): Promise<void>;
|
|
192
191
|
unload(): void;
|
|
193
192
|
private ensureLoaded;
|
|
194
193
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* Uses koffi.decode with 'char' type and -1 length for null-terminated strings.
|
|
194
|
+
* Creates a null-terminated C string buffer.
|
|
195
|
+
* With 'buffer' FFI type, we return Uint8Array directly.
|
|
198
196
|
*/
|
|
199
|
-
private
|
|
197
|
+
private toCString;
|
|
198
|
+
private fromCString;
|
|
200
199
|
getVersion(): string;
|
|
201
200
|
getRustVersion(): string;
|
|
202
201
|
healthCheck(): boolean;
|
|
@@ -229,51 +228,31 @@ declare class NodeRuntime extends BaseTaskerRuntime {
|
|
|
229
228
|
}
|
|
230
229
|
|
|
231
230
|
/**
|
|
232
|
-
*
|
|
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).
|
|
231
|
+
* Node.js FFI runtime adapter using koffi.
|
|
245
232
|
*
|
|
246
|
-
*
|
|
247
|
-
* is
|
|
248
|
-
*/
|
|
249
|
-
declare class BunRuntime extends NodeRuntime {
|
|
250
|
-
readonly name = "bun";
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Deno FFI runtime adapter using Deno.dlopen.
|
|
233
|
+
* This adapter uses the koffi package to interface with the Rust native library.
|
|
234
|
+
* Koffi is a modern, actively maintained FFI library with prebuilt binaries.
|
|
255
235
|
*
|
|
256
|
-
*
|
|
257
|
-
* It requires --unstable-ffi and --allow-ffi flags.
|
|
236
|
+
* Install: npm install koffi
|
|
258
237
|
*/
|
|
259
238
|
|
|
260
239
|
/**
|
|
261
|
-
*
|
|
240
|
+
* Node.js FFI runtime implementation using koffi
|
|
262
241
|
*/
|
|
263
|
-
declare class
|
|
264
|
-
readonly name
|
|
242
|
+
declare class NodeRuntime extends BaseTaskerRuntime {
|
|
243
|
+
readonly name: string;
|
|
265
244
|
private lib;
|
|
266
|
-
private
|
|
245
|
+
private koffi;
|
|
267
246
|
get isLoaded(): boolean;
|
|
268
247
|
load(libraryPath: string): Promise<void>;
|
|
269
248
|
unload(): void;
|
|
270
249
|
private ensureLoaded;
|
|
271
250
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
251
|
+
* Read a C string from a pointer and free the Rust-allocated memory.
|
|
252
|
+
*
|
|
253
|
+
* Uses koffi.decode with 'char' type and -1 length for null-terminated strings.
|
|
274
254
|
*/
|
|
275
|
-
private
|
|
276
|
-
private fromCString;
|
|
255
|
+
private readAndFreeRustString;
|
|
277
256
|
getVersion(): string;
|
|
278
257
|
getRustVersion(): string;
|
|
279
258
|
healthCheck(): boolean;
|
|
@@ -305,4 +284,4 @@ declare class DenoRuntime extends BaseTaskerRuntime {
|
|
|
305
284
|
clientHealthCheck(): ClientResult;
|
|
306
285
|
}
|
|
307
286
|
|
|
308
|
-
export { BaseTaskerRuntime, BootstrapConfig, BootstrapResult,
|
|
287
|
+
export { BaseTaskerRuntime, BootstrapConfig, BootstrapResult, DenoRuntime, FfiDispatchMetrics, FfiDomainEvent, FfiLayer, type FfiLayerConfig, FfiStepEvent, LogFields, NodeRuntime, type RuntimeInfo, type RuntimeType, StepExecutionResult, StopResult, TaskerRuntime, WorkerStatus, detectRuntime, getLibraryPath, getRuntimeInfo, isBun, isDeno, isNode };
|