@standardagents/builder 0.16.0 → 0.16.1-next.1e58032

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.
@@ -1 +1 @@
1
- import{r as x}from"./formkit.js";import{B as J,_,G as k,d as V,e as F}from"./index.js";import{_ as L}from"./DataTable.vue_vue_type_script_setup_true_lang.js";import{_ as j}from"./Modal.vue_vue_type_script_setup_true_lang.js";import{C as z}from"./CenteredContentView.js";import{u as G}from"./useActionFeedback.js";import{g as A,b as H}from"./settingsData.js";import{d as I,r as d,o as Q,O as D,z as P,e as $,k as t,q as W,j as s,J as i,s as v,u as X,f as C}from"./vue.js";import"./vendor.js";import"./monaco.js";import"./syntax.js";import"./chevron-right.js";import"./ConfirmDialog.vue_vue_type_script_setup_true_lang.js";const Y={class:"space-y-4"},Z={class:"flex justify-end gap-2"},ee={class:"space-y-4"},ae={class:"flex justify-end gap-2"},ye=I({__name:"UsersView",setup(se){const y=d(!1),b=d(!1),h=d([]),S=d(!1),U=d(null),c=d(!1),p=d(!1),u=d(null),m=d(null),{feedback:E,setFeedback:n,clearFeedback:w}=G(),f=d({username:"",role:"admin"}),M=[{value:"admin",label:"Admin"}],O=[{key:"username",label:"Username",width:"w-1/3"},{key:"role",label:"Role",width:"w-1/4"},{key:"created_at",label:"Created",width:"w-1/3",formatter:a=>new Date(a*1e3).toLocaleString()}],T=[{icon:"edit",label:"Edit",handler:async a=>{U.value=a,f.value={username:a.username,role:a.role},b.value=!0}},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this user? This action cannot be undone.",handler:async a=>{await R(a.id)}}],g=async()=>{S.value=!0,w();try{const a=await k("/users");if(!a.ok)throw new Error("Failed to fetch users");const e=await a.json();h.value=e.users||[]}catch{n("error","Users could not be loaded."),h.value=[]}finally{S.value=!1}},B=async a=>{c.value=!0,w(),V(u);try{const e=await k("/users",{method:"POST",body:JSON.stringify(a)});if(!e.ok){const l=await e.json();F(l,u)||n("error",A(l,"Failed to add user"));return}await g(),q(),n("success","User added.")}catch{F({error:"Failed to add user"},u)}finally{c.value=!1}},K=async a=>{if(U.value){p.value=!0,w(),V(m);try{const e=H(a),l=await k(`/users/${U.value.id}`,{method:"PUT",body:JSON.stringify(e)});if(!l.ok){const o=await l.json();F(o,m)||n("error",A(o,"Failed to update user"));return}await g(),N(),n("success","User updated.")}catch{F({error:"Failed to update user"},m)}finally{p.value=!1}}},R=async a=>{w();try{const e=await k(`/users/${a}`,{method:"DELETE"});if(!e.ok){const l=await e.json();n("error",A(l,"Failed to delete user"));return}await g(),n("success","User deleted.")}catch{n("error","Failed to delete user")}},q=()=>{V(u),x("add-user-form"),y.value=!1},N=()=>{V(m),x("edit-user-form"),b.value=!1,U.value=null};return Q(()=>{g()}),(a,e)=>{const l=D("FormKitMessages"),o=D("FormKit");return $(),P(z,null,{default:t(()=>[i(E)?($(),P(i(J),{key:0,variant:i(E).variant,class:"mb-4"},{default:t(()=>[v(X(i(E).message),1)]),_:1},8,["variant"])):W("",!0),s(L,{title:"Users",description:"Manage user accounts and permissions","primary-action":{label:"Add User",handler:()=>y.value=!0},columns:O,data:h.value,actions:T,loading:S.value,"empty-message":"No users found"},null,8,["primary-action","data","loading"]),s(j,{modelValue:y.value,"onUpdate:modelValue":e[1]||(e[1]=r=>y.value=r),title:"Add User",onClose:q},{footer:t(()=>[C("div",Z,[s(i(_),{variant:"secondary",disabled:c.value,onClick:q},{default:t(()=>[...e[6]||(e[6]=[v(" Cancel ",-1)])]),_:1},8,["disabled"]),s(i(_),{type:"submit",form:"add-user-form",loading:c.value},{default:t(()=>[...e[7]||(e[7]=[v(" Add User ",-1)])]),_:1},8,["loading"])])]),default:t(()=>[s(o,{id:"add-user-form",type:"form",actions:!1,disabled:c.value,onSubmit:B,onNode:e[0]||(e[0]=r=>u.value=r)},{default:t(()=>[C("div",Y,[s(l,{node:u.value||void 0},null,8,["node"]),s(o,{type:"text",name:"username",label:"Username",validation:"required","validation-messages":{required:"Username is required"}}),s(o,{type:"password",name:"password",label:"Password",validation:"required","validation-messages":{required:"Password is required"}}),s(o,{type:"selectSearch",name:"role",label:"Role",options:M,value:"admin",placeholder:"Select role"})])]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),s(j,{modelValue:b.value,"onUpdate:modelValue":e[5]||(e[5]=r=>b.value=r),title:"Edit User",onClose:N},{footer:t(()=>[C("div",ae,[s(i(_),{variant:"secondary",disabled:p.value,onClick:N},{default:t(()=>[...e[8]||(e[8]=[v(" Cancel ",-1)])]),_:1},8,["disabled"]),s(i(_),{type:"submit",form:"edit-user-form",loading:p.value},{default:t(()=>[...e[9]||(e[9]=[v(" Update User ",-1)])]),_:1},8,["loading"])])]),default:t(()=>[s(o,{id:"edit-user-form",type:"form",actions:!1,disabled:p.value,onSubmit:K,onNode:e[4]||(e[4]=r=>m.value=r)},{default:t(()=>[C("div",ee,[s(l,{node:m.value||void 0},null,8,["node"]),s(o,{type:"text",name:"username",label:"Username",validation:"required",modelValue:f.value.username,"onUpdate:modelValue":e[2]||(e[2]=r=>f.value.username=r),"validation-messages":{required:"Username is required"}},null,8,["modelValue"]),s(o,{type:"password",name:"password",label:"Password",help:"Leave blank to keep current password"}),s(o,{type:"selectSearch",name:"role",label:"Role",options:M,modelValue:f.value.role,"onUpdate:modelValue":e[3]||(e[3]=r=>f.value.role=r),placeholder:"Select role"},null,8,["modelValue"])])]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1})}}});export{ye as default};
1
+ import{r as P}from"./formkit.js";import{B as Y,_ as h,G as y,d as x,e as V}from"./index.js";import{_ as H}from"./DataTable.vue_vue_type_script_setup_true_lang.js";import{_ as $}from"./Modal.vue_vue_type_script_setup_true_lang.js";import{C as Q}from"./CenteredContentView.js";import{u as W}from"./useActionFeedback.js";import{g as M,b as X}from"./settingsData.js";import{d as Z,r as l,o as ee,O as B,z as O,e as C,k as r,q as j,j as s,J as i,s as b,u as T,f as m,b as K}from"./vue.js";import"./vendor.js";import"./monaco.js";import"./syntax.js";import"./chevron-right.js";import"./ConfirmDialog.vue_vue_type_script_setup_true_lang.js";const ae={class:"inline-flex items-center gap-2"},se={key:0,class:"rounded-full bg-accent-100 px-2 py-0.5 text-xs font-medium text-accent-800 dark:bg-accent-900 dark:text-accent-200"},te={key:1,class:"rounded-full bg-neutral-100 px-2 py-0.5 text-xs font-medium text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300",title:"Signs in through the Standard Agents platform connection"},re={class:"space-y-4"},oe={class:"flex justify-end gap-2"},le={class:"space-y-4"},ne={class:"flex justify-end gap-2"},ke=Z({__name:"UsersView",setup(de){const g=l(!1),U=l(!1),F=l([]),S=l(null),E=l(!1),w=l(null),p=l(!1),f=l(!1),u=l(null),c=l(null),{feedback:A,setFeedback:d,clearFeedback:_}=W(),v=l({username:"",role:"admin"}),D=[{value:"admin",label:"Admin"}],R=[{key:"username",label:"Username",width:"w-1/3"},{key:"role",label:"Role",width:"w-1/4"},{key:"created_at",label:"Created",width:"w-1/3",formatter:a=>new Date(a*1e3).toLocaleString()}],J=[{icon:"edit",label:"Edit",handler:async a=>{w.value=a,v.value={username:a.username,role:a.role},U.value=!0}},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this user? This action cannot be undone.",handler:async a=>{await I(a.id)}}],k=async()=>{E.value=!0,_();try{const a=await y("/users");if(!a.ok)throw new Error("Failed to fetch users");const e=await a.json();F.value=e.users||[]}catch{d("error","Users could not be loaded."),F.value=[]}finally{E.value=!1}},L=async()=>{try{const a=await y("/auth/me");if(!a.ok)return;const e=await a.json();S.value=e.user?.id??null}catch{S.value=null}},z=async a=>{p.value=!0,_(),x(u);try{const e=await y("/users",{method:"POST",body:JSON.stringify(a)});if(!e.ok){const n=await e.json();V(n,u)||d("error",M(n,"Failed to add user"));return}await k(),q(),d("success","User added.")}catch{V({error:"Failed to add user"},u)}finally{p.value=!1}},G=async a=>{if(w.value){f.value=!0,_(),x(c);try{const e=X(a),n=await y(`/users/${w.value.id}`,{method:"PUT",body:JSON.stringify(e)});if(!n.ok){const o=await n.json();V(o,c)||d("error",M(o,"Failed to update user"));return}await k(),N(),d("success","User updated.")}catch{V({error:"Failed to update user"},c)}finally{f.value=!1}}},I=async a=>{_();try{const e=await y(`/users/${a}`,{method:"DELETE"});if(!e.ok){const n=await e.json();d("error",M(n,"Failed to delete user"));return}await k(),d("success","User deleted.")}catch{d("error","Failed to delete user")}},q=()=>{x(u),P("add-user-form"),g.value=!1},N=()=>{x(c),P("edit-user-form"),U.value=!1,w.value=null};return ee(()=>{k(),L()}),(a,e)=>{const n=B("FormKitMessages"),o=B("FormKit");return C(),O(Q,null,{default:r(()=>[i(A)?(C(),O(i(Y),{key:0,variant:i(A).variant,class:"mb-4"},{default:r(()=>[b(T(i(A).message),1)]),_:1},8,["variant"])):j("",!0),s(H,{title:"Users",description:"Manage user accounts and permissions","primary-action":{label:"Add User",handler:()=>g.value=!0},columns:R,data:F.value,actions:J,loading:E.value,"empty-message":"No users found"},{"cell-username":r(({row:t})=>[m("span",ae,[m("span",null,T(t.username),1),t.id===S.value?(C(),K("span",se," You ")):j("",!0),t.source==="standard_agents"?(C(),K("span",te," Standard Agents login ")):j("",!0)])]),_:1},8,["primary-action","data","loading"]),s($,{modelValue:g.value,"onUpdate:modelValue":e[1]||(e[1]=t=>g.value=t),title:"Add User",onClose:q},{footer:r(()=>[m("div",oe,[s(i(h),{variant:"secondary",disabled:p.value,onClick:q},{default:r(()=>[...e[6]||(e[6]=[b(" Cancel ",-1)])]),_:1},8,["disabled"]),s(i(h),{type:"submit",form:"add-user-form",loading:p.value},{default:r(()=>[...e[7]||(e[7]=[b(" Add User ",-1)])]),_:1},8,["loading"])])]),default:r(()=>[s(o,{id:"add-user-form",type:"form",actions:!1,disabled:p.value,onSubmit:z,onNode:e[0]||(e[0]=t=>u.value=t)},{default:r(()=>[m("div",re,[s(n,{node:u.value||void 0},null,8,["node"]),s(o,{type:"text",name:"username",label:"Username",validation:"required","validation-messages":{required:"Username is required"}}),s(o,{type:"password",name:"password",label:"Password",validation:"required","validation-messages":{required:"Password is required"}}),s(o,{type:"selectSearch",name:"role",label:"Role",options:D,value:"admin",placeholder:"Select role"})])]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),s($,{modelValue:U.value,"onUpdate:modelValue":e[5]||(e[5]=t=>U.value=t),title:"Edit User",onClose:N},{footer:r(()=>[m("div",ne,[s(i(h),{variant:"secondary",disabled:f.value,onClick:N},{default:r(()=>[...e[8]||(e[8]=[b(" Cancel ",-1)])]),_:1},8,["disabled"]),s(i(h),{type:"submit",form:"edit-user-form",loading:f.value},{default:r(()=>[...e[9]||(e[9]=[b(" Update User ",-1)])]),_:1},8,["loading"])])]),default:r(()=>[s(o,{id:"edit-user-form",type:"form",actions:!1,disabled:f.value,onSubmit:G,onNode:e[4]||(e[4]=t=>c.value=t)},{default:r(()=>[m("div",le,[s(n,{node:c.value||void 0},null,8,["node"]),s(o,{type:"text",name:"username",label:"Username",validation:"required",modelValue:v.value.username,"onUpdate:modelValue":e[2]||(e[2]=t=>v.value.username=t),"validation-messages":{required:"Username is required"}},null,8,["modelValue"]),s(o,{type:"password",name:"password",label:"Password",help:"Leave blank to keep current password"}),s(o,{type:"selectSearch",name:"role",label:"Role",options:D,modelValue:v.value.role,"onUpdate:modelValue":e[3]||(e[3]=t=>v.value.role=t),placeholder:"Select role"},null,8,["modelValue"])])]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1})}}});export{ke as default};
@@ -648,6 +648,8 @@ interface LLMResponse {
648
648
  };
649
649
  /** @internal Provider instance reference for async metadata fetching */
650
650
  _provider?: unknown;
651
+ /** @internal True when the request routed through the Standard Agents platform passthrough */
652
+ _viaPlatform?: boolean;
651
653
  /** @internal Provider response ID for async metadata fetching */
652
654
  _providerResponseId?: string;
653
655
  /** @internal Aggregate response for logging */
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ModelDefinition, AgentDefinition } from './runtime.js';
2
2
  export { AgentBuilderEnv, AuthContext, AuthUser, BroadcastOptions, CodeExecutionBridge, DurableAgentBuilder, DurableThread, FlowStateSdk, FlowStateWithSdk, ImageContextConfig, InjectMessageOptions, LLMProviderInterface, NamespaceResolutionError, PromptContent, PromptDefinition, PromptIncludePart, PromptPart, PromptToolConfig, Provider, ProviderContentPart, ProviderFilePart, ProviderImagePart, ProviderRegistry, ProviderTextPart, SessionToolBinding, SessionToolConfig, SideConfig, SubagentToolConfig, SubpromptConfig, ThreadRegistryEntry, ToolConfig, UpdateThreadParams, User, authenticate, buildImageDescription, cat, createNamespaceContext, emitThreadEvent, enhanceFlowState, exists, find, forceTurn, generateImageDescription, getFileStats, getMessages, getMessagesToSummarize, getShortName, getThumbnail, getUnsummarizedImageAttachments, getVisibleAgentNames, getVisibleModelNames, getVisiblePromptNames, getVisibleToolNames, grep, hasImageAttachments, head, injectMessage, isQualifiedName, linkFile, mkdir, optimizeImageContext, parseQualifiedName, qualifyName, queueTool, readFile, readdir, reloadHistory, replaceImagesWithDescriptions, requireAdmin, requireAuth, resolveAgent, resolveHook, resolveModel, resolvePrompt, resolveTool, rmdir, stat, tail, unlink, updateThread, writeFile, writeImage } from './runtime.js';
3
3
  export { AgentPluginOptions, agentbuilder, builder } from './plugin.js';
4
- export { A as Agent, m as AttachmentRef, f as BuilderThreadEndpointHandler, B as Controller, a as ControllerContext, E as Env, l as FileRecord, n as FileStats, j as FlowResult, F as FlowState, G as GrepResult, p as ImageContentPart, I as ImageMetadata, L as LLMResponse, M as Message, r as MessageContent, q as MultimodalContent, R as RequestContext, S as StorageBackend, k as TelemetryEvent, o as TextContentPart, b as ThreadEndpointContext, e as ThreadEnv, g as ThreadInstance, h as ThreadMetadata, T as ToolCall, i as ToolResult, c as createThreadEndpointHandler, d as defineController } from './index-EaxysUHv.js';
4
+ export { A as Agent, m as AttachmentRef, f as BuilderThreadEndpointHandler, B as Controller, a as ControllerContext, E as Env, l as FileRecord, n as FileStats, j as FlowResult, F as FlowState, G as GrepResult, p as ImageContentPart, I as ImageMetadata, L as LLMResponse, M as Message, r as MessageContent, q as MultimodalContent, R as RequestContext, S as StorageBackend, k as TelemetryEvent, o as TextContentPart, b as ThreadEndpointContext, e as ThreadEnv, g as ThreadInstance, h as ThreadMetadata, T as ToolCall, i as ToolResult, c as createThreadEndpointHandler, d as defineController } from './index-BnrKzXpJ.js';
5
5
  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';
6
6
  export { C as ConstituentItem, D as DiscoveredPackage, N as NamespacedRegistry, P as PackingAnalysis, a as PackingOptions, b as PackingResult, c as UnpackOptions, d as UnpackResult } from './types-Bpe7IANZ.js';
7
7
  export { D as DiscoveryConfig, P as PackageDiscoveryService, d as discoverPackages } from './discovery-DiMJWisl.js';
package/dist/index.js CHANGED
@@ -866,11 +866,38 @@ var init_TestProvider = __esm({
866
866
  }
867
867
  });
868
868
 
869
+ // src/agents/providers/platform-routing.ts
870
+ function stringEnv(value) {
871
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
872
+ }
873
+ function resolvePlatformRouting(providerName, env) {
874
+ const apiKey = stringEnv(env.STANDARD_AGENTS_API_KEY) ?? stringEnv(env.PLATFORM_API_KEY);
875
+ if (!apiKey) return null;
876
+ const origin = (stringEnv(env.STANDARD_AGENTS_PROXY_URL) ?? stringEnv(env.PLATFORM_ENDPOINT) ?? stringEnv(env.STANDARD_AGENTS_API_URL) ?? DEFAULT_PLATFORM_PROXY_ORIGIN).replace(/\/+$/, "");
877
+ const provider = providerName.toLowerCase();
878
+ const basePath = PROVIDER_BASE_PATHS[provider] ?? "";
879
+ return {
880
+ apiKey,
881
+ origin,
882
+ baseUrl: `${origin}/v1/proxy/${encodeURIComponent(provider)}${basePath}`
883
+ };
884
+ }
885
+ var DEFAULT_PLATFORM_PROXY_ORIGIN, PROVIDER_BASE_PATHS;
886
+ var init_platform_routing = __esm({
887
+ "src/agents/providers/platform-routing.ts"() {
888
+ DEFAULT_PLATFORM_PROXY_ORIGIN = "https://proxy.standardagents.ai";
889
+ PROVIDER_BASE_PATHS = {
890
+ cloudflare: "/ai/v1"
891
+ };
892
+ }
893
+ });
894
+
869
895
  // src/agents/providers/ProviderRegistry.ts
870
896
  var ProviderRegistryImpl, ProviderRegistry;
871
897
  var init_ProviderRegistry = __esm({
872
898
  "src/agents/providers/ProviderRegistry.ts"() {
873
899
  init_TestProvider();
900
+ init_platform_routing();
874
901
  ProviderRegistryImpl = class {
875
902
  providerCache = /* @__PURE__ */ new Map();
876
903
  providerOverrideFn = null;
@@ -908,9 +935,9 @@ var init_ProviderRegistry = __esm({
908
935
  const fingerprint = this.getProviderFingerprint(providerName, modelDef);
909
936
  const cached = this.providerCache.get(modelName);
910
937
  if (cached?.fingerprint === fingerprint) {
911
- return this.buildResult(cached.provider, modelDef);
938
+ return this.buildResult(cached.provider, modelDef, false);
912
939
  }
913
- return this.cacheAndReturn(modelName, createTestProvider(), modelDef, fingerprint);
940
+ return this.cacheAndReturn(modelName, createTestProvider(), modelDef, fingerprint, false);
914
941
  }
915
942
  const apiKey = this.getApiKeyForProvider(providerName, env);
916
943
  if (apiKey) {
@@ -927,34 +954,47 @@ var init_ProviderRegistry = __esm({
927
954
  const fingerprint = this.getProviderFingerprint(providerName, modelDef, config);
928
955
  const cached = this.providerCache.get(modelName);
929
956
  if (cached?.fingerprint === fingerprint) {
930
- return this.buildResult(cached.provider, modelDef);
957
+ return this.buildResult(cached.provider, modelDef, false);
931
958
  }
932
- return this.cacheAndReturn(modelName, providerFactory(config), modelDef, fingerprint);
959
+ return this.cacheAndReturn(modelName, providerFactory(config), modelDef, fingerprint, false);
933
960
  }
934
961
  if (this.providerOverrideFn) {
935
962
  const overrideFingerprint = this.getProviderFingerprint(`override:${this.providerOverrideRevision}`, modelDef);
936
963
  const overrideCached = this.providerCache.get(modelName);
937
964
  if (overrideCached?.fingerprint === overrideFingerprint) {
938
- return this.buildResult(overrideCached.provider, modelDef);
965
+ return this.buildResult(overrideCached.provider, modelDef, true);
939
966
  }
940
967
  const overrideProvider = this.providerOverrideFn(modelName, modelDef, env);
941
968
  if (overrideProvider) {
942
- return this.cacheAndReturn(modelName, overrideProvider, modelDef, overrideFingerprint);
969
+ return this.cacheAndReturn(modelName, overrideProvider, modelDef, overrideFingerprint, true);
970
+ }
971
+ }
972
+ const routing = resolvePlatformRouting(providerName, env);
973
+ if (routing) {
974
+ const config = {
975
+ apiKey: routing.apiKey,
976
+ baseUrl: routing.baseUrl
977
+ };
978
+ const fingerprint = this.getProviderFingerprint(`platform:${providerName}`, modelDef, config);
979
+ const cached = this.providerCache.get(modelName);
980
+ if (cached?.fingerprint === fingerprint) {
981
+ return this.buildResult(cached.provider, modelDef, true);
943
982
  }
983
+ return this.cacheAndReturn(modelName, providerFactory(config), modelDef, fingerprint, true);
944
984
  }
945
985
  throw new Error(`No API key found for provider: ${providerName}. Set the provider key or STANDARD_AGENTS_API_KEY.`);
946
986
  }
947
- buildResult(provider, modelDef) {
948
- return { provider, modelName: modelDef.model, modelDef };
987
+ buildResult(provider, modelDef, viaPlatform) {
988
+ return { provider, modelName: modelDef.model, modelDef, viaPlatform };
949
989
  }
950
- cacheAndReturn(modelName, provider, modelDef, fingerprint) {
951
- this.providerCache.set(modelName, { provider, fingerprint });
952
- return this.buildResult(provider, modelDef);
990
+ cacheAndReturn(modelName, provider, modelDef, fingerprint, viaPlatform) {
991
+ this.providerCache.set(modelName, { provider, fingerprint, viaPlatform });
992
+ return this.buildResult(provider, modelDef, viaPlatform);
953
993
  }
954
994
  getProviderFingerprint(providerName, modelDef, config) {
955
995
  return JSON.stringify({
956
996
  providerName,
957
- baseUrl: modelDef.providerOptions?.baseUrl ?? null,
997
+ baseUrl: config?.baseUrl ?? modelDef.providerOptions?.baseUrl ?? null,
958
998
  apiKey: config?.apiKey ?? null,
959
999
  accountId: config?.accountId ?? null
960
1000
  });
@@ -1630,7 +1670,7 @@ var init_LLMRequest = __esm({
1630
1670
  */
1631
1671
  static async callModel(modelId, context, state, logId) {
1632
1672
  const { ProviderRegistry: ProviderRegistry2 } = await Promise.resolve().then(() => (init_providers(), providers_exports));
1633
- const { provider, modelName, modelDef } = await ProviderRegistry2.getProvider(
1673
+ const { provider, modelName, modelDef, viaPlatform } = await ProviderRegistry2.getProvider(
1634
1674
  modelId,
1635
1675
  state.env,
1636
1676
  state.thread.instance
@@ -1764,6 +1804,7 @@ var init_LLMRequest = __esm({
1764
1804
  }
1765
1805
  };
1766
1806
  response._provider = provider;
1807
+ response._viaPlatform = viaPlatform;
1767
1808
  response._providerResponseId = providerResponseId;
1768
1809
  response._aggregate_response = {
1769
1810
  id: responseId,
@@ -1841,7 +1882,7 @@ var init_LLMRequest = __esm({
1841
1882
  try {
1842
1883
  const toolsCalled = response.tool_calls ? JSON.stringify(response.tool_calls.map((tc) => tc.function.name)) : null;
1843
1884
  const providerName = response._provider?.name;
1844
- const standardAgentsRouterUsed = providerName === "platform";
1885
+ const standardAgentsRouterUsed = response._viaPlatform === true || providerName === "platform";
1845
1886
  const resolvedPricing = resolveModelPricing(modelDef, providerName);
1846
1887
  const calculatedCost = calculateUsageCost(response.usage, resolvedPricing);
1847
1888
  const providerReportedCost = typeof response.usage.cost === "number" ? response.usage.cost : typeof response.usage.cost === "string" ? parseFloat(response.usage.cost) : null;
@@ -5946,7 +5987,7 @@ var init_FlowEngine = __esm({
5946
5987
  max_session_turns: newAgentDef.maxSessionTurns ?? null,
5947
5988
  side_a_label: newAgentDef.sideA?.label ?? null,
5948
5989
  side_a_agent_prompt: newAgentDef.sideA?.prompt ?? null,
5949
- side_a_stop_on_response: newAgentDef.sideA?.stopOnResponse ?? false,
5990
+ side_a_stop_on_response: newAgentDef.sideA?.stopOnResponse ?? true,
5950
5991
  side_a_stop_tool: newAgentDef.sideA?.stopTool ?? null,
5951
5992
  side_a_stop_tool_response_property: newAgentDef.sideA?.stopToolResponseProperty ?? null,
5952
5993
  side_a_max_steps: newAgentDef.sideA?.maxSteps ?? null,
@@ -5961,7 +6002,7 @@ var init_FlowEngine = __esm({
5961
6002
  side_a_session_status_attachments_property: sideASession.status.attachmentsProperty,
5962
6003
  side_b_label: newAgentDef.sideB?.label ?? null,
5963
6004
  side_b_agent_prompt: newAgentDef.sideB?.prompt ?? null,
5964
- side_b_stop_on_response: newAgentDef.sideB?.stopOnResponse ?? false,
6005
+ side_b_stop_on_response: newAgentDef.sideB?.stopOnResponse ?? true,
5965
6006
  side_b_stop_tool: newAgentDef.sideB?.stopTool ?? null,
5966
6007
  side_b_stop_tool_response_property: newAgentDef.sideB?.stopToolResponseProperty ?? null,
5967
6008
  side_b_max_steps: newAgentDef.sideB?.maxSteps ?? null,
@@ -25418,7 +25459,7 @@ ${resultContent}${attachmentSummary}`;
25418
25459
  max_session_turns: agentDef.maxSessionTurns,
25419
25460
  side_a_label: agentDef.sideA?.label,
25420
25461
  side_a_agent_prompt: qualifyPromptName(agentDef.sideA?.prompt),
25421
- side_a_stop_on_response: agentDef.sideA?.stopOnResponse ?? false,
25462
+ side_a_stop_on_response: agentDef.sideA?.stopOnResponse ?? true,
25422
25463
  side_a_stop_tool: agentDef.sideA?.stopTool,
25423
25464
  side_a_stop_tool_response_property: agentDef.sideA?.stopToolResponseProperty,
25424
25465
  side_a_max_steps: agentDef.sideA?.maxSteps,
@@ -25433,7 +25474,7 @@ ${resultContent}${attachmentSummary}`;
25433
25474
  side_a_session_status_attachments_property: sideASession.status.attachmentsProperty,
25434
25475
  side_b_label: agentDef.sideB?.label,
25435
25476
  side_b_agent_prompt: qualifyPromptName(agentDef.sideB?.prompt),
25436
- side_b_stop_on_response: agentDef.sideB?.stopOnResponse ?? false,
25477
+ side_b_stop_on_response: agentDef.sideB?.stopOnResponse ?? true,
25437
25478
  side_b_stop_tool: agentDef.sideB?.stopTool,
25438
25479
  side_b_stop_tool_response_property: agentDef.sideB?.stopToolResponseProperty,
25439
25480
  side_b_max_steps: agentDef.sideB?.maxSteps,
@@ -25611,7 +25652,7 @@ ${resultContent}${attachmentSummary}`;
25611
25652
  max_session_turns: agentDef.maxSessionTurns,
25612
25653
  side_a_label: agentDef.sideA?.label,
25613
25654
  side_a_agent_prompt: qualifyPromptName(agentDef.sideA?.prompt),
25614
- side_a_stop_on_response: agentDef.sideA?.stopOnResponse ?? false,
25655
+ side_a_stop_on_response: agentDef.sideA?.stopOnResponse ?? true,
25615
25656
  side_a_stop_tool: agentDef.sideA?.stopTool,
25616
25657
  side_a_stop_tool_response_property: agentDef.sideA?.stopToolResponseProperty,
25617
25658
  side_a_max_steps: agentDef.sideA?.maxSteps,
@@ -25626,7 +25667,7 @@ ${resultContent}${attachmentSummary}`;
25626
25667
  side_a_session_status_attachments_property: sideASession.status.attachmentsProperty,
25627
25668
  side_b_label: agentDef.sideB?.label,
25628
25669
  side_b_agent_prompt: qualifyPromptName(agentDef.sideB?.prompt),
25629
- side_b_stop_on_response: agentDef.sideB?.stopOnResponse ?? false,
25670
+ side_b_stop_on_response: agentDef.sideB?.stopOnResponse ?? true,
25630
25671
  side_b_stop_tool: agentDef.sideB?.stopTool,
25631
25672
  side_b_stop_tool_response_property: agentDef.sideB?.stopToolResponseProperty,
25632
25673
  side_b_max_steps: agentDef.sideB?.maxSteps,
@@ -25757,7 +25798,7 @@ ${resultContent}${attachmentSummary}`;
25757
25798
  max_session_turns: agentDef.maxSessionTurns,
25758
25799
  side_a_label: agentDef.sideA?.label,
25759
25800
  side_a_agent_prompt: qualifyPromptName(agentDef.sideA?.prompt),
25760
- side_a_stop_on_response: agentDef.sideA?.stopOnResponse ?? false,
25801
+ side_a_stop_on_response: agentDef.sideA?.stopOnResponse ?? true,
25761
25802
  side_a_stop_tool: agentDef.sideA?.stopTool,
25762
25803
  side_a_stop_tool_response_property: agentDef.sideA?.stopToolResponseProperty,
25763
25804
  side_a_max_steps: agentDef.sideA?.maxSteps,
@@ -25772,7 +25813,7 @@ ${resultContent}${attachmentSummary}`;
25772
25813
  side_a_session_status_attachments_property: sideASession.status.attachmentsProperty,
25773
25814
  side_b_label: agentDef.sideB?.label,
25774
25815
  side_b_agent_prompt: qualifyPromptName(agentDef.sideB?.prompt),
25775
- side_b_stop_on_response: agentDef.sideB?.stopOnResponse ?? false,
25816
+ side_b_stop_on_response: agentDef.sideB?.stopOnResponse ?? true,
25776
25817
  side_b_stop_tool: agentDef.sideB?.stopTool,
25777
25818
  side_b_stop_tool_response_property: agentDef.sideB?.stopToolResponseProperty,
25778
25819
  side_b_max_steps: agentDef.sideB?.maxSteps,