@t2000/sdk 5.18.0 → 5.19.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 +22 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -76,6 +76,22 @@ interface VerifyAnchor {
|
|
|
76
76
|
anchoredBy?: string;
|
|
77
77
|
explorer: string;
|
|
78
78
|
}
|
|
79
|
+
/** A typed TCB claim from the attested upstream (dstack ACI §tcb-and-claims). */
|
|
80
|
+
interface UpstreamClaim {
|
|
81
|
+
name: string;
|
|
82
|
+
status: string;
|
|
83
|
+
source?: string;
|
|
84
|
+
}
|
|
85
|
+
interface VerifyUpstream {
|
|
86
|
+
provider?: string;
|
|
87
|
+
modelId?: string;
|
|
88
|
+
result?: string;
|
|
89
|
+
tcbStatus?: string;
|
|
90
|
+
/** The attested-session id (`as_…`) — resolve at GET /v1/aci/sessions/{id}. */
|
|
91
|
+
sessionId?: string;
|
|
92
|
+
/** Typed TCB claims (tee_attested, tcb_up_to_date, gpu_attested, …). */
|
|
93
|
+
claims?: UpstreamClaim[];
|
|
94
|
+
}
|
|
79
95
|
interface VerifyResult {
|
|
80
96
|
receiptId: string;
|
|
81
97
|
/** True iff the receipt resolved AND its on-chain Sui anchor matches. */
|
|
@@ -85,11 +101,7 @@ interface VerifyResult {
|
|
|
85
101
|
checks: VerifyCheck[];
|
|
86
102
|
wireHash?: string;
|
|
87
103
|
workloadId?: string;
|
|
88
|
-
upstream?:
|
|
89
|
-
provider?: string;
|
|
90
|
-
result?: string;
|
|
91
|
-
tcbStatus?: string;
|
|
92
|
-
};
|
|
104
|
+
upstream?: VerifyUpstream;
|
|
93
105
|
anchor?: VerifyAnchor;
|
|
94
106
|
}
|
|
95
107
|
interface VerifyOptions {
|
|
@@ -1070,4 +1082,4 @@ declare function fullHandle(label: string, parentName?: string): string;
|
|
|
1070
1082
|
*/
|
|
1071
1083
|
declare function displayHandle(label: string, parentName?: string): string;
|
|
1072
1084
|
|
|
1073
|
-
export { AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, type TrustMode, type VerifyAnchor, type VerifyCheck, type VerifyOptions, type VerifyResult, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, chatCompletion, chatCompletionStream, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
|
1085
|
+
export { AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, type TrustMode, type UpstreamClaim, type VerifyAnchor, type VerifyCheck, type VerifyOptions, type VerifyResult, type VerifyUpstream, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, chatCompletion, chatCompletionStream, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
package/dist/index.d.ts
CHANGED
|
@@ -76,6 +76,22 @@ interface VerifyAnchor {
|
|
|
76
76
|
anchoredBy?: string;
|
|
77
77
|
explorer: string;
|
|
78
78
|
}
|
|
79
|
+
/** A typed TCB claim from the attested upstream (dstack ACI §tcb-and-claims). */
|
|
80
|
+
interface UpstreamClaim {
|
|
81
|
+
name: string;
|
|
82
|
+
status: string;
|
|
83
|
+
source?: string;
|
|
84
|
+
}
|
|
85
|
+
interface VerifyUpstream {
|
|
86
|
+
provider?: string;
|
|
87
|
+
modelId?: string;
|
|
88
|
+
result?: string;
|
|
89
|
+
tcbStatus?: string;
|
|
90
|
+
/** The attested-session id (`as_…`) — resolve at GET /v1/aci/sessions/{id}. */
|
|
91
|
+
sessionId?: string;
|
|
92
|
+
/** Typed TCB claims (tee_attested, tcb_up_to_date, gpu_attested, …). */
|
|
93
|
+
claims?: UpstreamClaim[];
|
|
94
|
+
}
|
|
79
95
|
interface VerifyResult {
|
|
80
96
|
receiptId: string;
|
|
81
97
|
/** True iff the receipt resolved AND its on-chain Sui anchor matches. */
|
|
@@ -85,11 +101,7 @@ interface VerifyResult {
|
|
|
85
101
|
checks: VerifyCheck[];
|
|
86
102
|
wireHash?: string;
|
|
87
103
|
workloadId?: string;
|
|
88
|
-
upstream?:
|
|
89
|
-
provider?: string;
|
|
90
|
-
result?: string;
|
|
91
|
-
tcbStatus?: string;
|
|
92
|
-
};
|
|
104
|
+
upstream?: VerifyUpstream;
|
|
93
105
|
anchor?: VerifyAnchor;
|
|
94
106
|
}
|
|
95
107
|
interface VerifyOptions {
|
|
@@ -1070,4 +1082,4 @@ declare function fullHandle(label: string, parentName?: string): string;
|
|
|
1070
1082
|
*/
|
|
1071
1083
|
declare function displayHandle(label: string, parentName?: string): string;
|
|
1072
1084
|
|
|
1073
|
-
export { AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, type TrustMode, type VerifyAnchor, type VerifyCheck, type VerifyOptions, type VerifyResult, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, chatCompletion, chatCompletionStream, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
|
1085
|
+
export { AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, type TrustMode, type UpstreamClaim, type VerifyAnchor, type VerifyCheck, type VerifyOptions, type VerifyResult, type VerifyUpstream, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, chatCompletion, chatCompletionStream, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
package/dist/index.js
CHANGED
|
@@ -2028,6 +2028,23 @@ async function listModels(opts) {
|
|
|
2028
2028
|
}));
|
|
2029
2029
|
}
|
|
2030
2030
|
var RECEIPT_ANCHORED_SUFFIX = "::anchor::ReceiptAnchored";
|
|
2031
|
+
function normalizeClaims(claims) {
|
|
2032
|
+
if (!claims) {
|
|
2033
|
+
return [];
|
|
2034
|
+
}
|
|
2035
|
+
if (Array.isArray(claims)) {
|
|
2036
|
+
return claims.filter((c) => c.name).map((c) => ({
|
|
2037
|
+
name: c.name,
|
|
2038
|
+
status: c.status ?? "unknown",
|
|
2039
|
+
source: c.source
|
|
2040
|
+
}));
|
|
2041
|
+
}
|
|
2042
|
+
return Object.entries(claims).map(([name, v]) => ({
|
|
2043
|
+
name,
|
|
2044
|
+
status: v?.status ?? "unknown",
|
|
2045
|
+
source: v?.source
|
|
2046
|
+
}));
|
|
2047
|
+
}
|
|
2031
2048
|
function fullnodeUrl(network) {
|
|
2032
2049
|
return network === "testnet" ? "https://fullnode.testnet.sui.io" : "https://fullnode.mainnet.sui.io";
|
|
2033
2050
|
}
|
|
@@ -2121,6 +2138,7 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2121
2138
|
});
|
|
2122
2139
|
const upstreamEv = receipt.event_log.find((e) => e.type === "upstream.verified");
|
|
2123
2140
|
const upstreamOk = upstreamEv?.result === "verified";
|
|
2141
|
+
const claims = normalizeClaims(upstreamEv?.claims);
|
|
2124
2142
|
checks.push({
|
|
2125
2143
|
name: "Confidential upstream",
|
|
2126
2144
|
status: upstreamEv ? upstreamOk ? "pass" : "fail" : "skip",
|
|
@@ -2222,8 +2240,11 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2222
2240
|
workloadId,
|
|
2223
2241
|
upstream: upstreamEv ? {
|
|
2224
2242
|
provider: upstreamEv.provider ?? upstreamEv.upstream_name,
|
|
2243
|
+
modelId: upstreamEv.model_id,
|
|
2225
2244
|
result: upstreamEv.result,
|
|
2226
|
-
tcbStatus: upstreamEv.tcb_status
|
|
2245
|
+
tcbStatus: upstreamEv.tcb_status,
|
|
2246
|
+
sessionId: upstreamEv.session_id,
|
|
2247
|
+
claims: claims.length > 0 ? claims : void 0
|
|
2227
2248
|
} : void 0,
|
|
2228
2249
|
anchor
|
|
2229
2250
|
};
|