@cuylabs/agent-runtime-dapr 0.8.0 → 0.10.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 +154 -19
- package/dist/{chunk-2CEICSJH.js → chunk-5CJIC4YB.js} +184 -38
- package/dist/chunk-MJKJT3ZO.js +11219 -0
- package/dist/{chunk-A34CHK2E.js → chunk-MQJ4LZOX.js} +30 -4
- package/dist/chunk-YQQTUE6B.js +993 -0
- package/dist/chunk-YS2CWYBQ.js +1358 -0
- package/dist/client-UsEIzDF6.d.ts +322 -0
- package/dist/dispatch/index.d.ts +9 -0
- package/dist/dispatch/index.js +17 -0
- package/dist/execution/index.d.ts +5 -4
- package/dist/execution/index.js +2 -2
- package/dist/host/index.d.ts +8 -4
- package/dist/host/index.js +28 -8
- package/dist/index-BEOwKSPI.d.ts +101 -0
- package/dist/{index-nZvCz3bO.d.ts → index-BmM58WZa.d.ts} +391 -183
- package/dist/index-CFm5LORU.d.ts +63 -0
- package/dist/index.d.ts +62 -14
- package/dist/index.js +76 -6
- package/dist/invoker-B1jvz9DG.d.ts +52 -0
- package/dist/{store-pRLGfYhN.d.ts → store-BXBIDz40.d.ts} +24 -3
- package/dist/team/index.d.ts +612 -0
- package/dist/team/index.js +30 -0
- package/dist/worker-CXq0IFGX.d.ts +42 -0
- package/dist/workflow/index.d.ts +4 -225
- package/dist/workflow/index.js +2 -2
- package/dist/{workflow-bridge-C8Z1yr0Y.d.ts → workflow-bridge-BcicHH1Y.d.ts} +4 -2
- package/dist/workflow-host-D6W6fXoL.d.ts +459 -0
- package/package.json +16 -6
- package/dist/chunk-DILON56B.js +0 -668
- package/dist/chunk-R47X4FG2.js +0 -2009
package/dist/workflow/index.d.ts
CHANGED
|
@@ -1,225 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type DaprWorkflowRuntimeStatus = "RUNNING" | "COMPLETED" | "FAILED" | "TERMINATED" | "CONTINUED_AS_NEW" | "PENDING" | "SUSPENDED" | (string & {});
|
|
6
|
-
interface DaprWorkflowClientOptions extends DaprSidecarClientOptions {
|
|
7
|
-
/**
|
|
8
|
-
* Dapr workflow component name configured in the sidecar resources.
|
|
9
|
-
*
|
|
10
|
-
* Dapr requires the component name as part of the workflow HTTP route, so the
|
|
11
|
-
* client keeps it explicit rather than guessing a default.
|
|
12
|
-
*/
|
|
13
|
-
workflowComponent: string;
|
|
14
|
-
/**
|
|
15
|
-
* HTTP API version for workflow endpoints. Defaults to `v1.0`.
|
|
16
|
-
*/
|
|
17
|
-
workflowApiVersion?: DaprWorkflowApiVersion;
|
|
18
|
-
/**
|
|
19
|
-
* Default polling interval for wait helpers. Defaults to 1000ms.
|
|
20
|
-
*/
|
|
21
|
-
workflowPollIntervalMs?: number;
|
|
22
|
-
}
|
|
23
|
-
interface StartDaprWorkflowOptions<TInput = unknown> {
|
|
24
|
-
/**
|
|
25
|
-
* Optional workflow instance identifier. When omitted, Dapr generates one.
|
|
26
|
-
*/
|
|
27
|
-
instanceId?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Optional workflow input payload. Objects are JSON serialized; strings are
|
|
30
|
-
* sent as-is to preserve exact text payloads.
|
|
31
|
-
*/
|
|
32
|
-
input?: TInput;
|
|
33
|
-
}
|
|
34
|
-
interface RaiseDaprWorkflowEventOptions<TEventData = unknown> {
|
|
35
|
-
eventData?: TEventData;
|
|
36
|
-
}
|
|
37
|
-
interface WaitForDaprWorkflowOptions {
|
|
38
|
-
/**
|
|
39
|
-
* Max time to wait before returning `undefined`. Defaults to 60000ms.
|
|
40
|
-
*/
|
|
41
|
-
timeoutMs?: number;
|
|
42
|
-
/**
|
|
43
|
-
* Polling interval for repeated `getWorkflow` checks. Defaults to the client
|
|
44
|
-
* default and never below 50ms.
|
|
45
|
-
*/
|
|
46
|
-
pollIntervalMs?: number;
|
|
47
|
-
}
|
|
48
|
-
interface DaprWorkflowState {
|
|
49
|
-
instanceId: string;
|
|
50
|
-
workflowName: string;
|
|
51
|
-
createdAt?: string;
|
|
52
|
-
lastUpdatedAt?: string;
|
|
53
|
-
runtimeStatus: DaprWorkflowRuntimeStatus;
|
|
54
|
-
/**
|
|
55
|
-
* Raw string properties returned by Dapr for the orchestration instance.
|
|
56
|
-
*/
|
|
57
|
-
properties: Record<string, string>;
|
|
58
|
-
}
|
|
59
|
-
interface DaprStartWorkflowResponse {
|
|
60
|
-
instanceId: string;
|
|
61
|
-
}
|
|
62
|
-
declare function isTerminalDaprWorkflowStatus(status: DaprWorkflowRuntimeStatus): boolean;
|
|
63
|
-
declare function hasStartedDaprWorkflow(status: DaprWorkflowRuntimeStatus): boolean;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Durable workflow execution for agent turns.
|
|
67
|
-
*
|
|
68
|
-
* This is the inner integration seam between `agent-runtime-dapr` and
|
|
69
|
-
* `agent-core`: instead of scheduling a whole task as one opaque unit, the
|
|
70
|
-
* workflow reuses `agent-core` turn primitives to run model, tool, and commit
|
|
71
|
-
* phases as separate durable activities.
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
|
-
interface DaprAgentTurnWorkflowActivityNames {
|
|
75
|
-
modelStep: string;
|
|
76
|
-
toolCall: string;
|
|
77
|
-
stepCommit: string;
|
|
78
|
-
outputCommit: string;
|
|
79
|
-
}
|
|
80
|
-
interface DaprAgentTurnWorkflowContextLike {
|
|
81
|
-
callActivity(name: string, input: unknown): unknown;
|
|
82
|
-
setCustomStatus?(status: string): void;
|
|
83
|
-
isReplaying?(): boolean;
|
|
84
|
-
}
|
|
85
|
-
type DaprAgentTurnWorkflowDefinition = (context: DaprAgentTurnWorkflowContextLike, input: AgentWorkflowTurnState) => AsyncGenerator<unknown, AgentWorkflowTurnState, unknown>;
|
|
86
|
-
interface DaprAgentTurnActivityRegistration<TInput, TOutput> {
|
|
87
|
-
name: string;
|
|
88
|
-
handler: (context: unknown, input: TInput) => Promise<TOutput> | TOutput;
|
|
89
|
-
}
|
|
90
|
-
interface DaprAgentTurnWorkflowRegistration {
|
|
91
|
-
workflowName: string;
|
|
92
|
-
activityNames: DaprAgentTurnWorkflowActivityNames;
|
|
93
|
-
workflow: DaprAgentTurnWorkflowDefinition;
|
|
94
|
-
}
|
|
95
|
-
interface CreateDaprAgentTurnWorkflowOptions {
|
|
96
|
-
workflowName?: string;
|
|
97
|
-
activityNames?: Partial<DaprAgentTurnWorkflowActivityNames>;
|
|
98
|
-
now?: () => string;
|
|
99
|
-
}
|
|
100
|
-
type CreateDaprAgentTurnWorkflowRegistrationOptions = CreateDaprAgentTurnWorkflowOptions;
|
|
101
|
-
interface DaprAgentTurnModelStepActivityOptions {
|
|
102
|
-
runtime: AgentTurnStepRuntimeConfig;
|
|
103
|
-
tools: Record<string, Tool.Info>;
|
|
104
|
-
toModelMessages?: typeof convertAgentMessagesToModelMessages;
|
|
105
|
-
mcpTools?: PrepareModelStepOptions["mcpTools"] | (() => Promise<PrepareModelStepOptions["mcpTools"]>);
|
|
106
|
-
host?: ToolHost;
|
|
107
|
-
turnTracker?: TurnTrackerContext;
|
|
108
|
-
middleware?: MiddlewareRunner;
|
|
109
|
-
reasoningLevel?: ReasoningLevel;
|
|
110
|
-
createAbortSignal?: () => AbortSignal;
|
|
111
|
-
onEvent?: (event: AgentEvent) => void | Promise<void>;
|
|
112
|
-
now?: () => string;
|
|
113
|
-
/** Observer bridge for OTel trace context propagation. */
|
|
114
|
-
observerBridge?: DaprWorkflowObserverBridge;
|
|
115
|
-
}
|
|
116
|
-
interface DaprAgentTurnToolCallActivityOptions {
|
|
117
|
-
tools: Record<string, Tool.Info>;
|
|
118
|
-
cwd: string;
|
|
119
|
-
host?: ToolHost;
|
|
120
|
-
turnTracker?: TurnTrackerContext;
|
|
121
|
-
middleware?: MiddlewareRunner;
|
|
122
|
-
createAbortSignal?: () => AbortSignal;
|
|
123
|
-
now?: () => string;
|
|
124
|
-
/** Observer bridge for OTel trace context propagation. */
|
|
125
|
-
observerBridge?: DaprWorkflowObserverBridge;
|
|
126
|
-
}
|
|
127
|
-
interface DaprAgentTurnCommitActivityOptions {
|
|
128
|
-
persistMessages: (sessionId: string, messages: Message[]) => Promise<void>;
|
|
129
|
-
now?: () => string;
|
|
130
|
-
}
|
|
131
|
-
interface CreateDaprAgentTurnWorkflowDefinitionOptions extends CreateDaprAgentTurnWorkflowRegistrationOptions {
|
|
132
|
-
modelStep: (input: AgentWorkflowModelStepPlan) => Promise<AgentWorkflowModelStepResult> | AgentWorkflowModelStepResult;
|
|
133
|
-
toolCall: (input: AgentWorkflowToolCallPlan) => Promise<AgentWorkflowToolCallResult> | AgentWorkflowToolCallResult;
|
|
134
|
-
stepCommit: (input: AgentWorkflowStepCommitPlan) => Promise<AgentWorkflowCommitResult> | AgentWorkflowCommitResult;
|
|
135
|
-
outputCommit: (input: AgentWorkflowOutputCommitPlan) => Promise<AgentWorkflowCommitResult> | AgentWorkflowCommitResult;
|
|
136
|
-
/**
|
|
137
|
-
* Optional observer bridge. When provided, the workflow generator emits
|
|
138
|
-
* lifecycle notifications (task-start, checkpoint, complete, error) so
|
|
139
|
-
* that `AgentTaskObserver`s work on the workflow path too.
|
|
140
|
-
*/
|
|
141
|
-
observerBridge?: DaprWorkflowObserverBridge;
|
|
142
|
-
}
|
|
143
|
-
interface CreateDaprAgentTurnWorkflowKitOptions extends CreateDaprAgentTurnWorkflowRegistrationOptions {
|
|
144
|
-
modelStepActivity: DaprAgentTurnModelStepActivityOptions;
|
|
145
|
-
toolCallActivity: DaprAgentTurnToolCallActivityOptions;
|
|
146
|
-
commitActivity: DaprAgentTurnCommitActivityOptions;
|
|
147
|
-
/** Optional observer bridge passed through to the workflow definition. */
|
|
148
|
-
observerBridge?: DaprWorkflowObserverBridge;
|
|
149
|
-
}
|
|
150
|
-
interface DaprAgentTurnWorkflowKit extends DaprAgentTurnWorkflowRegistration {
|
|
151
|
-
activities: {
|
|
152
|
-
modelStep: DaprAgentTurnActivityRegistration<AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult>;
|
|
153
|
-
toolCall: DaprAgentTurnActivityRegistration<AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult>;
|
|
154
|
-
stepCommit: DaprAgentTurnActivityRegistration<AgentWorkflowStepCommitPlan, AgentWorkflowCommitResult>;
|
|
155
|
-
outputCommit: DaprAgentTurnActivityRegistration<AgentWorkflowOutputCommitPlan, AgentWorkflowCommitResult>;
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Create the deterministic workflow definition that a host app can register
|
|
160
|
-
* with the Dapr JS SDK runtime.
|
|
161
|
-
*
|
|
162
|
-
* The returned workflow stays SDK-agnostic at the package boundary: it only
|
|
163
|
-
* assumes a context with `callActivity()` and optional `setCustomStatus()`.
|
|
164
|
-
*/
|
|
165
|
-
declare function createDaprAgentTurnWorkflowDefinition(options: CreateDaprAgentTurnWorkflowDefinitionOptions): DaprAgentTurnWorkflowRegistration;
|
|
166
|
-
/**
|
|
167
|
-
* Build the default model-step activity over the extracted `agent-core`
|
|
168
|
-
* phase helpers.
|
|
169
|
-
*/
|
|
170
|
-
declare function createDaprAgentTurnModelStepActivity(options: DaprAgentTurnModelStepActivityOptions): DaprAgentTurnActivityRegistration<AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult>;
|
|
171
|
-
/**
|
|
172
|
-
* Build the default single-tool-call activity.
|
|
173
|
-
*
|
|
174
|
-
* One tool call per activity is the durable boundary used by the workflow
|
|
175
|
-
* adapter. That is intentionally finer-grained than the in-process
|
|
176
|
-
* `runToolBatch(...)` helper.
|
|
177
|
-
*/
|
|
178
|
-
declare function createDaprAgentTurnToolCallActivity(options: DaprAgentTurnToolCallActivityOptions): DaprAgentTurnActivityRegistration<AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult>;
|
|
179
|
-
/**
|
|
180
|
-
* Build the default step-commit activity that appends assistant/tool messages
|
|
181
|
-
* to the durable session store owned by the host app.
|
|
182
|
-
*/
|
|
183
|
-
declare function createDaprAgentTurnStepCommitActivity(options: DaprAgentTurnCommitActivityOptions): DaprAgentTurnActivityRegistration<AgentWorkflowStepCommitPlan, AgentWorkflowCommitResult>;
|
|
184
|
-
/**
|
|
185
|
-
* Build the default output-commit activity that appends the final assistant
|
|
186
|
-
* message to the durable session store owned by the host app.
|
|
187
|
-
*/
|
|
188
|
-
declare function createDaprAgentTurnOutputCommitActivity(options: DaprAgentTurnCommitActivityOptions): DaprAgentTurnActivityRegistration<AgentWorkflowOutputCommitPlan, AgentWorkflowCommitResult>;
|
|
189
|
-
/**
|
|
190
|
-
* Create a full workflow registration kit with default activity handlers.
|
|
191
|
-
*
|
|
192
|
-
* Host apps can register the returned workflow and activities directly with the
|
|
193
|
-
* Dapr JS SDK runtime while keeping execution semantics in `agent-core`.
|
|
194
|
-
*/
|
|
195
|
-
declare function createDaprAgentTurnWorkflowKit(options: CreateDaprAgentTurnWorkflowKitOptions): DaprAgentTurnWorkflowKit;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Thin HTTP client for Dapr workflow management APIs.
|
|
199
|
-
*
|
|
200
|
-
* This intentionally mirrors the rest of `agent-runtime-dapr`: direct sidecar
|
|
201
|
-
* HTTP calls with retry/timeout behavior owned by `DaprSidecarClient`. The
|
|
202
|
-
* higher-level runtime/workflow adapter can build on this without pulling gRPC
|
|
203
|
-
* or DurableTask types into the package boundary.
|
|
204
|
-
*/
|
|
205
|
-
declare class DaprWorkflowClient {
|
|
206
|
-
private readonly client;
|
|
207
|
-
private readonly workflowComponent;
|
|
208
|
-
private readonly workflowApiVersion;
|
|
209
|
-
private readonly workflowPollIntervalMs;
|
|
210
|
-
constructor(options: DaprWorkflowClientOptions);
|
|
211
|
-
verifySidecar(): Promise<void>;
|
|
212
|
-
startWorkflow<TInput = unknown>(workflowName: string, options?: StartDaprWorkflowOptions<TInput>): Promise<DaprStartWorkflowResponse>;
|
|
213
|
-
getWorkflow(instanceId: string): Promise<DaprWorkflowState | undefined>;
|
|
214
|
-
waitForWorkflowStart(instanceId: string, options?: WaitForDaprWorkflowOptions): Promise<DaprWorkflowState | undefined>;
|
|
215
|
-
waitForWorkflowCompletion(instanceId: string, options?: WaitForDaprWorkflowOptions): Promise<DaprWorkflowState | undefined>;
|
|
216
|
-
pauseWorkflow(instanceId: string): Promise<void>;
|
|
217
|
-
resumeWorkflow(instanceId: string): Promise<void>;
|
|
218
|
-
terminateWorkflow(instanceId: string): Promise<void>;
|
|
219
|
-
purgeWorkflow(instanceId: string): Promise<void>;
|
|
220
|
-
raiseWorkflowEvent<TEventData = unknown>(instanceId: string, eventName: string, options?: RaiseDaprWorkflowEventOptions<TEventData>): Promise<void>;
|
|
221
|
-
private controlWorkflow;
|
|
222
|
-
private waitForWorkflowState;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export { type CreateDaprAgentTurnWorkflowDefinitionOptions, type CreateDaprAgentTurnWorkflowKitOptions, type CreateDaprAgentTurnWorkflowOptions, type DaprAgentTurnActivityRegistration, type DaprAgentTurnCommitActivityOptions, type DaprAgentTurnModelStepActivityOptions, type DaprAgentTurnToolCallActivityOptions, type DaprAgentTurnWorkflowActivityNames, type DaprAgentTurnWorkflowContextLike, type DaprAgentTurnWorkflowDefinition, type DaprAgentTurnWorkflowKit, type DaprAgentTurnWorkflowRegistration, type DaprStartWorkflowResponse, type DaprWorkflowApiVersion, DaprWorkflowClient, type DaprWorkflowClientOptions, type DaprWorkflowRuntimeStatus, type DaprWorkflowState, type RaiseDaprWorkflowEventOptions, type StartDaprWorkflowOptions, type WaitForDaprWorkflowOptions, createDaprAgentTurnModelStepActivity, createDaprAgentTurnOutputCommitActivity, createDaprAgentTurnStepCommitActivity, createDaprAgentTurnToolCallActivity, createDaprAgentTurnWorkflowDefinition, createDaprAgentTurnWorkflowKit, hasStartedDaprWorkflow, isTerminalDaprWorkflowStatus };
|
|
1
|
+
export { C as CreateDaprAgentTurnWorkflowDefinitionOptions, c as CreateDaprAgentTurnWorkflowKitOptions, d as CreateDaprAgentTurnWorkflowOptions, b as DaprAgentTurnActivityRegistration, h as DaprAgentTurnCommitActivityOptions, l as DaprAgentTurnModelStepActivityOptions, o as DaprAgentTurnToolCallActivityOptions, p as DaprAgentTurnWorkflowActivityNames, q as DaprAgentTurnWorkflowContextLike, r as DaprAgentTurnWorkflowDefinition, s as DaprAgentTurnWorkflowKit, t as DaprAgentTurnWorkflowRegistration, a as DaprAgentTurnWorkflowToolHandler, u as DaprAgentTurnWorkflowToolHandlerInput, v as DaprStartWorkflowResponse, w as DaprWorkflowApiVersion, D as DaprWorkflowClient, x as DaprWorkflowClientOptions, y as DaprWorkflowRuntimeStatus, z as DaprWorkflowState, R as RaiseDaprWorkflowEventOptions, S as StartDaprWorkflowOptions, W as WaitForDaprWorkflowOptions, A as hasStartedDaprWorkflow, B as isTerminalDaprWorkflowStatus } from '../client-UsEIzDF6.js';
|
|
2
|
+
export { b as createDaprAgentTurnModelStepActivity, d as createDaprAgentTurnOutputCommitActivity, f as createDaprAgentTurnStepCommitActivity, g as createDaprAgentTurnToolCallActivity, h as createDaprAgentTurnWorkflowDefinition, i as createDaprAgentTurnWorkflowKit } from '../index-CFm5LORU.js';
|
|
3
|
+
import '@cuylabs/agent-core';
|
|
4
|
+
import '../workflow-bridge-BcicHH1Y.js';
|
package/dist/workflow/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
createDaprAgentTurnWorkflowKit,
|
|
9
9
|
hasStartedDaprWorkflow,
|
|
10
10
|
isTerminalDaprWorkflowStatus
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
} from "../chunk-YS2CWYBQ.js";
|
|
12
|
+
import "../chunk-MQJ4LZOX.js";
|
|
13
13
|
export {
|
|
14
14
|
DaprWorkflowClient,
|
|
15
15
|
createDaprAgentTurnModelStepActivity,
|
|
@@ -43,6 +43,8 @@ interface DaprWorkflowObserverOptions<TPayload extends AgentTaskPayload = AgentT
|
|
|
43
43
|
payload: Readonly<TPayload>;
|
|
44
44
|
/** Execution trigger label (e.g. "workflow", "http"). */
|
|
45
45
|
trigger?: string;
|
|
46
|
+
/** Stable execution identifier for this workflow run. */
|
|
47
|
+
executionId?: string;
|
|
46
48
|
}
|
|
47
49
|
/**
|
|
48
50
|
* A bridge that lets existing `AgentTaskObserver`s (DaprExecutionObserver,
|
|
@@ -76,8 +78,8 @@ interface DaprWorkflowObserverBridge {
|
|
|
76
78
|
* Used by workflow activities to wrap their execution so child spans
|
|
77
79
|
* (AI SDK, tool calls) are correlated under the observer's root span.
|
|
78
80
|
*/
|
|
79
|
-
getOtelContext(sessionId: string): unknown;
|
|
81
|
+
getOtelContext(sessionId: string, executionId?: string): unknown;
|
|
80
82
|
}
|
|
81
83
|
declare function createWorkflowObserverBridge<TPayload extends AgentTaskPayload = AgentTaskPayload>(options: DaprWorkflowObserverOptions<TPayload>): DaprWorkflowObserverBridge;
|
|
82
84
|
|
|
83
|
-
export { type
|
|
85
|
+
export { type DaprExecutionStoreOptions as D, type DaprOrchestratorRunStoreOptions as a, type DaprFetch as b, type DaprRuntimeDriverOptions as c, type DaprSidecarClientOptions as d, type DaprStateStoreClientOptions as e, type DaprWorkflowObserverBridge as f, type DaprWorkflowObserverOptions as g, createWorkflowObserverBridge as h };
|