@automatalabs/workflows 0.27.0 → 0.27.1

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.
Files changed (2) hide show
  1. package/README.md +17 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -220,6 +220,10 @@ const manager = new WorkflowManager({ agent: createAcpRunner() });
220
220
 
221
221
  const run = await manager.runSync(script, { repo: "agentprism" }, { tokenBudget: 200_000 });
222
222
 
223
+ const background = manager.startInBackground(script, { repo: "agentprism" }, { tokenBudget: 200_000 });
224
+ console.log(background.runId, manager.getSnapshot(background.runId));
225
+ // background.promise resolves only on completion and rejects on pause/failure/abort.
226
+
223
227
  const status = manager.inspectRun(run.runId, {
224
228
  lastN: 10,
225
229
  labelGlob: "review-*",
@@ -247,6 +251,19 @@ checkpoint unless the author opts in. `WorkflowManagerOptions` lets you set a de
247
251
  `loadSavedWorkflow` resolver (enables nested `workflow('name')`), a custom `persistence`
248
252
  implementation, and per-agent timeout/retry defaults.
249
253
 
254
+ `startInBackground(script, args?, exec?)` is detached only for the lifetime of this process and
255
+ returns `{ runId, promise: Promise<WorkflowRunResult> }`. The facade keeps an ACP event bridge for a
256
+ per-execution `exec.agent` until that promise settles, including rejection. Read live state with
257
+ `getRun()`, `getSnapshot()`, or `inspectRun()`, and subscribe to cumulative `tokenUsage` events while
258
+ work is running. Live attempts update `snapshot.tokenUsage` monotonically; replayed calls add zero.
259
+
260
+ When `exec.resumeJournal` is preloaded, the underlying manager sorts and copies the inherited prefix
261
+ into the child run before its fail-fast initial persistence. Cached replay does not re-emit journal
262
+ events, but every subsequent live suffix write persists the complete prefix. This makes each new
263
+ background run ID independently resumable across multiple pause/resume hops. Process loss can stop
264
+ in-flight work; the next manager recovers a stale durable `running` record to `paused`, and an
265
+ unjournaled in-flight call may run again.
266
+
250
267
  `inspectRun(runId, options?)` is inherited through this facade and returns the shared
251
268
  `WorkflowRunStatus` without importing `@automatalabs/workflow-engine`. It reads the freshest live
252
269
  snapshot first and project-scoped persistence second, never executes the script or acquires a run
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automatalabs/workflows",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "license": "Apache-2.0",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@automatalabs/shared-types": "0.17.0",
34
- "@automatalabs/workflow-engine": "0.16.0",
34
+ "@automatalabs/workflow-engine": "0.17.0",
35
35
  "@automatalabs/acp-agents": "0.24.8"
36
36
  },
37
37
  "devDependencies": {