@acosmi/sdk-ts 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { M as ManagedModel, I as InputModality, S as ServerMetadata, T as TokenResponse, a as TokenSet, C as ClientRegistration, B as BusinessError, b as ModelCoefficient, Q as QuotaSummary, c as ModelCapabilities, d as ChatRequest, P as ProviderAdapter, e as ChatResponse, A as AnthropicResponse, f as StreamEvent, g as SourcesEvent, h as StreamSettlement, E as EntitlementBalance, i as BalanceDetail, j as EntitlementItem, k as ConsumeRecordPage, l as ModelByQuotaResponse, m as ModelBucket, n as TokenPackage, o as PayPayload, O as Order, p as OrderStatus, W as WalletStats, q as Transaction, r as SkillStoreQuery, s as SkillStoreItem, t as SkillBrowseResponse, u as SkillBrowseListResponse, v as SkillSummary, w as CertificationStatus, G as GenerateSkillRequest, x as GenerateSkillResult, y as OptimizeSkillRequest, z as OptimizeSkillResult, D as ToolView, N as NotificationList, F as DeviceRegistration, H as NotificationPreference, J as WSEvent } from './index-28x02ITB.cjs';
2
- export { K as APIResponse, L as AnthropicContentBlock, R as AnthropicUsage, U as BucketClassCommercial, V as BucketClassGeneric, X as BucketInfo, Y as BucketRow, Z as ChatContentBlock, _ as ChatMessage, $ as ChatUsage, a0 as ConsumeRecord, a1 as EffortConfig, a2 as GeoLoc, a3 as HTTPError, a4 as ModelNotFoundError, a5 as NetworkError, a6 as Notification, a7 as NotificationUnreadCount, a8 as OpenAIChatChoice, a9 as OpenAIChatMessage, aa as OpenAIChatResponse, ab as OpenAIFunctionCall, ac as OpenAIStreamChoice, ad as OpenAIStreamChunk, ae as OpenAIStreamDelta, af as OpenAIStreamToolCall, ag as OpenAIToolCall, ah as OpenAIUsage, ai as OrderTerminalError, aj as OutputConfig, ak as ProviderFormat, al as RateLimitError, am as ServerTool, an as ServerToolTypeWebSearch, ao as SkillStoreListItem, ap as StreamError, aq as ThinkingConfig, ar as ThinkingHigh, as as ThinkingHighMinMaxTokens, at as ThinkingMax, au as ThinkingMaxFallbackMaxTokens, av as ThinkingOff, aw as ToolListResponse, ax as ToolProvider, ay as WebSearchConfig, az as WebSearchSource, aA as YudaoPageResult, aB as anthropicResponseTextContent, aC as anthropicResponseThinkingContent, aD as anthropicResponseToolUseBlocks, aE as apiResponseBusinessError, aF as apiResponseGetMessage, aG as bucketInfoIsCommercial, aH as bucketRowIsCommercial, aI as getAdapter, aJ as getAdapterForModel, aK as newThinkingConfig, aL as newWebSearchTool, aM as parseNotificationEvent, aN as parseSettlement, aO as parseSourcesEvent, aP as tokenSetIsExpired } from './index-28x02ITB.cjs';
1
+ import { M as ManagedModel, I as InputModality, S as ServerMetadata, T as TokenSet, a as TokenResponse, C as ClientRegistration, B as BusinessError, b as ModelCoefficient, Q as QuotaSummary, c as ModelCapabilities, d as ChatRequest, P as ProviderAdapter, e as ChatResponse, A as AnthropicResponse, f as StreamEvent, g as SourcesEvent, h as StreamSettlement, E as EntitlementBalance, i as BalanceDetail, j as EntitlementItem, k as ConsumeRecordPage, l as ModelByQuotaResponse, m as ModelBucket, n as TokenPackage, o as PayPayload, O as Order, p as OrderStatus, W as WalletStats, q as Transaction, r as SkillStoreQuery, s as SkillStoreItem, t as SkillBrowseResponse, u as SkillBrowseListResponse, v as SkillSummary, w as CertificationStatus, G as GenerateSkillRequest, x as GenerateSkillResult, y as OptimizeSkillRequest, z as OptimizeSkillResult, D as ToolView, N as NotificationList, F as DeviceRegistration, H as NotificationPreference, J as WSEvent } from './index-CbG9NqE-.cjs';
2
+ export { K as APIResponse, L as AnthropicContentBlock, R as AnthropicUsage, U as BucketClassCommercial, V as BucketClassGeneric, X as BucketInfo, Y as BucketRow, Z as ChatContentBlock, _ as ChatMessage, $ as ChatUsage, a0 as ConsumeRecord, a1 as EffortConfig, a2 as GeoLoc, a3 as HTTPError, a4 as ModelNotFoundError, a5 as NetworkError, a6 as Notification, a7 as NotificationUnreadCount, a8 as OpenAIChatChoice, a9 as OpenAIChatMessage, aa as OpenAIChatResponse, ab as OpenAIFunctionCall, ac as OpenAIStreamChoice, ad as OpenAIStreamChunk, ae as OpenAIStreamDelta, af as OpenAIStreamToolCall, ag as OpenAIToolCall, ah as OpenAIUsage, ai as OrderTerminalError, aj as OutputConfig, ak as ProviderFormat, al as RateLimitError, am as ServerTool, an as ServerToolTypeWebSearch, ao as SkillStoreListItem, ap as StreamError, aq as ThinkingConfig, ar as ThinkingHigh, as as ThinkingHighMinMaxTokens, at as ThinkingMax, au as ThinkingMaxFallbackMaxTokens, av as ThinkingOff, aw as ToolListResponse, ax as ToolProvider, ay as WebSearchConfig, az as WebSearchSource, aA as YudaoPageResult, aB as anthropicResponseTextContent, aC as anthropicResponseThinkingContent, aD as anthropicResponseToolUseBlocks, aE as apiResponseBusinessError, aF as apiResponseGetMessage, aG as bucketInfoIsCommercial, aH as bucketRowIsCommercial, aI as getAdapter, aJ as getAdapterForModel, aK as newThinkingConfig, aL as newWebSearchTool, aM as parseNotificationEvent, aN as parseSettlement, aO as parseSourcesEvent, aP as tokenSetIsExpired } from './index-CbG9NqE-.cjs';
3
3
  import { M as MinimalSanitizeConfig } from './index-nvLKgCm9.cjs';
4
4
  export { i as sanitize } from './index-nvLKgCm9.cjs';
5
5
  export { AnthropicAdapter } from './adapters/anthropic.cjs';
@@ -48,6 +48,19 @@ declare function findFirstModelByInputModality(models: ManagedModel[], modality:
48
48
  */
49
49
  declare function findDesktopVisualUnderstandingModel(models: ManagedModel[]): ManagedModel | null;
50
50
 
51
+ /** OAuth metadata profile — 决定 well-known 端点的路径后缀 */
52
+ type OAuthMetadataProfile = 'web' | 'desktop';
53
+ /**
54
+ * 从 well-known 端点获取指定 profile 的 OAuth 服务元数据。
55
+ *
56
+ * serverURL 可能含路径 (如 "https://acosmi.ai/api/v4"),
57
+ * well-known 端点按 RFC 8414 必须在 origin 根路径:
58
+ * https://acosmi.ai/.well-known/oauth-authorization-server/<profile>
59
+ *
60
+ * profile='desktop' 对应桌面 loopback OAuth;profile='web' 对应浏览器 Web OAuth。
61
+ * 内部 helper — `discover` / `discoverWebOAuthMetadata` 是其薄包装。
62
+ */
63
+ declare function discoverWithProfile(serverURL: string, profile: OAuthMetadataProfile, signal?: AbortSignal): Promise<ServerMetadata>;
51
64
  /**
52
65
  * 从 well-known 端点获取 Desktop OAuth 服务元数据。
53
66
  *
@@ -56,13 +69,48 @@ declare function findDesktopVisualUnderstandingModel(models: ManagedModel[]): Ma
56
69
  * https://acosmi.ai/.well-known/oauth-authorization-server/desktop
57
70
  */
58
71
  declare function discover(serverURL: string, signal?: AbortSignal): Promise<ServerMetadata>;
72
+ /**
73
+ * 从 well-known 端点获取 Web OAuth 服务元数据。
74
+ *
75
+ * 与 `discover` 行为一致, 但请求路径为
76
+ * https://acosmi.com/.well-known/oauth-authorization-server/web
77
+ *
78
+ * 浏览器侧 Web OAuth (csign 等第一方 Web 应用) 必须用此 profile,
79
+ * 它返回 Web authorize/token 端点; `discover` 的 desktop profile 返回的是
80
+ * 桌面 loopback 端点, 不可混用。
81
+ */
82
+ declare function discoverWebOAuthMetadata(serverURL: string, signal?: AbortSignal): Promise<ServerMetadata>;
59
83
  /** 动态注册桌面客户端,获取 client_id */
60
84
  declare function register(meta: ServerMetadata, appName: string, signal?: AbortSignal): Promise<ClientRegistration>;
85
+ /** Web OAuth 动态注册参数 */
86
+ interface RegisterWebOAuthClientOptions {
87
+ /** 客户端展示名 (RFC 7591 client_name) */
88
+ clientName: string;
89
+ /** 浏览器 Web OAuth 的 redirect_uri 列表 (如 ["https://sign.zhonglvbao.com/login/callback"]) */
90
+ redirectURIs: string[];
91
+ /** 可选 scope 列表 — 提供时以空格连接写入 RFC 7591 scope 字段 */
92
+ scopes?: string[];
93
+ }
94
+ /**
95
+ * 动态注册 Web OAuth (浏览器) 客户端,获取 client_id。
96
+ *
97
+ * 与 `register` (桌面 loopback, 硬编码 redirect_uri=127.0.0.1) 的区别:
98
+ * 本函数允许传入任意 Web redirect_uri,供 csign 等第一方 Web 应用使用。
99
+ * `token_endpoint_auth_method` 仍为 `none` (PKCE public client)。
100
+ */
101
+ declare function registerWebOAuthClient(meta: ServerMetadata, opts: RegisterWebOAuthClientOptions, signal?: AbortSignal): Promise<ClientRegistration>;
102
+ /**
103
+ * 生成 OAuth `state` 参数 — 32 字节加密随机数, base64url 无填充。
104
+ *
105
+ * 与 `generateCodeVerifier` 共用随机源 (`randomBase64Url32`)。Web OAuth 流程
106
+ * 用它做 CSRF 防护: 授权请求带上 state, callback 回来必须逐字符比对。
107
+ */
108
+ declare function generateState(): Promise<string>;
61
109
  type LoginEventType = 'auth_url' | 'complete' | 'error';
62
110
  declare const EventAuthURL: "auth_url";
63
111
  declare const EventComplete: "complete";
64
112
  declare const EventError: "error";
65
- type LoginErrCode = 'discovery_failed' | 'registration_failed' | 'browser_open_failed' | 'auth_denied' | 'auth_timeout' | 'token_exchange_failed' | 'ssl_proxy_detected';
113
+ type LoginErrCode = 'discovery_failed' | 'registration_failed' | 'browser_open_failed' | 'auth_denied' | 'auth_timeout' | 'token_exchange_failed' | 'ssl_proxy_detected' | 'state_mismatch';
66
114
  declare const ErrDiscovery: "discovery_failed";
67
115
  declare const ErrRegistration: "registration_failed";
68
116
  declare const ErrBrowserOpen: "browser_open_failed";
@@ -70,6 +118,8 @@ declare const ErrAuthDenied: "auth_denied";
70
118
  declare const ErrTimeout: "auth_timeout";
71
119
  declare const ErrTokenExchange: "token_exchange_failed";
72
120
  declare const ErrSSLProxy: "ssl_proxy_detected";
121
+ /** Web OAuth callback 的 state 与发起时不一致 (CSRF 防护) */
122
+ declare const ErrStateMismatch: "state_mismatch";
73
123
  /** 登录流程事件 */
74
124
  interface LoginEvent {
75
125
  type: LoginEventType;
@@ -112,6 +162,76 @@ declare function authorize(meta: ServerMetadata, clientID: string, scopes: strin
112
162
  result: AuthorizeResult;
113
163
  verifier: string;
114
164
  }>;
165
+ /**
166
+ * Web OAuth 授权请求 — `createWebAuthorizationRequest` 的返回结构。
167
+ *
168
+ * 发起方 (csign Next Route Handler 等) 应把整个对象作为 pending 状态持久化
169
+ * (HttpOnly cookie 等),callback 回来时取出供 `completeWebAuthorizationRequest` 校验。
170
+ */
171
+ interface WebAuthorizationRequest {
172
+ /** 完整授权 URL — 浏览器整页跳转到此地址 */
173
+ authUrl: string;
174
+ /** CSRF state — callback 必须回传同值 */
175
+ state: string;
176
+ /** PKCE code_verifier — 换 token 时使用, 切勿泄露给浏览器 URL */
177
+ verifier: string;
178
+ /** 动态注册得到的 client_id */
179
+ clientID: string;
180
+ /** 本次授权使用的 redirect_uri */
181
+ redirectURI: string;
182
+ /** OAuth issuer / SDK 业务域名 (用于 callback 阶段重新发现 metadata) */
183
+ serverURL: string;
184
+ /** 创建时间戳 (Date.now()),发起方可据此实现 TTL 过期判定 */
185
+ createdAt: number;
186
+ }
187
+ /** `createWebAuthorizationRequest` 参数 */
188
+ interface CreateWebAuthorizationRequestOptions {
189
+ /** 动态注册得到的 client_id */
190
+ clientID: string;
191
+ /** redirect_uri (须与动态注册登记的一致) */
192
+ redirectURI: string;
193
+ /** 请求的 scope 列表 — 以空格连接写入 authUrl */
194
+ scopes: string[];
195
+ /** OAuth issuer / SDK 业务域名 */
196
+ serverURL: string;
197
+ /** 可选 — SSO 场景下预填邮箱 */
198
+ loginHint?: string;
199
+ }
200
+ /**
201
+ * 构造 Web OAuth 授权请求。
202
+ *
203
+ * 生成 PKCE verifier + S256 challenge + CSRF state,按 OAuth 2.1 拼装授权 URL
204
+ * (含 `state` 参数 — SDK 桌面 `authorize` 不带 state, Web 流程必须带)。
205
+ *
206
+ * 返回的 `WebAuthorizationRequest` 应整体持久化为 pending 状态,
207
+ * callback 阶段交给 `completeWebAuthorizationRequest`。
208
+ */
209
+ declare function createWebAuthorizationRequest(meta: ServerMetadata, opts: CreateWebAuthorizationRequestOptions): Promise<WebAuthorizationRequest>;
210
+ /** `completeWebAuthorizationRequest` 的 pending 状态 (即 WebAuthorizationRequest 的子集) */
211
+ interface WebAuthorizationPending {
212
+ state: string;
213
+ verifier: string;
214
+ clientID: string;
215
+ redirectURI: string;
216
+ serverURL: string;
217
+ }
218
+ /** `completeWebAuthorizationRequest` 的 callback 参数 */
219
+ interface WebAuthorizationCallbackParams {
220
+ /** 授权服务器回传的 authorization code */
221
+ code: string;
222
+ /** 授权服务器回传的 state — 必须与 pending.state 一致 */
223
+ state: string;
224
+ }
225
+ /**
226
+ * 完成 Web OAuth 授权 — 校验 state → 换 token → 返回可持久化的 TokenSet。
227
+ *
228
+ * `pending` 为 `createWebAuthorizationRequest` 返回对象 (或其等价持久化结构);
229
+ * `params` 为 callback URL 解析出的 `code` / `state`。
230
+ *
231
+ * state 不匹配时抛错 (CSRF 防护)。内部依次:
232
+ * discoverWebOAuthMetadata(pending.serverURL) → exchangeCode(...) → newTokenSet(...)。
233
+ */
234
+ declare function completeWebAuthorizationRequest(pending: WebAuthorizationPending, params: WebAuthorizationCallbackParams, signal?: AbortSignal): Promise<TokenSet>;
115
235
  declare function exchangeCode(meta: ServerMetadata, clientID: string, code: string, redirectURI: string, codeVerifier: string, signal?: AbortSignal): Promise<TokenResponse>;
116
236
  /** 刷新 access_token */
117
237
  declare function refreshToken(meta: ServerMetadata, clientID: string, refreshTokenValue: string, signal?: AbortSignal): Promise<TokenResponse>;
@@ -720,6 +840,20 @@ interface Config {
720
840
  * `client.compliance.*`,不与既有模型网关 API 冲突。
721
841
  */
722
842
  complianceBaseURL?: string;
843
+ /**
844
+ * OAuth metadata profile — 决定 `ensureToken` 刷新 token 时
845
+ * 发现 metadata 走哪个 well-known 端点。
846
+ *
847
+ * - `'desktop'` (默认): `/.well-known/oauth-authorization-server/desktop`
848
+ * — 桌面 loopback OAuth (`login()`) 流程。
849
+ * - `'web'`: `/.well-known/oauth-authorization-server/web`
850
+ * — 浏览器 Web OAuth (csign 等第一方 Web 应用) 签发的 token,
851
+ * 其 refresh 必须走 Web token 端点。
852
+ *
853
+ * 未设置时默认 `'desktop'`,对既有调用方行为完全无影响。
854
+ * `login()` 桌面 loopback 路径不受此配置影响。
855
+ */
856
+ oauthMetadataProfile?: OAuthMetadataProfile;
723
857
  }
724
858
  interface Deferred<T> {
725
859
  promise: Promise<T>;
@@ -746,6 +880,8 @@ declare class Client {
746
880
  serverURL: string;
747
881
  /** Compliance API 根地址 (已 trim 尾随 /); null = 走默认 ${serverURL}/admin-api */
748
882
  complianceBaseURL: string | null;
883
+ /** OAuth metadata profile — 刷新 token 时发现 metadata 用 (默认 'desktop') */
884
+ oauthMetadataProfile: OAuthMetadataProfile;
749
885
  /** OAuth metadata (lazy loaded) */
750
886
  meta: ServerMetadata | null;
751
887
  /** 当前 token (内存) */
@@ -1604,4 +1740,4 @@ declare module '@acosmi/sdk-ts' {
1604
1740
  }
1605
1741
  }
1606
1742
 
1607
- export { type AgentRun, type AgentRunArtifact, type AgentRunArtifactList, type AgentRunArtifactPolicy, type AgentRunCreateRequest, type AgentRunCreateResponse, type AgentRunDownload, type AgentRunErrorPayload, type AgentRunLocalContextPolicy, type AgentRunLocalToolHandler, type AgentRunLocalToolHandlerContext, type AgentRunLocalToolResult, type AgentRunRunOptions, type AgentRunSettlement, type AgentRunStatus, AgentRunStreamError, type AgentRunStreamEvent, type AgentRunStreamOptions, type AgentRunUsage, type AgentRunWithLocalToolsOptions, AgentRunsClient, AnthropicResponse, type ApproveSealApprovalQuery, type AuthorizeResult, BalanceDetail, type BlockMeta, type BugReportResult, type BugView, BusinessError, type CancelSealApprovalQuery, CertificationStatus, ChatRequest, ChatResponse, Client, ClientRegistration, type ComplianceAssetType, type ComplianceBillingDisplayStatus, ComplianceClient, type ComplianceClientErrorCode, type ComplianceDigestSource, type ComplianceEnvelopeStatus, type ComplianceErrorInfo, type ComplianceErrorKey, type ComplianceHashAlgorithm, CompliancePollError, type CompliancePollOptions, type CompliancePrivacyLevel, type ComplianceProviderRequestStatus, type ComplianceProviderStatus, type ComplianceReport, type ComplianceScope, type ComplianceSealApprovalStatus, type ComplianceTimestampVerificationStatus, type ComplianceWriteOptions, type Config, ConsumeRecordPage, type CreateEvidenceAssetRequest, type CreateH5SigningUrlRequest, type CreateReportRequest, type CreateSigningEnvelopeRequest, DefaultRetryPolicy, DeviceRegistration, EntitlementBalance, EntitlementItem, 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, type EvidenceAsset, type EvidencePackage, FileTokenStore, type FilterStatus, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, GenerateSkillRequest, GenerateSkillResult, InMemoryTokenStore, InputModality, type IssueTimestampRequest, LocalStorageTokenStore, type LoginErrCode, type LoginEvent, type LoginEventType, type LoginOptions, ManagedModel, ModelBucket, ModelByQuotaResponse, ModelCapabilities, ModelCoefficient, NotificationList, NotificationPreference, OptimizeSkillRequest, OptimizeSkillResult, Order, OrderStatus, PayPayload, ProviderAdapter, type ProviderRequestStatusView, type PublicEvidenceVerifyResult, QuotaSummary, type RejectSealApprovalQuery, type ReportDownload, type RetryPolicy, type RetryRequestInfo, 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, type SealApproval, ServerMetadata, type SignEnvelopeRequest, type SigningEnvelope, SkillBrowseListResponse, SkillBrowseResponse, SkillStoreItem, SkillStoreQuery, SkillSummary, SourcesEvent, StreamEvent, StreamSettlement, type SubmitSealApprovalRequest, type TimestampToken, type TimestampVerifyResult, TokenPackage, TokenResponse, TokenSet, type TokenStore, ToolView, Transaction, type VerifyTimestampRequest, type WSConfig, WSEvent, WalletStats, allScopes, authorize, buildBetas, classifyComplianceError, commerceScopes, complianceScopes, computeBackoff, defaultRetryable, defaultSafeToRetry, discover, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, isBillingConfirmable, isComplianceBusinessError, isComplianceTerminalError, isSSLError, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newTokenSet, refreshToken, register, revokeToken, skillScopes, uniqueMerge };
1743
+ export { type AgentRun, type AgentRunArtifact, type AgentRunArtifactList, type AgentRunArtifactPolicy, type AgentRunCreateRequest, type AgentRunCreateResponse, type AgentRunDownload, type AgentRunErrorPayload, type AgentRunLocalContextPolicy, type AgentRunLocalToolHandler, type AgentRunLocalToolHandlerContext, type AgentRunLocalToolResult, type AgentRunRunOptions, type AgentRunSettlement, type AgentRunStatus, AgentRunStreamError, type AgentRunStreamEvent, type AgentRunStreamOptions, type AgentRunUsage, type AgentRunWithLocalToolsOptions, AgentRunsClient, AnthropicResponse, type ApproveSealApprovalQuery, type AuthorizeResult, BalanceDetail, type BlockMeta, type BugReportResult, type BugView, BusinessError, type CancelSealApprovalQuery, CertificationStatus, ChatRequest, ChatResponse, Client, ClientRegistration, type ComplianceAssetType, type ComplianceBillingDisplayStatus, ComplianceClient, type ComplianceClientErrorCode, type ComplianceDigestSource, type ComplianceEnvelopeStatus, type ComplianceErrorInfo, type ComplianceErrorKey, type ComplianceHashAlgorithm, CompliancePollError, type CompliancePollOptions, type CompliancePrivacyLevel, type ComplianceProviderRequestStatus, type ComplianceProviderStatus, type ComplianceReport, type ComplianceScope, type ComplianceSealApprovalStatus, type ComplianceTimestampVerificationStatus, type ComplianceWriteOptions, type Config, ConsumeRecordPage, type CreateEvidenceAssetRequest, type CreateH5SigningUrlRequest, type CreateReportRequest, type CreateSigningEnvelopeRequest, type CreateWebAuthorizationRequestOptions, DefaultRetryPolicy, DeviceRegistration, EntitlementBalance, EntitlementItem, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, EventAuthURL, EventComplete, EventError, type EvidenceAsset, type EvidencePackage, FileTokenStore, type FilterStatus, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, GenerateSkillRequest, GenerateSkillResult, InMemoryTokenStore, InputModality, type IssueTimestampRequest, LocalStorageTokenStore, type LoginErrCode, type LoginEvent, type LoginEventType, type LoginOptions, ManagedModel, ModelBucket, ModelByQuotaResponse, ModelCapabilities, ModelCoefficient, NotificationList, NotificationPreference, type OAuthMetadataProfile, OptimizeSkillRequest, OptimizeSkillResult, Order, OrderStatus, PayPayload, ProviderAdapter, type ProviderRequestStatusView, type PublicEvidenceVerifyResult, QuotaSummary, type RegisterWebOAuthClientOptions, type RejectSealApprovalQuery, type ReportDownload, type RetryPolicy, type RetryRequestInfo, 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, type SealApproval, ServerMetadata, type SignEnvelopeRequest, type SigningEnvelope, SkillBrowseListResponse, SkillBrowseResponse, SkillStoreItem, SkillStoreQuery, SkillSummary, SourcesEvent, StreamEvent, StreamSettlement, type SubmitSealApprovalRequest, type TimestampToken, type TimestampVerifyResult, TokenPackage, TokenResponse, TokenSet, type TokenStore, ToolView, Transaction, type VerifyTimestampRequest, type WSConfig, WSEvent, WalletStats, type WebAuthorizationCallbackParams, type WebAuthorizationPending, type WebAuthorizationRequest, allScopes, authorize, buildBetas, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, isBillingConfirmable, isComplianceBusinessError, isComplianceTerminalError, isSSLError, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newTokenSet, refreshToken, register, registerWebOAuthClient, revokeToken, skillScopes, uniqueMerge };
@@ -1,5 +1,5 @@
1
- import { M as ManagedModel, I as InputModality, S as ServerMetadata, T as TokenResponse, a as TokenSet, C as ClientRegistration, B as BusinessError, b as ModelCoefficient, Q as QuotaSummary, c as ModelCapabilities, d as ChatRequest, P as ProviderAdapter, e as ChatResponse, A as AnthropicResponse, f as StreamEvent, g as SourcesEvent, h as StreamSettlement, E as EntitlementBalance, i as BalanceDetail, j as EntitlementItem, k as ConsumeRecordPage, l as ModelByQuotaResponse, m as ModelBucket, n as TokenPackage, o as PayPayload, O as Order, p as OrderStatus, W as WalletStats, q as Transaction, r as SkillStoreQuery, s as SkillStoreItem, t as SkillBrowseResponse, u as SkillBrowseListResponse, v as SkillSummary, w as CertificationStatus, G as GenerateSkillRequest, x as GenerateSkillResult, y as OptimizeSkillRequest, z as OptimizeSkillResult, D as ToolView, N as NotificationList, F as DeviceRegistration, H as NotificationPreference, J as WSEvent } from './index-28x02ITB.js';
2
- export { K as APIResponse, L as AnthropicContentBlock, R as AnthropicUsage, U as BucketClassCommercial, V as BucketClassGeneric, X as BucketInfo, Y as BucketRow, Z as ChatContentBlock, _ as ChatMessage, $ as ChatUsage, a0 as ConsumeRecord, a1 as EffortConfig, a2 as GeoLoc, a3 as HTTPError, a4 as ModelNotFoundError, a5 as NetworkError, a6 as Notification, a7 as NotificationUnreadCount, a8 as OpenAIChatChoice, a9 as OpenAIChatMessage, aa as OpenAIChatResponse, ab as OpenAIFunctionCall, ac as OpenAIStreamChoice, ad as OpenAIStreamChunk, ae as OpenAIStreamDelta, af as OpenAIStreamToolCall, ag as OpenAIToolCall, ah as OpenAIUsage, ai as OrderTerminalError, aj as OutputConfig, ak as ProviderFormat, al as RateLimitError, am as ServerTool, an as ServerToolTypeWebSearch, ao as SkillStoreListItem, ap as StreamError, aq as ThinkingConfig, ar as ThinkingHigh, as as ThinkingHighMinMaxTokens, at as ThinkingMax, au as ThinkingMaxFallbackMaxTokens, av as ThinkingOff, aw as ToolListResponse, ax as ToolProvider, ay as WebSearchConfig, az as WebSearchSource, aA as YudaoPageResult, aB as anthropicResponseTextContent, aC as anthropicResponseThinkingContent, aD as anthropicResponseToolUseBlocks, aE as apiResponseBusinessError, aF as apiResponseGetMessage, aG as bucketInfoIsCommercial, aH as bucketRowIsCommercial, aI as getAdapter, aJ as getAdapterForModel, aK as newThinkingConfig, aL as newWebSearchTool, aM as parseNotificationEvent, aN as parseSettlement, aO as parseSourcesEvent, aP as tokenSetIsExpired } from './index-28x02ITB.js';
1
+ import { M as ManagedModel, I as InputModality, S as ServerMetadata, T as TokenSet, a as TokenResponse, C as ClientRegistration, B as BusinessError, b as ModelCoefficient, Q as QuotaSummary, c as ModelCapabilities, d as ChatRequest, P as ProviderAdapter, e as ChatResponse, A as AnthropicResponse, f as StreamEvent, g as SourcesEvent, h as StreamSettlement, E as EntitlementBalance, i as BalanceDetail, j as EntitlementItem, k as ConsumeRecordPage, l as ModelByQuotaResponse, m as ModelBucket, n as TokenPackage, o as PayPayload, O as Order, p as OrderStatus, W as WalletStats, q as Transaction, r as SkillStoreQuery, s as SkillStoreItem, t as SkillBrowseResponse, u as SkillBrowseListResponse, v as SkillSummary, w as CertificationStatus, G as GenerateSkillRequest, x as GenerateSkillResult, y as OptimizeSkillRequest, z as OptimizeSkillResult, D as ToolView, N as NotificationList, F as DeviceRegistration, H as NotificationPreference, J as WSEvent } from './index-CbG9NqE-.js';
2
+ export { K as APIResponse, L as AnthropicContentBlock, R as AnthropicUsage, U as BucketClassCommercial, V as BucketClassGeneric, X as BucketInfo, Y as BucketRow, Z as ChatContentBlock, _ as ChatMessage, $ as ChatUsage, a0 as ConsumeRecord, a1 as EffortConfig, a2 as GeoLoc, a3 as HTTPError, a4 as ModelNotFoundError, a5 as NetworkError, a6 as Notification, a7 as NotificationUnreadCount, a8 as OpenAIChatChoice, a9 as OpenAIChatMessage, aa as OpenAIChatResponse, ab as OpenAIFunctionCall, ac as OpenAIStreamChoice, ad as OpenAIStreamChunk, ae as OpenAIStreamDelta, af as OpenAIStreamToolCall, ag as OpenAIToolCall, ah as OpenAIUsage, ai as OrderTerminalError, aj as OutputConfig, ak as ProviderFormat, al as RateLimitError, am as ServerTool, an as ServerToolTypeWebSearch, ao as SkillStoreListItem, ap as StreamError, aq as ThinkingConfig, ar as ThinkingHigh, as as ThinkingHighMinMaxTokens, at as ThinkingMax, au as ThinkingMaxFallbackMaxTokens, av as ThinkingOff, aw as ToolListResponse, ax as ToolProvider, ay as WebSearchConfig, az as WebSearchSource, aA as YudaoPageResult, aB as anthropicResponseTextContent, aC as anthropicResponseThinkingContent, aD as anthropicResponseToolUseBlocks, aE as apiResponseBusinessError, aF as apiResponseGetMessage, aG as bucketInfoIsCommercial, aH as bucketRowIsCommercial, aI as getAdapter, aJ as getAdapterForModel, aK as newThinkingConfig, aL as newWebSearchTool, aM as parseNotificationEvent, aN as parseSettlement, aO as parseSourcesEvent, aP as tokenSetIsExpired } from './index-CbG9NqE-.js';
3
3
  import { M as MinimalSanitizeConfig } from './index-nvLKgCm9.js';
4
4
  export { i as sanitize } from './index-nvLKgCm9.js';
5
5
  export { AnthropicAdapter } from './adapters/anthropic.js';
@@ -48,6 +48,19 @@ declare function findFirstModelByInputModality(models: ManagedModel[], modality:
48
48
  */
49
49
  declare function findDesktopVisualUnderstandingModel(models: ManagedModel[]): ManagedModel | null;
50
50
 
51
+ /** OAuth metadata profile — 决定 well-known 端点的路径后缀 */
52
+ type OAuthMetadataProfile = 'web' | 'desktop';
53
+ /**
54
+ * 从 well-known 端点获取指定 profile 的 OAuth 服务元数据。
55
+ *
56
+ * serverURL 可能含路径 (如 "https://acosmi.ai/api/v4"),
57
+ * well-known 端点按 RFC 8414 必须在 origin 根路径:
58
+ * https://acosmi.ai/.well-known/oauth-authorization-server/<profile>
59
+ *
60
+ * profile='desktop' 对应桌面 loopback OAuth;profile='web' 对应浏览器 Web OAuth。
61
+ * 内部 helper — `discover` / `discoverWebOAuthMetadata` 是其薄包装。
62
+ */
63
+ declare function discoverWithProfile(serverURL: string, profile: OAuthMetadataProfile, signal?: AbortSignal): Promise<ServerMetadata>;
51
64
  /**
52
65
  * 从 well-known 端点获取 Desktop OAuth 服务元数据。
53
66
  *
@@ -56,13 +69,48 @@ declare function findDesktopVisualUnderstandingModel(models: ManagedModel[]): Ma
56
69
  * https://acosmi.ai/.well-known/oauth-authorization-server/desktop
57
70
  */
58
71
  declare function discover(serverURL: string, signal?: AbortSignal): Promise<ServerMetadata>;
72
+ /**
73
+ * 从 well-known 端点获取 Web OAuth 服务元数据。
74
+ *
75
+ * 与 `discover` 行为一致, 但请求路径为
76
+ * https://acosmi.com/.well-known/oauth-authorization-server/web
77
+ *
78
+ * 浏览器侧 Web OAuth (csign 等第一方 Web 应用) 必须用此 profile,
79
+ * 它返回 Web authorize/token 端点; `discover` 的 desktop profile 返回的是
80
+ * 桌面 loopback 端点, 不可混用。
81
+ */
82
+ declare function discoverWebOAuthMetadata(serverURL: string, signal?: AbortSignal): Promise<ServerMetadata>;
59
83
  /** 动态注册桌面客户端,获取 client_id */
60
84
  declare function register(meta: ServerMetadata, appName: string, signal?: AbortSignal): Promise<ClientRegistration>;
85
+ /** Web OAuth 动态注册参数 */
86
+ interface RegisterWebOAuthClientOptions {
87
+ /** 客户端展示名 (RFC 7591 client_name) */
88
+ clientName: string;
89
+ /** 浏览器 Web OAuth 的 redirect_uri 列表 (如 ["https://sign.zhonglvbao.com/login/callback"]) */
90
+ redirectURIs: string[];
91
+ /** 可选 scope 列表 — 提供时以空格连接写入 RFC 7591 scope 字段 */
92
+ scopes?: string[];
93
+ }
94
+ /**
95
+ * 动态注册 Web OAuth (浏览器) 客户端,获取 client_id。
96
+ *
97
+ * 与 `register` (桌面 loopback, 硬编码 redirect_uri=127.0.0.1) 的区别:
98
+ * 本函数允许传入任意 Web redirect_uri,供 csign 等第一方 Web 应用使用。
99
+ * `token_endpoint_auth_method` 仍为 `none` (PKCE public client)。
100
+ */
101
+ declare function registerWebOAuthClient(meta: ServerMetadata, opts: RegisterWebOAuthClientOptions, signal?: AbortSignal): Promise<ClientRegistration>;
102
+ /**
103
+ * 生成 OAuth `state` 参数 — 32 字节加密随机数, base64url 无填充。
104
+ *
105
+ * 与 `generateCodeVerifier` 共用随机源 (`randomBase64Url32`)。Web OAuth 流程
106
+ * 用它做 CSRF 防护: 授权请求带上 state, callback 回来必须逐字符比对。
107
+ */
108
+ declare function generateState(): Promise<string>;
61
109
  type LoginEventType = 'auth_url' | 'complete' | 'error';
62
110
  declare const EventAuthURL: "auth_url";
63
111
  declare const EventComplete: "complete";
64
112
  declare const EventError: "error";
65
- type LoginErrCode = 'discovery_failed' | 'registration_failed' | 'browser_open_failed' | 'auth_denied' | 'auth_timeout' | 'token_exchange_failed' | 'ssl_proxy_detected';
113
+ type LoginErrCode = 'discovery_failed' | 'registration_failed' | 'browser_open_failed' | 'auth_denied' | 'auth_timeout' | 'token_exchange_failed' | 'ssl_proxy_detected' | 'state_mismatch';
66
114
  declare const ErrDiscovery: "discovery_failed";
67
115
  declare const ErrRegistration: "registration_failed";
68
116
  declare const ErrBrowserOpen: "browser_open_failed";
@@ -70,6 +118,8 @@ declare const ErrAuthDenied: "auth_denied";
70
118
  declare const ErrTimeout: "auth_timeout";
71
119
  declare const ErrTokenExchange: "token_exchange_failed";
72
120
  declare const ErrSSLProxy: "ssl_proxy_detected";
121
+ /** Web OAuth callback 的 state 与发起时不一致 (CSRF 防护) */
122
+ declare const ErrStateMismatch: "state_mismatch";
73
123
  /** 登录流程事件 */
74
124
  interface LoginEvent {
75
125
  type: LoginEventType;
@@ -112,6 +162,76 @@ declare function authorize(meta: ServerMetadata, clientID: string, scopes: strin
112
162
  result: AuthorizeResult;
113
163
  verifier: string;
114
164
  }>;
165
+ /**
166
+ * Web OAuth 授权请求 — `createWebAuthorizationRequest` 的返回结构。
167
+ *
168
+ * 发起方 (csign Next Route Handler 等) 应把整个对象作为 pending 状态持久化
169
+ * (HttpOnly cookie 等),callback 回来时取出供 `completeWebAuthorizationRequest` 校验。
170
+ */
171
+ interface WebAuthorizationRequest {
172
+ /** 完整授权 URL — 浏览器整页跳转到此地址 */
173
+ authUrl: string;
174
+ /** CSRF state — callback 必须回传同值 */
175
+ state: string;
176
+ /** PKCE code_verifier — 换 token 时使用, 切勿泄露给浏览器 URL */
177
+ verifier: string;
178
+ /** 动态注册得到的 client_id */
179
+ clientID: string;
180
+ /** 本次授权使用的 redirect_uri */
181
+ redirectURI: string;
182
+ /** OAuth issuer / SDK 业务域名 (用于 callback 阶段重新发现 metadata) */
183
+ serverURL: string;
184
+ /** 创建时间戳 (Date.now()),发起方可据此实现 TTL 过期判定 */
185
+ createdAt: number;
186
+ }
187
+ /** `createWebAuthorizationRequest` 参数 */
188
+ interface CreateWebAuthorizationRequestOptions {
189
+ /** 动态注册得到的 client_id */
190
+ clientID: string;
191
+ /** redirect_uri (须与动态注册登记的一致) */
192
+ redirectURI: string;
193
+ /** 请求的 scope 列表 — 以空格连接写入 authUrl */
194
+ scopes: string[];
195
+ /** OAuth issuer / SDK 业务域名 */
196
+ serverURL: string;
197
+ /** 可选 — SSO 场景下预填邮箱 */
198
+ loginHint?: string;
199
+ }
200
+ /**
201
+ * 构造 Web OAuth 授权请求。
202
+ *
203
+ * 生成 PKCE verifier + S256 challenge + CSRF state,按 OAuth 2.1 拼装授权 URL
204
+ * (含 `state` 参数 — SDK 桌面 `authorize` 不带 state, Web 流程必须带)。
205
+ *
206
+ * 返回的 `WebAuthorizationRequest` 应整体持久化为 pending 状态,
207
+ * callback 阶段交给 `completeWebAuthorizationRequest`。
208
+ */
209
+ declare function createWebAuthorizationRequest(meta: ServerMetadata, opts: CreateWebAuthorizationRequestOptions): Promise<WebAuthorizationRequest>;
210
+ /** `completeWebAuthorizationRequest` 的 pending 状态 (即 WebAuthorizationRequest 的子集) */
211
+ interface WebAuthorizationPending {
212
+ state: string;
213
+ verifier: string;
214
+ clientID: string;
215
+ redirectURI: string;
216
+ serverURL: string;
217
+ }
218
+ /** `completeWebAuthorizationRequest` 的 callback 参数 */
219
+ interface WebAuthorizationCallbackParams {
220
+ /** 授权服务器回传的 authorization code */
221
+ code: string;
222
+ /** 授权服务器回传的 state — 必须与 pending.state 一致 */
223
+ state: string;
224
+ }
225
+ /**
226
+ * 完成 Web OAuth 授权 — 校验 state → 换 token → 返回可持久化的 TokenSet。
227
+ *
228
+ * `pending` 为 `createWebAuthorizationRequest` 返回对象 (或其等价持久化结构);
229
+ * `params` 为 callback URL 解析出的 `code` / `state`。
230
+ *
231
+ * state 不匹配时抛错 (CSRF 防护)。内部依次:
232
+ * discoverWebOAuthMetadata(pending.serverURL) → exchangeCode(...) → newTokenSet(...)。
233
+ */
234
+ declare function completeWebAuthorizationRequest(pending: WebAuthorizationPending, params: WebAuthorizationCallbackParams, signal?: AbortSignal): Promise<TokenSet>;
115
235
  declare function exchangeCode(meta: ServerMetadata, clientID: string, code: string, redirectURI: string, codeVerifier: string, signal?: AbortSignal): Promise<TokenResponse>;
116
236
  /** 刷新 access_token */
117
237
  declare function refreshToken(meta: ServerMetadata, clientID: string, refreshTokenValue: string, signal?: AbortSignal): Promise<TokenResponse>;
@@ -720,6 +840,20 @@ interface Config {
720
840
  * `client.compliance.*`,不与既有模型网关 API 冲突。
721
841
  */
722
842
  complianceBaseURL?: string;
843
+ /**
844
+ * OAuth metadata profile — 决定 `ensureToken` 刷新 token 时
845
+ * 发现 metadata 走哪个 well-known 端点。
846
+ *
847
+ * - `'desktop'` (默认): `/.well-known/oauth-authorization-server/desktop`
848
+ * — 桌面 loopback OAuth (`login()`) 流程。
849
+ * - `'web'`: `/.well-known/oauth-authorization-server/web`
850
+ * — 浏览器 Web OAuth (csign 等第一方 Web 应用) 签发的 token,
851
+ * 其 refresh 必须走 Web token 端点。
852
+ *
853
+ * 未设置时默认 `'desktop'`,对既有调用方行为完全无影响。
854
+ * `login()` 桌面 loopback 路径不受此配置影响。
855
+ */
856
+ oauthMetadataProfile?: OAuthMetadataProfile;
723
857
  }
724
858
  interface Deferred<T> {
725
859
  promise: Promise<T>;
@@ -746,6 +880,8 @@ declare class Client {
746
880
  serverURL: string;
747
881
  /** Compliance API 根地址 (已 trim 尾随 /); null = 走默认 ${serverURL}/admin-api */
748
882
  complianceBaseURL: string | null;
883
+ /** OAuth metadata profile — 刷新 token 时发现 metadata 用 (默认 'desktop') */
884
+ oauthMetadataProfile: OAuthMetadataProfile;
749
885
  /** OAuth metadata (lazy loaded) */
750
886
  meta: ServerMetadata | null;
751
887
  /** 当前 token (内存) */
@@ -1604,4 +1740,4 @@ declare module '@acosmi/sdk-ts' {
1604
1740
  }
1605
1741
  }
1606
1742
 
1607
- export { type AgentRun, type AgentRunArtifact, type AgentRunArtifactList, type AgentRunArtifactPolicy, type AgentRunCreateRequest, type AgentRunCreateResponse, type AgentRunDownload, type AgentRunErrorPayload, type AgentRunLocalContextPolicy, type AgentRunLocalToolHandler, type AgentRunLocalToolHandlerContext, type AgentRunLocalToolResult, type AgentRunRunOptions, type AgentRunSettlement, type AgentRunStatus, AgentRunStreamError, type AgentRunStreamEvent, type AgentRunStreamOptions, type AgentRunUsage, type AgentRunWithLocalToolsOptions, AgentRunsClient, AnthropicResponse, type ApproveSealApprovalQuery, type AuthorizeResult, BalanceDetail, type BlockMeta, type BugReportResult, type BugView, BusinessError, type CancelSealApprovalQuery, CertificationStatus, ChatRequest, ChatResponse, Client, ClientRegistration, type ComplianceAssetType, type ComplianceBillingDisplayStatus, ComplianceClient, type ComplianceClientErrorCode, type ComplianceDigestSource, type ComplianceEnvelopeStatus, type ComplianceErrorInfo, type ComplianceErrorKey, type ComplianceHashAlgorithm, CompliancePollError, type CompliancePollOptions, type CompliancePrivacyLevel, type ComplianceProviderRequestStatus, type ComplianceProviderStatus, type ComplianceReport, type ComplianceScope, type ComplianceSealApprovalStatus, type ComplianceTimestampVerificationStatus, type ComplianceWriteOptions, type Config, ConsumeRecordPage, type CreateEvidenceAssetRequest, type CreateH5SigningUrlRequest, type CreateReportRequest, type CreateSigningEnvelopeRequest, DefaultRetryPolicy, DeviceRegistration, EntitlementBalance, EntitlementItem, 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, type EvidenceAsset, type EvidencePackage, FileTokenStore, type FilterStatus, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, GenerateSkillRequest, GenerateSkillResult, InMemoryTokenStore, InputModality, type IssueTimestampRequest, LocalStorageTokenStore, type LoginErrCode, type LoginEvent, type LoginEventType, type LoginOptions, ManagedModel, ModelBucket, ModelByQuotaResponse, ModelCapabilities, ModelCoefficient, NotificationList, NotificationPreference, OptimizeSkillRequest, OptimizeSkillResult, Order, OrderStatus, PayPayload, ProviderAdapter, type ProviderRequestStatusView, type PublicEvidenceVerifyResult, QuotaSummary, type RejectSealApprovalQuery, type ReportDownload, type RetryPolicy, type RetryRequestInfo, 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, type SealApproval, ServerMetadata, type SignEnvelopeRequest, type SigningEnvelope, SkillBrowseListResponse, SkillBrowseResponse, SkillStoreItem, SkillStoreQuery, SkillSummary, SourcesEvent, StreamEvent, StreamSettlement, type SubmitSealApprovalRequest, type TimestampToken, type TimestampVerifyResult, TokenPackage, TokenResponse, TokenSet, type TokenStore, ToolView, Transaction, type VerifyTimestampRequest, type WSConfig, WSEvent, WalletStats, allScopes, authorize, buildBetas, classifyComplianceError, commerceScopes, complianceScopes, computeBackoff, defaultRetryable, defaultSafeToRetry, discover, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, isBillingConfirmable, isComplianceBusinessError, isComplianceTerminalError, isSSLError, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newTokenSet, refreshToken, register, revokeToken, skillScopes, uniqueMerge };
1743
+ export { type AgentRun, type AgentRunArtifact, type AgentRunArtifactList, type AgentRunArtifactPolicy, type AgentRunCreateRequest, type AgentRunCreateResponse, type AgentRunDownload, type AgentRunErrorPayload, type AgentRunLocalContextPolicy, type AgentRunLocalToolHandler, type AgentRunLocalToolHandlerContext, type AgentRunLocalToolResult, type AgentRunRunOptions, type AgentRunSettlement, type AgentRunStatus, AgentRunStreamError, type AgentRunStreamEvent, type AgentRunStreamOptions, type AgentRunUsage, type AgentRunWithLocalToolsOptions, AgentRunsClient, AnthropicResponse, type ApproveSealApprovalQuery, type AuthorizeResult, BalanceDetail, type BlockMeta, type BugReportResult, type BugView, BusinessError, type CancelSealApprovalQuery, CertificationStatus, ChatRequest, ChatResponse, Client, ClientRegistration, type ComplianceAssetType, type ComplianceBillingDisplayStatus, ComplianceClient, type ComplianceClientErrorCode, type ComplianceDigestSource, type ComplianceEnvelopeStatus, type ComplianceErrorInfo, type ComplianceErrorKey, type ComplianceHashAlgorithm, CompliancePollError, type CompliancePollOptions, type CompliancePrivacyLevel, type ComplianceProviderRequestStatus, type ComplianceProviderStatus, type ComplianceReport, type ComplianceScope, type ComplianceSealApprovalStatus, type ComplianceTimestampVerificationStatus, type ComplianceWriteOptions, type Config, ConsumeRecordPage, type CreateEvidenceAssetRequest, type CreateH5SigningUrlRequest, type CreateReportRequest, type CreateSigningEnvelopeRequest, type CreateWebAuthorizationRequestOptions, DefaultRetryPolicy, DeviceRegistration, EntitlementBalance, EntitlementItem, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, EventAuthURL, EventComplete, EventError, type EvidenceAsset, type EvidencePackage, FileTokenStore, type FilterStatus, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, GenerateSkillRequest, GenerateSkillResult, InMemoryTokenStore, InputModality, type IssueTimestampRequest, LocalStorageTokenStore, type LoginErrCode, type LoginEvent, type LoginEventType, type LoginOptions, ManagedModel, ModelBucket, ModelByQuotaResponse, ModelCapabilities, ModelCoefficient, NotificationList, NotificationPreference, type OAuthMetadataProfile, OptimizeSkillRequest, OptimizeSkillResult, Order, OrderStatus, PayPayload, ProviderAdapter, type ProviderRequestStatusView, type PublicEvidenceVerifyResult, QuotaSummary, type RegisterWebOAuthClientOptions, type RejectSealApprovalQuery, type ReportDownload, type RetryPolicy, type RetryRequestInfo, 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, type SealApproval, ServerMetadata, type SignEnvelopeRequest, type SigningEnvelope, SkillBrowseListResponse, SkillBrowseResponse, SkillStoreItem, SkillStoreQuery, SkillSummary, SourcesEvent, StreamEvent, StreamSettlement, type SubmitSealApprovalRequest, type TimestampToken, type TimestampVerifyResult, TokenPackage, TokenResponse, TokenSet, type TokenStore, ToolView, Transaction, type VerifyTimestampRequest, type WSConfig, WSEvent, WalletStats, type WebAuthorizationCallbackParams, type WebAuthorizationPending, type WebAuthorizationRequest, allScopes, authorize, buildBetas, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, isBillingConfirmable, isComplianceBusinessError, isComplianceTerminalError, isSSLError, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newTokenSet, refreshToken, register, registerWebOAuthClient, revokeToken, skillScopes, uniqueMerge };
@@ -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",
@@ -2165,6 +2255,8 @@ var Client = class _Client {
2165
2255
  serverURL;
2166
2256
  /** Compliance API 根地址 (已 trim 尾随 /); null = 走默认 ${serverURL}/admin-api */
2167
2257
  complianceBaseURL;
2258
+ /** OAuth metadata profile — 刷新 token 时发现 metadata 用 (默认 'desktop') */
2259
+ oauthMetadataProfile;
2168
2260
  /** OAuth metadata (lazy loaded) */
2169
2261
  meta = null;
2170
2262
  /** 当前 token (内存) */
@@ -2199,6 +2291,7 @@ var Client = class _Client {
2199
2291
  constructor(cfg = {}) {
2200
2292
  this.serverURL = (cfg.serverURL ?? "https://acosmi.com").replace(/\/+$/, "");
2201
2293
  this.complianceBaseURL = cfg.complianceBaseURL ? cfg.complianceBaseURL.replace(/\/+$/, "") : null;
2294
+ this.oauthMetadataProfile = cfg.oauthMetadataProfile ?? "desktop";
2202
2295
  this.store = cfg.store ?? defaultTokenStore();
2203
2296
  this.fetchImpl = cfg.fetchImpl ?? globalThis.fetch.bind(globalThis);
2204
2297
  this.retryPolicy = effectivePolicy(cfg.retryPolicy ?? null);
@@ -2373,7 +2466,7 @@ var Client = class _Client {
2373
2466
  if (tokens) {
2374
2467
  if (!meta) {
2375
2468
  try {
2376
- meta = await discover(this.serverURL, signal);
2469
+ meta = await discoverWithProfile(this.serverURL, this.oauthMetadataProfile, signal);
2377
2470
  } catch (e) {
2378
2471
  console.warn(`[acosmi-sdk] warning: discover for revocation failed: ${e instanceof Error ? e.message : String(e)}`);
2379
2472
  }
@@ -2444,7 +2537,7 @@ var Client = class _Client {
2444
2537
  }
2445
2538
  if (this.meta == null) {
2446
2539
  try {
2447
- this.meta = await discover(this.serverURL, signal);
2540
+ this.meta = await discoverWithProfile(this.serverURL, this.oauthMetadataProfile, signal);
2448
2541
  } catch (e) {
2449
2542
  throw new Error(
2450
2543
  `discover for refresh: ${e instanceof Error ? e.message : String(e)}`
@@ -2476,7 +2569,7 @@ var Client = class _Client {
2476
2569
  throw new Error("no tokens to refresh");
2477
2570
  }
2478
2571
  if (this.meta == null) {
2479
- this.meta = await discover(this.serverURL, signal);
2572
+ this.meta = await discoverWithProfile(this.serverURL, this.oauthMetadataProfile, signal);
2480
2573
  }
2481
2574
  const tokenResp = await refreshToken(
2482
2575
  this.meta,
@@ -5369,6 +5462,6 @@ Client.prototype.getBugReport = async function(bugID, signal) {
5369
5462
  return resp.data;
5370
5463
  };
5371
5464
 
5372
- export { AgentRunStreamError, AgentRunsClient, AnthropicAdapter, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, ComplianceClient, CompliancePollError, 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 };
5465
+ export { AgentRunStreamError, AgentRunsClient, AnthropicAdapter, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, ComplianceClient, CompliancePollError, DefaultRetryPolicy, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, 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, 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
5466
  //# sourceMappingURL=index.mjs.map
5374
5467
  //# sourceMappingURL=index.mjs.map