@acosmi/sdk-ts 2.19.0 → 2.19.2
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 +16 -0
- package/README.md +2 -1
- package/dist/browser/index.mjs +1205 -160
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +1205 -160
- package/dist/index.mjs.map +1 -1
- package/dist/node/adapters/anthropic.cjs +2 -0
- package/dist/node/adapters/anthropic.cjs.map +1 -1
- package/dist/node/adapters/anthropic.d.cts +1 -1
- package/dist/node/adapters/anthropic.d.ts +1 -1
- package/dist/node/adapters/anthropic.mjs +2 -0
- package/dist/node/adapters/anthropic.mjs.map +1 -1
- package/dist/node/adapters/openai.cjs +122 -49
- package/dist/node/adapters/openai.cjs.map +1 -1
- package/dist/node/adapters/openai.d.cts +2 -2
- package/dist/node/adapters/openai.d.ts +2 -2
- package/dist/node/adapters/openai.mjs +122 -49
- package/dist/node/adapters/openai.mjs.map +1 -1
- package/dist/node/{index-C2oh157O.d.cts → index-CqxPqbsl.d.cts} +2 -1
- package/dist/node/{index-C2oh157O.d.ts → index-CqxPqbsl.d.ts} +2 -1
- package/dist/node/index.cjs +1206 -159
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +346 -151
- package/dist/node/index.d.ts +346 -151
- package/dist/node/index.mjs +1205 -160
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{openai-DR_KhEdM.d.cts → openai-Ce85qh14.d.cts} +30 -3
- package/dist/node/{openai-Cyvi8g6B.d.ts → openai-mkTSir6E.d.ts} +30 -3
- package/package.json +1 -1
package/dist/node/index.d.cts
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-
|
|
3
|
-
import { M as ManagedModel, Q as QuotaSummary,
|
|
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
|
|
1
|
+
import { a as AnthropicResponse } from './openai-Ce85qh14.cjs';
|
|
2
|
+
export { A as AnthropicContentBlock, b as AnthropicUsage, O as OpenAIAdapter, d as anthropicResponseTextContent, e as anthropicResponseThinkingContent, f as anthropicResponseToolUseBlocks } from './openai-Ce85qh14.cjs';
|
|
3
|
+
import { M as ManagedModel, Q as QuotaSummary, X as WindowResetSummary, n as ModelCapabilities, e as ChatRequest, P as ProviderAdapter, f as ChatResponse, I as ImageGenerationRequest, k as ImageGenerationResponse, V as VideoGenerationRequest, L 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-CqxPqbsl.cjs';
|
|
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 ThinkingLow, H as ThinkingMax, J as ThinkingMaxFallbackMaxTokens, K as ThinkingOff, W as WebSearchConfig, N as WebSearchSource, U as WindowLimitStatus, Y as bucketInfoIsCommercial, Z as bucketRowIsCommercial, _ as classifySourcesEvent, $ as getAdapter, a0 as getAdapterForModel, a1 as newThinkingConfig, a2 as newWebSearchTool, a3 as parseSettlement, a4 as parseSourcesEvent } from './index-CqxPqbsl.cjs';
|
|
5
5
|
import { M as MinimalSanitizeConfig } from './index-Bah9A83R.cjs';
|
|
6
6
|
export { A as sanitize } from './index-Bah9A83R.cjs';
|
|
7
7
|
export { AnthropicAdapter } from './adapters/anthropic.cjs';
|
|
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
|
/**
|
|
@@ -877,6 +986,13 @@ declare class Client {
|
|
|
877
986
|
tokens: TokenSet | null;
|
|
878
987
|
/** token 持久化 */
|
|
879
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;
|
|
880
996
|
/** fetch 实现 (默认 globalThis.fetch) */
|
|
881
997
|
fetchImpl: typeof fetch;
|
|
882
998
|
/** 互斥锁 (TS 用 Promise chain 替代 sync.Mutex) */
|
|
@@ -907,6 +1023,7 @@ declare class Client {
|
|
|
907
1023
|
/** V29 系数缓存 (TTL 8s, listCoefficients 内部用) */
|
|
908
1024
|
coefCacheData: ModelCoefficient[] | null;
|
|
909
1025
|
coefCacheTimeMs: number;
|
|
1026
|
+
private credentialOwnerKey;
|
|
910
1027
|
/** 串行化锁 (替代 Go sync.Mutex) */
|
|
911
1028
|
private coefMu;
|
|
912
1029
|
constructor(cfg?: Config);
|
|
@@ -915,6 +1032,38 @@ declare class Client {
|
|
|
915
1032
|
* 替代 Go NewClient (Go 同步 IO, TS 必须 async)
|
|
916
1033
|
*/
|
|
917
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
|
+
}>;
|
|
918
1067
|
/** 是否已授权 (有可用 token) */
|
|
919
1068
|
isAuthorized(): boolean;
|
|
920
1069
|
/**
|
|
@@ -958,7 +1107,7 @@ declare class Client {
|
|
|
958
1107
|
*/
|
|
959
1108
|
ensureToken(signal?: AbortSignal): Promise<string>;
|
|
960
1109
|
/** 强制刷新 token (用于 401 重试) */
|
|
961
|
-
forceRefresh(signal?: AbortSignal): Promise<void>;
|
|
1110
|
+
forceRefresh(signal?: AbortSignal, rejectedToken?: string): Promise<void>;
|
|
962
1111
|
private refreshCurrentToken;
|
|
963
1112
|
private refreshCurrentTokenDirect;
|
|
964
1113
|
private refreshCurrentTokenViaProxy;
|
|
@@ -1184,6 +1333,7 @@ declare class Client {
|
|
|
1184
1333
|
* 不复用 `apiURL`:apiURL 强制追加 `/api/v4`,与 compliance 路径不同。
|
|
1185
1334
|
*/
|
|
1186
1335
|
complianceURL(path: string): string;
|
|
1336
|
+
private assertCredentialURL;
|
|
1187
1337
|
/** GET/POST/... 通用 JSON 调用 (返回 result 已 typed) */
|
|
1188
1338
|
doJSON<T>(method: string, path: string, body: unknown | null, signal?: AbortSignal): Promise<T>;
|
|
1189
1339
|
/** 与 doJSON 相同, 但返回响应 Headers (用于提取 X-Token-Remaining 等) */
|
|
@@ -1346,6 +1496,13 @@ declare class HTTPError extends Error {
|
|
|
1346
1496
|
* false/缺失 = 周窗/显式禁止/灰度关 (硬等待, 无豁免路径, 老网关不返回时为 undefined)。
|
|
1347
1497
|
*/
|
|
1348
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;
|
|
1349
1506
|
constructor(statusCode: number, opts?: {
|
|
1350
1507
|
type?: string;
|
|
1351
1508
|
message?: string;
|
|
@@ -1355,6 +1512,13 @@ declare class HTTPError extends Error {
|
|
|
1355
1512
|
windowKind?: 'FIVE_HOUR' | 'WEEKLY';
|
|
1356
1513
|
windowResetAt?: string;
|
|
1357
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;
|
|
1358
1522
|
});
|
|
1359
1523
|
}
|
|
1360
1524
|
/**
|
|
@@ -1371,6 +1535,7 @@ declare class NetworkError extends Error {
|
|
|
1371
1535
|
cause?: unknown;
|
|
1372
1536
|
timeout: boolean;
|
|
1373
1537
|
eof: boolean;
|
|
1538
|
+
requestDisposition: RequestDisposition;
|
|
1374
1539
|
constructor(op: string, url: string, cause: unknown, opts?: {
|
|
1375
1540
|
timeout?: boolean;
|
|
1376
1541
|
eof?: boolean;
|
|
@@ -1387,6 +1552,8 @@ declare class NetworkError extends Error {
|
|
|
1387
1552
|
declare class StreamError extends Error {
|
|
1388
1553
|
/** 例: "empty_response" / "rate_limit" / "overloaded" / "" */
|
|
1389
1554
|
code: string;
|
|
1555
|
+
/** D23 gateway machine code; mirrors the legacy `code` field. */
|
|
1556
|
+
errorCode: string;
|
|
1390
1557
|
/** 例: "provider" / "settlement" */
|
|
1391
1558
|
stage: string;
|
|
1392
1559
|
/** 用户友好提示 (中文); 历史字段, 与 rawError 区分 */
|
|
@@ -1395,14 +1562,42 @@ declare class StreamError extends Error {
|
|
|
1395
1562
|
rawError: string;
|
|
1396
1563
|
/** 客户端是否值得重试 */
|
|
1397
1564
|
retryable: boolean;
|
|
1565
|
+
errorContractVersion?: number;
|
|
1566
|
+
faultDomain?: FaultDomain;
|
|
1567
|
+
requestDisposition?: RequestDisposition;
|
|
1568
|
+
transportRequestId?: string | null;
|
|
1569
|
+
consumeRequestId?: string | null;
|
|
1570
|
+
providerRequestId?: string | null;
|
|
1398
1571
|
constructor(opts?: {
|
|
1399
1572
|
code?: string;
|
|
1400
1573
|
stage?: string;
|
|
1401
1574
|
message?: string;
|
|
1402
1575
|
rawError?: string;
|
|
1403
1576
|
retryable?: boolean;
|
|
1577
|
+
errorContractVersion?: number;
|
|
1578
|
+
faultDomain?: FaultDomain;
|
|
1579
|
+
requestDisposition?: RequestDisposition;
|
|
1580
|
+
transportRequestId?: string | null;
|
|
1581
|
+
consumeRequestId?: string | null;
|
|
1582
|
+
providerRequestId?: string | null;
|
|
1404
1583
|
});
|
|
1405
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;
|
|
1406
1601
|
/**
|
|
1407
1602
|
* 判断错误是否为窗口限额拒绝 (5 小时 / 7 天滚动窗口 credit 用量达上限)。
|
|
1408
1603
|
* 结构化 errorCode 优先, message/body 子串防御兜底 (后端部署版本错位期:
|
|
@@ -5271,4 +5466,4 @@ declare class ChatBridgeClient {
|
|
|
5271
5466
|
revokeCredential(credentialRef: string, signal?: AbortSignal): Promise<void>;
|
|
5272
5467
|
}
|
|
5273
5468
|
|
|
5274
|
-
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, GATEWAY_REQUEST_ID_HEADER, type GateQuota, 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 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 };
|