@tasker-systems/tasker
v0.1.8
Published
TypeScript worker for tasker-core workflow orchestration
Maintainers
Readme
@tasker-systems/tasker
TypeScript worker for the Tasker workflow orchestration system. Uses napi-rs native addons for high-performance FFI to the shared Rust worker infrastructure. Supports Bun (primary) and Node.js runtimes.
Installation
# Bun (recommended)
bun add @tasker-systems/tasker
# Node.js
npm install @tasker-systems/taskerQuick Start
import { WorkerServer, StepHandler, type StepContext, type StepHandlerResult } from "@tasker-systems/tasker";
// Define a step handler
class ProcessPaymentHandler extends StepHandler {
static handlerName = "process_payment";
static handlerVersion = "1.0.0";
async call(context: StepContext): Promise<StepHandlerResult> {
const amount = context.getInput<number>("amount");
// ... business logic ...
return this.success({ amount, status: "processed" });
}
}
// Create and start the worker server
const server = new WorkerServer();
await server.start({ namespace: "default" });
// Register handlers
const handlerSystem = server.getHandlerSystem();
handlerSystem.register(ProcessPaymentHandler.handlerName, ProcessPaymentHandler);
// Server is now processing tasks — shut down gracefully on exit
process.on("SIGINT", () => server.shutdown());Handler Types
| Type | Use Case |
|------|----------|
| StepHandler | General-purpose step execution |
| ApiHandler | HTTP API integration with automatic error classification |
| DecisionHandler | Dynamic workflow routing |
| BatchableStepHandler | Large dataset processing in chunks |
Development
Prerequisites
- Bun 1.0+ (recommended) or Node.js 18+
- Rust 1.70+ (for building the napi-rs native addon)
Build
bun install # Install dependencies
bun run build:napi # Build napi-rs native addon (debug)
bun run build # Build TypeScript
bun test # Run tests
bun run typecheck # Type checking
bun run check # Lint (Biome)Documentation
- TypeScript Worker Guide — full API reference, handler patterns, event system, configuration
- Example App (Bun + Hono) — production-style example with multiple handler types
License
MIT
