@t2000/sdk 5.20.0 → 5.21.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.cjs +15 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -46,6 +46,9 @@ interface ApiModel {
|
|
|
46
46
|
outputPer1M?: number;
|
|
47
47
|
/** Privacy tier surfaced by the API (e.g. `zdr`, `confidential`). */
|
|
48
48
|
privacy?: string;
|
|
49
|
+
/** True for reasoning models — deeper but slower (a hidden reasoning trace
|
|
50
|
+
* before the answer). Surfaced so callers pick the speed/depth tradeoff. */
|
|
51
|
+
reasoning?: boolean;
|
|
49
52
|
}
|
|
50
53
|
/** Non-streaming chat completion. Returns the assistant text + usage + the
|
|
51
54
|
* verbatim OpenAI response body. */
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,9 @@ interface ApiModel {
|
|
|
46
46
|
outputPer1M?: number;
|
|
47
47
|
/** Privacy tier surfaced by the API (e.g. `zdr`, `confidential`). */
|
|
48
48
|
privacy?: string;
|
|
49
|
+
/** True for reasoning models — deeper but slower (a hidden reasoning trace
|
|
50
|
+
* before the answer). Surfaced so callers pick the speed/depth tradeoff. */
|
|
51
|
+
reasoning?: boolean;
|
|
49
52
|
}
|
|
50
53
|
/** Non-streaming chat completion. Returns the assistant text + usage + the
|
|
51
54
|
* verbatim OpenAI response body. */
|
package/dist/index.js
CHANGED
|
@@ -2024,7 +2024,8 @@ async function listModels(opts) {
|
|
|
2024
2024
|
contextWindow: m.context_window ?? m.context_length,
|
|
2025
2025
|
inputPer1M: m.pricing?.input_per_1m ?? m.pricing?.prompt,
|
|
2026
2026
|
outputPer1M: m.pricing?.output_per_1m ?? m.pricing?.completion,
|
|
2027
|
-
privacy: m.privacy ?? m.privacy_tier
|
|
2027
|
+
privacy: m.privacy ?? m.privacy_tier,
|
|
2028
|
+
reasoning: m.reasoning
|
|
2028
2029
|
}));
|
|
2029
2030
|
}
|
|
2030
2031
|
var RECEIPT_ANCHORED_SUFFIX = "::anchor::ReceiptAnchored";
|
|
@@ -2133,7 +2134,15 @@ async function verifyTdxQuote(base, model, receiptWorkloadId) {
|
|
|
2133
2134
|
};
|
|
2134
2135
|
}
|
|
2135
2136
|
try {
|
|
2136
|
-
const
|
|
2137
|
+
const dcap = await import('@phala/dcap-qvl');
|
|
2138
|
+
const getCollateralAndVerify = dcap.getCollateralAndVerify ?? dcap.default?.getCollateralAndVerify;
|
|
2139
|
+
if (typeof getCollateralAndVerify !== "function") {
|
|
2140
|
+
return {
|
|
2141
|
+
status: "fail",
|
|
2142
|
+
forged: false,
|
|
2143
|
+
detail: "DCAP verifier unavailable in this build"
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2137
2146
|
const quoteBytes = hexToBytes(quoteHex.replace(/^0x/, ""));
|
|
2138
2147
|
const vr = await getCollateralAndVerify(quoteBytes);
|
|
2139
2148
|
const td = vr.report.asTd10() ?? vr.report.asTd15()?.base ?? null;
|
|
@@ -2259,7 +2268,6 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2259
2268
|
});
|
|
2260
2269
|
}
|
|
2261
2270
|
}
|
|
2262
|
-
let signatureForged = false;
|
|
2263
2271
|
let sigStatus = "skip";
|
|
2264
2272
|
let sigDetail = "no signature on receipt";
|
|
2265
2273
|
if (receipt.signature?.value) {
|
|
@@ -2276,7 +2284,6 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2276
2284
|
} else {
|
|
2277
2285
|
const ok = verifyReceiptSignature(receipt, att.signingKey);
|
|
2278
2286
|
sigStatus = ok ? "pass" : "fail";
|
|
2279
|
-
signatureForged = !ok;
|
|
2280
2287
|
sigDetail = ok ? `signed by the attested receipt key (${receipt.signature.key_id ?? "key"})` : "signature does NOT recover the attested receipt key \u2014 forged/altered";
|
|
2281
2288
|
}
|
|
2282
2289
|
} catch {
|
|
@@ -2289,7 +2296,6 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2289
2296
|
detail: sigDetail,
|
|
2290
2297
|
trust: sigStatus === "skip" ? "roadmap" : "trustless"
|
|
2291
2298
|
});
|
|
2292
|
-
let quoteForged = false;
|
|
2293
2299
|
if (opts.skipQuote) {
|
|
2294
2300
|
checks.push({
|
|
2295
2301
|
name: "TDX quote (DCAP)",
|
|
@@ -2303,7 +2309,6 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2303
2309
|
opts.model ?? "phala/glm-5.2",
|
|
2304
2310
|
workloadId ?? ""
|
|
2305
2311
|
);
|
|
2306
|
-
quoteForged = q.forged;
|
|
2307
2312
|
checks.push({
|
|
2308
2313
|
name: "TDX quote (DCAP)",
|
|
2309
2314
|
status: q.status,
|
|
@@ -2311,9 +2316,12 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2311
2316
|
trust: "trustless"
|
|
2312
2317
|
});
|
|
2313
2318
|
}
|
|
2319
|
+
const trustlessFailed = checks.some(
|
|
2320
|
+
(c) => c.trust === "trustless" && c.status === "fail"
|
|
2321
|
+
);
|
|
2314
2322
|
return {
|
|
2315
2323
|
receiptId,
|
|
2316
|
-
verified: Boolean(wireHash && workloadId) &&
|
|
2324
|
+
verified: Boolean(wireHash && workloadId) && !trustlessFailed,
|
|
2317
2325
|
anchorVerified,
|
|
2318
2326
|
checks,
|
|
2319
2327
|
wireHash,
|