{"_id":"@a3s-lab/flow","name":"@a3s-lab/flow","dist-tags":{"latest":"0.3.4"},"versions":{"0.3.4":{"name":"@a3s-lab/flow","version":"0.3.4","description":"Node.js bindings for A3S Flow workflow engine","main":"index.js","types":"index.d.ts","keywords":["workflow","dag","agent","ai","automation","napi-rs","rust"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/A3S-Lab/Flow.git"},"napi":{"name":"a3s-flow","triples":{"defaults":true,"additional":["x86_64-unknown-linux-musl","aarch64-unknown-linux-gnu","aarch64-unknown-linux-musl","aarch64-apple-darwin","aarch64-pc-windows-msvc"]}},"engines":{"node":">= 10"},"scripts":{"build":"napi build --platform --release --js index.js --dts index.d.ts","build:debug":"napi build --platform --js index.js --dts index.d.ts","prepublishOnly":"napi prepublish -t npm","version":"napi version"},"devDependencies":{"@napi-rs/cli":"^2.18.0"},"optionalDependencies":{"@a3s-lab/flow-win32-x64-msvc":"0.3.3","@a3s-lab/flow-darwin-x64":"0.3.3","@a3s-lab/flow-darwin-arm64":"0.3.3","@a3s-lab/flow-linux-x64-gnu":"0.3.3","@a3s-lab/flow-linux-x64-musl":"0.3.3","@a3s-lab/flow-linux-arm64-gnu":"0.3.3","@a3s-lab/flow-linux-arm64-musl":"0.3.3"},"_id":"@a3s-lab/flow@0.3.4","gitHead":"4fc5285aa3a32d7d66b9d9a110dc1d7d881d055a","bugs":{"url":"https://github.com/A3S-Lab/Flow/issues"},"homepage":"https://github.com/A3S-Lab/Flow#readme","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-ke+ZWINuU3aGJK1gRbsJVJRjOofF/v4HcpKHaIc8oB0mCMx1Ct47oLdfP4YmKWUVk8PFEAUffxofHD7piTPolg==","shasum":"1b6db09db9ec52e82a016f53b432205613e2a339","tarball":"https://registry.npmjs.org/@a3s-lab/flow/-/flow-0.3.4.tgz","fileCount":56,"unpackedSize":265995184,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD2eXlep9bHd7j01Yb2pF6ZPJ3rf6rJj6ZsVxjZjo3PDwIgPL/8zkkIQzP97FgnC/fJaqZqS7oiAInaoqtx5Z0RVJI="}]},"_npmUser":{"name":"linzhixiao","email":"18770221825@163.com"},"directories":{},"maintainers":[{"name":"linzhixiao","email":"18770221825@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/flow_0.3.4_1773236710620_0.22255431199716313"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-11T13:45:10.547Z","0.3.4":"2026-03-11T13:45:15.242Z","modified":"2026-03-11T13:45:15.495Z"},"maintainers":[{"name":"linzhixiao","email":"18770221825@163.com"}],"description":"Node.js bindings for A3S Flow workflow engine","homepage":"https://github.com/A3S-Lab/Flow#readme","keywords":["workflow","dag","agent","ai","automation","napi-rs","rust"],"repository":{"type":"git","url":"git+https://github.com/A3S-Lab/Flow.git"},"bugs":{"url":"https://github.com/A3S-Lab/Flow/issues"},"license":"MIT","readme":"# A3S Flow Node.js SDK\n\nNode.js bindings for the A3S Flow workflow engine, with full TypeScript support.\n\n## Installation\n\n```bash\nnpm install @a3s-lab/flow\n```\n\n## Quick Start\n\n```typescript\nimport { FlowEngine } from '@a3s-lab/flow';\n\n// Create a flow engine\nconst engine = new FlowEngine();\n\n// Define a simple workflow\nconst definition = {\n  nodes: [\n    { id: 'start', type: 'noop' },\n    { id: 'process', type: 'noop' }\n  ],\n  edges: [\n    { source: 'start', target: 'process' }\n  ]\n};\n\n// Start the flow\nconst executionId = await engine.start(definition, {});\n\n// Check the state\nconst state = await engine.state(executionId);\nconsole.log(`Status: ${state.status}`);\n\n// Pause and resume\nawait engine.pause(executionId);\nawait engine.resume(executionId);\n\n// Terminate\nawait engine.terminate(executionId);\n```\n\n## API Reference\n\n### `FlowEngine`\n\n#### `new FlowEngine()`\nCreate a new flow engine with default built-in nodes.\n\n#### `start(definition: object, variables?: object): Promise<string>`\nStart a new flow execution.\n- `definition`: Flow definition with `nodes` and `edges`\n- `variables`: Initial variables (optional)\n- Returns: Execution ID as a string\n\n#### `pause(executionId: string): Promise<void>`\nPause a running flow execution.\n\n#### `resume(executionId: string): Promise<void>`\nResume a paused flow execution.\n\n#### `terminate(executionId: string): Promise<void>`\nTerminate a running flow execution.\n\n#### `state(executionId: string): Promise<ExecutionState>`\nGet the current state of a flow execution.\n\n#### `nodeTypes(): string[]`\nList all registered node types.\n\n### `ExecutionState`\n\n```typescript\ninterface ExecutionState {\n  status: 'running' | 'paused' | 'completed' | 'failed' | 'terminated';\n  result?: FlowResult;  // present when status is \"completed\"\n  error?: string;       // present when status is \"failed\"\n}\n```\n\n### `FlowResult`\n\n```typescript\ninterface FlowResult {\n  executionId: string;\n  outputs: Record<string, unknown>;\n  completedNodes: string[];\n  skippedNodes: string[];\n  context: Record<string, unknown>;\n}\n```\n\n### `FlowEvent`\n\n```typescript\ninterface FlowEvent {\n  eventType: 'flow_started' | 'node_started' | 'node_completed' | 'node_skipped' | 'node_failed' | 'flow_completed' | 'flow_failed' | 'flow_terminated';\n  executionId: string;\n  nodeId?: string;\n  output?: unknown;\n  error?: string;\n}\n```\n\n## Development\n\n### Build from source\n\n```bash\ncd sdk/node\nnpm install\nnpm run build:debug\n```\n\n### Run tests\n\n```bash\nnpm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-dc19e533c5590c09a1c7217818756f68"}