@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,63 @@
|
|
|
1
|
+
import { e as DaprAgentTurnApprovalCheckActivityOptions, b as DaprAgentTurnActivityRegistration, f as DaprAgentTurnApprovalCheckInput, g as DaprAgentTurnApprovalCheckResult, i as DaprAgentTurnHumanInputCheckActivityOptions, j as DaprAgentTurnHumanInputCheckInput, k as DaprAgentTurnHumanInputCheckResult, l as DaprAgentTurnModelStepActivityOptions, h as DaprAgentTurnCommitActivityOptions, m as DaprAgentTurnSteerDrainActivityOptions, n as DaprAgentTurnSteerDrainInput, o as DaprAgentTurnToolCallActivityOptions, C as CreateDaprAgentTurnWorkflowDefinitionOptions, t as DaprAgentTurnWorkflowRegistration, c as CreateDaprAgentTurnWorkflowKitOptions, s as DaprAgentTurnWorkflowKit } from './client-UsEIzDF6.js';
|
|
2
|
+
import { AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult, AgentWorkflowOutputCommitPlan, AgentWorkflowCommitResult, AgentWorkflowInputCommitPlan, AgentWorkflowStepCommitPlan, AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult } from '@cuylabs/agent-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Durable activity handlers for agent-turn workflows.
|
|
6
|
+
*
|
|
7
|
+
* Each activity is a single checkpointed unit of work:
|
|
8
|
+
* - Model-step: runs the LLM (one inference call)
|
|
9
|
+
* - Tool-call: executes a single tool
|
|
10
|
+
* - Step-commit: persists assistant/tool messages to session store
|
|
11
|
+
* - Output-commit: persists the final assistant output
|
|
12
|
+
*
|
|
13
|
+
* Extracted from `runtime.ts` for maintainability.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
declare function createDaprAgentTurnSteerDrainActivity(options: DaprAgentTurnSteerDrainActivityOptions): DaprAgentTurnActivityRegistration<DaprAgentTurnSteerDrainInput, {
|
|
17
|
+
id: string;
|
|
18
|
+
message: string;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
}[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Build the default model-step activity over the extracted `agent-core`
|
|
23
|
+
* phase helpers.
|
|
24
|
+
*/
|
|
25
|
+
declare function createDaprAgentTurnModelStepActivity(options: DaprAgentTurnModelStepActivityOptions): DaprAgentTurnActivityRegistration<AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Build the default single-tool-call activity.
|
|
28
|
+
*
|
|
29
|
+
* One tool call per activity is the durable boundary used by the workflow
|
|
30
|
+
* adapter. That is intentionally finer-grained than the in-process
|
|
31
|
+
* `runToolBatch(...)` helper.
|
|
32
|
+
*/
|
|
33
|
+
declare function createDaprAgentTurnToolCallActivity(options: DaprAgentTurnToolCallActivityOptions): DaprAgentTurnActivityRegistration<AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult>;
|
|
34
|
+
declare function createDaprAgentTurnApprovalCheckActivity(options: DaprAgentTurnApprovalCheckActivityOptions): DaprAgentTurnActivityRegistration<DaprAgentTurnApprovalCheckInput, DaprAgentTurnApprovalCheckResult>;
|
|
35
|
+
declare function createDaprAgentTurnHumanInputCheckActivity(options: DaprAgentTurnHumanInputCheckActivityOptions): DaprAgentTurnActivityRegistration<DaprAgentTurnHumanInputCheckInput, DaprAgentTurnHumanInputCheckResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Build the default step-commit activity that appends assistant/tool messages
|
|
38
|
+
* to the durable session store owned by the host app.
|
|
39
|
+
*/
|
|
40
|
+
declare function createDaprAgentTurnStepCommitActivity(options: DaprAgentTurnCommitActivityOptions): DaprAgentTurnActivityRegistration<AgentWorkflowInputCommitPlan | AgentWorkflowStepCommitPlan, AgentWorkflowCommitResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Build the default output-commit activity that appends the final assistant
|
|
43
|
+
* message to the durable session store owned by the host app.
|
|
44
|
+
*/
|
|
45
|
+
declare function createDaprAgentTurnOutputCommitActivity(options: DaprAgentTurnCommitActivityOptions): DaprAgentTurnActivityRegistration<AgentWorkflowOutputCommitPlan, AgentWorkflowCommitResult>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Create the deterministic workflow definition that a host app can register
|
|
49
|
+
* with the Dapr JS SDK runtime.
|
|
50
|
+
*
|
|
51
|
+
* The returned workflow stays SDK-agnostic at the package boundary: it only
|
|
52
|
+
* assumes a context with `callActivity()` and optional `setCustomStatus()`.
|
|
53
|
+
*/
|
|
54
|
+
declare function createDaprAgentTurnWorkflowDefinition(options: CreateDaprAgentTurnWorkflowDefinitionOptions): DaprAgentTurnWorkflowRegistration;
|
|
55
|
+
/**
|
|
56
|
+
* Create a full workflow registration kit with default activity handlers.
|
|
57
|
+
*
|
|
58
|
+
* Host apps can register the returned workflow and activities directly with the
|
|
59
|
+
* Dapr JS SDK runtime while keeping execution semantics in `agent-core`.
|
|
60
|
+
*/
|
|
61
|
+
declare function createDaprAgentTurnWorkflowKit(options: CreateDaprAgentTurnWorkflowKitOptions): DaprAgentTurnWorkflowKit;
|
|
62
|
+
|
|
63
|
+
export { createDaprAgentTurnHumanInputCheckActivity as a, createDaprAgentTurnModelStepActivity as b, createDaprAgentTurnApprovalCheckActivity as c, createDaprAgentTurnOutputCommitActivity as d, createDaprAgentTurnSteerDrainActivity as e, createDaprAgentTurnStepCommitActivity as f, createDaprAgentTurnToolCallActivity as g, createDaprAgentTurnWorkflowDefinition as h, createDaprAgentTurnWorkflowKit as i };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
import { a as DaprOrchestratorRunStoreOptions } from './workflow-bridge-BcicHH1Y.js';
|
|
2
|
+
export { D as DaprExecutionStoreOptions, b as DaprFetch, c as DaprRuntimeDriverOptions, d as DaprSidecarClientOptions, e as DaprStateStoreClientOptions, f as DaprWorkflowObserverBridge, g as DaprWorkflowObserverOptions, h as createWorkflowObserverBridge } from './workflow-bridge-BcicHH1Y.js';
|
|
3
|
+
import { D as DaprWorkflowClient, a as DaprAgentTurnWorkflowToolHandler, b as DaprAgentTurnActivityRegistration } from './client-UsEIzDF6.js';
|
|
4
|
+
export { C as CreateDaprAgentTurnWorkflowDefinitionOptions, c as CreateDaprAgentTurnWorkflowKitOptions, d as CreateDaprAgentTurnWorkflowOptions, e as DaprAgentTurnApprovalCheckActivityOptions, f as DaprAgentTurnApprovalCheckInput, g as DaprAgentTurnApprovalCheckResult, h as DaprAgentTurnCommitActivityOptions, i as DaprAgentTurnHumanInputCheckActivityOptions, j as DaprAgentTurnHumanInputCheckInput, k as DaprAgentTurnHumanInputCheckResult, l as DaprAgentTurnModelStepActivityOptions, m as DaprAgentTurnSteerDrainActivityOptions, n as DaprAgentTurnSteerDrainInput, o as DaprAgentTurnToolCallActivityOptions, p as DaprAgentTurnWorkflowActivityNames, q as DaprAgentTurnWorkflowContextLike, r as DaprAgentTurnWorkflowDefinition, s as DaprAgentTurnWorkflowKit, t as DaprAgentTurnWorkflowRegistration, u as DaprAgentTurnWorkflowToolHandlerInput, v as DaprStartWorkflowResponse, w as DaprWorkflowApiVersion, 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';
|
|
5
|
+
export { C as CreateDaprAgentServerAdapterOptions, a as CreateRemoteAgentToolOptions, D as DaprAgentDurableRunOptions, b as DaprAgentDurableRunResult, c as DaprAgentRunner, d as DaprAgentRunnerOptions, e as DaprAgentRuntimeBundle, f as DaprAgentRuntimeOptions, g as DaprAgentServeOptions, h as DaprAgentTaskErrorContext, i as DaprAgentTaskResultContext, j as DaprHostApp, k as DaprHostHttpHandlerOptions, l as DaprHostHttpServer, m as DaprHostHttpServerOptions, n as DaprHostReadinessCheck, o as DaprHostReadinessStatus, p as DaprHostRemoteRunRequest, q as DaprHostedAgentInfo, r as DaprHttpJobHandlerOptions, s as DaprHttpJobHandlerResult, t as DaprJobTriggerHandler, u as DaprMultiAgentRunner, v as DaprMultiAgentRunnerAgentConfig, w as DaprMultiAgentRunnerOptions, x as DaprRuntimeDriver, y as DaprWorkloadErrorContext, z as DaprWorkloadResultContext, A as DaprWorkloadRuntimeBundle, B as DaprWorkloadRuntimeOptions, E as createDaprAgentRunner, F as createDaprAgentRuntime, G as createDaprAgentServerAdapter, H as createDaprHostHttpHandler, I as createDaprHttpJobHandler, J as createDaprMultiAgentRunner, K as createDaprWorkloadRuntime, L as createRemoteAgentTool, M as startDaprHostHttpServer } from './index-BmM58WZa.js';
|
|
6
|
+
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, h as DaprExecutionStore } from './store-BXBIDz40.js';
|
|
6
7
|
export { DaprExecutionObserver, DaprExecutionObserverOptions, DaprHostLoggerLike, DaprLoggingObserverOptions, OtelObserverConfig, createDaprExecutionObserver, createDaprLoggingObserver, createOtelObserver } from './execution/index.js';
|
|
7
8
|
import { OrchestratorRunStatus, OrchestratorRunStore, OrchestratorRunRecord } from '@cuylabs/agent-runtime';
|
|
8
|
-
|
|
9
|
+
export { c as createDaprAgentTurnApprovalCheckActivity, a as createDaprAgentTurnHumanInputCheckActivity, b as createDaprAgentTurnModelStepActivity, d as createDaprAgentTurnOutputCommitActivity, e as createDaprAgentTurnSteerDrainActivity, f as createDaprAgentTurnStepCommitActivity, g as createDaprAgentTurnToolCallActivity, h as createDaprAgentTurnWorkflowDefinition, i as createDaprAgentTurnWorkflowKit } from './index-CFm5LORU.js';
|
|
10
|
+
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';
|
|
11
|
+
import { a as DaprAgentWorkflowHost } from './workflow-host-D6W6fXoL.js';
|
|
12
|
+
export { b as DaprAgentWorkflowFollowUpRequest, 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';
|
|
13
|
+
export { D as DaprWorkflowWorker, a as DaprWorkflowWorkerAgentDefinition, b as DaprWorkflowWorkerLogger, c as DaprWorkflowWorkerOptions, d as DaprWorkflowWorkerRuntime, e as createDaprWorkflowWorker } from './worker-CXq0IFGX.js';
|
|
14
|
+
export { EventBus, EventBusMessage, EventBusOptions, EventBusSubscribeOptions, EventBusSubscription, createEventBus } from '@cuylabs/agent-core/events';
|
|
15
|
+
import { D as DaprDispatchRuntimeOptions, a as DaprDispatchRecordWriterOptions } from './index-BEOwKSPI.js';
|
|
16
|
+
export { b as DaprAppDispatchExecutorOptions, c as DaprDispatchRecord, 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';
|
|
17
|
+
import { SubAgentRole, Agent, Tool } from '@cuylabs/agent-core';
|
|
18
|
+
export { AppliedCoordinatorActionsResult, ApplyCoordinatorActionsActivityOptions, ApplyCoordinatorActionsInput, CheckTrackedTasksTerminalActivityOptions, CheckTrackedTasksTerminalInput, CollectWorkerReportsActivityOptions, CollectWorkerReportsInput, CollectedWorkerReportsResult, CommitExternalTaskActivityOptions, CommitExternalTaskInput, CommittedCoordinatorTaskResult, CoordinatorAssignment, CoordinatorChildLaunch, CoordinatorReasonActivityInput, CoordinatorReasonActivityOptions, CoordinatorReasonResult, CoordinatorRecordedAction, CoordinatorTaskNotification, CoordinatorTrackedTask, CoordinatorWorkflowActivityNames, CoordinatorWorkflowInput, CoordinatorWorkflowRegistration, CoordinatorWorkflowResult, CreateCoordinatorWorkflowOptions, DaprMailboxStore, DaprMailboxStoreOptions, DaprTaskBoardStore, DaprTaskBoardStoreOptions, DaprTeamDispatchOptions, DaprTeamDurableRunOptions, DaprTeamDurableRunStartResult, DaprTeamDurableRunState, DaprTeamHttpHandlerOptions, DaprTeamRunner, DaprTeamRunnerOptions, DaprTeamServeOptions, PrepareExternalTasksActivityOptions, PrepareExternalTasksInput, PreparedExternalTasksResult, createApplyCoordinatorActionsActivity, createCheckTrackedTasksTerminalActivity, createCollectWorkerReportsActivity, createCommitExternalTaskActivity, createCoordinatorReasonActivity, createCoordinatorWorkflowDefinition, createDaprTeamHttpHandler, createDaprTeamRunner, createPrepareExternalTasksActivity } from './team/index.js';
|
|
9
19
|
import 'node:http';
|
|
20
|
+
import '@cuylabs/agent-core/team';
|
|
10
21
|
|
|
11
22
|
interface DaprOrchestratorRunCleanupOptions {
|
|
12
23
|
maxAgeMs?: number;
|
|
@@ -31,17 +42,54 @@ declare class DaprOrchestratorRunStore<TInput = unknown, TResult = unknown> impl
|
|
|
31
42
|
remove(runId: string): Promise<boolean>;
|
|
32
43
|
cleanup(options?: DaprOrchestratorRunCleanupOptions): Promise<DaprOrchestratorRunCleanupResult>;
|
|
33
44
|
private stateKeyForRun;
|
|
34
|
-
private stateKeyForIndex;
|
|
35
45
|
private readRun;
|
|
36
46
|
private writeRun;
|
|
37
|
-
private readIndex;
|
|
38
|
-
private writeIndex;
|
|
39
|
-
private addToIndex;
|
|
40
|
-
private removeFromIndex;
|
|
41
47
|
private listRunsViaStateQuery;
|
|
42
|
-
private listRunsFromIndex;
|
|
43
48
|
private decodeStoredRun;
|
|
44
|
-
private updateIndex;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
|
|
51
|
+
declare const DAPR_SUBAGENT_BACKEND = "@cuylabs/agent-runtime-dapr/workflow";
|
|
52
|
+
interface DaprSubAgentToolsOptions extends Omit<DaprDispatchRuntimeOptions, "targets" | "agentId"> {
|
|
53
|
+
agentId: string;
|
|
54
|
+
roles: readonly SubAgentRole[];
|
|
55
|
+
workflowHosts: ReadonlyMap<string, DaprAgentWorkflowHost>;
|
|
56
|
+
workflowComponent: string;
|
|
57
|
+
workflowClient?: DaprWorkflowClient;
|
|
58
|
+
async?: boolean;
|
|
59
|
+
sessionTitlePrefix?: string;
|
|
60
|
+
maxConcurrent?: number;
|
|
61
|
+
maxDepth?: number;
|
|
62
|
+
currentDepth?: number;
|
|
63
|
+
}
|
|
64
|
+
interface DaprSubAgentInstallOptions extends Omit<DaprSubAgentToolsOptions, "roles" | "async" | "sessionTitlePrefix"> {
|
|
65
|
+
agent: Agent;
|
|
66
|
+
config: DaprSubAgentConfig;
|
|
67
|
+
}
|
|
68
|
+
interface DaprSubAgentConfig {
|
|
69
|
+
roles: readonly SubAgentRole[];
|
|
70
|
+
async?: boolean;
|
|
71
|
+
sessionTitlePrefix?: string;
|
|
72
|
+
maxConcurrent?: number;
|
|
73
|
+
maxDepth?: number;
|
|
74
|
+
currentDepth?: number;
|
|
75
|
+
mode?: "dispatch" | "child-workflow";
|
|
76
|
+
}
|
|
77
|
+
declare function configureDaprSubAgents(agent: object, config: DaprSubAgentConfig): DaprSubAgentConfig;
|
|
78
|
+
declare function getConfiguredDaprSubAgents(agent: object): DaprSubAgentConfig | undefined;
|
|
79
|
+
declare function createDaprSubAgentTools(options: DaprSubAgentToolsOptions): Tool.AnyInfo[];
|
|
80
|
+
declare function installDaprSubAgents(options: DaprSubAgentInstallOptions): readonly Tool.AnyInfo[];
|
|
81
|
+
|
|
82
|
+
interface CreateDaprSubAgentWorkflowSupportOptions extends DaprDispatchRecordWriterOptions {
|
|
83
|
+
workflowName: string;
|
|
84
|
+
agentId: string;
|
|
85
|
+
config: DaprSubAgentConfig;
|
|
86
|
+
roles: readonly SubAgentRole[];
|
|
87
|
+
workflowHosts: ReadonlyMap<string, DaprAgentWorkflowHost>;
|
|
88
|
+
}
|
|
89
|
+
interface DaprSubAgentWorkflowSupport {
|
|
90
|
+
workflowToolHandlers: readonly DaprAgentTurnWorkflowToolHandler[];
|
|
91
|
+
additionalActivities: readonly DaprAgentTurnActivityRegistration<any, any>[];
|
|
92
|
+
}
|
|
93
|
+
declare function createDaprSubAgentWorkflowSupport(options: CreateDaprSubAgentWorkflowSupportOptions): DaprSubAgentWorkflowSupport;
|
|
94
|
+
|
|
95
|
+
export { type CreateDaprSubAgentWorkflowSupportOptions, DAPR_SUBAGENT_BACKEND, DaprAgentTurnActivityRegistration, DaprAgentTurnWorkflowToolHandler, DaprAgentWorkflowHost, DaprDispatchRuntimeOptions, type DaprOrchestratorRunCleanupOptions, type DaprOrchestratorRunCleanupResult, DaprOrchestratorRunStore, DaprOrchestratorRunStoreOptions, type DaprSubAgentConfig, type DaprSubAgentInstallOptions, type DaprSubAgentToolsOptions, type DaprSubAgentWorkflowSupport, DaprWorkflowClient, configureDaprSubAgents, createDaprSubAgentTools, createDaprSubAgentWorkflowSupport, getConfiguredDaprSubAgents, installDaprSubAgents };
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DAPR_SUBAGENT_BACKEND,
|
|
3
|
+
DaprMailboxStore,
|
|
2
4
|
DaprOrchestratorRunStore,
|
|
3
5
|
DaprRuntimeDriver,
|
|
4
|
-
|
|
6
|
+
DaprTaskBoardStore,
|
|
7
|
+
configureDaprSubAgents,
|
|
8
|
+
createApplyCoordinatorActionsActivity,
|
|
9
|
+
createCheckTrackedTasksTerminalActivity,
|
|
10
|
+
createCollectWorkerReportsActivity,
|
|
11
|
+
createCommitExternalTaskActivity,
|
|
12
|
+
createCoordinatorReasonActivity,
|
|
13
|
+
createCoordinatorWorkflowDefinition,
|
|
5
14
|
createDaprAgentRunner,
|
|
6
15
|
createDaprAgentRuntime,
|
|
16
|
+
createDaprAgentServerAdapter,
|
|
7
17
|
createDaprAgentWorkflowHost,
|
|
8
18
|
createDaprHostHttpHandler,
|
|
9
19
|
createDaprHttpJobHandler,
|
|
10
20
|
createDaprMultiAgentRunner,
|
|
21
|
+
createDaprPubSubEventBridge,
|
|
22
|
+
createDaprSubAgentTools,
|
|
23
|
+
createDaprSubAgentWorkflowSupport,
|
|
24
|
+
createDaprTeamHttpHandler,
|
|
25
|
+
createDaprTeamRunner,
|
|
26
|
+
createDaprWorkflowApprovalRuntime,
|
|
27
|
+
createDaprWorkflowFollowUpRuntime,
|
|
28
|
+
createDaprWorkflowHumanInputRuntime,
|
|
29
|
+
createDaprWorkflowSteerRuntime,
|
|
11
30
|
createDaprWorkflowWorker,
|
|
12
31
|
createDaprWorkloadRuntime,
|
|
13
|
-
|
|
32
|
+
createEventBus,
|
|
33
|
+
createPrepareExternalTasksActivity,
|
|
34
|
+
createRemoteAgentTool,
|
|
35
|
+
getConfiguredDaprSubAgents,
|
|
36
|
+
installDaprSubAgents,
|
|
14
37
|
startDaprAgentWorkflowTurn,
|
|
15
38
|
startDaprHostHttpServer
|
|
16
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-MJKJT3ZO.js";
|
|
40
|
+
import {
|
|
41
|
+
DaprServiceInvoker,
|
|
42
|
+
createDaprAppDispatchExecutor,
|
|
43
|
+
createDaprCompositeDispatchExecutor,
|
|
44
|
+
createDaprDispatchRuntime,
|
|
45
|
+
createDaprWorkflowDispatchExecutor,
|
|
46
|
+
createRemoteAgentDispatchTarget,
|
|
47
|
+
createWorkflowDispatchTarget,
|
|
48
|
+
invokeRemoteAgentRun
|
|
49
|
+
} from "./chunk-YQQTUE6B.js";
|
|
17
50
|
import {
|
|
18
51
|
DaprExecutionObserver,
|
|
19
52
|
DaprExecutionStore,
|
|
@@ -21,45 +54,82 @@ import {
|
|
|
21
54
|
createDaprLoggingObserver,
|
|
22
55
|
createOtelObserver,
|
|
23
56
|
createWorkflowObserverBridge
|
|
24
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-5CJIC4YB.js";
|
|
25
58
|
import {
|
|
26
59
|
DaprWorkflowClient,
|
|
60
|
+
createDaprAgentTurnApprovalCheckActivity,
|
|
61
|
+
createDaprAgentTurnHumanInputCheckActivity,
|
|
27
62
|
createDaprAgentTurnModelStepActivity,
|
|
28
63
|
createDaprAgentTurnOutputCommitActivity,
|
|
64
|
+
createDaprAgentTurnSteerDrainActivity,
|
|
29
65
|
createDaprAgentTurnStepCommitActivity,
|
|
30
66
|
createDaprAgentTurnToolCallActivity,
|
|
31
67
|
createDaprAgentTurnWorkflowDefinition,
|
|
32
68
|
createDaprAgentTurnWorkflowKit,
|
|
33
69
|
hasStartedDaprWorkflow,
|
|
34
70
|
isTerminalDaprWorkflowStatus
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import "./chunk-
|
|
71
|
+
} from "./chunk-YS2CWYBQ.js";
|
|
72
|
+
import "./chunk-MQJ4LZOX.js";
|
|
37
73
|
export {
|
|
74
|
+
DAPR_SUBAGENT_BACKEND,
|
|
38
75
|
DaprExecutionObserver,
|
|
39
76
|
DaprExecutionStore,
|
|
77
|
+
DaprMailboxStore,
|
|
40
78
|
DaprOrchestratorRunStore,
|
|
41
79
|
DaprRuntimeDriver,
|
|
42
80
|
DaprServiceInvoker,
|
|
81
|
+
DaprTaskBoardStore,
|
|
43
82
|
DaprWorkflowClient,
|
|
83
|
+
configureDaprSubAgents,
|
|
84
|
+
createApplyCoordinatorActionsActivity,
|
|
85
|
+
createCheckTrackedTasksTerminalActivity,
|
|
86
|
+
createCollectWorkerReportsActivity,
|
|
87
|
+
createCommitExternalTaskActivity,
|
|
88
|
+
createCoordinatorReasonActivity,
|
|
89
|
+
createCoordinatorWorkflowDefinition,
|
|
44
90
|
createDaprAgentRunner,
|
|
45
91
|
createDaprAgentRuntime,
|
|
92
|
+
createDaprAgentServerAdapter,
|
|
93
|
+
createDaprAgentTurnApprovalCheckActivity,
|
|
94
|
+
createDaprAgentTurnHumanInputCheckActivity,
|
|
46
95
|
createDaprAgentTurnModelStepActivity,
|
|
47
96
|
createDaprAgentTurnOutputCommitActivity,
|
|
97
|
+
createDaprAgentTurnSteerDrainActivity,
|
|
48
98
|
createDaprAgentTurnStepCommitActivity,
|
|
49
99
|
createDaprAgentTurnToolCallActivity,
|
|
50
100
|
createDaprAgentTurnWorkflowDefinition,
|
|
51
101
|
createDaprAgentTurnWorkflowKit,
|
|
52
102
|
createDaprAgentWorkflowHost,
|
|
103
|
+
createDaprAppDispatchExecutor,
|
|
104
|
+
createDaprCompositeDispatchExecutor,
|
|
105
|
+
createDaprDispatchRuntime,
|
|
53
106
|
createDaprExecutionObserver,
|
|
54
107
|
createDaprHostHttpHandler,
|
|
55
108
|
createDaprHttpJobHandler,
|
|
56
109
|
createDaprLoggingObserver,
|
|
57
110
|
createDaprMultiAgentRunner,
|
|
111
|
+
createDaprPubSubEventBridge,
|
|
112
|
+
createDaprSubAgentTools,
|
|
113
|
+
createDaprSubAgentWorkflowSupport,
|
|
114
|
+
createDaprTeamHttpHandler,
|
|
115
|
+
createDaprTeamRunner,
|
|
116
|
+
createDaprWorkflowApprovalRuntime,
|
|
117
|
+
createDaprWorkflowDispatchExecutor,
|
|
118
|
+
createDaprWorkflowFollowUpRuntime,
|
|
119
|
+
createDaprWorkflowHumanInputRuntime,
|
|
120
|
+
createDaprWorkflowSteerRuntime,
|
|
58
121
|
createDaprWorkflowWorker,
|
|
59
122
|
createDaprWorkloadRuntime,
|
|
123
|
+
createEventBus,
|
|
60
124
|
createOtelObserver,
|
|
125
|
+
createPrepareExternalTasksActivity,
|
|
126
|
+
createRemoteAgentDispatchTarget,
|
|
127
|
+
createRemoteAgentTool,
|
|
128
|
+
createWorkflowDispatchTarget,
|
|
61
129
|
createWorkflowObserverBridge,
|
|
130
|
+
getConfiguredDaprSubAgents,
|
|
62
131
|
hasStartedDaprWorkflow,
|
|
132
|
+
installDaprSubAgents,
|
|
63
133
|
invokeRemoteAgentRun,
|
|
64
134
|
isTerminalDaprWorkflowStatus,
|
|
65
135
|
startDaprAgentWorkflowTurn,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AgentTaskPayload, AgentTaskResult } from '@cuylabs/agent-core';
|
|
2
|
+
|
|
3
|
+
interface DaprServiceInvokerOptions {
|
|
4
|
+
/** Dapr sidecar HTTP endpoint. Defaults to http://127.0.0.1:3500. */
|
|
5
|
+
daprHttpEndpoint?: string;
|
|
6
|
+
/** Optional Dapr API token sent as the dapr-api-token header. */
|
|
7
|
+
apiToken?: string;
|
|
8
|
+
/** Default request timeout in milliseconds. Defaults to 15000. */
|
|
9
|
+
requestTimeoutMs?: number;
|
|
10
|
+
/** Override fetch implementation for tests/custom runtimes. */
|
|
11
|
+
fetch?: typeof fetch;
|
|
12
|
+
}
|
|
13
|
+
interface DaprInvokeMethodOptions<TBody = unknown> {
|
|
14
|
+
/** HTTP method for invocation. Defaults to POST when body exists, otherwise GET. */
|
|
15
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
16
|
+
/** Request body. Objects are serialized as JSON. */
|
|
17
|
+
body?: TBody;
|
|
18
|
+
/** Additional HTTP headers. */
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
/** Query-string parameters appended to method URL. */
|
|
21
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
22
|
+
/** Per-request timeout override in milliseconds. */
|
|
23
|
+
timeoutMs?: number;
|
|
24
|
+
}
|
|
25
|
+
interface DaprInvokeMethodResult<TResponse = unknown> {
|
|
26
|
+
status: number;
|
|
27
|
+
data: TResponse | undefined;
|
|
28
|
+
headers: Headers;
|
|
29
|
+
}
|
|
30
|
+
/** Default request contract for invoking a remote agent over service invocation. */
|
|
31
|
+
interface RemoteAgentRunRequest extends AgentTaskPayload {
|
|
32
|
+
}
|
|
33
|
+
/** Default response contract for remote agent execution. */
|
|
34
|
+
interface RemoteAgentRunResponse extends AgentTaskResult {
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare class DaprServiceInvoker {
|
|
38
|
+
private readonly daprHttpEndpoint;
|
|
39
|
+
private readonly apiToken?;
|
|
40
|
+
private readonly requestTimeoutMs;
|
|
41
|
+
private readonly fetchImpl;
|
|
42
|
+
constructor(options?: DaprServiceInvokerOptions);
|
|
43
|
+
invokeMethod<TResponse = unknown, TBody = unknown>(appId: string, methodPath: string, options?: DaprInvokeMethodOptions<TBody>): Promise<DaprInvokeMethodResult<TResponse>>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Invoke a remote agent endpoint using the default run contract.
|
|
47
|
+
*
|
|
48
|
+
* Default route: `POST /agents/run`.
|
|
49
|
+
*/
|
|
50
|
+
declare function invokeRemoteAgentRun(invoker: DaprServiceInvoker, appId: string, request: RemoteAgentRunRequest, methodPath?: string): Promise<RemoteAgentRunResponse>;
|
|
51
|
+
|
|
52
|
+
export { type DaprInvokeMethodOptions as D, type RemoteAgentRunRequest as R, type DaprInvokeMethodResult as a, DaprServiceInvoker as b, type DaprServiceInvokerOptions as c, type RemoteAgentRunResponse as d, invokeRemoteAgentRun as i };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AgentTaskPayload, AgentTaskCheckpointReason, AgentTaskExecutionSnapshot, AgentTurnState, AgentTaskResult, AgentTaskExecutionRun, AgentTaskExecutionCheckpoint } from '@cuylabs/agent-core';
|
|
2
|
-
import {
|
|
1
|
+
import { AgentTaskPayload, AgentTaskResumeSnapshot, AgentTaskCheckpointReason, AgentTaskExecutionSnapshot, AgentTurnState, AgentTaskResult, AgentTaskExecutionRun, AgentTaskExecutionCheckpoint } from '@cuylabs/agent-core';
|
|
2
|
+
import { ExecutionStore, ExecutionRunRecord, ExecutionListOptions, ExecutionCheckpointRecord } from '@cuylabs/agent-runtime';
|
|
3
|
+
import { D as DaprExecutionStoreOptions } from './workflow-bridge-BcicHH1Y.js';
|
|
3
4
|
|
|
4
5
|
interface DaprExecutionCleanupOptions {
|
|
5
6
|
maxAgeMs?: number;
|
|
@@ -65,10 +66,25 @@ interface DaprExecutionCheckpointRecord<TPayload extends AgentTaskPayload = Agen
|
|
|
65
66
|
event?: unknown;
|
|
66
67
|
createdAt: string;
|
|
67
68
|
}
|
|
68
|
-
declare class DaprExecutionStore<TPayload extends AgentTaskPayload = AgentTaskPayload> {
|
|
69
|
+
declare class DaprExecutionStore<TPayload extends AgentTaskPayload = AgentTaskPayload> implements ExecutionStore {
|
|
69
70
|
private readonly client;
|
|
70
71
|
private readonly keyPrefix;
|
|
71
72
|
constructor(options: DaprExecutionStoreOptions);
|
|
73
|
+
get(sessionId: string): Promise<ExecutionRunRecord | undefined>;
|
|
74
|
+
list(options?: ExecutionListOptions): Promise<ExecutionRunRecord[]>;
|
|
75
|
+
listGenericCheckpoints(sessionId: string): Promise<ExecutionCheckpointRecord[]>;
|
|
76
|
+
remove(sessionId: string): Promise<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Build a resume snapshot from a persisted execution record.
|
|
79
|
+
*
|
|
80
|
+
* Returns `undefined` if no execution exists for the session or the
|
|
81
|
+
* execution is already in a terminal state (completed/failed).
|
|
82
|
+
*
|
|
83
|
+
* The returned snapshot can be passed as `context.restoreFrom` to
|
|
84
|
+
* `createAgentTaskRunner(...)` to resume the direct-path execution
|
|
85
|
+
* from where it left off.
|
|
86
|
+
*/
|
|
87
|
+
buildResumeSnapshot(sessionId: string): Promise<AgentTaskResumeSnapshot | undefined>;
|
|
72
88
|
getExecution(sessionId: string): Promise<DaprExecutionRunRecord<TPayload> | undefined>;
|
|
73
89
|
listExecutions(): Promise<DaprExecutionRunRecord<TPayload>[]>;
|
|
74
90
|
listCheckpoints(sessionId: string): Promise<DaprExecutionCheckpointRecord<TPayload>[]>;
|
|
@@ -89,6 +105,11 @@ declare class DaprExecutionStore<TPayload extends AgentTaskPayload = AgentTaskPa
|
|
|
89
105
|
private addCheckpointToIndex;
|
|
90
106
|
private listCheckpointsFromIndex;
|
|
91
107
|
private writeExecution;
|
|
108
|
+
/**
|
|
109
|
+
* Read-modify-write the execution record with optimistic concurrency.
|
|
110
|
+
* Retries on etag conflict up to 4 times.
|
|
111
|
+
*/
|
|
112
|
+
private updateExecution;
|
|
92
113
|
private writeCheckpoint;
|
|
93
114
|
private decodeExecution;
|
|
94
115
|
private decodeCheckpoint;
|