@acosmi/sdk-ts 2.5.1 → 2.7.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.
@@ -3892,6 +3892,10 @@ var ScopeRemoteControl = "remote_control";
3892
3892
  var ScopeRemoteControlAgentRun = "remote_control:agent-run";
3893
3893
  var ScopeRemoteControlSessionControl = "remote_control:session-control";
3894
3894
  var ScopeRemoteControlPermissionResponse = "remote_control:permission-response";
3895
+ var ScopeChatBridge = "chat_bridge";
3896
+ var ScopeChatBridgeRead = "chat_bridge:read";
3897
+ var ScopeChatBridgeWrite = "chat_bridge:write";
3898
+ var ScopeChatBridgeRotate = "chat_bridge:rotate";
3895
3899
  var ScopeModels = "models";
3896
3900
  var ScopeModelsChat = "models:chat";
3897
3901
  var ScopeEntitlements = "entitlements";
@@ -3917,6 +3921,9 @@ function skillScopes() {
3917
3921
  function remoteControlScopes() {
3918
3922
  return [ScopeRemoteControl];
3919
3923
  }
3924
+ function chatBridgeScopes() {
3925
+ return [ScopeChatBridge];
3926
+ }
3920
3927
 
3921
3928
  // src/models/index.ts
3922
3929
  init_types();
@@ -4108,9 +4115,10 @@ Client.prototype.waitForPayment = async function(orderID, pollIntervalMs, signal
4108
4115
  if (pollIntervalMs <= 0) pollIntervalMs = 2e3;
4109
4116
  while (true) {
4110
4117
  const status = await this.getOrderStatus(orderID, signal);
4111
- if (isOrderTerminal(status.status)) {
4112
- if (isOrderSuccess(status.status)) return status;
4113
- throw new OrderTerminalError(orderID, status.status);
4118
+ const st = status.paymentStatus ?? status.orderStatus;
4119
+ if (isOrderTerminal(st)) {
4120
+ if (isOrderSuccess(st)) return status;
4121
+ throw new OrderTerminalError(orderID, st);
4114
4122
  }
4115
4123
  await sleepWithSignal(pollIntervalMs, signal);
4116
4124
  }
@@ -4562,11 +4570,17 @@ function getWebSocketCtor() {
4562
4570
  return WSCtor;
4563
4571
  }
4564
4572
  async function wsConnectOnce(c, ws) {
4565
- const token = await c.ensureToken(ws.abort.signal);
4566
4573
  const url = wsURL(c);
4567
4574
  const WSCtor = getWebSocketCtor();
4575
+ const ticketResp = await c.doJSON(
4576
+ "POST",
4577
+ "/ws/stream-ticket",
4578
+ null,
4579
+ ws.abort.signal
4580
+ );
4581
+ const ticket = ticketResp.data.ticket;
4568
4582
  const u = new URL(url);
4569
- u.searchParams.set("token", token);
4583
+ u.searchParams.set("ticket", ticket);
4570
4584
  let conn;
4571
4585
  try {
4572
4586
  conn = new WSCtor(u.toString());
@@ -4749,6 +4763,8 @@ async function sleepWithSignal2(ms, signal) {
4749
4763
  }
4750
4764
 
4751
4765
  // src/agent-runs/types.ts
4766
+ var AGENT_RUN_META_TITLE = "title";
4767
+ var AGENT_RUN_META_WORKSPACE = "workspace";
4752
4768
  var AgentRunStreamError = class extends Error {
4753
4769
  event;
4754
4770
  code;
@@ -4924,6 +4940,33 @@ var AgentRunsClient = class {
4924
4940
  );
4925
4941
  return fromWireCreateResponse(resp);
4926
4942
  }
4943
+ /**
4944
+ * List the caller's own agent runs, newest first (GET /agent-runs, Phase 5C
4945
+ * console). Returns view metadata only — never session tokens, policies or
4946
+ * messages (contract §6). Filter remote-control runs with
4947
+ * `{ runtime: 'crabcode_remote' }`.
4948
+ */
4949
+ async list(opts = {}, signal) {
4950
+ const params = new URLSearchParams();
4951
+ if (opts.runtime) params.set("runtime", opts.runtime);
4952
+ if (opts.status) params.set("status", opts.status);
4953
+ if (opts.page != null) params.set("page", String(opts.page));
4954
+ if (opts.pageSize != null) params.set("page_size", String(opts.pageSize));
4955
+ const qs = params.toString();
4956
+ const resp = await this.requestAPI(
4957
+ "GET",
4958
+ `/agent-runs${qs ? `?${qs}` : ""}`,
4959
+ null,
4960
+ signal,
4961
+ { retryOn401: true }
4962
+ );
4963
+ return {
4964
+ records: (resp.records ?? []).map(fromWireRun),
4965
+ total: typeof resp.total === "number" ? resp.total : 0,
4966
+ page: typeof resp.page === "number" ? resp.page : 1,
4967
+ pageSize: typeof resp.pageSize === "number" ? resp.pageSize : 20
4968
+ };
4969
+ }
4927
4970
  get(runId, signal) {
4928
4971
  return this.requestAPI(
4929
4972
  "GET",
@@ -4985,6 +5028,73 @@ var AgentRunsClient = class {
4985
5028
  [Symbol.asyncIterator]: () => this.streamRemoteControlGen(runId, signal)
4986
5029
  };
4987
5030
  }
5031
+ /**
5032
+ * Submit a permission decision for a pending `permission_request` event
5033
+ * (POST /agent-runs/:runId/permission-results, contract §4/§9/§14).
5034
+ *
5035
+ * Only `approved` | `rejected` may be submitted by clients — `timeout` /
5036
+ * `cancelled` are produced server-side. Requires an OAuth token with the
5037
+ * explicit `remote_control` scope (or a web JWT). 409 means the remote
5038
+ * session is gone (e.g. already terminated).
5039
+ */
5040
+ async submitPermissionResult(runId, result, signal) {
5041
+ await this.requestAPI(
5042
+ "POST",
5043
+ `/agent-runs/${encodeURIComponent(runId)}/permission-results`,
5044
+ {
5045
+ request_id: result.requestId,
5046
+ decision: result.decision,
5047
+ reason: result.reason
5048
+ },
5049
+ signal,
5050
+ { retryOn401: false }
5051
+ );
5052
+ }
5053
+ /**
5054
+ * Append a mid-session user message to a remote run
5055
+ * (POST /agent-runs/:runId/messages, Phase 5C). The message role is
5056
+ * hard-coded to 'user' server-side (contract §6 #5 prompt-injection
5057
+ * defence); content is limited to 64KB. Requires the explicit
5058
+ * `remote_control` scope (or a web JWT).
5059
+ */
5060
+ async submitUserMessage(runId, message, signal) {
5061
+ const resp = await this.requestAPI(
5062
+ "POST",
5063
+ `/agent-runs/${encodeURIComponent(runId)}/messages`,
5064
+ { request_id: message.requestId, content: message.content },
5065
+ signal,
5066
+ { retryOn401: false }
5067
+ );
5068
+ return {
5069
+ ok: resp?.ok === true,
5070
+ requestId: resp?.request_id ?? message.requestId ?? ""
5071
+ };
5072
+ }
5073
+ /**
5074
+ * Reveal the one-shot remote session token for a desktop-runner run
5075
+ * (POST /agent-runs/:runId/remote-token, Phase 5B; contract §18.1).
5076
+ *
5077
+ * Desktop launcher only: the token is single-consumption (a second call
5078
+ * returns 409) and must never touch browser storage — receive it in the
5079
+ * native layer and inject it into the CrabCode child-process env only
5080
+ * (contract §6). Cloud / local_embedded runners never expose tokens over
5081
+ * HTTP (403). Requires the explicit `remote_control` scope.
5082
+ */
5083
+ async revealRemoteToken(runId, signal) {
5084
+ const resp = await this.requestAPI(
5085
+ "POST",
5086
+ `/agent-runs/${encodeURIComponent(runId)}/remote-token`,
5087
+ {},
5088
+ signal,
5089
+ { retryOn401: false }
5090
+ );
5091
+ return {
5092
+ accessToken: resp?.access_token ?? "",
5093
+ sessionUrl: resp?.session_url ?? "",
5094
+ tenantId: resp?.tenant_id ?? "",
5095
+ workspace: resp?.workspace || void 0
5096
+ };
5097
+ }
4988
5098
  async *streamRemoteControlGen(runId, signal) {
4989
5099
  const resp = await this.requestRaw(
4990
5100
  "GET",
@@ -5235,6 +5345,7 @@ function toWireCreateRequest(req) {
5235
5345
  adapter: req.adapter,
5236
5346
  permission_policy: req.permissionPolicy ? toWirePermissionPolicy(req.permissionPolicy) : void 0,
5237
5347
  workspace_policy: req.workspacePolicy ? toWireWorkspacePolicy(req.workspacePolicy) : void 0,
5348
+ byok_credential_ref: req.byokCredentialRef,
5238
5349
  artifact_policy: req.artifactPolicy ? {
5239
5350
  enabled: req.artifactPolicy.enabled,
5240
5351
  max_files: req.artifactPolicy.maxFiles
@@ -5267,7 +5378,10 @@ function fromWireRun(resp) {
5267
5378
  startedAt: resp.started_at,
5268
5379
  completedAt: resp.completed_at,
5269
5380
  error: normalizeError(resp.error),
5270
- metadata: resp.metadata
5381
+ metadata: resp.metadata,
5382
+ runtime: resp.runtime,
5383
+ runner: resp.runner,
5384
+ adapter: resp.adapter
5271
5385
  };
5272
5386
  }
5273
5387
  function fromWireArtifact(resp) {
@@ -5525,6 +5639,87 @@ function errorMessage(e) {
5525
5639
  return e instanceof Error ? e.message : String(e);
5526
5640
  }
5527
5641
 
5642
+ // src/agent-runs/byok.ts
5643
+ function fromWireByok(v) {
5644
+ return {
5645
+ credentialRef: v.credential_ref ?? "",
5646
+ provider: v.provider ?? "",
5647
+ name: v.name || void 0,
5648
+ baseUrl: v.base_url || void 0,
5649
+ fingerprint: v.fingerprint || void 0,
5650
+ status: v.status ?? "",
5651
+ createdAt: v.created_at || void 0,
5652
+ lastUsedAt: v.last_used_at || void 0
5653
+ };
5654
+ }
5655
+ var byokByClient = /* @__PURE__ */ new WeakMap();
5656
+ Object.defineProperty(Client.prototype, "crabcodeByok", {
5657
+ configurable: true,
5658
+ enumerable: false,
5659
+ get() {
5660
+ let existing = byokByClient.get(this);
5661
+ if (!existing) {
5662
+ existing = new CrabCodeByokClient(this);
5663
+ byokByClient.set(this, existing);
5664
+ }
5665
+ return existing;
5666
+ }
5667
+ });
5668
+ var CrabCodeByokClient = class {
5669
+ constructor(client) {
5670
+ this.client = client;
5671
+ }
5672
+ client;
5673
+ /** 列出调用者自己的密钥 (masked; 新→旧, 服务端上限 100 条)。 */
5674
+ async list(signal) {
5675
+ const resp = await this.client.doJSON(
5676
+ "GET",
5677
+ "/crabcode/byok-credentials",
5678
+ null,
5679
+ signal
5680
+ );
5681
+ return (resp.data?.items ?? []).map(fromWireByok);
5682
+ }
5683
+ /**
5684
+ * 创建密钥 — 明文一次性提交, 返回 masked 视图。
5685
+ * 单用户上限 20 把; provider='custom' 必须带 https:// baseUrl。
5686
+ */
5687
+ async create(req, signal) {
5688
+ const resp = await this.client.doJSON(
5689
+ "POST",
5690
+ "/crabcode/byok-credentials",
5691
+ {
5692
+ provider: req.provider,
5693
+ name: req.name,
5694
+ base_url: req.baseUrl,
5695
+ plaintext: req.plaintext
5696
+ },
5697
+ signal
5698
+ );
5699
+ return fromWireByok(resp.data ?? {});
5700
+ }
5701
+ /** 轮换密钥明文 — credentialRef 不变, fingerprint 更新。已吊销的密钥不可轮换 (400)。 */
5702
+ async rotate(credentialRef, newPlaintext, signal) {
5703
+ const resp = await this.client.doJSON(
5704
+ "POST",
5705
+ `/crabcode/byok-credentials/${encodeURIComponent(credentialRef)}/rotate`,
5706
+ { new_plaintext: newPlaintext },
5707
+ signal
5708
+ );
5709
+ return fromWireByok(resp.data ?? {});
5710
+ }
5711
+ /** 吊销密钥 (软状态 + 服务端抹密文, 不可恢复; 幂等 — 重复吊销返回当前视图)。 */
5712
+ async revoke(credentialRef, signal) {
5713
+ const resp = await this.client.doJSON(
5714
+ "POST",
5715
+ `/crabcode/byok-credentials/${encodeURIComponent(credentialRef)}/revoke`,
5716
+ {},
5717
+ signal
5718
+ );
5719
+ return fromWireByok(resp.data ?? {});
5720
+ }
5721
+ };
5722
+
5528
5723
  // src/compliance/scopes.ts
5529
5724
  var ScopeComplianceEvidenceRead = "compliance:evidence:read";
5530
5725
  var ScopeComplianceEvidenceWrite = "compliance:evidence:write";
@@ -6734,14 +6929,36 @@ Client.prototype.listPlans = async function(audience, signal) {
6734
6929
  );
6735
6930
  return Array.isArray(resp.data) ? resp.data : [];
6736
6931
  };
6737
- Client.prototype.listUserSubscriptions = async function(signal) {
6932
+ Client.prototype.getMembership = async function(signal) {
6738
6933
  const resp = await this.doJSON(
6739
6934
  "GET",
6740
- "/distribution/user/subscriptions",
6935
+ "/entitlements/membership",
6741
6936
  null,
6742
6937
  signal
6743
6938
  );
6744
- return Array.isArray(resp.data) ? resp.data : [];
6939
+ return resp.data;
6940
+ };
6941
+ Client.prototype.getSubscriptionTier = async function(signal) {
6942
+ const resp = await this.doJSON(
6943
+ "GET",
6944
+ "/entitlements/subscription",
6945
+ null,
6946
+ signal
6947
+ );
6948
+ return resp.data;
6949
+ };
6950
+ Client.prototype.subscriptionPrecheck = async function(signal) {
6951
+ const resp = await this.doJSON(
6952
+ "GET",
6953
+ "/consumer/subscriptions/precheck",
6954
+ null,
6955
+ signal
6956
+ );
6957
+ return resp.data;
6958
+ };
6959
+ Client.prototype.listUserSubscriptions = async function(signal) {
6960
+ const m = await this.getMembership(signal);
6961
+ return m.hasActive ? [m] : [];
6745
6962
  };
6746
6963
  Client.prototype.getPlanByCode = async function(planCode, signal) {
6747
6964
  if (!planCode) return null;
@@ -7156,6 +7373,130 @@ function asCredentialRef(s) {
7156
7373
  return s;
7157
7374
  }
7158
7375
 
7159
- export { ALL_INTEGRATION_STATUS, ALL_PLATFORMS, ALL_REGIONS, AgentRunStreamError, AgentRunsClient, AnthropicAdapter, AudienceEnum, BillingModeEnum, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, ComplianceClient, CompliancePollError, DEFAULT_API_TIMEOUT_MS, DEFAULT_GATEWAY_BASE_URL, LocalStorageTokenStore as DefaultBrowserTokenStore, DefaultRetryPolicy, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrOAuthCORSBlocked, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRefreshProxyFailed, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, ErrTokenExpired, EventAuthURL, EventComplete, EventError, FileTokenStore, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, HTTPError, IdempotencyKeyHeader, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OAuthTokenEndpointError, OpenAIAdapter, OrderTerminalError, ProductFamilyEnum, ProviderFormat, RETRY_ADVICE_REASONS, RateLimitError, RegionScopeEnum, 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, ServerToolTypeWebSearch, StreamError, ThinkingHigh, ThinkingHighMinMaxTokens, ThinkingMax, ThinkingMaxFallbackMaxTokens, ThinkingOff, allScopes, anthropicResponseTextContent, anthropicResponseThinkingContent, anthropicResponseToolUseBlocks, apiResponseBusinessError, apiResponseGetMessage, asCredentialRef, authorize, bucketInfoIsCommercial, bucketRowIsCommercial, buildBetas, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getAdapter, getAdapterForModel, isBillingConfirmable, isChannelInboundEvent, isComplianceBusinessError, isComplianceTerminalError, isIntegrationStatus, isInvalidGrantError, isPlatform, isRegion, isSSECommentLine, isSSLError, isTerminalRemoteEvent, isValidTokenSet, maxEndUserIdLength, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, normalizeGatewayBaseURL, normalizeOverrideBaseURL, parseNotificationEvent, parseRemoteControlEvent, parseSettlement, parseSourcesEvent, refreshToken, register, registerWebOAuthClient, remoteControlScopes, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge, validateEndUserId };
7376
+ // src/chatbridge/client.ts
7377
+ var chatBridgeByClient = /* @__PURE__ */ new WeakMap();
7378
+ Object.defineProperty(Client.prototype, "chatBridge", {
7379
+ configurable: true,
7380
+ enumerable: false,
7381
+ get() {
7382
+ let existing = chatBridgeByClient.get(this);
7383
+ if (!existing) {
7384
+ existing = new ChatBridgeClient(this);
7385
+ chatBridgeByClient.set(this, existing);
7386
+ }
7387
+ return existing;
7388
+ }
7389
+ });
7390
+ var ChatBridgeClient = class {
7391
+ constructor(client) {
7392
+ this.client = client;
7393
+ }
7394
+ client;
7395
+ // ---------------------------------------------------------------------------
7396
+ // Integration 管理面
7397
+ // ---------------------------------------------------------------------------
7398
+ /** 创建平台集成 (chat_bridge:write)。云端控制台与下游 (CrabCode) 调的是同一端点/同一份数据。 */
7399
+ async createIntegration(req, signal) {
7400
+ const resp = await this.client.doJSON(
7401
+ "POST",
7402
+ "/chat-bridge/integrations",
7403
+ {
7404
+ app_id: req.appId,
7405
+ platform: req.platform,
7406
+ region: req.region,
7407
+ workspace_id: req.workspaceId,
7408
+ bot_id: req.botId,
7409
+ config_json: req.configJson
7410
+ },
7411
+ signal
7412
+ );
7413
+ return resp.data;
7414
+ }
7415
+ /** 列出本租户集成 (chat_bridge:read; masked 视图)。可按 appId 过滤。 */
7416
+ async listIntegrations(appId, signal) {
7417
+ const qs = appId ? `?app_id=${encodeURIComponent(appId)}` : "";
7418
+ const resp = await this.client.doJSON(
7419
+ "GET",
7420
+ `/chat-bridge/integrations${qs}`,
7421
+ null,
7422
+ signal
7423
+ );
7424
+ return resp.data?.items ?? [];
7425
+ }
7426
+ /** 取单个集成 (chat_bridge:read)。不存在/跨租户一律 404。 */
7427
+ async getIntegration(id, signal) {
7428
+ const resp = await this.client.doJSON(
7429
+ "GET",
7430
+ `/chat-bridge/integrations/${encodeURIComponent(id)}`,
7431
+ null,
7432
+ signal
7433
+ );
7434
+ return resp.data;
7435
+ }
7436
+ /** 更新集成状态 (chat_bridge:write): pending | active | suspended | revoked。 */
7437
+ async updateIntegrationStatus(id, status, signal) {
7438
+ await this.client.doJSON(
7439
+ "PATCH",
7440
+ `/chat-bridge/integrations/${encodeURIComponent(id)}/status`,
7441
+ { status },
7442
+ signal
7443
+ );
7444
+ }
7445
+ // ---------------------------------------------------------------------------
7446
+ // Credential 管理面 (vault)
7447
+ // ---------------------------------------------------------------------------
7448
+ /** 存凭证 (chat_bridge:write) — 明文一次性提交, 返回 masked 记录 (ref+fingerprint)。 */
7449
+ async storeCredential(integrationId, req, signal) {
7450
+ const resp = await this.client.doJSON(
7451
+ "POST",
7452
+ `/chat-bridge/integrations/${encodeURIComponent(integrationId)}/credentials`,
7453
+ {
7454
+ secret_kind: req.secretKind,
7455
+ plaintext: req.plaintext,
7456
+ region: req.region,
7457
+ platform: req.platform
7458
+ },
7459
+ signal
7460
+ );
7461
+ return brandCredential(resp.data);
7462
+ }
7463
+ /** 列出集成的凭证 (chat_bridge:read; masked, 永不含明文/密文)。 */
7464
+ async listCredentials(integrationId, signal) {
7465
+ const resp = await this.client.doJSON(
7466
+ "GET",
7467
+ `/chat-bridge/integrations/${encodeURIComponent(integrationId)}/credentials`,
7468
+ null,
7469
+ signal
7470
+ );
7471
+ return (resp.data?.items ?? []).map(brandCredential);
7472
+ }
7473
+ /** 轮换凭证 (chat_bridge:rotate, 高风险) — ref 不变, fingerprint 更新。 */
7474
+ async rotateCredential(integrationId, secretKind, newPlaintext, signal) {
7475
+ const resp = await this.client.doJSON(
7476
+ "POST",
7477
+ `/chat-bridge/integrations/${encodeURIComponent(integrationId)}/credentials/rotate`,
7478
+ { secret_kind: secretKind, new_plaintext: newPlaintext },
7479
+ signal
7480
+ );
7481
+ return brandCredential(resp.data);
7482
+ }
7483
+ /** 吊销凭证 (chat_bridge:rotate) — 软吊销 + 服务端抹密文。 */
7484
+ async revokeCredential(credentialRef, signal) {
7485
+ await this.client.doJSON(
7486
+ "POST",
7487
+ `/chat-bridge/credentials/${encodeURIComponent(credentialRef)}/revoke`,
7488
+ {},
7489
+ signal
7490
+ );
7491
+ }
7492
+ };
7493
+ function brandCredential(c) {
7494
+ if (c && typeof c.credentialRef === "string") {
7495
+ return { ...c, credentialRef: asCredentialRef(c.credentialRef) };
7496
+ }
7497
+ return c;
7498
+ }
7499
+
7500
+ export { AGENT_RUN_META_TITLE, AGENT_RUN_META_WORKSPACE, ALL_INTEGRATION_STATUS, ALL_PLATFORMS, ALL_REGIONS, AgentRunStreamError, AgentRunsClient, AnthropicAdapter, AudienceEnum, BillingModeEnum, BucketClassCommercial, BucketClassGeneric, BusinessError, ChatBridgeClient, Client, ComplianceClient, CompliancePollError, CrabCodeByokClient, DEFAULT_API_TIMEOUT_MS, DEFAULT_GATEWAY_BASE_URL, LocalStorageTokenStore as DefaultBrowserTokenStore, DefaultRetryPolicy, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrOAuthCORSBlocked, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRefreshProxyFailed, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, ErrTokenExpired, EventAuthURL, EventComplete, EventError, FileTokenStore, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, HTTPError, IdempotencyKeyHeader, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OAuthTokenEndpointError, OpenAIAdapter, OrderTerminalError, ProductFamilyEnum, ProviderFormat, RETRY_ADVICE_REASONS, RateLimitError, RegionScopeEnum, ScopeAI, ScopeAccount, ScopeChatBridge, ScopeChatBridgeRead, ScopeChatBridgeRotate, ScopeChatBridgeWrite, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, ScopeComplianceContractTemplateRead, ScopeComplianceContractTemplateWrite, ScopeComplianceEvidenceRead, ScopeComplianceEvidenceWrite, ScopeComplianceReportsPublish, ScopeComplianceReportsRead, ScopeComplianceReportsWrite, ScopeComplianceSealApprovalApprove, ScopeComplianceSealApprovalRequest, ScopeComplianceSealManage, ScopeComplianceSealUseExecute, ScopeComplianceTimestampIssue, ScopeComplianceTimestampVerify, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeRemoteControl, ScopeRemoteControlAgentRun, ScopeRemoteControlPermissionResponse, ScopeRemoteControlSessionControl, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, ServerToolTypeWebSearch, StreamError, ThinkingHigh, ThinkingHighMinMaxTokens, ThinkingMax, ThinkingMaxFallbackMaxTokens, ThinkingOff, allScopes, anthropicResponseTextContent, anthropicResponseThinkingContent, anthropicResponseToolUseBlocks, apiResponseBusinessError, apiResponseGetMessage, asCredentialRef, authorize, bucketInfoIsCommercial, bucketRowIsCommercial, buildBetas, chatBridgeScopes, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getAdapter, getAdapterForModel, isBillingConfirmable, isChannelInboundEvent, isComplianceBusinessError, isComplianceTerminalError, isIntegrationStatus, isInvalidGrantError, isPlatform, isRegion, isSSECommentLine, isSSLError, isTerminalRemoteEvent, isValidTokenSet, maxEndUserIdLength, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, normalizeGatewayBaseURL, normalizeOverrideBaseURL, parseNotificationEvent, parseRemoteControlEvent, parseSettlement, parseSourcesEvent, refreshToken, register, registerWebOAuthClient, remoteControlScopes, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge, validateEndUserId };
7160
7501
  //# sourceMappingURL=index.mjs.map
7161
7502
  //# sourceMappingURL=index.mjs.map