@tasker-systems/tasker 0.1.0-alpha.1 → 0.1.2

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.
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
- import { l as FfiStepEvent, p as StepExecutionResult, k as FfiDispatchMetrics, T as TaskerRuntime } from './runtime-interface-CE4viUt7.js';
2
+ import { l as FfiStepEvent, p as StepExecutionResult, k as FfiDispatchMetrics, T as TaskerRuntime } from './runtime-interface-D940vUzy.js';
3
3
 
4
4
  /**
5
5
  * Event emitter for TypeScript workers.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { T as TaskerRuntime, F as FfiDomainEvent, H as HandlerDefinitionDto } from './runtime-interface-CE4viUt7.js';
2
- export { B as BaseTaskerRuntime, C as ClientHealthResponse, c as ClientPaginationInfo, d as ClientResult, e as ClientStepAuditResponse, f as ClientStepReadiness, g as ClientStepResponse, h as ClientTaskListResponse, i as ClientTaskRequest, j as ClientTaskResponse, D as DependencyResult, a as FfiBootstrapConfig, b as FfiBootstrapResult, k as FfiDispatchMetrics, L as FfiLogFields, l as FfiStepEvent, q as FfiStopResult, W as FfiWorkerStatus, m as HandlerDefinition, O as OrchestrationMetadata, R as RetryConfiguration, S as StepDefinition, n as StepExecutionError, o as StepExecutionMetadata, p as StepExecutionResult, r as Task, s as WorkflowStep } from './runtime-interface-CE4viUt7.js';
3
- import { S as StepHandlerResult, a as StepHandler, B as BatchWorkerConfig, b as StepContext, E as ExecutableHandler, c as StepHandlerClass, T as TaskerEventEmitter, d as EventPoller, e as StepExecutionSubscriber, f as EventSystem } from './index-B3BcknlZ.js';
4
- export { y as ErrorCallback, I as ErrorType, n as EventName, o as EventNames, z as EventPollerConfig, F as EventSystemConfig, G as EventSystemStats, A as MetricsCallback, p as MetricsEventName, q as MetricsEventNames, M as MetricsPayload, P as PollerCyclePayload, r as PollerEventName, s as PollerEventNames, C as PollerState, g as StepCompletionSentPayload, L as StepContextParams, D as StepEventCallback, t as StepEventName, u as StepEventNames, h as StepExecutionCompletedPayload, i as StepExecutionFailedPayload, j as StepExecutionReceivedPayload, k as StepExecutionStartedPayload, H as StepExecutionSubscriberConfig, N as StepHandlerResultParams, l as TaskerEventMap, W as WorkerErrorPayload, v as WorkerEventName, w as WorkerEventNames, m as WorkerEventPayload, x as createEventPoller, J as isStandardErrorType, K as isTypicallyRetryable } from './index-B3BcknlZ.js';
5
- import { FfiLayerConfig } from './ffi/index.js';
6
- export { BunRuntime, DenoRuntime, FfiLayer, NodeRuntime, RuntimeInfo, RuntimeType, detectRuntime, getLibraryPath, getRuntimeInfo, isBun, isDeno, isNode } from './ffi/index.js';
1
+ import { T as TaskerRuntime, C as ClientTaskResponse, a as ClientTaskListResponse, b as ClientStepResponse, c as ClientStepAuditResponse, d as ClientHealthResponse, F as FfiDomainEvent, H as HandlerDefinitionDto } from './runtime-interface-D940vUzy.js';
2
+ export { B as BaseTaskerRuntime, g as ClientPaginationInfo, h as ClientResult, i as ClientStepReadiness, j as ClientTaskRequest, D as DependencyResult, e as FfiBootstrapConfig, f as FfiBootstrapResult, k as FfiDispatchMetrics, L as FfiLogFields, l as FfiStepEvent, q as FfiStopResult, W as FfiWorkerStatus, m as HandlerDefinition, O as OrchestrationMetadata, R as RetryConfiguration, S as StepDefinition, n as StepExecutionError, o as StepExecutionMetadata, p as StepExecutionResult, r as Task, s as WorkflowStep } from './runtime-interface-D940vUzy.js';
3
+ import { FfiLayer, FfiLayerConfig } from './ffi/index.js';
4
+ export { BunRuntime, DenoRuntime, NodeRuntime, RuntimeInfo, RuntimeType, detectRuntime, getLibraryPath, getRuntimeInfo, isBun, isDeno, isNode } from './ffi/index.js';
5
+ import { S as StepHandlerResult, a as StepHandler, B as BatchWorkerConfig, b as StepContext, E as ExecutableHandler, c as StepHandlerClass, T as TaskerEventEmitter, d as EventPoller, e as StepExecutionSubscriber, f as EventSystem } from './index-CTl8lGpU.js';
6
+ export { y as ErrorCallback, I as ErrorType, n as EventName, o as EventNames, z as EventPollerConfig, F as EventSystemConfig, G as EventSystemStats, A as MetricsCallback, p as MetricsEventName, q as MetricsEventNames, M as MetricsPayload, P as PollerCyclePayload, r as PollerEventName, s as PollerEventNames, C as PollerState, g as StepCompletionSentPayload, L as StepContextParams, D as StepEventCallback, t as StepEventName, u as StepEventNames, h as StepExecutionCompletedPayload, i as StepExecutionFailedPayload, j as StepExecutionReceivedPayload, k as StepExecutionStartedPayload, H as StepExecutionSubscriberConfig, N as StepHandlerResultParams, l as TaskerEventMap, W as WorkerErrorPayload, v as WorkerEventName, w as WorkerEventNames, m as WorkerEventPayload, x as createEventPoller, J as isStandardErrorType, K as isTypicallyRetryable } from './index-CTl8lGpU.js';
7
7
  import { Logger } from 'pino';
8
8
  import 'eventemitter3';
9
9
 
@@ -225,6 +225,166 @@ declare function getRustVersion(runtime?: TaskerRuntime): string;
225
225
  */
226
226
  declare function healthCheck(runtime?: TaskerRuntime): boolean;
227
227
 
228
+ /**
229
+ * High-level client wrapper for orchestration API operations.
230
+ *
231
+ * The raw FFI exposes `runtime.clientCreateTask(json)` and similar methods
232
+ * that require callers to construct complete JSON request strings with all
233
+ * required fields and return untyped `ClientResult` envelopes.
234
+ *
235
+ * This module provides a `TaskerClient` class with typed methods, sensible
236
+ * defaults, and proper error handling.
237
+ *
238
+ * @example
239
+ * ```typescript
240
+ * import { FfiLayer, TaskerClient } from '@tasker-systems/tasker';
241
+ *
242
+ * const ffiLayer = new FfiLayer();
243
+ * await ffiLayer.load();
244
+ * const client = new TaskerClient(ffiLayer);
245
+ *
246
+ * const task = client.createTask({ name: 'process_order', namespace: 'ecommerce' });
247
+ * console.log(task.task_uuid);
248
+ * ```
249
+ *
250
+ * @packageDocumentation
251
+ */
252
+
253
+ /**
254
+ * Options for creating a task.
255
+ *
256
+ * Only `name` is required; all other fields have sensible defaults.
257
+ */
258
+ interface CreateTaskOptions {
259
+ /** Named task template name */
260
+ name: string;
261
+ /** Task namespace (default: 'default') */
262
+ namespace?: string;
263
+ /** Workflow context passed to step handlers (default: {}) */
264
+ context?: Record<string, unknown>;
265
+ /** Template version (default: '1.0.0') */
266
+ version?: string;
267
+ /** Who initiated the request (default: 'tasker-core-typescript') */
268
+ initiator?: string;
269
+ /** Originating system (default: 'tasker-core') */
270
+ sourceSystem?: string;
271
+ /** Reason for creating the task (default: 'Task requested') */
272
+ reason?: string;
273
+ /** Optional tags */
274
+ tags?: string[];
275
+ /** Optional priority */
276
+ priority?: number | null;
277
+ /** Optional correlation ID (auto-generated if not provided) */
278
+ correlationId?: string;
279
+ /** Optional parent correlation ID */
280
+ parentCorrelationId?: string | null;
281
+ /** Optional idempotency key */
282
+ idempotencyKey?: string | null;
283
+ }
284
+ /**
285
+ * Options for listing tasks.
286
+ */
287
+ interface ListTasksOptions {
288
+ /** Maximum number of results (default: 50) */
289
+ limit?: number;
290
+ /** Pagination offset (default: 0) */
291
+ offset?: number;
292
+ /** Filter by namespace */
293
+ namespace?: string;
294
+ /** Filter by status */
295
+ status?: string;
296
+ }
297
+ /**
298
+ * Error thrown when a client operation fails.
299
+ */
300
+ declare class TaskerClientError extends Error {
301
+ /** Whether the error is potentially recoverable */
302
+ readonly recoverable: boolean;
303
+ constructor(message: string, recoverable?: boolean);
304
+ }
305
+ /**
306
+ * High-level client for orchestration API operations.
307
+ *
308
+ * Wraps the raw FFI methods with typed interfaces, sensible defaults,
309
+ * and proper error handling via `TaskerClientError`.
310
+ */
311
+ declare class TaskerClient {
312
+ private readonly ffiLayer;
313
+ constructor(ffiLayer: FfiLayer);
314
+ /**
315
+ * Create a task via the orchestration API.
316
+ *
317
+ * @param options - Task creation options (only `name` is required)
318
+ * @returns Typed task response
319
+ * @throws TaskerClientError if the operation fails
320
+ */
321
+ createTask(options: CreateTaskOptions): ClientTaskResponse;
322
+ /**
323
+ * Get a task by UUID.
324
+ *
325
+ * @param taskUuid - The task UUID
326
+ * @returns Typed task response
327
+ * @throws TaskerClientError if the operation fails
328
+ */
329
+ getTask(taskUuid: string): ClientTaskResponse;
330
+ /**
331
+ * List tasks with optional filtering and pagination.
332
+ *
333
+ * @param options - Filtering and pagination options
334
+ * @returns Typed task list response with pagination
335
+ * @throws TaskerClientError if the operation fails
336
+ */
337
+ listTasks(options?: ListTasksOptions): ClientTaskListResponse;
338
+ /**
339
+ * Cancel a task by UUID.
340
+ *
341
+ * @param taskUuid - The task UUID
342
+ * @throws TaskerClientError if the operation fails
343
+ */
344
+ cancelTask(taskUuid: string): void;
345
+ /**
346
+ * List workflow steps for a task.
347
+ *
348
+ * @param taskUuid - The task UUID
349
+ * @returns Array of typed step responses
350
+ * @throws TaskerClientError if the operation fails
351
+ */
352
+ listTaskSteps(taskUuid: string): ClientStepResponse[];
353
+ /**
354
+ * Get a specific workflow step.
355
+ *
356
+ * @param taskUuid - The task UUID
357
+ * @param stepUuid - The step UUID
358
+ * @returns Typed step response
359
+ * @throws TaskerClientError if the operation fails
360
+ */
361
+ getStep(taskUuid: string, stepUuid: string): ClientStepResponse;
362
+ /**
363
+ * Get audit history for a workflow step.
364
+ *
365
+ * @param taskUuid - The task UUID
366
+ * @param stepUuid - The step UUID
367
+ * @returns Array of typed audit history entries
368
+ * @throws TaskerClientError if the operation fails
369
+ */
370
+ getStepAuditHistory(taskUuid: string, stepUuid: string): ClientStepAuditResponse[];
371
+ /**
372
+ * Check orchestration API health.
373
+ *
374
+ * @returns Typed health response
375
+ * @throws TaskerClientError if the operation fails
376
+ */
377
+ healthCheck(): ClientHealthResponse;
378
+ /**
379
+ * Unwrap a ClientResult envelope, throwing on error.
380
+ */
381
+ private unwrap;
382
+ /**
383
+ * Get the FFI runtime from the layer.
384
+ */
385
+ private getRuntime;
386
+ }
387
+
228
388
  /**
229
389
  * API mixin for HTTP functionality.
230
390
  *
@@ -4010,4 +4170,4 @@ declare class WorkerServer {
4010
4170
  private cleanupOnError;
4011
4171
  }
4012
4172
 
4013
- export { type APICapable, APIMixin, ApiHandler, ApiResponse, BasePublisher, type BaseResolver, BaseSubscriber, type BatchAggregationResult, type BatchAnalyzerOutcome, type BatchMetadata, type BatchProcessingOutcome, type BatchWorkerContext, type BatchWorkerOutcome, type Batchable, BatchableMixin, type BootstrapConfig, type BootstrapResult, ClassLookupResolver, type CreateBatchesOutcome, type CursorConfig, type DecisionCapable, DecisionHandler, DecisionMixin, type DecisionPointOutcome, DecisionType, DefaultPublisher, type DomainEvent, type DomainEventCallback, type DomainEventErrorCallback, type DomainEventMetadata, type DomainEventPollerConfig, DuplicatePublisherError, type EventDeclaration, EventPoller, EventSystem, ExecutableHandler, ExplicitMappingResolver, type FailureStrategy, FfiLayerConfig, type HandlerEntry, type HandlerFactory, HandlerRegistry, type HandlerSpec, HandlerSystem, InProcessDomainEventPoller, type LogFields, MethodDispatchError, MethodDispatchWrapper, type NoBatchesOutcome, NoResolverMatchError, type PollerStats, type PublishContext, PublisherNotFoundError, PublisherRegistry, PublisherValidationError, RegistryFrozenError, RegistryResolver, type RegistryResolverStatic, ResolutionError, ResolverChain, type ResolverConfig, ResolverNotFoundError, type RustBatchWorkerInputs, type RustCursorConfig, type ServerComponents, type HealthCheckResult as ServerHealthCheckResult, type ServerState, type ServerStatus, ShutdownController, type ShutdownHandler, StepContext, type StepEventContext, StepExecutionSubscriber, StepHandler, StepHandlerClass, StepHandlerResult, type StepResult, type StopResult, type SubscriberClass, SubscriberRegistry, type SubscriberStats, TaskerEventEmitter, TaskerRuntime, WorkerServer, type WorkerServerConfig, type WorkerStatus, aggregateBatchResults, applyAPI, applyBatchable, applyDecision, bootstrapWorker, createBatchWorkerContext, createBatches, createDomainEvent, createFfiPollAdapter, createLogger, createStepEventContext, effectiveMethod, ffiEventToDomainEvent, fromCallable, fromDto, getRustVersion, getVersion, getWorkerStatus, hasResolverHint, healthCheck, isCreateBatches, isNoBatches, isWorkerRunning, logDebug, logError, logInfo, logTrace, logWarn, noBatches, normalizeToDefinition, stopWorker, transitionToGracefulShutdown, usesMethodDispatch };
4173
+ export { type APICapable, APIMixin, ApiHandler, ApiResponse, BasePublisher, type BaseResolver, BaseSubscriber, type BatchAggregationResult, type BatchAnalyzerOutcome, type BatchMetadata, type BatchProcessingOutcome, type BatchWorkerContext, type BatchWorkerOutcome, type Batchable, BatchableMixin, type BootstrapConfig, type BootstrapResult, ClassLookupResolver, ClientHealthResponse, ClientStepAuditResponse, ClientStepResponse, ClientTaskListResponse, ClientTaskResponse, type CreateBatchesOutcome, type CreateTaskOptions, type CursorConfig, type DecisionCapable, DecisionHandler, DecisionMixin, type DecisionPointOutcome, DecisionType, DefaultPublisher, type DomainEvent, type DomainEventCallback, type DomainEventErrorCallback, type DomainEventMetadata, type DomainEventPollerConfig, DuplicatePublisherError, type EventDeclaration, EventPoller, EventSystem, ExecutableHandler, ExplicitMappingResolver, type FailureStrategy, FfiLayer, FfiLayerConfig, type HandlerEntry, type HandlerFactory, HandlerRegistry, type HandlerSpec, HandlerSystem, InProcessDomainEventPoller, type ListTasksOptions, type LogFields, MethodDispatchError, MethodDispatchWrapper, type NoBatchesOutcome, NoResolverMatchError, type PollerStats, type PublishContext, PublisherNotFoundError, PublisherRegistry, PublisherValidationError, RegistryFrozenError, RegistryResolver, type RegistryResolverStatic, ResolutionError, ResolverChain, type ResolverConfig, ResolverNotFoundError, type RustBatchWorkerInputs, type RustCursorConfig, type ServerComponents, type HealthCheckResult as ServerHealthCheckResult, type ServerState, type ServerStatus, ShutdownController, type ShutdownHandler, StepContext, type StepEventContext, StepExecutionSubscriber, StepHandler, StepHandlerClass, StepHandlerResult, type StepResult, type StopResult, type SubscriberClass, SubscriberRegistry, type SubscriberStats, TaskerClient, TaskerClientError, TaskerEventEmitter, TaskerRuntime, WorkerServer, type WorkerServerConfig, type WorkerStatus, aggregateBatchResults, applyAPI, applyBatchable, applyDecision, bootstrapWorker, createBatchWorkerContext, createBatches, createDomainEvent, createFfiPollAdapter, createLogger, createStepEventContext, effectiveMethod, ffiEventToDomainEvent, fromCallable, fromDto, getRustVersion, getVersion, getWorkerStatus, hasResolverHint, healthCheck, isCreateBatches, isNoBatches, isWorkerRunning, logDebug, logError, logInfo, logTrace, logWarn, noBatches, normalizeToDefinition, stopWorker, transitionToGracefulShutdown, usesMethodDispatch };
package/dist/index.js CHANGED
@@ -79,9 +79,9 @@ var init_koffi = __esm({
79
79
  }
80
80
  });
81
81
 
82
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/darwin_arm64/koffi.node
82
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/darwin_arm64/koffi.node
83
83
  var require_koffi = __commonJS2({
84
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/darwin_arm64/koffi.node"(exports2, module2) {
84
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/darwin_arm64/koffi.node"(exports2, module2) {
85
85
  init_koffi();
86
86
  try {
87
87
  module2.exports = __require(koffi_default);
@@ -98,9 +98,9 @@ var init_koffi2 = __esm({
98
98
  }
99
99
  });
100
100
 
101
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/darwin_x64/koffi.node
101
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/darwin_x64/koffi.node
102
102
  var require_koffi2 = __commonJS2({
103
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/darwin_x64/koffi.node"(exports2, module2) {
103
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/darwin_x64/koffi.node"(exports2, module2) {
104
104
  init_koffi2();
105
105
  try {
106
106
  module2.exports = __require(koffi_default2);
@@ -117,9 +117,9 @@ var init_koffi3 = __esm({
117
117
  }
118
118
  });
119
119
 
120
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node
120
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node
121
121
  var require_koffi3 = __commonJS2({
122
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node"(exports2, module2) {
122
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node"(exports2, module2) {
123
123
  init_koffi3();
124
124
  try {
125
125
  module2.exports = __require(koffi_default3);
@@ -136,9 +136,9 @@ var init_koffi4 = __esm({
136
136
  }
137
137
  });
138
138
 
139
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node
139
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node
140
140
  var require_koffi4 = __commonJS2({
141
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node"(exports2, module2) {
141
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node"(exports2, module2) {
142
142
  init_koffi4();
143
143
  try {
144
144
  module2.exports = __require(koffi_default4);
@@ -155,9 +155,9 @@ var init_koffi5 = __esm({
155
155
  }
156
156
  });
157
157
 
158
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_x64/koffi.node
158
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_x64/koffi.node
159
159
  var require_koffi5 = __commonJS2({
160
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_x64/koffi.node"(exports2, module2) {
160
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/freebsd_x64/koffi.node"(exports2, module2) {
161
161
  init_koffi5();
162
162
  try {
163
163
  module2.exports = __require(koffi_default5);
@@ -174,9 +174,9 @@ var init_koffi6 = __esm({
174
174
  }
175
175
  });
176
176
 
177
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_armhf/koffi.node
177
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_armhf/koffi.node
178
178
  var require_koffi6 = __commonJS2({
179
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_armhf/koffi.node"(exports2, module2) {
179
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_armhf/koffi.node"(exports2, module2) {
180
180
  init_koffi6();
181
181
  try {
182
182
  module2.exports = __require(koffi_default6);
@@ -193,9 +193,9 @@ var init_koffi7 = __esm({
193
193
  }
194
194
  });
195
195
 
196
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_arm64/koffi.node
196
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_arm64/koffi.node
197
197
  var require_koffi7 = __commonJS2({
198
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_arm64/koffi.node"(exports2, module2) {
198
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_arm64/koffi.node"(exports2, module2) {
199
199
  init_koffi7();
200
200
  try {
201
201
  module2.exports = __require(koffi_default7);
@@ -212,9 +212,9 @@ var init_koffi8 = __esm({
212
212
  }
213
213
  });
214
214
 
215
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_ia32/koffi.node
215
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_ia32/koffi.node
216
216
  var require_koffi8 = __commonJS2({
217
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_ia32/koffi.node"(exports2, module2) {
217
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_ia32/koffi.node"(exports2, module2) {
218
218
  init_koffi8();
219
219
  try {
220
220
  module2.exports = __require(koffi_default8);
@@ -231,9 +231,9 @@ var init_koffi9 = __esm({
231
231
  }
232
232
  });
233
233
 
234
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_loong64/koffi.node
234
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_loong64/koffi.node
235
235
  var require_koffi9 = __commonJS2({
236
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_loong64/koffi.node"(exports2, module2) {
236
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_loong64/koffi.node"(exports2, module2) {
237
237
  init_koffi9();
238
238
  try {
239
239
  module2.exports = __require(koffi_default9);
@@ -250,9 +250,9 @@ var init_koffi10 = __esm({
250
250
  }
251
251
  });
252
252
 
253
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node
253
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node
254
254
  var require_koffi10 = __commonJS2({
255
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node"(exports2, module2) {
255
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node"(exports2, module2) {
256
256
  init_koffi10();
257
257
  try {
258
258
  module2.exports = __require(koffi_default10);
@@ -269,9 +269,9 @@ var init_koffi11 = __esm({
269
269
  }
270
270
  });
271
271
 
272
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_x64/koffi.node
272
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_x64/koffi.node
273
273
  var require_koffi11 = __commonJS2({
274
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_x64/koffi.node"(exports2, module2) {
274
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/linux_x64/koffi.node"(exports2, module2) {
275
275
  init_koffi11();
276
276
  try {
277
277
  module2.exports = __require(koffi_default11);
@@ -288,9 +288,9 @@ var init_koffi12 = __esm({
288
288
  }
289
289
  });
290
290
 
291
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node
291
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node
292
292
  var require_koffi12 = __commonJS2({
293
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node"(exports2, module2) {
293
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node"(exports2, module2) {
294
294
  init_koffi12();
295
295
  try {
296
296
  module2.exports = __require(koffi_default12);
@@ -307,9 +307,9 @@ var init_koffi13 = __esm({
307
307
  }
308
308
  });
309
309
 
310
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/openbsd_x64/koffi.node
310
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/openbsd_x64/koffi.node
311
311
  var require_koffi13 = __commonJS2({
312
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/openbsd_x64/koffi.node"(exports2, module2) {
312
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/openbsd_x64/koffi.node"(exports2, module2) {
313
313
  init_koffi13();
314
314
  try {
315
315
  module2.exports = __require(koffi_default13);
@@ -326,9 +326,9 @@ var init_koffi14 = __esm({
326
326
  }
327
327
  });
328
328
 
329
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_arm64/koffi.node
329
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_arm64/koffi.node
330
330
  var require_koffi14 = __commonJS2({
331
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_arm64/koffi.node"(exports2, module2) {
331
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_arm64/koffi.node"(exports2, module2) {
332
332
  init_koffi14();
333
333
  try {
334
334
  module2.exports = __require(koffi_default14);
@@ -345,9 +345,9 @@ var init_koffi15 = __esm({
345
345
  }
346
346
  });
347
347
 
348
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_ia32/koffi.node
348
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_ia32/koffi.node
349
349
  var require_koffi15 = __commonJS2({
350
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_ia32/koffi.node"(exports2, module2) {
350
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_ia32/koffi.node"(exports2, module2) {
351
351
  init_koffi15();
352
352
  try {
353
353
  module2.exports = __require(koffi_default15);
@@ -364,9 +364,9 @@ var init_koffi16 = __esm({
364
364
  }
365
365
  });
366
366
 
367
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_x64/koffi.node
367
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_x64/koffi.node
368
368
  var require_koffi16 = __commonJS2({
369
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_x64/koffi.node"(exports2, module2) {
369
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/win32_x64/koffi.node"(exports2, module2) {
370
370
  init_koffi16();
371
371
  try {
372
372
  module2.exports = __require(koffi_default16);
@@ -383,9 +383,9 @@ var init_koffi17 = __esm({
383
383
  }
384
384
  });
385
385
 
386
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/musl_arm64/koffi.node
386
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/musl_arm64/koffi.node
387
387
  var require_koffi17 = __commonJS2({
388
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/musl_arm64/koffi.node"(exports2, module2) {
388
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/musl_arm64/koffi.node"(exports2, module2) {
389
389
  init_koffi17();
390
390
  try {
391
391
  module2.exports = __require(koffi_default17);
@@ -402,9 +402,9 @@ var init_koffi18 = __esm({
402
402
  }
403
403
  });
404
404
 
405
- // node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/musl_x64/koffi.node
405
+ // node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/musl_x64/koffi.node
406
406
  var require_koffi18 = __commonJS2({
407
- "node-file:/Users/petetaylor/projects/tasker-systems/tasker-core/workers/typescript/node_modules/koffi/build/koffi/musl_x64/koffi.node"(exports2, module2) {
407
+ "node-file:/home/runner/work/tasker-core/tasker-core/workers/typescript/node_modules/koffi/build/koffi/musl_x64/koffi.node"(exports2, module2) {
408
408
  init_koffi18();
409
409
  try {
410
410
  module2.exports = __require(koffi_default18);
@@ -2103,6 +2103,151 @@ function healthCheck(runtime) {
2103
2103
  }
2104
2104
  }
2105
2105
 
2106
+ // src/client/index.ts
2107
+ var TaskerClientError = class extends Error {
2108
+ /** Whether the error is potentially recoverable */
2109
+ recoverable;
2110
+ constructor(message, recoverable = false) {
2111
+ super(message);
2112
+ this.name = "TaskerClientError";
2113
+ this.recoverable = recoverable;
2114
+ }
2115
+ };
2116
+ var TaskerClient = class {
2117
+ ffiLayer;
2118
+ constructor(ffiLayer) {
2119
+ this.ffiLayer = ffiLayer;
2120
+ }
2121
+ /**
2122
+ * Create a task via the orchestration API.
2123
+ *
2124
+ * @param options - Task creation options (only `name` is required)
2125
+ * @returns Typed task response
2126
+ * @throws TaskerClientError if the operation fails
2127
+ */
2128
+ createTask(options) {
2129
+ const request = {
2130
+ name: options.name,
2131
+ namespace: options.namespace ?? "default",
2132
+ version: options.version ?? "1.0.0",
2133
+ context: options.context ?? {},
2134
+ initiator: options.initiator ?? "tasker-core-typescript",
2135
+ source_system: options.sourceSystem ?? "tasker-core",
2136
+ reason: options.reason ?? "Task requested",
2137
+ tags: options.tags ?? [],
2138
+ requested_at: (/* @__PURE__ */ new Date()).toISOString(),
2139
+ options: null,
2140
+ priority: options.priority ?? null,
2141
+ correlation_id: options.correlationId ?? crypto.randomUUID(),
2142
+ parent_correlation_id: options.parentCorrelationId ?? null,
2143
+ idempotency_key: options.idempotencyKey ?? null
2144
+ };
2145
+ const result = this.getRuntime().clientCreateTask(JSON.stringify(request));
2146
+ return this.unwrap(result);
2147
+ }
2148
+ /**
2149
+ * Get a task by UUID.
2150
+ *
2151
+ * @param taskUuid - The task UUID
2152
+ * @returns Typed task response
2153
+ * @throws TaskerClientError if the operation fails
2154
+ */
2155
+ getTask(taskUuid) {
2156
+ const result = this.getRuntime().clientGetTask(taskUuid);
2157
+ return this.unwrap(result);
2158
+ }
2159
+ /**
2160
+ * List tasks with optional filtering and pagination.
2161
+ *
2162
+ * @param options - Filtering and pagination options
2163
+ * @returns Typed task list response with pagination
2164
+ * @throws TaskerClientError if the operation fails
2165
+ */
2166
+ listTasks(options = {}) {
2167
+ const params = {
2168
+ limit: options.limit ?? 50,
2169
+ offset: options.offset ?? 0,
2170
+ namespace: options.namespace ?? null,
2171
+ status: options.status ?? null
2172
+ };
2173
+ const result = this.getRuntime().clientListTasks(JSON.stringify(params));
2174
+ return this.unwrap(result);
2175
+ }
2176
+ /**
2177
+ * Cancel a task by UUID.
2178
+ *
2179
+ * @param taskUuid - The task UUID
2180
+ * @throws TaskerClientError if the operation fails
2181
+ */
2182
+ cancelTask(taskUuid) {
2183
+ const result = this.getRuntime().clientCancelTask(taskUuid);
2184
+ this.unwrap(result);
2185
+ }
2186
+ /**
2187
+ * List workflow steps for a task.
2188
+ *
2189
+ * @param taskUuid - The task UUID
2190
+ * @returns Array of typed step responses
2191
+ * @throws TaskerClientError if the operation fails
2192
+ */
2193
+ listTaskSteps(taskUuid) {
2194
+ const result = this.getRuntime().clientListTaskSteps(taskUuid);
2195
+ return this.unwrap(result);
2196
+ }
2197
+ /**
2198
+ * Get a specific workflow step.
2199
+ *
2200
+ * @param taskUuid - The task UUID
2201
+ * @param stepUuid - The step UUID
2202
+ * @returns Typed step response
2203
+ * @throws TaskerClientError if the operation fails
2204
+ */
2205
+ getStep(taskUuid, stepUuid) {
2206
+ const result = this.getRuntime().clientGetStep(taskUuid, stepUuid);
2207
+ return this.unwrap(result);
2208
+ }
2209
+ /**
2210
+ * Get audit history for a workflow step.
2211
+ *
2212
+ * @param taskUuid - The task UUID
2213
+ * @param stepUuid - The step UUID
2214
+ * @returns Array of typed audit history entries
2215
+ * @throws TaskerClientError if the operation fails
2216
+ */
2217
+ getStepAuditHistory(taskUuid, stepUuid) {
2218
+ const result = this.getRuntime().clientGetStepAuditHistory(taskUuid, stepUuid);
2219
+ return this.unwrap(result);
2220
+ }
2221
+ /**
2222
+ * Check orchestration API health.
2223
+ *
2224
+ * @returns Typed health response
2225
+ * @throws TaskerClientError if the operation fails
2226
+ */
2227
+ healthCheck() {
2228
+ const result = this.getRuntime().clientHealthCheck();
2229
+ return this.unwrap(result);
2230
+ }
2231
+ /**
2232
+ * Unwrap a ClientResult envelope, throwing on error.
2233
+ */
2234
+ unwrap(result) {
2235
+ if (!result.success) {
2236
+ throw new TaskerClientError(
2237
+ result.error ?? "Unknown client error",
2238
+ result.recoverable ?? false
2239
+ );
2240
+ }
2241
+ return result.data;
2242
+ }
2243
+ /**
2244
+ * Get the FFI runtime from the layer.
2245
+ */
2246
+ getRuntime() {
2247
+ return this.ffiLayer.getRuntime();
2248
+ }
2249
+ };
2250
+
2106
2251
  // src/events/event-names.ts
2107
2252
  var StepEventNames = {
2108
2253
  /** Emitted when a step execution event is received from the FFI layer */
@@ -7865,6 +8010,6 @@ var WorkerServer = class {
7865
8010
  }
7866
8011
  };
7867
8012
 
7868
- export { APIMixin, ApiHandler, ApiResponse, BasePublisher, BaseSubscriber, BaseTaskerRuntime, BatchableMixin, BunRuntime, ClassLookupResolver, DecisionHandler, DecisionMixin, DecisionType, DefaultPublisher, DenoRuntime, DuplicatePublisherError, ErrorType, EventNames, EventPoller, EventSystem, ExplicitMappingResolver, FfiLayer, HandlerRegistry, HandlerSystem, InProcessDomainEventPoller, MethodDispatchError, MethodDispatchWrapper, MetricsEventNames, NoResolverMatchError, NodeRuntime, PollerEventNames, PublisherNotFoundError, PublisherRegistry, PublisherValidationError, RegistryFrozenError, RegistryResolver, ResolutionError, ResolverChain, ResolverNotFoundError, ShutdownController, StepContext, StepEventNames, StepExecutionSubscriber, StepHandler, StepHandlerResult, SubscriberRegistry, TaskerEventEmitter, WorkerEventNames, WorkerServer, aggregateBatchResults, applyAPI, applyBatchable, applyDecision, bootstrapWorker, createBatchWorkerContext, createBatches, createDomainEvent, createEventPoller, createFfiPollAdapter, createLogger, createStepEventContext, detectRuntime, effectiveMethod, ffiEventToDomainEvent, fromCallable, fromDto, getLibraryPath, getRuntimeInfo, getRustVersion, getVersion, getWorkerStatus, hasResolverHint, healthCheck, isBun, isCreateBatches, isDeno, isNoBatches, isNode, isStandardErrorType, isTypicallyRetryable, isWorkerRunning, logDebug, logError, logInfo, logTrace, logWarn, noBatches, normalizeToDefinition, stopWorker, transitionToGracefulShutdown, usesMethodDispatch };
8013
+ export { APIMixin, ApiHandler, ApiResponse, BasePublisher, BaseSubscriber, BaseTaskerRuntime, BatchableMixin, BunRuntime, ClassLookupResolver, DecisionHandler, DecisionMixin, DecisionType, DefaultPublisher, DenoRuntime, DuplicatePublisherError, ErrorType, EventNames, EventPoller, EventSystem, ExplicitMappingResolver, FfiLayer, HandlerRegistry, HandlerSystem, InProcessDomainEventPoller, MethodDispatchError, MethodDispatchWrapper, MetricsEventNames, NoResolverMatchError, NodeRuntime, PollerEventNames, PublisherNotFoundError, PublisherRegistry, PublisherValidationError, RegistryFrozenError, RegistryResolver, ResolutionError, ResolverChain, ResolverNotFoundError, ShutdownController, StepContext, StepEventNames, StepExecutionSubscriber, StepHandler, StepHandlerResult, SubscriberRegistry, TaskerClient, TaskerClientError, TaskerEventEmitter, WorkerEventNames, WorkerServer, aggregateBatchResults, applyAPI, applyBatchable, applyDecision, bootstrapWorker, createBatchWorkerContext, createBatches, createDomainEvent, createEventPoller, createFfiPollAdapter, createLogger, createStepEventContext, detectRuntime, effectiveMethod, ffiEventToDomainEvent, fromCallable, fromDto, getLibraryPath, getRuntimeInfo, getRustVersion, getVersion, getWorkerStatus, hasResolverHint, healthCheck, isBun, isCreateBatches, isDeno, isNoBatches, isNode, isStandardErrorType, isTypicallyRetryable, isWorkerRunning, logDebug, logError, logInfo, logTrace, logWarn, noBatches, normalizeToDefinition, stopWorker, transitionToGracefulShutdown, usesMethodDispatch };
7869
8014
  //# sourceMappingURL=index.js.map
7870
8015
  //# sourceMappingURL=index.js.map