@standardagents/builder 0.35.5 → 0.36.3

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.
Files changed (39) hide show
  1. package/dist/built-in-routes.js +3243 -2114
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-1dDvAxVS.js → ApiKeysView-CxelZw61.js} +1 -1
  4. package/dist/client/{CenteredContentView-DpneLOEW.js → CenteredContentView-CeQNRQH8.js} +1 -1
  5. package/dist/client/CompositionView-YO0nHsYV.js +32 -0
  6. package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-DiI1fhCg.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-_Y_F2vcO.js} +1 -1
  7. package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-C_mtx_IO.js → CopyButton.vue_vue_type_script_setup_true_lang-CtC06f6H.js} +1 -1
  8. package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-xHY6L65e.js → DataTable.vue_vue_type_script_setup_true_lang-CqaWkS63.js} +1 -1
  9. package/dist/client/{JsonViewer-DZk1hmoU.js → JsonViewer-71rdOpyq.js} +1 -1
  10. package/dist/client/{LoginView-Jpd6CNht.js → LoginView-CkDpPh8U.js} +1 -1
  11. package/dist/client/{MarketplaceView-CxyxQ3eT.js → MarketplaceView-UYrMBLon.js} +1 -1
  12. package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-Be5qsOZI.js → Modal.vue_vue_type_script_setup_true_lang-B1HPGo8o.js} +1 -1
  13. package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-eYizTKcZ.js → ModelModal.vue_vue_type_script_setup_true_lang-DejoTM9W.js} +1 -1
  14. package/dist/client/{ModelsView-BU1zF5Zw.js → ModelsView-DKYzp2fJ.js} +1 -1
  15. package/dist/client/{PromptEditView-BhvxR_WM.js → PromptEditView-BlYHZ0ao.js} +1 -1
  16. package/dist/client/{PromptModal-D6H1VYyD.js → PromptModal-B1neRzSc.js} +1 -1
  17. package/dist/client/{PromptsView-DgdRXffo.js → PromptsView-C0Ez74j0.js} +1 -1
  18. package/dist/client/{ProvidersView-QcOzG7y7.js → ProvidersView-CFc4K0IC.js} +1 -1
  19. package/dist/client/{ThreadInspectorPane.vue_vue_type_script_setup_true_lang-roXBQlRw.js → ThreadInspectorPane.vue_vue_type_script_setup_true_lang-CXbSQo2-.js} +1 -1
  20. package/dist/client/{ThreadsView-DmsDuS1X.js → ThreadsView-B1hFXL-4.js} +1 -1
  21. package/dist/client/{ToolsView-Bcr6QafS.js → ToolsView-B3KqeOZD.js} +1 -1
  22. package/dist/client/{UsersView-Du7GQtro.js → UsersView-CF1tomjI.js} +1 -1
  23. package/dist/client/{VariablesView-DIdSMYXb.js → VariablesView-CP0TDspK.js} +1 -1
  24. package/dist/client/{index-7UIZEBvt.js → index-BTs3PMFs.js} +2 -2
  25. package/dist/client/index.html +1 -1
  26. package/dist/{index-BIVhZqwM.d.ts → index-DUIfQjBW.d.ts} +1 -0
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +162 -11
  29. package/dist/index.js.map +1 -1
  30. package/dist/plugin.d.ts +1 -1
  31. package/dist/plugin.js +7 -0
  32. package/dist/plugin.js.map +1 -1
  33. package/dist/runtime.d.ts +2 -2
  34. package/dist/runtime.js +155 -11
  35. package/dist/runtime.js.map +1 -1
  36. package/dist/test.d.ts +1 -1
  37. package/package.json +25 -25
  38. package/LICENSE.txt +0 -48
  39. package/dist/client/CompositionView-DvzI90K5.js +0 -32
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { e as ThreadEnv, A as Agent, r as ThreadMetadata, t as ToolResult, M as Message, k as ClientToolRequest, l as ClientToolResponse, m as ClientStreamRequest, n as ClientStreamResponse, w as FileRecord, F as FlowState, y as FileStats, G as GrepResult, x as AttachmentRef, J as MessageContent, E as Env, q as ThreadInstance } from './index-BIVhZqwM.js';
2
- export { f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, B as Controller, a as ControllerContext, u as FlowResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, T as ToolCall, g as callClient, h as callClientStream, c as createThreadEndpointHandler, j as decodeStreamChunk, d as defineController, i as encodeStreamChunk, s as supportsClientForwarding } from './index-BIVhZqwM.js';
1
+ import { e as ThreadEnv, A as Agent, r as ThreadMetadata, t as ToolResult, M as Message, k as ClientToolRequest, l as ClientToolResponse, m as ClientStreamRequest, n as ClientStreamResponse, w as FileRecord, F as FlowState, y as FileStats, G as GrepResult, x as AttachmentRef, J as MessageContent, E as Env, q as ThreadInstance } from './index-DUIfQjBW.js';
2
+ export { f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, B as Controller, a as ControllerContext, u as FlowResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, T as ToolCall, g as callClient, h as callClientStream, c as createThreadEndpointHandler, j as decodeStreamChunk, d as defineController, i as encodeStreamChunk, s as supportsClientForwarding } from './index-DUIfQjBW.js';
3
3
  import { CodeExecutionOptions, CodeExecutionResult, SubagentRegistryEntry, InjectMessageInput, QueueMessageInput, CredentialGrant, SkillMetadata, SkillFileInput, ModelDefinition as ModelDefinition$1, ToolArgs, PromptTextPart, PromptEnvPart, VariableDefinition, SubpromptConfig as SubpromptConfig$1, PromptToolConfig as PromptToolConfig$1, SubagentToolConfig as SubagentToolConfig$1, ReasoningConfig, SideConfig as SideConfig$1, LLMProviderInterface, ContentPart, TextPart, ImagePart, FilePart, ThreadState, NamespaceContext, DefinitionLoader } from '@standardagents/spec';
4
4
  export { AgentType, DefinitionLoader, GlobalNamespaceContext, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, PromptInput, PromptTextPart, ProviderAssistantMessage, ProviderError, ProviderErrorCode, ProviderFactory, ProviderFactoryConfig, ProviderFinishReason, ProviderGeneratedImage, ProviderMessage, ProviderMessageContent, ModelCapabilities as ProviderModelCapabilities, ProviderReasoningDetail, ProviderRequest, ProviderResponse, ProviderStreamChunk, ProviderSystemMessage, ProviderTool, ProviderToolCallPart, ProviderToolMessage, ProviderToolResultContent, ProviderUsage, ProviderUserMessage, ReasoningConfig, StructuredPrompt, TextContent, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHook, defineModel, definePrompt, defineTool, isPacked, isVisibleInNamespace, mapReasoningLevel } from '@standardagents/spec';
5
5
  import { DurableObject, WorkerEntrypoint } from 'cloudflare:workers';
package/dist/runtime.js CHANGED
@@ -931,12 +931,23 @@ function resolvePlatformRouting(providerName, env) {
931
931
  baseUrl: `${origin}/v1/proxy/${encodeURIComponent(provider)}${basePath}`
932
932
  };
933
933
  }
934
+ function platformProviderFactoryConfig(providerName, routing) {
935
+ const config = {
936
+ apiKey: routing.apiKey,
937
+ baseUrl: routing.baseUrl
938
+ };
939
+ if (providerName.toLowerCase() === "deepinfra") {
940
+ config.modelsUrl = `${routing.origin}/v1/proxy/deepinfra/models`;
941
+ }
942
+ return config;
943
+ }
934
944
  var DEFAULT_PLATFORM_PROXY_ORIGIN, PROVIDER_BASE_PATHS;
935
945
  var init_platform_routing = __esm({
936
946
  "src/agents/providers/platform-routing.ts"() {
937
947
  DEFAULT_PLATFORM_PROXY_ORIGIN = "https://api.standardagents.ai";
938
948
  PROVIDER_BASE_PATHS = {
939
- cloudflare: "/ai/v1"
949
+ cloudflare: "/ai/v1",
950
+ deepinfra: "/openai"
940
951
  };
941
952
  }
942
953
  });
@@ -1229,10 +1240,7 @@ var init_ProviderRegistry = __esm({
1229
1240
  }
1230
1241
  const routing = resolvePlatformRouting(providerName, env);
1231
1242
  if (routing) {
1232
- const config = {
1233
- apiKey: routing.apiKey,
1234
- baseUrl: routing.baseUrl
1235
- };
1243
+ const config = platformProviderFactoryConfig(providerName, routing);
1236
1244
  registerPlatformProxyOrigin(routing.origin);
1237
1245
  const fingerprint = this.getProviderFingerprint(`platform:${providerName}`, modelDef, config);
1238
1246
  const cached = this.providerCache.get(modelName);
@@ -1268,6 +1276,7 @@ var init_ProviderRegistry = __esm({
1268
1276
  google: "GOOGLE_API_KEY",
1269
1277
  groq: "GROQ_API_KEY",
1270
1278
  novita: "NOVITA_API_KEY",
1279
+ deepinfra: "DEEPINFRA_API_KEY",
1271
1280
  openai: "OPENAI_API_KEY",
1272
1281
  openrouter: "OPENROUTER_API_KEY",
1273
1282
  anthropic: "ANTHROPIC_API_KEY",
@@ -1705,7 +1714,9 @@ function buildRequestBody(context, modelDef) {
1705
1714
  messages: requestMessages,
1706
1715
  tools,
1707
1716
  toolChoice,
1708
- parallelToolCalls: supportsToolCalls ? context.parallel_tool_calls : void 0,
1717
+ // null (prompt didn't set it) normalizes to undefined so providers omit
1718
+ // the wire param entirely and their default applies (2026-08-04).
1719
+ parallelToolCalls: supportsToolCalls ? context.parallel_tool_calls ?? void 0 : void 0,
1709
1720
  reasoning: context.reasoning ? {
1710
1721
  level: reasoningEffortToLevel(context.reasoning.effort),
1711
1722
  maxTokens: context.reasoning.max_tokens,
@@ -1961,7 +1972,8 @@ var init_LLMRequest = __esm({
1961
1972
  }
1962
1973
  console.error(`Error calling ${actualModelId} (attempt ${attempts}):`, error2);
1963
1974
  await this.logError(state, error2, "api_error", actualModelId, startTime, logId);
1964
- if (attempts < MAX_RETRIES_PER_MODEL) {
1975
+ const isStallTimeout = error2?.code === "timeout";
1976
+ if (attempts < MAX_RETRIES_PER_MODEL && !isStallTimeout) {
1965
1977
  const base = BACKOFF_BASE * Math.pow(2, attempts - 1);
1966
1978
  const retryAfterMs = typeof error2?.retryAfter === "number" ? error2.retryAfter * 1e3 : 0;
1967
1979
  const backoffMs = Math.max(base, retryAfterMs);
@@ -3869,7 +3881,7 @@ __export(ToolExecutor_exports, {
3869
3881
  function getPackageId(state) {
3870
3882
  return state.namespaceContext.type === "packed" ? state.namespaceContext.packageId : void 0;
3871
3883
  }
3872
- var SUBAGENT_CREATE_TOOL, SUBAGENT_MESSAGE_TOOL, LEGACY_SEND_TO_AGENT_TOOL, INTERNAL_SCOPED_ENV_ARGUMENT, INTERNAL_SCOPED_ENV_CONTEXT_KEY, ToolExecutor;
3884
+ var SUBAGENT_CREATE_TOOL, SUBAGENT_MESSAGE_TOOL, SUBAGENTS_LIST_TOOL, LEGACY_SEND_TO_AGENT_TOOL, INTERNAL_SCOPED_ENV_ARGUMENT, INTERNAL_SCOPED_ENV_CONTEXT_KEY, ToolExecutor;
3873
3885
  var init_ToolExecutor = __esm({
3874
3886
  "src/agents/ToolExecutor.ts"() {
3875
3887
  init_types();
@@ -3877,6 +3889,7 @@ var init_ToolExecutor = __esm({
3877
3889
  init_sessionTools();
3878
3890
  SUBAGENT_CREATE_TOOL = "subagent_create";
3879
3891
  SUBAGENT_MESSAGE_TOOL = "subagent_message";
3892
+ SUBAGENTS_LIST_TOOL = "subagents";
3880
3893
  LEGACY_SEND_TO_AGENT_TOOL = "send_to_agent";
3881
3894
  INTERNAL_SCOPED_ENV_ARGUMENT = "__scoped_env";
3882
3895
  INTERNAL_SCOPED_ENV_CONTEXT_KEY = "__immediate_scoped_env_by_call_id";
@@ -4035,6 +4048,33 @@ var init_ToolExecutor = __esm({
4035
4048
  * Execute a single tool call
4036
4049
  */
4037
4050
  static async executeToolCall(call, state, toolMessageId) {
4051
+ try {
4052
+ const n = call.function?.name;
4053
+ if (n && n.includes("_") && n !== "mcp") {
4054
+ const cat2 = await state.thread.instance.getValue("mcp_catalog");
4055
+ for (const srv of cat2?.servers ?? []) {
4056
+ const sname = srv.name ?? srv.serverInfo?.name;
4057
+ if (!sname || !n.startsWith(`${sname}_`)) continue;
4058
+ const mtool = n.slice(sname.length + 1);
4059
+ if (!Array.isArray(srv.tools) || !srv.tools.some((t) => t.name === mtool)) continue;
4060
+ call = {
4061
+ ...call,
4062
+ function: {
4063
+ ...call.function,
4064
+ name: "mcp",
4065
+ arguments: JSON.stringify({
4066
+ action: "call",
4067
+ server: sname,
4068
+ tool: mtool,
4069
+ arguments_json: call.function.arguments || "{}"
4070
+ })
4071
+ }
4072
+ };
4073
+ break;
4074
+ }
4075
+ }
4076
+ } catch {
4077
+ }
4038
4078
  const toolType = await this.identifyToolType(call, state);
4039
4079
  switch (toolType) {
4040
4080
  case "native":
@@ -4084,7 +4124,7 @@ var init_ToolExecutor = __esm({
4084
4124
  */
4085
4125
  static async identifyToolType(call, state) {
4086
4126
  const toolName = call.function.name;
4087
- if (toolName === SUBAGENT_CREATE_TOOL || toolName === SUBAGENT_MESSAGE_TOOL || toolName === LEGACY_SEND_TO_AGENT_TOOL) {
4127
+ if (toolName === SUBAGENT_CREATE_TOOL || toolName === SUBAGENT_MESSAGE_TOOL || toolName === SUBAGENTS_LIST_TOOL || toolName === LEGACY_SEND_TO_AGENT_TOOL) {
4088
4128
  return "agent";
4089
4129
  }
4090
4130
  if (state.allowedTools) {
@@ -4617,6 +4657,22 @@ ${errorLines.join("\n")}`);
4617
4657
  if (builtinSubagentAction === "message") {
4618
4658
  return await this.executeSubagentMessageTool(call, state);
4619
4659
  }
4660
+ if (call.function.name === SUBAGENTS_LIST_TOOL) {
4661
+ const { FlowEngine: FlowEngine2 } = await Promise.resolve().then(() => (init_FlowEngine(), FlowEngine_exports));
4662
+ const registry = await FlowEngine2.listModelVisibleSubagents(state);
4663
+ if (registry.length === 0) {
4664
+ return { status: "success", result: "No active subagent instances." };
4665
+ }
4666
+ const lines = registry.map(
4667
+ (entry) => `- ${entry.reference}: ${entry.name} \u2014 ${entry.status ?? "unknown"}${entry.description ? ` (${entry.description})` : ""}`
4668
+ );
4669
+ return {
4670
+ status: "success",
4671
+ result: `Active subagent instances:
4672
+ ${lines.join("\n")}
4673
+ Message one with subagent_message(referenceId, message).`
4674
+ };
4675
+ }
4620
4676
  const createArgs = builtinSubagentAction === "create" ? this.parseSubagentCreateArgs(call.function.arguments) : null;
4621
4677
  if (createArgs?.error) {
4622
4678
  return { status: "error", error: createArgs.error };
@@ -6939,7 +6995,10 @@ This usually points to something I can't fix from here \u2014 for example the wo
6939
6995
  model: def.model,
6940
6996
  include_chat: def.includeChat ?? false,
6941
6997
  include_past_tools: def.includePastTools ?? false,
6942
- parallel_tool_calls: def.parallelToolCalls ?? false,
6998
+ // Unset stays unset (2026-08-04): defaulting to `false` forbade the
6999
+ // parallel batching agentic-tuned models are trained on; absent lets
7000
+ // the provider default apply, while an explicit prompt value is honored.
7001
+ parallel_tool_calls: def.parallelToolCalls ?? null,
6943
7002
  tool_choice: def.toolChoice ?? "auto",
6944
7003
  reasoning_effort: def.reasoning?.effort ?? null,
6945
7004
  reasoning_max_tokens: def.reasoning?.maxTokens ?? null,
@@ -8221,6 +8280,13 @@ This usually points to something I can't fix from here \u2014 for example the wo
8221
8280
  if (hidden.size === 0) return registry;
8222
8281
  return registry.filter((entry) => !hidden.has(entry.name));
8223
8282
  }
8283
+ /** Public snapshot for the `subagents` built-in tool (ToolExecutor). */
8284
+ static async listModelVisibleSubagents(state) {
8285
+ return _FlowEngine.filterModelVisibleSubagents(
8286
+ await this.getSubagentRegistry(state),
8287
+ state.prompt?._tools
8288
+ );
8289
+ }
8224
8290
  static async getSubagentRegistry(state) {
8225
8291
  if (typeof state.thread.instance.getChildrenRegistry === "function") {
8226
8292
  try {
@@ -8490,7 +8556,8 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
8490
8556
  await this.getSubagentRegistry(state),
8491
8557
  state.prompt?._tools
8492
8558
  );
8493
- if (subagentRegistry.length > 0) {
8559
+ const suppressRegistryMessage = Array.isArray(state.prompt?.hooks) ? state.prompt.hooks.includes("append_static_session_env") : false;
8560
+ if (subagentRegistry.length > 0 && !suppressRegistryMessage) {
8494
8561
  const fallbackNameMap = await this.resolveRegistryThreadNameMap(state, subagentRegistry);
8495
8562
  const lines = subagentRegistry.map((entry) => {
8496
8563
  const threadName = this.getRegistryThreadName(entry) ?? fallbackNameMap.get(entry.reference) ?? null;
@@ -8849,6 +8916,16 @@ ${lines.join("\n\n")}`
8849
8916
  }
8850
8917
  if (resumablePromptSubagents.length > 0 && !tools.some((tool) => tool.function.name === "subagent_create")) {
8851
8918
  tools.push(this.buildSubagentCreateTool(resumablePromptSubagents));
8919
+ if (!tools.some((tool) => tool.function.name === "subagents")) {
8920
+ tools.push({
8921
+ type: "function",
8922
+ function: {
8923
+ name: "subagents",
8924
+ description: "List your active subagent instances: reference id, name, status, and working-status text. Use when you need to check on children you created; completions also arrive as messages.",
8925
+ parameters: { type: "object", properties: {} }
8926
+ }
8927
+ });
8928
+ }
8852
8929
  }
8853
8930
  const hasActiveResumable = childrenRegistry.some(
8854
8931
  (entry) => entry.status !== "terminated"
@@ -8883,6 +8960,73 @@ ${lines.join("\n\n")}`
8883
8960
  }
8884
8961
  });
8885
8962
  }
8963
+ try {
8964
+ const cat2 = await state.thread.instance.getValue("mcp_catalog");
8965
+ const servers = cat2?.servers ?? [];
8966
+ const have = new Set(tools.map((t) => t.function?.name));
8967
+ const sanitizeProperty = (p) => {
8968
+ const prop = p ?? {};
8969
+ const t = prop.type;
8970
+ if (t === "string" || t === "number" || t === "integer" || t === "boolean") {
8971
+ const out = { type: t };
8972
+ if (typeof prop.description === "string") out.description = prop.description;
8973
+ if (Array.isArray(prop.enum)) out.enum = prop.enum;
8974
+ return out;
8975
+ }
8976
+ if (t === "array") {
8977
+ return {
8978
+ type: "array",
8979
+ items: sanitizeProperty(prop.items),
8980
+ ...typeof prop.description === "string" ? { description: prop.description } : {}
8981
+ };
8982
+ }
8983
+ if (t === "object") {
8984
+ const props = prop.properties ?? {};
8985
+ const out = {};
8986
+ for (const [k, v] of Object.entries(props)) out[k] = sanitizeProperty(v);
8987
+ return {
8988
+ type: "object",
8989
+ properties: out,
8990
+ ...Array.isArray(prop.required) ? { required: prop.required.filter((r) => typeof r === "string" && r in out) } : {},
8991
+ ...typeof prop.description === "string" ? { description: prop.description } : {}
8992
+ };
8993
+ }
8994
+ return {
8995
+ type: "string",
8996
+ ...typeof prop.description === "string" ? { description: prop.description } : {}
8997
+ };
8998
+ };
8999
+ const sanitizeSchema = (schema) => {
9000
+ const s = schema ?? { type: "object", properties: {} };
9001
+ if (s.type !== void 0 && s.type !== "object") return null;
9002
+ const sanitized = sanitizeProperty({ ...s, type: "object" });
9003
+ return sanitized;
9004
+ };
9005
+ for (const srv of servers) {
9006
+ const sname = srv.name ?? srv.serverInfo?.name;
9007
+ if (!sname || srv.error || !Array.isArray(srv.tools)) continue;
9008
+ for (const mt of srv.tools) {
9009
+ const pname = `${sname}_${mt.name}`;
9010
+ if (have.has(pname)) continue;
9011
+ const parameters = sanitizeSchema(mt.inputSchema);
9012
+ if (!parameters) {
9013
+ console.log(`[FlowEngine] mcp projection: skipped ${pname} (non-object schema)`);
9014
+ continue;
9015
+ }
9016
+ tools.push({
9017
+ type: "function",
9018
+ function: {
9019
+ name: pname,
9020
+ description: mt.description || `${mt.name} via the ${sname} MCP server`,
9021
+ parameters
9022
+ }
9023
+ });
9024
+ have.add(pname);
9025
+ }
9026
+ }
9027
+ console.log(`[FlowEngine] mcp projection: ${tools.length} tools after catalog merge`);
9028
+ } catch {
9029
+ }
8886
9030
  console.log(`[FlowEngine] getToolsForPrompt result: ${tools.length} tools loaded for prompt ${promptData.name}`);
8887
9031
  return tools;
8888
9032
  } catch (error) {