@standardagents/builder 0.13.2 → 0.14.1
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/built-in-routes.js +168 -189
- package/dist/built-in-routes.js.map +1 -1
- package/dist/{index-8zDQpR2z.d.ts → index-CGbIvNZQ.d.ts} +18 -18
- package/dist/index.d.ts +4 -16
- package/dist/index.js +233 -244
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +20 -30
- package/dist/plugin.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1060,6 +1060,68 @@ function filterEmptyAssistantProviderMessages(messages) {
|
|
|
1060
1060
|
return hasToolCalls || hasReasoning || hasContent;
|
|
1061
1061
|
});
|
|
1062
1062
|
}
|
|
1063
|
+
function buildSyntheticMissingToolResult(toolCall) {
|
|
1064
|
+
return {
|
|
1065
|
+
role: "tool",
|
|
1066
|
+
tool_call_id: toolCall.id,
|
|
1067
|
+
name: toolCall.function.name,
|
|
1068
|
+
toolName: toolCall.function.name,
|
|
1069
|
+
content: `Tool result missing from conversation history for prior call "${toolCall.function.name}". Treat this as a failed tool call.`
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
function normalizeToolCallMessageSequence(messages) {
|
|
1073
|
+
const normalized = [];
|
|
1074
|
+
let pending = null;
|
|
1075
|
+
const flushPending = () => {
|
|
1076
|
+
if (!pending) {
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
normalized.push(pending.assistantMessage);
|
|
1080
|
+
for (const toolCall of pending.expectedToolCalls) {
|
|
1081
|
+
const matchedResult = pending.matchedResults.get(toolCall.id);
|
|
1082
|
+
normalized.push(matchedResult ?? buildSyntheticMissingToolResult(toolCall));
|
|
1083
|
+
}
|
|
1084
|
+
if (pending.deferredMessages.length > 0) {
|
|
1085
|
+
normalized.push(...normalizeToolCallMessageSequence(pending.deferredMessages));
|
|
1086
|
+
}
|
|
1087
|
+
pending = null;
|
|
1088
|
+
};
|
|
1089
|
+
for (const message of messages) {
|
|
1090
|
+
const isAssistantToolCallMessage = message.role === "assistant" && Array.isArray(message.tool_calls) && message.tool_calls.length > 0;
|
|
1091
|
+
if (!pending) {
|
|
1092
|
+
if (!isAssistantToolCallMessage) {
|
|
1093
|
+
normalized.push(message);
|
|
1094
|
+
continue;
|
|
1095
|
+
}
|
|
1096
|
+
const toolCalls = message.tool_calls ?? [];
|
|
1097
|
+
const expectedToolCalls = toolCalls.filter(
|
|
1098
|
+
(toolCall) => Boolean(toolCall && typeof toolCall.id === "string" && toolCall.function?.name)
|
|
1099
|
+
);
|
|
1100
|
+
if (expectedToolCalls.length === 0) {
|
|
1101
|
+
normalized.push(message);
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1104
|
+
pending = {
|
|
1105
|
+
assistantMessage: message,
|
|
1106
|
+
expectedToolCalls,
|
|
1107
|
+
matchedResults: /* @__PURE__ */ new Map(),
|
|
1108
|
+
deferredMessages: []
|
|
1109
|
+
};
|
|
1110
|
+
continue;
|
|
1111
|
+
}
|
|
1112
|
+
const matchesPendingToolResult = message.role === "tool" && typeof message.tool_call_id === "string" && pending.expectedToolCalls.some((toolCall) => toolCall.id === message.tool_call_id) && !pending.matchedResults.has(message.tool_call_id);
|
|
1113
|
+
if (matchesPendingToolResult) {
|
|
1114
|
+
pending.matchedResults.set(message.tool_call_id, message);
|
|
1115
|
+
if (pending.matchedResults.size === pending.expectedToolCalls.length) {
|
|
1116
|
+
flushPending();
|
|
1117
|
+
}
|
|
1118
|
+
continue;
|
|
1119
|
+
}
|
|
1120
|
+
pending.deferredMessages.push(message);
|
|
1121
|
+
}
|
|
1122
|
+
flushPending();
|
|
1123
|
+
return normalized;
|
|
1124
|
+
}
|
|
1063
1125
|
function stripBase64FromMessages(messages, imagePathMap) {
|
|
1064
1126
|
return messages.map((msg) => {
|
|
1065
1127
|
if (msg.role === "user" && Array.isArray(msg.content)) {
|
|
@@ -1203,7 +1265,8 @@ function transformToolChoice(toolChoice) {
|
|
|
1203
1265
|
return void 0;
|
|
1204
1266
|
}
|
|
1205
1267
|
function buildRequestBody(context, modelDef) {
|
|
1206
|
-
const
|
|
1268
|
+
const normalizedMessages = normalizeToolCallMessageSequence(context.messages);
|
|
1269
|
+
const transformedMessages = transformMessages(normalizedMessages);
|
|
1207
1270
|
const supportsImageInput = modelSupportsImageInput(modelDef);
|
|
1208
1271
|
const supportsToolCalls = modelSupportsToolCalls(modelDef);
|
|
1209
1272
|
let requestMessages = transformedMessages;
|
|
@@ -2146,7 +2209,7 @@ function parseBindingObject(binding) {
|
|
|
2146
2209
|
attachmentsProperty: typeof binding.attachmentsProperty === "string" ? binding.attachmentsProperty : null
|
|
2147
2210
|
};
|
|
2148
2211
|
}
|
|
2149
|
-
function resolveSessionToolBinding(binding
|
|
2212
|
+
function resolveSessionToolBinding(binding) {
|
|
2150
2213
|
if (typeof binding === "string") {
|
|
2151
2214
|
return {
|
|
2152
2215
|
toolName: binding,
|
|
@@ -2161,7 +2224,7 @@ function resolveSessionToolBinding(binding, legacyTool) {
|
|
|
2161
2224
|
}
|
|
2162
2225
|
}
|
|
2163
2226
|
return {
|
|
2164
|
-
toolName:
|
|
2227
|
+
toolName: null,
|
|
2165
2228
|
messageProperty: null,
|
|
2166
2229
|
attachmentsProperty: null
|
|
2167
2230
|
};
|
|
@@ -2169,60 +2232,51 @@ function resolveSessionToolBinding(binding, legacyTool) {
|
|
|
2169
2232
|
function getResolvedSessionBindingsFromSide(side) {
|
|
2170
2233
|
const config = side ?? {};
|
|
2171
2234
|
return {
|
|
2172
|
-
stop: resolveSessionToolBinding(
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
),
|
|
2176
|
-
fail: resolveSessionToolBinding(
|
|
2177
|
-
config.sessionFail,
|
|
2178
|
-
config.failSessionTool
|
|
2179
|
-
),
|
|
2180
|
-
status: resolveSessionToolBinding(
|
|
2181
|
-
config.sessionStatus,
|
|
2182
|
-
config.statusTool
|
|
2183
|
-
)
|
|
2235
|
+
stop: resolveSessionToolBinding(config.sessionStop),
|
|
2236
|
+
fail: resolveSessionToolBinding(config.sessionFail),
|
|
2237
|
+
status: resolveSessionToolBinding(config.sessionStatus)
|
|
2184
2238
|
};
|
|
2185
2239
|
}
|
|
2186
2240
|
function getAgentSessionBinding(agent, side, kind) {
|
|
2187
2241
|
if (side === "a") {
|
|
2188
2242
|
if (kind === "stop") {
|
|
2189
2243
|
return {
|
|
2190
|
-
toolName: agent.
|
|
2191
|
-
messageProperty: agent.
|
|
2192
|
-
attachmentsProperty: agent.
|
|
2244
|
+
toolName: agent.side_a_session_stop_tool,
|
|
2245
|
+
messageProperty: agent.side_a_session_stop_message_property,
|
|
2246
|
+
attachmentsProperty: agent.side_a_session_stop_attachments_property
|
|
2193
2247
|
};
|
|
2194
2248
|
}
|
|
2195
2249
|
if (kind === "fail") {
|
|
2196
2250
|
return {
|
|
2197
|
-
toolName: agent.
|
|
2198
|
-
messageProperty: agent.
|
|
2199
|
-
attachmentsProperty: agent.
|
|
2251
|
+
toolName: agent.side_a_session_fail_tool,
|
|
2252
|
+
messageProperty: agent.side_a_session_fail_message_property,
|
|
2253
|
+
attachmentsProperty: agent.side_a_session_fail_attachments_property
|
|
2200
2254
|
};
|
|
2201
2255
|
}
|
|
2202
2256
|
return {
|
|
2203
|
-
toolName: agent.
|
|
2204
|
-
messageProperty: agent.
|
|
2205
|
-
attachmentsProperty: agent.
|
|
2257
|
+
toolName: agent.side_a_session_status_tool,
|
|
2258
|
+
messageProperty: agent.side_a_session_status_message_property,
|
|
2259
|
+
attachmentsProperty: agent.side_a_session_status_attachments_property
|
|
2206
2260
|
};
|
|
2207
2261
|
}
|
|
2208
2262
|
if (kind === "stop") {
|
|
2209
2263
|
return {
|
|
2210
|
-
toolName: agent.
|
|
2211
|
-
messageProperty: agent.
|
|
2212
|
-
attachmentsProperty: agent.
|
|
2264
|
+
toolName: agent.side_b_session_stop_tool,
|
|
2265
|
+
messageProperty: agent.side_b_session_stop_message_property,
|
|
2266
|
+
attachmentsProperty: agent.side_b_session_stop_attachments_property
|
|
2213
2267
|
};
|
|
2214
2268
|
}
|
|
2215
2269
|
if (kind === "fail") {
|
|
2216
2270
|
return {
|
|
2217
|
-
toolName: agent.
|
|
2218
|
-
messageProperty: agent.
|
|
2219
|
-
attachmentsProperty: agent.
|
|
2271
|
+
toolName: agent.side_b_session_fail_tool,
|
|
2272
|
+
messageProperty: agent.side_b_session_fail_message_property,
|
|
2273
|
+
attachmentsProperty: agent.side_b_session_fail_attachments_property
|
|
2220
2274
|
};
|
|
2221
2275
|
}
|
|
2222
2276
|
return {
|
|
2223
|
-
toolName: agent.
|
|
2224
|
-
messageProperty: agent.
|
|
2225
|
-
attachmentsProperty: agent.
|
|
2277
|
+
toolName: agent.side_b_session_status_tool,
|
|
2278
|
+
messageProperty: agent.side_b_session_status_message_property,
|
|
2279
|
+
attachmentsProperty: agent.side_b_session_status_attachments_property
|
|
2226
2280
|
};
|
|
2227
2281
|
}
|
|
2228
2282
|
var init_sessionTools = __esm({
|
|
@@ -3249,15 +3303,15 @@ var init_ToolExecutor = __esm({
|
|
|
3249
3303
|
side_a_stop_tool: null,
|
|
3250
3304
|
side_a_stop_tool_response_property: null,
|
|
3251
3305
|
side_a_max_steps: null,
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3306
|
+
side_a_session_stop_tool: null,
|
|
3307
|
+
side_a_session_stop_message_property: null,
|
|
3308
|
+
side_a_session_stop_attachments_property: null,
|
|
3309
|
+
side_a_session_fail_tool: null,
|
|
3310
|
+
side_a_session_fail_message_property: null,
|
|
3311
|
+
side_a_session_fail_attachments_property: null,
|
|
3312
|
+
side_a_session_status_tool: null,
|
|
3313
|
+
side_a_session_status_message_property: null,
|
|
3314
|
+
side_a_session_status_attachments_property: null,
|
|
3261
3315
|
// Side B configuration (unused for prompt tools)
|
|
3262
3316
|
side_b_label: null,
|
|
3263
3317
|
side_b_agent_prompt: null,
|
|
@@ -3265,15 +3319,15 @@ var init_ToolExecutor = __esm({
|
|
|
3265
3319
|
side_b_stop_tool: null,
|
|
3266
3320
|
side_b_stop_tool_response_property: null,
|
|
3267
3321
|
side_b_max_steps: null,
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3322
|
+
side_b_session_stop_tool: null,
|
|
3323
|
+
side_b_session_stop_message_property: null,
|
|
3324
|
+
side_b_session_stop_attachments_property: null,
|
|
3325
|
+
side_b_session_fail_tool: null,
|
|
3326
|
+
side_b_session_fail_message_property: null,
|
|
3327
|
+
side_b_session_fail_attachments_property: null,
|
|
3328
|
+
side_b_session_status_tool: null,
|
|
3329
|
+
side_b_session_status_message_property: null,
|
|
3330
|
+
side_b_session_status_attachments_property: null
|
|
3277
3331
|
};
|
|
3278
3332
|
let userMessageContent;
|
|
3279
3333
|
let userMessageAttachments;
|
|
@@ -4486,8 +4540,8 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
4486
4540
|
state.currentSide,
|
|
4487
4541
|
"status"
|
|
4488
4542
|
);
|
|
4489
|
-
const
|
|
4490
|
-
if (!
|
|
4543
|
+
const sessionStatusToolName = statusBinding.toolName;
|
|
4544
|
+
if (!sessionStatusToolName || sessionStatusToolName !== toolName) {
|
|
4491
4545
|
return;
|
|
4492
4546
|
}
|
|
4493
4547
|
const mappedValue = statusBinding.messageProperty && args ? args[statusBinding.messageProperty] : void 0;
|
|
@@ -4671,9 +4725,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
4671
4725
|
const baseError = processedResult.error?.trim() || "Tool execution failed";
|
|
4672
4726
|
content = `Failed to execute tool: ${baseError}`;
|
|
4673
4727
|
}
|
|
4674
|
-
const
|
|
4675
|
-
const
|
|
4676
|
-
const shouldAppendAttachmentPaths = (!
|
|
4728
|
+
const sessionStopToolName = stopBinding.toolName;
|
|
4729
|
+
const sessionFailToolName = failBinding.toolName;
|
|
4730
|
+
const shouldAppendAttachmentPaths = (!sessionStopToolName || call.function.name !== sessionStopToolName) && (!sessionFailToolName || call.function.name !== sessionFailToolName);
|
|
4677
4731
|
if (shouldAppendAttachmentPaths && attachmentRefs && attachmentRefs.length > 0) {
|
|
4678
4732
|
const attachmentPaths = attachmentRefs.map((ref) => `Attachment path for "${ref.name}": ${ref.path}`).join("\n");
|
|
4679
4733
|
content += `
|
|
@@ -6902,30 +6956,30 @@ var init_FlowEngine = __esm({
|
|
|
6902
6956
|
side_a_stop_tool: newAgentDef.sideA?.stopTool ?? null,
|
|
6903
6957
|
side_a_stop_tool_response_property: newAgentDef.sideA?.stopToolResponseProperty ?? null,
|
|
6904
6958
|
side_a_max_steps: newAgentDef.sideA?.maxSteps ?? null,
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6959
|
+
side_a_session_stop_tool: sideASession.stop.toolName,
|
|
6960
|
+
side_a_session_stop_message_property: sideASession.stop.messageProperty,
|
|
6961
|
+
side_a_session_stop_attachments_property: sideASession.stop.attachmentsProperty,
|
|
6962
|
+
side_a_session_fail_tool: sideASession.fail.toolName,
|
|
6963
|
+
side_a_session_fail_message_property: sideASession.fail.messageProperty,
|
|
6964
|
+
side_a_session_fail_attachments_property: sideASession.fail.attachmentsProperty,
|
|
6965
|
+
side_a_session_status_tool: sideASession.status.toolName,
|
|
6966
|
+
side_a_session_status_message_property: sideASession.status.messageProperty,
|
|
6967
|
+
side_a_session_status_attachments_property: sideASession.status.attachmentsProperty,
|
|
6914
6968
|
side_b_label: newAgentDef.sideB?.label ?? null,
|
|
6915
6969
|
side_b_agent_prompt: newAgentDef.sideB?.prompt ?? null,
|
|
6916
6970
|
side_b_stop_on_response: newAgentDef.sideB?.stopOnResponse ?? false,
|
|
6917
6971
|
side_b_stop_tool: newAgentDef.sideB?.stopTool ?? null,
|
|
6918
6972
|
side_b_stop_tool_response_property: newAgentDef.sideB?.stopToolResponseProperty ?? null,
|
|
6919
6973
|
side_b_max_steps: newAgentDef.sideB?.maxSteps ?? null,
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6974
|
+
side_b_session_stop_tool: sideBSession.stop.toolName,
|
|
6975
|
+
side_b_session_stop_message_property: sideBSession.stop.messageProperty,
|
|
6976
|
+
side_b_session_stop_attachments_property: sideBSession.stop.attachmentsProperty,
|
|
6977
|
+
side_b_session_fail_tool: sideBSession.fail.toolName,
|
|
6978
|
+
side_b_session_fail_message_property: sideBSession.fail.messageProperty,
|
|
6979
|
+
side_b_session_fail_attachments_property: sideBSession.fail.attachmentsProperty,
|
|
6980
|
+
side_b_session_status_tool: sideBSession.status.toolName,
|
|
6981
|
+
side_b_session_status_message_property: sideBSession.status.messageProperty,
|
|
6982
|
+
side_b_session_status_attachments_property: sideBSession.status.attachmentsProperty
|
|
6929
6983
|
};
|
|
6930
6984
|
const { sideAPrompt, sideBPrompt } = await this.loadAgentAndPrompts(
|
|
6931
6985
|
agentConfig,
|
|
@@ -7716,7 +7770,7 @@ var init_FlowEngine = __esm({
|
|
|
7716
7770
|
role: row.role,
|
|
7717
7771
|
content: row.content,
|
|
7718
7772
|
created_at: row.created_at,
|
|
7719
|
-
silent: row.silent
|
|
7773
|
+
silent: this.isSilentMessageRow(row.silent),
|
|
7720
7774
|
attachments: row.attachments,
|
|
7721
7775
|
metadata: parsedMetadata,
|
|
7722
7776
|
subagent_id: this.extractSubagentIdFromMetadata(row.metadata)
|
|
@@ -7869,12 +7923,6 @@ var init_FlowEngine = __esm({
|
|
|
7869
7923
|
const completedMessages = state.messageHistory.filter(
|
|
7870
7924
|
(msg) => msg.status !== "pending"
|
|
7871
7925
|
);
|
|
7872
|
-
const toolCallsWithResponses = /* @__PURE__ */ new Set();
|
|
7873
|
-
for (const msg of completedMessages) {
|
|
7874
|
-
if (msg.role === "tool" && msg.tool_call_id) {
|
|
7875
|
-
toolCallsWithResponses.add(msg.tool_call_id);
|
|
7876
|
-
}
|
|
7877
|
-
}
|
|
7878
7926
|
const recentMessageThreshold = state.prompt.recentImageThreshold ?? 10;
|
|
7879
7927
|
const oldMessageThreshold = completedMessages.length - recentMessageThreshold;
|
|
7880
7928
|
let messageIndex = 0;
|
|
@@ -7937,11 +7985,12 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
7937
7985
|
messageContent = msg.content || "";
|
|
7938
7986
|
}
|
|
7939
7987
|
messageIndex++;
|
|
7988
|
+
const shouldIncludeAssistantToolCalls = includePastTools && role === "assistant" && Boolean(msg.tool_calls);
|
|
7940
7989
|
const messageToAdd = {
|
|
7941
7990
|
role,
|
|
7942
7991
|
content: messageContent,
|
|
7943
|
-
tool_calls:
|
|
7944
|
-
tool_call_id: includePastTools && msg.tool_call_id ? msg.tool_call_id : void 0,
|
|
7992
|
+
tool_calls: shouldIncludeAssistantToolCalls ? JSON.parse(msg.tool_calls) : void 0,
|
|
7993
|
+
tool_call_id: includePastTools && msg.role === "tool" && msg.tool_call_id ? msg.tool_call_id : void 0,
|
|
7945
7994
|
name: msg.name || void 0,
|
|
7946
7995
|
// For tool messages, also set toolName for provider transformers (e.g., OpenAI image_generation)
|
|
7947
7996
|
toolName: msg.role === "tool" ? msg.name : void 0
|
|
@@ -7991,24 +8040,7 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
7991
8040
|
messageToAdd.reasoning_details = reasoningDetailsArray;
|
|
7992
8041
|
}
|
|
7993
8042
|
}
|
|
7994
|
-
|
|
7995
|
-
const toolCalls = JSON.parse(msg.tool_calls);
|
|
7996
|
-
const matchedToolCalls = toolCalls.filter(
|
|
7997
|
-
(toolCall) => toolCallsWithResponses.has(toolCall.id)
|
|
7998
|
-
);
|
|
7999
|
-
if (msg.content || matchedToolCalls.length > 0) {
|
|
8000
|
-
if (matchedToolCalls.length === 0) {
|
|
8001
|
-
delete messageToAdd.tool_calls;
|
|
8002
|
-
} else if (matchedToolCalls.length !== toolCalls.length) {
|
|
8003
|
-
messageToAdd.tool_calls = matchedToolCalls;
|
|
8004
|
-
}
|
|
8005
|
-
messages.push(messageToAdd);
|
|
8006
|
-
} else {
|
|
8007
|
-
console.warn(`[FlowEngine] Skipping assistant message ${msg.id} - no content and no tool calls with responses`);
|
|
8008
|
-
}
|
|
8009
|
-
} else {
|
|
8010
|
-
messages.push(messageToAdd);
|
|
8011
|
-
}
|
|
8043
|
+
messages.push(messageToAdd);
|
|
8012
8044
|
}
|
|
8013
8045
|
const maxSteps = state.currentSide === "a" ? state.agentConfig.side_a_max_steps : state.agentConfig.side_b_max_steps;
|
|
8014
8046
|
if (typeof maxSteps === "number" && !isNaN(maxSteps)) {
|
|
@@ -9674,14 +9706,14 @@ ${lines.join("\n\n")}`
|
|
|
9674
9706
|
* Check if stop condition is met
|
|
9675
9707
|
*/
|
|
9676
9708
|
static checkStopCondition(state, response) {
|
|
9677
|
-
const
|
|
9709
|
+
const sessionFailToolName = getAgentSessionBinding(
|
|
9678
9710
|
state.agentConfig,
|
|
9679
9711
|
state.currentSide,
|
|
9680
9712
|
"fail"
|
|
9681
9713
|
).toolName;
|
|
9682
|
-
if (
|
|
9714
|
+
if (sessionFailToolName) {
|
|
9683
9715
|
const matchingFailSessionCalls = response.tool_calls?.filter(
|
|
9684
|
-
(call) => call.function.name ===
|
|
9716
|
+
(call) => call.function.name === sessionFailToolName
|
|
9685
9717
|
) ?? [];
|
|
9686
9718
|
if (matchingFailSessionCalls.length > 0) {
|
|
9687
9719
|
const hasSuccessfulFailSessionCall = matchingFailSessionCalls.some(
|
|
@@ -9690,11 +9722,11 @@ ${lines.join("\n\n")}`
|
|
|
9690
9722
|
if (hasSuccessfulFailSessionCall) {
|
|
9691
9723
|
state.stopped = true;
|
|
9692
9724
|
state.stoppedBy = state.currentSide;
|
|
9693
|
-
state.stopReason = `
|
|
9725
|
+
state.stopReason = `sessionFail tool called: ${sessionFailToolName}`;
|
|
9694
9726
|
state.stopReasonCode = "session_fail";
|
|
9695
9727
|
state.emitTelemetry?.({
|
|
9696
9728
|
type: "stopped",
|
|
9697
|
-
reason: `
|
|
9729
|
+
reason: `sessionFail tool called: ${sessionFailToolName}`,
|
|
9698
9730
|
side: state.currentSide,
|
|
9699
9731
|
timestamp: Date.now()
|
|
9700
9732
|
});
|
|
@@ -9709,14 +9741,14 @@ ${lines.join("\n\n")}`
|
|
|
9709
9741
|
};
|
|
9710
9742
|
}
|
|
9711
9743
|
}
|
|
9712
|
-
const
|
|
9744
|
+
const sessionStopToolName = getAgentSessionBinding(
|
|
9713
9745
|
state.agentConfig,
|
|
9714
9746
|
state.currentSide,
|
|
9715
9747
|
"stop"
|
|
9716
9748
|
).toolName;
|
|
9717
|
-
if (
|
|
9749
|
+
if (sessionStopToolName) {
|
|
9718
9750
|
const matchingEndSessionCalls = response.tool_calls?.filter(
|
|
9719
|
-
(call) => call.function.name ===
|
|
9751
|
+
(call) => call.function.name === sessionStopToolName
|
|
9720
9752
|
) ?? [];
|
|
9721
9753
|
if (matchingEndSessionCalls.length > 0) {
|
|
9722
9754
|
const hasSuccessfulEndSessionCall = matchingEndSessionCalls.some(
|
|
@@ -9725,11 +9757,11 @@ ${lines.join("\n\n")}`
|
|
|
9725
9757
|
if (hasSuccessfulEndSessionCall) {
|
|
9726
9758
|
state.stopped = true;
|
|
9727
9759
|
state.stoppedBy = state.currentSide;
|
|
9728
|
-
state.stopReason = `
|
|
9760
|
+
state.stopReason = `sessionStop tool called: ${sessionStopToolName}`;
|
|
9729
9761
|
state.stopReasonCode = "session_stop";
|
|
9730
9762
|
state.emitTelemetry?.({
|
|
9731
9763
|
type: "stopped",
|
|
9732
|
-
reason: `
|
|
9764
|
+
reason: `sessionStop tool called: ${sessionStopToolName}`,
|
|
9733
9765
|
side: state.currentSide,
|
|
9734
9766
|
timestamp: Date.now()
|
|
9735
9767
|
});
|
|
@@ -9821,16 +9853,13 @@ ${lines.join("\n\n")}`
|
|
|
9821
9853
|
)?.[1];
|
|
9822
9854
|
return msg.role === "tool" && referencedSubagentId !== void 0 && (typeof msg.subagent_id === "string" && msg.subagent_id.trim().length > 0 || typeof msg.name === "string");
|
|
9823
9855
|
}
|
|
9856
|
+
static isSilentMessageRow(value) {
|
|
9857
|
+
return value === 1 || value === true;
|
|
9858
|
+
}
|
|
9824
9859
|
static filterOrphanedToolCalls(messages) {
|
|
9825
|
-
const toolResultIds = /* @__PURE__ */ new Set();
|
|
9826
|
-
for (const msg of messages) {
|
|
9827
|
-
if (msg.role === "tool" && msg.tool_call_id) {
|
|
9828
|
-
toolResultIds.add(msg.tool_call_id);
|
|
9829
|
-
}
|
|
9830
|
-
}
|
|
9831
9860
|
const assistantToolCallIds = /* @__PURE__ */ new Set();
|
|
9832
9861
|
for (const msg of messages) {
|
|
9833
|
-
if (msg.role === "assistant" && msg.tool_calls) {
|
|
9862
|
+
if ((msg.role === "assistant" || msg.role === "user") && msg.tool_calls) {
|
|
9834
9863
|
try {
|
|
9835
9864
|
const toolCalls = JSON.parse(msg.tool_calls);
|
|
9836
9865
|
for (const call of toolCalls) {
|
|
@@ -9856,40 +9885,6 @@ ${lines.join("\n\n")}`
|
|
|
9856
9885
|
continue;
|
|
9857
9886
|
}
|
|
9858
9887
|
}
|
|
9859
|
-
if (msg.role === "assistant" && msg.tool_calls) {
|
|
9860
|
-
try {
|
|
9861
|
-
const toolCalls = JSON.parse(msg.tool_calls);
|
|
9862
|
-
const matchedToolCalls = toolCalls.filter(
|
|
9863
|
-
(call) => toolResultIds.has(call.id)
|
|
9864
|
-
);
|
|
9865
|
-
if (matchedToolCalls.length === 0 && toolCalls.length > 0) {
|
|
9866
|
-
if (msg.content) {
|
|
9867
|
-
console.warn(`[FlowEngine] Filtering tool_calls from message ${msg.id} - no matching tool results`);
|
|
9868
|
-
warnedRemovedCount += 1;
|
|
9869
|
-
filtered.push({
|
|
9870
|
-
...msg,
|
|
9871
|
-
tool_calls: null
|
|
9872
|
-
});
|
|
9873
|
-
continue;
|
|
9874
|
-
} else {
|
|
9875
|
-
console.warn(`[FlowEngine] Filtering assistant message ${msg.id} - no content and no tool calls with results`);
|
|
9876
|
-
warnedRemovedCount += 1;
|
|
9877
|
-
continue;
|
|
9878
|
-
}
|
|
9879
|
-
}
|
|
9880
|
-
if (matchedToolCalls.length !== toolCalls.length) {
|
|
9881
|
-
console.warn(`[FlowEngine] Filtering ${toolCalls.length - matchedToolCalls.length} orphaned tool_calls from message ${msg.id}`);
|
|
9882
|
-
warnedRemovedCount += 1;
|
|
9883
|
-
filtered.push({
|
|
9884
|
-
...msg,
|
|
9885
|
-
tool_calls: JSON.stringify(matchedToolCalls)
|
|
9886
|
-
});
|
|
9887
|
-
continue;
|
|
9888
|
-
}
|
|
9889
|
-
} catch (error) {
|
|
9890
|
-
console.error(`Failed to parse tool_calls for message ${msg.id}:`, error);
|
|
9891
|
-
}
|
|
9892
|
-
}
|
|
9893
9888
|
filtered.push(msg);
|
|
9894
9889
|
}
|
|
9895
9890
|
const removedCount = messages.length - filtered.length;
|
|
@@ -9960,14 +9955,18 @@ ${lines.join("\n\n")}`
|
|
|
9960
9955
|
request_sent_at: row.request_sent_at,
|
|
9961
9956
|
response_completed_at: row.response_completed_at,
|
|
9962
9957
|
status: row.status,
|
|
9963
|
-
silent: row.silent
|
|
9958
|
+
silent: this.isSilentMessageRow(row.silent),
|
|
9964
9959
|
tool_status: row.tool_status,
|
|
9965
9960
|
parent_id: row.parent_id,
|
|
9966
9961
|
depth: row.depth,
|
|
9967
9962
|
reasoning_content: row.reasoning_content,
|
|
9968
9963
|
reasoning_details: row.reasoning_details
|
|
9969
9964
|
}));
|
|
9970
|
-
return this.runFilterMessagesHook(
|
|
9965
|
+
return this.runFilterMessagesHook(
|
|
9966
|
+
thread.instance,
|
|
9967
|
+
state,
|
|
9968
|
+
this.filterOrphanedToolCalls(messages)
|
|
9969
|
+
);
|
|
9971
9970
|
} catch (error) {
|
|
9972
9971
|
console.error("Error loading message history:", error);
|
|
9973
9972
|
return [];
|
|
@@ -11428,7 +11427,6 @@ function generateTypesContent(config) {
|
|
|
11428
11427
|
const agents = agentResults.map((a) => a.name);
|
|
11429
11428
|
const callables = [...prompts, ...agents, ...tools];
|
|
11430
11429
|
return `// Auto-generated by @standardagents/builder - DO NOT EDIT
|
|
11431
|
-
// Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
11432
11430
|
//
|
|
11433
11431
|
// This file augments the StandardAgentSpec namespace declared in @standardagents/spec
|
|
11434
11432
|
// to provide type-safe references for your models, prompts, agents, tools, and hooks.
|
|
@@ -11717,7 +11715,7 @@ declare module 'virtual:@standardagents/builder' {
|
|
|
11717
11715
|
offset?: number,
|
|
11718
11716
|
order?: 'ASC' | 'DESC'
|
|
11719
11717
|
): Promise<GetLogsResult>;
|
|
11720
|
-
getLogDetails(logId: string): Promise<ThreadLogDetails>;
|
|
11718
|
+
getLogDetails(logId: string): Promise<ThreadLogDetails | null>;
|
|
11721
11719
|
|
|
11722
11720
|
// Thread management methods
|
|
11723
11721
|
getThreadMeta(threadId: string): Promise<ThreadMetaResult>;
|
|
@@ -11973,14 +11971,23 @@ function ensureDir(dir) {
|
|
|
11973
11971
|
fs4__default.mkdirSync(dir, { recursive: true });
|
|
11974
11972
|
}
|
|
11975
11973
|
}
|
|
11974
|
+
function writeFileIfChanged(filePath, content) {
|
|
11975
|
+
if (fs4__default.existsSync(filePath)) {
|
|
11976
|
+
const existing = fs4__default.readFileSync(filePath, "utf-8");
|
|
11977
|
+
if (existing === content) {
|
|
11978
|
+
return;
|
|
11979
|
+
}
|
|
11980
|
+
}
|
|
11981
|
+
fs4__default.writeFileSync(filePath, content);
|
|
11982
|
+
}
|
|
11976
11983
|
function generateTypes(config) {
|
|
11977
11984
|
ensureDir(config.outputDir);
|
|
11978
11985
|
const typesContent = generateTypesContent(config);
|
|
11979
|
-
|
|
11986
|
+
writeFileIfChanged(path8__default.join(config.outputDir, "types.d.ts"), typesContent);
|
|
11980
11987
|
const virtualModuleContent = generateVirtualModuleContent();
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
|
|
11988
|
+
writeFileIfChanged(path8__default.join(config.outputDir, "virtual-module.d.ts"), virtualModuleContent);
|
|
11989
|
+
writeFileIfChanged(path8__default.join(config.outputDir, "tsconfig.json"), TSCONFIG_CONTENT);
|
|
11990
|
+
writeFileIfChanged(path8__default.join(config.outputDir, ".gitignore"), "*\n");
|
|
11984
11991
|
}
|
|
11985
11992
|
function needsRegeneration(config) {
|
|
11986
11993
|
const typesPath = path8__default.join(config.outputDir, "types.d.ts");
|
|
@@ -12589,18 +12596,12 @@ function formatSideConfig(config) {
|
|
|
12589
12596
|
}
|
|
12590
12597
|
if (config.sessionStop) {
|
|
12591
12598
|
parts.push(` sessionStop: ${formatSessionBinding(config.sessionStop)},`);
|
|
12592
|
-
} else if (config.endSessionTool) {
|
|
12593
|
-
parts.push(` endSessionTool: '${escapeString3(config.endSessionTool)}',`);
|
|
12594
12599
|
}
|
|
12595
12600
|
if (config.sessionFail) {
|
|
12596
12601
|
parts.push(` sessionFail: ${formatSessionBinding(config.sessionFail)},`);
|
|
12597
|
-
} else if (config.failSessionTool) {
|
|
12598
|
-
parts.push(` failSessionTool: '${escapeString3(config.failSessionTool)}',`);
|
|
12599
12602
|
}
|
|
12600
12603
|
if (config.sessionStatus) {
|
|
12601
12604
|
parts.push(` sessionStatus: ${formatSessionBinding(config.sessionStatus)},`);
|
|
12602
|
-
} else if (config.statusTool) {
|
|
12603
|
-
parts.push(` statusTool: '${escapeString3(config.statusTool)}',`);
|
|
12604
12605
|
}
|
|
12605
12606
|
if (config.manualStopCondition) {
|
|
12606
12607
|
parts.push(` manualStopCondition: ${config.manualStopCondition},`);
|
|
@@ -13269,34 +13270,28 @@ function transformAgentData(data) {
|
|
|
13269
13270
|
transformed.sideA.maxSteps = data.side_a_max_steps;
|
|
13270
13271
|
}
|
|
13271
13272
|
const sideASessionStop = toSessionBinding(
|
|
13272
|
-
data.side_a_session_stop_tool
|
|
13273
|
+
data.side_a_session_stop_tool,
|
|
13273
13274
|
data.side_a_session_stop_message_property,
|
|
13274
13275
|
data.side_a_session_stop_attachments_property
|
|
13275
13276
|
);
|
|
13276
13277
|
if (sideASessionStop !== void 0) {
|
|
13277
13278
|
transformed.sideA.sessionStop = sideASessionStop;
|
|
13278
|
-
} else if (data.side_a_end_session_tool) {
|
|
13279
|
-
transformed.sideA.endSessionTool = data.side_a_end_session_tool;
|
|
13280
13279
|
}
|
|
13281
13280
|
const sideASessionFail = toSessionBinding(
|
|
13282
|
-
data.side_a_session_fail_tool
|
|
13281
|
+
data.side_a_session_fail_tool,
|
|
13283
13282
|
data.side_a_session_fail_message_property,
|
|
13284
13283
|
data.side_a_session_fail_attachments_property
|
|
13285
13284
|
);
|
|
13286
13285
|
if (sideASessionFail !== void 0) {
|
|
13287
13286
|
transformed.sideA.sessionFail = sideASessionFail;
|
|
13288
|
-
} else if (data.side_a_fail_session_tool) {
|
|
13289
|
-
transformed.sideA.failSessionTool = data.side_a_fail_session_tool;
|
|
13290
13287
|
}
|
|
13291
13288
|
const sideASessionStatus = toSessionBinding(
|
|
13292
|
-
data.side_a_session_status_tool
|
|
13289
|
+
data.side_a_session_status_tool,
|
|
13293
13290
|
data.side_a_session_status_message_property,
|
|
13294
13291
|
data.side_a_session_status_attachments_property
|
|
13295
13292
|
);
|
|
13296
13293
|
if (sideASessionStatus !== void 0) {
|
|
13297
13294
|
transformed.sideA.sessionStatus = sideASessionStatus;
|
|
13298
|
-
} else if (data.side_a_status_tool) {
|
|
13299
|
-
transformed.sideA.statusTool = data.side_a_status_tool;
|
|
13300
13295
|
}
|
|
13301
13296
|
if (data.side_a_manual_stop_condition !== void 0) {
|
|
13302
13297
|
transformed.sideA.manualStopCondition = data.side_a_manual_stop_condition;
|
|
@@ -13321,34 +13316,28 @@ function transformAgentData(data) {
|
|
|
13321
13316
|
transformed.sideB.maxSteps = data.side_b_max_steps;
|
|
13322
13317
|
}
|
|
13323
13318
|
const sideBSessionStop = toSessionBinding(
|
|
13324
|
-
data.side_b_session_stop_tool
|
|
13319
|
+
data.side_b_session_stop_tool,
|
|
13325
13320
|
data.side_b_session_stop_message_property,
|
|
13326
13321
|
data.side_b_session_stop_attachments_property
|
|
13327
13322
|
);
|
|
13328
13323
|
if (sideBSessionStop !== void 0) {
|
|
13329
13324
|
transformed.sideB.sessionStop = sideBSessionStop;
|
|
13330
|
-
} else if (data.side_b_end_session_tool) {
|
|
13331
|
-
transformed.sideB.endSessionTool = data.side_b_end_session_tool;
|
|
13332
13325
|
}
|
|
13333
13326
|
const sideBSessionFail = toSessionBinding(
|
|
13334
|
-
data.side_b_session_fail_tool
|
|
13327
|
+
data.side_b_session_fail_tool,
|
|
13335
13328
|
data.side_b_session_fail_message_property,
|
|
13336
13329
|
data.side_b_session_fail_attachments_property
|
|
13337
13330
|
);
|
|
13338
13331
|
if (sideBSessionFail !== void 0) {
|
|
13339
13332
|
transformed.sideB.sessionFail = sideBSessionFail;
|
|
13340
|
-
} else if (data.side_b_fail_session_tool) {
|
|
13341
|
-
transformed.sideB.failSessionTool = data.side_b_fail_session_tool;
|
|
13342
13333
|
}
|
|
13343
13334
|
const sideBSessionStatus = toSessionBinding(
|
|
13344
|
-
data.side_b_session_status_tool
|
|
13335
|
+
data.side_b_session_status_tool,
|
|
13345
13336
|
data.side_b_session_status_message_property,
|
|
13346
13337
|
data.side_b_session_status_attachments_property
|
|
13347
13338
|
);
|
|
13348
13339
|
if (sideBSessionStatus !== void 0) {
|
|
13349
13340
|
transformed.sideB.sessionStatus = sideBSessionStatus;
|
|
13350
|
-
} else if (data.side_b_status_tool) {
|
|
13351
|
-
transformed.sideB.statusTool = data.side_b_status_tool;
|
|
13352
13341
|
}
|
|
13353
13342
|
if (data.side_b_manual_stop_condition !== void 0) {
|
|
13354
13343
|
transformed.sideB.manualStopCondition = data.side_b_manual_stop_condition;
|
|
@@ -21076,7 +21065,7 @@ var DurableThread = class extends DurableObject {
|
|
|
21076
21065
|
true
|
|
21077
21066
|
);
|
|
21078
21067
|
const terminalToolNames = await this.getTerminalSessionToolNames(agentId);
|
|
21079
|
-
const
|
|
21068
|
+
const sessionFailToolNames = terminalToolNames.fail;
|
|
21080
21069
|
const hasTerminalSessionTools = terminalToolNames.all.size > 0;
|
|
21081
21070
|
const latestInRunCursor = await this.ctx.storage.sql.exec(
|
|
21082
21071
|
`
|
|
@@ -21131,7 +21120,7 @@ var DurableThread = class extends DurableObject {
|
|
|
21131
21120
|
return { status: "success", result: "Subagent completed." };
|
|
21132
21121
|
}
|
|
21133
21122
|
const attachments = hasTerminalSessionTools && !selectedTerminalRow ? void 0 : this.parseAttachmentRefsJson(row.attachments);
|
|
21134
|
-
const isFailSessionTerminal = row.role === "tool" && !!row.name &&
|
|
21123
|
+
const isFailSessionTerminal = row.role === "tool" && !!row.name && sessionFailToolNames.has(row.name);
|
|
21135
21124
|
const isSuccessfulTerminalSessionCall = selectedTerminalRow && row.role === "tool" && !!row.name && terminalToolNames.all.has(row.name) && row.tool_status !== "error";
|
|
21136
21125
|
if (isFailSessionTerminal) {
|
|
21137
21126
|
await emitParentHandoffStatus("failure");
|
|
@@ -21519,7 +21508,7 @@ ${paths.join("\n")}`;
|
|
|
21519
21508
|
return;
|
|
21520
21509
|
}
|
|
21521
21510
|
const terminalToolNames = await this.getTerminalSessionToolNames(agentName);
|
|
21522
|
-
const
|
|
21511
|
+
const sessionFailToolNames = terminalToolNames.fail;
|
|
21523
21512
|
const hasTerminalSessionTools = terminalToolNames.all.size > 0;
|
|
21524
21513
|
const latest = await this.getLatestTopLevelMessage();
|
|
21525
21514
|
if (!latest && !hasTerminalSessionTools) {
|
|
@@ -21529,7 +21518,7 @@ ${paths.join("\n")}`;
|
|
|
21529
21518
|
return;
|
|
21530
21519
|
}
|
|
21531
21520
|
const isTerminalSessionMessage = !!latest && latest.role === "tool" && !!latest.name && terminalToolNames.all.has(latest.name);
|
|
21532
|
-
const isFailSessionTerminal = isTerminalSessionMessage && !!latest.name &&
|
|
21521
|
+
const isFailSessionTerminal = isTerminalSessionMessage && !!latest.name && sessionFailToolNames.has(latest.name);
|
|
21533
21522
|
const isSuccessfulTerminalSessionMessage = isTerminalSessionMessage && latest?.tool_status !== "error";
|
|
21534
21523
|
const isFailureWithoutTerminalMessage = hasTerminalSessionTools && !isSuccessfulTerminalSessionMessage;
|
|
21535
21524
|
const isErrorTerminal = latest?.tool_status === "error" || isFailSessionTerminal || isFailureWithoutTerminalMessage;
|
|
@@ -22087,9 +22076,9 @@ ${resultContent}${attachmentSummary}`;
|
|
|
22087
22076
|
`,
|
|
22088
22077
|
logId
|
|
22089
22078
|
);
|
|
22090
|
-
const row = result.
|
|
22079
|
+
const row = result.toArray()[0] ?? null;
|
|
22091
22080
|
if (!row) {
|
|
22092
|
-
|
|
22081
|
+
return null;
|
|
22093
22082
|
}
|
|
22094
22083
|
let messageHistory = null;
|
|
22095
22084
|
if (row.request_body) {
|
|
@@ -22545,30 +22534,30 @@ ${resultContent}${attachmentSummary}`;
|
|
|
22545
22534
|
side_a_stop_tool: agentDef.sideA?.stopTool,
|
|
22546
22535
|
side_a_stop_tool_response_property: agentDef.sideA?.stopToolResponseProperty,
|
|
22547
22536
|
side_a_max_steps: agentDef.sideA?.maxSteps,
|
|
22548
|
-
|
|
22549
|
-
|
|
22550
|
-
|
|
22551
|
-
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
|
|
22556
|
-
|
|
22537
|
+
side_a_session_stop_tool: sideASession.stop.toolName,
|
|
22538
|
+
side_a_session_stop_message_property: sideASession.stop.messageProperty,
|
|
22539
|
+
side_a_session_stop_attachments_property: sideASession.stop.attachmentsProperty,
|
|
22540
|
+
side_a_session_fail_tool: sideASession.fail.toolName,
|
|
22541
|
+
side_a_session_fail_message_property: sideASession.fail.messageProperty,
|
|
22542
|
+
side_a_session_fail_attachments_property: sideASession.fail.attachmentsProperty,
|
|
22543
|
+
side_a_session_status_tool: sideASession.status.toolName,
|
|
22544
|
+
side_a_session_status_message_property: sideASession.status.messageProperty,
|
|
22545
|
+
side_a_session_status_attachments_property: sideASession.status.attachmentsProperty,
|
|
22557
22546
|
side_b_label: agentDef.sideB?.label,
|
|
22558
22547
|
side_b_agent_prompt: qualifyPromptName(agentDef.sideB?.prompt),
|
|
22559
22548
|
side_b_stop_on_response: agentDef.sideB?.stopOnResponse ?? false,
|
|
22560
22549
|
side_b_stop_tool: agentDef.sideB?.stopTool,
|
|
22561
22550
|
side_b_stop_tool_response_property: agentDef.sideB?.stopToolResponseProperty,
|
|
22562
22551
|
side_b_max_steps: agentDef.sideB?.maxSteps,
|
|
22563
|
-
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
|
|
22570
|
-
|
|
22571
|
-
|
|
22552
|
+
side_b_session_stop_tool: sideBSession.stop.toolName,
|
|
22553
|
+
side_b_session_stop_message_property: sideBSession.stop.messageProperty,
|
|
22554
|
+
side_b_session_stop_attachments_property: sideBSession.stop.attachmentsProperty,
|
|
22555
|
+
side_b_session_fail_tool: sideBSession.fail.toolName,
|
|
22556
|
+
side_b_session_fail_message_property: sideBSession.fail.messageProperty,
|
|
22557
|
+
side_b_session_fail_attachments_property: sideBSession.fail.attachmentsProperty,
|
|
22558
|
+
side_b_session_status_tool: sideBSession.status.toolName,
|
|
22559
|
+
side_b_session_status_message_property: sideBSession.status.messageProperty,
|
|
22560
|
+
side_b_session_status_attachments_property: sideBSession.status.attachmentsProperty
|
|
22572
22561
|
};
|
|
22573
22562
|
const agentBuilderId = this.env.AGENT_BUILDER.idFromName("singleton");
|
|
22574
22563
|
const agentBuilder = this.env.AGENT_BUILDER.get(agentBuilderId);
|
|
@@ -22731,30 +22720,30 @@ ${resultContent}${attachmentSummary}`;
|
|
|
22731
22720
|
side_a_stop_tool: agentDef.sideA?.stopTool,
|
|
22732
22721
|
side_a_stop_tool_response_property: agentDef.sideA?.stopToolResponseProperty,
|
|
22733
22722
|
side_a_max_steps: agentDef.sideA?.maxSteps,
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
|
|
22742
|
-
|
|
22723
|
+
side_a_session_stop_tool: sideASession.stop.toolName,
|
|
22724
|
+
side_a_session_stop_message_property: sideASession.stop.messageProperty,
|
|
22725
|
+
side_a_session_stop_attachments_property: sideASession.stop.attachmentsProperty,
|
|
22726
|
+
side_a_session_fail_tool: sideASession.fail.toolName,
|
|
22727
|
+
side_a_session_fail_message_property: sideASession.fail.messageProperty,
|
|
22728
|
+
side_a_session_fail_attachments_property: sideASession.fail.attachmentsProperty,
|
|
22729
|
+
side_a_session_status_tool: sideASession.status.toolName,
|
|
22730
|
+
side_a_session_status_message_property: sideASession.status.messageProperty,
|
|
22731
|
+
side_a_session_status_attachments_property: sideASession.status.attachmentsProperty,
|
|
22743
22732
|
side_b_label: agentDef.sideB?.label,
|
|
22744
22733
|
side_b_agent_prompt: qualifyPromptName(agentDef.sideB?.prompt),
|
|
22745
22734
|
side_b_stop_on_response: agentDef.sideB?.stopOnResponse ?? false,
|
|
22746
22735
|
side_b_stop_tool: agentDef.sideB?.stopTool,
|
|
22747
22736
|
side_b_stop_tool_response_property: agentDef.sideB?.stopToolResponseProperty,
|
|
22748
22737
|
side_b_max_steps: agentDef.sideB?.maxSteps,
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
|
|
22756
|
-
|
|
22757
|
-
|
|
22738
|
+
side_b_session_stop_tool: sideBSession.stop.toolName,
|
|
22739
|
+
side_b_session_stop_message_property: sideBSession.stop.messageProperty,
|
|
22740
|
+
side_b_session_stop_attachments_property: sideBSession.stop.attachmentsProperty,
|
|
22741
|
+
side_b_session_fail_tool: sideBSession.fail.toolName,
|
|
22742
|
+
side_b_session_fail_message_property: sideBSession.fail.messageProperty,
|
|
22743
|
+
side_b_session_fail_attachments_property: sideBSession.fail.attachmentsProperty,
|
|
22744
|
+
side_b_session_status_tool: sideBSession.status.toolName,
|
|
22745
|
+
side_b_session_status_message_property: sideBSession.status.messageProperty,
|
|
22746
|
+
side_b_session_status_attachments_property: sideBSession.status.attachmentsProperty
|
|
22758
22747
|
};
|
|
22759
22748
|
const messageId = crypto.randomUUID();
|
|
22760
22749
|
const timestamp = Date.now() * 1e3;
|
|
@@ -22876,30 +22865,30 @@ ${resultContent}${attachmentSummary}`;
|
|
|
22876
22865
|
side_a_stop_tool: agentDef.sideA?.stopTool,
|
|
22877
22866
|
side_a_stop_tool_response_property: agentDef.sideA?.stopToolResponseProperty,
|
|
22878
22867
|
side_a_max_steps: agentDef.sideA?.maxSteps,
|
|
22879
|
-
|
|
22880
|
-
|
|
22881
|
-
|
|
22882
|
-
|
|
22883
|
-
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22868
|
+
side_a_session_stop_tool: sideASession.stop.toolName,
|
|
22869
|
+
side_a_session_stop_message_property: sideASession.stop.messageProperty,
|
|
22870
|
+
side_a_session_stop_attachments_property: sideASession.stop.attachmentsProperty,
|
|
22871
|
+
side_a_session_fail_tool: sideASession.fail.toolName,
|
|
22872
|
+
side_a_session_fail_message_property: sideASession.fail.messageProperty,
|
|
22873
|
+
side_a_session_fail_attachments_property: sideASession.fail.attachmentsProperty,
|
|
22874
|
+
side_a_session_status_tool: sideASession.status.toolName,
|
|
22875
|
+
side_a_session_status_message_property: sideASession.status.messageProperty,
|
|
22876
|
+
side_a_session_status_attachments_property: sideASession.status.attachmentsProperty,
|
|
22888
22877
|
side_b_label: agentDef.sideB?.label,
|
|
22889
22878
|
side_b_agent_prompt: qualifyPromptName(agentDef.sideB?.prompt),
|
|
22890
22879
|
side_b_stop_on_response: agentDef.sideB?.stopOnResponse ?? false,
|
|
22891
22880
|
side_b_stop_tool: agentDef.sideB?.stopTool,
|
|
22892
22881
|
side_b_stop_tool_response_property: agentDef.sideB?.stopToolResponseProperty,
|
|
22893
22882
|
side_b_max_steps: agentDef.sideB?.maxSteps,
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
|
|
22898
|
-
|
|
22899
|
-
|
|
22900
|
-
|
|
22901
|
-
|
|
22902
|
-
|
|
22883
|
+
side_b_session_stop_tool: sideBSession.stop.toolName,
|
|
22884
|
+
side_b_session_stop_message_property: sideBSession.stop.messageProperty,
|
|
22885
|
+
side_b_session_stop_attachments_property: sideBSession.stop.attachmentsProperty,
|
|
22886
|
+
side_b_session_fail_tool: sideBSession.fail.toolName,
|
|
22887
|
+
side_b_session_fail_message_property: sideBSession.fail.messageProperty,
|
|
22888
|
+
side_b_session_fail_attachments_property: sideBSession.fail.attachmentsProperty,
|
|
22889
|
+
side_b_session_status_tool: sideBSession.status.toolName,
|
|
22890
|
+
side_b_session_status_message_property: sideBSession.status.messageProperty,
|
|
22891
|
+
side_b_session_status_attachments_property: sideBSession.status.attachmentsProperty
|
|
22903
22892
|
};
|
|
22904
22893
|
const { StreamManager: StreamManager2 } = await Promise.resolve().then(() => (init_StreamManager(), StreamManager_exports));
|
|
22905
22894
|
const stream = new StreamManager2();
|