@standardagents/builder 0.24.4 → 0.24.5

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 (35) hide show
  1. package/dist/built-in-routes.js +20 -17
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-1m7uIS8S.js → ApiKeysView-CmObAp7n.js} +1 -1
  4. package/dist/client/{CenteredContentView-DJzHRMGj.js → CenteredContentView-gJXa9UHE.js} +1 -1
  5. package/dist/client/{CompositionView-nzqzVKAg.js → CompositionView-BohQwGLE.js} +1 -1
  6. package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-YX8WE_iB.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-A1C0eTY7.js} +1 -1
  7. package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-BpJt6BT0.js → CopyButton.vue_vue_type_script_setup_true_lang-D5q8qf4n.js} +1 -1
  8. package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-Dg3HMMJ0.js → DataTable.vue_vue_type_script_setup_true_lang-DzPpurCp.js} +1 -1
  9. package/dist/client/{JsonViewer-BdNA5OCG.js → JsonViewer-CKqMMqjU.js} +1 -1
  10. package/dist/client/{LoginView-BlF_2TtB.js → LoginView-BY2NMQQF.js} +1 -1
  11. package/dist/client/{MarketplaceView-DrlOb57k.js → MarketplaceView-DVEMUvDq.js} +1 -1
  12. package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-hkOmEwrb.js → Modal.vue_vue_type_script_setup_true_lang-1t6cxO9H.js} +1 -1
  13. package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-p3esoV-i.js → ModelModal.vue_vue_type_script_setup_true_lang-WFlATqyT.js} +1 -1
  14. package/dist/client/{ModelsView-CHBanMSH.js → ModelsView-_qZmXle8.js} +1 -1
  15. package/dist/client/{PromptEditView-b5B43l4Q.js → PromptEditView-DzY493YB.js} +1 -1
  16. package/dist/client/{PromptModal-BF5bdmNQ.js → PromptModal-BQYwnWKw.js} +1 -1
  17. package/dist/client/{PromptsView-6TfMOScI.js → PromptsView-DBiQ9X1g.js} +1 -1
  18. package/dist/client/{ProvidersView-CA5Yx2Fn.js → ProvidersView-DEH34_v0.js} +1 -1
  19. package/dist/client/{ThreadInspectorPane.vue_vue_type_script_setup_true_lang-ejyFhmNy.js → ThreadInspectorPane.vue_vue_type_script_setup_true_lang-Dtd1VFrj.js} +2 -2
  20. package/dist/client/{ThreadsView-yJpVmf42.js → ThreadsView-m1CAq3Aw.js} +1 -1
  21. package/dist/client/{ToolsView-DE1TDnlU.js → ToolsView-D-qvyctb.js} +1 -1
  22. package/dist/client/{UsersView-BXDHjJLB.js → UsersView-DaXRB61v.js} +1 -1
  23. package/dist/client/{VariablesView-Bz-CbaEv.js → VariablesView-DDomn-IB.js} +1 -1
  24. package/dist/client/assets/{ThreadInspectorPane-DLSVKyBu.css → ThreadInspectorPane-CjK6SKEi.css} +1 -1
  25. package/dist/client/{index-TIntu1KJ.js → index-DihZBCmQ.js} +2 -2
  26. package/dist/client/index.html +1 -1
  27. package/dist/{index-jDKWlMKG.d.ts → index-D7KMmRgr.d.ts} +1 -0
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +55 -36
  30. package/dist/index.js.map +1 -1
  31. package/dist/runtime.d.ts +3 -2
  32. package/dist/runtime.js +55 -36
  33. package/dist/runtime.js.map +1 -1
  34. package/dist/test.d.ts +1 -1
  35. package/package.json +5 -5
@@ -26,7 +26,7 @@
26
26
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
27
27
  <link rel="icon" type="image/svg+xml" href="/agents/assets/img/favicon-9uH1rb2F.svg">
28
28
  <title>AgentBuilder Admin</title>
29
- <script type="module" crossorigin src="/agents/index-TIntu1KJ.js"></script>
29
+ <script type="module" crossorigin src="/agents/index-DihZBCmQ.js"></script>
30
30
  <link rel="modulepreload" crossorigin href="/agents/formkit-DcuuXZjC.js">
31
31
  <link rel="modulepreload" crossorigin href="/agents/vendor-TPZjEwCU.js">
32
32
  <link rel="modulepreload" crossorigin href="/agents/syntax-D-ZcovVx.js">
@@ -845,6 +845,7 @@ interface LogData {
845
845
  error?: string;
846
846
  error_type?: string;
847
847
  cost_input?: number;
848
+ cost_cached?: number;
848
849
  cost_output?: number;
849
850
  cost_total?: number;
850
851
  message_history_length?: number;
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, move, optimizeImageContext, parseQualifiedName, qualifyName, queueTool, readFile, readdir, reloadHistory, rename, 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-jDKWlMKG.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-D7KMmRgr.js';
5
5
  export { AgentType, DefinitionLoader, GlobalNamespaceContext, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, PromptInput, PromptTextPart, ProviderAssistantMessage, ProviderConfigSlot, ProviderConfigSlots, ProviderConfigValueSource, ProviderDefinition, ProviderError, ProviderErrorCode, ProviderFactory, ProviderFactoryConfig, ProviderFinishReason, ProviderGeneratedImage, ProviderMessage, ProviderMessageContent, ProviderMethodOverrides, ModelCapabilities as ProviderModelCapabilities, ProviderOverride, ProviderOverrideContext, ProviderReasoningDetail, ProviderRequest, ProviderResponse, ProviderStreamChunk, ProviderSyncOverride, ProviderSystemMessage, ProviderTool, ProviderToolCallPart, ProviderToolMessage, ProviderToolResultContent, ProviderUsage, ProviderUserMessage, ReasoningConfig, StructuredPrompt, TextContent, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHook, defineModel, definePrompt, defineProvider, defineTool, isPacked, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue } 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
@@ -245,14 +245,14 @@ function calculateUsageCost(usage, pricing) {
245
245
  const inputPrice = useLongContext ? pricing.longInputPrice ?? pricing.inputPrice : pricing.inputPrice;
246
246
  const outputPrice = useLongContext ? pricing.longOutputPrice ?? pricing.outputPrice : pricing.outputPrice;
247
247
  const cachedTokenPrice = useLongContext ? pricing.longCachedPrice ?? pricing.cachedPrice ?? pricing.inputPrice : pricing.cachedPrice ?? pricing.inputPrice;
248
- const costInput = roundCost(
249
- (uncachedPromptTokens * inputPrice + cachedTokens * cachedTokenPrice) / TOKENS_PER_MILLION
250
- );
248
+ const costInput = roundCost(uncachedPromptTokens * inputPrice / TOKENS_PER_MILLION);
249
+ const costCached = roundCost(cachedTokens * cachedTokenPrice / TOKENS_PER_MILLION);
251
250
  const costOutput = roundCost(billableOutputTokens * outputPrice / TOKENS_PER_MILLION);
252
251
  return {
253
252
  costInput,
253
+ costCached,
254
254
  costOutput,
255
- costTotal: roundCost(costInput + costOutput)
255
+ costTotal: roundCost(costInput + costCached + costOutput)
256
256
  };
257
257
  }
258
258
  var TOKENS_PER_MILLION;
@@ -2120,6 +2120,7 @@ var init_LLMRequest = __esm({
2120
2120
  reasoning_tokens: response.usage.completion_tokens_details?.reasoning_tokens || 0,
2121
2121
  total_tokens: response.usage.total_tokens,
2122
2122
  cost_input: calculatedCost?.costInput,
2123
+ cost_cached: calculatedCost?.costCached,
2123
2124
  cost_output: calculatedCost?.costOutput,
2124
2125
  latency_ms: Date.now() - startTime,
2125
2126
  time_to_first_token_ms: timing?.latencyMs ?? void 0,
@@ -2149,19 +2150,20 @@ var init_LLMRequest = __esm({
2149
2150
  reasoning_tokens = ?5,
2150
2151
  total_tokens = ?6,
2151
2152
  cost_input = ?7,
2152
- cost_output = ?8,
2153
- latency_ms = ?9,
2154
- finish_reason = ?10,
2155
- tools_called = ?11,
2156
- cost_total = ?12,
2157
- is_complete = ?13,
2158
- reasoning_content = ?14,
2159
- provider_tools = ?15,
2160
- actual_provider = ?16,
2161
- standard_agents_router_used = ?17,
2162
- time_to_first_token_ms = ?18,
2163
- generation_ms = ?19
2164
- WHERE id = ?20
2153
+ cost_cached = ?8,
2154
+ cost_output = ?9,
2155
+ latency_ms = ?10,
2156
+ finish_reason = ?11,
2157
+ tools_called = ?12,
2158
+ cost_total = ?13,
2159
+ is_complete = ?14,
2160
+ reasoning_content = ?15,
2161
+ provider_tools = ?16,
2162
+ actual_provider = ?17,
2163
+ standard_agents_router_used = ?18,
2164
+ time_to_first_token_ms = ?19,
2165
+ generation_ms = ?20
2166
+ WHERE id = ?21
2165
2167
  `,
2166
2168
  logData.response_body,
2167
2169
  logData.input_tokens,
@@ -2170,6 +2172,7 @@ var init_LLMRequest = __esm({
2170
2172
  logData.reasoning_tokens,
2171
2173
  logData.total_tokens,
2172
2174
  logData.cost_input ?? null,
2175
+ logData.cost_cached ?? null,
2173
2176
  logData.cost_output ?? null,
2174
2177
  logData.latency_ms,
2175
2178
  logData.finish_reason,
@@ -22918,8 +22921,23 @@ var migration31 = {
22918
22921
  }
22919
22922
  };
22920
22923
 
22924
+ // src/durable-objects/migrations/032_add_cost_cached.ts
22925
+ var migration32 = {
22926
+ version: 32,
22927
+ name: "add_cost_cached",
22928
+ async up(sql) {
22929
+ const tableInfo = sql.exec(`PRAGMA table_info(logs)`).toArray();
22930
+ const hasCostCached = tableInfo.some((col) => col.name === "cost_cached");
22931
+ if (!hasCostCached) {
22932
+ await sql.exec(`
22933
+ ALTER TABLE logs ADD COLUMN cost_cached REAL;
22934
+ `);
22935
+ }
22936
+ }
22937
+ };
22938
+
22921
22939
  // src/durable-objects/migrations/index.ts
22922
- var migrations = [migration, migration2, migration3, migration4, migration5, migration6, migration7, migration8, migration9, migration10, migration11, migration12, migration13, migration14, migration15, migration16, migration17, migration18, migration19, migration20, migration21, migration22, migration23, migration24, migration25, migration26, migration27, migration28, migration29, migration30, migration31];
22940
+ var migrations = [migration, migration2, migration3, migration4, migration5, migration6, migration7, migration8, migration9, migration10, migration11, migration12, migration13, migration14, migration15, migration16, migration17, migration18, migration19, migration20, migration21, migration22, migration23, migration24, migration25, migration26, migration27, migration28, migration29, migration30, migration31, migration32];
22923
22941
  var LATEST_SCHEMA_VERSION = migrations.length;
22924
22942
 
22925
22943
  // src/durable-objects/DurableThread.ts
@@ -25035,9 +25053,9 @@ var DurableThread = class _DurableThread extends DurableObject {
25035
25053
  * Each migration is run in order, starting from the current version + 1.
25036
25054
  */
25037
25055
  async runMigrations(fromVersion) {
25038
- for (const migration42 of migrations) {
25039
- if (migration42.version > fromVersion) {
25040
- await migration42.up(this.ctx.storage.sql);
25056
+ for (const migration43 of migrations) {
25057
+ if (migration43.version > fromVersion) {
25058
+ await migration43.up(this.ctx.storage.sql);
25041
25059
  }
25042
25060
  }
25043
25061
  }
@@ -26753,7 +26771,7 @@ ${resultContent}${attachmentSummary}`;
26753
26771
  l.request_body, l.request_headers, l.response_body, l.response_headers,
26754
26772
  l.status_code, l.reasoning_content, l.input_tokens, l.cached_tokens, l.output_tokens,
26755
26773
  l.reasoning_tokens, l.total_tokens, l.latency_ms, l.time_to_first_token_ms, l.generation_ms,
26756
- l.finish_reason, l.error, l.error_type, l.cost_input, l.cost_output, l.cost_total,
26774
+ l.finish_reason, l.error, l.error_type, l.cost_input, l.cost_cached, l.cost_output, l.cost_total,
26757
26775
  l.message_history_length, l.tools_available, l.prompt_name, l.tools_called,
26758
26776
  l.queued_tools, l.provider_tools, l.parent_log_id, l.tools_schema, l.system_prompt,
26759
26777
  l.errors, l.retry_of_log_id, l.tool_results, l.is_complete, l.created_at,
@@ -26843,6 +26861,7 @@ ${resultContent}${attachmentSummary}`;
26843
26861
  error: row.error,
26844
26862
  error_type: row.error_type,
26845
26863
  cost_input: row.cost_input,
26864
+ cost_cached: row.cost_cached,
26846
26865
  cost_output: row.cost_output,
26847
26866
  cost_total: row.cost_total,
26848
26867
  message_history_length: row.message_history_length,
@@ -28745,7 +28764,7 @@ ${resultContent}${attachmentSummary}`;
28745
28764
  };
28746
28765
 
28747
28766
  // src/durable-objects/agentbuilder-migrations/0001_initial.ts
28748
- var migration32 = {
28767
+ var migration33 = {
28749
28768
  version: 1,
28750
28769
  async up(sql) {
28751
28770
  sql.exec(`
@@ -28844,7 +28863,7 @@ var migration32 = {
28844
28863
  };
28845
28864
 
28846
28865
  // src/durable-objects/agentbuilder-migrations/0002_add_tenvs_properties.ts
28847
- var migration33 = {
28866
+ var migration34 = {
28848
28867
  version: 2,
28849
28868
  async up(sql) {
28850
28869
  sql.exec(`ALTER TABLE threads ADD COLUMN tenvs TEXT`);
@@ -28856,7 +28875,7 @@ var migration33 = {
28856
28875
  };
28857
28876
 
28858
28877
  // src/durable-objects/agentbuilder-migrations/0003_add_parent_and_terminated.ts
28859
- var migration34 = {
28878
+ var migration35 = {
28860
28879
  version: 3,
28861
28880
  async up(sql) {
28862
28881
  sql.exec(`ALTER TABLE threads ADD COLUMN parent TEXT REFERENCES threads(id)`);
@@ -28869,7 +28888,7 @@ var migration34 = {
28869
28888
  };
28870
28889
 
28871
28890
  // src/durable-objects/agentbuilder-migrations/0004_add_env_tables.ts
28872
- var migration35 = {
28891
+ var migration36 = {
28873
28892
  version: 4,
28874
28893
  async up(sql) {
28875
28894
  sql.exec(`ALTER TABLE threads ADD COLUMN env TEXT`);
@@ -28893,7 +28912,7 @@ var migration35 = {
28893
28912
  };
28894
28913
 
28895
28914
  // src/durable-objects/agentbuilder-migrations/0005_add_pending_subagent_env_requests.ts
28896
- var migration36 = {
28915
+ var migration37 = {
28897
28916
  version: 5,
28898
28917
  async up(sql) {
28899
28918
  sql.exec(`
@@ -28919,7 +28938,7 @@ var migration36 = {
28919
28938
  };
28920
28939
 
28921
28940
  // src/durable-objects/agentbuilder-migrations/0006_add_env_value_types.ts
28922
- var migration37 = {
28941
+ var migration38 = {
28923
28942
  version: 6,
28924
28943
  async up(sql) {
28925
28944
  sql.exec(
@@ -28934,7 +28953,7 @@ var migration37 = {
28934
28953
  };
28935
28954
 
28936
28955
  // src/durable-objects/agentbuilder-migrations/0007_platform_identity_replica.ts
28937
- var migration38 = {
28956
+ var migration39 = {
28938
28957
  version: 7,
28939
28958
  async up(sql) {
28940
28959
  sql.exec(`ALTER TABLE users ADD COLUMN platform_user_id TEXT`);
@@ -28963,7 +28982,7 @@ var migration38 = {
28963
28982
  };
28964
28983
 
28965
28984
  // src/durable-objects/agentbuilder-migrations/0008_add_skills.ts
28966
- var migration39 = {
28985
+ var migration40 = {
28967
28986
  version: 8,
28968
28987
  async up(sql) {
28969
28988
  sql.exec(`
@@ -28994,7 +29013,7 @@ var migration39 = {
28994
29013
  };
28995
29014
 
28996
29015
  // src/durable-objects/agentbuilder-migrations/0009_add_user_permissions.ts
28997
- var migration40 = {
29016
+ var migration41 = {
28998
29017
  version: 9,
28999
29018
  async up(sql) {
29000
29019
  sql.exec(`ALTER TABLE users ADD COLUMN permissions TEXT`);
@@ -29005,7 +29024,7 @@ var migration40 = {
29005
29024
  };
29006
29025
 
29007
29026
  // src/durable-objects/agentbuilder-migrations/0010_add_device_logins.ts
29008
- var migration41 = {
29027
+ var migration42 = {
29009
29028
  version: 10,
29010
29029
  async up(sql) {
29011
29030
  sql.exec(`
@@ -29025,7 +29044,7 @@ var migration41 = {
29025
29044
  };
29026
29045
 
29027
29046
  // src/durable-objects/agentbuilder-migrations/index.ts
29028
- var migrations2 = [migration32, migration33, migration34, migration35, migration36, migration37, migration38, migration39, migration40, migration41];
29047
+ var migrations2 = [migration33, migration34, migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42];
29029
29048
  var LATEST_SCHEMA_VERSION2 = 10;
29030
29049
 
29031
29050
  // src/utils/crypto.ts
@@ -29788,9 +29807,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
29788
29807
  }
29789
29808
  }
29790
29809
  async runMigrations(fromVersion) {
29791
- for (const migration42 of migrations2) {
29792
- if (migration42.version > fromVersion) {
29793
- await migration42.up(this.ctx.storage.sql);
29810
+ for (const migration43 of migrations2) {
29811
+ if (migration43.version > fromVersion) {
29812
+ await migration43.up(this.ctx.storage.sql);
29794
29813
  }
29795
29814
  }
29796
29815
  }