@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
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult, AgentWorkflowInterventionSnapshot, AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult, HumanInputRequest, ApprovalRequest, AgentWorkflowInputCommitPlan, AgentWorkflowStepCommitPlan, AgentWorkflowCommitResult, AgentWorkflowOutputCommitPlan, AgentEvent, AgentTurnStepRuntimeConfig, Tool, convertAgentMessagesToModelMessages, PrepareModelStepOptions, ToolHost, TurnTrackerContext, MiddlewareRunner, ReasoningLevel, Message, AgentWorkflowTurnState } from '@cuylabs/agent-core';
|
|
2
|
+
import { d as DaprSidecarClientOptions, f as DaprWorkflowObserverBridge } from './workflow-bridge-BcicHH1Y.js';
|
|
3
|
+
|
|
4
|
+
type DaprWorkflowApiVersion = "v1.0" | "v1.0-beta1" | "v1.0-alpha1";
|
|
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
|
+
* Type definitions for the durable agent-turn workflow runtime.
|
|
67
|
+
*
|
|
68
|
+
* Extracted from `runtime.ts` for maintainability.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
interface DaprAgentTurnWorkflowActivityNames {
|
|
72
|
+
steerDrain?: string;
|
|
73
|
+
modelStep: string;
|
|
74
|
+
humanInputCheck?: string;
|
|
75
|
+
approvalCheck?: string;
|
|
76
|
+
toolCall: string;
|
|
77
|
+
stepCommit: string;
|
|
78
|
+
outputCommit: string;
|
|
79
|
+
}
|
|
80
|
+
interface DaprAgentTurnWorkflowContextLike {
|
|
81
|
+
callActivity(name: string, input: unknown): unknown;
|
|
82
|
+
callChildWorkflow?(name: string, input: unknown, instanceId?: string): unknown;
|
|
83
|
+
waitForExternalEvent?(name: string): unknown;
|
|
84
|
+
createTimer?(fireAt: Date | number): unknown;
|
|
85
|
+
whenAll?(tasks: unknown[]): unknown;
|
|
86
|
+
whenAny?(tasks: unknown[]): unknown;
|
|
87
|
+
continueAsNew?(input: unknown, preserveUnprocessedEvents?: boolean): never;
|
|
88
|
+
setCustomStatus?(status: string): void;
|
|
89
|
+
isReplaying?(): boolean;
|
|
90
|
+
getWorkflowInstanceId?(): string;
|
|
91
|
+
}
|
|
92
|
+
type DaprAgentTurnWorkflowDefinition = (context: DaprAgentTurnWorkflowContextLike, input: AgentWorkflowTurnState) => AsyncGenerator<unknown, AgentWorkflowTurnState, unknown>;
|
|
93
|
+
interface DaprAgentTurnActivityRegistration<TInput, TOutput> {
|
|
94
|
+
name: string;
|
|
95
|
+
handler: (context: unknown, input: TInput) => Promise<TOutput> | TOutput;
|
|
96
|
+
}
|
|
97
|
+
interface DaprAgentTurnApprovalCheckInput {
|
|
98
|
+
workflowInstanceId: string;
|
|
99
|
+
sessionId: string;
|
|
100
|
+
step: number;
|
|
101
|
+
toolCall: AgentWorkflowToolCallPlan["toolCall"];
|
|
102
|
+
}
|
|
103
|
+
type DaprAgentTurnApprovalCheckResult = {
|
|
104
|
+
action: "allow";
|
|
105
|
+
} | {
|
|
106
|
+
action: "deny";
|
|
107
|
+
reason: string;
|
|
108
|
+
} | {
|
|
109
|
+
action: "request";
|
|
110
|
+
requestId: string;
|
|
111
|
+
eventName: string;
|
|
112
|
+
request: ApprovalRequest;
|
|
113
|
+
};
|
|
114
|
+
interface DaprAgentTurnHumanInputCheckInput {
|
|
115
|
+
workflowInstanceId: string;
|
|
116
|
+
sessionId: string;
|
|
117
|
+
step: number;
|
|
118
|
+
toolCall: AgentWorkflowToolCallPlan["toolCall"];
|
|
119
|
+
}
|
|
120
|
+
type DaprAgentTurnHumanInputCheckResult = {
|
|
121
|
+
action: "allow";
|
|
122
|
+
} | {
|
|
123
|
+
action: "deny";
|
|
124
|
+
reason: string;
|
|
125
|
+
} | {
|
|
126
|
+
action: "request";
|
|
127
|
+
requestId: string;
|
|
128
|
+
eventName: string;
|
|
129
|
+
request: HumanInputRequest;
|
|
130
|
+
};
|
|
131
|
+
interface DaprAgentTurnSteerDrainInput {
|
|
132
|
+
workflowInstanceId: string;
|
|
133
|
+
sessionId: string;
|
|
134
|
+
step: number;
|
|
135
|
+
maxItems: number;
|
|
136
|
+
}
|
|
137
|
+
interface DaprAgentTurnWorkflowRegistration {
|
|
138
|
+
workflowName: string;
|
|
139
|
+
activityNames: DaprAgentTurnWorkflowActivityNames;
|
|
140
|
+
workflow: DaprAgentTurnWorkflowDefinition;
|
|
141
|
+
}
|
|
142
|
+
interface CreateDaprAgentTurnWorkflowOptions {
|
|
143
|
+
workflowName?: string;
|
|
144
|
+
activityNames?: Partial<DaprAgentTurnWorkflowActivityNames>;
|
|
145
|
+
now?: () => string;
|
|
146
|
+
/**
|
|
147
|
+
* Timeout in milliseconds for durable human-input waits.
|
|
148
|
+
* When set, the workflow races `waitForExternalEvent` against a Dapr timer.
|
|
149
|
+
* If the timer fires first, the tool call is denied with a timeout message.
|
|
150
|
+
* Requires the workflow context to support `createTimer` and `whenAny`.
|
|
151
|
+
* Default: no timeout (wait indefinitely).
|
|
152
|
+
*/
|
|
153
|
+
humanInputTimeoutMs?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Timeout in milliseconds for durable approval waits.
|
|
156
|
+
* Same semantics as `humanInputTimeoutMs`.
|
|
157
|
+
* Default: no timeout (wait indefinitely).
|
|
158
|
+
*/
|
|
159
|
+
approvalTimeoutMs?: number;
|
|
160
|
+
/**
|
|
161
|
+
* Enable mid-turn steering injection.
|
|
162
|
+
* When `true`, the workflow drains pending steer messages before each
|
|
163
|
+
* model-step and injects them as user messages.
|
|
164
|
+
* Requires a configured steer-drain activity.
|
|
165
|
+
* Default: `true`.
|
|
166
|
+
*/
|
|
167
|
+
steeringEnabled?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Maximum number of workflow steps before issuing `continueAsNew`.
|
|
170
|
+
* Resets the Dapr workflow history to prevent unbounded growth in
|
|
171
|
+
* long-running agents. The turn state is preserved across the reset.
|
|
172
|
+
* Default: no limit (history grows until the turn completes).
|
|
173
|
+
*/
|
|
174
|
+
continueAsNewThreshold?: number;
|
|
175
|
+
/**
|
|
176
|
+
* Enable deferred follow-up queuing.
|
|
177
|
+
* When `true`, the durable host accepts follow-up requests and stores
|
|
178
|
+
* them in the follow-up runtime for next-turn seeding.
|
|
179
|
+
* Default: `true`.
|
|
180
|
+
*/
|
|
181
|
+
followUpsEnabled?: boolean;
|
|
182
|
+
}
|
|
183
|
+
type CreateDaprAgentTurnWorkflowRegistrationOptions = CreateDaprAgentTurnWorkflowOptions;
|
|
184
|
+
interface DaprAgentTurnModelStepActivityOptions {
|
|
185
|
+
runtime: AgentTurnStepRuntimeConfig | (() => AgentTurnStepRuntimeConfig);
|
|
186
|
+
tools: Record<string, Tool.Info> | (() => Record<string, Tool.Info>);
|
|
187
|
+
toModelMessages?: typeof convertAgentMessagesToModelMessages;
|
|
188
|
+
mcpTools?: PrepareModelStepOptions["mcpTools"] | (() => Promise<PrepareModelStepOptions["mcpTools"]>);
|
|
189
|
+
host?: ToolHost | (() => ToolHost | undefined);
|
|
190
|
+
turnTracker?: TurnTrackerContext;
|
|
191
|
+
middleware?: MiddlewareRunner | (() => MiddlewareRunner | undefined);
|
|
192
|
+
reasoningLevel?: ReasoningLevel | (() => ReasoningLevel | undefined);
|
|
193
|
+
/**
|
|
194
|
+
* Resolve system prompts dynamically at model-step execution time.
|
|
195
|
+
*
|
|
196
|
+
* When provided, called at the start of every model-step activity with
|
|
197
|
+
* the session ID and the prompts carried in the workflow state. The
|
|
198
|
+
* returned prompts replace `plan.systemPrompts` for that step.
|
|
199
|
+
*
|
|
200
|
+
* This keeps the workflow future-proof for dynamic prompt injection
|
|
201
|
+
* (MCP prompt resources, middleware-injected instructions, etc.)
|
|
202
|
+
* without freezing prompts at workflow start.
|
|
203
|
+
*
|
|
204
|
+
* During Dapr replay the activity result is cached, so the resolver
|
|
205
|
+
* only runs on the first execution of each activity — not on replay.
|
|
206
|
+
*/
|
|
207
|
+
resolveSystemPrompts?: (sessionId: string, current: string[]) => Promise<string[]> | string[];
|
|
208
|
+
createAbortSignal?: () => AbortSignal;
|
|
209
|
+
onEvent?: (sessionId: string, event: AgentEvent) => void | Promise<void>;
|
|
210
|
+
now?: () => string;
|
|
211
|
+
/** Observer bridge for OTel trace context propagation. */
|
|
212
|
+
observerBridge?: DaprWorkflowObserverBridge;
|
|
213
|
+
}
|
|
214
|
+
interface DaprAgentTurnToolCallActivityOptions {
|
|
215
|
+
tools: Record<string, Tool.Info> | (() => Record<string, Tool.Info>);
|
|
216
|
+
cwd: string;
|
|
217
|
+
host?: ToolHost | (() => ToolHost | undefined);
|
|
218
|
+
turnTracker?: TurnTrackerContext;
|
|
219
|
+
middleware?: MiddlewareRunner | (() => MiddlewareRunner | undefined);
|
|
220
|
+
createAbortSignal?: () => AbortSignal;
|
|
221
|
+
now?: () => string;
|
|
222
|
+
/** Observer bridge for OTel trace context propagation. */
|
|
223
|
+
observerBridge?: DaprWorkflowObserverBridge;
|
|
224
|
+
}
|
|
225
|
+
interface DaprAgentTurnApprovalCheckActivityOptions {
|
|
226
|
+
check: (input: DaprAgentTurnApprovalCheckInput) => Promise<DaprAgentTurnApprovalCheckResult> | DaprAgentTurnApprovalCheckResult;
|
|
227
|
+
}
|
|
228
|
+
interface DaprAgentTurnHumanInputCheckActivityOptions {
|
|
229
|
+
check: (input: DaprAgentTurnHumanInputCheckInput) => Promise<DaprAgentTurnHumanInputCheckResult> | DaprAgentTurnHumanInputCheckResult;
|
|
230
|
+
}
|
|
231
|
+
interface DaprAgentTurnSteerDrainActivityOptions {
|
|
232
|
+
drain: (input: DaprAgentTurnSteerDrainInput) => Promise<AgentWorkflowInterventionSnapshot[]> | AgentWorkflowInterventionSnapshot[];
|
|
233
|
+
}
|
|
234
|
+
interface DaprAgentTurnCommitActivityOptions {
|
|
235
|
+
persistMessages: (sessionId: string, messages: Message[]) => Promise<void>;
|
|
236
|
+
now?: () => string;
|
|
237
|
+
}
|
|
238
|
+
interface CreateDaprAgentTurnWorkflowDefinitionOptions extends CreateDaprAgentTurnWorkflowRegistrationOptions {
|
|
239
|
+
modelStep: (input: AgentWorkflowModelStepPlan) => Promise<AgentWorkflowModelStepResult> | AgentWorkflowModelStepResult;
|
|
240
|
+
steerDrain?: (input: DaprAgentTurnSteerDrainInput) => Promise<AgentWorkflowInterventionSnapshot[]> | AgentWorkflowInterventionSnapshot[];
|
|
241
|
+
toolCall: (input: AgentWorkflowToolCallPlan) => Promise<AgentWorkflowToolCallResult> | AgentWorkflowToolCallResult;
|
|
242
|
+
humanInputCheck?: (input: DaprAgentTurnHumanInputCheckInput) => Promise<DaprAgentTurnHumanInputCheckResult> | DaprAgentTurnHumanInputCheckResult;
|
|
243
|
+
approvalCheck?: (input: DaprAgentTurnApprovalCheckInput) => Promise<DaprAgentTurnApprovalCheckResult> | DaprAgentTurnApprovalCheckResult;
|
|
244
|
+
stepCommit: (input: AgentWorkflowInputCommitPlan | AgentWorkflowStepCommitPlan) => Promise<AgentWorkflowCommitResult> | AgentWorkflowCommitResult;
|
|
245
|
+
outputCommit: (input: AgentWorkflowOutputCommitPlan) => Promise<AgentWorkflowCommitResult> | AgentWorkflowCommitResult;
|
|
246
|
+
workflowToolHandlers?: readonly DaprAgentTurnWorkflowToolHandler[];
|
|
247
|
+
/**
|
|
248
|
+
* Optional observer bridge. When provided, the workflow generator emits
|
|
249
|
+
* lifecycle notifications (task-start, checkpoint, complete, error) so
|
|
250
|
+
* that `AgentTaskObserver`s work on the workflow path too.
|
|
251
|
+
*/
|
|
252
|
+
observerBridge?: DaprWorkflowObserverBridge;
|
|
253
|
+
/**
|
|
254
|
+
* Optional event sink for workflow-level events that are produced inside
|
|
255
|
+
* the orchestrator rather than model-step activities.
|
|
256
|
+
*
|
|
257
|
+
* Used for durable steering/intervention events that should reach the
|
|
258
|
+
* same real-time channels as direct execution.
|
|
259
|
+
*/
|
|
260
|
+
onEvent?: (sessionId: string, event: AgentEvent) => void | Promise<void>;
|
|
261
|
+
}
|
|
262
|
+
interface CreateDaprAgentTurnWorkflowKitOptions extends CreateDaprAgentTurnWorkflowRegistrationOptions {
|
|
263
|
+
modelStepActivity: DaprAgentTurnModelStepActivityOptions;
|
|
264
|
+
steerDrainActivity?: DaprAgentTurnSteerDrainActivityOptions;
|
|
265
|
+
humanInputCheckActivity?: DaprAgentTurnHumanInputCheckActivityOptions;
|
|
266
|
+
approvalCheckActivity?: DaprAgentTurnApprovalCheckActivityOptions;
|
|
267
|
+
toolCallActivity: DaprAgentTurnToolCallActivityOptions;
|
|
268
|
+
commitActivity: DaprAgentTurnCommitActivityOptions;
|
|
269
|
+
workflowToolHandlers?: readonly DaprAgentTurnWorkflowToolHandler[];
|
|
270
|
+
/** Optional observer bridge passed through to the workflow definition. */
|
|
271
|
+
observerBridge?: DaprWorkflowObserverBridge;
|
|
272
|
+
/** Optional workflow-level event sink passed through to the definition. */
|
|
273
|
+
onEvent?: (sessionId: string, event: AgentEvent) => void | Promise<void>;
|
|
274
|
+
}
|
|
275
|
+
interface DaprAgentTurnWorkflowToolHandlerInput {
|
|
276
|
+
context: DaprAgentTurnWorkflowContextLike;
|
|
277
|
+
plan: AgentWorkflowToolCallPlan;
|
|
278
|
+
now: string;
|
|
279
|
+
isReplaying: boolean;
|
|
280
|
+
}
|
|
281
|
+
type DaprAgentTurnWorkflowToolHandler = (input: DaprAgentTurnWorkflowToolHandlerInput) => AsyncGenerator<unknown, AgentWorkflowToolCallResult | undefined, unknown>;
|
|
282
|
+
interface DaprAgentTurnWorkflowKit extends DaprAgentTurnWorkflowRegistration {
|
|
283
|
+
activities: {
|
|
284
|
+
steerDrain?: DaprAgentTurnActivityRegistration<DaprAgentTurnSteerDrainInput, AgentWorkflowInterventionSnapshot[]>;
|
|
285
|
+
modelStep: DaprAgentTurnActivityRegistration<AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult>;
|
|
286
|
+
humanInputCheck?: DaprAgentTurnActivityRegistration<DaprAgentTurnHumanInputCheckInput, DaprAgentTurnHumanInputCheckResult>;
|
|
287
|
+
approvalCheck?: DaprAgentTurnActivityRegistration<DaprAgentTurnApprovalCheckInput, DaprAgentTurnApprovalCheckResult>;
|
|
288
|
+
toolCall: DaprAgentTurnActivityRegistration<AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult>;
|
|
289
|
+
stepCommit: DaprAgentTurnActivityRegistration<AgentWorkflowInputCommitPlan | AgentWorkflowStepCommitPlan, AgentWorkflowCommitResult>;
|
|
290
|
+
outputCommit: DaprAgentTurnActivityRegistration<AgentWorkflowOutputCommitPlan, AgentWorkflowCommitResult>;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Thin HTTP client for Dapr workflow management APIs.
|
|
296
|
+
*
|
|
297
|
+
* This intentionally mirrors the rest of `agent-runtime-dapr`: direct sidecar
|
|
298
|
+
* HTTP calls with retry/timeout behavior owned by `DaprSidecarClient`. The
|
|
299
|
+
* higher-level runtime/workflow adapter can build on this without pulling gRPC
|
|
300
|
+
* or DurableTask types into the package boundary.
|
|
301
|
+
*/
|
|
302
|
+
declare class DaprWorkflowClient {
|
|
303
|
+
private readonly client;
|
|
304
|
+
private readonly workflowComponent;
|
|
305
|
+
private readonly workflowApiVersion;
|
|
306
|
+
private readonly workflowPollIntervalMs;
|
|
307
|
+
constructor(options: DaprWorkflowClientOptions);
|
|
308
|
+
verifySidecar(): Promise<void>;
|
|
309
|
+
startWorkflow<TInput = unknown>(workflowName: string, options?: StartDaprWorkflowOptions<TInput>): Promise<DaprStartWorkflowResponse>;
|
|
310
|
+
getWorkflow(instanceId: string): Promise<DaprWorkflowState | undefined>;
|
|
311
|
+
waitForWorkflowStart(instanceId: string, options?: WaitForDaprWorkflowOptions): Promise<DaprWorkflowState | undefined>;
|
|
312
|
+
waitForWorkflowCompletion(instanceId: string, options?: WaitForDaprWorkflowOptions): Promise<DaprWorkflowState | undefined>;
|
|
313
|
+
pauseWorkflow(instanceId: string): Promise<void>;
|
|
314
|
+
resumeWorkflow(instanceId: string): Promise<void>;
|
|
315
|
+
terminateWorkflow(instanceId: string): Promise<void>;
|
|
316
|
+
purgeWorkflow(instanceId: string): Promise<void>;
|
|
317
|
+
raiseWorkflowEvent<TEventData = unknown>(instanceId: string, eventName: string, options?: RaiseDaprWorkflowEventOptions<TEventData>): Promise<void>;
|
|
318
|
+
private controlWorkflow;
|
|
319
|
+
private waitForWorkflowState;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export { hasStartedDaprWorkflow as A, isTerminalDaprWorkflowStatus as B, type CreateDaprAgentTurnWorkflowDefinitionOptions as C, DaprWorkflowClient as D, type RaiseDaprWorkflowEventOptions as R, type StartDaprWorkflowOptions as S, type WaitForDaprWorkflowOptions as W, type DaprAgentTurnWorkflowToolHandler as a, type DaprAgentTurnActivityRegistration as b, type CreateDaprAgentTurnWorkflowKitOptions as c, type CreateDaprAgentTurnWorkflowOptions as d, type DaprAgentTurnApprovalCheckActivityOptions as e, type DaprAgentTurnApprovalCheckInput as f, type DaprAgentTurnApprovalCheckResult as g, type DaprAgentTurnCommitActivityOptions as h, type DaprAgentTurnHumanInputCheckActivityOptions as i, type DaprAgentTurnHumanInputCheckInput as j, type DaprAgentTurnHumanInputCheckResult as k, type DaprAgentTurnModelStepActivityOptions as l, type DaprAgentTurnSteerDrainActivityOptions as m, type DaprAgentTurnSteerDrainInput as n, type DaprAgentTurnToolCallActivityOptions as o, type DaprAgentTurnWorkflowActivityNames as p, type DaprAgentTurnWorkflowContextLike as q, type DaprAgentTurnWorkflowDefinition as r, type DaprAgentTurnWorkflowKit as s, type DaprAgentTurnWorkflowRegistration as t, type DaprAgentTurnWorkflowToolHandlerInput as u, type DaprStartWorkflowResponse as v, type DaprWorkflowApiVersion as w, type DaprWorkflowClientOptions as x, type DaprWorkflowRuntimeStatus as y, type DaprWorkflowState as z };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { b as DaprAppDispatchExecutorOptions, c as DaprDispatchRecord, D as DaprDispatchRuntimeOptions, d as DaprDispatchTarget, e as DaprDispatchTargetInspection, f as DaprWorkflowDispatchExecutorOptions, R as RemoteAgentDispatchTargetOptions, W as WorkflowDispatchTargetOptions, g as createDaprAppDispatchExecutor, h as createDaprCompositeDispatchExecutor, i as createDaprDispatchRuntime, j as createDaprWorkflowDispatchExecutor, k as createRemoteAgentDispatchTarget, l as createWorkflowDispatchTarget } from '../index-BEOwKSPI.js';
|
|
2
|
+
import '@cuylabs/agent-core';
|
|
3
|
+
import '../workflow-bridge-BcicHH1Y.js';
|
|
4
|
+
import '../client-UsEIzDF6.js';
|
|
5
|
+
import '../workflow-host-D6W6fXoL.js';
|
|
6
|
+
import '@cuylabs/agent-core/events';
|
|
7
|
+
import '../invoker-B1jvz9DG.js';
|
|
8
|
+
import '../store-BXBIDz40.js';
|
|
9
|
+
import '@cuylabs/agent-runtime';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDaprAppDispatchExecutor,
|
|
3
|
+
createDaprCompositeDispatchExecutor,
|
|
4
|
+
createDaprDispatchRuntime,
|
|
5
|
+
createDaprWorkflowDispatchExecutor,
|
|
6
|
+
createRemoteAgentDispatchTarget,
|
|
7
|
+
createWorkflowDispatchTarget
|
|
8
|
+
} from "../chunk-YQQTUE6B.js";
|
|
9
|
+
import "../chunk-MQJ4LZOX.js";
|
|
10
|
+
export {
|
|
11
|
+
createDaprAppDispatchExecutor,
|
|
12
|
+
createDaprCompositeDispatchExecutor,
|
|
13
|
+
createDaprDispatchRuntime,
|
|
14
|
+
createDaprWorkflowDispatchExecutor,
|
|
15
|
+
createRemoteAgentDispatchTarget,
|
|
16
|
+
createWorkflowDispatchTarget
|
|
17
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { h as DaprExecutionStore } from '../store-
|
|
2
|
-
export { D as DaprExecutionCheckpointRecord, a as DaprExecutionCleanupOptions, b as DaprExecutionCleanupResult, c as DaprExecutionContextMetadata, d as DaprExecutionErrorRecord, e as DaprExecutionRunRecord, f as DaprExecutionSnapshot, g as DaprExecutionStatus } from '../store-
|
|
1
|
+
import { h as DaprExecutionStore } from '../store-BXBIDz40.js';
|
|
2
|
+
export { D as DaprExecutionCheckpointRecord, a as DaprExecutionCleanupOptions, b as DaprExecutionCleanupResult, c as DaprExecutionContextMetadata, d as DaprExecutionErrorRecord, e as DaprExecutionRunRecord, f as DaprExecutionSnapshot, g as DaprExecutionStatus } from '../store-BXBIDz40.js';
|
|
3
3
|
import { AgentTaskPayload, AgentTaskObserver, AgentTaskExecutionRun, AgentTaskExecutionSnapshot, AgentTaskExecutionCheckpoint, AgentTaskResult } from '@cuylabs/agent-core';
|
|
4
|
-
export { f as DaprWorkflowObserverBridge, g as DaprWorkflowObserverOptions, h as createWorkflowObserverBridge } from '../workflow-bridge-
|
|
4
|
+
export { f as DaprWorkflowObserverBridge, g as DaprWorkflowObserverOptions, h as createWorkflowObserverBridge } from '../workflow-bridge-BcicHH1Y.js';
|
|
5
|
+
import '@cuylabs/agent-runtime';
|
|
5
6
|
|
|
6
7
|
interface DaprExecutionObserverOptions<TPayload extends AgentTaskPayload = AgentTaskPayload> {
|
|
7
8
|
/**
|
|
@@ -72,7 +73,7 @@ declare function createDaprLoggingObserver<TPayload extends AgentTaskPayload = A
|
|
|
72
73
|
* └─ execute_tool greet ← otelMiddleware
|
|
73
74
|
* ```
|
|
74
75
|
*
|
|
75
|
-
* Span hierarchy (workflow execution — /agents/
|
|
76
|
+
* Span hierarchy (workflow execution — /agents/run-durable):
|
|
76
77
|
* ```
|
|
77
78
|
* agent.turn ← this observer
|
|
78
79
|
* └─ invoke_agent my-agent ← otelMiddleware (via runChatStart/End)
|
package/dist/execution/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createDaprLoggingObserver,
|
|
6
6
|
createOtelObserver,
|
|
7
7
|
createWorkflowObserverBridge
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-5CJIC4YB.js";
|
|
9
|
+
import "../chunk-MQJ4LZOX.js";
|
|
10
10
|
export {
|
|
11
11
|
DaprExecutionObserver,
|
|
12
12
|
DaprExecutionStore,
|
package/dist/host/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as CreateDaprAgentServerAdapterOptions, a as CreateRemoteAgentToolOptions, D as DaprAgentDurableRunOptions, b as DaprAgentDurableRunResult, N as DaprAgentHttpHandlerOptions, O as DaprAgentHttpRoute, c as DaprAgentRunner, d as DaprAgentRunnerOptions, e as DaprAgentRuntimeBundle, f as DaprAgentRuntimeOptions, g as DaprAgentServeOptions, h as DaprAgentTaskErrorContext, i as DaprAgentTaskResultContext, j as DaprHostApp, P as DaprHostHttpHandler, k as DaprHostHttpHandlerOptions, l as DaprHostHttpServer, m as DaprHostHttpServerOptions, n as DaprHostReadinessCheck, o as DaprHostReadinessStatus, p as DaprHostRemoteRunRequest, q as DaprHostedAgentInfo, Q as DaprHttpServerOptions, u as DaprMultiAgentRunner, v as DaprMultiAgentRunnerAgentConfig, w as DaprMultiAgentRunnerOptions, y as DaprWorkloadErrorContext, z as DaprWorkloadResultContext, A as DaprWorkloadRuntimeBundle, B as DaprWorkloadRuntimeOptions, E as createDaprAgentRunner, F as createDaprAgentRuntime, G as createDaprAgentServerAdapter, H as createDaprHostHttpHandler, J as createDaprMultiAgentRunner, K as createDaprWorkloadRuntime, L as createRemoteAgentTool, M as startDaprHostHttpServer, R as startDaprHttpServer } from '../index-BmM58WZa.js';
|
|
2
|
+
export { D as DaprInvokeMethodOptions, a as DaprInvokeMethodResult, b as DaprServiceInvoker, c as DaprServiceInvokerOptions, R as RemoteAgentRunRequest, d as RemoteAgentRunResponse, i as invokeRemoteAgentRun } from '../invoker-B1jvz9DG.js';
|
|
3
|
+
export { b as DaprAgentWorkflowFollowUpRequest, a as DaprAgentWorkflowHost, c as DaprAgentWorkflowHostOptions, d as DaprAgentWorkflowRunRequest, e as DaprAgentWorkflowRunResult, f as DaprAgentWorkflowSteerRequest, g as DaprApprovalDecision, h as DaprApprovalRequestListOptions, i as DaprApprovalRequestRecord, j as DaprApprovalRequestStatus, k as DaprApprovalResolution, l as DaprFollowUpListOptions, m as DaprFollowUpRecord, n as DaprHumanInputRequestListOptions, o as DaprHumanInputRequestRecord, p as DaprHumanInputRequestStatus, q as DaprPubSubEventBridge, r as DaprPubSubEventBridgeOptions, s as DaprSteerRecord, t as DaprWorkflowApprovalCheckInput, u as DaprWorkflowApprovalCheckResult, v as DaprWorkflowApprovalRuntime, w as DaprWorkflowApprovalRuntimeOptions, x as DaprWorkflowEventRaiserLike, y as DaprWorkflowFollowUpRuntime, z as DaprWorkflowFollowUpRuntimeOptions, A as DaprWorkflowHumanInputCheckInput, B as DaprWorkflowHumanInputCheckResult, C as DaprWorkflowHumanInputRuntime, E as DaprWorkflowHumanInputRuntimeOptions, D as DaprWorkflowRuntimeRegistrar, F as DaprWorkflowStarterLike, G as DaprWorkflowSteerRuntime, H as DaprWorkflowSteerRuntimeOptions, I as createDaprAgentWorkflowHost, J as createDaprPubSubEventBridge, K as createDaprWorkflowApprovalRuntime, L as createDaprWorkflowFollowUpRuntime, M as createDaprWorkflowHumanInputRuntime, N as createDaprWorkflowSteerRuntime, O as startDaprAgentWorkflowTurn } from '../workflow-host-D6W6fXoL.js';
|
|
4
|
+
export { D as DaprWorkflowWorker, a as DaprWorkflowWorkerAgentDefinition, b as DaprWorkflowWorkerLogger, c as DaprWorkflowWorkerOptions, d as DaprWorkflowWorkerRuntime, e as createDaprWorkflowWorker } from '../worker-CXq0IFGX.js';
|
|
5
|
+
export { EventBus, EventBusMessage, EventBusOptions, EventBusSubscribeOptions, EventBusSubscription, createEventBus } from '@cuylabs/agent-core/events';
|
|
2
6
|
import '@cuylabs/agent-core';
|
|
3
|
-
import '../store-
|
|
4
|
-
import '../workflow-bridge-C8Z1yr0Y.js';
|
|
5
|
-
import '../workflow/index.js';
|
|
7
|
+
import '../store-BXBIDz40.js';
|
|
6
8
|
import '@cuylabs/agent-runtime';
|
|
9
|
+
import '../workflow-bridge-BcicHH1Y.js';
|
|
10
|
+
import '../client-UsEIzDF6.js';
|
|
7
11
|
import 'node:http';
|
package/dist/host/index.js
CHANGED
|
@@ -1,29 +1,49 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DaprServiceInvoker,
|
|
3
2
|
createDaprAgentRunner,
|
|
4
3
|
createDaprAgentRuntime,
|
|
4
|
+
createDaprAgentServerAdapter,
|
|
5
5
|
createDaprAgentWorkflowHost,
|
|
6
6
|
createDaprHostHttpHandler,
|
|
7
7
|
createDaprMultiAgentRunner,
|
|
8
|
+
createDaprPubSubEventBridge,
|
|
9
|
+
createDaprWorkflowApprovalRuntime,
|
|
10
|
+
createDaprWorkflowFollowUpRuntime,
|
|
11
|
+
createDaprWorkflowHumanInputRuntime,
|
|
12
|
+
createDaprWorkflowSteerRuntime,
|
|
8
13
|
createDaprWorkflowWorker,
|
|
9
14
|
createDaprWorkloadRuntime,
|
|
10
|
-
|
|
15
|
+
createEventBus,
|
|
16
|
+
createRemoteAgentTool,
|
|
11
17
|
startDaprAgentWorkflowTurn,
|
|
12
|
-
startDaprHostHttpServer
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import
|
|
16
|
-
|
|
18
|
+
startDaprHostHttpServer,
|
|
19
|
+
startDaprHttpServer
|
|
20
|
+
} from "../chunk-MJKJT3ZO.js";
|
|
21
|
+
import {
|
|
22
|
+
DaprServiceInvoker,
|
|
23
|
+
invokeRemoteAgentRun
|
|
24
|
+
} from "../chunk-YQQTUE6B.js";
|
|
25
|
+
import "../chunk-5CJIC4YB.js";
|
|
26
|
+
import "../chunk-YS2CWYBQ.js";
|
|
27
|
+
import "../chunk-MQJ4LZOX.js";
|
|
17
28
|
export {
|
|
18
29
|
DaprServiceInvoker,
|
|
19
30
|
createDaprAgentRunner,
|
|
20
31
|
createDaprAgentRuntime,
|
|
32
|
+
createDaprAgentServerAdapter,
|
|
21
33
|
createDaprAgentWorkflowHost,
|
|
22
34
|
createDaprHostHttpHandler,
|
|
23
35
|
createDaprMultiAgentRunner,
|
|
36
|
+
createDaprPubSubEventBridge,
|
|
37
|
+
createDaprWorkflowApprovalRuntime,
|
|
38
|
+
createDaprWorkflowFollowUpRuntime,
|
|
39
|
+
createDaprWorkflowHumanInputRuntime,
|
|
40
|
+
createDaprWorkflowSteerRuntime,
|
|
24
41
|
createDaprWorkflowWorker,
|
|
25
42
|
createDaprWorkloadRuntime,
|
|
43
|
+
createEventBus,
|
|
44
|
+
createRemoteAgentTool,
|
|
26
45
|
invokeRemoteAgentRun,
|
|
27
46
|
startDaprAgentWorkflowTurn,
|
|
28
|
-
startDaprHostHttpServer
|
|
47
|
+
startDaprHostHttpServer,
|
|
48
|
+
startDaprHttpServer
|
|
29
49
|
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { DispatchRecord, DispatchTarget, DispatchTargetInspection, DispatchRuntime, TaskExecutor } from '@cuylabs/agent-core';
|
|
2
|
+
import { e as DaprStateStoreClientOptions } from './workflow-bridge-BcicHH1Y.js';
|
|
3
|
+
import { D as DaprWorkflowClient, z as DaprWorkflowState } from './client-UsEIzDF6.js';
|
|
4
|
+
import { a as DaprAgentWorkflowHost, d as DaprAgentWorkflowRunRequest } from './workflow-host-D6W6fXoL.js';
|
|
5
|
+
import { b as DaprServiceInvoker, c as DaprServiceInvokerOptions } from './invoker-B1jvz9DG.js';
|
|
6
|
+
import { h as DaprExecutionStore } from './store-BXBIDz40.js';
|
|
7
|
+
|
|
8
|
+
interface DaprDispatchRecord extends DispatchRecord {
|
|
9
|
+
agentId: string;
|
|
10
|
+
}
|
|
11
|
+
type DaprDispatchTargetInspection = DispatchTargetInspection;
|
|
12
|
+
type DaprDispatchTarget = DispatchTarget<DaprDispatchRecord>;
|
|
13
|
+
interface DaprDispatchRuntimeOptions extends DaprStateStoreClientOptions {
|
|
14
|
+
agentId: string;
|
|
15
|
+
targets: readonly DaprDispatchTarget[];
|
|
16
|
+
keyPrefix?: string;
|
|
17
|
+
now?: () => string;
|
|
18
|
+
pollIntervalMs?: number;
|
|
19
|
+
createId?: () => string;
|
|
20
|
+
}
|
|
21
|
+
interface DaprDispatchRecordWriterOptions extends DaprStateStoreClientOptions {
|
|
22
|
+
agentId: string;
|
|
23
|
+
keyPrefix?: string;
|
|
24
|
+
}
|
|
25
|
+
interface WorkflowDispatchTargetOptions {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
host: DaprAgentWorkflowHost;
|
|
29
|
+
client: DaprWorkflowClient;
|
|
30
|
+
/**
|
|
31
|
+
* Optional hook for customizing the child workflow input.
|
|
32
|
+
* `message`, `sessionId`, and `workflowInstanceId` defaults are provided.
|
|
33
|
+
*/
|
|
34
|
+
buildRequest?: (input: {
|
|
35
|
+
id: string;
|
|
36
|
+
brief: string;
|
|
37
|
+
title: string;
|
|
38
|
+
parentSessionId?: string;
|
|
39
|
+
sessionId?: string;
|
|
40
|
+
}) => DaprAgentWorkflowRunRequest;
|
|
41
|
+
/**
|
|
42
|
+
* Optional terminal-state reader that can attach a final result or
|
|
43
|
+
* richer error details when the child workflow completes.
|
|
44
|
+
*/
|
|
45
|
+
readCompletion?: (input: {
|
|
46
|
+
record: DaprDispatchRecord;
|
|
47
|
+
workflow: DaprWorkflowState;
|
|
48
|
+
}) => Promise<Pick<DispatchTargetInspection, "result" | "error"> | undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* When `true`, waits for the child workflow to reach a running state
|
|
51
|
+
* before returning the dispatch record. This confirms the sidecar has
|
|
52
|
+
* actually scheduled the workflow before the caller proceeds.
|
|
53
|
+
* Default: `false`.
|
|
54
|
+
*/
|
|
55
|
+
waitForStart?: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface RemoteAgentDispatchTargetOptions {
|
|
58
|
+
name: string;
|
|
59
|
+
description: string;
|
|
60
|
+
appId: string;
|
|
61
|
+
agentId?: string;
|
|
62
|
+
invoker?: DaprServiceInvoker;
|
|
63
|
+
invokerOptions?: DaprServiceInvokerOptions;
|
|
64
|
+
buildRunRequest?: (input: {
|
|
65
|
+
id: string;
|
|
66
|
+
brief: string;
|
|
67
|
+
title: string;
|
|
68
|
+
parentSessionId?: string;
|
|
69
|
+
sessionId?: string;
|
|
70
|
+
}) => {
|
|
71
|
+
message: string;
|
|
72
|
+
sessionId?: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
declare function createWorkflowDispatchTarget(options: WorkflowDispatchTargetOptions): DaprDispatchTarget;
|
|
76
|
+
declare function createRemoteAgentDispatchTarget(options: RemoteAgentDispatchTargetOptions): DaprDispatchTarget;
|
|
77
|
+
declare function createDaprDispatchRuntime(options: DaprDispatchRuntimeOptions): DispatchRuntime;
|
|
78
|
+
|
|
79
|
+
interface DaprWorkflowDispatchExecutorOptions {
|
|
80
|
+
workflowHosts: Map<string, DaprAgentWorkflowHost>;
|
|
81
|
+
workflowClient: DaprWorkflowClient;
|
|
82
|
+
executionStore?: DaprExecutionStore;
|
|
83
|
+
timeoutMs?: number;
|
|
84
|
+
pollIntervalMs?: number;
|
|
85
|
+
}
|
|
86
|
+
declare function createDaprWorkflowDispatchExecutor(options: DaprWorkflowDispatchExecutorOptions): TaskExecutor;
|
|
87
|
+
interface DaprAppDispatchExecutorOptions {
|
|
88
|
+
appsByRole: Map<string, string>;
|
|
89
|
+
invoker?: DaprServiceInvoker;
|
|
90
|
+
invokerOptions?: DaprServiceInvokerOptions;
|
|
91
|
+
timeoutMs?: number;
|
|
92
|
+
pollIntervalMs?: number;
|
|
93
|
+
}
|
|
94
|
+
declare function createDaprAppDispatchExecutor(options: DaprAppDispatchExecutorOptions): TaskExecutor;
|
|
95
|
+
declare function createDaprCompositeDispatchExecutor(options: {
|
|
96
|
+
workflow?: DaprWorkflowDispatchExecutorOptions;
|
|
97
|
+
app?: DaprAppDispatchExecutorOptions;
|
|
98
|
+
fallback?: TaskExecutor;
|
|
99
|
+
}): TaskExecutor;
|
|
100
|
+
|
|
101
|
+
export { type DaprDispatchRuntimeOptions as D, type RemoteAgentDispatchTargetOptions as R, type WorkflowDispatchTargetOptions as W, type DaprDispatchRecordWriterOptions as a, type DaprAppDispatchExecutorOptions as b, type DaprDispatchRecord as c, type DaprDispatchTarget as d, type DaprDispatchTargetInspection as e, type DaprWorkflowDispatchExecutorOptions as f, createDaprAppDispatchExecutor as g, createDaprCompositeDispatchExecutor as h, createDaprDispatchRuntime as i, createDaprWorkflowDispatchExecutor as j, createRemoteAgentDispatchTarget as k, createWorkflowDispatchTarget as l };
|