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