@automatalabs/workflows 0.33.1 → 0.34.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 +53 -13
- package/dist/index.d.ts +53 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -303,18 +303,56 @@ execution results carry an immediate redacted final-20 `logTail`; completed resu
|
|
|
303
303
|
|
|
304
304
|
Manager events are Node `EventEmitter` notifications: `agentStart`, `agentEnd`, `agentHistory`,
|
|
305
305
|
`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.
|
|
306
|
+
and `agentEvent`. Their overloads infer exact payloads from `EngineRunEventPayloadMap` and
|
|
307
|
+
`WorkflowAgentEventPayloadMap`; `WorkflowRunEvent` is the exhaustive union when a host wants one
|
|
308
|
+
dispatcher. Every engine event carries the owning root `runId` and originating engine `scope`.
|
|
309
|
+
`journal` emits `{ runId, scope, entry }` for each live journal append, even when file journaling is
|
|
310
|
+
disabled via `journaling: false`.
|
|
313
311
|
|
|
314
312
|
```ts
|
|
315
|
-
|
|
313
|
+
import {
|
|
314
|
+
WorkflowManager,
|
|
315
|
+
createAcpRunner,
|
|
316
|
+
type EngineRunEventPayloadMap,
|
|
317
|
+
type WorkflowRunEvent,
|
|
318
|
+
} from "@automatalabs/workflows";
|
|
319
|
+
|
|
320
|
+
const manager = new WorkflowManager({ agent: createAcpRunner() });
|
|
321
|
+
|
|
322
|
+
const onAgentEnd = (event: EngineRunEventPayloadMap["agentEnd"]) => {
|
|
323
|
+
console.error(event.scope, event.callIndex, event.label, event.result);
|
|
324
|
+
};
|
|
325
|
+
manager.on("agentEnd", onAgentEnd); // the overload infers the same payload without annotation
|
|
326
|
+
|
|
327
|
+
const target = { scope: "build-abc-nested1", callIndex: 3 };
|
|
328
|
+
manager.on("agentEvent", (event) => {
|
|
329
|
+
if (event.scope === target.scope && event.callIndex === target.callIndex) {
|
|
330
|
+
renderAcpUpdate(event.name, event.event);
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
function consumeEvent(event: WorkflowRunEvent): void {
|
|
335
|
+
switch (event.type) {
|
|
336
|
+
case "phase":
|
|
337
|
+
console.error(event.scope, event.title);
|
|
338
|
+
break;
|
|
339
|
+
case "agentEvent":
|
|
340
|
+
console.error(event.scope, event.callIndex, event.name);
|
|
341
|
+
break;
|
|
342
|
+
default:
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
316
346
|
```
|
|
317
347
|
|
|
348
|
+
`agentEvent` forwards the live ACP stream from an ACP-capable runner with `name`, `event`, and the
|
|
349
|
+
runner context fields (`runId`, `scope`, `callIndex`, `label`, `sessionId`, `backendId`) when present.
|
|
350
|
+
`scope` repeats the runner's originating engine `runId`, so nested calls filter directly on
|
|
351
|
+
`(scope, callIndex)`. Direct runner/interactive sessions can omit `callIndex`; `backend_error` is
|
|
352
|
+
connection-scoped and carries `backendId` only. ACP `session/update` traffic is emitted once under
|
|
353
|
+
its inner discriminant name, while permission/elicitation/session/raw/backend events keep their
|
|
354
|
+
runner names.
|
|
355
|
+
|
|
318
356
|
Every live ACP-backed `agent()` call records a non-secret re-attach handle in
|
|
319
357
|
`run.agentSessions`. Set `agent(..., { keepSession: true })` to skip release-time `session/close`,
|
|
320
358
|
then use the runner's `loadSession()` or `resumeSession()` host API with that record. Session
|
|
@@ -441,16 +479,18 @@ await runner.dispose();
|
|
|
441
479
|
| `backend_error` | `{ backendId, error }` — a pooled backend process crashed |
|
|
442
480
|
|
|
443
481
|
**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
|
-
`
|
|
482
|
+
event (except `backend_error`) carries `{ sessionId, backendId, label?, runId?, callIndex? }`.
|
|
483
|
+
`callIndex` echoes the optional `RunOptions.callIndex` used to open the session and is never sent on
|
|
484
|
+
the ACP wire. Engine-created calls supply it; direct/interactive runner callers may omit it.
|
|
446
485
|
|
|
447
486
|
**Best-effort.** Listeners are observers: a throwing listener is isolated and never breaks the run,
|
|
448
487
|
the update drain, or sibling listeners.
|
|
449
488
|
|
|
450
489
|
**With `runDynamicWorkflow` / `WorkflowManager`.** Subscribe at the manager layer:
|
|
451
|
-
`manager.on("agentEvent", ({
|
|
452
|
-
script then streams live ACP events through the manager;
|
|
453
|
-
|
|
490
|
+
`manager.on("agentEvent", ({ scope, callIndex, name, event }) => …)`. Every `agent()` call in the
|
|
491
|
+
script then streams live ACP events through the manager; the bridge sets `scope = runId` and repeats
|
|
492
|
+
the optional `callIndex` for direct call filtering. ACP `session/update` traffic is forwarded once
|
|
493
|
+
under `name = event.sessionUpdate`, so hosts do not receive both the catch-all and the
|
|
454
494
|
per-discriminant runner event.
|
|
455
495
|
|
|
456
496
|
---
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
6
|
export { runWorkflow, parseWorkflowScript, redactText, truncateUtf8 } from "@automatalabs/workflow-engine";
|
|
7
7
|
export { runIsolation, createReplayRunner, type RunIsolationSdkOptions } from "./isolation.js";
|
|
@@ -11,6 +11,8 @@ export { validateWorkflowScript, fabricateFromSchema, formatValidateReport, MOCK
|
|
|
11
11
|
export type { MockAnswerJson, MockAnswerRule, MockAnswers, MockAnswerSequence, UnusedMockAnswer, ValidateWorkflowOptions, ValidateWorkflowReport, ValidateHarnessOptions, ValidatedAgentCall, ValidatedCheckpoint, ValidatedMockAnswerRule, ValidatedMockAnswers, ValidatedMockAnswerUse, } from "./validate.js";
|
|
12
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";
|
|
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,EAA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AAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAK9E;8FAC0F;IAC1F,OAAO,IAAI,IAAI;IAOf,8EAA8E;IAC9E,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,sBAAsB;CAiC/B;AA2CD;;;;;;;;GAQG;AACH,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kGAAkG;IAClG,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,+FAA+F;IAC/F,mBAAmB,CAAC,EAAE,qBAAqB,CAAC;IAC5C;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;CAC7C;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAsC5B"}
|
package/dist/index.js
CHANGED
|
@@ -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.34.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.22.0",
|
|
35
|
+
"@automatalabs/workflow-engine": "0.23.0",
|
|
36
|
+
"@automatalabs/acp-agents": "0.28.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -b",
|