@acosmi/sdk-ts 2.0.1 → 2.2.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,7 +1,7 @@
1
- import { a as AnthropicResponse } from './openai-C_UKadSX.cjs';
2
- export { A as AnthropicContentBlock, b as AnthropicUsage, O as OpenAIAdapter, d as anthropicResponseTextContent, e as anthropicResponseThinkingContent, f as anthropicResponseToolUseBlocks } from './openai-C_UKadSX.cjs';
3
- import { M as ManagedModel, Q as QuotaSummary, h as ModelCapabilities, e as ChatRequest, P as ProviderAdapter, f as ChatResponse, l as StreamEvent, k as SourcesEvent, m as StreamSettlement, I as InputModality } from './index-C9X5Yuyk.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, G as GeoLoc, O as OutputConfig, i as ProviderFormat, S as ServerTool, j as ServerToolTypeWebSearch, T as ThinkingConfig, n as ThinkingHigh, o as ThinkingHighMinMaxTokens, p as ThinkingMax, q as ThinkingMaxFallbackMaxTokens, r as ThinkingOff, W as WebSearchConfig, s as WebSearchSource, t as bucketInfoIsCommercial, u as bucketRowIsCommercial, v as getAdapter, w as getAdapterForModel, x as newThinkingConfig, y as newWebSearchTool, z as parseSettlement, A as parseSourcesEvent } from './index-C9X5Yuyk.cjs';
1
+ import { a as AnthropicResponse } from './openai-xKHChcmG.cjs';
2
+ export { A as AnthropicContentBlock, b as AnthropicUsage, O as OpenAIAdapter, d as anthropicResponseTextContent, e as anthropicResponseThinkingContent, f as anthropicResponseToolUseBlocks } from './openai-xKHChcmG.cjs';
3
+ import { M as ManagedModel, Q as QuotaSummary, j as ModelCapabilities, e as ChatRequest, P as ProviderAdapter, f as ChatResponse, I as ImageGenerationRequest, h as ImageGenerationResponse, V as VideoGenerationRequest, u as VideoTaskResponse, n as StreamEvent, m as SourcesEvent, o as StreamSettlement, i as InputModality } from './index-CI7FM3xe.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, G as GeoLoc, O as OutputConfig, k as ProviderFormat, S as ServerTool, l as ServerToolTypeWebSearch, T as ThinkingConfig, p as ThinkingHigh, q as ThinkingHighMinMaxTokens, r as ThinkingMax, s as ThinkingMaxFallbackMaxTokens, t as ThinkingOff, W as WebSearchConfig, v as WebSearchSource, w as bucketInfoIsCommercial, x as bucketRowIsCommercial, y as getAdapter, z as getAdapterForModel, A as newThinkingConfig, D as newWebSearchTool, F as parseSettlement, H as parseSourcesEvent } from './index-CI7FM3xe.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';
@@ -184,6 +184,13 @@ interface ClientRegistration {
184
184
  client_secret?: string;
185
185
  }
186
186
 
187
+ declare class OAuthTokenEndpointError extends Error {
188
+ readonly status: number;
189
+ readonly oauthError: string;
190
+ readonly errorDescription: string;
191
+ constructor(status: number, oauthError: string, errorDescription: string);
192
+ }
193
+ declare function isInvalidGrantError(err: unknown): boolean;
187
194
  /** OAuth metadata profile — 决定 well-known 端点的路径后缀 */
188
195
  type OAuthMetadataProfile = 'web' | 'desktop';
189
196
  /**
@@ -564,13 +571,48 @@ declare const FilterStatusFallbackTkdistSkew: FilterStatus;
564
571
  declare const FilterStatusFallbackNoBuckets: FilterStatus;
565
572
  declare const FilterStatusFallbackMissingUser: FilterStatus;
566
573
  declare const FilterStatusUnknown: FilterStatus;
574
+ /** Acosmi Gateway URL 默认值 — 与历史行为一致。 */
575
+ declare const DEFAULT_GATEWAY_BASE_URL = "https://acosmi.com";
576
+ /**
577
+ * normalizeGatewayBaseURL — Acosmi nexus-v4 API Gateway URL 的归一化与校验。
578
+ *
579
+ * 红线 (Phase 0 契约 §1-§2):
580
+ * 1. 仅允许 `http:` / `https:`;`ws:` / `wss:` 是 CrabCode `--sdk-url`
581
+ * RemoteIO 会话通道,不是 SDK API gateway URL,传入立刻抛错。
582
+ * 2. URL 必须可被 `new URL()` 解析;非法输入立刻抛错。
583
+ * 3. host 必须非空;query/hash 不允许 (gateway URL 不带 query)。
584
+ * 4. pathname 去尾 `/`;末段允许是 `/api/v4` (`apiURL()` 不会重复追加)。
585
+ * 5. 返回值是 `origin + pathname`,不带 query/hash/trailing slash。
586
+ *
587
+ * 该函数是公共 helper:CrabCode AppServer worker、CrabClaw 内部、外部第三方 SDK
588
+ * 都应在写入 Acosmi base 之前调用它一次,避免 ws/wss 误入 SDK API client。
589
+ */
590
+ declare function normalizeGatewayBaseURL(input: unknown): string;
567
591
  /** 客户端配置 */
568
592
  interface Config {
569
593
  /**
570
- * nexus-v4 API 根地址 (默认 https://acosmi.com)。
571
- * SDK 自动追加 /api/v4, 无需手动拼接。
594
+ * Acosmi nexus-v4 API Gateway 根地址 (默认 https://acosmi.com)。
595
+ *
596
+ * 该 URL 是 `@acosmi/sdk-ts` 调 Acosmi 云端 API 的根 — agent-runs /
597
+ * managed-models / notifications WS / compliance 都从它派生。SDK 内部
598
+ * `apiURL()` 会自动追加 `/api/v4`,调用方无需手动拼。
599
+ *
600
+ * 见 Phase 0 契约 `docs/audit/sdk-remote-control-contract-2026-05-27.md` §1-§2:
601
+ * - 协议: 仅允许 `http:` / `https:`;`ws:` / `wss:` 是 CrabCode `--sdk-url`
602
+ * RemoteIO 会话通道,不是 SDK gateway URL,传入将抛 `Error`。
603
+ * - `serverURL` / `baseURL` / `baseUrl` 三字段同语义,多写时 normalize 后必须相等。
572
604
  */
573
605
  serverURL?: string;
606
+ /**
607
+ * `serverURL` 的标准 alias (推荐拼写)。语义、normalize、校验完全等同 serverURL。
608
+ * 见 Phase 0 契约 §2。同时传入 serverURL/baseURL/baseUrl 时三者 normalize 后必须相等。
609
+ */
610
+ baseURL?: string;
611
+ /**
612
+ * `serverURL` 的 camelCase-小写 alias。语义、normalize、校验完全等同 serverURL。
613
+ * 见 Phase 0 契约 §2。
614
+ */
615
+ baseUrl?: string;
574
616
  /** token 持久化实现, 缺省时按平台选 (Node File / Browser LocalStorage / Memory) */
575
617
  store?: TokenStore;
576
618
  /** 自定义 fetch 实现 (默认 globalThis.fetch) */
@@ -696,6 +738,16 @@ declare class Client {
696
738
  static create(cfg?: Config): Promise<Client>;
697
739
  /** 是否已授权 (有可用 token) */
698
740
  isAuthorized(): boolean;
741
+ /**
742
+ * 返回归一化后的 Acosmi Gateway URL (= `serverURL` 字段). readonly helper.
743
+ *
744
+ * Phase 0 §2 红线:
745
+ * - 不要 mutate `client.serverURL` 字段实现 base 切换; 用 per-base Client 实例.
746
+ * - 该值仅供日志/排查/上层缓存键使用, 不重新 normalize 它 (构造期已 normalize).
747
+ */
748
+ getServerURL(): string;
749
+ /** `getServerURL()` 的 alias — Phase 0 §2 baseURL 与 serverURL 同义. */
750
+ getBaseURL(): string;
699
751
  /** 当前 token 信息 (用于 CLI whoami 显示) */
700
752
  getTokenSet(): TokenSet | null;
701
753
  private getCachedClientID;
@@ -732,6 +784,7 @@ declare class Client {
732
784
  private refreshCurrentTokenDirect;
733
785
  private refreshCurrentTokenViaProxy;
734
786
  private saveRefreshedToken;
787
+ private clearInvalidRefreshToken;
735
788
  /** 互斥锁 helper (替代 Go sync.Mutex) */
736
789
  private withMu;
737
790
  /** v1.0.2: 跨进程临界区 helper. store.withLock 可选, 缺省则直接调用 fn (LocalStorage /
@@ -803,6 +856,28 @@ declare class Client {
803
856
  * v0.5.0: 根据 provider 自动路由到 /anthropic 或 /chat 端点
804
857
  */
805
858
  chat(modelID: string, req: ChatRequest, signal?: AbortSignal): Promise<ChatResponse>;
859
+ /** 解析 nexus-v4 {code,message,data} 信封, code!=0 抛 BusinessError, 返回 data。 */
860
+ private unwrapAPIResponse;
861
+ /**
862
+ * 图片生成 (同步)。POST /managed-models/:id/images/generations
863
+ *
864
+ * @param modelID 图片生成托管模型 ID (capabilities.supports_image_generation=true)
865
+ */
866
+ generateImage(modelID: string, req: ImageGenerationRequest, signal?: AbortSignal): Promise<ImageGenerationResponse>;
867
+ /**
868
+ * 创建视频生成任务 (异步)。POST /managed-models/:id/videos/generations
869
+ * 返回 taskId; 用 pollVideoTask() 轮询直到 status=completed。
870
+ * 上报真物理量 (视频秒数) 需在 pollVideoTask 时回传 req.duration。
871
+ *
872
+ * @param modelID 视频生成托管模型 ID (capabilities.supports_video_generation=true)
873
+ */
874
+ generateVideo(modelID: string, req: VideoGenerationRequest, signal?: AbortSignal): Promise<VideoTaskResponse>;
875
+ /**
876
+ * 轮询视频任务状态。GET /managed-models/:id/videos/tasks/:taskId
877
+ *
878
+ * @param durationSeconds 创建时的时长 (秒), 透传给网关在 completed 时上报用量。
879
+ */
880
+ pollVideoTask(modelID: string, taskID: string, durationSeconds?: number, signal?: AbortSignal): Promise<VideoTaskResponse>;
806
881
  /**
807
882
  * Anthropic 原生格式同步聊天
808
883
  * v0.5.0: 根据 provider 自动路由
@@ -865,7 +940,7 @@ declare class Client {
865
940
  }>;
866
941
  private doJSONFullInternal;
867
942
  /** doJSONFull 的 raw bytes 变体 (chat 用, 不立即 JSON.parse) */
868
- doJSONFullRaw(method: string, path: string, body: unknown | null, signal?: AbortSignal): Promise<{
943
+ doJSONFullRaw(method: string, path: string, body: unknown | null, signal?: AbortSignal, timeoutMs?: number): Promise<{
869
944
  result: Uint8Array;
870
945
  headers: Headers;
871
946
  }>;
@@ -1362,6 +1437,14 @@ interface BillingPreflightResult {
1362
1437
  declare const ScopeAI = "ai";
1363
1438
  declare const ScopeSkills = "skills";
1364
1439
  declare const ScopeAccount = "account";
1440
+ /** 远程控制能力 (分组 scope, 自包含展开到 3 个子 scope). 高风险, 不进 allScopes(). */
1441
+ declare const ScopeRemoteControl = "remote_control";
1442
+ /** 创建 / 取消 / stream AgentRun. */
1443
+ declare const ScopeRemoteControlAgentRun = "remote_control:agent-run";
1444
+ /** 远程会话 lifecycle 控制 (cancel / interrupt / kill). */
1445
+ declare const ScopeRemoteControlSessionControl = "remote_control:session-control";
1446
+ /** 代表用户提交远控权限审批响应 (allow / deny / timeout). */
1447
+ declare const ScopeRemoteControlPermissionResponse = "remote_control:permission-response";
1365
1448
  /** @deprecated 旧细粒度 scope, 保留向后兼容, 新代码请用分组 scope */
1366
1449
  declare const ScopeModels = "models";
1367
1450
  /** @deprecated */
@@ -1390,6 +1473,11 @@ declare function modelScopes(): string[];
1390
1473
  declare function commerceScopes(): string[];
1391
1474
  /** 技能/工具 scope */
1392
1475
  declare function skillScopes(): string[];
1476
+ /**
1477
+ * 远程控制 scope (推荐). 仅返回分组 ScopeRemoteControl, 服务端 ScopeExpansion 会展开
1478
+ * 为 3 个子 scope. 调用方需显式申请, allScopes() 不包含本项 (避免桌面登录自动获权).
1479
+ */
1480
+ declare function remoteControlScopes(): string[];
1393
1481
 
1394
1482
  interface OpenAIChatResponse {
1395
1483
  id: string;
@@ -1900,7 +1988,139 @@ declare module '@acosmi/sdk-ts' {
1900
1988
  }
1901
1989
  }
1902
1990
 
1991
+ type AdapterKind = 'remote_io' | 'app_server_tcp_ws' | 'bridge_ccr' | 'app_server_uds' | 'stdio_stream_json' | 'tauri_managed_app_server';
1992
+ type RunnerKind = 'cloud' | 'desktop' | 'local_embedded';
1993
+ interface WorkspacePolicy {
1994
+ readOnly?: boolean;
1995
+ allowedPaths?: string[];
1996
+ deniedPaths?: string[];
1997
+ maxBytes?: number;
1998
+ }
1999
+ interface PermissionPolicy {
2000
+ shellAllowed?: boolean;
2001
+ shellDenyList?: string[];
2002
+ networkAllowed?: boolean;
2003
+ writeAllowed?: boolean;
2004
+ approvalTimeoutMs?: number;
2005
+ requiredActors?: string[];
2006
+ }
2007
+ interface RemoteSessionPlacement {
2008
+ tenantId: string;
2009
+ userId: string;
2010
+ appId: string;
2011
+ runId: string;
2012
+ runner: RunnerKind;
2013
+ adapter: AdapterKind;
2014
+ ttlMs?: number;
2015
+ workspace?: WorkspacePolicy;
2016
+ permission?: PermissionPolicy;
2017
+ }
2018
+ interface RemoteSessionRef {
2019
+ sessionId: string;
2020
+ runId: string;
2021
+ tenantId: string;
2022
+ userId: string;
2023
+ adapter: AdapterKind;
2024
+ createdAt?: string;
2025
+ expiresAt?: string;
2026
+ }
2027
+ type RemoteControlEventType = 'text_delta' | 'reasoning_delta' | 'tool_call' | 'tool_result' | 'permission_request' | 'permission_result' | 'usage' | 'settle' | 'status' | 'error' | 'done';
2028
+ interface RemoteControlTextDelta {
2029
+ type: 'text_delta';
2030
+ index: number;
2031
+ text: string;
2032
+ }
2033
+ interface RemoteControlReasoningDelta {
2034
+ type: 'reasoning_delta';
2035
+ index: number;
2036
+ text: string;
2037
+ }
2038
+ interface RemoteControlToolCall {
2039
+ type: 'tool_call';
2040
+ toolCallId: string;
2041
+ name: string;
2042
+ input?: unknown;
2043
+ source?: string;
2044
+ }
2045
+ interface RemoteControlToolResult {
2046
+ type: 'tool_result';
2047
+ toolCallId: string;
2048
+ ok: boolean;
2049
+ output?: unknown;
2050
+ error?: string;
2051
+ }
2052
+ interface RemoteControlPermissionRequest {
2053
+ type: 'permission_request';
2054
+ requestId: string;
2055
+ kind: string;
2056
+ payload?: unknown;
2057
+ deadlineMs?: number;
2058
+ }
2059
+ interface RemoteControlPermissionResult {
2060
+ type: 'permission_result';
2061
+ requestId: string;
2062
+ decision: 'allow' | 'deny' | string;
2063
+ actor?: string;
2064
+ decidedAt?: string;
2065
+ }
2066
+ interface RemoteControlUsage {
2067
+ type: 'usage';
2068
+ inputTokens?: number;
2069
+ outputTokens?: number;
2070
+ cacheRead?: number;
2071
+ cacheCreate?: number;
2072
+ exact?: boolean;
2073
+ }
2074
+ interface RemoteControlSettle {
2075
+ type: 'settle';
2076
+ status: string;
2077
+ billed?: boolean;
2078
+ }
2079
+ interface RemoteControlStatus {
2080
+ type: 'status';
2081
+ phase: 'created' | 'connecting' | 'connected' | 'running' | 'cancelling' | 'terminating' | string;
2082
+ message?: string;
2083
+ }
2084
+ interface RemoteControlError {
2085
+ type: 'error';
2086
+ code: string;
2087
+ message: string;
2088
+ retryable?: boolean;
2089
+ kind?: string;
2090
+ }
2091
+ interface RemoteControlDone {
2092
+ type: 'done';
2093
+ reason: string;
2094
+ runId: string;
2095
+ finalStatus: string;
2096
+ }
2097
+ type RemoteControlEvent = RemoteControlTextDelta | RemoteControlReasoningDelta | RemoteControlToolCall | RemoteControlToolResult | RemoteControlPermissionRequest | RemoteControlPermissionResult | RemoteControlUsage | RemoteControlSettle | RemoteControlStatus | RemoteControlError | RemoteControlDone;
2098
+ /**
2099
+ * 把后端 SSE/JSON wire payload 翻译成强类型 RemoteControlEvent。
2100
+ *
2101
+ * - wire 字段 snake_case (text_delta / tool_call_id / permission_request ...);
2102
+ * - TS API 字段 camelCase (toolCallId / requestId ...);
2103
+ * - 未知 type / 缺失关键字段返回 null, 调用方应当忽略并打 warn;
2104
+ * - 不抛异常: 一律返回 null。
2105
+ */
2106
+ declare function parseRemoteControlEvent(raw: unknown): RemoteControlEvent | null;
2107
+ /**
2108
+ * isTerminalRemoteEvent — 仅 `done` 与 `settle` 终结一个 stream。
2109
+ *
2110
+ * 注意契约 §4 关于 error:
2111
+ * - 终结性错误进入 `done`;
2112
+ * - 非终结 error 不结束 stream;
2113
+ * 因此 `error` 本身不算 terminal, `done` 才是。
2114
+ */
2115
+ declare function isTerminalRemoteEvent(ev: RemoteControlEvent): boolean;
2116
+
1903
2117
  type AgentRunStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
2118
+ /**
2119
+ * Remote-control runtime selector (Phase 3 / contract §3).
2120
+ * - 'standard' existing chat/workflow path (default; backward compatible)
2121
+ * - 'crabcode_remote' CrabCode remote-control session; requires runner + adapter
2122
+ */
2123
+ type AgentRunRuntime = 'standard' | 'crabcode_remote';
1904
2124
  interface AgentRunLocalContextPolicy {
1905
2125
  enabled?: boolean;
1906
2126
  readonly?: boolean;
@@ -1923,6 +2143,22 @@ interface AgentRunCreateRequest {
1923
2143
  metadata?: Record<string, string>;
1924
2144
  localContextPolicy?: AgentRunLocalContextPolicy;
1925
2145
  artifactPolicy?: AgentRunArtifactPolicy;
2146
+ runtime?: AgentRunRuntime;
2147
+ runner?: RunnerKind;
2148
+ adapter?: AdapterKind;
2149
+ permissionPolicy?: PermissionPolicy;
2150
+ workspacePolicy?: WorkspacePolicy;
2151
+ }
2152
+ /**
2153
+ * Narrow type for `agentRuns.createRemoteRun(req)`:
2154
+ * - runtime is fixed to `'crabcode_remote'`;
2155
+ * - runner + adapter are required;
2156
+ * - inherits everything else from AgentRunCreateRequest.
2157
+ */
2158
+ interface AgentRunRemoteCreateRequest extends AgentRunCreateRequest {
2159
+ runtime: 'crabcode_remote';
2160
+ runner: RunnerKind;
2161
+ adapter: AdapterKind;
1926
2162
  }
1927
2163
  interface AgentRun {
1928
2164
  runId: string;
@@ -2090,6 +2326,34 @@ declare class AgentRunsClient {
2090
2326
  get(runId: string, signal?: AbortSignal): Promise<AgentRun>;
2091
2327
  stream(runId: string, opts?: AgentRunStreamOptions, signal?: AbortSignal): AsyncIterable<AgentRunStreamEvent>;
2092
2328
  cancel(runId: string, signal?: AbortSignal): Promise<AgentRun>;
2329
+ /**
2330
+ * Create a CrabCode remote-control agent run (contract §3, ADR-2 + ADR-5).
2331
+ *
2332
+ * Equivalent to `create()` with `runtime: 'crabcode_remote'` and the required
2333
+ * `runner` + `adapter` fields set. Per-session policies (permission/workspace)
2334
+ * are forwarded to the gateway, which is the only side allowed to enforce
2335
+ * them (contract §6). The SDK never enforces remote permissions client-side.
2336
+ *
2337
+ * The corresponding stream uses `streamRemoteControl(runId)`, NOT `stream()`,
2338
+ * because the event union is different (contract §4).
2339
+ */
2340
+ createRemoteRun(req: AgentRunRemoteCreateRequest, signal?: AbortSignal): Promise<AgentRunCreateResponse>;
2341
+ /**
2342
+ * Stream remote-control events for a CrabCode remote run (contract §4).
2343
+ *
2344
+ * Yields the canonical 11-event union: text_delta / reasoning_delta /
2345
+ * tool_call / tool_result / permission_request / permission_result /
2346
+ * usage / settle / status / error / done.
2347
+ *
2348
+ * Iteration ends naturally when a terminal event (`done` or `settle`) is
2349
+ * observed. Per contract §4, `error` alone is non-terminal — terminal errors
2350
+ * are carried by `done.reason` / `done.final_status`.
2351
+ *
2352
+ * Unknown event types and malformed frames are silently skipped (warn-only),
2353
+ * matching `parseRemoteControlEvent`'s null-return contract.
2354
+ */
2355
+ streamRemoteControl(runId: string, signal?: AbortSignal): AsyncIterable<RemoteControlEvent>;
2356
+ private streamRemoteControlGen;
2093
2357
  listArtifacts(runId: string, signal?: AbortSignal): Promise<AgentRunArtifact[]>;
2094
2358
  downloadArtifact(runId: string, artifactId: string, signal?: AbortSignal): Promise<AgentRunDownload>;
2095
2359
  submitLocalToolResult(runId: string, result: AgentRunLocalToolResult, signal?: AbortSignal): Promise<AgentRun>;
@@ -3456,6 +3720,11 @@ declare module '@acosmi/sdk-ts' {
3456
3720
  listPlans(audience?: SubscriptionAudience, signal?: AbortSignal): Promise<SubscriptionPlan[]>;
3457
3721
  /** 列出当前用户已激活订阅 (跨档位; 通常 1 条 active) */
3458
3722
  listUserSubscriptions(signal?: AbortSignal): Promise<UserSubscription[]>;
3723
+ /**
3724
+ * 按 planCode 精确取单个可售订阅计划 (V41 起 planCode 在 active 内唯一)。
3725
+ * 复用 listPlans 客户端过滤, 未命中返回 null。减少 C 端按字段手筛 (deep-review §12.3)。
3726
+ */
3727
+ getPlanByCode(planCode: string, signal?: AbortSignal): Promise<SubscriptionPlan | null>;
3459
3728
  }
3460
3729
  }
3461
3730
 
@@ -4135,4 +4404,201 @@ declare module '@acosmi/sdk-ts' {
4135
4404
  }
4136
4405
  }
4137
4406
 
4138
- export { type APIResponse, 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 ApiClientRef, type ApproveSealApprovalQuery, type AssignSeatRequest, type Audience, AudienceEnum, type AuthorizeResult, type BalanceDetail, type BillingMode, BillingModeEnum, type BillingPreflightResult, type BlockMeta, type BookConsultationRequest, type BrowserRefreshMode, type BugReportResult, type BugView, BusinessError, type CancelSealApprovalQuery, type CaseLead, type CaseMatter, type CertificationStatus, ChatRequest, ChatResponse, 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, type CreateContractTemplateRequest, type CreateEvidenceAssetRequest, type CreateH5SigningUrlRequest, type CreateReportRequest, type CreateSigningEnvelopeRequest, type CreateWebAuthorizationRequestOptions, DefaultRetryPolicy, type DeviceRegistration, type EnterpriseKycMyStatusView, type EnterpriseMember, type EnterpriseSummary, type EntitlementBalance, type EntitlementItem, type EnvelopeContractItem, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrOAuthCORSBlocked, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRefreshProxyFailed, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, ErrTokenExpired, EventAuthURL, EventComplete, EventError, type EvidenceAsset, type EvidenceAssetPageItem, type EvidencePackage, type EvidencePackagePageItem, type FeatureGateState, type FeatureGateStatus, FileTokenStore, type FilterStatus, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, type GateQuota, type GenerateSkillRequest, type GenerateSkillResult, HTTPError, type IdempotencyKey, IdempotencyKeyHeader, InMemoryTokenStore, type InitiateCorporateTransferInput, type InitiateCorporateTransferResult, InputModality, 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 ModelBucket, type ModelByQuotaResponse, ModelCapabilities, type ModelCoefficient, ModelNotFoundError, NetworkError, type Notification, type NotificationList, type NotificationPreference, type NotificationUnreadCount, type OAuthMetadataProfile, 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 OrderStatus, OrderTerminalError, type OrgConsumeReport, type OrgSeat, type OrgSubscription, type PageRequest, type PageResult, type PayPayload, 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 RegionScope, RegionScopeEnum, type RegisterWebOAuthClientOptions, type RejectSealApprovalQuery, type ReportDownload, type ReportPageItem, type RequestInvoiceInput, type RequestRefundInput, type RetryAdvice, type RetryAdviceReason, type RetryPolicy, type RetryRequestInfo, type RolloverPolicy, ScopeAI, ScopeAccount, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, ScopeComplianceContractTemplateRead, ScopeComplianceContractTemplateWrite, ScopeComplianceEvidenceRead, ScopeComplianceEvidenceWrite, ScopeComplianceReportsPublish, ScopeComplianceReportsRead, ScopeComplianceReportsWrite, ScopeComplianceSealApprovalApprove, ScopeComplianceSealApprovalRequest, ScopeComplianceSealManage, ScopeComplianceSealUseExecute, ScopeComplianceTimestampIssue, ScopeComplianceTimestampVerify, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, 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, StreamError, StreamEvent, StreamSettlement, type SubmitCaseLeadRequest, type SubmitSealApprovalRequest, type SubscriptionAudience, type SubscriptionPlan, 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 UserSubscription, type VerifyStatus, type VerifyTimestampRequest, type VoidEnvelopeRequest, type WSConfig, type WSEvent, type WalletStats, type WebAuthorizationCallbackParams, type WebAuthorizationPending, type WebAuthorizationRequest, type YudaoPageResult, allScopes, apiResponseBusinessError, apiResponseGetMessage, authorize, buildBetas, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, isBillingConfirmable, isComplianceBusinessError, isComplianceTerminalError, isSSECommentLine, isSSLError, maxEndUserIdLength, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newTokenSet, parseNotificationEvent, refreshToken, register, registerWebOAuthClient, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, skillScopes, tokenSetIsExpired, uniqueMerge, validateEndUserId };
4407
+ type Platform = 'feishu' | 'wecom' | 'dingtalk' | 'slack' | 'teams' | 'telegram' | 'whatsapp';
4408
+ type Region = 'cn' | 'intl';
4409
+ type IntegrationStatus = 'pending' | 'active' | 'suspended' | 'revoked';
4410
+ /**
4411
+ * CredentialRef — chat-bridge 凭证公开引用 (`cred_<22 char base32>`).
4412
+ *
4413
+ * branded type 防止 plaintext secret 字符串被误传到需要 CredentialRef 的位置。
4414
+ * SDK 调用方应仅持有 CredentialRef, 永不持 plaintext。
4415
+ */
4416
+ type CredentialRef = string & {
4417
+ readonly __brand: 'CredentialRef';
4418
+ };
4419
+ /**
4420
+ * ChannelAttachment — 入站附件 / 出站文件附件.
4421
+ *
4422
+ * 安全约束 (ADR-8):
4423
+ * - `url` 必须由 bridge runtime 解析过 (Acosmi 内部存储 URL); 严禁是平台原始签名 URL。
4424
+ * - `contentType` 是标准 MIME; `kind` 是 bridge 内部分类 (image/file/audio/video/link/...)。
4425
+ */
4426
+ interface ChannelAttachment {
4427
+ kind: string;
4428
+ url: string;
4429
+ size?: number;
4430
+ contentType?: string;
4431
+ }
4432
+ /**
4433
+ * ChannelCardAction — 出站交互卡片按钮 / 自由输入.
4434
+ *
4435
+ * `kind`: 'approve' | 'reject' | 'cancel' | 'free_text' | 其他 bridge 自定义。
4436
+ * `id` 是 bridge 侧稳定 action id, 用于把用户点击映射回原 requestId 幂等键。
4437
+ */
4438
+ interface ChannelCardAction {
4439
+ kind: string;
4440
+ id: string;
4441
+ label: string;
4442
+ }
4443
+ /**
4444
+ * ChannelCard — 出站交互卡片 (permission / tool_status / done / error).
4445
+ */
4446
+ interface ChannelCard {
4447
+ kind: string;
4448
+ title: string;
4449
+ body: string;
4450
+ actions?: ChannelCardAction[];
4451
+ }
4452
+ /**
4453
+ * ChannelInboundEvent — bridge runtime 视角的入站平台消息.
4454
+ *
4455
+ * 安全约束:
4456
+ * - `threadHash` / `senderHash` 是 SHA256(平台原始 ID), 不允许直接是平台 ID;
4457
+ * - `metadata` 仅含非敏感字段 (例: locale, message_kind), 严禁含 plaintext secret;
4458
+ * - `messageId` 是平台原生 message id, 仅用于平台侧 ack / dedup, 不进 AgentRun transcript。
4459
+ */
4460
+ interface ChannelInboundEvent {
4461
+ platform: Platform;
4462
+ threadHash: string;
4463
+ senderHash?: string;
4464
+ content: string;
4465
+ attachments?: ChannelAttachment[];
4466
+ messageId?: string;
4467
+ receivedAt?: string;
4468
+ metadata?: Record<string, string>;
4469
+ }
4470
+ /**
4471
+ * ChannelOutboundEvent — bridge runtime 出站平台消息 / 卡片.
4472
+ *
4473
+ * Metadata 仅含非敏感投递参数 (例: card_locale), 严禁含 plaintext secret。
4474
+ */
4475
+ interface ChannelOutboundEvent {
4476
+ threadHash: string;
4477
+ content?: string;
4478
+ cards?: ChannelCard[];
4479
+ metadata?: Record<string, string>;
4480
+ }
4481
+ /**
4482
+ * BridgeThreadRef — bridge runtime 内部 thread 引用 (Acosmi 三元组).
4483
+ *
4484
+ * 永不携带 platform secret / 原始平台 ID。
4485
+ */
4486
+ interface BridgeThreadRef {
4487
+ threadId: string;
4488
+ runId?: string;
4489
+ remoteSessionId?: string;
4490
+ tenantId: string;
4491
+ userId: string;
4492
+ appId: string;
4493
+ }
4494
+ /**
4495
+ * ChatIntegration — 平台安装记录的 SDK 只读视图.
4496
+ *
4497
+ * 注意: `configJson` 仅含非敏感配置 (rate limit / feature toggles); 严禁含 secret。
4498
+ * Phase 7B handler 落地后, SDK admin 子客户端会按此型号 GET。
4499
+ */
4500
+ interface ChatIntegration {
4501
+ id: string;
4502
+ tenantId: string;
4503
+ appId: string;
4504
+ platform: Platform;
4505
+ region: Region;
4506
+ workspaceIdHash?: string;
4507
+ botIdHash?: string;
4508
+ status: IntegrationStatus;
4509
+ configJson?: string;
4510
+ installedByUserId?: string;
4511
+ lastUsedAt?: string;
4512
+ createdAt?: string;
4513
+ updatedAt?: string;
4514
+ }
4515
+ /**
4516
+ * ChatCredentialPublic — 凭证的 SDK 只读视图 (绝不含 ciphertext / plaintext).
4517
+ *
4518
+ * 仅暴露公开字段: `credentialRef` / `fingerprint` / `keyId` / `version` / `status`。
4519
+ */
4520
+ interface ChatCredentialPublic {
4521
+ credentialRef: CredentialRef;
4522
+ integrationId: string;
4523
+ platform: Platform;
4524
+ region: Region;
4525
+ secretKind: string;
4526
+ fingerprint: string;
4527
+ keyId: string;
4528
+ version: number;
4529
+ status: 'active' | 'rotating' | 'revoked' | string;
4530
+ lastUsedAt?: string;
4531
+ rotatedAt?: string;
4532
+ createdAt?: string;
4533
+ updatedAt?: string;
4534
+ }
4535
+ /**
4536
+ * ChatThread — 平台 thread 到 Acosmi session 的映射 (SDK 只读视图).
4537
+ *
4538
+ * 永不携带原始 platform thread / sender ID; 仅含 SHA256 hash。
4539
+ */
4540
+ interface ChatThread {
4541
+ id: string;
4542
+ tenantId: string;
4543
+ integrationId: string;
4544
+ platformThreadHash: string;
4545
+ platform: Platform;
4546
+ userId: string;
4547
+ appId: string;
4548
+ sessionId?: string;
4549
+ lastRunId?: string;
4550
+ senderHash?: string;
4551
+ lastInboundAt?: string;
4552
+ lastOutboundAt?: string;
4553
+ }
4554
+ /**
4555
+ * ChatBridgeSession — 一次 bridge runtime 会话 (SDK 只读视图).
4556
+ */
4557
+ interface ChatBridgeSession {
4558
+ id: string;
4559
+ tenantId: string;
4560
+ threadId: string;
4561
+ integrationId: string;
4562
+ runId?: string;
4563
+ remoteSessionId?: string;
4564
+ status: 'created' | 'routing' | 'active' | 'paused' | 'closed' | 'errored' | string;
4565
+ adapter?: string;
4566
+ lastFrameAt?: string;
4567
+ closedAt?: string;
4568
+ disconnectReason?: string;
4569
+ createdAt?: string;
4570
+ updatedAt?: string;
4571
+ }
4572
+ declare const ALL_PLATFORMS: readonly Platform[];
4573
+ declare const ALL_REGIONS: readonly Region[];
4574
+ declare const ALL_INTEGRATION_STATUS: readonly IntegrationStatus[];
4575
+ /**
4576
+ * isPlatform — runtime type guard for {@link Platform}.
4577
+ *
4578
+ * 用途: SDK 解析 wire payload 时校验未知字段; 不直接抛异常, 调用方决策。
4579
+ */
4580
+ declare function isPlatform(v: unknown): v is Platform;
4581
+ /**
4582
+ * isRegion — runtime type guard for {@link Region}.
4583
+ */
4584
+ declare function isRegion(v: unknown): v is Region;
4585
+ /**
4586
+ * isIntegrationStatus — runtime type guard for {@link IntegrationStatus}.
4587
+ */
4588
+ declare function isIntegrationStatus(v: unknown): v is IntegrationStatus;
4589
+ /**
4590
+ * isChannelInboundEvent — 极简 type guard, 用于 wire payload 入口校验.
4591
+ *
4592
+ * 仅校验必填字段 (platform/threadHash/content); 其他字段交给调用方按需校验。
4593
+ * 不抛异常: 失败返回 false。
4594
+ */
4595
+ declare function isChannelInboundEvent(v: unknown): v is ChannelInboundEvent;
4596
+ /**
4597
+ * 把任意字符串安全 brand 成 {@link CredentialRef}; 不做合法性校验.
4598
+ *
4599
+ * Phase 7B SDK 客户端 wire 解析时使用 — 服务端返回的 `credential_ref` 字段一律走它。
4600
+ * 调用方自行判断格式 (例: 是否 `cred_` 前缀)。
4601
+ */
4602
+ declare function asCredentialRef(s: string): CredentialRef;
4603
+
4604
+ export { 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 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 BillingMode, BillingModeEnum, type BillingPreflightResult, type BlockMeta, type BookConsultationRequest, type BridgeThreadRef, type BrowserRefreshMode, type BugReportResult, type BugView, BusinessError, type CancelSealApprovalQuery, type CaseLead, type CaseMatter, type CertificationStatus, type ChannelAttachment, type ChannelCard, type ChannelCardAction, type ChannelInboundEvent, type ChannelOutboundEvent, 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, type CreateContractTemplateRequest, type CreateEvidenceAssetRequest, type CreateH5SigningUrlRequest, type CreateReportRequest, type CreateSigningEnvelopeRequest, type CreateWebAuthorizationRequestOptions, type CredentialRef, DEFAULT_GATEWAY_BASE_URL, DefaultRetryPolicy, type DeviceRegistration, type EnterpriseKycMyStatusView, type EnterpriseMember, type EnterpriseSummary, type EntitlementBalance, type EntitlementItem, type EnvelopeContractItem, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrOAuthCORSBlocked, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRefreshProxyFailed, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, ErrTokenExpired, EventAuthURL, EventComplete, EventError, type EvidenceAsset, type EvidenceAssetPageItem, type EvidencePackage, type EvidencePackagePageItem, type FeatureGateState, type FeatureGateStatus, FileTokenStore, type FilterStatus, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, type GateQuota, type GenerateSkillRequest, type GenerateSkillResult, HTTPError, type IdempotencyKey, IdempotencyKeyHeader, ImageGenerationRequest, ImageGenerationResponse, InMemoryTokenStore, type InitiateCorporateTransferInput, type InitiateCorporateTransferResult, InputModality, type IntegrationStatus, type InviteMemberRequest, type Invoice, type IssueTimestampRequest, type LawyerCredentialMyView, type LawyerSummary, type LegalConsultation, type LegalServiceOrder, type LegalServiceSku, type LegalSkuCode, type ListContractTemplatesRequest, type ListEvidenceAssetsRequest, type ListEvidencePackagesRequest, type ListOperationsRequest, type ListReportsRequest, type ListSealApprovalsRequest, type ListSealUsesRequest, type ListSigningEnvelopesRequest, type ListTimestampsRequest, LocalStorageTokenStore, type LoginErrCode, type LoginEvent, type LoginEventType, type LoginOptions, ManagedModel, type 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 OrderStatus, OrderTerminalError, type OrgConsumeReport, type OrgSeat, type OrgSubscription, type PageRequest, type PageResult, type PayPayload, 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 RemoteSessionPlacement, type RemoteSessionRef, type ReportDownload, type ReportPageItem, type RequestInvoiceInput, type RequestRefundInput, type RetryAdvice, type RetryAdviceReason, type RetryPolicy, type RetryRequestInfo, type RolloverPolicy, type RunnerKind, ScopeAI, ScopeAccount, 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, StreamError, StreamEvent, StreamSettlement, type SubmitCaseLeadRequest, type SubmitSealApprovalRequest, type SubscriptionAudience, type SubscriptionPlan, 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 UserSubscription, type VerifyStatus, type VerifyTimestampRequest, VideoGenerationRequest, VideoTaskResponse, type VoidEnvelopeRequest, type WSConfig, type WSEvent, type WalletStats, type WebAuthorizationCallbackParams, type WebAuthorizationPending, type WebAuthorizationRequest, type WorkspacePolicy, type YudaoPageResult, allScopes, apiResponseBusinessError, apiResponseGetMessage, asCredentialRef, authorize, buildBetas, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, isBillingConfirmable, isChannelInboundEvent, isComplianceBusinessError, isComplianceTerminalError, isIntegrationStatus, isInvalidGrantError, isPlatform, isRegion, isSSECommentLine, isSSLError, isTerminalRemoteEvent, maxEndUserIdLength, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newTokenSet, normalizeGatewayBaseURL, parseNotificationEvent, parseRemoteControlEvent, refreshToken, register, registerWebOAuthClient, remoteControlScopes, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, skillScopes, tokenSetIsExpired, uniqueMerge, validateEndUserId };