@standardagents/builder 0.24.4 → 0.24.6

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 (51) hide show
  1. package/dist/built-in-routes.js +173 -32
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-1m7uIS8S.js → ApiKeysView-CmZKVcOR.js} +1 -1
  4. package/dist/client/CenteredContentView-DK7rPUK2.js +1 -0
  5. package/dist/client/{CompositionView-nzqzVKAg.js → CompositionView-BvVMnyYP.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-h7YuRPAr.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-BpQ6CMUp.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-DCUZbvUM.js} +1 -1
  9. package/dist/client/{JsonViewer-BdNA5OCG.js → JsonViewer-CvwfQYW-.js} +1 -1
  10. package/dist/client/{LoginView-BlF_2TtB.js → LoginView-DnaG5knS.js} +1 -1
  11. package/dist/client/{MarketplaceView-DrlOb57k.js → MarketplaceView-fX_Juw54.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-CFFVfl1g.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-B68s7Jo1.js} +1 -1
  14. package/dist/client/{ModelsView-CHBanMSH.js → ModelsView-lv4-IyA2.js} +1 -1
  15. package/dist/client/{PromptEditView-b5B43l4Q.js → PromptEditView-DGaxlMMx.js} +1 -1
  16. package/dist/client/{PromptModal-BF5bdmNQ.js → PromptModal-DaW1J_W6.js} +1 -1
  17. package/dist/client/{PromptsView-6TfMOScI.js → PromptsView-CdiBqZey.js} +1 -1
  18. package/dist/client/{ProvidersView-CA5Yx2Fn.js → ProvidersView-B37bgFKh.js} +1 -1
  19. package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang-DHlNdv7o.js +22 -0
  20. package/dist/client/ThreadsView-BAfuNShv.js +1 -0
  21. package/dist/client/{ToolsView-DE1TDnlU.js → ToolsView-BMKgNq7O.js} +1 -1
  22. package/dist/client/{UiCodeBlock.vue_vue_type_script_setup_true_lang-BawOR_eB.js → UiCodeBlock.vue_vue_type_script_setup_true_lang-BH3WC9G_.js} +1 -1
  23. package/dist/client/{UsersView-BXDHjJLB.js → UsersView-BDKchqNQ.js} +1 -1
  24. package/dist/client/{VariablesView-Bz-CbaEv.js → VariablesView-BPioaCbu.js} +1 -1
  25. package/dist/client/assets/{ThreadInspectorPane-DLSVKyBu.css → ThreadInspectorPane-lJJckks4.css} +1 -1
  26. package/dist/client/assets/index-Djjx6d3k.css +1 -0
  27. package/dist/client/{check-DKLwABgc.js → check-Dkzs1C3V.js} +1 -1
  28. package/dist/client/{chevron-right-DJJGHNE5.js → chevron-right-BGirddPg.js} +1 -1
  29. package/dist/client/{copy-CLWiDcxB.js → copy-C08OR8rY.js} +1 -1
  30. package/dist/client/{formkit-DcuuXZjC.js → formkit-YJ1Z7D5r.js} +1 -1
  31. package/dist/client/{index-TIntu1KJ.js → index-BVfRoUms.js} +3 -3
  32. package/dist/client/index.html +4 -4
  33. package/dist/client/{package-CarOhnUs.js → package-guyzMTDG.js} +1 -1
  34. package/dist/client/{plus-zGapov7j.js → plus-DG3ZN5wg.js} +1 -1
  35. package/dist/client/{timeAgo-ASgzq6bq.js → timeAgo-D7V247YG.js} +1 -1
  36. package/dist/client/{useActionFeedback-uUrfjlCo.js → useActionFeedback-byARNQjQ.js} +1 -1
  37. package/dist/client/vue-BqC6IZDY.js +1 -0
  38. package/dist/{index-jDKWlMKG.d.ts → index-D3FNNQWC.d.ts} +8 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.js +102 -42
  41. package/dist/index.js.map +1 -1
  42. package/dist/runtime.d.ts +10 -2
  43. package/dist/runtime.js +102 -42
  44. package/dist/runtime.js.map +1 -1
  45. package/dist/test.d.ts +1 -1
  46. package/package.json +5 -5
  47. package/dist/client/CenteredContentView-DJzHRMGj.js +0 -1
  48. package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang-ejyFhmNy.js +0 -22
  49. package/dist/client/ThreadsView-yJpVmf42.js +0 -1
  50. package/dist/client/assets/index-V68N0r_5.css +0 -1
  51. package/dist/client/vue-2tGL2Ulx.js +0 -1
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-D3FNNQWC.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
@@ -217,6 +217,18 @@ function getFallbackPricing(providerName, modelId) {
217
217
  const pricing = getProviderModelPricing(providerName, modelId);
218
218
  return pricing ? toResolvedModelPricing(pricing) : null;
219
219
  }
220
+ function resolveUsageReportedPricing(usage) {
221
+ const pricing = usage.pricing;
222
+ if (!pricing || typeof pricing.inputPerMillion !== "number" || typeof pricing.outputPerMillion !== "number") {
223
+ return null;
224
+ }
225
+ return {
226
+ inputPrice: pricing.inputPerMillion,
227
+ outputPrice: pricing.outputPerMillion,
228
+ cachedPrice: pricing.cachedInputPerMillion,
229
+ source: "provider"
230
+ };
231
+ }
220
232
  function resolveModelPricing(modelDef, providerName) {
221
233
  if (typeof modelDef.inputPrice === "number" && typeof modelDef.outputPrice === "number") {
222
234
  return {
@@ -245,14 +257,14 @@ function calculateUsageCost(usage, pricing) {
245
257
  const inputPrice = useLongContext ? pricing.longInputPrice ?? pricing.inputPrice : pricing.inputPrice;
246
258
  const outputPrice = useLongContext ? pricing.longOutputPrice ?? pricing.outputPrice : pricing.outputPrice;
247
259
  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
- );
260
+ const costInput = roundCost(uncachedPromptTokens * inputPrice / TOKENS_PER_MILLION);
261
+ const costCached = roundCost(cachedTokens * cachedTokenPrice / TOKENS_PER_MILLION);
251
262
  const costOutput = roundCost(billableOutputTokens * outputPrice / TOKENS_PER_MILLION);
252
263
  return {
253
264
  costInput,
265
+ costCached,
254
266
  costOutput,
255
- costTotal: roundCost(costInput + costOutput)
267
+ costTotal: roundCost(costInput + costCached + costOutput)
256
268
  };
257
269
  }
258
270
  var TOKENS_PER_MILLION;
@@ -1358,7 +1370,8 @@ function convertUsage(usage) {
1358
1370
  prompt_tokens_details: usage.cachedTokens ? { cached_tokens: usage.cachedTokens } : void 0,
1359
1371
  completion_tokens_details: usage.reasoningTokens ? { reasoning_tokens: usage.reasoningTokens } : void 0,
1360
1372
  cost: usage.cost,
1361
- provider: usage.provider
1373
+ provider: usage.provider,
1374
+ pricing: usage.pricing
1362
1375
  };
1363
1376
  }
1364
1377
  function inferProviderFromModelId(model) {
@@ -2053,7 +2066,7 @@ var init_LLMRequest = __esm({
2053
2066
  const toolsCalled = response.tool_calls ? JSON.stringify(response.tool_calls.map((tc) => tc.function.name)) : null;
2054
2067
  const providerName = response._provider?.name;
2055
2068
  const standardAgentsRouterUsed = response._viaPlatform === true || providerName === "platform";
2056
- const resolvedPricing = resolveModelPricing(modelDef, providerName);
2069
+ const resolvedPricing = resolveModelPricing(modelDef) ?? resolveUsageReportedPricing(response.usage) ?? resolveModelPricing(modelDef, providerName);
2057
2070
  const calculatedCost = calculateUsageCost(response.usage, resolvedPricing);
2058
2071
  const providerReportedCost = typeof response.usage.cost === "number" ? response.usage.cost : typeof response.usage.cost === "string" ? parseFloat(response.usage.cost) : null;
2059
2072
  const cost_total = providerReportedCost != null && !Number.isNaN(providerReportedCost) ? providerReportedCost : calculatedCost?.costTotal ?? null;
@@ -2120,6 +2133,7 @@ var init_LLMRequest = __esm({
2120
2133
  reasoning_tokens: response.usage.completion_tokens_details?.reasoning_tokens || 0,
2121
2134
  total_tokens: response.usage.total_tokens,
2122
2135
  cost_input: calculatedCost?.costInput,
2136
+ cost_cached: calculatedCost?.costCached,
2123
2137
  cost_output: calculatedCost?.costOutput,
2124
2138
  latency_ms: Date.now() - startTime,
2125
2139
  time_to_first_token_ms: timing?.latencyMs ?? void 0,
@@ -2149,19 +2163,20 @@ var init_LLMRequest = __esm({
2149
2163
  reasoning_tokens = ?5,
2150
2164
  total_tokens = ?6,
2151
2165
  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
2166
+ cost_cached = ?8,
2167
+ cost_output = ?9,
2168
+ latency_ms = ?10,
2169
+ finish_reason = ?11,
2170
+ tools_called = ?12,
2171
+ cost_total = ?13,
2172
+ is_complete = ?14,
2173
+ reasoning_content = ?15,
2174
+ provider_tools = ?16,
2175
+ actual_provider = ?17,
2176
+ standard_agents_router_used = ?18,
2177
+ time_to_first_token_ms = ?19,
2178
+ generation_ms = ?20
2179
+ WHERE id = ?21
2165
2180
  `,
2166
2181
  logData.response_body,
2167
2182
  logData.input_tokens,
@@ -2170,6 +2185,7 @@ var init_LLMRequest = __esm({
2170
2185
  logData.reasoning_tokens,
2171
2186
  logData.total_tokens,
2172
2187
  logData.cost_input ?? null,
2188
+ logData.cost_cached ?? null,
2173
2189
  logData.cost_output ?? null,
2174
2190
  logData.latency_ms,
2175
2191
  logData.finish_reason,
@@ -22918,8 +22934,23 @@ var migration31 = {
22918
22934
  }
22919
22935
  };
22920
22936
 
22937
+ // src/durable-objects/migrations/032_add_cost_cached.ts
22938
+ var migration32 = {
22939
+ version: 32,
22940
+ name: "add_cost_cached",
22941
+ async up(sql) {
22942
+ const tableInfo = sql.exec(`PRAGMA table_info(logs)`).toArray();
22943
+ const hasCostCached = tableInfo.some((col) => col.name === "cost_cached");
22944
+ if (!hasCostCached) {
22945
+ await sql.exec(`
22946
+ ALTER TABLE logs ADD COLUMN cost_cached REAL;
22947
+ `);
22948
+ }
22949
+ }
22950
+ };
22951
+
22921
22952
  // 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];
22953
+ 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
22954
  var LATEST_SCHEMA_VERSION = migrations.length;
22924
22955
 
22925
22956
  // src/durable-objects/DurableThread.ts
@@ -24399,8 +24430,10 @@ var DurableThread = class _DurableThread extends DurableObject {
24399
24430
  async setValue(key, value) {
24400
24431
  await this.ensureMigrated();
24401
24432
  this.assertValidThreadValueKey(key);
24433
+ const updatedAt = Date.now() * 1e3;
24402
24434
  if (value === null || value === void 0) {
24403
24435
  await this.ctx.storage.sql.exec(`DELETE FROM thread_values WHERE key = ?`, key);
24436
+ this.broadcastLog({ type: "kv_data", key, deleted: true, updated_at: updatedAt });
24404
24437
  return;
24405
24438
  }
24406
24439
  const serialized = this.serializeThreadValue(value);
@@ -24414,8 +24447,9 @@ var DurableThread = class _DurableThread extends DurableObject {
24414
24447
  `,
24415
24448
  key,
24416
24449
  serialized,
24417
- Date.now() * 1e3
24450
+ updatedAt
24418
24451
  );
24452
+ this.broadcastLog({ type: "kv_data", key, deleted: false, updated_at: updatedAt });
24419
24453
  }
24420
24454
  async listValues(options = {}) {
24421
24455
  await this.ensureMigrated();
@@ -25035,9 +25069,9 @@ var DurableThread = class _DurableThread extends DurableObject {
25035
25069
  * Each migration is run in order, starting from the current version + 1.
25036
25070
  */
25037
25071
  async runMigrations(fromVersion) {
25038
- for (const migration42 of migrations) {
25039
- if (migration42.version > fromVersion) {
25040
- await migration42.up(this.ctx.storage.sql);
25072
+ for (const migration43 of migrations) {
25073
+ if (migration43.version > fromVersion) {
25074
+ await migration43.up(this.ctx.storage.sql);
25041
25075
  }
25042
25076
  }
25043
25077
  }
@@ -26471,7 +26505,7 @@ ${resultContent}${attachmentSummary}`;
26471
26505
  SELECT
26472
26506
  id, message_id, provider, actual_provider, standard_agents_router_used, model, model_name, prompt_name,
26473
26507
  tools_called, queued_tools, provider_tools, parent_log_id, retry_of_log_id, error, cost_total,
26474
- input_tokens, output_tokens, total_tokens,
26508
+ input_tokens, cached_tokens, output_tokens, total_tokens,
26475
26509
  is_complete, created_at, request_body
26476
26510
  FROM logs
26477
26511
  ORDER BY created_at ${order}
@@ -26497,6 +26531,7 @@ ${resultContent}${attachmentSummary}`;
26497
26531
  error: row.error,
26498
26532
  cost_total: row.cost_total,
26499
26533
  input_tokens: row.input_tokens,
26534
+ cached_tokens: row.cached_tokens,
26500
26535
  output_tokens: row.output_tokens,
26501
26536
  total_tokens: row.total_tokens,
26502
26537
  is_complete: row.is_complete === 1,
@@ -26520,11 +26555,17 @@ ${resultContent}${attachmentSummary}`;
26520
26555
  await this.ensureMigrated();
26521
26556
  const byModel = {};
26522
26557
  let totalCost = 0;
26558
+ let inputCost = 0;
26559
+ let cachedCost = 0;
26560
+ let outputCost = 0;
26523
26561
  let requestCount = 0;
26524
26562
  const modelRows = await this.ctx.storage.sql.exec(
26525
26563
  `
26526
26564
  SELECT COALESCE(model_name, model, 'unknown') AS model_key,
26527
26565
  SUM(cost_total) AS total_cost,
26566
+ SUM(CASE WHEN cost_cached IS NOT NULL THEN cost_input END) AS input_cost,
26567
+ SUM(cost_cached) AS cached_cost,
26568
+ SUM(cost_output) AS output_cost,
26528
26569
  COUNT(*) AS request_count
26529
26570
  FROM logs
26530
26571
  WHERE cost_total IS NOT NULL
@@ -26532,15 +26573,32 @@ ${resultContent}${attachmentSummary}`;
26532
26573
  `
26533
26574
  );
26534
26575
  for (const row of modelRows.toArray()) {
26535
- byModel[row.model_key] = { totalCost: row.total_cost, count: row.request_count };
26576
+ byModel[row.model_key] = {
26577
+ totalCost: row.total_cost,
26578
+ inputCost: row.input_cost ?? 0,
26579
+ cachedCost: row.cached_cost ?? 0,
26580
+ outputCost: row.output_cost ?? 0,
26581
+ count: row.request_count
26582
+ };
26536
26583
  totalCost += row.total_cost;
26584
+ inputCost += row.input_cost ?? 0;
26585
+ cachedCost += row.cached_cost ?? 0;
26586
+ outputCost += row.output_cost ?? 0;
26537
26587
  requestCount += row.request_count;
26538
26588
  }
26539
26589
  const messageRow = await this.ctx.storage.sql.exec(
26540
26590
  `SELECT COUNT(DISTINCT message_id) AS message_count FROM logs WHERE cost_total IS NOT NULL`
26541
26591
  );
26542
26592
  const messageCount = messageRow.one().message_count || 0;
26543
- return { totalCost, requestCount, messageCount, byModel };
26593
+ return {
26594
+ totalCost,
26595
+ inputCost,
26596
+ cachedCost,
26597
+ outputCost,
26598
+ requestCount,
26599
+ messageCount,
26600
+ byModel
26601
+ };
26544
26602
  }
26545
26603
  /**
26546
26604
  * Get specific logs, optionally including all descendant logs.
@@ -26753,7 +26811,7 @@ ${resultContent}${attachmentSummary}`;
26753
26811
  l.request_body, l.request_headers, l.response_body, l.response_headers,
26754
26812
  l.status_code, l.reasoning_content, l.input_tokens, l.cached_tokens, l.output_tokens,
26755
26813
  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,
26814
+ l.finish_reason, l.error, l.error_type, l.cost_input, l.cost_cached, l.cost_output, l.cost_total,
26757
26815
  l.message_history_length, l.tools_available, l.prompt_name, l.tools_called,
26758
26816
  l.queued_tools, l.provider_tools, l.parent_log_id, l.tools_schema, l.system_prompt,
26759
26817
  l.errors, l.retry_of_log_id, l.tool_results, l.is_complete, l.created_at,
@@ -26843,6 +26901,7 @@ ${resultContent}${attachmentSummary}`;
26843
26901
  error: row.error,
26844
26902
  error_type: row.error_type,
26845
26903
  cost_input: row.cost_input,
26904
+ cost_cached: row.cost_cached,
26846
26905
  cost_output: row.cost_output,
26847
26906
  cost_total: row.cost_total,
26848
26907
  message_history_length: row.message_history_length,
@@ -27342,6 +27401,7 @@ ${resultContent}${attachmentSummary}`;
27342
27401
  * Broadcast a log record to all connected WebSocket clients
27343
27402
  */
27344
27403
  broadcastLog(log) {
27404
+ if (!this.logSockets || this.logSockets.size === 0) return;
27345
27405
  const payload = JSON.stringify(log);
27346
27406
  for (const ws of Array.from(this.logSockets)) {
27347
27407
  try {
@@ -28745,7 +28805,7 @@ ${resultContent}${attachmentSummary}`;
28745
28805
  };
28746
28806
 
28747
28807
  // src/durable-objects/agentbuilder-migrations/0001_initial.ts
28748
- var migration32 = {
28808
+ var migration33 = {
28749
28809
  version: 1,
28750
28810
  async up(sql) {
28751
28811
  sql.exec(`
@@ -28844,7 +28904,7 @@ var migration32 = {
28844
28904
  };
28845
28905
 
28846
28906
  // src/durable-objects/agentbuilder-migrations/0002_add_tenvs_properties.ts
28847
- var migration33 = {
28907
+ var migration34 = {
28848
28908
  version: 2,
28849
28909
  async up(sql) {
28850
28910
  sql.exec(`ALTER TABLE threads ADD COLUMN tenvs TEXT`);
@@ -28856,7 +28916,7 @@ var migration33 = {
28856
28916
  };
28857
28917
 
28858
28918
  // src/durable-objects/agentbuilder-migrations/0003_add_parent_and_terminated.ts
28859
- var migration34 = {
28919
+ var migration35 = {
28860
28920
  version: 3,
28861
28921
  async up(sql) {
28862
28922
  sql.exec(`ALTER TABLE threads ADD COLUMN parent TEXT REFERENCES threads(id)`);
@@ -28869,7 +28929,7 @@ var migration34 = {
28869
28929
  };
28870
28930
 
28871
28931
  // src/durable-objects/agentbuilder-migrations/0004_add_env_tables.ts
28872
- var migration35 = {
28932
+ var migration36 = {
28873
28933
  version: 4,
28874
28934
  async up(sql) {
28875
28935
  sql.exec(`ALTER TABLE threads ADD COLUMN env TEXT`);
@@ -28893,7 +28953,7 @@ var migration35 = {
28893
28953
  };
28894
28954
 
28895
28955
  // src/durable-objects/agentbuilder-migrations/0005_add_pending_subagent_env_requests.ts
28896
- var migration36 = {
28956
+ var migration37 = {
28897
28957
  version: 5,
28898
28958
  async up(sql) {
28899
28959
  sql.exec(`
@@ -28919,7 +28979,7 @@ var migration36 = {
28919
28979
  };
28920
28980
 
28921
28981
  // src/durable-objects/agentbuilder-migrations/0006_add_env_value_types.ts
28922
- var migration37 = {
28982
+ var migration38 = {
28923
28983
  version: 6,
28924
28984
  async up(sql) {
28925
28985
  sql.exec(
@@ -28934,7 +28994,7 @@ var migration37 = {
28934
28994
  };
28935
28995
 
28936
28996
  // src/durable-objects/agentbuilder-migrations/0007_platform_identity_replica.ts
28937
- var migration38 = {
28997
+ var migration39 = {
28938
28998
  version: 7,
28939
28999
  async up(sql) {
28940
29000
  sql.exec(`ALTER TABLE users ADD COLUMN platform_user_id TEXT`);
@@ -28963,7 +29023,7 @@ var migration38 = {
28963
29023
  };
28964
29024
 
28965
29025
  // src/durable-objects/agentbuilder-migrations/0008_add_skills.ts
28966
- var migration39 = {
29026
+ var migration40 = {
28967
29027
  version: 8,
28968
29028
  async up(sql) {
28969
29029
  sql.exec(`
@@ -28994,7 +29054,7 @@ var migration39 = {
28994
29054
  };
28995
29055
 
28996
29056
  // src/durable-objects/agentbuilder-migrations/0009_add_user_permissions.ts
28997
- var migration40 = {
29057
+ var migration41 = {
28998
29058
  version: 9,
28999
29059
  async up(sql) {
29000
29060
  sql.exec(`ALTER TABLE users ADD COLUMN permissions TEXT`);
@@ -29005,7 +29065,7 @@ var migration40 = {
29005
29065
  };
29006
29066
 
29007
29067
  // src/durable-objects/agentbuilder-migrations/0010_add_device_logins.ts
29008
- var migration41 = {
29068
+ var migration42 = {
29009
29069
  version: 10,
29010
29070
  async up(sql) {
29011
29071
  sql.exec(`
@@ -29025,7 +29085,7 @@ var migration41 = {
29025
29085
  };
29026
29086
 
29027
29087
  // src/durable-objects/agentbuilder-migrations/index.ts
29028
- var migrations2 = [migration32, migration33, migration34, migration35, migration36, migration37, migration38, migration39, migration40, migration41];
29088
+ var migrations2 = [migration33, migration34, migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42];
29029
29089
  var LATEST_SCHEMA_VERSION2 = 10;
29030
29090
 
29031
29091
  // src/utils/crypto.ts
@@ -29788,9 +29848,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
29788
29848
  }
29789
29849
  }
29790
29850
  async runMigrations(fromVersion) {
29791
- for (const migration42 of migrations2) {
29792
- if (migration42.version > fromVersion) {
29793
- await migration42.up(this.ctx.storage.sql);
29851
+ for (const migration43 of migrations2) {
29852
+ if (migration43.version > fromVersion) {
29853
+ await migration43.up(this.ctx.storage.sql);
29794
29854
  }
29795
29855
  }
29796
29856
  }