@skrr-ai/cli 0.1.171 → 0.1.172

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 (43) hide show
  1. package/dist/commands/harnesses/models.d.ts +12 -0
  2. package/dist/commands/harnesses/models.js +14 -2
  3. package/dist/commands/harnesses/rollouts/grant.d.ts +21 -0
  4. package/dist/commands/harnesses/rollouts/grant.js +56 -0
  5. package/dist/commands/harnesses/rollouts/list.d.ts +24 -0
  6. package/dist/commands/harnesses/rollouts/list.js +87 -0
  7. package/dist/commands/harnesses/rollouts/revoke.d.ts +22 -0
  8. package/dist/commands/harnesses/rollouts/revoke.js +56 -0
  9. package/dist/commands/machines/hosted/exec.d.ts +19 -0
  10. package/dist/commands/machines/hosted/exec.js +59 -5
  11. package/dist/commands/machines/hosted/list.js +8 -1
  12. package/dist/commands/machines/hosted/start.js +10 -1
  13. package/dist/lib/first-party-harness-broker.js +6 -0
  14. package/dist/lib/harness-tiers.d.ts +6 -4
  15. package/dist/lib/harness-tiers.js +12 -10
  16. package/dist/lib/hosted-machines.d.ts +13 -0
  17. package/dist/lib/hosted-machines.js +34 -1
  18. package/dist/lib/provider-rollouts.d.ts +58 -0
  19. package/dist/lib/provider-rollouts.js +23 -0
  20. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.cjs +8 -0
  21. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.d.cts +23 -0
  22. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.json +2381 -0
  23. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.d.ts +11 -2
  24. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.js +1 -5
  25. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/inferenceBrokerHarnesses.d.ts +165 -0
  26. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/inferenceBrokerHarnesses.js +132 -0
  27. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.d.ts +11 -2
  28. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.js +1 -5
  29. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/inferenceBrokerHarnesses.d.ts +165 -0
  30. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/inferenceBrokerHarnesses.js +203 -0
  31. package/dist/node_modules/@skrr-ai/auth-core/package.json +14 -0
  32. package/dist/node_modules/@skrr-ai/data-provider/index.js +11598 -11591
  33. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +1 -1
  34. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +4 -0
  35. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +58 -1
  36. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +171 -61
  37. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +1 -1
  38. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +1 -1
  39. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +58 -1
  40. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +217 -88
  41. package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
  42. package/oclif.manifest.json +297 -4
  43. package/package.json +5 -2
@@ -60,19 +60,36 @@ export const INFERENCE_BROKER_SOCKET_ENV = 'OVERSKY_INFERENCE_BROKER_SOCKET';
60
60
  * some clients honour `*` only as the entire value.
61
61
  */
62
62
  export function inferenceBrokerNoProxyEnv(env) {
63
+ return noProxyEnvWithHosts(env, [INFERENCE_BROKER_HOST]);
64
+ }
65
+ /**
66
+ * The loopback hosts a `loopback-tcp` broker is reached on. A harness that
67
+ * honours HTTP(S)_PROXY would otherwise send its model traffic, relay token
68
+ * included, to the proxy instead of to this machine (OSK-24457).
69
+ */
70
+ export const LOOPBACK_BROKER_NO_PROXY_HOSTS = ['127.0.0.1', 'localhost'];
71
+ /**
72
+ * {@link inferenceBrokerNoProxyEnv} for any set of hosts: both spellings, each
73
+ * keeping its existing entries in order and gaining every missing host once.
74
+ */
75
+ export function noProxyEnvWithHosts(env, hosts) {
63
76
  const upper = nonEmpty(env.NO_PROXY);
64
77
  const lower = nonEmpty(env.no_proxy);
65
78
  return {
66
- NO_PROXY: withInferenceBrokerHost(upper ?? lower ?? ''),
67
- no_proxy: withInferenceBrokerHost(lower ?? upper ?? ''),
79
+ NO_PROXY: withNoProxyHosts(upper ?? lower ?? '', hosts),
80
+ no_proxy: withNoProxyHosts(lower ?? upper ?? '', hosts),
68
81
  };
69
82
  }
70
- function withInferenceBrokerHost(list) {
71
- const entries = list.split(',').map((entry) => entry.trim().toLowerCase());
72
- if (entries.includes('*') || entries.includes(INFERENCE_BROKER_HOST))
73
- return list;
74
- const kept = list.replace(WITH_INFERENCE_BROKER_HOST_RE, '');
75
- return kept ? `${kept},${INFERENCE_BROKER_HOST}` : INFERENCE_BROKER_HOST;
83
+ function withNoProxyHosts(list, hosts) {
84
+ let out = list;
85
+ for (const host of hosts) {
86
+ const entries = out.split(',').map((entry) => entry.trim().toLowerCase());
87
+ if (entries.includes('*') || entries.includes(host))
88
+ continue;
89
+ const kept = out.replace(WITH_INFERENCE_BROKER_HOST_RE, '');
90
+ out = kept ? `${kept},${host}` : host;
91
+ }
92
+ return out;
76
93
  }
77
94
  export const MANAGED_SESSION_ENV = 'OVERSKY_MANAGED_SESSION';
78
95
  export const MANAGED_PROMPT_CACHING_ENV = 'OVERSKY_MANAGED_PROMPT_CACHING';
@@ -91,6 +108,62 @@ const ANTHROPIC_ALLOWED_PATHS = new Set([
91
108
  '/chat/completions',
92
109
  ]);
93
110
  const OPENAI_COMPATIBLE_CHAT_PATHS = new Set(['/v1/chat/completions', '/chat/completions']);
111
+ const ANTHROPIC_MESSAGES_PATHS = new Set(['/v1/messages', '/messages']);
112
+ /**
113
+ * Anthropic's token-counting route. Claude Code calls it (`?beta=true`) to size
114
+ * context; the public relay has no route for it, and a count is not something a
115
+ * lease meters. So the broker answers it HERE, as the provider answers a route
116
+ * it does not serve, and Claude Code falls back to its own estimate. Nothing
117
+ * leaves the machine.
118
+ */
119
+ const ANTHROPIC_COUNT_TOKENS_PATHS = new Set([
120
+ '/v1/messages/count_tokens',
121
+ '/messages/count_tokens',
122
+ ]);
123
+ /**
124
+ * The only query a forwarded request may carry: the Anthropic SDK's beta
125
+ * marker, which Claude Code adds to every Messages call. It selects nothing
126
+ * upstream (the beta features travel in `anthropic-beta`), so it is dropped
127
+ * before forwarding. Any other query is refused rather than ignored, so a
128
+ * route cannot be widened through a parameter the broker never examined.
129
+ */
130
+ const ACCEPTED_ANTHROPIC_QUERY = 'beta=true';
131
+ /** Split an origin-form request target into its path and query. */
132
+ function brokerRequestTarget(target) {
133
+ const queryAt = target.indexOf('?');
134
+ if (queryAt === -1)
135
+ return { path: target, query: '' };
136
+ return { path: target.slice(0, queryAt), query: target.slice(queryAt + 1) };
137
+ }
138
+ /**
139
+ * The path a request may be forwarded under, with its query checked. Throws
140
+ * the broker's ordinary rejection for a query it does not accept.
141
+ */
142
+ function approvedRequestPath(target) {
143
+ if (target.query === '')
144
+ return target.path;
145
+ if (target.query === ACCEPTED_ANTHROPIC_QUERY &&
146
+ (ANTHROPIC_MESSAGES_PATHS.has(target.path) || ANTHROPIC_COUNT_TOKENS_PATHS.has(target.path))) {
147
+ return target.path;
148
+ }
149
+ rejectManagedRequest('managed inference broker denied a request query it does not accept');
150
+ }
151
+ function countTokensUnavailableResponse() {
152
+ const encoded = new TextEncoder().encode(JSON.stringify({
153
+ type: 'error',
154
+ error: {
155
+ type: 'not_found_error',
156
+ message: 'The managed inference broker does not serve token counting; estimate locally.',
157
+ },
158
+ }));
159
+ return {
160
+ status: 404,
161
+ headers: { 'content-type': 'application/json', 'cache-control': 'no-store' },
162
+ body: (async function* () {
163
+ yield encoded;
164
+ })(),
165
+ };
166
+ }
94
167
  const FORWARDED_HEADERS = new Set([
95
168
  'accept',
96
169
  'content-type',
@@ -179,21 +252,16 @@ export function buildManagedInferenceRelayCredential(credential, options) {
179
252
  authToken: sessionToken,
180
253
  };
181
254
  }
182
- /**
183
- * Start the daemon-local, request-envelope-constrained proxy.
184
- *
185
- * skrr Code is a multi-provider ACP runtime, so the child receives each dialect
186
- * it may select: OpenAI/OpenRouter and Anthropic. Every credential variable
187
- * contains the same daemon-local relay secret, never the LiteLLM virtual key.
188
- * The first-party engine must use one of these supplied base URLs for managed
189
- * execution; a failure to do so becomes an auth failure rather than a
190
- * direct-provider fallback.
191
- */
192
255
  export async function startManagedInferenceBroker(options) {
256
+ const transport = options.transport ?? 'unix-socket';
257
+ if (transport !== 'unix-socket' && transport !== 'loopback-tcp') {
258
+ throw new Error('managed inference broker received an unknown transport');
259
+ }
193
260
  const gatewayBase = nonEmpty(options.credential.baseUrl);
194
261
  const gatewayKey = nonEmpty(options.credential.authToken);
195
262
  const modelScope = isManagedInferenceModelScope(options.modelScope) ? options.modelScope : null;
196
263
  const legacyModel = nonEmpty(options.model);
264
+ const promptCacheControl = options.promptCacheControl === 'strip' ? 'strip' : 'refuse';
197
265
  if (!gatewayBase || !gatewayKey || (!modelScope && !legacyModel)) {
198
266
  throw new Error('managed inference broker requires gateway base URL, virtual key, and resolved model');
199
267
  }
@@ -326,10 +394,14 @@ export async function startManagedInferenceBroker(options) {
326
394
  if (request.path === MANAGED_STATUS_PATH) {
327
395
  return statusResponse();
328
396
  }
397
+ const target = brokerRequestTarget(request.path);
398
+ const path = approvedRequestPath(target);
399
+ if (ANTHROPIC_COUNT_TOKENS_PATHS.has(path))
400
+ return countTokensUnavailableResponse();
329
401
  const releaseSlot = acquireRequestSlot();
330
- const url = resolveGatewayUrl(gatewayBase, origin, request.path);
402
+ const url = resolveGatewayUrl(gatewayBase, origin, path);
331
403
  try {
332
- const body = assertApprovedEnvelope(request.method, request.path, request.body, modelScope, legacyModel);
404
+ const body = assertApprovedEnvelope(request.method, path, request.body, modelScope, legacyModel, promptCacheControl);
333
405
  const headers = new Headers();
334
406
  for (const [name, value] of Object.entries(request.headers)) {
335
407
  if (FORWARDED_HEADERS.has(name.toLowerCase()))
@@ -365,34 +437,51 @@ export async function startManagedInferenceBroker(options) {
365
437
  }
366
438
  },
367
439
  };
368
- if (process.platform === 'win32') {
369
- throw new Error('managed inference broker requires a verified local IPC transport on Windows');
370
- }
371
- // Keep below Unix-domain socket path limits even on macOS where os.tmpdir()
372
- // can be deeply nested. The random mkdtemp directory is private to this
373
- // daemon process; the socket itself is chmod 0600 by the listener.
374
- const socketDirectory = mkdtempSync('/tmp/oversky-inference-');
375
- const sharedSocketGroup = Number.isSafeInteger(options.socketGroupId);
376
- if (sharedSocketGroup) {
377
- chownSync(socketDirectory, typeof process.getuid === 'function' ? process.getuid() : -1, options.socketGroupId);
378
- }
379
- chmodSync(socketDirectory, sharedSocketGroup ? 0o750 : 0o700);
380
- const socketPath = join(socketDirectory, 'broker.sock');
381
- const server = new ModelProxyLoopbackServer({
382
- relayToken,
383
- forwarder,
384
- socketPath,
385
- ...(sharedSocketGroup ? { socketGroupId: options.socketGroupId } : {}),
386
- advertisedBaseUrl: INFERENCE_BROKER_ORIGIN,
387
- ...(envelope ? { maxBodyBytes: envelope.maxInputBytes } : {}),
388
- });
389
- try {
390
- await server.start();
391
- }
392
- catch (error) {
393
- rmSync(socketDirectory, { recursive: true, force: true });
394
- throw error;
395
- }
440
+ // The TCP transport has no file-mode fence, so the 256-bit relay token is the
441
+ // whole of its authentication. That is the same token the socket transport
442
+ // checks; the socket's 0600 mode is defence in depth this transport lacks.
443
+ const startListener = async () => {
444
+ if (transport === 'loopback-tcp') {
445
+ const tcp = new ModelProxyLoopbackServer({
446
+ relayToken,
447
+ forwarder,
448
+ host: '127.0.0.1',
449
+ port: 0,
450
+ ...(envelope ? { maxBodyBytes: envelope.maxInputBytes } : {}),
451
+ });
452
+ return { kind: 'tcp', server: tcp, origin: (await tcp.start()).baseUrl };
453
+ }
454
+ if (process.platform === 'win32') {
455
+ throw new Error('managed inference broker requires a verified local IPC transport on Windows');
456
+ }
457
+ // Keep below Unix-domain socket path limits even on macOS where os.tmpdir()
458
+ // can be deeply nested. The random mkdtemp directory is private to this
459
+ // daemon process; the socket itself is chmod 0600 by the listener.
460
+ const directory = mkdtempSync('/tmp/oversky-inference-');
461
+ const sharedSocketGroup = Number.isSafeInteger(options.socketGroupId);
462
+ if (sharedSocketGroup) {
463
+ chownSync(directory, typeof process.getuid === 'function' ? process.getuid() : -1, options.socketGroupId);
464
+ }
465
+ chmodSync(directory, sharedSocketGroup ? 0o750 : 0o700);
466
+ const path = join(directory, 'broker.sock');
467
+ const socket = new ModelProxyLoopbackServer({
468
+ relayToken,
469
+ forwarder,
470
+ socketPath: path,
471
+ ...(sharedSocketGroup ? { socketGroupId: options.socketGroupId } : {}),
472
+ advertisedBaseUrl: INFERENCE_BROKER_ORIGIN,
473
+ ...(envelope ? { maxBodyBytes: envelope.maxInputBytes } : {}),
474
+ });
475
+ try {
476
+ await socket.start();
477
+ }
478
+ catch (error) {
479
+ rmSync(directory, { recursive: true, force: true });
480
+ throw error;
481
+ }
482
+ return { kind: 'socket', server: socket, directory, path };
483
+ };
484
+ const listener = await startListener();
396
485
  let stopped = false;
397
486
  // OSK-3901 — arm the renewal heartbeat once the socket is live.
398
487
  //
@@ -489,6 +578,60 @@ export async function startManagedInferenceBroker(options) {
489
578
  },
490
579
  });
491
580
  }
581
+ const promptCachingEnv = modelScope?.requestEnvelope.allowPromptCaching && supportsManagedPromptCaching(modelScope)
582
+ ? { [MANAGED_PROMPT_CACHING_ENV]: '1' }
583
+ : {};
584
+ const leaseFields = {
585
+ ...(modelScope ? { clientModelId: managedClientModelId(modelScope) } : {}),
586
+ ...(envelope
587
+ ? {
588
+ reasoningPolicy: {
589
+ allowedEfforts: [...envelope.allowedReasoningEfforts],
590
+ defaultEffort: envelope.defaultReasoningEffort ?? envelope.allowedReasoningEfforts[0],
591
+ ...(envelope.selectedReasoningEffort
592
+ ? { requestedEffort: envelope.selectedReasoningEffort }
593
+ : {}),
594
+ ...(envelope.reasoningSelectionSource
595
+ ? { selectionSource: envelope.reasoningSelectionSource }
596
+ : {}),
597
+ },
598
+ }
599
+ : {}),
600
+ };
601
+ const stop = async () => {
602
+ if (stopped)
603
+ return;
604
+ stopped = true;
605
+ // Before the socket: a renewal in flight against a session that is ending
606
+ // would extend a lease nobody will use, and its timer would otherwise keep
607
+ // firing against a dead broker.
608
+ renewal?.stop();
609
+ await listener.server.stop();
610
+ if (listener.kind === 'socket')
611
+ rmSync(listener.directory, { recursive: true, force: true });
612
+ // Drop our own references promptly. JS cannot promise physical memory
613
+ // zeroization, but no subsequent request can authenticate upstream.
614
+ relayToken = '';
615
+ upstreamKey = '';
616
+ };
617
+ if (listener.kind === 'tcp') {
618
+ return {
619
+ // No bearer and no base URL in the environment: a TCP harness is given the
620
+ // endpoint through its SDK, so nothing it starts inherits the token.
621
+ env: { [MANAGED_SESSION_ENV]: '1', ...promptCachingEnv },
622
+ endpoint: {
623
+ origin: listener.origin,
624
+ upstreamProvider: modelScope?.upstreamProvider ?? null,
625
+ bearerToken: () => {
626
+ if (stopped || !relayToken)
627
+ throw new Error('managed inference broker is stopped');
628
+ return relayToken;
629
+ },
630
+ },
631
+ ...leaseFields,
632
+ stop,
633
+ };
634
+ }
492
635
  return {
493
636
  env: {
494
637
  OPENAI_BASE_URL: INFERENCE_BROKER_ORIGIN,
@@ -507,43 +650,13 @@ export async function startManagedInferenceBroker(options) {
507
650
  // Bearer capability that ModelProxyLoopbackServer validates.
508
651
  ANTHROPIC_BASE_URL: INFERENCE_BROKER_ORIGIN,
509
652
  ANTHROPIC_AUTH_TOKEN: relayToken,
510
- [INFERENCE_BROKER_SOCKET_ENV]: socketPath,
653
+ [INFERENCE_BROKER_SOCKET_ENV]: listener.path,
511
654
  [MANAGED_SESSION_ENV]: '1',
512
- ...(modelScope?.requestEnvelope.allowPromptCaching && supportsManagedPromptCaching(modelScope)
513
- ? { [MANAGED_PROMPT_CACHING_ENV]: '1' }
514
- : {}),
515
- },
516
- socketPath,
517
- ...(modelScope ? { clientModelId: managedClientModelId(modelScope) } : {}),
518
- ...(envelope
519
- ? {
520
- reasoningPolicy: {
521
- allowedEfforts: [...envelope.allowedReasoningEfforts],
522
- defaultEffort: envelope.defaultReasoningEffort ?? envelope.allowedReasoningEfforts[0],
523
- ...(envelope.selectedReasoningEffort
524
- ? { requestedEffort: envelope.selectedReasoningEffort }
525
- : {}),
526
- ...(envelope.reasoningSelectionSource
527
- ? { selectionSource: envelope.reasoningSelectionSource }
528
- : {}),
529
- },
530
- }
531
- : {}),
532
- async stop() {
533
- if (stopped)
534
- return;
535
- stopped = true;
536
- // Before the socket: a renewal in flight against a session that is ending
537
- // would extend a lease nobody will use, and its timer would otherwise keep
538
- // firing against a dead broker.
539
- renewal?.stop();
540
- await server.stop();
541
- rmSync(socketDirectory, { recursive: true, force: true });
542
- // Drop our own references promptly. JS cannot promise physical memory
543
- // zeroization, but no subsequent request can authenticate upstream.
544
- relayToken = '';
545
- upstreamKey = '';
655
+ ...promptCachingEnv,
546
656
  },
657
+ socketPath: listener.path,
658
+ ...leaseFields,
659
+ stop,
547
660
  };
548
661
  }
549
662
  /**
@@ -677,7 +790,7 @@ function resolveGatewayUrl(base, allowedOrigin, path) {
677
790
  }
678
791
  return url;
679
792
  }
680
- function assertApprovedEnvelope(method, path, body, modelScope, legacyModel) {
793
+ function assertApprovedEnvelope(method, path, body, modelScope, legacyModel, promptCacheControl = 'refuse') {
681
794
  if (method.toUpperCase() !== 'POST' || !ALLOWED_PATHS.has(path)) {
682
795
  rejectManagedRequest('managed inference broker denied an unapproved request method or route');
683
796
  }
@@ -729,7 +842,7 @@ function assertApprovedEnvelope(method, path, body, modelScope, legacyModel) {
729
842
  // the trusted daemon and guarantee the upstream always sees the alias the
730
843
  // key was actually minted for.
731
844
  payload.model = modelScope.wireModel;
732
- enforceRequestEnvelope(payload, path, modelScope.requestEnvelope, modelScope);
845
+ enforceRequestEnvelope(payload, path, modelScope.requestEnvelope, modelScope, promptCacheControl);
733
846
  const sanitized = new TextEncoder().encode(JSON.stringify(payload));
734
847
  if (sanitized.byteLength > modelScope.requestEnvelope.maxInputBytes) {
735
848
  rejectManagedRequest('managed inference broker input byte envelope exceeded');
@@ -741,7 +854,7 @@ function assertApprovedEnvelope(method, path, body, modelScope, legacyModel) {
741
854
  }
742
855
  return body;
743
856
  }
744
- function enforceRequestEnvelope(payload, path, envelope, modelScope) {
857
+ function enforceRequestEnvelope(payload, path, envelope, modelScope, promptCacheControl = 'refuse') {
745
858
  // LiteLLM merges `extra_body` after provider transformation. The child must
746
859
  // never use it to override model, spend, output, or cache fields already
747
860
  // checked by this broker and the authenticated API.
@@ -896,7 +1009,7 @@ function enforceRequestEnvelope(payload, path, envelope, modelScope) {
896
1009
  }
897
1010
  payload.max_reasoning_tokens = Math.min(value, envelope.maxReasoningTokens);
898
1011
  }
899
- enforcePromptCacheEnvelope(payload, envelope, modelScope);
1012
+ enforcePromptCacheEnvelope(payload, envelope, modelScope, promptCacheControl);
900
1013
  }
901
1014
  function rejectManagedRequest(message) {
902
1015
  throw new ModelProxyError(MODEL_PROXY_ERROR.REQUEST_REJECTED, message);
@@ -910,6 +1023,20 @@ function containsObjectKey(value, target) {
910
1023
  return (Object.prototype.hasOwnProperty.call(record, target) ||
911
1024
  Object.values(record).some((item) => containsObjectKey(item, target)));
912
1025
  }
1026
+ /** Remove every own `target` key, at any depth. Mutates `value`. */
1027
+ function deleteObjectKey(value, target) {
1028
+ if (Array.isArray(value)) {
1029
+ for (const item of value)
1030
+ deleteObjectKey(item, target);
1031
+ return;
1032
+ }
1033
+ if (!value || typeof value !== 'object')
1034
+ return;
1035
+ const record = value;
1036
+ delete record[target];
1037
+ for (const item of Object.values(record))
1038
+ deleteObjectKey(item, target);
1039
+ }
913
1040
  function objectKeyValues(value, target, found = []) {
914
1041
  if (Array.isArray(value)) {
915
1042
  for (const item of value)
@@ -943,7 +1070,7 @@ function supportsManagedPromptCaching(modelScope) {
943
1070
  *
944
1071
  * Source: https://developers.openai.com/api/docs/guides/prompt-caching
945
1072
  */
946
- function enforcePromptCacheEnvelope(payload, envelope, modelScope) {
1073
+ function enforcePromptCacheEnvelope(payload, envelope, modelScope, promptCacheControl = 'refuse') {
947
1074
  const model = nonEmpty(modelScope.wireModel)
948
1075
  ?.replace(SUPPORTS_MANAGED_PROMPT_CACHING_RE, '')
949
1076
  .toLowerCase();
@@ -953,6 +1080,8 @@ function enforcePromptCacheEnvelope(payload, envelope, modelScope) {
953
1080
  if (envelope.allowPromptCaching) {
954
1081
  rejectManagedRequest('managed inference broker has no prompt cache policy for the leased model');
955
1082
  }
1083
+ if (promptCacheControl === 'strip')
1084
+ deleteObjectKey(payload, 'cache_control');
956
1085
  if (containsObjectKey(payload, 'cache_control') ||
957
1086
  containsObjectKey(payload, 'prompt_cache_breakpoint') ||
958
1087
  payload.prompt_cache_key != null ||
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skrr-ai/inference-broker",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "main": "dist/cjs/index.js",
5
5
  "types": "dist/cjs/index.d.ts",
6
6
  "exports": {