@acosmi/sdk-ts 2.18.0 → 2.19.1
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/CHANGELOG.md +28 -0
- package/README.md +30 -2
- package/dist/browser/index.mjs +1228 -171
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +1228 -171
- package/dist/index.mjs.map +1 -1
- package/dist/node/adapters/anthropic.cjs.map +1 -1
- package/dist/node/adapters/anthropic.mjs.map +1 -1
- package/dist/node/adapters/openai.cjs +110 -45
- package/dist/node/adapters/openai.cjs.map +1 -1
- package/dist/node/adapters/openai.d.cts +1 -1
- package/dist/node/adapters/openai.d.ts +1 -1
- package/dist/node/adapters/openai.mjs +110 -45
- package/dist/node/adapters/openai.mjs.map +1 -1
- package/dist/node/index.cjs +1230 -170
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +376 -153
- package/dist/node/index.d.ts +376 -153
- package/dist/node/index.mjs +1228 -171
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{openai-Cyvi8g6B.d.ts → openai-BbCQOMNY.d.ts} +28 -1
- package/dist/node/{openai-DR_KhEdM.d.cts → openai-CMrvATF_.d.cts} +28 -1
- package/package.json +1 -1
package/dist/node/index.d.ts
CHANGED
|
@@ -1,11 +1,248 @@
|
|
|
1
|
-
import { a as AnthropicResponse } from './openai-
|
|
2
|
-
export { A as AnthropicContentBlock, b as AnthropicUsage, O as OpenAIAdapter, d as anthropicResponseTextContent, e as anthropicResponseThinkingContent, f as anthropicResponseToolUseBlocks } from './openai-
|
|
1
|
+
import { a as AnthropicResponse } from './openai-BbCQOMNY.js';
|
|
2
|
+
export { A as AnthropicContentBlock, b as AnthropicUsage, O as OpenAIAdapter, d as anthropicResponseTextContent, e as anthropicResponseThinkingContent, f as anthropicResponseToolUseBlocks } from './openai-BbCQOMNY.js';
|
|
3
3
|
import { M as ManagedModel, Q as QuotaSummary, U as WindowResetSummary, n as ModelCapabilities, e as ChatRequest, P as ProviderAdapter, f as ChatResponse, I as ImageGenerationRequest, k as ImageGenerationResponse, V as VideoGenerationRequest, K as VideoTaskResponse, i as EmbeddingRequest, j as EmbeddingResponse, r as RerankRequest, s as RerankResponse, y as StreamEvent, v as SourcesEvent, z as StreamSettlement, l as InputModality } from './index-C2oh157O.js';
|
|
4
4
|
export { B as BucketClassCommercial, a as BucketClassGeneric, b as BucketInfo, c as BucketRow, C as ChatContentBlock, d as ChatMessage, g as ChatUsage, E as EffortConfig, h as EmbeddingData, G as GeoLoc, m as InputModalityTag, o as MultimodalContent, O as OutputConfig, p as ProviderFormat, R as RerankDocument, q as RerankQuery, t as RerankResult, S as ServerTool, u as ServerToolTypeWebSearch, w as SourcesEventIssueCode, x as SourcesEventParseResult, T as ThinkingConfig, A as ThinkingHigh, D as ThinkingHighMinMaxTokens, F as ThinkingMax, H as ThinkingMaxFallbackMaxTokens, J as ThinkingOff, W as WebSearchConfig, L as WebSearchSource, N as WindowLimitStatus, X as bucketInfoIsCommercial, Y as bucketRowIsCommercial, Z as classifySourcesEvent, _ as getAdapter, $ as getAdapterForModel, a0 as newThinkingConfig, a1 as newWebSearchTool, a2 as parseSettlement, a3 as parseSourcesEvent } from './index-C2oh157O.js';
|
|
5
5
|
import { M as MinimalSanitizeConfig } from './index-Bah9A83R.js';
|
|
6
6
|
export { A as sanitize } from './index-Bah9A83R.js';
|
|
7
7
|
export { AnthropicAdapter } from './adapters/anthropic.js';
|
|
8
8
|
|
|
9
|
+
/** OAuth Authorization Server 元数据 (RFC 8414) */
|
|
10
|
+
interface ServerMetadata {
|
|
11
|
+
crabcode_auth_contract_version?: number;
|
|
12
|
+
gateway_error_contract_version?: number;
|
|
13
|
+
issuer: string;
|
|
14
|
+
authorization_endpoint: string;
|
|
15
|
+
token_endpoint: string;
|
|
16
|
+
revocation_endpoint: string;
|
|
17
|
+
registration_endpoint: string;
|
|
18
|
+
scopes_supported: string[];
|
|
19
|
+
}
|
|
20
|
+
/** OAuth token 响应 */
|
|
21
|
+
interface TokenResponse {
|
|
22
|
+
access_token: string;
|
|
23
|
+
token_type: string;
|
|
24
|
+
expires_in: number;
|
|
25
|
+
refresh_token?: string;
|
|
26
|
+
scope?: string;
|
|
27
|
+
}
|
|
28
|
+
/** 持久化 token 对 */
|
|
29
|
+
interface TokenSet {
|
|
30
|
+
access_token: string;
|
|
31
|
+
refresh_token: string;
|
|
32
|
+
/** ISO 8601 格式 */
|
|
33
|
+
expires_at: string;
|
|
34
|
+
scope: string;
|
|
35
|
+
client_id: string;
|
|
36
|
+
server_url: string;
|
|
37
|
+
}
|
|
38
|
+
/** token 是否已过期 (提前 30 秒视为过期) */
|
|
39
|
+
declare function tokenSetIsExpired(t: TokenSet): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 运行时校验任意值是否为合法 TokenSet 形状 (所有字段都是 string)。
|
|
42
|
+
*
|
|
43
|
+
* store 反序列化磁盘 / localStorage 的 JSON 后必须经此校验:
|
|
44
|
+
* 损坏文件、旧版本残留、缺字段都会被判为无效, 由 caller 当作"无 token"重新登录,
|
|
45
|
+
* 而不是把 `{}` / 缺字段对象直接 cast 成 TokenSet 后在 refresh 阶段炸出难懂的错误。
|
|
46
|
+
*/
|
|
47
|
+
declare function isValidTokenSet(x: unknown): x is TokenSet;
|
|
48
|
+
/** 动态注册响应 */
|
|
49
|
+
interface ClientRegistration {
|
|
50
|
+
client_id: string;
|
|
51
|
+
client_secret?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type CredentialState = 'signed_out' | 'pending_identity' | 'ready' | 'refresh_reserved' | 'refresh_dispatched' | 'reauth_required' | 'configuration_error';
|
|
55
|
+
type CredentialReason = 'invalid_grant' | 'refresh_outcome_unknown' | 'migration_required' | 'identity_unavailable' | 'invalid_client' | 'invalid_scope' | 'unsupported_grant_type' | 'auth_contract_unsupported';
|
|
56
|
+
interface CredentialAuthorityConfig {
|
|
57
|
+
serverURL: string;
|
|
58
|
+
issuer: string;
|
|
59
|
+
oauthProfile: 'desktop';
|
|
60
|
+
authContractVersion: 2;
|
|
61
|
+
errorContractVersion: 1;
|
|
62
|
+
}
|
|
63
|
+
interface CredentialPrincipal {
|
|
64
|
+
issuer: string;
|
|
65
|
+
subject: string;
|
|
66
|
+
organizationId: string | null;
|
|
67
|
+
}
|
|
68
|
+
interface CredentialRefreshOperation {
|
|
69
|
+
operationId: string;
|
|
70
|
+
sessionId: string;
|
|
71
|
+
baseRevision: string;
|
|
72
|
+
phase: 'reserved' | 'dispatched';
|
|
73
|
+
returnState: 'ready' | 'pending_identity';
|
|
74
|
+
startedAt: string;
|
|
75
|
+
dispatchedAt: string | null;
|
|
76
|
+
deadlineAt: string | null;
|
|
77
|
+
}
|
|
78
|
+
interface CredentialLoginAttempt {
|
|
79
|
+
attemptId: string;
|
|
80
|
+
baseSessionId: string | null;
|
|
81
|
+
startedAt: string;
|
|
82
|
+
}
|
|
83
|
+
interface VerifiedCredentialIdentity {
|
|
84
|
+
authSessionId: string;
|
|
85
|
+
principal: CredentialPrincipal;
|
|
86
|
+
displayName?: string;
|
|
87
|
+
avatarUrl?: string;
|
|
88
|
+
email?: string;
|
|
89
|
+
imageUrl?: string;
|
|
90
|
+
accountCreatedAt?: string;
|
|
91
|
+
requiresPhoneBinding?: boolean;
|
|
92
|
+
hasExtraUsageEnabled?: boolean;
|
|
93
|
+
billingType?: string;
|
|
94
|
+
subscriptionCreatedAt?: string;
|
|
95
|
+
rateLimitTier?: string;
|
|
96
|
+
organizationName?: string;
|
|
97
|
+
verifiedAt: string;
|
|
98
|
+
}
|
|
99
|
+
interface CredentialMutationReceipt {
|
|
100
|
+
mutationId: string;
|
|
101
|
+
operationId: string | null;
|
|
102
|
+
resultRevision: string;
|
|
103
|
+
}
|
|
104
|
+
/** Durable authoritative snapshot. Revisions are decimal strings to avoid JS truncation. */
|
|
105
|
+
interface CredentialSnapshot {
|
|
106
|
+
storeInstanceId: string;
|
|
107
|
+
authorityConfig: CredentialAuthorityConfig | null;
|
|
108
|
+
revision: string;
|
|
109
|
+
authSessionId: string | null;
|
|
110
|
+
principal: CredentialPrincipal | null;
|
|
111
|
+
credentialState: CredentialState;
|
|
112
|
+
tokenSet: TokenSet | null;
|
|
113
|
+
refreshOperation: CredentialRefreshOperation | null;
|
|
114
|
+
loginAttempt: CredentialLoginAttempt | null;
|
|
115
|
+
reason: CredentialReason | null;
|
|
116
|
+
lastMutation: CredentialMutationReceipt | null;
|
|
117
|
+
lastLoginAttemptId: string | null;
|
|
118
|
+
verifiedIdentity: VerifiedCredentialIdentity | null;
|
|
119
|
+
}
|
|
120
|
+
type CredentialRequestOwner = Pick<CredentialSnapshot, 'storeInstanceId' | 'authSessionId' | 'principal'>;
|
|
121
|
+
interface CredentialCASExpected {
|
|
122
|
+
storeInstanceId: string;
|
|
123
|
+
revision: string;
|
|
124
|
+
authSessionId: string | null;
|
|
125
|
+
state: CredentialState;
|
|
126
|
+
operationId: string | null;
|
|
127
|
+
}
|
|
128
|
+
type CredentialCASResult = {
|
|
129
|
+
status: 'committed';
|
|
130
|
+
snapshot: CredentialSnapshot;
|
|
131
|
+
} | {
|
|
132
|
+
status: 'superseded';
|
|
133
|
+
snapshot: CredentialSnapshot;
|
|
134
|
+
} | {
|
|
135
|
+
status: 'storage_error';
|
|
136
|
+
error: unknown;
|
|
137
|
+
};
|
|
138
|
+
/** Explicit opt-in store; versioned mode never calls TokenStore.save/load/clear. */
|
|
139
|
+
interface VersionedCredentialStore {
|
|
140
|
+
readSnapshot(signal?: AbortSignal): Promise<CredentialSnapshot>;
|
|
141
|
+
compareAndSwap(expected: CredentialCASExpected, nextState: CredentialSnapshot, mutationId: string, signal?: AbortSignal): Promise<CredentialCASResult>;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Token 持久化接口
|
|
145
|
+
* 桌面智能体可自行实现 (如 macOS Keychain / Windows Credential Manager)
|
|
146
|
+
*
|
|
147
|
+
* 跨端约定:
|
|
148
|
+
* - Save: 写入持久化, 失败抛 Error
|
|
149
|
+
* - Load: 读取, 不存在返回 null (与 Go IsNotExist 行为一致)
|
|
150
|
+
* - Clear: 删除, 不存在不抛错 (Logout 后 Clear 不应报错, [RC-11])
|
|
151
|
+
* - withLock (v1.0.2 新增, 可选): 跨进程临界区. Client 在 refresh token rotation
|
|
152
|
+
* 场景下用此包裹 "load → check → refresh → save" 整段, 防多进程共享同一 store
|
|
153
|
+
* (典型: FileTokenStore 默认 ~/.acosmi/tokens.json) 撞 HTTP 400 refresh token
|
|
154
|
+
* not found. 不实现时 Client 自动回退到仅进程内串行 (LocalStorage / InMemory
|
|
155
|
+
* 单进程语义无需此方法).
|
|
156
|
+
*/
|
|
157
|
+
interface TokenStore {
|
|
158
|
+
save(tokens: TokenSet): Promise<void>;
|
|
159
|
+
load(): Promise<TokenSet | null>;
|
|
160
|
+
clear(): Promise<void>;
|
|
161
|
+
withLock?<T>(fn: () => Promise<T>): Promise<T>;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 基于文件的 token 存储 (开发/测试用)
|
|
165
|
+
* 生产环境建议替换为系统钥匙串实现
|
|
166
|
+
*
|
|
167
|
+
* 默认路径: ~/.acosmi/tokens.json
|
|
168
|
+
*
|
|
169
|
+
* 浏览器环境调用 new FileTokenStore() 会抛错 — 浏览器请用 LocalStorageTokenStore 或 InMemoryTokenStore.
|
|
170
|
+
*/
|
|
171
|
+
/** 跨进程文件锁配置 (v1.0.2). 公开常量是为了让 caller / 测试可观察, 不建议生产代码改. */
|
|
172
|
+
declare const fileLockDefaults: {
|
|
173
|
+
/** 获取锁的超时上限 (毫秒). refresh 流程含网络 < 30s, 30s 已远超正常完成时间. */
|
|
174
|
+
readonly acquireTimeoutMs: 30000;
|
|
175
|
+
/** 旧锁判定阈值 (毫秒). 锁文件 mtime 早于此值视为 stale 进程崩溃残留, 自动 break. */
|
|
176
|
+
readonly staleMs: 60000;
|
|
177
|
+
/** 重试间隔基数 (毫秒). 真实间隔 = base + random(0, jitter). */
|
|
178
|
+
readonly retryBaseMs: 30;
|
|
179
|
+
readonly retryJitterMs: 70;
|
|
180
|
+
};
|
|
181
|
+
declare class FileTokenStore implements TokenStore {
|
|
182
|
+
private path;
|
|
183
|
+
/** 进程内串行化 (Promise chain) — 与跨进程 flock 配合, 避免单进程内并发持锁产生死锁式互等. */
|
|
184
|
+
private chain;
|
|
185
|
+
constructor(path?: string);
|
|
186
|
+
private resolvePath;
|
|
187
|
+
/** 进程内串行 (维持 v1.0.1 单进程语义). flock 之外另一层防御: 如果用户自己就是单进程
|
|
188
|
+
* 并发场景, 不必每次都进 flock 旁路文件 IO. */
|
|
189
|
+
private withChain;
|
|
190
|
+
/**
|
|
191
|
+
* 跨进程临界区. 用 sidecar `<path>.lock` 文件 + O_EXCL 创建语义实现互斥:
|
|
192
|
+
* - 创建成功 = 持有锁; 写入 pid+timestamp 便于诊断
|
|
193
|
+
* - 创建失败 (EEXIST) = 别的进程持锁, backoff 重试
|
|
194
|
+
* - 锁文件 mtime > staleMs = 进程崩溃残留, unlink 后重试
|
|
195
|
+
* - acquireTimeoutMs 超时 = 抛错 (caller 应作为 transient error 处理, 上层 retry)
|
|
196
|
+
*
|
|
197
|
+
* 注意: O_EXCL 在 NFS 上不保证原子; FileTokenStore 适用于本地文件系统 (典型用户家目录).
|
|
198
|
+
* 真要跨机共享 token, 应实现自定义 Keychain / 数据库 store, 不要用 FileTokenStore.
|
|
199
|
+
*/
|
|
200
|
+
withLock<T>(fn: () => Promise<T>): Promise<T>;
|
|
201
|
+
/**
|
|
202
|
+
* 写入 token. 流程:
|
|
203
|
+
* 1. mkdir -p (默认路径目录)
|
|
204
|
+
* 2. 写入 `<path>.tmp.<pid>`
|
|
205
|
+
* 3. fsync 后 rename 到正式路径 (POSIX 上 rename(2) 同分区原子, Windows 上 ReplaceFile)
|
|
206
|
+
*
|
|
207
|
+
* 选择 atomic rename 而非直接 writeFile: 多进程并发或本进程崩溃时, 读端永远看到的是
|
|
208
|
+
* 完整的旧/新 JSON, 不会读到截断半文件 (Client.create.store.load 可能在另一进程
|
|
209
|
+
* 写入中间触发, atomic rename 避免它解析失败).
|
|
210
|
+
*/
|
|
211
|
+
save(tokens: TokenSet): Promise<void>;
|
|
212
|
+
load(): Promise<TokenSet | null>;
|
|
213
|
+
clear(): Promise<void>;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* 创建文件 token 存储 (与 Go NewFileTokenStore 等价)
|
|
217
|
+
* @param path 自定义路径; 空则使用默认 ~/.acosmi/tokens.json
|
|
218
|
+
*/
|
|
219
|
+
declare function newFileTokenStore(path?: string): FileTokenStore;
|
|
220
|
+
/**
|
|
221
|
+
* 基于 LocalStorage 的 token 存储 (浏览器)
|
|
222
|
+
*
|
|
223
|
+
* 仅在浏览器环境可用 (检测 globalThis.localStorage)。
|
|
224
|
+
* 不持久化跨设备同步, 适合单机 SPA 使用。
|
|
225
|
+
*/
|
|
226
|
+
declare class LocalStorageTokenStore implements TokenStore {
|
|
227
|
+
private key;
|
|
228
|
+
constructor(key?: string);
|
|
229
|
+
save(tokens: TokenSet): Promise<void>;
|
|
230
|
+
load(): Promise<TokenSet | null>;
|
|
231
|
+
clear(): Promise<void>;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* 内存 token 存储 (不持久化, 进程重启即丢失)
|
|
235
|
+
* 适合: 测试 / Deno script / 短期 SDK 调用 / 不希望落盘的安全场景
|
|
236
|
+
*/
|
|
237
|
+
declare class InMemoryTokenStore implements TokenStore {
|
|
238
|
+
private tokens;
|
|
239
|
+
save(tokens: TokenSet): Promise<void>;
|
|
240
|
+
load(): Promise<TokenSet | null>;
|
|
241
|
+
clear(): Promise<void>;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
type CredentialStateNotification = Omit<CredentialSnapshot, 'tokenSet'>;
|
|
245
|
+
|
|
9
246
|
/** 权益余额 (聚合)。token* 单位双体系: 免费=Token / 付费(TOKEN_PACKAGE,SUBSCRIPTION)=微Credits(÷1000=Credits)。 */
|
|
10
247
|
interface EntitlementBalance {
|
|
11
248
|
totalTokenQuota: number;
|
|
@@ -201,49 +438,6 @@ interface Transaction {
|
|
|
201
438
|
createdAt: string;
|
|
202
439
|
}
|
|
203
440
|
|
|
204
|
-
/** OAuth Authorization Server 元数据 (RFC 8414) */
|
|
205
|
-
interface ServerMetadata {
|
|
206
|
-
issuer: string;
|
|
207
|
-
authorization_endpoint: string;
|
|
208
|
-
token_endpoint: string;
|
|
209
|
-
revocation_endpoint: string;
|
|
210
|
-
registration_endpoint: string;
|
|
211
|
-
scopes_supported: string[];
|
|
212
|
-
}
|
|
213
|
-
/** OAuth token 响应 */
|
|
214
|
-
interface TokenResponse {
|
|
215
|
-
access_token: string;
|
|
216
|
-
token_type: string;
|
|
217
|
-
expires_in: number;
|
|
218
|
-
refresh_token?: string;
|
|
219
|
-
scope?: string;
|
|
220
|
-
}
|
|
221
|
-
/** 持久化 token 对 */
|
|
222
|
-
interface TokenSet {
|
|
223
|
-
access_token: string;
|
|
224
|
-
refresh_token: string;
|
|
225
|
-
/** ISO 8601 格式 */
|
|
226
|
-
expires_at: string;
|
|
227
|
-
scope: string;
|
|
228
|
-
client_id: string;
|
|
229
|
-
server_url: string;
|
|
230
|
-
}
|
|
231
|
-
/** token 是否已过期 (提前 30 秒视为过期) */
|
|
232
|
-
declare function tokenSetIsExpired(t: TokenSet): boolean;
|
|
233
|
-
/**
|
|
234
|
-
* 运行时校验任意值是否为合法 TokenSet 形状 (所有字段都是 string)。
|
|
235
|
-
*
|
|
236
|
-
* store 反序列化磁盘 / localStorage 的 JSON 后必须经此校验:
|
|
237
|
-
* 损坏文件、旧版本残留、缺字段都会被判为无效, 由 caller 当作"无 token"重新登录,
|
|
238
|
-
* 而不是把 `{}` / 缺字段对象直接 cast 成 TokenSet 后在 refresh 阶段炸出难懂的错误。
|
|
239
|
-
*/
|
|
240
|
-
declare function isValidTokenSet(x: unknown): x is TokenSet;
|
|
241
|
-
/** 动态注册响应 */
|
|
242
|
-
interface ClientRegistration {
|
|
243
|
-
client_id: string;
|
|
244
|
-
client_secret?: string;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
441
|
declare class OAuthTokenEndpointError extends Error {
|
|
248
442
|
readonly status: number;
|
|
249
443
|
readonly oauthError: string;
|
|
@@ -313,7 +507,7 @@ type LoginEventType = 'auth_url' | 'complete' | 'error';
|
|
|
313
507
|
declare const EventAuthURL: "auth_url";
|
|
314
508
|
declare const EventComplete: "complete";
|
|
315
509
|
declare const EventError: "error";
|
|
316
|
-
type LoginErrCode = 'discovery_failed' | 'registration_failed' | 'browser_open_failed' | 'auth_denied' | 'auth_timeout' | 'token_exchange_failed' | 'ssl_proxy_detected' | 'state_mismatch';
|
|
510
|
+
type LoginErrCode = 'discovery_failed' | 'registration_failed' | 'browser_open_failed' | 'auth_denied' | 'auth_timeout' | 'token_exchange_failed' | 'ssl_proxy_detected' | 'state_mismatch' | 'credential_install_rejected';
|
|
317
511
|
declare const ErrDiscovery: "discovery_failed";
|
|
318
512
|
declare const ErrRegistration: "registration_failed";
|
|
319
513
|
declare const ErrBrowserOpen: "browser_open_failed";
|
|
@@ -325,6 +519,7 @@ declare const ErrSSLProxy: "ssl_proxy_detected";
|
|
|
325
519
|
declare const ErrStateMismatch: "state_mismatch";
|
|
326
520
|
/** 登录流程事件 */
|
|
327
521
|
interface LoginEvent {
|
|
522
|
+
attemptId?: string;
|
|
328
523
|
type: LoginEventType;
|
|
329
524
|
url?: string;
|
|
330
525
|
error?: string;
|
|
@@ -466,107 +661,6 @@ declare function revokeToken(meta: ServerMetadata, token: string, signal?: Abort
|
|
|
466
661
|
*/
|
|
467
662
|
declare function newTokenSet(resp: TokenResponse, clientID: string, serverURL: string): TokenSet;
|
|
468
663
|
|
|
469
|
-
/**
|
|
470
|
-
* Token 持久化接口
|
|
471
|
-
* 桌面智能体可自行实现 (如 macOS Keychain / Windows Credential Manager)
|
|
472
|
-
*
|
|
473
|
-
* 跨端约定:
|
|
474
|
-
* - Save: 写入持久化, 失败抛 Error
|
|
475
|
-
* - Load: 读取, 不存在返回 null (与 Go IsNotExist 行为一致)
|
|
476
|
-
* - Clear: 删除, 不存在不抛错 (Logout 后 Clear 不应报错, [RC-11])
|
|
477
|
-
* - withLock (v1.0.2 新增, 可选): 跨进程临界区. Client 在 refresh token rotation
|
|
478
|
-
* 场景下用此包裹 "load → check → refresh → save" 整段, 防多进程共享同一 store
|
|
479
|
-
* (典型: FileTokenStore 默认 ~/.acosmi/tokens.json) 撞 HTTP 400 refresh token
|
|
480
|
-
* not found. 不实现时 Client 自动回退到仅进程内串行 (LocalStorage / InMemory
|
|
481
|
-
* 单进程语义无需此方法).
|
|
482
|
-
*/
|
|
483
|
-
interface TokenStore {
|
|
484
|
-
save(tokens: TokenSet): Promise<void>;
|
|
485
|
-
load(): Promise<TokenSet | null>;
|
|
486
|
-
clear(): Promise<void>;
|
|
487
|
-
withLock?<T>(fn: () => Promise<T>): Promise<T>;
|
|
488
|
-
}
|
|
489
|
-
/**
|
|
490
|
-
* 基于文件的 token 存储 (开发/测试用)
|
|
491
|
-
* 生产环境建议替换为系统钥匙串实现
|
|
492
|
-
*
|
|
493
|
-
* 默认路径: ~/.acosmi/tokens.json
|
|
494
|
-
*
|
|
495
|
-
* 浏览器环境调用 new FileTokenStore() 会抛错 — 浏览器请用 LocalStorageTokenStore 或 InMemoryTokenStore.
|
|
496
|
-
*/
|
|
497
|
-
/** 跨进程文件锁配置 (v1.0.2). 公开常量是为了让 caller / 测试可观察, 不建议生产代码改. */
|
|
498
|
-
declare const fileLockDefaults: {
|
|
499
|
-
/** 获取锁的超时上限 (毫秒). refresh 流程含网络 < 30s, 30s 已远超正常完成时间. */
|
|
500
|
-
readonly acquireTimeoutMs: 30000;
|
|
501
|
-
/** 旧锁判定阈值 (毫秒). 锁文件 mtime 早于此值视为 stale 进程崩溃残留, 自动 break. */
|
|
502
|
-
readonly staleMs: 60000;
|
|
503
|
-
/** 重试间隔基数 (毫秒). 真实间隔 = base + random(0, jitter). */
|
|
504
|
-
readonly retryBaseMs: 30;
|
|
505
|
-
readonly retryJitterMs: 70;
|
|
506
|
-
};
|
|
507
|
-
declare class FileTokenStore implements TokenStore {
|
|
508
|
-
private path;
|
|
509
|
-
/** 进程内串行化 (Promise chain) — 与跨进程 flock 配合, 避免单进程内并发持锁产生死锁式互等. */
|
|
510
|
-
private chain;
|
|
511
|
-
constructor(path?: string);
|
|
512
|
-
private resolvePath;
|
|
513
|
-
/** 进程内串行 (维持 v1.0.1 单进程语义). flock 之外另一层防御: 如果用户自己就是单进程
|
|
514
|
-
* 并发场景, 不必每次都进 flock 旁路文件 IO. */
|
|
515
|
-
private withChain;
|
|
516
|
-
/**
|
|
517
|
-
* 跨进程临界区. 用 sidecar `<path>.lock` 文件 + O_EXCL 创建语义实现互斥:
|
|
518
|
-
* - 创建成功 = 持有锁; 写入 pid+timestamp 便于诊断
|
|
519
|
-
* - 创建失败 (EEXIST) = 别的进程持锁, backoff 重试
|
|
520
|
-
* - 锁文件 mtime > staleMs = 进程崩溃残留, unlink 后重试
|
|
521
|
-
* - acquireTimeoutMs 超时 = 抛错 (caller 应作为 transient error 处理, 上层 retry)
|
|
522
|
-
*
|
|
523
|
-
* 注意: O_EXCL 在 NFS 上不保证原子; FileTokenStore 适用于本地文件系统 (典型用户家目录).
|
|
524
|
-
* 真要跨机共享 token, 应实现自定义 Keychain / 数据库 store, 不要用 FileTokenStore.
|
|
525
|
-
*/
|
|
526
|
-
withLock<T>(fn: () => Promise<T>): Promise<T>;
|
|
527
|
-
/**
|
|
528
|
-
* 写入 token. 流程:
|
|
529
|
-
* 1. mkdir -p (默认路径目录)
|
|
530
|
-
* 2. 写入 `<path>.tmp.<pid>`
|
|
531
|
-
* 3. fsync 后 rename 到正式路径 (POSIX 上 rename(2) 同分区原子, Windows 上 ReplaceFile)
|
|
532
|
-
*
|
|
533
|
-
* 选择 atomic rename 而非直接 writeFile: 多进程并发或本进程崩溃时, 读端永远看到的是
|
|
534
|
-
* 完整的旧/新 JSON, 不会读到截断半文件 (Client.create.store.load 可能在另一进程
|
|
535
|
-
* 写入中间触发, atomic rename 避免它解析失败).
|
|
536
|
-
*/
|
|
537
|
-
save(tokens: TokenSet): Promise<void>;
|
|
538
|
-
load(): Promise<TokenSet | null>;
|
|
539
|
-
clear(): Promise<void>;
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* 创建文件 token 存储 (与 Go NewFileTokenStore 等价)
|
|
543
|
-
* @param path 自定义路径; 空则使用默认 ~/.acosmi/tokens.json
|
|
544
|
-
*/
|
|
545
|
-
declare function newFileTokenStore(path?: string): FileTokenStore;
|
|
546
|
-
/**
|
|
547
|
-
* 基于 LocalStorage 的 token 存储 (浏览器)
|
|
548
|
-
*
|
|
549
|
-
* 仅在浏览器环境可用 (检测 globalThis.localStorage)。
|
|
550
|
-
* 不持久化跨设备同步, 适合单机 SPA 使用。
|
|
551
|
-
*/
|
|
552
|
-
declare class LocalStorageTokenStore implements TokenStore {
|
|
553
|
-
private key;
|
|
554
|
-
constructor(key?: string);
|
|
555
|
-
save(tokens: TokenSet): Promise<void>;
|
|
556
|
-
load(): Promise<TokenSet | null>;
|
|
557
|
-
clear(): Promise<void>;
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* 内存 token 存储 (不持久化, 进程重启即丢失)
|
|
561
|
-
* 适合: 测试 / Deno script / 短期 SDK 调用 / 不希望落盘的安全场景
|
|
562
|
-
*/
|
|
563
|
-
declare class InMemoryTokenStore implements TokenStore {
|
|
564
|
-
private tokens;
|
|
565
|
-
save(tokens: TokenSet): Promise<void>;
|
|
566
|
-
load(): Promise<TokenSet | null>;
|
|
567
|
-
clear(): Promise<void>;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
664
|
/** 表示一次 retry 评估的请求快照 — 仅供 SafeToRetry 闸门使用 */
|
|
571
665
|
interface RetryRequestInfo {
|
|
572
666
|
method: string;
|
|
@@ -707,6 +801,21 @@ interface Config {
|
|
|
707
801
|
baseUrl?: string;
|
|
708
802
|
/** token 持久化实现, 缺省时按平台选 (Node File / Browser LocalStorage / Memory) */
|
|
709
803
|
store?: TokenStore;
|
|
804
|
+
/** Opt-in durable CAS credential lifecycle. Legacy callers omit this field. */
|
|
805
|
+
credentialMode?: 'legacy' | 'versioned' | 'external';
|
|
806
|
+
/** Required exactly when credentialMode is versioned. */
|
|
807
|
+
versionedCredentialStore?: VersionedCredentialStore;
|
|
808
|
+
/** Optional owner fence for requests issued by this versioned Client. */
|
|
809
|
+
credentialRequestOwner?: CredentialRequestOwner;
|
|
810
|
+
/** Supplies a source-owned access token for each request in external mode. */
|
|
811
|
+
accessTokenProvider?: (signal?: AbortSignal) => Promise<string> | string;
|
|
812
|
+
/** Runs after a new authorization-code exchange and before durable install. */
|
|
813
|
+
beforeCredentialInstall?: (input: {
|
|
814
|
+
accessToken: string;
|
|
815
|
+
attemptId: string;
|
|
816
|
+
serverURL: string;
|
|
817
|
+
clientId: string;
|
|
818
|
+
}, signal?: AbortSignal) => Promise<void> | void;
|
|
710
819
|
/** 自定义 fetch 实现 (默认 globalThis.fetch) */
|
|
711
820
|
fetchImpl?: typeof fetch;
|
|
712
821
|
/**
|
|
@@ -804,6 +913,32 @@ declare const CHAT_REQUEST_TIMEOUT_MS: number;
|
|
|
804
913
|
* 回调抛错会被吞掉且不中断流 (它是旁路信号, 不该有能力杀死主链路)。
|
|
805
914
|
*/
|
|
806
915
|
type UpstreamActivityCallback = () => void;
|
|
916
|
+
/**
|
|
917
|
+
* 网关下发消费请求 ID 的响应头名。
|
|
918
|
+
*
|
|
919
|
+
* 值 = cloud-agent 的 `consumeRequestID`, 也就是 `managed_model_usage_logs.request_id`
|
|
920
|
+
* 的值 —— 消费方拿它可以把一次用户可见的失败直接 join 到上游那次网关调用与它产生的
|
|
921
|
+
* 计费行。
|
|
922
|
+
*
|
|
923
|
+
* **不要**与 `X-Request-ID` 混用: 那是网关的传输层追踪 ID, 独立生成、从不写进任何
|
|
924
|
+
* 计费表, 两者永不相等。用错的后果是恒空 join —— 不报错, 只是下次事故照样查不动。
|
|
925
|
+
*/
|
|
926
|
+
declare const GATEWAY_REQUEST_ID_HEADER = "X-Acosmi-Request-Id";
|
|
927
|
+
/**
|
|
928
|
+
* 网关消费请求 ID 回调 (2026-09-01)。
|
|
929
|
+
*
|
|
930
|
+
* **为什么需要它**: 消费方 (如 CrabCode) 会在流成功、但流内证据不合格时对用户报失败
|
|
931
|
+
* (2026-08-31 事故形态: 6 次上游搜索全部成功并已计费, 客户端却全部判失败)。这类失败
|
|
932
|
+
* 此前无法关联到上游那一次调用 —— 客户端与网关之间没有任何共同标识符, 定位只能靠
|
|
933
|
+
* 时间戳与模型名人工对齐。
|
|
934
|
+
*
|
|
935
|
+
* 头在**首字节之前**发出, 因此覆盖流中段中断、零事件、HTTP 错误等全部形态; 而流内
|
|
936
|
+
* 事件在「事件根本没来」的场景里恰恰不存在 —— 那正是最需要诊断的那一种。
|
|
937
|
+
*
|
|
938
|
+
* 回调在响应头到达后触发**至多一次**; 网关没下发 (旧版本 / 非托管路径) 时**一次都不
|
|
939
|
+
* 触发** —— 绝不合成占位值。回调抛错会被吞掉且不中断流 (旁路信号不该有能力杀死主链路)。
|
|
940
|
+
*/
|
|
941
|
+
type GatewayRequestIDCallback = (requestID: string) => void;
|
|
807
942
|
/**
|
|
808
943
|
* 非流式 JSON API 请求的默认超时 (毫秒)。
|
|
809
944
|
*
|
|
@@ -851,6 +986,13 @@ declare class Client {
|
|
|
851
986
|
tokens: TokenSet | null;
|
|
852
987
|
/** token 持久化 */
|
|
853
988
|
store: TokenStore;
|
|
989
|
+
readonly credentialMode: 'legacy' | 'versioned' | 'external';
|
|
990
|
+
private readonly versionedCredentialStore;
|
|
991
|
+
private readonly accessTokenProvider;
|
|
992
|
+
private readonly beforeCredentialInstall;
|
|
993
|
+
private readonly credentialAuthority;
|
|
994
|
+
private readonly credentialRequestOwner;
|
|
995
|
+
private lifecycle;
|
|
854
996
|
/** fetch 实现 (默认 globalThis.fetch) */
|
|
855
997
|
fetchImpl: typeof fetch;
|
|
856
998
|
/** 互斥锁 (TS 用 Promise chain 替代 sync.Mutex) */
|
|
@@ -881,6 +1023,7 @@ declare class Client {
|
|
|
881
1023
|
/** V29 系数缓存 (TTL 8s, listCoefficients 内部用) */
|
|
882
1024
|
coefCacheData: ModelCoefficient[] | null;
|
|
883
1025
|
coefCacheTimeMs: number;
|
|
1026
|
+
private credentialOwnerKey;
|
|
884
1027
|
/** 串行化锁 (替代 Go sync.Mutex) */
|
|
885
1028
|
private coefMu;
|
|
886
1029
|
constructor(cfg?: Config);
|
|
@@ -889,6 +1032,38 @@ declare class Client {
|
|
|
889
1032
|
* 替代 Go NewClient (Go 同步 IO, TS 必须 async)
|
|
890
1033
|
*/
|
|
891
1034
|
static create(cfg?: Config): Promise<Client>;
|
|
1035
|
+
/** Read the durable authority. Available only in explicit versioned mode. */
|
|
1036
|
+
getCredentialSnapshot(signal?: AbortSignal): Promise<CredentialSnapshot>;
|
|
1037
|
+
/** Reconcile memory from durable state; storage errors never clear confirmed memory. */
|
|
1038
|
+
reconcileCredentials(signal?: AbortSignal): Promise<CredentialSnapshot>;
|
|
1039
|
+
private ownerKey;
|
|
1040
|
+
private adoptCredentialOwner;
|
|
1041
|
+
ensureCredential(signal?: AbortSignal): Promise<string>;
|
|
1042
|
+
subscribeCredentialState(listener: (snapshot: CredentialStateNotification) => void): () => void;
|
|
1043
|
+
retryCredentialIdentity(signal?: AbortSignal): Promise<CredentialSnapshot>;
|
|
1044
|
+
logoutCredential(signal?: AbortSignal, expected?: {
|
|
1045
|
+
storeInstanceId: string;
|
|
1046
|
+
authSessionId: string | null;
|
|
1047
|
+
}): Promise<{
|
|
1048
|
+
logoutOperationId: `${string}-${string}-${string}-${string}-${string}`;
|
|
1049
|
+
expectedAuthSessionId: string | null;
|
|
1050
|
+
storeInstanceId: string;
|
|
1051
|
+
revision: string;
|
|
1052
|
+
status: "superseded";
|
|
1053
|
+
} | {
|
|
1054
|
+
status: "already_signed_out";
|
|
1055
|
+
logoutOperationId: `${string}-${string}-${string}-${string}-${string}`;
|
|
1056
|
+
expectedAuthSessionId: string | null;
|
|
1057
|
+
storeInstanceId: string;
|
|
1058
|
+
revision: string;
|
|
1059
|
+
} | {
|
|
1060
|
+
revision: string;
|
|
1061
|
+
status: "committed";
|
|
1062
|
+
revocation: Promise<"confirmed" | "failed" | "unsupported">;
|
|
1063
|
+
logoutOperationId: `${string}-${string}-${string}-${string}-${string}`;
|
|
1064
|
+
expectedAuthSessionId: string | null;
|
|
1065
|
+
storeInstanceId: string;
|
|
1066
|
+
}>;
|
|
892
1067
|
/** 是否已授权 (有可用 token) */
|
|
893
1068
|
isAuthorized(): boolean;
|
|
894
1069
|
/**
|
|
@@ -932,7 +1107,7 @@ declare class Client {
|
|
|
932
1107
|
*/
|
|
933
1108
|
ensureToken(signal?: AbortSignal): Promise<string>;
|
|
934
1109
|
/** 强制刷新 token (用于 401 重试) */
|
|
935
|
-
forceRefresh(signal?: AbortSignal): Promise<void>;
|
|
1110
|
+
forceRefresh(signal?: AbortSignal, rejectedToken?: string): Promise<void>;
|
|
936
1111
|
private refreshCurrentToken;
|
|
937
1112
|
private refreshCurrentTokenDirect;
|
|
938
1113
|
private refreshCurrentTokenViaProxy;
|
|
@@ -1056,7 +1231,7 @@ declare class Client {
|
|
|
1056
1231
|
* 响应的 tokenRemaining / callRemaining 字段来自服务端 Header, 反映结算后余额
|
|
1057
1232
|
* v0.5.0: 根据 provider 自动路由到 /anthropic 或 /chat 端点
|
|
1058
1233
|
*/
|
|
1059
|
-
chat(modelID: string, req: ChatRequest, signal?: AbortSignal): Promise<ChatResponse>;
|
|
1234
|
+
chat(modelID: string, req: ChatRequest, signal?: AbortSignal, onGatewayRequestID?: GatewayRequestIDCallback): Promise<ChatResponse>;
|
|
1060
1235
|
/** 解析 nexus-v4 {code,message,data} 信封, code!=0 抛 BusinessError, 返回 data。 */
|
|
1061
1236
|
private unwrapAPIResponse;
|
|
1062
1237
|
/**
|
|
@@ -1105,7 +1280,7 @@ declare class Client {
|
|
|
1105
1280
|
* Anthropic → chatMessagesAnthropic (现有路径, POST /anthropic)
|
|
1106
1281
|
* 其他厂商 → chatMessagesOpenAI (POST /chat, 响应转换为 AnthropicResponse)
|
|
1107
1282
|
*/
|
|
1108
|
-
chatMessages(modelID: string, req: ChatRequest, signal?: AbortSignal): Promise<AnthropicResponse>;
|
|
1283
|
+
chatMessages(modelID: string, req: ChatRequest, signal?: AbortSignal, onGatewayRequestID?: GatewayRequestIDCallback): Promise<AnthropicResponse>;
|
|
1109
1284
|
private chatMessagesAnthropic;
|
|
1110
1285
|
private chatMessagesOpenAI;
|
|
1111
1286
|
/**
|
|
@@ -1113,16 +1288,18 @@ declare class Client {
|
|
|
1113
1288
|
* v0.5.0: 根据 adapter 路由端点
|
|
1114
1289
|
*
|
|
1115
1290
|
* @param onUpstreamActivity 见 {@link UpstreamActivityCallback}
|
|
1291
|
+
* @param onGatewayRequestID 见 {@link GatewayRequestIDCallback}
|
|
1116
1292
|
*/
|
|
1117
|
-
chatStream(modelID: string, req: ChatRequest, signal?: AbortSignal, onUpstreamActivity?: UpstreamActivityCallback): AsyncIterable<StreamEvent>;
|
|
1293
|
+
chatStream(modelID: string, req: ChatRequest, signal?: AbortSignal, onUpstreamActivity?: UpstreamActivityCallback, onGatewayRequestID?: GatewayRequestIDCallback): AsyncIterable<StreamEvent>;
|
|
1118
1294
|
/**
|
|
1119
1295
|
* Anthropic 原生格式流式聊天 (SSE)
|
|
1120
1296
|
* 调用 POST /managed-models/:id/anthropic, SSE 事件为 Anthropic 协议格式
|
|
1121
1297
|
* 无 started/settled/failed 自定义事件, 无 data: [DONE], message_stop 为自然结束
|
|
1122
1298
|
*
|
|
1123
1299
|
* @param onUpstreamActivity 见 {@link UpstreamActivityCallback}
|
|
1300
|
+
* @param onGatewayRequestID 见 {@link GatewayRequestIDCallback}
|
|
1124
1301
|
*/
|
|
1125
|
-
chatMessagesStream(modelID: string, req: ChatRequest, signal?: AbortSignal, onUpstreamActivity?: UpstreamActivityCallback): AsyncIterable<StreamEvent>;
|
|
1302
|
+
chatMessagesStream(modelID: string, req: ChatRequest, signal?: AbortSignal, onUpstreamActivity?: UpstreamActivityCallback, onGatewayRequestID?: GatewayRequestIDCallback): AsyncIterable<StreamEvent>;
|
|
1126
1303
|
private chatStreamGen;
|
|
1127
1304
|
private chatMessagesStreamGen;
|
|
1128
1305
|
/**
|
|
@@ -1156,6 +1333,7 @@ declare class Client {
|
|
|
1156
1333
|
* 不复用 `apiURL`:apiURL 强制追加 `/api/v4`,与 compliance 路径不同。
|
|
1157
1334
|
*/
|
|
1158
1335
|
complianceURL(path: string): string;
|
|
1336
|
+
private assertCredentialURL;
|
|
1159
1337
|
/** GET/POST/... 通用 JSON 调用 (返回 result 已 typed) */
|
|
1160
1338
|
doJSON<T>(method: string, path: string, body: unknown | null, signal?: AbortSignal): Promise<T>;
|
|
1161
1339
|
/** 与 doJSON 相同, 但返回响应 Headers (用于提取 X-Token-Remaining 等) */
|
|
@@ -1318,6 +1496,13 @@ declare class HTTPError extends Error {
|
|
|
1318
1496
|
* false/缺失 = 周窗/显式禁止/灰度关 (硬等待, 无豁免路径, 老网关不返回时为 undefined)。
|
|
1319
1497
|
*/
|
|
1320
1498
|
windowOverridable?: boolean;
|
|
1499
|
+
errorContractVersion?: number;
|
|
1500
|
+
faultDomain?: FaultDomain;
|
|
1501
|
+
requestDisposition?: RequestDisposition;
|
|
1502
|
+
transportRequestId?: string | null;
|
|
1503
|
+
consumeRequestId?: string | null;
|
|
1504
|
+
providerRequestId?: string | null;
|
|
1505
|
+
retryable: boolean;
|
|
1321
1506
|
constructor(statusCode: number, opts?: {
|
|
1322
1507
|
type?: string;
|
|
1323
1508
|
message?: string;
|
|
@@ -1327,6 +1512,13 @@ declare class HTTPError extends Error {
|
|
|
1327
1512
|
windowKind?: 'FIVE_HOUR' | 'WEEKLY';
|
|
1328
1513
|
windowResetAt?: string;
|
|
1329
1514
|
windowOverridable?: boolean;
|
|
1515
|
+
errorContractVersion?: number;
|
|
1516
|
+
faultDomain?: FaultDomain;
|
|
1517
|
+
requestDisposition?: RequestDisposition;
|
|
1518
|
+
transportRequestId?: string | null;
|
|
1519
|
+
consumeRequestId?: string | null;
|
|
1520
|
+
providerRequestId?: string | null;
|
|
1521
|
+
retryable?: boolean;
|
|
1330
1522
|
});
|
|
1331
1523
|
}
|
|
1332
1524
|
/**
|
|
@@ -1343,6 +1535,7 @@ declare class NetworkError extends Error {
|
|
|
1343
1535
|
cause?: unknown;
|
|
1344
1536
|
timeout: boolean;
|
|
1345
1537
|
eof: boolean;
|
|
1538
|
+
requestDisposition: RequestDisposition;
|
|
1346
1539
|
constructor(op: string, url: string, cause: unknown, opts?: {
|
|
1347
1540
|
timeout?: boolean;
|
|
1348
1541
|
eof?: boolean;
|
|
@@ -1359,6 +1552,8 @@ declare class NetworkError extends Error {
|
|
|
1359
1552
|
declare class StreamError extends Error {
|
|
1360
1553
|
/** 例: "empty_response" / "rate_limit" / "overloaded" / "" */
|
|
1361
1554
|
code: string;
|
|
1555
|
+
/** D23 gateway machine code; mirrors the legacy `code` field. */
|
|
1556
|
+
errorCode: string;
|
|
1362
1557
|
/** 例: "provider" / "settlement" */
|
|
1363
1558
|
stage: string;
|
|
1364
1559
|
/** 用户友好提示 (中文); 历史字段, 与 rawError 区分 */
|
|
@@ -1367,14 +1562,42 @@ declare class StreamError extends Error {
|
|
|
1367
1562
|
rawError: string;
|
|
1368
1563
|
/** 客户端是否值得重试 */
|
|
1369
1564
|
retryable: boolean;
|
|
1565
|
+
errorContractVersion?: number;
|
|
1566
|
+
faultDomain?: FaultDomain;
|
|
1567
|
+
requestDisposition?: RequestDisposition;
|
|
1568
|
+
transportRequestId?: string | null;
|
|
1569
|
+
consumeRequestId?: string | null;
|
|
1570
|
+
providerRequestId?: string | null;
|
|
1370
1571
|
constructor(opts?: {
|
|
1371
1572
|
code?: string;
|
|
1372
1573
|
stage?: string;
|
|
1373
1574
|
message?: string;
|
|
1374
1575
|
rawError?: string;
|
|
1375
1576
|
retryable?: boolean;
|
|
1577
|
+
errorContractVersion?: number;
|
|
1578
|
+
faultDomain?: FaultDomain;
|
|
1579
|
+
requestDisposition?: RequestDisposition;
|
|
1580
|
+
transportRequestId?: string | null;
|
|
1581
|
+
consumeRequestId?: string | null;
|
|
1582
|
+
providerRequestId?: string | null;
|
|
1376
1583
|
});
|
|
1377
1584
|
}
|
|
1585
|
+
type RequestDisposition = 'not_accepted' | 'accepted' | 'unknown';
|
|
1586
|
+
type FaultDomain = 'user_auth' | 'caller_credentials' | 'account_quota' | 'account_permission' | 'provider' | 'gateway' | 'transport' | 'stream_ticket' | 'protocol';
|
|
1587
|
+
interface GatewayErrorContract {
|
|
1588
|
+
errorContractVersion: 1;
|
|
1589
|
+
faultDomain: FaultDomain;
|
|
1590
|
+
errorCode: string;
|
|
1591
|
+
transportRequestId: string | null;
|
|
1592
|
+
consumeRequestId: string | null;
|
|
1593
|
+
providerRequestId: string | null;
|
|
1594
|
+
requestDisposition: RequestDisposition;
|
|
1595
|
+
retryable: boolean;
|
|
1596
|
+
}
|
|
1597
|
+
/** Read the closed v1 gateway error contract without exposing the raw response body. */
|
|
1598
|
+
declare function readGatewayErrorContract(error: unknown): GatewayErrorContract | null;
|
|
1599
|
+
/** True only for an HTTP 401 carrying the exact v1 rejected user-token contract. */
|
|
1600
|
+
declare function isUserAccessTokenRejected(error: unknown): boolean;
|
|
1378
1601
|
/**
|
|
1379
1602
|
* 判断错误是否为窗口限额拒绝 (5 小时 / 7 天滚动窗口 credit 用量达上限)。
|
|
1380
1603
|
* 结构化 errorCode 优先, message/body 子串防御兜底 (后端部署版本错位期:
|
|
@@ -5243,4 +5466,4 @@ declare class ChatBridgeClient {
|
|
|
5243
5466
|
revokeCredential(credentialRef: string, signal?: AbortSignal): Promise<void>;
|
|
5244
5467
|
}
|
|
5245
5468
|
|
|
5246
|
-
export { AGENT_RUN_META_TITLE, AGENT_RUN_META_WORKSPACE, ALL_INTEGRATION_STATUS, ALL_PLATFORMS, ALL_REGIONS, type APIResponse, type AdapterKind, type AgentRun, type AgentRunArtifact, type AgentRunArtifactList, type AgentRunArtifactPolicy, type AgentRunCreateRequest, type AgentRunCreateResponse, type AgentRunDownload, type AgentRunErrorPayload, type AgentRunListOptions, type AgentRunListResult, type AgentRunLocalContextPolicy, type AgentRunLocalToolHandler, type AgentRunLocalToolHandlerContext, type AgentRunLocalToolResult, type AgentRunRemoteCreateRequest, type AgentRunRunOptions, type AgentRunRuntime, type AgentRunSettlement, type AgentRunStatus, AgentRunStreamError, type AgentRunStreamEvent, type AgentRunStreamOptions, type AgentRunUsage, type AgentRunWithLocalToolsOptions, AgentRunsClient, AnthropicResponse, type ApiClientRef, type ApproveSealApprovalQuery, type AssignSeatRequest, type Audience, AudienceEnum, type AuthorizeResult, type BalanceDetail, type BalanceDetailEntitlement, type BillingMode, BillingModeEnum, type BillingPreflightResult, type BlockMeta, type BookConsultationRequest, type BridgeThreadRef, type BrowserRefreshMode, type BugReportResult, type BugView, BusinessError, type BuyResponse, type ByokCreateRequest, type ByokCredential, type ByokCredentialStatus, type ByokProvider, CHAT_REQUEST_TIMEOUT_MS, type CancelSealApprovalQuery, type CaseLead, type CaseMatter, type CertificationStatus, type ChannelAttachment, type ChannelCard, type ChannelCardAction, type ChannelInboundEvent, type ChannelOutboundEvent, ChatBridgeClient, type ChatBridgeSession, type ChatCredentialPublic, type ChatIntegration, ChatRequest, ChatResponse, type ChatThread, Client, type ClientRegistration, type ComplianceAssetType, type ComplianceBenefitType, type ComplianceBillingDisplayStatus, type ComplianceCapability, ComplianceClient, type ComplianceClientErrorCode, type ComplianceDigestSource, type ComplianceEnvelopeStatus, type ComplianceErrorInfo, type ComplianceErrorKey, type ComplianceHashAlgorithm, CompliancePollError, type CompliancePollOptions, type CompliancePrivacyLevel, type ComplianceProviderRequestStatus, type ComplianceProviderStatus, type ComplianceQuoteResponse, type ComplianceReport, type ComplianceScope, type ComplianceSealApprovalStatus, type ComplianceSku, type ComplianceTimestampVerificationStatus, type ComplianceWriteOptions, type Config, type ConsumeRecord, type ConsumeRecordPage, type ContractTemplateField, type ContractTemplateFieldType, type ContractTemplatePageItem, type ContractTemplateResp, type ContractTemplateStatus, type ContractTemplateVersion, type CorporateTransfer, CrabCodeByokClient, type CreateContractTemplateRequest, type CreateEvidenceAssetRequest, type CreateH5SigningUrlRequest, type CreateIntegrationRequest, type CreateReportRequest, type CreateSigningEnvelopeRequest, type CreateWebAuthorizationRequestOptions, type CredentialRef, DEFAULT_API_TIMEOUT_MS, DEFAULT_GATEWAY_BASE_URL, DefaultRetryPolicy, type DeviceRegistration, EmbeddingRequest, EmbeddingResponse, type EnterpriseKycMyStatusView, type EnterpriseMember, type EnterpriseSummary, type EntitlementBalance, type EntitlementItem, type EnvelopeContractItem, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrOAuthCORSBlocked, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRefreshProxyFailed, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, ErrTokenExpired, EventAuthURL, EventComplete, EventError, type EvidenceAsset, type EvidenceAssetPageItem, type EvidencePackage, type EvidencePackagePageItem, type FeatureGateState, type FeatureGateStatus, FileTokenStore, type FilterStatus, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, type GateQuota, type GenerateSkillRequest, type GenerateSkillResult, HTTPError, type IdempotencyKey, IdempotencyKeyHeader, ImageGenerationRequest, ImageGenerationResponse, InMemoryTokenStore, type InitiateCorporateTransferInput, type InitiateCorporateTransferResult, InputModality, type IntegrationStatus, type InviteMemberRequest, type Invoice, type IssueTimestampRequest, type LawyerCredentialMyView, type LawyerSummary, type LegalConsultation, type LegalServiceOrder, type LegalServiceSku, type LegalSkuCode, type ListContractTemplatesRequest, type ListEvidenceAssetsRequest, type ListEvidencePackagesRequest, type ListOperationsRequest, type ListReportsRequest, type ListSealApprovalsRequest, type ListSealUsesRequest, type ListSigningEnvelopesRequest, type ListTimestampsRequest, LocalStorageTokenStore, type LoginErrCode, type LoginEvent, type LoginEventType, type LoginOptions, ManagedModel, type Membership, type ModelBucket, type ModelByQuotaResponse, ModelCapabilities, type ModelCoefficient, ModelNotFoundError, NetworkError, type Notification, type NotificationList, type NotificationPreference, type NotificationUnreadCount, type OAuthMetadataProfile, OAuthTokenEndpointError, type OpenAIChatChoice, type OpenAIChatMessage, type OpenAIChatResponse, type OpenAIFunctionCall, type OpenAIStreamChoice, type OpenAIStreamChunk, type OpenAIStreamDelta, type OpenAIStreamToolCall, type OpenAIToolCall, type OpenAIUsage, type OperationDetail, type OperationId, type OperationPageItem, type OperationSource, type OperationStatus, type OptimizeSkillRequest, type OptimizeSkillResult, type Order, type OrderListItem, type OrderStatus, OrderTerminalError, type OrgConsumeReport, type OrgSeat, type OrgSubscription, type PageRequest, type PageResult, type PayPayload, type PaymentMethod, type PermissionPolicy, type Platform, type PricingConfig, type PrincipalRef, type Product, type ProductFamily, ProductFamilyEnum, ProviderAdapter, type ProviderRequestStatus, type ProviderRequestStatusView, type PublicEvidenceVerifyResult, type PublicModelSummary, QuotaSummary, RETRY_ADVICE_REASONS, RateLimitError, type RefundPolicy, type RefundRecord, type Region, type RegionScope, RegionScopeEnum, type RegisterWebOAuthClientOptions, type RejectSealApprovalQuery, type RemoteControlDone, type RemoteControlError, type RemoteControlEvent, type RemoteControlEventType, type RemoteControlPermissionRequest, type RemoteControlPermissionResult, type RemoteControlReasoningDelta, type RemoteControlSettle, type RemoteControlStatus, type RemoteControlTextDelta, type RemoteControlToolCall, type RemoteControlToolResult, type RemoteControlUsage, type RemotePermissionDecision, type RemotePermissionResultRequest, type RemoteSessionPlacement, type RemoteSessionRef, type RemoteSessionTokenGrant, type RemoteUserMessageAck, type RemoteUserMessageRequest, type ReportDownload, type ReportPageItem, type ReqTimeoutCtl, type RequestInvoiceInput, type RequestRefundInput, RerankRequest, RerankResponse, type RetryAdvice, type RetryAdviceReason, type RetryPolicy, type RetryRequestInfo, type RolloverPolicy, type RunnerKind, ScopeAI, ScopeAccount, ScopeAgentAccessManage, ScopeChatBridge, ScopeChatBridgeRead, ScopeChatBridgeRotate, ScopeChatBridgeWrite, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, ScopeComplianceContractTemplateRead, ScopeComplianceContractTemplateWrite, ScopeComplianceEvidenceRead, ScopeComplianceEvidenceWrite, ScopeComplianceReportsPublish, ScopeComplianceReportsRead, ScopeComplianceReportsWrite, ScopeComplianceSealApprovalApprove, ScopeComplianceSealApprovalRequest, ScopeComplianceSealManage, ScopeComplianceSealUseExecute, ScopeComplianceTimestampIssue, ScopeComplianceTimestampVerify, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeRemoteControl, ScopeRemoteControlAgentRun, ScopeRemoteControlPermissionResponse, ScopeRemoteControlSessionControl, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, type SealApproval, type SealApprovalPageItem, type SealUsePageItem, type ServerMetadata, type SignEnvelopeRequest, type SigningEnvelope, type SigningEnvelopePageItem, type SkillBrowseListResponse, type SkillBrowseResponse, type SkillStoreItem, type SkillStoreListItem, type SkillStoreQuery, type SkillSummary, type SortDirection, SourcesEvent, type StepUpStatus, type StoreCredentialRequest, StreamError, StreamEvent, StreamSettlement, type SubmitCaseLeadRequest, type SubmitSealApprovalRequest, type SubscriptionAudience, type SubscriptionPlan, type SubscriptionTier, type TenantRef, type TimestampPageItem, type TimestampToken, type TimestampVerifyResult, type TokenPackage, type TokenResponse, type TokenSet, type TokenStore, type ToolListResponse, type ToolProvider, type ToolView, type Transaction, type TsaProvider, type TsaStats, type UpdateContractTemplateRequest, type UploadContractTemplatePdfRequest, type UpstreamActivityCallback, type UserSubscription, type VerifyStatus, type VerifyTimestampRequest, VideoGenerationRequest, VideoTaskResponse, type VoidEnvelopeRequest, type WSConfig, type WSEvent, type WalletStats, type WebAuthorizationCallbackParams, type WebAuthorizationPending, type WebAuthorizationRequest, WindowResetSummary, type WorkspacePolicy, type YudaoPageResult, agentAccessScopes, allScopes, apiResponseBusinessError, apiResponseGetMessage, asCredentialRef, authorize, buildBetas, chatBridgeScopes, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getWindowLimitStreamDetails, isBillingConfirmable, isChannelInboundEvent, isComplianceBusinessError, isComplianceTerminalError, isContinuableWindowLimitError, isIntegrationStatus, isInvalidGrantError, isPlatform, isRegion, isSSECommentLine, isSSLError, isTerminalRemoteEvent, isValidTokenSet, isWindowLimitError, isWindowLimitStreamError, maxEndUserIdLength, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newTokenSet, normalizeGatewayBaseURL, normalizeOverrideBaseURL, parseNotificationEvent, parseRemoteControlEvent, refreshToken, register, registerWebOAuthClient, remoteControlScopes, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, skillScopes, tokenSetIsExpired, uniqueMerge, validateEndUserId };
|
|
5469
|
+
export { AGENT_RUN_META_TITLE, AGENT_RUN_META_WORKSPACE, ALL_INTEGRATION_STATUS, ALL_PLATFORMS, ALL_REGIONS, type APIResponse, type AdapterKind, type AgentRun, type AgentRunArtifact, type AgentRunArtifactList, type AgentRunArtifactPolicy, type AgentRunCreateRequest, type AgentRunCreateResponse, type AgentRunDownload, type AgentRunErrorPayload, type AgentRunListOptions, type AgentRunListResult, type AgentRunLocalContextPolicy, type AgentRunLocalToolHandler, type AgentRunLocalToolHandlerContext, type AgentRunLocalToolResult, type AgentRunRemoteCreateRequest, type AgentRunRunOptions, type AgentRunRuntime, type AgentRunSettlement, type AgentRunStatus, AgentRunStreamError, type AgentRunStreamEvent, type AgentRunStreamOptions, type AgentRunUsage, type AgentRunWithLocalToolsOptions, AgentRunsClient, AnthropicResponse, type ApiClientRef, type ApproveSealApprovalQuery, type AssignSeatRequest, type Audience, AudienceEnum, type AuthorizeResult, type BalanceDetail, type BalanceDetailEntitlement, type BillingMode, BillingModeEnum, type BillingPreflightResult, type BlockMeta, type BookConsultationRequest, type BridgeThreadRef, type BrowserRefreshMode, type BugReportResult, type BugView, BusinessError, type BuyResponse, type ByokCreateRequest, type ByokCredential, type ByokCredentialStatus, type ByokProvider, CHAT_REQUEST_TIMEOUT_MS, type CancelSealApprovalQuery, type CaseLead, type CaseMatter, type CertificationStatus, type ChannelAttachment, type ChannelCard, type ChannelCardAction, type ChannelInboundEvent, type ChannelOutboundEvent, ChatBridgeClient, type ChatBridgeSession, type ChatCredentialPublic, type ChatIntegration, ChatRequest, ChatResponse, type ChatThread, Client, type ClientRegistration, type ComplianceAssetType, type ComplianceBenefitType, type ComplianceBillingDisplayStatus, type ComplianceCapability, ComplianceClient, type ComplianceClientErrorCode, type ComplianceDigestSource, type ComplianceEnvelopeStatus, type ComplianceErrorInfo, type ComplianceErrorKey, type ComplianceHashAlgorithm, CompliancePollError, type CompliancePollOptions, type CompliancePrivacyLevel, type ComplianceProviderRequestStatus, type ComplianceProviderStatus, type ComplianceQuoteResponse, type ComplianceReport, type ComplianceScope, type ComplianceSealApprovalStatus, type ComplianceSku, type ComplianceTimestampVerificationStatus, type ComplianceWriteOptions, type Config, type ConsumeRecord, type ConsumeRecordPage, type ContractTemplateField, type ContractTemplateFieldType, type ContractTemplatePageItem, type ContractTemplateResp, type ContractTemplateStatus, type ContractTemplateVersion, type CorporateTransfer, CrabCodeByokClient, type CreateContractTemplateRequest, type CreateEvidenceAssetRequest, type CreateH5SigningUrlRequest, type CreateIntegrationRequest, type CreateReportRequest, type CreateSigningEnvelopeRequest, type CreateWebAuthorizationRequestOptions, type CredentialAuthorityConfig, type CredentialCASExpected, type CredentialCASResult, type CredentialLoginAttempt, type CredentialMutationReceipt, type CredentialPrincipal, type CredentialReason, type CredentialRef, type CredentialRefreshOperation, type CredentialRequestOwner, type CredentialSnapshot, type CredentialState, type CredentialStateNotification, DEFAULT_API_TIMEOUT_MS, DEFAULT_GATEWAY_BASE_URL, DefaultRetryPolicy, type DeviceRegistration, EmbeddingRequest, EmbeddingResponse, type EnterpriseKycMyStatusView, type EnterpriseMember, type EnterpriseSummary, type EntitlementBalance, type EntitlementItem, type EnvelopeContractItem, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrOAuthCORSBlocked, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRefreshProxyFailed, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, ErrTokenExpired, EventAuthURL, EventComplete, EventError, type EvidenceAsset, type EvidenceAssetPageItem, type EvidencePackage, type EvidencePackagePageItem, type FaultDomain, type FeatureGateState, type FeatureGateStatus, FileTokenStore, type FilterStatus, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, GATEWAY_REQUEST_ID_HEADER, type GateQuota, type GatewayErrorContract, type GatewayRequestIDCallback, type GenerateSkillRequest, type GenerateSkillResult, HTTPError, type IdempotencyKey, IdempotencyKeyHeader, ImageGenerationRequest, ImageGenerationResponse, InMemoryTokenStore, type InitiateCorporateTransferInput, type InitiateCorporateTransferResult, InputModality, type IntegrationStatus, type InviteMemberRequest, type Invoice, type IssueTimestampRequest, type LawyerCredentialMyView, type LawyerSummary, type LegalConsultation, type LegalServiceOrder, type LegalServiceSku, type LegalSkuCode, type ListContractTemplatesRequest, type ListEvidenceAssetsRequest, type ListEvidencePackagesRequest, type ListOperationsRequest, type ListReportsRequest, type ListSealApprovalsRequest, type ListSealUsesRequest, type ListSigningEnvelopesRequest, type ListTimestampsRequest, LocalStorageTokenStore, type LoginErrCode, type LoginEvent, type LoginEventType, type LoginOptions, ManagedModel, type Membership, type ModelBucket, type ModelByQuotaResponse, ModelCapabilities, type ModelCoefficient, ModelNotFoundError, NetworkError, type Notification, type NotificationList, type NotificationPreference, type NotificationUnreadCount, type OAuthMetadataProfile, OAuthTokenEndpointError, type OpenAIChatChoice, type OpenAIChatMessage, type OpenAIChatResponse, type OpenAIFunctionCall, type OpenAIStreamChoice, type OpenAIStreamChunk, type OpenAIStreamDelta, type OpenAIStreamToolCall, type OpenAIToolCall, type OpenAIUsage, type OperationDetail, type OperationId, type OperationPageItem, type OperationSource, type OperationStatus, type OptimizeSkillRequest, type OptimizeSkillResult, type Order, type OrderListItem, type OrderStatus, OrderTerminalError, type OrgConsumeReport, type OrgSeat, type OrgSubscription, type PageRequest, type PageResult, type PayPayload, type PaymentMethod, type PermissionPolicy, type Platform, type PricingConfig, type PrincipalRef, type Product, type ProductFamily, ProductFamilyEnum, ProviderAdapter, type ProviderRequestStatus, type ProviderRequestStatusView, type PublicEvidenceVerifyResult, type PublicModelSummary, QuotaSummary, RETRY_ADVICE_REASONS, RateLimitError, type RefundPolicy, type RefundRecord, type Region, type RegionScope, RegionScopeEnum, type RegisterWebOAuthClientOptions, type RejectSealApprovalQuery, type RemoteControlDone, type RemoteControlError, type RemoteControlEvent, type RemoteControlEventType, type RemoteControlPermissionRequest, type RemoteControlPermissionResult, type RemoteControlReasoningDelta, type RemoteControlSettle, type RemoteControlStatus, type RemoteControlTextDelta, type RemoteControlToolCall, type RemoteControlToolResult, type RemoteControlUsage, type RemotePermissionDecision, type RemotePermissionResultRequest, type RemoteSessionPlacement, type RemoteSessionRef, type RemoteSessionTokenGrant, type RemoteUserMessageAck, type RemoteUserMessageRequest, type ReportDownload, type ReportPageItem, type ReqTimeoutCtl, type RequestDisposition, type RequestInvoiceInput, type RequestRefundInput, RerankRequest, RerankResponse, type RetryAdvice, type RetryAdviceReason, type RetryPolicy, type RetryRequestInfo, type RolloverPolicy, type RunnerKind, ScopeAI, ScopeAccount, ScopeAgentAccessManage, ScopeChatBridge, ScopeChatBridgeRead, ScopeChatBridgeRotate, ScopeChatBridgeWrite, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, ScopeComplianceContractTemplateRead, ScopeComplianceContractTemplateWrite, ScopeComplianceEvidenceRead, ScopeComplianceEvidenceWrite, ScopeComplianceReportsPublish, ScopeComplianceReportsRead, ScopeComplianceReportsWrite, ScopeComplianceSealApprovalApprove, ScopeComplianceSealApprovalRequest, ScopeComplianceSealManage, ScopeComplianceSealUseExecute, ScopeComplianceTimestampIssue, ScopeComplianceTimestampVerify, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeRemoteControl, ScopeRemoteControlAgentRun, ScopeRemoteControlPermissionResponse, ScopeRemoteControlSessionControl, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, type SealApproval, type SealApprovalPageItem, type SealUsePageItem, type ServerMetadata, type SignEnvelopeRequest, type SigningEnvelope, type SigningEnvelopePageItem, type SkillBrowseListResponse, type SkillBrowseResponse, type SkillStoreItem, type SkillStoreListItem, type SkillStoreQuery, type SkillSummary, type SortDirection, SourcesEvent, type StepUpStatus, type StoreCredentialRequest, StreamError, StreamEvent, StreamSettlement, type SubmitCaseLeadRequest, type SubmitSealApprovalRequest, type SubscriptionAudience, type SubscriptionPlan, type SubscriptionTier, type TenantRef, type TimestampPageItem, type TimestampToken, type TimestampVerifyResult, type TokenPackage, type TokenResponse, type TokenSet, type TokenStore, type ToolListResponse, type ToolProvider, type ToolView, type Transaction, type TsaProvider, type TsaStats, type UpdateContractTemplateRequest, type UploadContractTemplatePdfRequest, type UpstreamActivityCallback, type UserSubscription, type VerifiedCredentialIdentity, type VerifyStatus, type VerifyTimestampRequest, type VersionedCredentialStore, VideoGenerationRequest, VideoTaskResponse, type VoidEnvelopeRequest, type WSConfig, type WSEvent, type WalletStats, type WebAuthorizationCallbackParams, type WebAuthorizationPending, type WebAuthorizationRequest, WindowResetSummary, type WorkspacePolicy, type YudaoPageResult, agentAccessScopes, allScopes, apiResponseBusinessError, apiResponseGetMessage, asCredentialRef, authorize, buildBetas, chatBridgeScopes, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getWindowLimitStreamDetails, isBillingConfirmable, isChannelInboundEvent, isComplianceBusinessError, isComplianceTerminalError, isContinuableWindowLimitError, isIntegrationStatus, isInvalidGrantError, isPlatform, isRegion, isSSECommentLine, isSSLError, isTerminalRemoteEvent, isUserAccessTokenRejected, isValidTokenSet, isWindowLimitError, isWindowLimitStreamError, maxEndUserIdLength, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newTokenSet, normalizeGatewayBaseURL, normalizeOverrideBaseURL, parseNotificationEvent, parseRemoteControlEvent, readGatewayErrorContract, refreshToken, register, registerWebOAuthClient, remoteControlScopes, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, skillScopes, tokenSetIsExpired, uniqueMerge, validateEndUserId };
|