@tasker-systems/tasker 0.1.4 → 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 +46 -85
- 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 -221
- package/dist/ffi/index.js +58 -1887
- 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 +618 -2486
- 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
|
@@ -1,694 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DTO for health check response
|
|
3
|
-
*/
|
|
4
|
-
type ClientHealthResponseDto = {
|
|
5
|
-
status: string;
|
|
6
|
-
timestamp: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* DTO for pagination info in list responses
|
|
11
|
-
*/
|
|
12
|
-
type ClientPaginationInfoDto = {
|
|
13
|
-
page: number;
|
|
14
|
-
per_page: number;
|
|
15
|
-
total_count: bigint;
|
|
16
|
-
total_pages: number;
|
|
17
|
-
has_next: boolean;
|
|
18
|
-
has_previous: boolean;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* DTO for client operation result wrapper (success/error envelope)
|
|
23
|
-
*
|
|
24
|
-
* All TypeScript client FFI functions return this envelope format.
|
|
25
|
-
*/
|
|
26
|
-
type ClientResultDto = {
|
|
27
|
-
success: boolean;
|
|
28
|
-
data: unknown;
|
|
29
|
-
error: string | null;
|
|
30
|
-
recoverable: boolean | null;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* DTO for step audit history response (SOC2 compliance)
|
|
35
|
-
*/
|
|
36
|
-
type ClientStepAuditResponseDto = {
|
|
37
|
-
audit_uuid: string;
|
|
38
|
-
workflow_step_uuid: string;
|
|
39
|
-
transition_uuid: string;
|
|
40
|
-
task_uuid: string;
|
|
41
|
-
recorded_at: string;
|
|
42
|
-
worker_uuid: string | null;
|
|
43
|
-
correlation_id: string | null;
|
|
44
|
-
success: boolean;
|
|
45
|
-
execution_time_ms: bigint | null;
|
|
46
|
-
result: Record<string, unknown> | null;
|
|
47
|
-
step_name: string;
|
|
48
|
-
from_state: string | null;
|
|
49
|
-
to_state: string;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* DTO for step readiness status (nested in task responses)
|
|
54
|
-
*/
|
|
55
|
-
type ClientStepReadinessDto = {
|
|
56
|
-
workflow_step_uuid: string;
|
|
57
|
-
task_uuid: string;
|
|
58
|
-
named_step_uuid: string;
|
|
59
|
-
name: string;
|
|
60
|
-
current_state: string;
|
|
61
|
-
dependencies_satisfied: boolean;
|
|
62
|
-
retry_eligible: boolean;
|
|
63
|
-
ready_for_execution: boolean;
|
|
64
|
-
last_failure_at: string | null;
|
|
65
|
-
next_retry_at: string | null;
|
|
66
|
-
total_parents: number;
|
|
67
|
-
completed_parents: number;
|
|
68
|
-
attempts: number;
|
|
69
|
-
max_attempts: number;
|
|
70
|
-
backoff_request_seconds: number | null;
|
|
71
|
-
last_attempted_at: string | null;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* DTO for step response from the orchestration API
|
|
76
|
-
*/
|
|
77
|
-
type ClientStepResponseDto = {
|
|
78
|
-
step_uuid: string;
|
|
79
|
-
task_uuid: string;
|
|
80
|
-
name: string;
|
|
81
|
-
created_at: string;
|
|
82
|
-
updated_at: string;
|
|
83
|
-
completed_at: string | null;
|
|
84
|
-
results: Record<string, unknown> | null;
|
|
85
|
-
current_state: string;
|
|
86
|
-
dependencies_satisfied: boolean;
|
|
87
|
-
retry_eligible: boolean;
|
|
88
|
-
ready_for_execution: boolean;
|
|
89
|
-
total_parents: number;
|
|
90
|
-
completed_parents: number;
|
|
91
|
-
attempts: number;
|
|
92
|
-
max_attempts: number;
|
|
93
|
-
last_failure_at: string | null;
|
|
94
|
-
next_retry_at: string | null;
|
|
95
|
-
last_attempted_at: string | null;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* DTO for task response from the orchestration API
|
|
100
|
-
*/
|
|
101
|
-
type ClientTaskResponseDto = {
|
|
102
|
-
task_uuid: string;
|
|
103
|
-
name: string;
|
|
104
|
-
namespace: string;
|
|
105
|
-
version: string;
|
|
106
|
-
status: string;
|
|
107
|
-
created_at: string;
|
|
108
|
-
updated_at: string;
|
|
109
|
-
completed_at: string | null;
|
|
110
|
-
context: Record<string, unknown>;
|
|
111
|
-
initiator: string;
|
|
112
|
-
source_system: string;
|
|
113
|
-
reason: string;
|
|
114
|
-
priority: number | null;
|
|
115
|
-
tags: Array<string> | null;
|
|
116
|
-
correlation_id: string;
|
|
117
|
-
parent_correlation_id: string | null;
|
|
118
|
-
total_steps: bigint;
|
|
119
|
-
pending_steps: bigint;
|
|
120
|
-
in_progress_steps: bigint;
|
|
121
|
-
completed_steps: bigint;
|
|
122
|
-
failed_steps: bigint;
|
|
123
|
-
ready_steps: bigint;
|
|
124
|
-
execution_status: string;
|
|
125
|
-
recommended_action: string;
|
|
126
|
-
completion_percentage: number;
|
|
127
|
-
health_status: string;
|
|
128
|
-
steps: Array<ClientStepReadinessDto>;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* DTO for task list response with pagination
|
|
133
|
-
*/
|
|
134
|
-
type ClientTaskListResponseDto = {
|
|
135
|
-
tasks: Array<ClientTaskResponseDto>;
|
|
136
|
-
pagination: ClientPaginationInfoDto;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* DTO for task creation request (input to client_create_task)
|
|
141
|
-
*/
|
|
142
|
-
type ClientTaskRequestDto = {
|
|
143
|
-
name: string;
|
|
144
|
-
namespace: string;
|
|
145
|
-
version: string;
|
|
146
|
-
context: Record<string, unknown>;
|
|
147
|
-
initiator: string;
|
|
148
|
-
source_system: string;
|
|
149
|
-
reason: string;
|
|
150
|
-
tags: Array<string>;
|
|
151
|
-
requested_at: string;
|
|
152
|
-
options: Record<string, unknown> | null;
|
|
153
|
-
priority: number | null;
|
|
154
|
-
correlation_id: string;
|
|
155
|
-
parent_correlation_id: string | null;
|
|
156
|
-
idempotency_key: string | null;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* DTO for step execution errors
|
|
161
|
-
*/
|
|
162
|
-
type StepExecutionErrorDto = {
|
|
163
|
-
message: string;
|
|
164
|
-
error_type: string | null;
|
|
165
|
-
retryable: boolean;
|
|
166
|
-
status_code: number | null;
|
|
167
|
-
backtrace: Array<string> | null;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* DTO for dependency step results
|
|
172
|
-
*/
|
|
173
|
-
type DependencyResultDto = {
|
|
174
|
-
step_uuid: string;
|
|
175
|
-
success: boolean;
|
|
176
|
-
result: Record<string, unknown>;
|
|
177
|
-
status: string;
|
|
178
|
-
error: StepExecutionErrorDto | null;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* DTO for FFI dispatch metrics
|
|
183
|
-
*/
|
|
184
|
-
type FfiDispatchMetricsDto = {
|
|
185
|
-
pending_count: number;
|
|
186
|
-
starvation_detected: boolean;
|
|
187
|
-
starving_event_count: number;
|
|
188
|
-
oldest_pending_age_ms: bigint | null;
|
|
189
|
-
newest_pending_age_ms: bigint | null;
|
|
190
|
-
oldest_event_id: string | null;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* DTO for HandlerDefinition
|
|
195
|
-
*
|
|
196
|
-
* TAS-93: Includes method dispatch and resolver hint fields for the
|
|
197
|
-
* step handler router/resolver strategy pattern.
|
|
198
|
-
*/
|
|
199
|
-
type HandlerDefinitionDto = {
|
|
200
|
-
callable: string;
|
|
201
|
-
/**
|
|
202
|
-
* The entry point method to invoke (defaults to "call")
|
|
203
|
-
*/
|
|
204
|
-
method: string | null;
|
|
205
|
-
/**
|
|
206
|
-
* Resolution strategy hint (bypass chain and use this resolver)
|
|
207
|
-
*/
|
|
208
|
-
resolver: string | null;
|
|
209
|
-
initialization: Record<string, unknown>;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* DTO for RetryConfiguration
|
|
214
|
-
*/
|
|
215
|
-
type RetryConfigurationDto = {
|
|
216
|
-
retryable: boolean;
|
|
217
|
-
max_attempts: number;
|
|
218
|
-
backoff: string;
|
|
219
|
-
backoff_base_ms: bigint | null;
|
|
220
|
-
max_backoff_ms: bigint | null;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* DTO for StepDefinition (from task template)
|
|
225
|
-
*/
|
|
226
|
-
type StepDefinitionDto = {
|
|
227
|
-
name: string;
|
|
228
|
-
description: string | null;
|
|
229
|
-
handler: HandlerDefinitionDto;
|
|
230
|
-
system_dependency: string | null;
|
|
231
|
-
dependencies: Array<string>;
|
|
232
|
-
timeout_seconds: bigint | null;
|
|
233
|
-
retry: RetryConfigurationDto;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* DTO for Task information
|
|
238
|
-
*/
|
|
239
|
-
type TaskDto = {
|
|
240
|
-
task_uuid: string;
|
|
241
|
-
named_task_uuid: string;
|
|
242
|
-
name: string;
|
|
243
|
-
namespace: string;
|
|
244
|
-
version: string;
|
|
245
|
-
context: Record<string, unknown> | null;
|
|
246
|
-
correlation_id: string;
|
|
247
|
-
parent_correlation_id: string | null;
|
|
248
|
-
complete: boolean;
|
|
249
|
-
priority: number;
|
|
250
|
-
initiator: string | null;
|
|
251
|
-
source_system: string | null;
|
|
252
|
-
reason: string | null;
|
|
253
|
-
tags: Record<string, unknown> | null;
|
|
254
|
-
identity_hash: string;
|
|
255
|
-
created_at: string;
|
|
256
|
-
updated_at: string;
|
|
257
|
-
requested_at: string;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* DTO for WorkflowStep information (uses WorkflowStepWithName which has name fields)
|
|
262
|
-
*/
|
|
263
|
-
type WorkflowStepDto = {
|
|
264
|
-
workflow_step_uuid: string;
|
|
265
|
-
task_uuid: string;
|
|
266
|
-
named_step_uuid: string;
|
|
267
|
-
name: string;
|
|
268
|
-
template_step_name: string;
|
|
269
|
-
retryable: boolean;
|
|
270
|
-
max_attempts: number;
|
|
271
|
-
attempts: number;
|
|
272
|
-
in_process: boolean;
|
|
273
|
-
processed: boolean;
|
|
274
|
-
inputs: Record<string, unknown> | null;
|
|
275
|
-
results: Record<string, unknown> | null;
|
|
276
|
-
backoff_request_seconds: number | null;
|
|
277
|
-
processed_at: string | null;
|
|
278
|
-
last_attempted_at: string | null;
|
|
279
|
-
created_at: string;
|
|
280
|
-
updated_at: string;
|
|
281
|
-
/**
|
|
282
|
-
* Handler-driven checkpoint data for batch processing resumability (TAS-125)
|
|
283
|
-
*/
|
|
284
|
-
checkpoint: Record<string, unknown> | null;
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* DTO for FfiStepEvent - the main event payload sent to TypeScript handlers
|
|
289
|
-
*/
|
|
290
|
-
type FfiStepEventDto = {
|
|
291
|
-
event_id: string;
|
|
292
|
-
task_uuid: string;
|
|
293
|
-
step_uuid: string;
|
|
294
|
-
correlation_id: string;
|
|
295
|
-
trace_id: string | null;
|
|
296
|
-
span_id: string | null;
|
|
297
|
-
task_correlation_id: string;
|
|
298
|
-
parent_correlation_id: string | null;
|
|
299
|
-
task: TaskDto;
|
|
300
|
-
workflow_step: WorkflowStepDto;
|
|
301
|
-
step_definition: StepDefinitionDto;
|
|
302
|
-
dependency_results: {
|
|
303
|
-
[key in string]?: DependencyResultDto;
|
|
304
|
-
};
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* FFI type definitions for TypeScript/JavaScript workers.
|
|
309
|
-
*
|
|
310
|
-
* These types are automatically generated from Rust DTOs using ts-rs.
|
|
311
|
-
* Run `cargo make generate-bindings` to regenerate the base types.
|
|
312
|
-
*
|
|
313
|
-
* This file re-exports generated types with API-friendly names and adds
|
|
314
|
-
* runtime-specific types that aren't part of the DTO layer.
|
|
315
|
-
*/
|
|
316
|
-
|
|
317
|
-
type Task = TaskDto;
|
|
318
|
-
type WorkflowStep = WorkflowStepDto;
|
|
319
|
-
type HandlerDefinition = HandlerDefinitionDto;
|
|
320
|
-
type RetryConfiguration = RetryConfigurationDto;
|
|
321
|
-
type StepDefinition = StepDefinitionDto;
|
|
322
|
-
type StepExecutionError = StepExecutionErrorDto;
|
|
323
|
-
type DependencyResult = DependencyResultDto;
|
|
324
|
-
type FfiStepEvent = FfiStepEventDto;
|
|
325
|
-
type FfiDispatchMetrics = FfiDispatchMetricsDto;
|
|
326
|
-
type ClientTaskRequest = ClientTaskRequestDto;
|
|
327
|
-
type ClientTaskResponse = ClientTaskResponseDto;
|
|
328
|
-
type ClientTaskListResponse = ClientTaskListResponseDto;
|
|
329
|
-
type ClientStepResponse = ClientStepResponseDto;
|
|
330
|
-
type ClientStepAuditResponse = ClientStepAuditResponseDto;
|
|
331
|
-
type ClientStepReadiness = ClientStepReadinessDto;
|
|
332
|
-
type ClientPaginationInfo = ClientPaginationInfoDto;
|
|
333
|
-
type ClientHealthResponse = ClientHealthResponseDto;
|
|
334
|
-
type ClientResult = ClientResultDto;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Bootstrap configuration for the worker
|
|
338
|
-
*/
|
|
339
|
-
interface BootstrapConfig {
|
|
340
|
-
worker_id?: string;
|
|
341
|
-
log_level?: 'trace' | 'debug' | 'info' | 'warn' | 'error';
|
|
342
|
-
database_url?: string;
|
|
343
|
-
[key: string]: unknown;
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Bootstrap result from Rust
|
|
347
|
-
*/
|
|
348
|
-
interface BootstrapResult {
|
|
349
|
-
success: boolean;
|
|
350
|
-
status: 'started' | 'already_running' | 'error';
|
|
351
|
-
message: string;
|
|
352
|
-
worker_id?: string;
|
|
353
|
-
error?: string;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Worker status from get_worker_status
|
|
357
|
-
*/
|
|
358
|
-
interface WorkerStatus {
|
|
359
|
-
success: boolean;
|
|
360
|
-
running: boolean;
|
|
361
|
-
status?: 'stopped';
|
|
362
|
-
worker_id?: string;
|
|
363
|
-
environment?: string;
|
|
364
|
-
worker_core_status?: string;
|
|
365
|
-
web_api_enabled?: boolean;
|
|
366
|
-
supported_namespaces?: string[];
|
|
367
|
-
database_pool_size?: number;
|
|
368
|
-
database_pool_idle?: number;
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Stop result from stop_worker
|
|
372
|
-
*/
|
|
373
|
-
interface StopResult {
|
|
374
|
-
success: boolean;
|
|
375
|
-
status: 'stopped' | 'not_running' | 'error';
|
|
376
|
-
message: string;
|
|
377
|
-
worker_id?: string;
|
|
378
|
-
error?: string;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Step execution result to send back to Rust
|
|
382
|
-
*
|
|
383
|
-
* This structure matches tasker_shared::messaging::StepExecutionResult
|
|
384
|
-
*/
|
|
385
|
-
interface StepExecutionResult {
|
|
386
|
-
step_uuid: string;
|
|
387
|
-
success: boolean;
|
|
388
|
-
result: Record<string, unknown>;
|
|
389
|
-
metadata: StepExecutionMetadata;
|
|
390
|
-
status: 'completed' | 'failed' | 'error';
|
|
391
|
-
error?: StepExecutionError;
|
|
392
|
-
orchestration_metadata?: OrchestrationMetadata;
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Metadata about step execution
|
|
396
|
-
*/
|
|
397
|
-
interface StepExecutionMetadata {
|
|
398
|
-
execution_time_ms: number;
|
|
399
|
-
worker_id?: string;
|
|
400
|
-
handler_name?: string;
|
|
401
|
-
attempt_number?: number;
|
|
402
|
-
[key: string]: unknown;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Orchestration metadata for routing
|
|
406
|
-
*/
|
|
407
|
-
interface OrchestrationMetadata {
|
|
408
|
-
routing_context?: Record<string, unknown>;
|
|
409
|
-
next_steps?: string[];
|
|
410
|
-
[key: string]: unknown;
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Log fields for structured logging
|
|
414
|
-
*/
|
|
415
|
-
interface LogFields {
|
|
416
|
-
[key: string]: string | number | boolean | null;
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* Metadata attached to every domain event from FFI.
|
|
420
|
-
*/
|
|
421
|
-
interface FfiDomainEventMetadata {
|
|
422
|
-
taskUuid: string;
|
|
423
|
-
stepUuid: string | null;
|
|
424
|
-
stepName: string | null;
|
|
425
|
-
namespace: string;
|
|
426
|
-
correlationId: string;
|
|
427
|
-
firedAt: string;
|
|
428
|
-
firedBy: string | null;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Domain event from in-process event bus (fast path).
|
|
432
|
-
*
|
|
433
|
-
* Used for real-time notifications that don't require guaranteed delivery
|
|
434
|
-
* (e.g., metrics updates, logging, notifications).
|
|
435
|
-
*/
|
|
436
|
-
interface FfiDomainEvent {
|
|
437
|
-
eventId: string;
|
|
438
|
-
eventName: string;
|
|
439
|
-
eventVersion: string;
|
|
440
|
-
metadata: FfiDomainEventMetadata;
|
|
441
|
-
payload: Record<string, unknown>;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Checkpoint yield data for batch processing handlers (TAS-125)
|
|
445
|
-
*
|
|
446
|
-
* Sent when a handler wants to persist progress and be re-dispatched.
|
|
447
|
-
* The step remains in_process and will be re-executed with the checkpoint
|
|
448
|
-
* data available.
|
|
449
|
-
*/
|
|
450
|
-
interface CheckpointYieldData {
|
|
451
|
-
step_uuid: string;
|
|
452
|
-
cursor: unknown;
|
|
453
|
-
items_processed: number;
|
|
454
|
-
accumulated_results?: Record<string, unknown>;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Runtime interface for FFI operations.
|
|
459
|
-
*
|
|
460
|
-
* This interface defines the contract that all runtime adapters must implement.
|
|
461
|
-
* It provides strongly-typed access to the Rust FFI functions.
|
|
462
|
-
*/
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* Interface for runtime-specific FFI implementations.
|
|
466
|
-
*
|
|
467
|
-
* Each runtime (Node.js, Bun, Deno) implements this interface
|
|
468
|
-
* using their native FFI mechanism.
|
|
469
|
-
*/
|
|
470
|
-
interface TaskerRuntime {
|
|
471
|
-
/**
|
|
472
|
-
* Get the runtime name
|
|
473
|
-
*/
|
|
474
|
-
readonly name: string;
|
|
475
|
-
/**
|
|
476
|
-
* Check if the FFI library is loaded
|
|
477
|
-
*/
|
|
478
|
-
readonly isLoaded: boolean;
|
|
479
|
-
/**
|
|
480
|
-
* Load the native library from the given path
|
|
481
|
-
*/
|
|
482
|
-
load(libraryPath: string): Promise<void>;
|
|
483
|
-
/**
|
|
484
|
-
* Unload the native library and release resources
|
|
485
|
-
*/
|
|
486
|
-
unload(): void;
|
|
487
|
-
/**
|
|
488
|
-
* Get the version of the tasker-ts package
|
|
489
|
-
*/
|
|
490
|
-
getVersion(): string;
|
|
491
|
-
/**
|
|
492
|
-
* Get detailed Rust library version
|
|
493
|
-
*/
|
|
494
|
-
getRustVersion(): string;
|
|
495
|
-
/**
|
|
496
|
-
* Check if the FFI module is functional
|
|
497
|
-
*/
|
|
498
|
-
healthCheck(): boolean;
|
|
499
|
-
/**
|
|
500
|
-
* Bootstrap the worker with optional configuration
|
|
501
|
-
*/
|
|
502
|
-
bootstrapWorker(config?: BootstrapConfig): BootstrapResult;
|
|
503
|
-
/**
|
|
504
|
-
* Check if the worker is currently running
|
|
505
|
-
*/
|
|
506
|
-
isWorkerRunning(): boolean;
|
|
507
|
-
/**
|
|
508
|
-
* Get current worker status
|
|
509
|
-
*/
|
|
510
|
-
getWorkerStatus(): WorkerStatus;
|
|
511
|
-
/**
|
|
512
|
-
* Stop the worker gracefully
|
|
513
|
-
*/
|
|
514
|
-
stopWorker(): StopResult;
|
|
515
|
-
/**
|
|
516
|
-
* Transition to graceful shutdown mode
|
|
517
|
-
*/
|
|
518
|
-
transitionToGracefulShutdown(): StopResult;
|
|
519
|
-
/**
|
|
520
|
-
* Poll for pending step events (non-blocking)
|
|
521
|
-
*
|
|
522
|
-
* @returns Step event if available, null otherwise
|
|
523
|
-
*/
|
|
524
|
-
pollStepEvents(): FfiStepEvent | null;
|
|
525
|
-
/**
|
|
526
|
-
* Poll for in-process domain events (fast path, non-blocking)
|
|
527
|
-
*
|
|
528
|
-
* Used for real-time notifications that don't require guaranteed delivery
|
|
529
|
-
* (e.g., metrics updates, logging, notifications).
|
|
530
|
-
*
|
|
531
|
-
* @returns Domain event if available, null otherwise
|
|
532
|
-
*/
|
|
533
|
-
pollInProcessEvents(): FfiDomainEvent | null;
|
|
534
|
-
/**
|
|
535
|
-
* Complete a step event with the given result
|
|
536
|
-
*
|
|
537
|
-
* @param eventId The event ID to complete
|
|
538
|
-
* @param result The step execution result
|
|
539
|
-
* @returns true if successful, false otherwise
|
|
540
|
-
*/
|
|
541
|
-
completeStepEvent(eventId: string, result: StepExecutionResult): boolean;
|
|
542
|
-
/**
|
|
543
|
-
* TAS-125: Submit a checkpoint yield for batch processing
|
|
544
|
-
*
|
|
545
|
-
* Called from batch processing handlers when they want to persist progress
|
|
546
|
-
* and be re-dispatched for continuation. Unlike completeStepEvent, this
|
|
547
|
-
* does NOT complete the step - instead it persists checkpoint data and
|
|
548
|
-
* re-dispatches the step for continued processing.
|
|
549
|
-
*
|
|
550
|
-
* @param eventId The event ID from the step event
|
|
551
|
-
* @param checkpointData The checkpoint data to persist
|
|
552
|
-
* @returns true if checkpoint persisted and step re-dispatched, false otherwise
|
|
553
|
-
*/
|
|
554
|
-
checkpointYieldStepEvent(eventId: string, checkpointData: CheckpointYieldData): boolean;
|
|
555
|
-
/**
|
|
556
|
-
* Get FFI dispatch metrics
|
|
557
|
-
*/
|
|
558
|
-
getFfiDispatchMetrics(): FfiDispatchMetrics;
|
|
559
|
-
/**
|
|
560
|
-
* Check for and log starvation warnings
|
|
561
|
-
*/
|
|
562
|
-
checkStarvationWarnings(): void;
|
|
563
|
-
/**
|
|
564
|
-
* Cleanup timed-out events
|
|
565
|
-
*/
|
|
566
|
-
cleanupTimeouts(): void;
|
|
567
|
-
/**
|
|
568
|
-
* Create a task via the orchestration API client
|
|
569
|
-
*
|
|
570
|
-
* @param requestJson JSON string of ClientTaskRequest
|
|
571
|
-
* @returns ClientResult containing ClientTaskResponse on success
|
|
572
|
-
*/
|
|
573
|
-
clientCreateTask(requestJson: string): ClientResult;
|
|
574
|
-
/**
|
|
575
|
-
* Get a task by UUID
|
|
576
|
-
*
|
|
577
|
-
* @param taskUuid The task UUID
|
|
578
|
-
* @returns ClientResult containing ClientTaskResponse on success
|
|
579
|
-
*/
|
|
580
|
-
clientGetTask(taskUuid: string): ClientResult;
|
|
581
|
-
/**
|
|
582
|
-
* List tasks with optional filters
|
|
583
|
-
*
|
|
584
|
-
* @param paramsJson JSON string with limit, offset, namespace, status
|
|
585
|
-
* @returns ClientResult containing ClientTaskListResponse on success
|
|
586
|
-
*/
|
|
587
|
-
clientListTasks(paramsJson: string): ClientResult;
|
|
588
|
-
/**
|
|
589
|
-
* Cancel a task
|
|
590
|
-
*
|
|
591
|
-
* @param taskUuid The task UUID to cancel
|
|
592
|
-
* @returns ClientResult with cancellation status
|
|
593
|
-
*/
|
|
594
|
-
clientCancelTask(taskUuid: string): ClientResult;
|
|
595
|
-
/**
|
|
596
|
-
* List workflow steps for a task
|
|
597
|
-
*
|
|
598
|
-
* @param taskUuid The task UUID
|
|
599
|
-
* @returns ClientResult containing step list on success
|
|
600
|
-
*/
|
|
601
|
-
clientListTaskSteps(taskUuid: string): ClientResult;
|
|
602
|
-
/**
|
|
603
|
-
* Get a specific workflow step
|
|
604
|
-
*
|
|
605
|
-
* @param taskUuid The task UUID
|
|
606
|
-
* @param stepUuid The step UUID
|
|
607
|
-
* @returns ClientResult containing ClientStepResponse on success
|
|
608
|
-
*/
|
|
609
|
-
clientGetStep(taskUuid: string, stepUuid: string): ClientResult;
|
|
610
|
-
/**
|
|
611
|
-
* Get audit history for a workflow step (SOC2 compliance)
|
|
612
|
-
*
|
|
613
|
-
* @param taskUuid The task UUID
|
|
614
|
-
* @param stepUuid The step UUID
|
|
615
|
-
* @returns ClientResult containing audit history on success
|
|
616
|
-
*/
|
|
617
|
-
clientGetStepAuditHistory(taskUuid: string, stepUuid: string): ClientResult;
|
|
618
|
-
/**
|
|
619
|
-
* Health check against the orchestration API
|
|
620
|
-
*
|
|
621
|
-
* @returns ClientResult containing ClientHealthResponse on success
|
|
622
|
-
*/
|
|
623
|
-
clientHealthCheck(): ClientResult;
|
|
624
|
-
/**
|
|
625
|
-
* Log an error message
|
|
626
|
-
*/
|
|
627
|
-
logError(message: string, fields?: LogFields): void;
|
|
628
|
-
/**
|
|
629
|
-
* Log a warning message
|
|
630
|
-
*/
|
|
631
|
-
logWarn(message: string, fields?: LogFields): void;
|
|
632
|
-
/**
|
|
633
|
-
* Log an info message
|
|
634
|
-
*/
|
|
635
|
-
logInfo(message: string, fields?: LogFields): void;
|
|
636
|
-
/**
|
|
637
|
-
* Log a debug message
|
|
638
|
-
*/
|
|
639
|
-
logDebug(message: string, fields?: LogFields): void;
|
|
640
|
-
/**
|
|
641
|
-
* Log a trace message
|
|
642
|
-
*/
|
|
643
|
-
logTrace(message: string, fields?: LogFields): void;
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* Base class with common functionality for all runtime implementations.
|
|
647
|
-
*
|
|
648
|
-
* Runtime-specific implementations extend this class and implement
|
|
649
|
-
* the abstract methods using their native FFI mechanism.
|
|
650
|
-
*/
|
|
651
|
-
declare abstract class BaseTaskerRuntime implements TaskerRuntime {
|
|
652
|
-
abstract readonly name: string;
|
|
653
|
-
abstract readonly isLoaded: boolean;
|
|
654
|
-
abstract load(libraryPath: string): Promise<void>;
|
|
655
|
-
abstract unload(): void;
|
|
656
|
-
abstract getVersion(): string;
|
|
657
|
-
abstract getRustVersion(): string;
|
|
658
|
-
abstract healthCheck(): boolean;
|
|
659
|
-
abstract bootstrapWorker(config?: BootstrapConfig): BootstrapResult;
|
|
660
|
-
abstract isWorkerRunning(): boolean;
|
|
661
|
-
abstract getWorkerStatus(): WorkerStatus;
|
|
662
|
-
abstract stopWorker(): StopResult;
|
|
663
|
-
abstract transitionToGracefulShutdown(): StopResult;
|
|
664
|
-
abstract pollStepEvents(): FfiStepEvent | null;
|
|
665
|
-
abstract pollInProcessEvents(): FfiDomainEvent | null;
|
|
666
|
-
abstract completeStepEvent(eventId: string, result: StepExecutionResult): boolean;
|
|
667
|
-
abstract checkpointYieldStepEvent(eventId: string, checkpointData: CheckpointYieldData): boolean;
|
|
668
|
-
abstract getFfiDispatchMetrics(): FfiDispatchMetrics;
|
|
669
|
-
abstract checkStarvationWarnings(): void;
|
|
670
|
-
abstract cleanupTimeouts(): void;
|
|
671
|
-
abstract clientCreateTask(requestJson: string): ClientResult;
|
|
672
|
-
abstract clientGetTask(taskUuid: string): ClientResult;
|
|
673
|
-
abstract clientListTasks(paramsJson: string): ClientResult;
|
|
674
|
-
abstract clientCancelTask(taskUuid: string): ClientResult;
|
|
675
|
-
abstract clientListTaskSteps(taskUuid: string): ClientResult;
|
|
676
|
-
abstract clientGetStep(taskUuid: string, stepUuid: string): ClientResult;
|
|
677
|
-
abstract clientGetStepAuditHistory(taskUuid: string, stepUuid: string): ClientResult;
|
|
678
|
-
abstract clientHealthCheck(): ClientResult;
|
|
679
|
-
abstract logError(message: string, fields?: LogFields): void;
|
|
680
|
-
abstract logWarn(message: string, fields?: LogFields): void;
|
|
681
|
-
abstract logInfo(message: string, fields?: LogFields): void;
|
|
682
|
-
abstract logDebug(message: string, fields?: LogFields): void;
|
|
683
|
-
abstract logTrace(message: string, fields?: LogFields): void;
|
|
684
|
-
/**
|
|
685
|
-
* Helper to parse JSON string from FFI
|
|
686
|
-
*/
|
|
687
|
-
protected parseJson<T>(jsonStr: string | null): T | null;
|
|
688
|
-
/**
|
|
689
|
-
* Helper to stringify JSON for FFI
|
|
690
|
-
*/
|
|
691
|
-
protected toJson(value: unknown): string;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
export { BaseTaskerRuntime as B, type ClientTaskResponse as C, type DependencyResult as D, type FfiDomainEvent as F, type HandlerDefinitionDto as H, type LogFields as L, type OrchestrationMetadata as O, type RetryConfiguration as R, type StepDefinition as S, type TaskerRuntime as T, type WorkerStatus as W, type ClientTaskListResponse as a, type ClientStepResponse as b, type ClientStepAuditResponse as c, type ClientHealthResponse as d, type BootstrapConfig as e, type BootstrapResult as f, type ClientPaginationInfo as g, type ClientResult as h, type ClientStepReadiness as i, type ClientTaskRequest as j, type FfiDispatchMetrics as k, type FfiStepEvent as l, type HandlerDefinition as m, type StepExecutionError as n, type StepExecutionMetadata as o, type StepExecutionResult as p, type StopResult as q, type Task as r, type WorkflowStep as s, type CheckpointYieldData as t, type FfiDomainEventMetadata as u };
|