@standardagents/builder 0.24.3 → 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 +32 -19
  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 +61 -38
  30. package/dist/index.js.map +1 -1
  31. package/dist/runtime.d.ts +3 -2
  32. package/dist/runtime.js +61 -38
  33. package/dist/runtime.js.map +1 -1
  34. package/dist/test.d.ts +1 -1
  35. package/package.json +5 -5
@@ -252,14 +252,14 @@ function calculateUsageCost(usage, pricing) {
252
252
  const inputPrice = useLongContext ? pricing.longInputPrice ?? pricing.inputPrice : pricing.inputPrice;
253
253
  const outputPrice = useLongContext ? pricing.longOutputPrice ?? pricing.outputPrice : pricing.outputPrice;
254
254
  const cachedTokenPrice = useLongContext ? pricing.longCachedPrice ?? pricing.cachedPrice ?? pricing.inputPrice : pricing.cachedPrice ?? pricing.inputPrice;
255
- const costInput = roundCost(
256
- (uncachedPromptTokens * inputPrice + cachedTokens * cachedTokenPrice) / TOKENS_PER_MILLION
257
- );
255
+ const costInput = roundCost(uncachedPromptTokens * inputPrice / TOKENS_PER_MILLION);
256
+ const costCached = roundCost(cachedTokens * cachedTokenPrice / TOKENS_PER_MILLION);
258
257
  const costOutput = roundCost(billableOutputTokens * outputPrice / TOKENS_PER_MILLION);
259
258
  return {
260
259
  costInput,
260
+ costCached,
261
261
  costOutput,
262
- costTotal: roundCost(costInput + costOutput)
262
+ costTotal: roundCost(costInput + costCached + costOutput)
263
263
  };
264
264
  }
265
265
  var TOKENS_PER_MILLION;
@@ -1323,10 +1323,14 @@ function buildRequestBody(context, modelDef) {
1323
1323
  visionFiltering
1324
1324
  };
1325
1325
  }
1326
- function buildProviderRequest(context, modelDef, signal) {
1326
+ function buildProviderRequest(context, modelDef, signal, user) {
1327
1327
  const { requestBody } = buildRequestBody(context, modelDef);
1328
1328
  return {
1329
1329
  ...requestBody,
1330
+ // Stable per-thread identity: providers that support it (OpenRouter's
1331
+ // provider-sticky routing) pin the thread to one upstream, which is what
1332
+ // makes prompt caching hit across consecutive steps.
1333
+ user,
1330
1334
  signal
1331
1335
  };
1332
1336
  }
@@ -1673,7 +1677,7 @@ var init_LLMRequest = __esm({
1673
1677
  parentSignal.addEventListener("abort", onParentAbort, { once: true });
1674
1678
  }
1675
1679
  }
1676
- const request = buildProviderRequest(context, modelDef, streamAbort.signal);
1680
+ const request = buildProviderRequest(context, modelDef, streamAbort.signal, state.threadId);
1677
1681
  let response;
1678
1682
  await state.stream.waitFor(
1679
1683
  async () => {
@@ -2132,6 +2136,7 @@ var init_LLMRequest = __esm({
2132
2136
  reasoning_tokens: response.usage.completion_tokens_details?.reasoning_tokens || 0,
2133
2137
  total_tokens: response.usage.total_tokens,
2134
2138
  cost_input: calculatedCost?.costInput,
2139
+ cost_cached: calculatedCost?.costCached,
2135
2140
  cost_output: calculatedCost?.costOutput,
2136
2141
  latency_ms: Date.now() - startTime,
2137
2142
  time_to_first_token_ms: timing?.latencyMs ?? void 0,
@@ -2161,19 +2166,20 @@ var init_LLMRequest = __esm({
2161
2166
  reasoning_tokens = ?5,
2162
2167
  total_tokens = ?6,
2163
2168
  cost_input = ?7,
2164
- cost_output = ?8,
2165
- latency_ms = ?9,
2166
- finish_reason = ?10,
2167
- tools_called = ?11,
2168
- cost_total = ?12,
2169
- is_complete = ?13,
2170
- reasoning_content = ?14,
2171
- provider_tools = ?15,
2172
- actual_provider = ?16,
2173
- standard_agents_router_used = ?17,
2174
- time_to_first_token_ms = ?18,
2175
- generation_ms = ?19
2176
- WHERE id = ?20
2169
+ cost_cached = ?8,
2170
+ cost_output = ?9,
2171
+ latency_ms = ?10,
2172
+ finish_reason = ?11,
2173
+ tools_called = ?12,
2174
+ cost_total = ?13,
2175
+ is_complete = ?14,
2176
+ reasoning_content = ?15,
2177
+ provider_tools = ?16,
2178
+ actual_provider = ?17,
2179
+ standard_agents_router_used = ?18,
2180
+ time_to_first_token_ms = ?19,
2181
+ generation_ms = ?20
2182
+ WHERE id = ?21
2177
2183
  `,
2178
2184
  logData.response_body,
2179
2185
  logData.input_tokens,
@@ -2182,6 +2188,7 @@ var init_LLMRequest = __esm({
2182
2188
  logData.reasoning_tokens,
2183
2189
  logData.total_tokens,
2184
2190
  logData.cost_input ?? null,
2191
+ logData.cost_cached ?? null,
2185
2192
  logData.cost_output ?? null,
2186
2193
  logData.latency_ms,
2187
2194
  logData.finish_reason,
@@ -55224,6 +55231,9 @@ function buildChatParams3(request) {
55224
55231
  }
55225
55232
  }
55226
55233
  }
55234
+ if (request.user) {
55235
+ params.user = request.user;
55236
+ }
55227
55237
  const safeOptions = splitOpenRouterProviderOptions(
55228
55238
  request.providerOptions
55229
55239
  );
@@ -55745,6 +55755,9 @@ function buildCreateParams3(request) {
55745
55755
  }
55746
55756
  }
55747
55757
  }
55758
+ if (request.user) {
55759
+ params.user = request.user;
55760
+ }
55748
55761
  const providerOptions = splitOpenRouterProviderOptions(
55749
55762
  request.providerOptions
55750
55763
  );