@automatalabs/workflows 0.33.1 → 0.35.0
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 +103 -24
- package/dist/index.d.ts +55 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ Options (`RunDynamicWorkflowOptions`):
|
|
|
97
97
|
| `args` | `unknown` | The value handed to the script's `args` global. |
|
|
98
98
|
| `cwd` | `string` | Base working directory for the run (e.g. the project root): every subagent session runs here (a per-agent `agent({ cwd })` or worktree isolation overrides it), worktrees branch from it, and `agentType` definitions are scanned from it. Omitted ⇒ `process.cwd()`. |
|
|
99
99
|
| `runner` | `AgentRunner` | Swap the backend (or stub it in tests). Omitted ⇒ `createAcpRunner()`. |
|
|
100
|
-
| `exec` | `ExecOptions` | Per-run controls forwarded to the manager: `tokenBudget`, `agentTimeoutMs`, `concurrency`, `agentRetries`, `signal`, `onProgress`, `confirm`, `checkpointReplies`, … |
|
|
100
|
+
| `exec` | `ExecOptions` | Per-run controls forwarded to the manager: `tokenBudget`, `agentTimeoutMs`, `concurrency`, `agentRetries`, `signal`, `onProgress`, `confirm`, `resumeFromRunId`, `resumePolicy`, `checkpointReplies`, … |
|
|
101
101
|
| `allowScriptBackends` | `boolean \| callback` | Approve the commands declared in `meta.backends`; declarations are inert without host approval. |
|
|
102
102
|
| `workflows` | `string \| string[] \| WorkflowDir` | Resolve the first argument and nested `workflow("name")` calls from one or more directories. |
|
|
103
103
|
|
|
@@ -116,6 +116,23 @@ Every script **must** begin with `export const meta = { name, description, phase
|
|
|
116
116
|
statement, and must be **deterministic** — `Date.now()`, `Math.random()`, and `new Date()` are
|
|
117
117
|
unavailable inside the realm (they would break journal replay on resume).
|
|
118
118
|
|
|
119
|
+
Replay-safe read-only/worktree fan-out is explicit:
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
const [audit, experiment] = await parallel([
|
|
123
|
+
() => agent("Audit src/api without changing files.", {
|
|
124
|
+
label: "audit:api", resume: { filesystem: "read-only" },
|
|
125
|
+
}),
|
|
126
|
+
() => agent("Try the worker fix in isolation; return a unified diff.", {
|
|
127
|
+
label: "try:worker", isolation: "worktree", resume: { filesystem: "read-only" },
|
|
128
|
+
}),
|
|
129
|
+
]);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The worktree and edits are discarded; return the diff as data. The declaration is required for
|
|
133
|
+
content-addressed reuse in both arms—worktree isolation alone is not a safety proof. See the
|
|
134
|
+
[incremental resume API](../../docs/api.md#content-addressed-incremental-resume).
|
|
135
|
+
|
|
119
136
|
### Substitution testing (isolation mode)
|
|
120
137
|
|
|
121
138
|
Record a normal managed run, then re-run its recorded script with one selected step live while all
|
|
@@ -258,6 +275,13 @@ if (run.status === "paused") {
|
|
|
258
275
|
const accepted = await manager.resume(run.runId);
|
|
259
276
|
console.log(accepted); // true when the paused run was accepted for resume
|
|
260
277
|
}
|
|
278
|
+
|
|
279
|
+
// Edited-script/current-args resume is a NEW managed run with a correspondence report.
|
|
280
|
+
const next = await manager.runSync(script, { repo: "agentprism", expanded: true }, {
|
|
281
|
+
resumeFromRunId: run.runId,
|
|
282
|
+
resumePolicy: "auto",
|
|
283
|
+
});
|
|
284
|
+
console.log(next.runId, next.resumeReport);
|
|
261
285
|
```
|
|
262
286
|
|
|
263
287
|
`runSync(script, args?, exec?)` always resolves to a terminal `WorkflowRunResult`. A run **pauses**
|
|
@@ -284,12 +308,21 @@ per-execution `exec.agent` until that promise settles, including rejection. Read
|
|
|
284
308
|
`getRun()`, `getSnapshot()`, or `inspectRun()`, and subscribe to cumulative `tokenUsage` events while
|
|
285
309
|
work is running. Live attempts update `snapshot.tokenUsage` monotonically; replayed calls add zero.
|
|
286
310
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
311
|
+
`exec.resumeFromRunId` asks the manager to admit a terminal source, persist a self-contained seed
|
|
312
|
+
under a new run ID, and match safe calls by exact path/hash or unique hash+input fingerprint.
|
|
313
|
+
Uncertain, ambiguous, unsafe, or environment-mismatched calls run live. Identity hits preserve
|
|
314
|
+
script-visible logical budget debit while adding zero current provider usage; replayed session
|
|
315
|
+
records are rebound to the current call index/label/phase. `resumePolicy: "positional"` requests
|
|
316
|
+
index/prefix matching but cannot bypass new-format input/safety/environment gates. The distinct
|
|
317
|
+
same-ID `resume()` and low-level `resumeJournal` paths remain permanently legacy positional and
|
|
318
|
+
emit no `resumeReport`. See the [full contract](../../docs/api.md#content-addressed-incremental-resume).
|
|
319
|
+
|
|
320
|
+
The manager's critical initial save contains the complete inherited seed before a background
|
|
321
|
+
acknowledgement. A manager-prepared `resumeFromRunId` hit re-journals the selected value under its
|
|
322
|
+
current target index; same-ID/manual legacy cache hits retain the historical no-journal-callback
|
|
323
|
+
behavior and rely on the already-seeded prefix. Each new run is independently resumable across
|
|
324
|
+
multiple pause/resume hops. Process loss can stop in-flight work; the next manager recovers a stale
|
|
325
|
+
durable `running` record to `paused`, and an unjournaled in-flight call may run again.
|
|
293
326
|
|
|
294
327
|
`inspectRun(runId, options?)` is inherited through this facade and returns the shared
|
|
295
328
|
`WorkflowRunStatus` without importing `@automatalabs/workflow-engine`. It reads the freshest live
|
|
@@ -303,18 +336,56 @@ execution results carry an immediate redacted final-20 `logTail`; completed resu
|
|
|
303
336
|
|
|
304
337
|
Manager events are Node `EventEmitter` notifications: `agentStart`, `agentEnd`, `agentHistory`,
|
|
305
338
|
`journal`, `tokenUsage`, `log`, `phase`, `complete`, `paused`, `resumed`, `stopped`, `error`,
|
|
306
|
-
and `agentEvent`.
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
`
|
|
310
|
-
|
|
311
|
-
discriminant name, while permission/elicitation/session/raw/backend events keep their runner
|
|
312
|
-
names.
|
|
339
|
+
and `agentEvent`. Their overloads infer exact payloads from `EngineRunEventPayloadMap` and
|
|
340
|
+
`WorkflowAgentEventPayloadMap`; `WorkflowRunEvent` is the exhaustive union when a host wants one
|
|
341
|
+
dispatcher. Every engine event carries the owning root `runId` and originating engine `scope`.
|
|
342
|
+
`journal` emits `{ runId, scope, entry }` for each live journal append, even when file journaling is
|
|
343
|
+
disabled via `journaling: false`.
|
|
313
344
|
|
|
314
345
|
```ts
|
|
315
|
-
|
|
346
|
+
import {
|
|
347
|
+
WorkflowManager,
|
|
348
|
+
createAcpRunner,
|
|
349
|
+
type EngineRunEventPayloadMap,
|
|
350
|
+
type WorkflowRunEvent,
|
|
351
|
+
} from "@automatalabs/workflows";
|
|
352
|
+
|
|
353
|
+
const manager = new WorkflowManager({ agent: createAcpRunner() });
|
|
354
|
+
|
|
355
|
+
const onAgentEnd = (event: EngineRunEventPayloadMap["agentEnd"]) => {
|
|
356
|
+
console.error(event.scope, event.callIndex, event.label, event.result);
|
|
357
|
+
};
|
|
358
|
+
manager.on("agentEnd", onAgentEnd); // the overload infers the same payload without annotation
|
|
359
|
+
|
|
360
|
+
const target = { scope: "build-abc-nested1", callIndex: 3 };
|
|
361
|
+
manager.on("agentEvent", (event) => {
|
|
362
|
+
if (event.scope === target.scope && event.callIndex === target.callIndex) {
|
|
363
|
+
renderAcpUpdate(event.name, event.event);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
function consumeEvent(event: WorkflowRunEvent): void {
|
|
368
|
+
switch (event.type) {
|
|
369
|
+
case "phase":
|
|
370
|
+
console.error(event.scope, event.title);
|
|
371
|
+
break;
|
|
372
|
+
case "agentEvent":
|
|
373
|
+
console.error(event.scope, event.callIndex, event.name);
|
|
374
|
+
break;
|
|
375
|
+
default:
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
316
379
|
```
|
|
317
380
|
|
|
381
|
+
`agentEvent` forwards the live ACP stream from an ACP-capable runner with `name`, `event`, and the
|
|
382
|
+
runner context fields (`runId`, `scope`, `callIndex`, `label`, `sessionId`, `backendId`) when present.
|
|
383
|
+
`scope` repeats the runner's originating engine `runId`, so nested calls filter directly on
|
|
384
|
+
`(scope, callIndex)`. Direct runner/interactive sessions can omit `callIndex`; `backend_error` is
|
|
385
|
+
connection-scoped and carries `backendId` only. ACP `session/update` traffic is emitted once under
|
|
386
|
+
its inner discriminant name, while permission/elicitation/session/raw/backend events keep their
|
|
387
|
+
runner names.
|
|
388
|
+
|
|
318
389
|
Every live ACP-backed `agent()` call records a non-secret re-attach handle in
|
|
319
390
|
`run.agentSessions`. Set `agent(..., { keepSession: true })` to skip release-time `session/close`,
|
|
320
391
|
then use the runner's `loadSession()` or `resumeSession()` host API with that record. Session
|
|
@@ -388,9 +459,9 @@ Semantics worth knowing:
|
|
|
388
459
|
script resolves from the same view. (Without it, `runDynamicWorkflow` has no saved-workflow
|
|
389
460
|
resolver and nested names cannot resolve.) A top-level string containing `export const meta`
|
|
390
461
|
is always treated as a verbatim script, never a name.
|
|
391
|
-
- **Versioning is git's job.**
|
|
392
|
-
|
|
393
|
-
|
|
462
|
+
- **Versioning is git's job.** Same-ID `resume()` reloads the exact persisted script. A new
|
|
463
|
+
`resumeFromRunId` execution can use an edited script: changed calls run live, while uniquely
|
|
464
|
+
matching safety-marked calls may move and replay after admission.
|
|
394
465
|
- **`resolve()` validates name shape strictly** (one flat path segment) — inline nested scripts
|
|
395
466
|
fall through to verbatim parsing, and path traversal out of the configured dirs is impossible.
|
|
396
467
|
|
|
@@ -441,16 +512,18 @@ await runner.dispose();
|
|
|
441
512
|
| `backend_error` | `{ backendId, error }` — a pooled backend process crashed |
|
|
442
513
|
|
|
443
514
|
**Context envelope.** A pooled runner multiplexes many concurrent runs over one process, so every
|
|
444
|
-
event (except `backend_error`) carries `{ sessionId, backendId, label?, runId? }
|
|
445
|
-
`
|
|
515
|
+
event (except `backend_error`) carries `{ sessionId, backendId, label?, runId?, callIndex? }`.
|
|
516
|
+
`callIndex` echoes the optional `RunOptions.callIndex` used to open the session and is never sent on
|
|
517
|
+
the ACP wire. Engine-created calls supply it; direct/interactive runner callers may omit it.
|
|
446
518
|
|
|
447
519
|
**Best-effort.** Listeners are observers: a throwing listener is isolated and never breaks the run,
|
|
448
520
|
the update drain, or sibling listeners.
|
|
449
521
|
|
|
450
522
|
**With `runDynamicWorkflow` / `WorkflowManager`.** Subscribe at the manager layer:
|
|
451
|
-
`manager.on("agentEvent", ({
|
|
452
|
-
script then streams live ACP events through the manager;
|
|
453
|
-
|
|
523
|
+
`manager.on("agentEvent", ({ scope, callIndex, name, event }) => …)`. Every `agent()` call in the
|
|
524
|
+
script then streams live ACP events through the manager; the bridge sets `scope = runId` and repeats
|
|
525
|
+
the optional `callIndex` for direct call filtering. ACP `session/update` traffic is forwarded once
|
|
526
|
+
under `name = event.sessionUpdate`, so hosts do not receive both the catch-all and the
|
|
454
527
|
per-discriminant runner event.
|
|
455
528
|
|
|
456
529
|
---
|
|
@@ -465,7 +538,7 @@ ships no runtime code).
|
|
|
465
538
|
|
|
466
539
|
| global | what it does |
|
|
467
540
|
|--------|--------------|
|
|
468
|
-
| `agent(prompt, options?)` | Run ONE subagent to completion; returns its result (text, or the validated object with `options.schema`). |
|
|
541
|
+
| `agent(prompt, options?)` | Run ONE subagent to completion; returns its result (text, or the validated object with `options.schema`). `options.resume: { filesystem: "read-only" }` is the author safety declaration for content-addressed replay. |
|
|
469
542
|
| `parallel(thunks)` | Run an array of **thunks** (`() => Promise`) concurrently; resolves in input order. |
|
|
470
543
|
| `pipeline(items, ...stages)` | Map `items` through sequential async stages, concurrently across items. |
|
|
471
544
|
| `workflow(nameOrScript, args?)` | Run a saved (or inline) workflow nested in this run, sharing its limiter/budget. |
|
|
@@ -659,6 +732,8 @@ fabricateFromSchema, // the dry run's JSON-Schema value fabricator
|
|
|
659
732
|
formatValidateReport, // render a ValidateWorkflowReport as CLI text
|
|
660
733
|
openWorkflowDir, // read-only view over folders of workflow scripts (name = filename stem)
|
|
661
734
|
WorkflowManager, // stateful / resumable run manager
|
|
735
|
+
RESUME_FALLBACK_REASONS, RESUME_DISABLED_REASONS,
|
|
736
|
+
RESUME_CALL_LIVE_REASONS, RESUME_CALL_FAILED_REASONS,
|
|
662
737
|
|
|
663
738
|
// ── ACP backend ──
|
|
664
739
|
createAcpRunner, // () => AcpAgentRunner (the default AgentRunner; has .on(...) events)
|
|
@@ -689,6 +764,10 @@ ValidateWorkflowOptions, ValidateWorkflowReport, ValidateHarnessOptions,
|
|
|
689
764
|
ValidatedAgentCall, ValidatedCheckpoint,
|
|
690
765
|
WorkflowManagerOptions, CheckpointOptions, WorkflowRunResult, WorkflowRunFallback,
|
|
691
766
|
WorkflowCheckpointTaken, WorkflowCheckpointSource, WorkflowSnapshot,
|
|
767
|
+
ResumePolicy, WorkflowResumeStrategy, WorkflowResumeMatch, WorkflowResumeSafety,
|
|
768
|
+
WorkflowResumeFallbackReason, WorkflowResumeDisabledReason,
|
|
769
|
+
WorkflowResumeCallLiveReason, WorkflowResumeCallFailedReason,
|
|
770
|
+
WorkflowCallReplayProvenance, WorkflowResumeCallDecision, WorkflowResumeReport,
|
|
692
771
|
WorkflowPathOptions, RunPersistence, RunPersistenceOptions,
|
|
693
772
|
AcpPoolOptions, AcpRunnerOptions, AgentRunner, RunOptions, AgentResult, AgentUsage, JournalEntry,
|
|
694
773
|
AgentSessionRef, AgentSessionRecord, WorkflowBackendConfig, WorkflowCallRecord, WorkflowRecordedError,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { WorkflowManager as EngineWorkflowManager } from "@automatalabs/workflow-engine";
|
|
2
2
|
import type { AcpEventName, AcpRunnerEventMap } from "@automatalabs/acp-agents";
|
|
3
3
|
import type { ExecOptions, WorkflowDir, WorkflowManagerOptions } from "@automatalabs/workflow-engine";
|
|
4
|
-
import type { AgentRunner, WorkflowRunResult } from "@automatalabs/shared-types";
|
|
4
|
+
import type { AgentRunner, RunEvent, WorkflowRunResult } from "@automatalabs/shared-types";
|
|
5
5
|
import { type ScriptBackendApproval } from "./script-backends.js";
|
|
6
|
-
export { runWorkflow, parseWorkflowScript, redactText, truncateUtf8 } from "@automatalabs/workflow-engine";
|
|
6
|
+
export { runWorkflow, parseWorkflowScript, hashCheckpointInputs, redactText, truncateUtf8, CALL_PATH_FORMAT, CALL_INPUTS_FORMAT, CHECKPOINT_INPUTS_FORMAT, RESUME_FALLBACK_REASONS, RESUME_DISABLED_REASONS, RESUME_CALL_LIVE_REASONS, RESUME_CALL_FAILED_REASONS, } from "@automatalabs/workflow-engine";
|
|
7
7
|
export { runIsolation, createReplayRunner, type RunIsolationSdkOptions } from "./isolation.js";
|
|
8
8
|
export type { RunIsolationOptions, IsolationRunResult, ReplayRunnerOptions, ResolvedIsolationTarget, IsolationTarget, ReplayRunner, ReplayObservation, ReplayReport, ReplayCallReport, ReplayDivergenceEvent, CheckpointCallContext, WorkflowCallRecord, WorkflowRecordedError, } from "./isolation.js";
|
|
9
9
|
export { openWorkflowDir, type WorkflowDir, type WorkflowDirEntry, type OpenWorkflowDirOptions, } from "@automatalabs/workflow-engine";
|
|
10
10
|
export { validateWorkflowScript, fabricateFromSchema, formatValidateReport, MOCK_TOKENS_PER_AGENT } from "./validate.js";
|
|
11
11
|
export type { MockAnswerJson, MockAnswerRule, MockAnswers, MockAnswerSequence, UnusedMockAnswer, ValidateWorkflowOptions, ValidateWorkflowReport, ValidateHarnessOptions, ValidatedAgentCall, ValidatedCheckpoint, ValidatedMockAnswerRule, ValidatedMockAnswers, ValidatedMockAnswerUse, } from "./validate.js";
|
|
12
|
-
export type { WorkflowRunOptions, AgentOptions, ExecOptions, WorkflowManagerOptions, CheckpointOptions, WorkflowRunResult, WorkflowSnapshot, WorkflowPathOptions, RunPersistence, RunPersistenceOptions, PersistedRunState, PersistedAgentState, WorkflowLogTail, WorkflowRunCallStatus, WorkflowRunInspectionOptions, WorkflowRunStatus, WorkflowRunStatusTruncation, WorkflowRunFallback, WorkflowCheckpointSource, WorkflowCheckpointTaken, } from "@automatalabs/workflow-engine";
|
|
12
|
+
export type { WorkflowRunOptions, AgentOptions, ExecOptions, WorkflowManagerOptions, CheckpointOptions, WorkflowRunResult, WorkflowSnapshot, WorkflowPathOptions, RunPersistence, RunPersistenceOptions, PersistedRunState, PersistedAgentState, PersistedResumeFormat, PersistedResumeCandidate, PersistedCheckpointInjection, PersistedResumeSeed, PreparedResume, WorkflowLogTail, WorkflowRunCallStatus, WorkflowRunInspectionOptions, WorkflowRunStatus, WorkflowRunStatusTruncation, WorkflowRunFallback, WorkflowCheckpointSource, WorkflowCheckpointTaken, ResumePolicy, WorkflowResumeStrategy, WorkflowResumeMatch, WorkflowResumeFallbackReason, WorkflowResumeDisabledReason, WorkflowResumeCallLiveReason, WorkflowResumeCallFailedReason, WorkflowResumeSafety, WorkflowCallReplayProvenance, WorkflowResumeCallDecision, WorkflowResumeReport, } from "@automatalabs/workflow-engine";
|
|
13
13
|
export { AGENTPRISM_PERSISTENCE_ROOT_ENV, WorkflowError, WorkflowErrorCode, isWorkflowError, isProviderUsageLimit, isAuthRequired, } from "@automatalabs/workflow-engine";
|
|
14
|
+
export { withRunEvents, RunEventLogError, RUN_EVENT_READ_LIMIT_DEFAULT, RUN_EVENT_READ_LIMIT_MAX, RUN_EVENT_MAX_RECORD_BYTES, } from "@automatalabs/workflow-engine";
|
|
15
|
+
export type { RunEventPersistence, RunEventStream, AppendRunEventInput, ReadRunEventsOptions, ReadRunEventsResult, WatchRunEventsOptions, RunEventLogErrorCode, } from "@automatalabs/workflow-engine";
|
|
14
16
|
export { createAcpRunner, AcpAgentRunner, InteractiveSession, selectBackend, ClaudeBackend, CodexBackend, CustomAcpBackend, AGENT_METHODS, CLIENT_METHODS, AGENT_METHOD_COVERAGE, CLIENT_METHOD_COVERAGE, ACP_AUTH_REQUIRED_ERROR_CODE, clientCapabilitiesFor, adaptPromptContent, resolveBackendRegistry, BACKENDS_ENV, toJsonSchema, toStrictJsonSchema, } from "@automatalabs/acp-agents";
|
|
15
17
|
export type { AcpPoolOptions, AcpRunnerOptions, AuthenticateOptions, AuthMethodsOptions, DisableProviderOptions, DeleteSessionOptions, InteractiveSessionOptions, InteractiveTurn, ListProvidersOptions, ListSessionsOptions, LogoutOptions, ProbedConfigOptions, ReattachSessionOptions, SetProviderOptions, BackendRegistry, CustomBackendConfig, RegisteredBackend, ClientCapabilityOptions, ClientHandlers, FsHandlers, McpHandlers, TerminalHandlers, AcpSessionContext, NegotiatedCapabilities, PermissionResolver, AgentAuthCapabilities, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, AuthCapabilities, AuthEnvVar, AuthenticateRequest, AuthenticateResponse, AuthMethod, AuthMethodAgent, AuthMethodEnvVar, AuthMethodId, AuthMethodTerminal, ConnectMcpRequest, ConnectMcpResponse, DeleteSessionRequest, DeleteSessionResponse, DisableProviderRequest, DisableProviderResponse, DisconnectMcpRequest, DisconnectMcpResponse, ListProvidersRequest, ListProvidersResponse, ListSessionsRequest, ListSessionsResponse, LlmProtocol, LoadSessionRequest, LoadSessionResponse, LogoutCapabilities, LogoutRequest, LogoutResponse, McpConnectionId, McpServerAcp, McpServerAcpId, MessageMcpNotification, MessageMcpRequest, MessageMcpResponse, ProviderCurrentConfig, ProviderId, ProviderInfo, ProvidersCapabilities, ResumeSessionRequest, ResumeSessionResponse, SetProviderRequest, SetProviderResponse, AgentNotificationMethod, AgentNotificationParamsByMethod, CompleteElicitationNotification, CreateElicitationRequest, CreateElicitationResponse, ElicitationAcceptAction, ElicitationCapabilities, ElicitationContentValue, ElicitationFormCapabilities, ElicitationFormMode, ElicitationId, ElicitationPropertySchema, ElicitationRequestScope, ElicitationResolver, ElicitationSchema, ElicitationSchemaType, ElicitationSessionScope, ElicitationUrlCapabilities, ElicitationUrlMode, SessionMode, SessionModeState, SessionConfigOption, SessionInfo, SendRequestOptions, AgentMethodCoverage, ClientMethodCoverage, } from "@automatalabs/acp-agents";
|
|
16
18
|
export type { AuthResolver, AuthContext, AuthResolution, AuthMethodDescriptor, CompleteAuthOptions, AuthOutcome, AuthController, AuthStatusSnapshot, AuthCapableRunner, ProviderCapableRunner, } from "@automatalabs/acp-agents";
|
|
@@ -19,26 +21,61 @@ export { TypedEventEmitter } from "@automatalabs/acp-agents";
|
|
|
19
21
|
export type { AcpRunnerEventMap, AcpEventName, AcpEventListener, AcpEventContext, AcpSessionUpdate, AcpUpdateKind, AcpElicitationCompleteEvent, AcpElicitationEvent, AcpElicitationPendingEvent, AcpPermissionPendingEvent, AcpPermissionEvent, AcpRawMessageEvent, AcpBackendErrorEvent, } from "@automatalabs/acp-agents";
|
|
20
22
|
export type { AgentRunner, McpAcpServerConfig, McpServerConfig, RunOptions, AgentResult, AgentUsage, } from "@automatalabs/shared-types";
|
|
21
23
|
export type { AgentSessionRecord, AgentSessionRef, JournalCallMetadata, JournalEntry, WorkflowBackendConfig, WorkflowMeta, } from "@automatalabs/shared-types";
|
|
22
|
-
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
export { RUN_EVENT_LOG_VERSION } from "@automatalabs/shared-types";
|
|
25
|
+
export type { RunEvent, EngineRunEvent, EngineRunEventName, EngineRunEventPayloadMap, PersistableEngineRunEvent, PersistedRunEvent, RunEventLogRecord, RunEventValueProjection, RunEventErrorProjection, RunEventCheckpointProjection, PersistedRunAgentEndPayload, } from "@automatalabs/shared-types";
|
|
26
|
+
type ContextProperty<T, Key extends PropertyKey> = Key extends keyof T ? T[Key] : never;
|
|
27
|
+
type OptionalContextProperty<T, Key extends PropertyKey> = Key extends keyof T ? T[Key] : undefined;
|
|
28
|
+
/** The manager unwraps the runner catch-all into its concrete sessionUpdate discriminant. */
|
|
29
|
+
export type WorkflowAgentEventName = Exclude<AcpEventName, "session_update">;
|
|
30
|
+
/**
|
|
31
|
+
* Envelope map over the runner's whole public event-name type. The manager-emitted map below
|
|
32
|
+
* picks only names the bridge actually publishes; retaining the full map preserves the existing
|
|
33
|
+
* AgentEventPayload<"session_update"> type argument for source compatibility.
|
|
34
|
+
*/
|
|
35
|
+
type WorkflowAgentEventEnvelopeMap = {
|
|
36
|
+
[Name in AcpEventName]: {
|
|
37
|
+
name: Name;
|
|
38
|
+
event: AcpRunnerEventMap[Name];
|
|
39
|
+
backendId: ContextProperty<AcpRunnerEventMap[Name], "backendId">;
|
|
40
|
+
} & ("sessionId" extends keyof AcpRunnerEventMap[Name] ? {
|
|
41
|
+
sessionId: ContextProperty<AcpRunnerEventMap[Name], "sessionId">;
|
|
34
42
|
} : {
|
|
35
43
|
sessionId?: undefined;
|
|
36
44
|
}) & {
|
|
37
|
-
label?: OptionalContextProperty<AcpRunnerEventMap[
|
|
38
|
-
runId?: OptionalContextProperty<AcpRunnerEventMap[
|
|
45
|
+
label?: OptionalContextProperty<AcpRunnerEventMap[Name], "label">;
|
|
46
|
+
runId?: OptionalContextProperty<AcpRunnerEventMap[Name], "runId">;
|
|
47
|
+
scope?: OptionalContextProperty<AcpRunnerEventMap[Name], "runId">;
|
|
48
|
+
callIndex?: OptionalContextProperty<AcpRunnerEventMap[Name], "callIndex">;
|
|
39
49
|
};
|
|
40
50
|
};
|
|
41
|
-
export type
|
|
51
|
+
export type WorkflowAgentEventPayloadMap = Pick<WorkflowAgentEventEnvelopeMap, WorkflowAgentEventName>;
|
|
52
|
+
export type WorkflowAgentEventPayload<Name extends WorkflowAgentEventName = WorkflowAgentEventName> = WorkflowAgentEventPayloadMap[Name];
|
|
53
|
+
export type WorkflowAgentEvent = {
|
|
54
|
+
[Name in WorkflowAgentEventName]: {
|
|
55
|
+
type: "agentEvent";
|
|
56
|
+
} & WorkflowAgentEventPayload<Name>;
|
|
57
|
+
}[WorkflowAgentEventName];
|
|
58
|
+
export type WorkflowRunEvent = RunEvent<WorkflowAgentEvent>;
|
|
59
|
+
/**
|
|
60
|
+
* Compatibility alias retained with its pre-contract generic constraint and default. The
|
|
61
|
+
* "session_update" member is type-only: the manager did not emit it before this contract and
|
|
62
|
+
* still does not. New exact consumers use WorkflowAgentEventPayload/WorkflowAgentEvent.
|
|
63
|
+
*/
|
|
64
|
+
export type AgentEventPayload<Name extends AcpEventName = AcpEventName> = WorkflowAgentEventEnvelopeMap[Name];
|
|
65
|
+
export interface WorkflowManager {
|
|
66
|
+
addListener(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this;
|
|
67
|
+
on(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this;
|
|
68
|
+
once(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this;
|
|
69
|
+
removeListener(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this;
|
|
70
|
+
off(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this;
|
|
71
|
+
emit(eventName: "agentEvent", payload: WorkflowAgentEventPayload): boolean;
|
|
72
|
+
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
73
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
74
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
75
|
+
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
76
|
+
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
77
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
78
|
+
}
|
|
42
79
|
/**
|
|
43
80
|
* Stateful workflow manager exported by the SDK facade. It is the workflow-engine manager plus
|
|
44
81
|
* ONE composition-root bridge for ACP-capable runners: when the injected AgentRunner also exposes
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAKL,eAAe,IAAI,qBAAqB,EACzC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAoB,YAAY,EAAE,iBAAiB,EA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ScriptBackends } from "./script-backends.js";
|
|
15
15
|
// ── Engine: run entry, script parsing, the managed-run lifecycle, and the
|
|
16
16
|
// option/result + error types the host composes against. ──
|
|
17
|
-
export { runWorkflow, parseWorkflowScript, redactText, truncateUtf8 } from "@automatalabs/workflow-engine";
|
|
17
|
+
export { runWorkflow, parseWorkflowScript, hashCheckpointInputs, redactText, truncateUtf8, CALL_PATH_FORMAT, CALL_INPUTS_FORMAT, CHECKPOINT_INPUTS_FORMAT, RESUME_FALLBACK_REASONS, RESUME_DISABLED_REASONS, RESUME_CALL_LIVE_REASONS, RESUME_CALL_FAILED_REASONS, } from "@automatalabs/workflow-engine";
|
|
18
18
|
// ── Isolation mode: deterministic substitution testing over a recorded run. The SDK
|
|
19
19
|
// wrapper defaults the live target runner to ACP and owns that runner's disposal. ──
|
|
20
20
|
export { runIsolation, createReplayRunner } from "./isolation.js";
|
|
@@ -28,6 +28,11 @@ export { openWorkflowDir, } from "@automatalabs/workflow-engine";
|
|
|
28
28
|
// the `agentprism-workflows validate` CLI (./cli.ts). ──
|
|
29
29
|
export { validateWorkflowScript, fabricateFromSchema, formatValidateReport, MOCK_TOKENS_PER_AGENT } from "./validate.js";
|
|
30
30
|
export { AGENTPRISM_PERSISTENCE_ROOT_ENV, WorkflowError, WorkflowErrorCode, isWorkflowError, isProviderUsageLimit, isAuthRequired, } from "@automatalabs/workflow-engine";
|
|
31
|
+
// ── Durable run-event read/tail seam: the append/read/watch API over the per-run
|
|
32
|
+
// `<runId>.events.jsonl` sidecar, its error taxonomy, and the read caps (§2.10). A host
|
|
33
|
+
// attaches to a run's structured event log through these — and `withRunEvents` upgrades a
|
|
34
|
+
// custom RunPersistence into the seam — without reaching into package internals. ──
|
|
35
|
+
export { withRunEvents, RunEventLogError, RUN_EVENT_READ_LIMIT_DEFAULT, RUN_EVENT_READ_LIMIT_MAX, RUN_EVENT_MAX_RECORD_BYTES, } from "@automatalabs/workflow-engine";
|
|
31
36
|
// ── ACP backend: the default AgentRunner implementation, interactive sessions, backend
|
|
32
37
|
// selection, the concrete backends (built-in + custom registry), the pool/runner options,
|
|
33
38
|
// capability helpers, client handlers, permission resolvers, and JSON-Schema helpers.
|
|
@@ -37,9 +42,14 @@ export { AGENTPRISM_PERSISTENCE_ROOT_ENV, WorkflowError, WorkflowErrorCode, isWo
|
|
|
37
42
|
export { createAcpRunner, AcpAgentRunner, InteractiveSession, selectBackend, ClaudeBackend, CodexBackend, CustomAcpBackend, AGENT_METHODS, CLIENT_METHODS, AGENT_METHOD_COVERAGE, CLIENT_METHOD_COVERAGE, ACP_AUTH_REQUIRED_ERROR_CODE, clientCapabilitiesFor, adaptPromptContent, resolveBackendRegistry, BACKENDS_ENV, toJsonSchema, toStrictJsonSchema, } from "@automatalabs/acp-agents";
|
|
38
43
|
// ── Live ACP events: `createAcpRunner().on("tool_call", evt => …)` to listen in on the
|
|
39
44
|
// stream of a run. The event map keys are ACP `sessionUpdate` discriminants plus a few
|
|
40
|
-
// cross-cutting events; each payload carries a `{ sessionId, backendId, label?, runId? }`
|
|
45
|
+
// cross-cutting events; each payload carries a `{ sessionId, backendId, label?, runId?, callIndex? }`
|
|
41
46
|
// context envelope so a pooled runner's concurrent runs are disambiguable. ──
|
|
42
47
|
export { TypedEventEmitter } from "@automatalabs/acp-agents";
|
|
48
|
+
// ── Shared durable run-event contract: the live/persisted event unions, the engine
|
|
49
|
+
// event name/payload maps, and the bounded persisted projections (§2.2, §2.5). Re-exported
|
|
50
|
+
// through the facade so SDK consumers type a durable-log reader without reaching past the SDK
|
|
51
|
+
// (the ACP-specialized agentEvent branch is bound below as WorkflowAgentEvent/WorkflowRunEvent). ──
|
|
52
|
+
export { RUN_EVENT_LOG_VERSION } from "@automatalabs/shared-types";
|
|
43
53
|
const MANAGER_ACP_CROSS_CUTTING_EVENT_NAMES = ACP_CROSS_CUTTING_EVENT_NAMES;
|
|
44
54
|
/**
|
|
45
55
|
* Stateful workflow manager exported by the SDK facade. It is the workflow-engine manager plus
|
|
@@ -158,6 +168,7 @@ function toSessionUpdateAgentEventPayload(event) {
|
|
|
158
168
|
backendId: event.backendId,
|
|
159
169
|
label: event.label,
|
|
160
170
|
runId: event.runId,
|
|
171
|
+
callIndex: event.callIndex,
|
|
161
172
|
});
|
|
162
173
|
}
|
|
163
174
|
function toAgentEventPayload(name, event) {
|
|
@@ -169,6 +180,8 @@ function toAgentEventPayload(name, event) {
|
|
|
169
180
|
...(context.sessionId !== undefined ? { sessionId: context.sessionId } : {}),
|
|
170
181
|
...(context.label !== undefined ? { label: context.label } : {}),
|
|
171
182
|
...(context.runId !== undefined ? { runId: context.runId } : {}),
|
|
183
|
+
...(context.runId !== undefined ? { scope: context.runId } : {}),
|
|
184
|
+
...(context.callIndex !== undefined ? { callIndex: context.callIndex } : {}),
|
|
172
185
|
};
|
|
173
186
|
}
|
|
174
187
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automatalabs/workflows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"typebox": "1.3.2",
|
|
34
|
-
"@automatalabs/shared-types": "0.
|
|
35
|
-
"@automatalabs/
|
|
36
|
-
"@automatalabs/
|
|
34
|
+
"@automatalabs/shared-types": "0.23.0",
|
|
35
|
+
"@automatalabs/workflow-engine": "0.24.0",
|
|
36
|
+
"@automatalabs/acp-agents": "0.28.1"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -b",
|