@acosmi/sdk-ts 1.3.2 → 1.4.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 CHANGED
@@ -9,6 +9,62 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ---
11
11
 
12
+ ## [1.4.1] — 2026-05-22
13
+
14
+ ### Added
15
+
16
+ - **`Config.browserRefreshMode?: 'direct' | 'server-proxy' | 'none'`** 与
17
+ `refreshProxyURL` — 浏览器 Web OAuth token 刷新策略。默认 `direct` 保持既有行为;
18
+ `server-proxy` 可把刷新收口到同源 Route Handler,规避 OAuth issuer CORS 403;
19
+ `none` 用于产品自行处理过期登录态。新增错误码常量
20
+ `ErrOAuthCORSBlocked`、`ErrRefreshProxyFailed`、`ErrTokenExpired`。
21
+
22
+ ---
23
+
24
+ ## [1.4.0] — 2026-05-21
25
+
26
+ > csign `/login` Web OAuth 接入复核审计(`docs/audit/csign-login-oauth-audit-result-2026-05-21`)
27
+ > Phase A:在 SDK 增补浏览器 Web OAuth 原语。本版本为**纯增量、向后兼容**——
28
+ > 不改任何既有导出符号的签名或行为,桌面 loopback `login()` 流程完全不受影响。
29
+
30
+ ### Added
31
+
32
+ - **`discoverWebOAuthMetadata(serverURL, signal?)`** — 发现 Web OAuth 服务元数据,
33
+ 请求 `/.well-known/oauth-authorization-server/web`。与既有 `discover()`
34
+ (`/desktop`)共用内部 `discoverWithProfile(serverURL, profile, signal?)`,URL 解析、
35
+ fetch、错误处理与字段校验完全一致。`discoverWithProfile` 与
36
+ `OAuthMetadataProfile`(`'web' | 'desktop'`)一并导出。
37
+ - **`registerWebOAuthClient(meta, opts, signal?)`** — 动态注册浏览器 Web OAuth
38
+ 客户端。与 `register()`(桌面 loopback,硬编码 `redirect_uri=127.0.0.1`)的区别在于
39
+ 允许传入任意 Web `redirectURIs`;`opts = { clientName, redirectURIs, scopes? }`,
40
+ 注册体 `token_endpoint_auth_method: 'none'`、
41
+ `grant_types: ['authorization_code','refresh_token']`、`response_types: ['code']`,
42
+ 接受 HTTP 200/201。
43
+ - **`createWebAuthorizationRequest(meta, opts)`** — 构造 Web OAuth 授权请求:生成
44
+ PKCE verifier + S256 challenge + CSRF `state`,按 OAuth 2.1 拼装 authUrl
45
+ (`response_type=code`、`code_challenge_method=S256`、`state`、空格连接的 `scope`、
46
+ 可选 `login_hint`)。返回 `WebAuthorizationRequest`
47
+ (`{ authUrl, state, verifier, clientID, redirectURI, serverURL, createdAt }`),
48
+ 发起方应整体持久化为 pending 状态。
49
+ - **`completeWebAuthorizationRequest(pending, params, signal?)`** — 完成 Web OAuth:
50
+ 校验 `params.state === pending.state`(CSRF 防护,不匹配抛 `ErrStateMismatch`),
51
+ 依次 `discoverWebOAuthMetadata` → `exchangeCode` → `newTokenSet`,返回可持久化的
52
+ `TokenSet`。
53
+ - **`generateState()`** — 生成 32 字节加密随机 `state`(base64url 无填充),与
54
+ `generateCodeVerifier` 共用随机源。
55
+ - **`ErrStateMismatch`(`'state_mismatch'`)** — Web OAuth callback `state` 不匹配
56
+ 错误码,加入 `LoginErrCode` 联合类型。
57
+ - **`Config.oauthMetadataProfile?: 'web' | 'desktop'`** — 新增客户端配置项,决定
58
+ **所有 token 生命周期的 metadata 发现**走哪个 well-known 端点,覆盖
59
+ `ensureToken()` 刷新、`forceRefresh()`(401 强制刷新)以及 `logout()` 吊销
60
+ (revoke)三条路径——不止 `ensureToken`。默认 `'desktop'`,未设置时对既有调用方
61
+ 零影响;浏览器 Web OAuth 签发的 token 其 refresh / revoke 必须走 Web token /
62
+ revocation 端点,否则会打到桌面 loopback 端点导致刷新失败或吊销无效,故 csign 等
63
+ Web 应用应显式配 `'web'`。`login()` 桌面 loopback 授权路径仍固定走 `'desktop'`
64
+ 发现,不受此配置影响。
65
+
66
+ ---
67
+
12
68
  ## [1.3.2] — 2026-05-20
13
69
 
14
70
  > 生产闭环实施计划(`Acosmi-Compliance-SDK-Csign-PC-CrabCode-生产闭环实施计划-2026-05-20`)
@@ -1056,7 +1056,7 @@ init_adapters();
1056
1056
 
1057
1057
  // src/auth.ts
1058
1058
  var authTimeoutMs = 3e4;
1059
- async function discover(serverURL, signal) {
1059
+ async function discoverWithProfile(serverURL, profile, signal) {
1060
1060
  let parsed;
1061
1061
  try {
1062
1062
  parsed = new URL(serverURL.replace(/\/+$/, ""));
@@ -1064,7 +1064,7 @@ async function discover(serverURL, signal) {
1064
1064
  throw new Error(`discover: invalid server URL: ${e instanceof Error ? e.message : String(e)}`);
1065
1065
  }
1066
1066
  const origin = `${parsed.protocol}//${parsed.host}`;
1067
- const endpoint = `${origin}/.well-known/oauth-authorization-server/desktop`;
1067
+ const endpoint = `${origin}/.well-known/oauth-authorization-server/${profile}`;
1068
1068
  const ctl = withTimeout(authTimeoutMs, signal);
1069
1069
  let resp;
1070
1070
  try {
@@ -1090,6 +1090,12 @@ async function discover(serverURL, signal) {
1090
1090
  }
1091
1091
  return meta;
1092
1092
  }
1093
+ async function discover(serverURL, signal) {
1094
+ return discoverWithProfile(serverURL, "desktop", signal);
1095
+ }
1096
+ async function discoverWebOAuthMetadata(serverURL, signal) {
1097
+ return discoverWithProfile(serverURL, "web", signal);
1098
+ }
1093
1099
  async function register(meta, appName, signal) {
1094
1100
  const regReq = {
1095
1101
  client_name: appName,
@@ -1121,12 +1127,50 @@ async function register(meta, appName, signal) {
1121
1127
  throw new Error(`register: decode: ${e instanceof Error ? e.message : String(e)}`);
1122
1128
  }
1123
1129
  }
1124
- async function generateCodeVerifier() {
1130
+ async function registerWebOAuthClient(meta, opts, signal) {
1131
+ const regReq = {
1132
+ client_name: opts.clientName,
1133
+ token_endpoint_auth_method: "none",
1134
+ grant_types: ["authorization_code", "refresh_token"],
1135
+ redirect_uris: opts.redirectURIs,
1136
+ response_types: ["code"],
1137
+ ...opts.scopes ? { scope: opts.scopes.join(" ") } : {}
1138
+ };
1139
+ const ctl = withTimeout(authTimeoutMs, signal);
1140
+ let resp;
1141
+ try {
1142
+ resp = await fetch(meta.registration_endpoint, {
1143
+ method: "POST",
1144
+ headers: { "Content-Type": "application/json" },
1145
+ body: JSON.stringify(regReq),
1146
+ signal: ctl.signal
1147
+ });
1148
+ } catch (e) {
1149
+ throw new Error(`register: ${e instanceof Error ? e.message : String(e)}`);
1150
+ } finally {
1151
+ ctl.dispose();
1152
+ }
1153
+ if (resp.status !== 200 && resp.status !== 201) {
1154
+ throw new Error(`register: HTTP ${resp.status}`);
1155
+ }
1156
+ try {
1157
+ return await resp.json();
1158
+ } catch (e) {
1159
+ throw new Error(`register: decode: ${e instanceof Error ? e.message : String(e)}`);
1160
+ }
1161
+ }
1162
+ async function randomBase64Url32() {
1125
1163
  const c = await getCrypto();
1126
1164
  const b = new Uint8Array(32);
1127
1165
  c.getRandomValues(b);
1128
1166
  return base64urlNoPad(b);
1129
1167
  }
1168
+ async function generateCodeVerifier() {
1169
+ return randomBase64Url32();
1170
+ }
1171
+ async function generateState() {
1172
+ return randomBase64Url32();
1173
+ }
1130
1174
  async function codeChallenge(verifier) {
1131
1175
  const c = await getCrypto();
1132
1176
  const buf = await c.subtle.digest("SHA-256", new TextEncoder().encode(verifier));
@@ -1160,6 +1204,7 @@ var ErrAuthDenied = "auth_denied";
1160
1204
  var ErrTimeout = "auth_timeout";
1161
1205
  var ErrTokenExchange = "token_exchange_failed";
1162
1206
  var ErrSSLProxy = "ssl_proxy_detected";
1207
+ var ErrStateMismatch = "state_mismatch";
1163
1208
  function isSSLError(err) {
1164
1209
  const msg = err instanceof Error ? err.message : String(err);
1165
1210
  return msg.includes("tls:") || msg.includes("x509:") || msg.includes("certificate");
@@ -1273,6 +1318,51 @@ async function authorize(meta, clientID, scopes, opts = {}) {
1273
1318
  function htmlEscape(s) {
1274
1319
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1275
1320
  }
1321
+ async function createWebAuthorizationRequest(meta, opts) {
1322
+ const verifier = await generateCodeVerifier();
1323
+ const challenge = await codeChallenge(verifier);
1324
+ const state = await generateState();
1325
+ const authURL = new URL(meta.authorization_endpoint);
1326
+ authURL.searchParams.set("response_type", "code");
1327
+ authURL.searchParams.set("client_id", opts.clientID);
1328
+ authURL.searchParams.set("redirect_uri", opts.redirectURI);
1329
+ authURL.searchParams.set("code_challenge", challenge);
1330
+ authURL.searchParams.set("code_challenge_method", "S256");
1331
+ authURL.searchParams.set("state", state);
1332
+ authURL.searchParams.set("scope", opts.scopes.join(" "));
1333
+ if (opts.loginHint) {
1334
+ authURL.searchParams.set("login_hint", opts.loginHint);
1335
+ }
1336
+ return {
1337
+ authUrl: authURL.toString(),
1338
+ state,
1339
+ verifier,
1340
+ clientID: opts.clientID,
1341
+ redirectURI: opts.redirectURI,
1342
+ serverURL: opts.serverURL,
1343
+ createdAt: Date.now()
1344
+ };
1345
+ }
1346
+ async function completeWebAuthorizationRequest(pending, params, signal) {
1347
+ if (!params.code) {
1348
+ throw new Error("completeWebAuthorizationRequest: missing authorization code");
1349
+ }
1350
+ if (params.state !== pending.state) {
1351
+ throw new Error(
1352
+ `completeWebAuthorizationRequest: ${ErrStateMismatch}: callback state does not match pending state (possible CSRF)`
1353
+ );
1354
+ }
1355
+ const meta = await discoverWebOAuthMetadata(pending.serverURL, signal);
1356
+ const resp = await exchangeCode(
1357
+ meta,
1358
+ pending.clientID,
1359
+ params.code,
1360
+ pending.redirectURI,
1361
+ pending.verifier,
1362
+ signal
1363
+ );
1364
+ return newTokenSet(resp, pending.clientID, pending.serverURL);
1365
+ }
1276
1366
  async function exchangeCode(meta, clientID, code, redirectURI, codeVerifier, signal) {
1277
1367
  const data = new URLSearchParams({
1278
1368
  grant_type: "authorization_code",
@@ -2150,6 +2240,9 @@ var FilterStatusFallbackTkdistSkew = "fallback-tkdist-deployment-skew";
2150
2240
  var FilterStatusFallbackNoBuckets = "fallback-no-buckets";
2151
2241
  var FilterStatusFallbackMissingUser = "fallback-missing-userid";
2152
2242
  var FilterStatusUnknown = "";
2243
+ var ErrOAuthCORSBlocked = "oauth_cors_blocked";
2244
+ var ErrRefreshProxyFailed = "refresh_proxy_failed";
2245
+ var ErrTokenExpired = "token_expired";
2153
2246
  function newDeferred() {
2154
2247
  let resolve;
2155
2248
  let reject;
@@ -2165,6 +2258,12 @@ var Client = class _Client {
2165
2258
  serverURL;
2166
2259
  /** Compliance API 根地址 (已 trim 尾随 /); null = 走默认 ${serverURL}/admin-api */
2167
2260
  complianceBaseURL;
2261
+ /** OAuth metadata profile — 刷新 token 时发现 metadata 用 (默认 'desktop') */
2262
+ oauthMetadataProfile;
2263
+ /** Browser Web OAuth refresh strategy (default 'direct') */
2264
+ browserRefreshMode;
2265
+ /** Same-origin refresh proxy URL for browserRefreshMode='server-proxy' */
2266
+ refreshProxyURL;
2168
2267
  /** OAuth metadata (lazy loaded) */
2169
2268
  meta = null;
2170
2269
  /** 当前 token (内存) */
@@ -2199,6 +2298,9 @@ var Client = class _Client {
2199
2298
  constructor(cfg = {}) {
2200
2299
  this.serverURL = (cfg.serverURL ?? "https://acosmi.com").replace(/\/+$/, "");
2201
2300
  this.complianceBaseURL = cfg.complianceBaseURL ? cfg.complianceBaseURL.replace(/\/+$/, "") : null;
2301
+ this.oauthMetadataProfile = cfg.oauthMetadataProfile ?? "desktop";
2302
+ this.browserRefreshMode = cfg.browserRefreshMode ?? "direct";
2303
+ this.refreshProxyURL = cfg.refreshProxyURL ?? null;
2202
2304
  this.store = cfg.store ?? defaultTokenStore();
2203
2305
  this.fetchImpl = cfg.fetchImpl ?? globalThis.fetch.bind(globalThis);
2204
2306
  this.retryPolicy = effectivePolicy(cfg.retryPolicy ?? null);
@@ -2373,7 +2475,7 @@ var Client = class _Client {
2373
2475
  if (tokens) {
2374
2476
  if (!meta) {
2375
2477
  try {
2376
- meta = await discover(this.serverURL, signal);
2478
+ meta = await discoverWithProfile(this.serverURL, this.oauthMetadataProfile, signal);
2377
2479
  } catch (e) {
2378
2480
  console.warn(`[acosmi-sdk] warning: discover for revocation failed: ${e instanceof Error ? e.message : String(e)}`);
2379
2481
  }
@@ -2442,27 +2544,7 @@ var Client = class _Client {
2442
2544
  if (!tokenSetIsExpired(this.tokens)) {
2443
2545
  return this.tokens.access_token;
2444
2546
  }
2445
- if (this.meta == null) {
2446
- try {
2447
- this.meta = await discover(this.serverURL, signal);
2448
- } catch (e) {
2449
- throw new Error(
2450
- `discover for refresh: ${e instanceof Error ? e.message : String(e)}`
2451
- );
2452
- }
2453
- }
2454
- let tokenResp;
2455
- try {
2456
- tokenResp = await refreshToken(this.meta, this.tokens.client_id, this.tokens.refresh_token, signal);
2457
- } catch (e) {
2458
- throw new Error(`refresh token: ${e instanceof Error ? e.message : String(e)}`);
2459
- }
2460
- this.tokens = newTokenSet(tokenResp, this.tokens.client_id, this.serverURL);
2461
- try {
2462
- await this.store.save(this.tokens);
2463
- } catch (e) {
2464
- console.warn(`[acosmi-sdk] warning: save refreshed token failed: ${e instanceof Error ? e.message : String(e)}`);
2465
- }
2547
+ await this.refreshCurrentToken(signal);
2466
2548
  return this.tokens.access_token;
2467
2549
  })
2468
2550
  );
@@ -2475,26 +2557,111 @@ var Client = class _Client {
2475
2557
  if (this.tokens == null) {
2476
2558
  throw new Error("no tokens to refresh");
2477
2559
  }
2478
- if (this.meta == null) {
2479
- this.meta = await discover(this.serverURL, signal);
2480
- }
2481
- const tokenResp = await refreshToken(
2482
- this.meta,
2483
- this.tokens.client_id,
2484
- this.tokens.refresh_token,
2485
- signal
2486
- );
2487
- this.tokens = newTokenSet(tokenResp, this.tokens.client_id, this.serverURL);
2488
- try {
2489
- await this.store.save(this.tokens);
2490
- } catch (e) {
2491
- console.warn(
2492
- `[acosmi-sdk] warning: save refreshed token failed: ${e instanceof Error ? e.message : String(e)}`
2493
- );
2494
- }
2560
+ await this.refreshCurrentToken(signal);
2495
2561
  })
2496
2562
  );
2497
2563
  }
2564
+ async refreshCurrentToken(signal) {
2565
+ if (this.tokens == null) {
2566
+ throw new Error("no tokens to refresh");
2567
+ }
2568
+ if (this.browserRefreshMode === "none") {
2569
+ throw new Error(`${ErrTokenExpired}: token refresh disabled`);
2570
+ }
2571
+ if (this.browserRefreshMode === "server-proxy") {
2572
+ await this.refreshCurrentTokenViaProxy(signal);
2573
+ return;
2574
+ }
2575
+ await this.refreshCurrentTokenDirect(signal);
2576
+ }
2577
+ async refreshCurrentTokenDirect(signal) {
2578
+ if (this.tokens == null) {
2579
+ throw new Error("no tokens to refresh");
2580
+ }
2581
+ if (this.meta == null) {
2582
+ try {
2583
+ this.meta = await discoverWithProfile(this.serverURL, this.oauthMetadataProfile, signal);
2584
+ } catch (e) {
2585
+ throw new Error(
2586
+ `discover for refresh: ${e instanceof Error ? e.message : String(e)}`
2587
+ );
2588
+ }
2589
+ }
2590
+ let tokenResp;
2591
+ try {
2592
+ tokenResp = await refreshToken(
2593
+ this.meta,
2594
+ this.tokens.client_id,
2595
+ this.tokens.refresh_token,
2596
+ signal
2597
+ );
2598
+ } catch (e) {
2599
+ const message = e instanceof Error ? e.message : String(e);
2600
+ if (isLikelyBrowserOAuthCORSError(message)) {
2601
+ throw new Error(`${ErrOAuthCORSBlocked}: refresh token: ${message}`);
2602
+ }
2603
+ throw new Error(`refresh token: ${message}`);
2604
+ }
2605
+ this.tokens = newTokenSet(tokenResp, this.tokens.client_id, this.serverURL);
2606
+ await this.saveRefreshedToken();
2607
+ }
2608
+ async refreshCurrentTokenViaProxy(signal) {
2609
+ if (this.tokens == null) {
2610
+ throw new Error("no tokens to refresh");
2611
+ }
2612
+ if (!this.refreshProxyURL) {
2613
+ throw new Error(`${ErrRefreshProxyFailed}: refreshProxyURL is required`);
2614
+ }
2615
+ let resp;
2616
+ try {
2617
+ resp = await this.fetchImpl(this.refreshProxyURL, {
2618
+ method: "POST",
2619
+ headers: { "Content-Type": "application/json" },
2620
+ body: JSON.stringify({
2621
+ client_id: this.tokens.client_id,
2622
+ refresh_token: this.tokens.refresh_token,
2623
+ server_url: this.tokens.server_url || this.serverURL
2624
+ }),
2625
+ signal
2626
+ });
2627
+ } catch (e) {
2628
+ throw new Error(
2629
+ `${ErrRefreshProxyFailed}: ${e instanceof Error ? e.message : String(e)}`
2630
+ );
2631
+ }
2632
+ if (!resp.ok) {
2633
+ let message = "";
2634
+ try {
2635
+ const body2 = await resp.json();
2636
+ if (typeof body2.error === "string") message = body2.error;
2637
+ } catch {
2638
+ }
2639
+ throw new Error(`${ErrRefreshProxyFailed}: HTTP ${resp.status}: ${message}`);
2640
+ }
2641
+ let body;
2642
+ try {
2643
+ body = await resp.json();
2644
+ } catch (e) {
2645
+ throw new Error(
2646
+ `${ErrRefreshProxyFailed}: decode: ${e instanceof Error ? e.message : String(e)}`
2647
+ );
2648
+ }
2649
+ if (!isTokenSetLike(body.tokenSet)) {
2650
+ throw new Error(`${ErrRefreshProxyFailed}: response missing tokenSet`);
2651
+ }
2652
+ this.tokens = body.tokenSet;
2653
+ await this.saveRefreshedToken();
2654
+ }
2655
+ async saveRefreshedToken() {
2656
+ if (this.tokens == null) return;
2657
+ try {
2658
+ await this.store.save(this.tokens);
2659
+ } catch (e) {
2660
+ console.warn(
2661
+ `[acosmi-sdk] warning: save refreshed token failed: ${e instanceof Error ? e.message : String(e)}`
2662
+ );
2663
+ }
2664
+ }
2498
2665
  /** 互斥锁 helper (替代 Go sync.Mutex) */
2499
2666
  withMu(fn) {
2500
2667
  const next = this.mu.then(fn, fn);
@@ -3193,6 +3360,15 @@ function defaultTokenStore() {
3193
3360
  }
3194
3361
  return new InMemoryTokenStore();
3195
3362
  }
3363
+ function isLikelyBrowserOAuthCORSError(message) {
3364
+ const lower = message.toLowerCase();
3365
+ return lower.includes("failed to fetch") || lower.includes("networkerror") || lower.includes("cors") || lower.includes("http 403");
3366
+ }
3367
+ function isTokenSetLike(value) {
3368
+ if (value == null || typeof value !== "object") return false;
3369
+ const candidate = value;
3370
+ return typeof candidate.access_token === "string" && typeof candidate.refresh_token === "string" && typeof candidate.expires_at === "string" && typeof candidate.scope === "string" && typeof candidate.client_id === "string" && typeof candidate.server_url === "string";
3371
+ }
3196
3372
  function zeroModelCapabilities() {
3197
3373
  return {
3198
3374
  supports_thinking: false,
@@ -5369,6 +5545,6 @@ Client.prototype.getBugReport = async function(bugID, signal) {
5369
5545
  return resp.data;
5370
5546
  };
5371
5547
 
5372
- export { AgentRunStreamError, AgentRunsClient, AnthropicAdapter, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, ComplianceClient, CompliancePollError, LocalStorageTokenStore as DefaultBrowserTokenStore, DefaultRetryPolicy, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrTimeout, ErrTokenExchange, EventAuthURL, EventComplete, EventError, FileTokenStore, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, HTTPError, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OpenAIAdapter, OrderTerminalError, ProviderFormat, RateLimitError, ScopeAI, ScopeAccount, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, ScopeComplianceEvidenceRead, ScopeComplianceEvidenceWrite, ScopeComplianceReportsPublish, ScopeComplianceReportsRead, ScopeComplianceReportsWrite, ScopeComplianceSealApprovalApprove, ScopeComplianceSealApprovalRequest, ScopeComplianceSealManage, ScopeComplianceSealUseExecute, ScopeComplianceTimestampIssue, ScopeComplianceTimestampVerify, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, ServerToolTypeWebSearch, StreamError, ThinkingHigh, ThinkingHighMinMaxTokens, ThinkingMax, ThinkingMaxFallbackMaxTokens, ThinkingOff, allScopes, anthropicResponseTextContent, anthropicResponseThinkingContent, anthropicResponseToolUseBlocks, apiResponseBusinessError, apiResponseGetMessage, authorize, bucketInfoIsCommercial, bucketRowIsCommercial, buildBetas, classifyComplianceError, commerceScopes, complianceScopes, computeBackoff, defaultRetryable, defaultSafeToRetry, discover, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, getAdapter, getAdapterForModel, isBillingConfirmable, isComplianceBusinessError, isComplianceTerminalError, isSSLError, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, parseNotificationEvent, parseSettlement, parseSourcesEvent, refreshToken, register, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge };
5548
+ export { AgentRunStreamError, AgentRunsClient, AnthropicAdapter, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, ComplianceClient, CompliancePollError, LocalStorageTokenStore as DefaultBrowserTokenStore, DefaultRetryPolicy, 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, FileTokenStore, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, HTTPError, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OpenAIAdapter, OrderTerminalError, ProviderFormat, RateLimitError, ScopeAI, ScopeAccount, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, ScopeComplianceEvidenceRead, ScopeComplianceEvidenceWrite, ScopeComplianceReportsPublish, ScopeComplianceReportsRead, ScopeComplianceReportsWrite, ScopeComplianceSealApprovalApprove, ScopeComplianceSealApprovalRequest, ScopeComplianceSealManage, ScopeComplianceSealUseExecute, ScopeComplianceTimestampIssue, ScopeComplianceTimestampVerify, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, ServerToolTypeWebSearch, StreamError, ThinkingHigh, ThinkingHighMinMaxTokens, ThinkingMax, ThinkingMaxFallbackMaxTokens, ThinkingOff, allScopes, anthropicResponseTextContent, anthropicResponseThinkingContent, anthropicResponseToolUseBlocks, apiResponseBusinessError, apiResponseGetMessage, authorize, bucketInfoIsCommercial, bucketRowIsCommercial, buildBetas, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getAdapter, getAdapterForModel, isBillingConfirmable, isComplianceBusinessError, isComplianceTerminalError, isSSLError, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, parseNotificationEvent, parseSettlement, parseSourcesEvent, refreshToken, register, registerWebOAuthClient, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge };
5373
5549
  //# sourceMappingURL=index.mjs.map
5374
5550
  //# sourceMappingURL=index.mjs.map