@standardagents/builder 0.38.2 → 0.39.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/built-in-routes.js +54 -7
- package/dist/built-in-routes.js.map +1 -1
- package/dist/{index-CF-lgN47.d.ts → index-yIcqf7DC.d.ts} +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +53 -6
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +53 -6
- package/dist/runtime.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/package.json +5 -5
package/dist/built-in-routes.js
CHANGED
|
@@ -4247,6 +4247,24 @@ var init_ToolExecutor = __esm({
|
|
|
4247
4247
|
}
|
|
4248
4248
|
} catch {
|
|
4249
4249
|
}
|
|
4250
|
+
const aliasTarget = this.subagentAliasTarget(state, toolName);
|
|
4251
|
+
if (aliasTarget) {
|
|
4252
|
+
if (packageId) {
|
|
4253
|
+
try {
|
|
4254
|
+
const qualified = aliasTarget.includes("/") ? aliasTarget : `${packageId}/${aliasTarget}`;
|
|
4255
|
+
if (await state.thread.instance.loadAgent(qualified)) {
|
|
4256
|
+
return "agent";
|
|
4257
|
+
}
|
|
4258
|
+
} catch {
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
try {
|
|
4262
|
+
if (await state.thread.instance.loadAgent(aliasTarget)) {
|
|
4263
|
+
return "agent";
|
|
4264
|
+
}
|
|
4265
|
+
} catch {
|
|
4266
|
+
}
|
|
4267
|
+
}
|
|
4250
4268
|
const isInToolsArray = (agentName) => {
|
|
4251
4269
|
const tools2 = state.prompt._tools || [];
|
|
4252
4270
|
return tools2.some((t) => typeof t === "string" ? t === agentName : t.name === agentName);
|
|
@@ -4762,15 +4780,20 @@ Message one with subagent_message(referenceId, message).`
|
|
|
4762
4780
|
const builtinCreateAttachmentValue = createArgs?.attachments;
|
|
4763
4781
|
const builtinCreateInitialArguments = createArgs?.initialArguments ?? {};
|
|
4764
4782
|
const registryAgentName = targetAgentForCreate || call.function.name;
|
|
4783
|
+
const aliasConfig = this.resolveSubagentToolConfig(state, registryAgentName);
|
|
4784
|
+
const implementingAgentName = typeof aliasConfig.agent === "string" && aliasConfig.agent.trim().length > 0 ? aliasConfig.agent.trim() : registryAgentName;
|
|
4765
4785
|
const packageId = getPackageId(state);
|
|
4766
4786
|
let agentDef = null;
|
|
4767
|
-
let agentName =
|
|
4787
|
+
let agentName = implementingAgentName;
|
|
4768
4788
|
if (builtinSubagentAction === "create" && targetAgentForCreate) {
|
|
4769
4789
|
const availableSubagents = await this.getPromptSubagentNames(state);
|
|
4770
4790
|
if (!availableSubagents.includes(targetAgentForCreate)) {
|
|
4791
|
+
const configuredDirect = (state.prompt._tools || []).some(
|
|
4792
|
+
(t) => typeof t === "string" ? t === targetAgentForCreate : t?.name === targetAgentForCreate
|
|
4793
|
+
);
|
|
4771
4794
|
return {
|
|
4772
4795
|
status: "error",
|
|
4773
|
-
error: `Subagent "${targetAgentForCreate}" is not available for this prompt. Use one of: ${availableSubagents.join(", ") || "(none)"}.`
|
|
4796
|
+
error: configuredDirect ? `"${targetAgentForCreate}" is not a resumable subagent \u2014 call the ${targetAgentForCreate} tool directly; it runs to completion and returns its result in the tool response. subagent_create manages resumable subagents only: ${availableSubagents.join(", ") || "(none)"}.` : `Subagent "${targetAgentForCreate}" is not available for this prompt. Use one of: ${availableSubagents.join(", ") || "(none)"}.`
|
|
4774
4797
|
};
|
|
4775
4798
|
}
|
|
4776
4799
|
}
|
|
@@ -4811,7 +4834,7 @@ Message one with subagent_message(referenceId, message).`
|
|
|
4811
4834
|
if (agentType === "ai_human") {
|
|
4812
4835
|
const parentToolConfigs = state.prompt._tools || [];
|
|
4813
4836
|
const toolConfig = parentToolConfigs.find(
|
|
4814
|
-
(t) => typeof t === "string" ? t === agentName : t.name === agentName
|
|
4837
|
+
(t) => typeof t === "string" ? t === registryAgentName || t === agentName : t.name === registryAgentName || t.name === agentName
|
|
4815
4838
|
);
|
|
4816
4839
|
const subpromptToolConfig = this.getSubpromptToolConfig(toolConfig);
|
|
4817
4840
|
const targetState = state.rootState || state;
|
|
@@ -5389,6 +5412,27 @@ Message one with subagent_message(referenceId, message).`
|
|
|
5389
5412
|
}
|
|
5390
5413
|
return null;
|
|
5391
5414
|
}
|
|
5415
|
+
/**
|
|
5416
|
+
* The implementing agent behind an aliased subagent tool name, or null when
|
|
5417
|
+
* the name carries no alias (`agent` absent, empty, or equal to the name).
|
|
5418
|
+
*/
|
|
5419
|
+
static subagentAliasTarget(state, toolName) {
|
|
5420
|
+
for (const tool3 of state.prompt._tools || []) {
|
|
5421
|
+
if (!tool3 || typeof tool3 !== "object" || tool3.name !== toolName) {
|
|
5422
|
+
continue;
|
|
5423
|
+
}
|
|
5424
|
+
const target = tool3.agent;
|
|
5425
|
+
if (typeof target === "string" && target.trim().length > 0 && target.trim() !== toolName) {
|
|
5426
|
+
return target.trim();
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
return null;
|
|
5430
|
+
}
|
|
5431
|
+
/**
|
|
5432
|
+
* Resolve the prompt's subagent tool config for an EXPOSED tool name.
|
|
5433
|
+
* Config entries are keyed by `name` (the model-facing tool name), which
|
|
5434
|
+
* may alias a differently-named implementing agent via `agent`.
|
|
5435
|
+
*/
|
|
5392
5436
|
static resolveSubagentToolConfig(state, agentName) {
|
|
5393
5437
|
const config = (state.prompt._tools || []).find(
|
|
5394
5438
|
(tool3) => typeof tool3 === "string" ? tool3 === agentName : tool3.name === agentName
|
|
@@ -8842,7 +8886,8 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
8842
8886
|
}
|
|
8843
8887
|
if (foundToolNames.has(toolName)) continue;
|
|
8844
8888
|
try {
|
|
8845
|
-
const
|
|
8889
|
+
const implementingAgent = subagentConfig && typeof subagentConfig.agent === "string" && subagentConfig.agent.trim().length > 0 ? subagentConfig.agent.trim() : toolName;
|
|
8890
|
+
const agentDef = await state.thread.instance.loadAgent(implementingAgent);
|
|
8846
8891
|
if (agentDef && (agentDef.type === "ai_human" || agentDef.type === "dual_ai")) {
|
|
8847
8892
|
let parameters;
|
|
8848
8893
|
const sideAPromptName = agentDef.sideA?.prompt;
|
|
@@ -9056,12 +9101,14 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
9056
9101
|
if (!toolName || toolName.startsWith("provider:") || seen.has(toolName)) {
|
|
9057
9102
|
continue;
|
|
9058
9103
|
}
|
|
9059
|
-
const
|
|
9104
|
+
const subagentConfigForLoad = this.isSubagentToolConfig(configEntry) ? configEntry : void 0;
|
|
9105
|
+
const implementingAgent = subagentConfigForLoad && typeof subagentConfigForLoad.agent === "string" && subagentConfigForLoad.agent.trim().length > 0 ? subagentConfigForLoad.agent.trim() : toolName;
|
|
9106
|
+
const agentDef = await this.tryLoadPromptToolAgent(state, implementingAgent, packageId);
|
|
9060
9107
|
if (!agentDef || agentDef.type !== "dual_ai") {
|
|
9061
9108
|
continue;
|
|
9062
9109
|
}
|
|
9063
9110
|
seen.add(toolName);
|
|
9064
|
-
const subagentConfig =
|
|
9111
|
+
const subagentConfig = subagentConfigForLoad;
|
|
9065
9112
|
const blocking = subagentConfig?.blocking ?? true;
|
|
9066
9113
|
const resumable = !!subagentConfig?.resumable && typeof subagentConfig.resumable === "object";
|
|
9067
9114
|
const receivesMessages = subagentConfig?.resumable && typeof subagentConfig.resumable === "object" ? subagentConfig.resumable.receives_messages : "side_a";
|
|
@@ -68323,7 +68370,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
|
|
|
68323
68370
|
});
|
|
68324
68371
|
|
|
68325
68372
|
// src/version.ts
|
|
68326
|
-
var BUILDER_VERSION = "0.
|
|
68373
|
+
var BUILDER_VERSION = "0.39.0".length > 0 ? "0.39.0" : "dev";
|
|
68327
68374
|
|
|
68328
68375
|
// src/api/diagnostics.get.ts
|
|
68329
68376
|
init_LLMRequest();
|