@nanogpt/private-mode 0.2.6 → 0.2.7

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 (2) hide show
  1. package/lib/server.js +4 -2
  2. package/package.json +1 -1
package/lib/server.js CHANGED
@@ -183,8 +183,9 @@ async function runPreflight({ apiBase, apiKey, model, req, requestBodyBytes }) {
183
183
  try {
184
184
  const data = await response.json();
185
185
  const cacheScope = typeof data?.cacheScope === 'string' ? data.cacheScope.trim() : '';
186
- if (/^[a-f0-9]{64}$/i.test(cacheScope)) {
187
- return { ok: true, cacheScope };
186
+ const preflightTicket = typeof data?.preflightTicket === 'string' ? data.preflightTicket.trim() : '';
187
+ if (/^[a-f0-9]{64}$/i.test(cacheScope) && preflightTicket) {
188
+ return { ok: true, cacheScope, preflightTicket };
188
189
  }
189
190
  } catch {}
190
191
 
@@ -312,6 +313,7 @@ async function handleChatCompletion({ apiBase, apiKey, secureState, req, res, co
312
313
  'x-nanogpt-private-model': model.id,
313
314
  'x-nanogpt-private-stream': privateStreamRequested ? 'true' : 'false',
314
315
  'x-nanogpt-private-cache-scope': buildPrivateModeCacheScopeProof(preflight.cacheScope),
316
+ 'x-nanogpt-private-preflight-ticket': preflight.preflightTicket,
315
317
  'x-query-source': 'api',
316
318
  ...copyLocalHeaders(req),
317
319
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanogpt/private-mode",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "OpenAI-compatible localhost proxy for NanoGPT Private Mode.",
5
5
  "type": "module",
6
6
  "publishConfig": {