@standardagents/builder 0.24.3 → 0.24.4

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.
@@ -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 () => {
@@ -55224,6 +55228,9 @@ function buildChatParams3(request) {
55224
55228
  }
55225
55229
  }
55226
55230
  }
55231
+ if (request.user) {
55232
+ params.user = request.user;
55233
+ }
55227
55234
  const safeOptions = splitOpenRouterProviderOptions(
55228
55235
  request.providerOptions
55229
55236
  );
@@ -55745,6 +55752,9 @@ function buildCreateParams3(request) {
55745
55752
  }
55746
55753
  }
55747
55754
  }
55755
+ if (request.user) {
55756
+ params.user = request.user;
55757
+ }
55748
55758
  const providerOptions = splitOpenRouterProviderOptions(
55749
55759
  request.providerOptions
55750
55760
  );