@cuylabs/agent-runtime-dapr 0.11.0 → 0.13.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/dist/{chunk-YS2CWYBQ.js → chunk-2TBZCBXE.js} +20 -23
- package/dist/{chunk-YQQTUE6B.js → chunk-6BLY7B7U.js} +41 -31
- package/dist/{chunk-O7H3XGY2.js → chunk-EJBODJQR.js} +368 -254
- package/dist/{chunk-MQJ4LZOX.js → chunk-HQLQRXU5.js} +6 -3
- package/dist/{chunk-5CJIC4YB.js → chunk-VKPTE4J6.js} +28 -10
- package/dist/dispatch/index.js +2 -2
- package/dist/execution/index.js +2 -2
- package/dist/host/index.js +5 -5
- package/dist/index.js +5 -5
- package/dist/team/index.js +5 -5
- package/dist/workflow/index.js +2 -2
- package/package.json +4 -4
|
@@ -5,23 +5,23 @@ import {
|
|
|
5
5
|
createWorkflowDispatchTarget,
|
|
6
6
|
invokeRemoteAgentRun,
|
|
7
7
|
readWorkflowCompletion
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6BLY7B7U.js";
|
|
9
9
|
import {
|
|
10
10
|
DaprExecutionStore,
|
|
11
11
|
createDaprExecutionObserver,
|
|
12
12
|
createDaprLoggingObserver,
|
|
13
13
|
createWorkflowObserverBridge
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VKPTE4J6.js";
|
|
15
15
|
import {
|
|
16
16
|
DaprWorkflowClient,
|
|
17
17
|
createDaprAgentTurnWorkflowKit,
|
|
18
18
|
isTerminalDaprWorkflowStatus
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-2TBZCBXE.js";
|
|
20
20
|
import {
|
|
21
21
|
DaprSidecarClient,
|
|
22
22
|
__export,
|
|
23
23
|
isDaprConflictError
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-HQLQRXU5.js";
|
|
25
25
|
|
|
26
26
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
27
27
|
var external_exports = {};
|
|
@@ -4082,11 +4082,10 @@ function formatRemoteResult(name, appId, response, sessionId) {
|
|
|
4082
4082
|
};
|
|
4083
4083
|
}
|
|
4084
4084
|
async function executeDirect(invoker, appId, name, message, sessionId) {
|
|
4085
|
-
const response = await invokeRemoteAgentRun(
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
);
|
|
4085
|
+
const response = await invokeRemoteAgentRun(invoker, appId, {
|
|
4086
|
+
message,
|
|
4087
|
+
...sessionId ? { sessionId } : {}
|
|
4088
|
+
});
|
|
4090
4089
|
return formatRemoteResult(name, appId, response, sessionId);
|
|
4091
4090
|
}
|
|
4092
4091
|
async function startRemoteWorkflow(invoker, appId, message, sessionId) {
|
|
@@ -4139,12 +4138,7 @@ async function fetchExecutionResult(invoker, appId, agentId, sessionId) {
|
|
|
4139
4138
|
return result.data;
|
|
4140
4139
|
}
|
|
4141
4140
|
async function executeWorkflow(invoker, appId, name, message, pollIntervalMs, timeoutMs, sessionId) {
|
|
4142
|
-
const started = await startRemoteWorkflow(
|
|
4143
|
-
invoker,
|
|
4144
|
-
appId,
|
|
4145
|
-
message,
|
|
4146
|
-
sessionId
|
|
4147
|
-
);
|
|
4141
|
+
const started = await startRemoteWorkflow(invoker, appId, message, sessionId);
|
|
4148
4142
|
const agentId = started.agentId ?? name;
|
|
4149
4143
|
const finalState = await pollWorkflowCompletion(
|
|
4150
4144
|
invoker,
|
|
@@ -4499,7 +4493,9 @@ function createDaprWorkflowApprovalRuntime(options) {
|
|
|
4499
4493
|
if (!strict) {
|
|
4500
4494
|
return void 0;
|
|
4501
4495
|
}
|
|
4502
|
-
throw new Error(
|
|
4496
|
+
throw new Error(
|
|
4497
|
+
`Approval request does not belong to agent: ${requestId}`
|
|
4498
|
+
);
|
|
4503
4499
|
}
|
|
4504
4500
|
if (record.status !== "pending") {
|
|
4505
4501
|
if (!strict) {
|
|
@@ -4703,7 +4699,9 @@ function createDaprWorkflowHumanInputRuntime(options) {
|
|
|
4703
4699
|
}
|
|
4704
4700
|
let parsed;
|
|
4705
4701
|
try {
|
|
4706
|
-
parsed = initialized.parameters.parse(
|
|
4702
|
+
parsed = initialized.parameters.parse(
|
|
4703
|
+
input.toolCall.args
|
|
4704
|
+
);
|
|
4707
4705
|
} catch (error) {
|
|
4708
4706
|
return {
|
|
4709
4707
|
action: "deny",
|
|
@@ -4763,26 +4761,28 @@ function createDaprWorkflowHumanInputRuntime(options) {
|
|
|
4763
4761
|
response: structuredClone(response)
|
|
4764
4762
|
};
|
|
4765
4763
|
try {
|
|
4766
|
-
await client.saveState(
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
{
|
|
4770
|
-
...current.etag ? { etag: current.etag, concurrency: "first-write" } : {}
|
|
4771
|
-
}
|
|
4772
|
-
);
|
|
4764
|
+
await client.saveState(requestKey(requestId), toStoredRecord2(next), {
|
|
4765
|
+
...current.etag ? { etag: current.etag, concurrency: "first-write" } : {}
|
|
4766
|
+
});
|
|
4773
4767
|
} catch (error) {
|
|
4774
4768
|
if (!isDaprConflictError(error)) {
|
|
4775
4769
|
throw error;
|
|
4776
4770
|
}
|
|
4777
4771
|
const latest = await getRequest(requestId);
|
|
4778
4772
|
if (!latest) {
|
|
4779
|
-
throw new Error(
|
|
4773
|
+
throw new Error(
|
|
4774
|
+
`Human input request not found after conflict: ${requestId}`
|
|
4775
|
+
);
|
|
4780
4776
|
}
|
|
4781
4777
|
return latest;
|
|
4782
4778
|
}
|
|
4783
|
-
await workflowClient.raiseWorkflowEvent(
|
|
4784
|
-
|
|
4785
|
-
|
|
4779
|
+
await workflowClient.raiseWorkflowEvent(
|
|
4780
|
+
next.workflowInstanceId,
|
|
4781
|
+
`human-input:${requestId}`,
|
|
4782
|
+
{
|
|
4783
|
+
eventData: response
|
|
4784
|
+
}
|
|
4785
|
+
);
|
|
4786
4786
|
await publishEvent(next.sessionId, {
|
|
4787
4787
|
type: "human-input-resolved",
|
|
4788
4788
|
id: requestId,
|
|
@@ -4881,7 +4881,13 @@ function createDaprWorkflowSteerRuntime(options) {
|
|
|
4881
4881
|
};
|
|
4882
4882
|
}
|
|
4883
4883
|
return {
|
|
4884
|
-
ids: [
|
|
4884
|
+
ids: [
|
|
4885
|
+
...new Set(
|
|
4886
|
+
entry.value.filter(
|
|
4887
|
+
(item) => typeof item === "string"
|
|
4888
|
+
)
|
|
4889
|
+
)
|
|
4890
|
+
],
|
|
4885
4891
|
etag: entry.etag,
|
|
4886
4892
|
exists: true
|
|
4887
4893
|
};
|
|
@@ -4942,7 +4948,11 @@ function createDaprWorkflowSteerRuntime(options) {
|
|
|
4942
4948
|
}
|
|
4943
4949
|
}
|
|
4944
4950
|
if (presentIds.length !== (current.ids ?? []).length) {
|
|
4945
|
-
await writeWorkflowIndex(
|
|
4951
|
+
await writeWorkflowIndex(
|
|
4952
|
+
workflowInstanceId,
|
|
4953
|
+
presentIds,
|
|
4954
|
+
current.etag
|
|
4955
|
+
).catch(() => {
|
|
4946
4956
|
});
|
|
4947
4957
|
}
|
|
4948
4958
|
return records;
|
|
@@ -5102,14 +5112,10 @@ function createDaprWorkflowFollowUpRuntime(options) {
|
|
|
5102
5112
|
};
|
|
5103
5113
|
}
|
|
5104
5114
|
async function saveRecord(record, etag) {
|
|
5105
|
-
await client.saveState(
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
...etag ? { etag } : {},
|
|
5110
|
-
concurrency: "first-write"
|
|
5111
|
-
}
|
|
5112
|
-
);
|
|
5115
|
+
await client.saveState(requestKey(record.id), toStoredRecord4(record), {
|
|
5116
|
+
...etag ? { etag } : {},
|
|
5117
|
+
concurrency: "first-write"
|
|
5118
|
+
});
|
|
5113
5119
|
}
|
|
5114
5120
|
async function readIndex(key) {
|
|
5115
5121
|
const entry = await client.getStateEntry(key);
|
|
@@ -5124,7 +5130,13 @@ function createDaprWorkflowFollowUpRuntime(options) {
|
|
|
5124
5130
|
};
|
|
5125
5131
|
}
|
|
5126
5132
|
return {
|
|
5127
|
-
ids: [
|
|
5133
|
+
ids: [
|
|
5134
|
+
...new Set(
|
|
5135
|
+
entry.value.filter(
|
|
5136
|
+
(item) => typeof item === "string"
|
|
5137
|
+
)
|
|
5138
|
+
)
|
|
5139
|
+
],
|
|
5128
5140
|
etag: entry.etag,
|
|
5129
5141
|
exists: true
|
|
5130
5142
|
};
|
|
@@ -5248,7 +5260,9 @@ function createDaprWorkflowFollowUpRuntime(options) {
|
|
|
5248
5260
|
await saveRecord(next, etag);
|
|
5249
5261
|
} catch (error) {
|
|
5250
5262
|
if (isDaprConflictError(error)) {
|
|
5251
|
-
throw new Error(
|
|
5263
|
+
throw new Error(
|
|
5264
|
+
`Follow-up request changed concurrently: ${requestId}`
|
|
5265
|
+
);
|
|
5252
5266
|
}
|
|
5253
5267
|
throw error;
|
|
5254
5268
|
}
|
|
@@ -5311,9 +5325,18 @@ function normalizeStatus(value, fallback) {
|
|
|
5311
5325
|
return normalized;
|
|
5312
5326
|
}
|
|
5313
5327
|
function createDaprHttpJobHandler(options) {
|
|
5314
|
-
const handledStatus = normalizeStatus(
|
|
5315
|
-
|
|
5316
|
-
|
|
5328
|
+
const handledStatus = normalizeStatus(
|
|
5329
|
+
options.handledStatus,
|
|
5330
|
+
DEFAULT_HANDLED_STATUS
|
|
5331
|
+
);
|
|
5332
|
+
const unhandledStatus = normalizeStatus(
|
|
5333
|
+
options.unhandledStatus,
|
|
5334
|
+
DEFAULT_UNHANDLED_STATUS
|
|
5335
|
+
);
|
|
5336
|
+
const errorStatus = normalizeStatus(
|
|
5337
|
+
options.errorStatus,
|
|
5338
|
+
DEFAULT_ERROR_STATUS
|
|
5339
|
+
);
|
|
5317
5340
|
return async (jobName) => {
|
|
5318
5341
|
const normalizedJobName = String(jobName).trim();
|
|
5319
5342
|
if (!normalizedJobName) {
|
|
@@ -5357,7 +5380,9 @@ function normalizeDaprCronExpression(expr) {
|
|
|
5357
5380
|
if (parts.length === 6) {
|
|
5358
5381
|
return parts.join(" ");
|
|
5359
5382
|
}
|
|
5360
|
-
throw new Error(
|
|
5383
|
+
throw new Error(
|
|
5384
|
+
`Dapr cron schedules must have 5 or 6 fields. Received: ${expr}`
|
|
5385
|
+
);
|
|
5361
5386
|
}
|
|
5362
5387
|
var DaprJobsApi = class {
|
|
5363
5388
|
client;
|
|
@@ -5390,16 +5415,24 @@ var DaprJobsApi = class {
|
|
|
5390
5415
|
}
|
|
5391
5416
|
const payload = this.toSchedulePayload(job);
|
|
5392
5417
|
const name = this.toDaprJobName(job.id);
|
|
5393
|
-
await this.client.requestJson(
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5418
|
+
await this.client.requestJson(
|
|
5419
|
+
`/v1.0-alpha1/jobs/${encodeURIComponent(name)}`,
|
|
5420
|
+
{
|
|
5421
|
+
method: "POST",
|
|
5422
|
+
body: JSON.stringify(payload)
|
|
5423
|
+
},
|
|
5424
|
+
[200, 201, 204]
|
|
5425
|
+
);
|
|
5397
5426
|
}
|
|
5398
5427
|
async deleteJob(jobId) {
|
|
5399
5428
|
const name = this.toDaprJobName(jobId);
|
|
5400
|
-
await this.client.requestJson(
|
|
5401
|
-
|
|
5402
|
-
|
|
5429
|
+
await this.client.requestJson(
|
|
5430
|
+
`/v1.0-alpha1/jobs/${encodeURIComponent(name)}`,
|
|
5431
|
+
{
|
|
5432
|
+
method: "DELETE"
|
|
5433
|
+
},
|
|
5434
|
+
[200, 204, 404]
|
|
5435
|
+
);
|
|
5403
5436
|
}
|
|
5404
5437
|
toSchedulePayload(job) {
|
|
5405
5438
|
const payload = {
|
|
@@ -5424,9 +5457,13 @@ var DaprJobsApi = class {
|
|
|
5424
5457
|
return payload;
|
|
5425
5458
|
}
|
|
5426
5459
|
if (job.schedule.kind !== "cron") {
|
|
5427
|
-
throw new Error(
|
|
5460
|
+
throw new Error(
|
|
5461
|
+
`Unsupported schedule kind: ${String(job.schedule.kind)}`
|
|
5462
|
+
);
|
|
5428
5463
|
}
|
|
5429
|
-
if (job.schedule.timezone && !["UTC", "ETC/UTC", "Z"].includes(
|
|
5464
|
+
if (job.schedule.timezone && !["UTC", "ETC/UTC", "Z"].includes(
|
|
5465
|
+
job.schedule.timezone.trim().toUpperCase()
|
|
5466
|
+
)) {
|
|
5430
5467
|
throw new Error(
|
|
5431
5468
|
`Dapr jobs API does not expose timezone selection for cron schedules (received: ${job.schedule.timezone})`
|
|
5432
5469
|
);
|
|
@@ -5460,7 +5497,10 @@ var DaprRuntimeDriver = class {
|
|
|
5460
5497
|
started = false;
|
|
5461
5498
|
constructor(options) {
|
|
5462
5499
|
this.client = new DaprSidecarClient(options);
|
|
5463
|
-
this.keyPrefix = ensureNonEmpty5(
|
|
5500
|
+
this.keyPrefix = ensureNonEmpty5(
|
|
5501
|
+
options.keyPrefix ?? DEFAULT_KEY_PREFIX5,
|
|
5502
|
+
"keyPrefix"
|
|
5503
|
+
);
|
|
5464
5504
|
this.jobsApi = new DaprJobsApi({
|
|
5465
5505
|
client: this.client,
|
|
5466
5506
|
jobNamePrefix: ensureNonEmpty5(
|
|
@@ -5553,7 +5593,9 @@ var DaprRuntimeDriver = class {
|
|
|
5553
5593
|
return `${this.keyPrefix}jobs/${jobId}`;
|
|
5554
5594
|
}
|
|
5555
5595
|
async readJob(jobId) {
|
|
5556
|
-
const value = await this.client.getState(
|
|
5596
|
+
const value = await this.client.getState(
|
|
5597
|
+
this.stateKeyForJob(jobId)
|
|
5598
|
+
);
|
|
5557
5599
|
if (!value || typeof value !== "object") {
|
|
5558
5600
|
return void 0;
|
|
5559
5601
|
}
|
|
@@ -5642,7 +5684,10 @@ var DaprOrchestratorRunStore = class {
|
|
|
5642
5684
|
keyPrefix;
|
|
5643
5685
|
constructor(options) {
|
|
5644
5686
|
this.client = new DaprSidecarClient(options);
|
|
5645
|
-
this.keyPrefix = ensureNonEmpty6(
|
|
5687
|
+
this.keyPrefix = ensureNonEmpty6(
|
|
5688
|
+
options.keyPrefix ?? DEFAULT_KEY_PREFIX6,
|
|
5689
|
+
"keyPrefix"
|
|
5690
|
+
);
|
|
5646
5691
|
}
|
|
5647
5692
|
async start() {
|
|
5648
5693
|
await this.client.verifySidecar();
|
|
@@ -5717,7 +5762,9 @@ var DaprOrchestratorRunStore = class {
|
|
|
5717
5762
|
return `${this.keyPrefix}runs/${runId}`;
|
|
5718
5763
|
}
|
|
5719
5764
|
async readRun(runId) {
|
|
5720
|
-
const value = await this.client.getState(
|
|
5765
|
+
const value = await this.client.getState(
|
|
5766
|
+
this.stateKeyForRun(runId)
|
|
5767
|
+
);
|
|
5721
5768
|
if (!value || typeof value !== "object") {
|
|
5722
5769
|
return void 0;
|
|
5723
5770
|
}
|
|
@@ -5883,10 +5930,7 @@ function installDaprSubAgents(options) {
|
|
|
5883
5930
|
}
|
|
5884
5931
|
|
|
5885
5932
|
// src/subagents/host-graph.ts
|
|
5886
|
-
import {
|
|
5887
|
-
DEFAULT_SUBAGENT_DEPTH as DEFAULT_SUBAGENT_DEPTH2,
|
|
5888
|
-
SUBAGENT_TOOL_IDS
|
|
5889
|
-
} from "@cuylabs/agent-core";
|
|
5933
|
+
import { DEFAULT_SUBAGENT_DEPTH as DEFAULT_SUBAGENT_DEPTH2, SUBAGENT_TOOL_IDS } from "@cuylabs/agent-core";
|
|
5890
5934
|
|
|
5891
5935
|
// src/host/hosted-agent.ts
|
|
5892
5936
|
function createDaprHostedAgentBundle(options) {
|
|
@@ -6210,7 +6254,9 @@ function flattenHostedSubagentEntries(entries) {
|
|
|
6210
6254
|
}
|
|
6211
6255
|
function toWorkflowHostMap(entries) {
|
|
6212
6256
|
return new Map(
|
|
6213
|
-
entries.map(
|
|
6257
|
+
entries.map(
|
|
6258
|
+
(entry) => [entry.role.name, entry.bundle.workflowHost]
|
|
6259
|
+
)
|
|
6214
6260
|
);
|
|
6215
6261
|
}
|
|
6216
6262
|
function resolvedSubagentConfig(config, currentDepth, maxDepth) {
|
|
@@ -6256,7 +6302,11 @@ function wireDaprHostedSubagentGraph(options) {
|
|
|
6256
6302
|
...children.length > 0 && (options.config.mode ?? "child-workflow") === "child-workflow" ? createDaprSubAgentWorkflowSupport({
|
|
6257
6303
|
workflowName: `${id}:turn`,
|
|
6258
6304
|
agentId: id,
|
|
6259
|
-
config: resolvedSubagentConfig(
|
|
6305
|
+
config: resolvedSubagentConfig(
|
|
6306
|
+
options.config,
|
|
6307
|
+
childDepth,
|
|
6308
|
+
maxDepth
|
|
6309
|
+
),
|
|
6260
6310
|
roles: options.config.roles,
|
|
6261
6311
|
workflowHosts: toWorkflowHostMap(children),
|
|
6262
6312
|
stateStoreName: options.runtime.stateStoreName,
|
|
@@ -6343,7 +6393,9 @@ var DaprTaskBoardStore = class {
|
|
|
6343
6393
|
if (ids.length === 0) return [];
|
|
6344
6394
|
const members = [];
|
|
6345
6395
|
for (const id of ids) {
|
|
6346
|
-
const entry = await this.client.getStateEntry(
|
|
6396
|
+
const entry = await this.client.getStateEntry(
|
|
6397
|
+
this.memberKey(id)
|
|
6398
|
+
);
|
|
6347
6399
|
if (entry.value) {
|
|
6348
6400
|
this.memberEtags.set(id, entry.etag);
|
|
6349
6401
|
members.push(entry.value);
|
|
@@ -6352,7 +6404,9 @@ var DaprTaskBoardStore = class {
|
|
|
6352
6404
|
return members;
|
|
6353
6405
|
}
|
|
6354
6406
|
async getMember(memberId) {
|
|
6355
|
-
const entry = await this.client.getStateEntry(
|
|
6407
|
+
const entry = await this.client.getStateEntry(
|
|
6408
|
+
this.memberKey(memberId)
|
|
6409
|
+
);
|
|
6356
6410
|
this.memberEtags.set(memberId, entry.etag);
|
|
6357
6411
|
return entry.value;
|
|
6358
6412
|
}
|
|
@@ -6366,7 +6420,10 @@ var DaprTaskBoardStore = class {
|
|
|
6366
6420
|
} catch (error) {
|
|
6367
6421
|
this.memberEtags.delete(member.id);
|
|
6368
6422
|
if (isDaprConflictError(error)) {
|
|
6369
|
-
throw new TaskConflictError(
|
|
6423
|
+
throw new TaskConflictError(
|
|
6424
|
+
`Concurrent member update conflict: ${member.id}`,
|
|
6425
|
+
member.id
|
|
6426
|
+
);
|
|
6370
6427
|
}
|
|
6371
6428
|
throw error;
|
|
6372
6429
|
}
|
|
@@ -6399,7 +6456,9 @@ var DaprTaskBoardStore = class {
|
|
|
6399
6456
|
return tasks;
|
|
6400
6457
|
}
|
|
6401
6458
|
async getTask(taskId) {
|
|
6402
|
-
const entry = await this.client.getStateEntry(
|
|
6459
|
+
const entry = await this.client.getStateEntry(
|
|
6460
|
+
this.taskKey(taskId)
|
|
6461
|
+
);
|
|
6403
6462
|
this.taskEtags.set(taskId, entry.etag);
|
|
6404
6463
|
return entry.value;
|
|
6405
6464
|
}
|
|
@@ -6413,7 +6472,10 @@ var DaprTaskBoardStore = class {
|
|
|
6413
6472
|
} catch (error) {
|
|
6414
6473
|
this.taskEtags.delete(task.id);
|
|
6415
6474
|
if (isDaprConflictError(error)) {
|
|
6416
|
-
throw new TaskConflictError(
|
|
6475
|
+
throw new TaskConflictError(
|
|
6476
|
+
`Concurrent task update conflict: ${task.id}`,
|
|
6477
|
+
task.id
|
|
6478
|
+
);
|
|
6417
6479
|
}
|
|
6418
6480
|
throw error;
|
|
6419
6481
|
}
|
|
@@ -6425,7 +6487,9 @@ var DaprTaskBoardStore = class {
|
|
|
6425
6487
|
if (this.memberEtags.has(memberId)) {
|
|
6426
6488
|
return this.memberEtags.get(memberId);
|
|
6427
6489
|
}
|
|
6428
|
-
const entry = await this.client.getStateEntry(
|
|
6490
|
+
const entry = await this.client.getStateEntry(
|
|
6491
|
+
this.memberKey(memberId)
|
|
6492
|
+
);
|
|
6429
6493
|
this.memberEtags.set(memberId, entry.etag);
|
|
6430
6494
|
return entry.etag;
|
|
6431
6495
|
}
|
|
@@ -6433,7 +6497,9 @@ var DaprTaskBoardStore = class {
|
|
|
6433
6497
|
if (this.taskEtags.has(taskId)) {
|
|
6434
6498
|
return this.taskEtags.get(taskId);
|
|
6435
6499
|
}
|
|
6436
|
-
const entry = await this.client.getStateEntry(
|
|
6500
|
+
const entry = await this.client.getStateEntry(
|
|
6501
|
+
this.taskKey(taskId)
|
|
6502
|
+
);
|
|
6437
6503
|
this.taskEtags.set(taskId, entry.etag);
|
|
6438
6504
|
return entry.etag;
|
|
6439
6505
|
}
|
|
@@ -6442,11 +6508,7 @@ var DaprTaskBoardStore = class {
|
|
|
6442
6508
|
const entry = await this.client.getStateEntry(key);
|
|
6443
6509
|
if (!Array.isArray(entry.value)) return [];
|
|
6444
6510
|
return [
|
|
6445
|
-
...new Set(
|
|
6446
|
-
entry.value.filter(
|
|
6447
|
-
(v) => typeof v === "string"
|
|
6448
|
-
)
|
|
6449
|
-
)
|
|
6511
|
+
...new Set(entry.value.filter((v) => typeof v === "string"))
|
|
6450
6512
|
];
|
|
6451
6513
|
}
|
|
6452
6514
|
async addToIndex(key, id) {
|
|
@@ -6460,9 +6522,7 @@ var DaprTaskBoardStore = class {
|
|
|
6460
6522
|
const current = await this.client.getStateEntry(key);
|
|
6461
6523
|
const ids = Array.isArray(current.value) ? [
|
|
6462
6524
|
...new Set(
|
|
6463
|
-
current.value.filter(
|
|
6464
|
-
(v) => typeof v === "string"
|
|
6465
|
-
)
|
|
6525
|
+
current.value.filter((v) => typeof v === "string")
|
|
6466
6526
|
)
|
|
6467
6527
|
] : [];
|
|
6468
6528
|
const next = updater(ids);
|
|
@@ -6513,14 +6573,10 @@ var DaprMailboxStore = class {
|
|
|
6513
6573
|
if (ids.length === 0) return [];
|
|
6514
6574
|
let messages = [];
|
|
6515
6575
|
for (const id of ids) {
|
|
6516
|
-
const msg = await this.client.getState(
|
|
6517
|
-
this.messageKey(id)
|
|
6518
|
-
);
|
|
6576
|
+
const msg = await this.client.getState(this.messageKey(id));
|
|
6519
6577
|
if (msg) messages.push(msg);
|
|
6520
6578
|
}
|
|
6521
|
-
messages.sort(
|
|
6522
|
-
(a, b) => Date.parse(a.createdAt) - Date.parse(b.createdAt)
|
|
6523
|
-
);
|
|
6579
|
+
messages.sort((a, b) => Date.parse(a.createdAt) - Date.parse(b.createdAt));
|
|
6524
6580
|
if (filter?.teamId) {
|
|
6525
6581
|
messages = messages.filter((m) => m.teamId === filter.teamId);
|
|
6526
6582
|
}
|
|
@@ -6549,11 +6605,7 @@ var DaprMailboxStore = class {
|
|
|
6549
6605
|
);
|
|
6550
6606
|
if (!Array.isArray(entry.value)) return [];
|
|
6551
6607
|
return [
|
|
6552
|
-
...new Set(
|
|
6553
|
-
entry.value.filter(
|
|
6554
|
-
(v) => typeof v === "string"
|
|
6555
|
-
)
|
|
6556
|
-
)
|
|
6608
|
+
...new Set(entry.value.filter((v) => typeof v === "string"))
|
|
6557
6609
|
];
|
|
6558
6610
|
}
|
|
6559
6611
|
async addToIndex(id) {
|
|
@@ -6569,9 +6621,7 @@ var DaprMailboxStore = class {
|
|
|
6569
6621
|
);
|
|
6570
6622
|
const ids = Array.isArray(current.value) ? [
|
|
6571
6623
|
...new Set(
|
|
6572
|
-
current.value.filter(
|
|
6573
|
-
(v) => typeof v === "string"
|
|
6574
|
-
)
|
|
6624
|
+
current.value.filter((v) => typeof v === "string")
|
|
6575
6625
|
)
|
|
6576
6626
|
] : [];
|
|
6577
6627
|
const next = updater(ids);
|
|
@@ -6674,7 +6724,10 @@ function createCoordinatorWorkflowDefinition(options) {
|
|
|
6674
6724
|
},
|
|
6675
6725
|
launch.runId
|
|
6676
6726
|
);
|
|
6677
|
-
activeChildren.set(launch.taskId, {
|
|
6727
|
+
activeChildren.set(launch.taskId, {
|
|
6728
|
+
handle: childHandle,
|
|
6729
|
+
meta: launch
|
|
6730
|
+
});
|
|
6678
6731
|
}
|
|
6679
6732
|
}
|
|
6680
6733
|
const round = {
|
|
@@ -6713,9 +6766,13 @@ function createCoordinatorWorkflowDefinition(options) {
|
|
|
6713
6766
|
const reportEvent = ctx.waitForExternalEvent(
|
|
6714
6767
|
"worker-report"
|
|
6715
6768
|
);
|
|
6716
|
-
const timeout = ctx.createTimer(
|
|
6769
|
+
const timeout = ctx.createTimer(
|
|
6770
|
+
new Date(Date.now() + input.waitTimeoutMs)
|
|
6771
|
+
);
|
|
6717
6772
|
const waitingOn = [
|
|
6718
|
-
...[...activeChildren.values()].map(
|
|
6773
|
+
...[...activeChildren.values()].map(
|
|
6774
|
+
(entry) => entry.handle
|
|
6775
|
+
),
|
|
6719
6776
|
reportEvent,
|
|
6720
6777
|
timeout
|
|
6721
6778
|
];
|
|
@@ -6783,7 +6840,10 @@ function createCoordinatorWorkflowDefinition(options) {
|
|
|
6783
6840
|
},
|
|
6784
6841
|
launch.runId
|
|
6785
6842
|
);
|
|
6786
|
-
activeChildren.set(launch.taskId, {
|
|
6843
|
+
activeChildren.set(launch.taskId, {
|
|
6844
|
+
handle: childHandle,
|
|
6845
|
+
meta: launch
|
|
6846
|
+
});
|
|
6787
6847
|
}
|
|
6788
6848
|
}
|
|
6789
6849
|
const reportBatch = yield ctx.callActivity(
|
|
@@ -6804,10 +6864,9 @@ function createCoordinatorWorkflowDefinition(options) {
|
|
|
6804
6864
|
error: notification.error
|
|
6805
6865
|
}));
|
|
6806
6866
|
rounds.push(round);
|
|
6807
|
-
const terminalAfterEvent = trackedTaskIds.size === 0 ? true : yield ctx.callActivity(
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
);
|
|
6867
|
+
const terminalAfterEvent = trackedTaskIds.size === 0 ? true : yield ctx.callActivity(activityNames.checkTrackedTasksTerminal, {
|
|
6868
|
+
taskIds: [...trackedTaskIds]
|
|
6869
|
+
});
|
|
6811
6870
|
const transition = evaluateCoordinatorRoundTransition({
|
|
6812
6871
|
reasonAssignmentsCount: reasonResult.assignments.length,
|
|
6813
6872
|
activeTaskCount: activeChildren.size,
|
|
@@ -6819,7 +6878,11 @@ function createCoordinatorWorkflowDefinition(options) {
|
|
|
6819
6878
|
blockedMessage: "No runnable tasks remain. Review blocked work, abort stale tasks, or provide the final response."
|
|
6820
6879
|
});
|
|
6821
6880
|
if (transition.kind === "done") {
|
|
6822
|
-
return {
|
|
6881
|
+
return {
|
|
6882
|
+
response: transition.finalResponse,
|
|
6883
|
+
rounds,
|
|
6884
|
+
usage: totalUsage
|
|
6885
|
+
};
|
|
6823
6886
|
}
|
|
6824
6887
|
message = transition.nextMessage;
|
|
6825
6888
|
}
|
|
@@ -6863,9 +6926,7 @@ function createRecordingTools(members, actions, assignments, messages, aborts, n
|
|
|
6863
6926
|
prompt: external_exports.string().describe(
|
|
6864
6927
|
"Self-contained task prompt with all context the teammate needs"
|
|
6865
6928
|
),
|
|
6866
|
-
dependsOn: external_exports.array(external_exports.string()).optional().describe(
|
|
6867
|
-
"Task IDs this task must wait for before starting."
|
|
6868
|
-
)
|
|
6929
|
+
dependsOn: external_exports.array(external_exports.string()).optional().describe("Task IDs this task must wait for before starting.")
|
|
6869
6930
|
}),
|
|
6870
6931
|
execute: async (params) => {
|
|
6871
6932
|
const taskId = nextTaskId();
|
|
@@ -6935,11 +6996,7 @@ function createRecordingTools(members, actions, assignments, messages, aborts, n
|
|
|
6935
6996
|
return [assignTask, sendMessage, abortTask];
|
|
6936
6997
|
}
|
|
6937
6998
|
function createCoordinatorReasonActivity(options) {
|
|
6938
|
-
const {
|
|
6939
|
-
lead,
|
|
6940
|
-
coordinator,
|
|
6941
|
-
onCoordinatorEvent
|
|
6942
|
-
} = options;
|
|
6999
|
+
const { lead, coordinator, onCoordinatorEvent } = options;
|
|
6943
7000
|
let taskCounter = 0;
|
|
6944
7001
|
return async (_ctx, input) => {
|
|
6945
7002
|
const actions = [];
|
|
@@ -7026,7 +7083,9 @@ function createApplyCoordinatorActionsActivity(options) {
|
|
|
7026
7083
|
const aliasMap = /* @__PURE__ */ new Map();
|
|
7027
7084
|
for (const action of input.actions) {
|
|
7028
7085
|
if (action.kind === "assign") {
|
|
7029
|
-
const dependsOn = action.dependsOn?.map(
|
|
7086
|
+
const dependsOn = action.dependsOn?.map(
|
|
7087
|
+
(depId) => aliasMap.get(depId) ?? depId
|
|
7088
|
+
);
|
|
7030
7089
|
const task = await coordinator.queue({
|
|
7031
7090
|
memberId: action.memberId,
|
|
7032
7091
|
title: action.title,
|
|
@@ -7085,7 +7144,10 @@ function createCommitExternalTaskActivity(options) {
|
|
|
7085
7144
|
outcome = await coordinator.failExternalTask(input.taskId, input.error);
|
|
7086
7145
|
} else {
|
|
7087
7146
|
const taskResult = input.turnState ? extractTaskResult(input.turnState) ?? { response: "" } : { response: "" };
|
|
7088
|
-
outcome = await coordinator.completeExternalTask(
|
|
7147
|
+
outcome = await coordinator.completeExternalTask(
|
|
7148
|
+
input.taskId,
|
|
7149
|
+
taskResult
|
|
7150
|
+
);
|
|
7089
7151
|
}
|
|
7090
7152
|
if (!outcome) {
|
|
7091
7153
|
return { notifications: [] };
|
|
@@ -7242,16 +7304,11 @@ async function routeTeamRequest(request, segments, url, coordinator, eventBus, l
|
|
|
7242
7304
|
}
|
|
7243
7305
|
const wantsSSE = request.headers.get("accept")?.includes("text/event-stream");
|
|
7244
7306
|
if (wantsSSE && eventBus) {
|
|
7245
|
-
return startCoordinatorLoopWithSSE(
|
|
7246
|
-
|
|
7247
|
-
body.
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
...loopOptions,
|
|
7251
|
-
...body.maxRounds !== void 0 ? { maxRounds: body.maxRounds } : {},
|
|
7252
|
-
...body.waitTimeoutMs !== void 0 ? { waitTimeoutMs: body.waitTimeoutMs } : {}
|
|
7253
|
-
}
|
|
7254
|
-
);
|
|
7307
|
+
return startCoordinatorLoopWithSSE(coordinator, body.prompt, eventBus, {
|
|
7308
|
+
...loopOptions,
|
|
7309
|
+
...body.maxRounds !== void 0 ? { maxRounds: body.maxRounds } : {},
|
|
7310
|
+
...body.waitTimeoutMs !== void 0 ? { waitTimeoutMs: body.waitTimeoutMs } : {}
|
|
7311
|
+
});
|
|
7255
7312
|
}
|
|
7256
7313
|
const result = await coordinator.run(body.prompt, {
|
|
7257
7314
|
...loopOptions,
|
|
@@ -7295,10 +7352,7 @@ async function routeTeamRequest(request, segments, url, coordinator, eventBus, l
|
|
|
7295
7352
|
if (!body.roleName || typeof body.roleName !== "string") {
|
|
7296
7353
|
return errorResponse("roleName is required", 400);
|
|
7297
7354
|
}
|
|
7298
|
-
const member = await coordinator.register(
|
|
7299
|
-
body.roleName,
|
|
7300
|
-
body.memberId
|
|
7301
|
-
);
|
|
7355
|
+
const member = await coordinator.register(body.roleName, body.memberId);
|
|
7302
7356
|
return json(member, 201);
|
|
7303
7357
|
}
|
|
7304
7358
|
if (sub === "register-all" && segments.length === 2) {
|
|
@@ -7421,12 +7475,10 @@ function startCoordinatorLoopWithSSE(coordinator, prompt, eventBus, options) {
|
|
|
7421
7475
|
const emit = (type, data) => {
|
|
7422
7476
|
try {
|
|
7423
7477
|
controller.enqueue(
|
|
7424
|
-
encoder.encode(
|
|
7425
|
-
`event: ${type}
|
|
7478
|
+
encoder.encode(`event: ${type}
|
|
7426
7479
|
data: ${JSON.stringify(data)}
|
|
7427
7480
|
|
|
7428
|
-
`
|
|
7429
|
-
)
|
|
7481
|
+
`)
|
|
7430
7482
|
);
|
|
7431
7483
|
} catch {
|
|
7432
7484
|
}
|
|
@@ -7467,10 +7519,10 @@ data: ${JSON.stringify(data)}
|
|
|
7467
7519
|
}
|
|
7468
7520
|
|
|
7469
7521
|
// src/team/team-runner.ts
|
|
7470
|
-
import { createServer } from "http";
|
|
7471
7522
|
import {
|
|
7472
|
-
|
|
7473
|
-
} from "
|
|
7523
|
+
createServer
|
|
7524
|
+
} from "http";
|
|
7525
|
+
import { createDispatchExternalTaskControl } from "@cuylabs/agent-core";
|
|
7474
7526
|
import {
|
|
7475
7527
|
createTeamCoordinator,
|
|
7476
7528
|
TaskBoard
|
|
@@ -7506,7 +7558,10 @@ function toHeaders(req) {
|
|
|
7506
7558
|
function streamToReadable(req) {
|
|
7507
7559
|
return new ReadableStream({
|
|
7508
7560
|
start(controller) {
|
|
7509
|
-
req.on(
|
|
7561
|
+
req.on(
|
|
7562
|
+
"data",
|
|
7563
|
+
(chunk) => controller.enqueue(new Uint8Array(chunk))
|
|
7564
|
+
);
|
|
7510
7565
|
req.on("end", () => controller.close());
|
|
7511
7566
|
req.on("error", (err) => controller.error(err));
|
|
7512
7567
|
}
|
|
@@ -7731,7 +7786,10 @@ function createDaprTeamRunner(options) {
|
|
|
7731
7786
|
}
|
|
7732
7787
|
async function waitForDurableRun(instanceId, waitOptions) {
|
|
7733
7788
|
const client2 = requireWorkflowClient();
|
|
7734
|
-
const state = await client2.waitForWorkflowCompletion(
|
|
7789
|
+
const state = await client2.waitForWorkflowCompletion(
|
|
7790
|
+
instanceId,
|
|
7791
|
+
waitOptions
|
|
7792
|
+
);
|
|
7735
7793
|
if (!state) {
|
|
7736
7794
|
return void 0;
|
|
7737
7795
|
}
|
|
@@ -7750,11 +7808,9 @@ function createDaprTeamRunner(options) {
|
|
|
7750
7808
|
if (!report || !workflowClient || !activeDurableRunInstanceId) {
|
|
7751
7809
|
return;
|
|
7752
7810
|
}
|
|
7753
|
-
await workflowClient.raiseWorkflowEvent(
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
{ eventData: report }
|
|
7757
|
-
).catch(async () => {
|
|
7811
|
+
await workflowClient.raiseWorkflowEvent(activeDurableRunInstanceId, "worker-report", {
|
|
7812
|
+
eventData: report
|
|
7813
|
+
}).catch(async () => {
|
|
7758
7814
|
await syncActiveDurableRun().catch(() => {
|
|
7759
7815
|
});
|
|
7760
7816
|
});
|
|
@@ -7787,7 +7843,9 @@ function createDaprTeamRunner(options) {
|
|
|
7787
7843
|
task.id,
|
|
7788
7844
|
task.status === "claimed" ? "Process interrupted before durable task launch completed" : "Durable task lost its workflow runId before recovery"
|
|
7789
7845
|
);
|
|
7790
|
-
log(
|
|
7846
|
+
log(
|
|
7847
|
+
`Recovery: marked durable task "${task.id}" without runId as failed`
|
|
7848
|
+
);
|
|
7791
7849
|
continue;
|
|
7792
7850
|
}
|
|
7793
7851
|
const workflow = await recoveryWorkflowClient?.getWorkflow(task.runId);
|
|
@@ -7796,7 +7854,9 @@ function createDaprTeamRunner(options) {
|
|
|
7796
7854
|
task.id,
|
|
7797
7855
|
`Durable workflow "${task.runId}" was missing during recovery`
|
|
7798
7856
|
);
|
|
7799
|
-
log(
|
|
7857
|
+
log(
|
|
7858
|
+
`Recovery: marked task "${task.id}" as failed (missing workflow ${task.runId})`
|
|
7859
|
+
);
|
|
7800
7860
|
continue;
|
|
7801
7861
|
}
|
|
7802
7862
|
switch (workflow.runtimeStatus) {
|
|
@@ -7812,21 +7872,27 @@ function createDaprTeamRunner(options) {
|
|
|
7812
7872
|
task.id,
|
|
7813
7873
|
`Durable workflow "${task.runId}" was terminated before task completion was committed`
|
|
7814
7874
|
);
|
|
7815
|
-
log(
|
|
7875
|
+
log(
|
|
7876
|
+
`Recovery: marked task "${task.id}" as aborted from terminated workflow`
|
|
7877
|
+
);
|
|
7816
7878
|
break;
|
|
7817
7879
|
case "COMPLETED":
|
|
7818
7880
|
await recoveryBoard.failTask(
|
|
7819
7881
|
task.id,
|
|
7820
7882
|
`Durable workflow "${task.runId}" completed before the task-board commit was persisted`
|
|
7821
7883
|
);
|
|
7822
|
-
log(
|
|
7884
|
+
log(
|
|
7885
|
+
`Recovery: marked task "${task.id}" as failed (completed workflow without commit)`
|
|
7886
|
+
);
|
|
7823
7887
|
break;
|
|
7824
7888
|
case "FAILED":
|
|
7825
7889
|
await recoveryBoard.failTask(
|
|
7826
7890
|
task.id,
|
|
7827
7891
|
`Durable workflow "${task.runId}" failed before task completion was committed`
|
|
7828
7892
|
);
|
|
7829
|
-
log(
|
|
7893
|
+
log(
|
|
7894
|
+
`Recovery: marked task "${task.id}" as failed from failed workflow`
|
|
7895
|
+
);
|
|
7830
7896
|
break;
|
|
7831
7897
|
default:
|
|
7832
7898
|
await recoveryBoard.failTask(
|
|
@@ -7855,15 +7921,15 @@ function createDaprTeamRunner(options) {
|
|
|
7855
7921
|
`A durable coordinator run is already active (${activeDurableRunInstanceId})`
|
|
7856
7922
|
);
|
|
7857
7923
|
}
|
|
7858
|
-
const missingHosts = [...coordinator.members.values()].filter(
|
|
7924
|
+
const missingHosts = [...coordinator.members.values()].filter(
|
|
7925
|
+
(memberRuntime) => !agentWorkflowHosts.has(memberRuntime.role.name)
|
|
7926
|
+
).map((memberRuntime) => memberRuntime.member.id);
|
|
7859
7927
|
if (missingHosts.length > 0) {
|
|
7860
7928
|
throw new Error(
|
|
7861
7929
|
`Members were registered after workflow startup without workflow hosts: ${missingHosts.join(", ")}`
|
|
7862
7930
|
);
|
|
7863
7931
|
}
|
|
7864
|
-
const roleNames = [...coordinator.members.values()].map(
|
|
7865
|
-
(m) => m.role.name
|
|
7866
|
-
);
|
|
7932
|
+
const roleNames = [...coordinator.members.values()].map((m) => m.role.name);
|
|
7867
7933
|
const input = {
|
|
7868
7934
|
prompt,
|
|
7869
7935
|
teamId,
|
|
@@ -7873,7 +7939,9 @@ function createDaprTeamRunner(options) {
|
|
|
7873
7939
|
roleNames
|
|
7874
7940
|
};
|
|
7875
7941
|
const instanceId = `${teamId}-coordinator-${Date.now().toString(36)}`;
|
|
7876
|
-
log(
|
|
7942
|
+
log(
|
|
7943
|
+
`Starting coordinator workflow: ${coordinatorWorkflowName} (${instanceId})`
|
|
7944
|
+
);
|
|
7877
7945
|
activeDurableRunInstanceId = instanceId;
|
|
7878
7946
|
try {
|
|
7879
7947
|
const { instanceId: actualInstanceId } = await client2.startWorkflow(
|
|
@@ -7908,9 +7976,7 @@ function createDaprTeamRunner(options) {
|
|
|
7908
7976
|
} else {
|
|
7909
7977
|
await coordinator.registerAll();
|
|
7910
7978
|
}
|
|
7911
|
-
log(
|
|
7912
|
-
`Auto-registered ${coordinator.listRoles().length} member(s)`
|
|
7913
|
-
);
|
|
7979
|
+
log(`Auto-registered ${coordinator.listRoles().length} member(s)`);
|
|
7914
7980
|
}
|
|
7915
7981
|
if (workflowRuntime) {
|
|
7916
7982
|
for (const [, memberRuntime] of coordinator.members) {
|
|
@@ -7930,10 +7996,7 @@ function createDaprTeamRunner(options) {
|
|
|
7930
7996
|
resolveAgentTurnWorkflowName
|
|
7931
7997
|
});
|
|
7932
7998
|
coordinatorWorkflowName = cwDef.workflowName;
|
|
7933
|
-
workflowRuntime.registerWorkflowWithName(
|
|
7934
|
-
cwDef.workflowName,
|
|
7935
|
-
cwDef.workflow
|
|
7936
|
-
);
|
|
7999
|
+
workflowRuntime.registerWorkflowWithName(cwDef.workflowName, cwDef.workflow);
|
|
7937
8000
|
const reasonHandler = createCoordinatorReasonActivity({
|
|
7938
8001
|
lead: options.lead,
|
|
7939
8002
|
coordinator,
|
|
@@ -7980,7 +8043,13 @@ function createDaprTeamRunner(options) {
|
|
|
7980
8043
|
client: workflowClient
|
|
7981
8044
|
})
|
|
7982
8045
|
),
|
|
7983
|
-
createRecord: ({
|
|
8046
|
+
createRecord: ({
|
|
8047
|
+
task,
|
|
8048
|
+
runtime,
|
|
8049
|
+
target,
|
|
8050
|
+
dispatchId,
|
|
8051
|
+
startedAt
|
|
8052
|
+
}) => ({
|
|
7984
8053
|
id: dispatchId,
|
|
7985
8054
|
agentId: runtime.member.id,
|
|
7986
8055
|
targetType: target.name,
|
|
@@ -8009,26 +8078,28 @@ function createDaprTeamRunner(options) {
|
|
|
8009
8078
|
}
|
|
8010
8079
|
const port = serveOptions?.port ?? 3e3;
|
|
8011
8080
|
const host = serveOptions?.host;
|
|
8012
|
-
const server = createServer(
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
response
|
|
8021
|
-
JSON.stringify({ error: "Not found" }),
|
|
8022
|
-
|
|
8023
|
-
|
|
8081
|
+
const server = createServer(
|
|
8082
|
+
async (req, res) => {
|
|
8083
|
+
try {
|
|
8084
|
+
const request = toRequest(req);
|
|
8085
|
+
let response = await teamHandler(request);
|
|
8086
|
+
if (!response) {
|
|
8087
|
+
response = await handleCoreRoute(request, coordinator, started);
|
|
8088
|
+
}
|
|
8089
|
+
if (!response) {
|
|
8090
|
+
response = new Response(JSON.stringify({ error: "Not found" }), {
|
|
8091
|
+
status: 404,
|
|
8092
|
+
headers: { "content-type": "application/json" }
|
|
8093
|
+
});
|
|
8094
|
+
}
|
|
8095
|
+
await writeResponse(response, res);
|
|
8096
|
+
} catch (error) {
|
|
8097
|
+
const message = error instanceof Error ? error.message : "Internal server error";
|
|
8098
|
+
res.writeHead(500, { "content-type": "application/json" });
|
|
8099
|
+
res.end(JSON.stringify({ error: message }));
|
|
8024
8100
|
}
|
|
8025
|
-
await writeResponse(response, res);
|
|
8026
|
-
} catch (error) {
|
|
8027
|
-
const message = error instanceof Error ? error.message : "Internal server error";
|
|
8028
|
-
res.writeHead(500, { "content-type": "application/json" });
|
|
8029
|
-
res.end(JSON.stringify({ error: message }));
|
|
8030
8101
|
}
|
|
8031
|
-
|
|
8102
|
+
);
|
|
8032
8103
|
await new Promise((resolve2, reject) => {
|
|
8033
8104
|
server.once("error", reject);
|
|
8034
8105
|
server.listen(port, host, () => {
|
|
@@ -8183,7 +8254,9 @@ function normalizeWorkflowInstanceId(explicitInstanceId, sessionId) {
|
|
|
8183
8254
|
}
|
|
8184
8255
|
function createSteeringRequest(input) {
|
|
8185
8256
|
if (!input.workflowInstanceId.trim()) {
|
|
8186
|
-
throw new Error(
|
|
8257
|
+
throw new Error(
|
|
8258
|
+
'"workflowInstanceId" is required and must be a non-empty string.'
|
|
8259
|
+
);
|
|
8187
8260
|
}
|
|
8188
8261
|
const sessionId = input.sessionId.trim();
|
|
8189
8262
|
if (!sessionId) {
|
|
@@ -8203,7 +8276,9 @@ function createSteeringRequest(input) {
|
|
|
8203
8276
|
}
|
|
8204
8277
|
function createFollowUpRequest(input) {
|
|
8205
8278
|
if (!input.workflowInstanceId.trim()) {
|
|
8206
|
-
throw new Error(
|
|
8279
|
+
throw new Error(
|
|
8280
|
+
'"workflowInstanceId" is required and must be a non-empty string.'
|
|
8281
|
+
);
|
|
8207
8282
|
}
|
|
8208
8283
|
const sessionId = input.sessionId.trim();
|
|
8209
8284
|
if (!sessionId) {
|
|
@@ -8240,10 +8315,7 @@ function createDaprAgentWorkflowHost(options) {
|
|
|
8240
8315
|
await activeTurns.get(state.sessionId)?.bridge.notifyTaskStart(state);
|
|
8241
8316
|
},
|
|
8242
8317
|
async notifyCheckpoint(reason, state) {
|
|
8243
|
-
await activeTurns.get(state.sessionId)?.bridge.notifyCheckpoint(
|
|
8244
|
-
reason,
|
|
8245
|
-
state
|
|
8246
|
-
);
|
|
8318
|
+
await activeTurns.get(state.sessionId)?.bridge.notifyCheckpoint(reason, state);
|
|
8247
8319
|
},
|
|
8248
8320
|
async notifyTaskComplete(state) {
|
|
8249
8321
|
try {
|
|
@@ -8258,10 +8330,7 @@ function createDaprAgentWorkflowHost(options) {
|
|
|
8258
8330
|
},
|
|
8259
8331
|
async notifyTaskError(state, error) {
|
|
8260
8332
|
try {
|
|
8261
|
-
await activeTurns.get(state.sessionId)?.bridge.notifyTaskError(
|
|
8262
|
-
state,
|
|
8263
|
-
error
|
|
8264
|
-
);
|
|
8333
|
+
await activeTurns.get(state.sessionId)?.bridge.notifyTaskError(state, error);
|
|
8265
8334
|
} finally {
|
|
8266
8335
|
await closeEventChannel(state.sessionId, {
|
|
8267
8336
|
type: "error",
|
|
@@ -8345,9 +8414,7 @@ function createDaprAgentWorkflowHost(options) {
|
|
|
8345
8414
|
...options.humanInputRuntime?.hasHumanInputTools ? {
|
|
8346
8415
|
humanInputCheckActivity: {
|
|
8347
8416
|
check: async (input) => {
|
|
8348
|
-
const result = await options.humanInputRuntime.evaluateToolRequest(
|
|
8349
|
-
input
|
|
8350
|
-
);
|
|
8417
|
+
const result = await options.humanInputRuntime.evaluateToolRequest(input);
|
|
8351
8418
|
switch (result.action) {
|
|
8352
8419
|
case "allow":
|
|
8353
8420
|
case "deny":
|
|
@@ -8366,9 +8433,7 @@ function createDaprAgentWorkflowHost(options) {
|
|
|
8366
8433
|
...options.approvalRuntime?.hasApprovalMiddleware ? {
|
|
8367
8434
|
approvalCheckActivity: {
|
|
8368
8435
|
check: async (input) => {
|
|
8369
|
-
const result = await options.approvalRuntime.evaluateToolApproval(
|
|
8370
|
-
input
|
|
8371
|
-
);
|
|
8436
|
+
const result = await options.approvalRuntime.evaluateToolApproval(input);
|
|
8372
8437
|
switch (result.action) {
|
|
8373
8438
|
case "allow":
|
|
8374
8439
|
return result;
|
|
@@ -8519,9 +8584,7 @@ function createDaprAgentWorkflowHost(options) {
|
|
|
8519
8584
|
preparedRun.workflowInstanceId
|
|
8520
8585
|
);
|
|
8521
8586
|
if (ctx) {
|
|
8522
|
-
const otelApi = await import("@opentelemetry/api").catch(
|
|
8523
|
-
() => null
|
|
8524
|
-
);
|
|
8587
|
+
const otelApi = await import("@opentelemetry/api").catch(() => null);
|
|
8525
8588
|
if (otelApi) {
|
|
8526
8589
|
await otelApi.context.with(
|
|
8527
8590
|
ctx,
|
|
@@ -8671,7 +8734,9 @@ function createDaprWorkflowWorker(options) {
|
|
|
8671
8734
|
if (!running) {
|
|
8672
8735
|
return;
|
|
8673
8736
|
}
|
|
8674
|
-
logger?.info?.(
|
|
8737
|
+
logger?.info?.(
|
|
8738
|
+
"Stopping workflow worker (gRPC stream cancel is expected)..."
|
|
8739
|
+
);
|
|
8675
8740
|
await options.runtime.stop();
|
|
8676
8741
|
running = false;
|
|
8677
8742
|
logger?.info?.("Dapr workflow worker stopped.");
|
|
@@ -9041,7 +9106,10 @@ async function handleAgentRunRoutes(method, segments, request, app, workflowClie
|
|
|
9041
9106
|
if (method === "POST" && segments.length === 2 && segments[0] === "agents" && segments[1] === "run") {
|
|
9042
9107
|
const body = await parseJsonBody(request);
|
|
9043
9108
|
if (!body.message || typeof body.message !== "string" || !body.message.trim()) {
|
|
9044
|
-
return json2(
|
|
9109
|
+
return json2(
|
|
9110
|
+
{ error: '"message" is required and must be a non-empty string.' },
|
|
9111
|
+
400
|
|
9112
|
+
);
|
|
9045
9113
|
}
|
|
9046
9114
|
const selectedId = body.agentId?.trim() || resolveSingleAgent(app)?.id;
|
|
9047
9115
|
if (!selectedId) {
|
|
@@ -9063,11 +9131,7 @@ async function handleAgentRunRoutes(method, segments, request, app, workflowClie
|
|
|
9063
9131
|
}
|
|
9064
9132
|
}
|
|
9065
9133
|
if (method === "POST" && segments.length === 2 && segments[0] === "agents" && segments[1] === "run-durable") {
|
|
9066
|
-
return await handleRunDurable(
|
|
9067
|
-
request,
|
|
9068
|
-
app,
|
|
9069
|
-
workflowClient
|
|
9070
|
-
);
|
|
9134
|
+
return await handleRunDurable(request, app, workflowClient);
|
|
9071
9135
|
}
|
|
9072
9136
|
if (method === "POST" && segments.length === 3 && segments[0] === "agents" && segments[2] === "run") {
|
|
9073
9137
|
const agent = app.getAgent(segments[1]);
|
|
@@ -9084,12 +9148,7 @@ async function handleAgentRunRoutes(method, segments, request, app, workflowClie
|
|
|
9084
9148
|
return void 0;
|
|
9085
9149
|
}
|
|
9086
9150
|
const body = await parseJsonBody(request);
|
|
9087
|
-
return await handleRunDurableForAgent(
|
|
9088
|
-
agent,
|
|
9089
|
-
body,
|
|
9090
|
-
request,
|
|
9091
|
-
workflowClient
|
|
9092
|
-
);
|
|
9151
|
+
return await handleRunDurableForAgent(agent, body, request, workflowClient);
|
|
9093
9152
|
}
|
|
9094
9153
|
return void 0;
|
|
9095
9154
|
}
|
|
@@ -9099,7 +9158,10 @@ async function handleRunDurable(request, app, workflowClient) {
|
|
|
9099
9158
|
}
|
|
9100
9159
|
const body = await parseJsonBody(request);
|
|
9101
9160
|
if (!body.message || typeof body.message !== "string" || !body.message.trim()) {
|
|
9102
|
-
return json2(
|
|
9161
|
+
return json2(
|
|
9162
|
+
{ error: '"message" is required and must be a non-empty string.' },
|
|
9163
|
+
400
|
|
9164
|
+
);
|
|
9103
9165
|
}
|
|
9104
9166
|
const selectedId = body.agentId?.trim() || resolveSingleAgent(app)?.id;
|
|
9105
9167
|
if (!selectedId) {
|
|
@@ -9121,18 +9183,16 @@ async function handleRunDurableForAgent(agent, body, request, workflowClient) {
|
|
|
9121
9183
|
return json2({ error: "Workflow client is not configured." }, 501);
|
|
9122
9184
|
}
|
|
9123
9185
|
if (!body.message || typeof body.message !== "string" || !body.message.trim()) {
|
|
9124
|
-
return json2(
|
|
9186
|
+
return json2(
|
|
9187
|
+
{ error: '"message" is required and must be a non-empty string.' },
|
|
9188
|
+
400
|
|
9189
|
+
);
|
|
9125
9190
|
}
|
|
9126
9191
|
try {
|
|
9127
|
-
const result = await agent.workflowHost.startTurn(
|
|
9128
|
-
workflowClient,
|
|
9129
|
-
body
|
|
9130
|
-
);
|
|
9192
|
+
const result = await agent.workflowHost.startTurn(workflowClient, body);
|
|
9131
9193
|
const wantsStream = request.headers.get("accept")?.includes("text/event-stream");
|
|
9132
9194
|
const eventBus = agent.workflowHost.eventBus;
|
|
9133
|
-
const afterSeq = parseLastEventId(
|
|
9134
|
-
request.headers.get("last-event-id")
|
|
9135
|
-
);
|
|
9195
|
+
const afterSeq = parseLastEventId(request.headers.get("last-event-id"));
|
|
9136
9196
|
if (wantsStream && eventBus) {
|
|
9137
9197
|
return createSSEResponse(
|
|
9138
9198
|
eventBus,
|
|
@@ -9141,12 +9201,15 @@ async function handleRunDurableForAgent(agent, body, request, workflowClient) {
|
|
|
9141
9201
|
request.signal
|
|
9142
9202
|
);
|
|
9143
9203
|
}
|
|
9144
|
-
return json2(
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9204
|
+
return json2(
|
|
9205
|
+
{
|
|
9206
|
+
instanceId: result.workflowInstanceId,
|
|
9207
|
+
agentId: agent.id,
|
|
9208
|
+
workflowName: agent.workflowHost.workflowName,
|
|
9209
|
+
sessionId: result.sessionId
|
|
9210
|
+
},
|
|
9211
|
+
202
|
|
9212
|
+
);
|
|
9150
9213
|
} catch (error) {
|
|
9151
9214
|
return json2({ error: toSafeErrorMessage(error) }, 500);
|
|
9152
9215
|
}
|
|
@@ -9367,7 +9430,9 @@ async function handleFollowUpRoutes(method, segments, request, agent, _workflowC
|
|
|
9367
9430
|
if (method === "GET" && segments.length === 0) {
|
|
9368
9431
|
if (!followUpRuntime) {
|
|
9369
9432
|
return json2(
|
|
9370
|
-
{
|
|
9433
|
+
{
|
|
9434
|
+
error: "Durable follow-up management is not enabled for this agent."
|
|
9435
|
+
},
|
|
9371
9436
|
501
|
|
9372
9437
|
);
|
|
9373
9438
|
}
|
|
@@ -9391,20 +9456,27 @@ async function handleFollowUpRoutes(method, segments, request, agent, _workflowC
|
|
|
9391
9456
|
if (method === "GET" && segments.length === 1) {
|
|
9392
9457
|
if (!followUpRuntime) {
|
|
9393
9458
|
return json2(
|
|
9394
|
-
{
|
|
9459
|
+
{
|
|
9460
|
+
error: "Durable follow-up management is not enabled for this agent."
|
|
9461
|
+
},
|
|
9395
9462
|
501
|
|
9396
9463
|
);
|
|
9397
9464
|
}
|
|
9398
9465
|
const record = await followUpRuntime.getRequest(segments[0]);
|
|
9399
9466
|
if (!record) {
|
|
9400
|
-
return json2(
|
|
9467
|
+
return json2(
|
|
9468
|
+
{ error: `Follow-up request not found: ${segments[0]}` },
|
|
9469
|
+
404
|
|
9470
|
+
);
|
|
9401
9471
|
}
|
|
9402
9472
|
return json2(record);
|
|
9403
9473
|
}
|
|
9404
9474
|
if (method === "POST" && segments.length === 2 && segments[1] === "respond") {
|
|
9405
9475
|
if (!followUpRuntime) {
|
|
9406
9476
|
return json2(
|
|
9407
|
-
{
|
|
9477
|
+
{
|
|
9478
|
+
error: "Durable follow-up management is not enabled for this agent."
|
|
9479
|
+
},
|
|
9408
9480
|
501
|
|
9409
9481
|
);
|
|
9410
9482
|
}
|
|
@@ -9418,7 +9490,10 @@ async function handleFollowUpRoutes(method, segments, request, agent, _workflowC
|
|
|
9418
9490
|
400
|
|
9419
9491
|
);
|
|
9420
9492
|
}
|
|
9421
|
-
return json2(
|
|
9493
|
+
return json2(
|
|
9494
|
+
await followUpRuntime.respondToRequest(segments[0], action),
|
|
9495
|
+
202
|
|
9496
|
+
);
|
|
9422
9497
|
}
|
|
9423
9498
|
return void 0;
|
|
9424
9499
|
}
|
|
@@ -9430,12 +9505,17 @@ async function handleSteerRoute(method, segments, request, agent, workflowClient
|
|
|
9430
9505
|
return json2({ error: "Workflow client is not configured." }, 501);
|
|
9431
9506
|
}
|
|
9432
9507
|
if (!agent.workflowHost.steerTurn) {
|
|
9433
|
-
return json2(
|
|
9508
|
+
return json2(
|
|
9509
|
+
{ error: "Durable steering is not enabled for this agent." },
|
|
9510
|
+
501
|
|
9511
|
+
);
|
|
9434
9512
|
}
|
|
9435
9513
|
const body = await parseJsonBody(request);
|
|
9436
9514
|
if (!body.workflowInstanceId || typeof body.workflowInstanceId !== "string" || !body.workflowInstanceId.trim()) {
|
|
9437
9515
|
return json2(
|
|
9438
|
-
{
|
|
9516
|
+
{
|
|
9517
|
+
error: '"workflowInstanceId" is required and must be a non-empty string.'
|
|
9518
|
+
},
|
|
9439
9519
|
400
|
|
9440
9520
|
);
|
|
9441
9521
|
}
|
|
@@ -9488,7 +9568,9 @@ async function handleFollowUpQueueRoute(method, segments, request, agent, workfl
|
|
|
9488
9568
|
const body = await parseJsonBody(request);
|
|
9489
9569
|
if (!body.workflowInstanceId || typeof body.workflowInstanceId !== "string" || !body.workflowInstanceId.trim()) {
|
|
9490
9570
|
return json2(
|
|
9491
|
-
{
|
|
9571
|
+
{
|
|
9572
|
+
error: '"workflowInstanceId" is required and must be a non-empty string.'
|
|
9573
|
+
},
|
|
9492
9574
|
400
|
|
9493
9575
|
);
|
|
9494
9576
|
}
|
|
@@ -9535,7 +9617,9 @@ async function handleWorkflowRoutes(method, segments, request, agent, workflowCl
|
|
|
9535
9617
|
501
|
|
9536
9618
|
);
|
|
9537
9619
|
}
|
|
9538
|
-
const record = await agent.runtimeBundle.executionStore.getExecution(
|
|
9620
|
+
const record = await agent.runtimeBundle.executionStore.getExecution(
|
|
9621
|
+
segments[1]
|
|
9622
|
+
);
|
|
9539
9623
|
if (!record) {
|
|
9540
9624
|
return json2({ error: `Execution not found: ${segments[1]}` }, 404);
|
|
9541
9625
|
}
|
|
@@ -9617,7 +9701,11 @@ function createDaprHostHttpHandler(options) {
|
|
|
9617
9701
|
const method = request.method;
|
|
9618
9702
|
const health = handleHealthRoutes(method, segments, options.app);
|
|
9619
9703
|
if (health) return health;
|
|
9620
|
-
const readiness = await handleReadinessRoutes(
|
|
9704
|
+
const readiness = await handleReadinessRoutes(
|
|
9705
|
+
method,
|
|
9706
|
+
segments,
|
|
9707
|
+
options.app
|
|
9708
|
+
);
|
|
9621
9709
|
if (readiness) return readiness;
|
|
9622
9710
|
const agentList = handleAgentListRoute(method, segments, options.app);
|
|
9623
9711
|
if (agentList) return agentList;
|
|
@@ -9856,9 +9944,15 @@ async function startDaprHttpServer(options) {
|
|
|
9856
9944
|
await writeResponse2(response, res);
|
|
9857
9945
|
} catch (error) {
|
|
9858
9946
|
if (error instanceof PayloadTooLargeError) {
|
|
9859
|
-
await writeResponse2(
|
|
9947
|
+
await writeResponse2(
|
|
9948
|
+
json2({ error: "Request body too large" }, 413),
|
|
9949
|
+
res
|
|
9950
|
+
);
|
|
9860
9951
|
} else {
|
|
9861
|
-
await writeResponse2(
|
|
9952
|
+
await writeResponse2(
|
|
9953
|
+
json2({ error: toSafeErrorMessage(error) }, 500),
|
|
9954
|
+
res
|
|
9955
|
+
);
|
|
9862
9956
|
}
|
|
9863
9957
|
}
|
|
9864
9958
|
});
|
|
@@ -10001,7 +10095,9 @@ async function readWorkflowTerminalEvent(input) {
|
|
|
10001
10095
|
if (!workflow) {
|
|
10002
10096
|
return {
|
|
10003
10097
|
type: "error",
|
|
10004
|
-
error: new Error(
|
|
10098
|
+
error: new Error(
|
|
10099
|
+
`Workflow for session "${sessionId}" did not return a terminal state.`
|
|
10100
|
+
)
|
|
10005
10101
|
};
|
|
10006
10102
|
}
|
|
10007
10103
|
const fromOutput = toCompletionEventFromObject(
|
|
@@ -10123,7 +10219,11 @@ function createDaprAgentServerAdapter(runner, options = {}) {
|
|
|
10123
10219
|
cwd: agent.cwd,
|
|
10124
10220
|
getCapabilities: () => mergeCapabilities(
|
|
10125
10221
|
{
|
|
10126
|
-
protocol: {
|
|
10222
|
+
protocol: {
|
|
10223
|
+
transport: "in-process",
|
|
10224
|
+
reconnectable: false,
|
|
10225
|
+
multiClient: true
|
|
10226
|
+
},
|
|
10127
10227
|
turns: { steer: true, followUp: true, followUpManagement: true },
|
|
10128
10228
|
interactive: {
|
|
10129
10229
|
approvalRequests: Boolean(runner.workflowHost.approvalRuntime),
|
|
@@ -10187,15 +10287,20 @@ function createDaprAgentServerAdapter(runner, options = {}) {
|
|
|
10187
10287
|
undoSessionTurn,
|
|
10188
10288
|
getSessionTurnDiff,
|
|
10189
10289
|
async *chat(sessionId, message, chatOptions) {
|
|
10190
|
-
const started = await runner.workflowHost.startTurn(
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10290
|
+
const started = await runner.workflowHost.startTurn(
|
|
10291
|
+
runner.workflowClient,
|
|
10292
|
+
{
|
|
10293
|
+
sessionId,
|
|
10294
|
+
message,
|
|
10295
|
+
...chatOptions?.system ? { system: chatOptions.system } : {}
|
|
10296
|
+
}
|
|
10297
|
+
);
|
|
10195
10298
|
activeTurns.set(started.sessionId, {
|
|
10196
10299
|
workflowInstanceId: started.workflowInstanceId
|
|
10197
10300
|
});
|
|
10198
|
-
const subscription = runner.workflowHost.eventBus?.subscribe(
|
|
10301
|
+
const subscription = runner.workflowHost.eventBus?.subscribe(
|
|
10302
|
+
started.sessionId
|
|
10303
|
+
);
|
|
10199
10304
|
const completionPromise = runner.workflowClient.waitForWorkflowCompletion(
|
|
10200
10305
|
started.workflowInstanceId
|
|
10201
10306
|
);
|
|
@@ -10206,7 +10311,9 @@ function createDaprAgentServerAdapter(runner, options = {}) {
|
|
|
10206
10311
|
if (chatOptions.abort.aborted) {
|
|
10207
10312
|
abortHandler();
|
|
10208
10313
|
} else {
|
|
10209
|
-
chatOptions.abort.addEventListener("abort", abortHandler, {
|
|
10314
|
+
chatOptions.abort.addEventListener("abort", abortHandler, {
|
|
10315
|
+
once: true
|
|
10316
|
+
});
|
|
10210
10317
|
}
|
|
10211
10318
|
}
|
|
10212
10319
|
try {
|
|
@@ -10231,7 +10338,9 @@ function createDaprAgentServerAdapter(runner, options = {}) {
|
|
|
10231
10338
|
if (chatOptions?.abort) {
|
|
10232
10339
|
chatOptions.abort.removeEventListener("abort", abortHandler);
|
|
10233
10340
|
}
|
|
10234
|
-
const completedInstanceId = activeTurns.get(
|
|
10341
|
+
const completedInstanceId = activeTurns.get(
|
|
10342
|
+
started.sessionId
|
|
10343
|
+
)?.workflowInstanceId;
|
|
10235
10344
|
activeTurns.delete(started.sessionId);
|
|
10236
10345
|
if (completedInstanceId) {
|
|
10237
10346
|
runner.workflowClient.purgeWorkflow(completedInstanceId).catch(() => {
|
|
@@ -10278,11 +10387,15 @@ function createDaprAgentServerAdapter(runner, options = {}) {
|
|
|
10278
10387
|
if (!runtime2) {
|
|
10279
10388
|
return;
|
|
10280
10389
|
}
|
|
10281
|
-
void runtime2.respondToRequest(
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10390
|
+
void runtime2.respondToRequest(
|
|
10391
|
+
requestId,
|
|
10392
|
+
{
|
|
10393
|
+
action: payload.action,
|
|
10394
|
+
...payload.feedback ? { feedback: payload.feedback } : {},
|
|
10395
|
+
...payload.rememberScope ? { rememberScope: payload.rememberScope } : {}
|
|
10396
|
+
},
|
|
10397
|
+
runner.workflowClient
|
|
10398
|
+
);
|
|
10286
10399
|
return;
|
|
10287
10400
|
}
|
|
10288
10401
|
const runtime = runner.workflowHost.humanInputRuntime;
|
|
@@ -10331,7 +10444,9 @@ function createDaprAgentServerAdapter(runner, options = {}) {
|
|
|
10331
10444
|
getSessionStorage: () => agent.getSessionManager().getStorage(),
|
|
10332
10445
|
listPluginCommands: () => pluginCommandInfos,
|
|
10333
10446
|
executePluginCommand: async (name, args) => {
|
|
10334
|
-
const command = pluginCommandTokens.get(
|
|
10447
|
+
const command = pluginCommandTokens.get(
|
|
10448
|
+
normalizePluginCommandToken(name)
|
|
10449
|
+
);
|
|
10335
10450
|
if (!command) {
|
|
10336
10451
|
throw new Error(`Plugin command not found: ${name}`);
|
|
10337
10452
|
}
|
|
@@ -10743,10 +10858,9 @@ function createDaprAgentRunner(options) {
|
|
|
10743
10858
|
},
|
|
10744
10859
|
roles: subagentConfig.roles,
|
|
10745
10860
|
workflowHosts: new Map(
|
|
10746
|
-
subagentGraph.entries.map(
|
|
10747
|
-
entry.role.name,
|
|
10748
|
-
|
|
10749
|
-
])
|
|
10861
|
+
subagentGraph.entries.map(
|
|
10862
|
+
(entry) => [entry.role.name, entry.bundle.workflowHost]
|
|
10863
|
+
)
|
|
10750
10864
|
),
|
|
10751
10865
|
stateStoreName: config.stateStoreName,
|
|
10752
10866
|
daprHttpEndpoint: config.daprHttpEndpoint,
|