@t2000/mcp 5.15.0 → 5.16.0

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.
package/dist/bin.js CHANGED
@@ -79370,7 +79370,9 @@ function body(params, stream4) {
79370
79370
  return JSON.stringify({
79371
79371
  model: params.model,
79372
79372
  messages: params.messages,
79373
- ...stream4 ? { stream: true } : {},
79373
+ // include_usage the final stream chunk carries usage + x_receipt_id
79374
+ // (the confidential attestation receipt) so we can surface it after a stream.
79375
+ ...stream4 ? { stream: true, stream_options: { include_usage: true } } : {},
79374
79376
  ...params.maxTokens != null ? { max_tokens: params.maxTokens } : {},
79375
79377
  ...params.temperature != null ? { temperature: params.temperature } : {}
79376
79378
  });
@@ -79386,12 +79388,14 @@ async function chatCompletion(params) {
79386
79388
  if (!res.ok) {
79387
79389
  await failBody(res);
79388
79390
  }
79391
+ const receiptId = res.headers.get("x-receipt-id") ?? void 0;
79389
79392
  const raw = await res.json();
79390
79393
  const content = raw?.choices?.[0]?.message?.content ?? "";
79391
79394
  return {
79392
79395
  content,
79393
79396
  model: raw?.model ?? params.model,
79394
79397
  usage: usageOf(raw),
79398
+ receiptId,
79395
79399
  raw
79396
79400
  };
79397
79401
  }
@@ -79405,11 +79409,12 @@ async function* chatCompletionStream(params) {
79405
79409
  });
79406
79410
  if (!(res.ok && res.body)) {
79407
79411
  await failBody(res);
79408
- return;
79412
+ return {};
79409
79413
  }
79410
79414
  const reader = res.body.getReader();
79411
79415
  const decoder = new TextDecoder();
79412
79416
  let buffer = "";
79417
+ let receiptId;
79413
79418
  while (true) {
79414
79419
  const { done, value } = await reader.read();
79415
79420
  if (done) {
@@ -79425,10 +79430,13 @@ async function* chatCompletionStream(params) {
79425
79430
  }
79426
79431
  const data = trimmed.slice(5).trim();
79427
79432
  if (data === "[DONE]") {
79428
- return;
79433
+ return { receiptId };
79429
79434
  }
79430
79435
  try {
79431
79436
  const json = JSON.parse(data);
79437
+ if (json.x_receipt_id) {
79438
+ receiptId = json.x_receipt_id;
79439
+ }
79432
79440
  const delta = json.choices?.[0]?.delta?.content;
79433
79441
  if (typeof delta === "string" && delta) {
79434
79442
  yield delta;
@@ -79437,6 +79445,7 @@ async function* chatCompletionStream(params) {
79437
79445
  }
79438
79446
  }
79439
79447
  }
79448
+ return { receiptId };
79440
79449
  }
79441
79450
  async function listModels(opts) {
79442
79451
  const base = opts?.apiBase ?? DEFAULT_API_BASE;
@@ -79729,7 +79738,8 @@ var T2000 = class _T2000 extends import_index2.default {
79729
79738
  async chat(params) {
79730
79739
  return chatCompletion(params);
79731
79740
  }
79732
- /** Streaming chat completion — async-iterate the assistant text deltas. */
79741
+ /** Streaming chat completion — async-iterate the assistant text deltas;
79742
+ * the generator returns `{ receiptId }` (confidential attestation) at the end. */
79733
79743
  chatStream(params) {
79734
79744
  return chatCompletionStream(params);
79735
79745
  }
@@ -80456,7 +80466,10 @@ function registerChatTools(server) {
80456
80466
  text: JSON.stringify({
80457
80467
  model: res.model,
80458
80468
  content: res.content,
80459
- usage: res.usage
80469
+ usage: res.usage,
80470
+ // Confidential (phala/*) → a TEE attestation receipt id,
80471
+ // verifiable at /v1/aci/receipts/{id}.
80472
+ receiptId: res.receiptId
80460
80473
  })
80461
80474
  }
80462
80475
  ]
@@ -80552,7 +80565,7 @@ CRITICAL: When the user asks to use any external or paid API, names a provider (
80552
80565
  Spending is the user's own USDC and every t2000_pay call is bounded by maxPrice. For larger or multi-step spends, state the estimated cost first and proceed once the user is happy. Use t2000_balance to check funds. The v4 wallet is payments-only; savings / lending live on audric.ai.`;
80553
80566
 
80554
80567
  // src/index.ts
80555
- var PKG_VERSION = "5.15.0" ;
80568
+ var PKG_VERSION = "5.16.0" ;
80556
80569
  console.log = (...args) => console.error("[log]", ...args);
80557
80570
  console.warn = (...args) => console.error("[warn]", ...args);
80558
80571
  async function startMcpServer(opts) {