@getenki/ai-darwin-arm64 0.4.15 → 0.5.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.
package/README.md CHANGED
@@ -20,6 +20,7 @@ The current package surface is:
20
20
 
21
21
  - `NativeEnkiAgent`
22
22
  - `NativeMultiAgentRuntime`
23
+ - `NativeWorkflowRuntime`
23
24
  - `JsAgentStatus`
24
25
  - `JsMemoryKind`
25
26
  - `JsMemoryModule`
@@ -43,6 +44,16 @@ The current package surface is:
43
44
  - `registry(...)`
44
45
  - `discover(...)`
45
46
 
47
+ `NativeWorkflowRuntime` supports:
48
+
49
+ - `new(...)`
50
+ - `listWorkflowsJson(...)`
51
+ - `listRunsJson(...)`
52
+ - `inspectJson(...)`
53
+ - `startJson(...)`
54
+ - `resumeJson(...)`
55
+ - `submitInterventionJson(...)`
56
+
46
57
  ## Basic Agent
47
58
 
48
59
  Use the constructor when you only need a session-based agent backed by the native runtime.
@@ -292,6 +303,107 @@ const recordHandler = (
292
303
  }
293
304
  ```
294
305
 
306
+ ## Workflow Runtime
307
+
308
+ Use `NativeWorkflowRuntime` when you want to register workflow agents plus JSON task and workflow definitions directly from Node.js.
309
+
310
+ ```js
311
+ const { NativeEnkiAgent, NativeWorkflowRuntime } = require('@getenki/ai')
312
+
313
+ const researcher = new NativeEnkiAgent(
314
+ 'Researcher',
315
+ 'Return short factual notes.',
316
+ 'ollama::qwen3.5:latest',
317
+ 4,
318
+ './.enki',
319
+ )
320
+ researcher.configureWorkflow('researcher', ['research'])
321
+
322
+ const writer = new NativeEnkiAgent(
323
+ 'Writer',
324
+ 'Turn notes into a concise summary.',
325
+ 'ollama::qwen3.5:latest',
326
+ 4,
327
+ './.enki',
328
+ )
329
+ writer.configureWorkflow('writer', ['writing'])
330
+
331
+ const runtime = new NativeWorkflowRuntime(
332
+ [researcher, writer],
333
+ [
334
+ JSON.stringify({
335
+ id: 'research_topic',
336
+ target: { type: 'capabilities', value: ['research'] },
337
+ prompt: 'Research {{topic}} and return 3 concise bullet points.',
338
+ input_bindings: { topic: 'input.topic' },
339
+ }),
340
+ JSON.stringify({
341
+ id: 'write_summary',
342
+ target: { type: 'agent_id', value: 'writer' },
343
+ prompt: 'Write a short summary for {{topic}} using {{research.content}}',
344
+ input_bindings: {
345
+ topic: 'input.topic',
346
+ research: 'research',
347
+ },
348
+ }),
349
+ ],
350
+ [
351
+ JSON.stringify({
352
+ id: 'research-to-summary',
353
+ name: 'Research To Summary',
354
+ nodes: [
355
+ { id: 'research', kind: 'task', task_id: 'research_topic', output_key: 'research' },
356
+ { id: 'summary', kind: 'task', task_id: 'write_summary', output_key: 'summary' },
357
+ ],
358
+ edges: [{ from: 'research', to: 'summary', transition: { type: 'always' } }],
359
+ }),
360
+ ],
361
+ './.enki',
362
+ )
363
+
364
+ const response = JSON.parse(
365
+ await runtime.startJson(
366
+ JSON.stringify({
367
+ workflow_id: 'research-to-summary',
368
+ input: { topic: 'workflow bindings in enki-js' },
369
+ }),
370
+ ),
371
+ )
372
+
373
+ const persisted = JSON.parse(await runtime.inspectJson(response.run_id))
374
+ console.log(persisted.status)
375
+ ```
376
+
377
+ ## Human Intervention
378
+
379
+ Workflow runs persist pending interventions as part of the run state, so approvals and failure escalations can pause and resume without moving state into a separate coordinator service.
380
+
381
+ Each pending intervention includes:
382
+
383
+ - `workflow_id`
384
+ - `run_id`
385
+ - `node_id`
386
+ - `prompt`
387
+ - `reason`
388
+ - `response`
389
+ - `created_at` and `resolved_at`
390
+
391
+ Two built-in patterns are supported:
392
+
393
+ - `human_gate` nodes pause immediately and wait for a human response
394
+ - task nodes with `failure_policy: "pause_for_intervention"` convert a terminal failure into an intervention asking the human to `retry`, `skip`, `continue`, or `fail`
395
+
396
+ The runnable TypeScript example is [`example/basic-ts/human-intervention-workflow.ts`](/I:/projects/enki/core-next/example/basic-ts/human-intervention-workflow.ts). It demonstrates:
397
+
398
+ - a `human_gate` approval flow that pauses, resolves, and resumes to `approval.approved = true`
399
+ - a missing-agent failure that pauses for intervention and resumes after a `skip` response
400
+
401
+ The runtime interaction loop is:
402
+
403
+ 1. `startJson(...)` returns a paused workflow response
404
+ 2. `inspectJson(runId)` exposes `pending_interventions`
405
+ 3. `submitInterventionJson(runId, interventionId, response)` resolves the intervention
406
+ 4. `resumeJson(runId)` continues the persisted run
295
407
  ## Tools And Memory Example
296
408
 
297
409
  The repository examples in [`example/basic-js/index.js`](/I:/projects/enki/core-next/example/basic-js/index.js) and [`example/basic-ts/index.ts`](/I:/projects/enki/core-next/example/basic-ts/index.ts) use `NativeEnkiAgent.withToolsAndMemory(...)` with:
@@ -461,3 +573,5 @@ Useful scripts:
461
573
  - `npm test`: run the AVA test suite
462
574
  - `npm run lint`: run `oxlint`
463
575
  - `npm run format`: run Prettier, `cargo fmt`, and `taplo format`
576
+
577
+
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getenki/ai-darwin-arm64",
3
- "version": "0.4.15",
3
+ "version": "0.5.2",
4
4
  "cpu": [
5
5
  "arm64"
6
6
  ],