@acosmi/sdk-ts 2.13.0 → 2.15.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-DTKQS8kL.cjs';
2
- export { A as AnthropicContentBlock, b as AnthropicUsage, O as OpenAIAdapter, d as anthropicResponseTextContent, e as anthropicResponseThinkingContent, f as anthropicResponseToolUseBlocks } from './openai-DTKQS8kL.cjs';
3
- import { M as ManagedModel, Q as QuotaSummary, K as WindowResetSummary, m as ModelCapabilities, e as ChatRequest, P as ProviderAdapter, f as ChatResponse, I as ImageGenerationRequest, k as ImageGenerationResponse, V as VideoGenerationRequest, F as VideoTaskResponse, i as EmbeddingRequest, j as EmbeddingResponse, q as RerankRequest, r as RerankResponse, v as StreamEvent, u as SourcesEvent, w as StreamSettlement, l as InputModality } from './index-BI-Y3iOO.cjs';
4
- export { B as BucketClassCommercial, a as BucketClassGeneric, b as BucketInfo, c as BucketRow, C as ChatContentBlock, d as ChatMessage, g as ChatUsage, E as EffortConfig, h as EmbeddingData, G as GeoLoc, n as MultimodalContent, O as OutputConfig, o as ProviderFormat, R as RerankDocument, p as RerankQuery, s as RerankResult, S as ServerTool, t as ServerToolTypeWebSearch, T as ThinkingConfig, x as ThinkingHigh, y as ThinkingHighMinMaxTokens, z as ThinkingMax, A as ThinkingMaxFallbackMaxTokens, D as ThinkingOff, W as WebSearchConfig, H as WebSearchSource, J as WindowLimitStatus, L as bucketInfoIsCommercial, N as bucketRowIsCommercial, U as getAdapter, X as getAdapterForModel, Y as newThinkingConfig, Z as newWebSearchTool, _ as parseSettlement, $ as parseSourcesEvent } from './index-BI-Y3iOO.cjs';
1
+ import { a as AnthropicResponse } from './openai-B6mz3cyj.cjs';
2
+ export { A as AnthropicContentBlock, b as AnthropicUsage, O as OpenAIAdapter, d as anthropicResponseTextContent, e as anthropicResponseThinkingContent, f as anthropicResponseToolUseBlocks } from './openai-B6mz3cyj.cjs';
3
+ import { M as ManagedModel, Q as QuotaSummary, U as WindowResetSummary, n as ModelCapabilities, e as ChatRequest, P as ProviderAdapter, f as ChatResponse, I as ImageGenerationRequest, k as ImageGenerationResponse, V as VideoGenerationRequest, K as VideoTaskResponse, i as EmbeddingRequest, j as EmbeddingResponse, r as RerankRequest, s as RerankResponse, y as StreamEvent, v as SourcesEvent, z as StreamSettlement, l as InputModality } from './index-yOZUFtNQ.cjs';
4
+ export { B as BucketClassCommercial, a as BucketClassGeneric, b as BucketInfo, c as BucketRow, C as ChatContentBlock, d as ChatMessage, g as ChatUsage, E as EffortConfig, h as EmbeddingData, G as GeoLoc, m as InputModalityTag, o as MultimodalContent, O as OutputConfig, p as ProviderFormat, R as RerankDocument, q as RerankQuery, t as RerankResult, S as ServerTool, u as ServerToolTypeWebSearch, w as SourcesEventIssueCode, x as SourcesEventParseResult, T as ThinkingConfig, A as ThinkingHigh, D as ThinkingHighMinMaxTokens, F as ThinkingMax, H as ThinkingMaxFallbackMaxTokens, J as ThinkingOff, W as WebSearchConfig, L as WebSearchSource, N as WindowLimitStatus, X as bucketInfoIsCommercial, Y as bucketRowIsCommercial, Z as classifySourcesEvent, _ as getAdapter, $ as getAdapterForModel, a0 as newThinkingConfig, a1 as newWebSearchTool, a2 as parseSettlement, a3 as parseSourcesEvent } from './index-yOZUFtNQ.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';
@@ -1,7 +1,7 @@
1
- import { a as AnthropicResponse } from './openai-CcGS1DkW.js';
2
- export { A as AnthropicContentBlock, b as AnthropicUsage, O as OpenAIAdapter, d as anthropicResponseTextContent, e as anthropicResponseThinkingContent, f as anthropicResponseToolUseBlocks } from './openai-CcGS1DkW.js';
3
- import { M as ManagedModel, Q as QuotaSummary, K as WindowResetSummary, m as ModelCapabilities, e as ChatRequest, P as ProviderAdapter, f as ChatResponse, I as ImageGenerationRequest, k as ImageGenerationResponse, V as VideoGenerationRequest, F as VideoTaskResponse, i as EmbeddingRequest, j as EmbeddingResponse, q as RerankRequest, r as RerankResponse, v as StreamEvent, u as SourcesEvent, w as StreamSettlement, l as InputModality } from './index-BI-Y3iOO.js';
4
- export { B as BucketClassCommercial, a as BucketClassGeneric, b as BucketInfo, c as BucketRow, C as ChatContentBlock, d as ChatMessage, g as ChatUsage, E as EffortConfig, h as EmbeddingData, G as GeoLoc, n as MultimodalContent, O as OutputConfig, o as ProviderFormat, R as RerankDocument, p as RerankQuery, s as RerankResult, S as ServerTool, t as ServerToolTypeWebSearch, T as ThinkingConfig, x as ThinkingHigh, y as ThinkingHighMinMaxTokens, z as ThinkingMax, A as ThinkingMaxFallbackMaxTokens, D as ThinkingOff, W as WebSearchConfig, H as WebSearchSource, J as WindowLimitStatus, L as bucketInfoIsCommercial, N as bucketRowIsCommercial, U as getAdapter, X as getAdapterForModel, Y as newThinkingConfig, Z as newWebSearchTool, _ as parseSettlement, $ as parseSourcesEvent } from './index-BI-Y3iOO.js';
1
+ import { a as AnthropicResponse } from './openai-DuQHy2AA.js';
2
+ export { A as AnthropicContentBlock, b as AnthropicUsage, O as OpenAIAdapter, d as anthropicResponseTextContent, e as anthropicResponseThinkingContent, f as anthropicResponseToolUseBlocks } from './openai-DuQHy2AA.js';
3
+ import { M as ManagedModel, Q as QuotaSummary, U as WindowResetSummary, n as ModelCapabilities, e as ChatRequest, P as ProviderAdapter, f as ChatResponse, I as ImageGenerationRequest, k as ImageGenerationResponse, V as VideoGenerationRequest, K as VideoTaskResponse, i as EmbeddingRequest, j as EmbeddingResponse, r as RerankRequest, s as RerankResponse, y as StreamEvent, v as SourcesEvent, z as StreamSettlement, l as InputModality } from './index-yOZUFtNQ.js';
4
+ export { B as BucketClassCommercial, a as BucketClassGeneric, b as BucketInfo, c as BucketRow, C as ChatContentBlock, d as ChatMessage, g as ChatUsage, E as EffortConfig, h as EmbeddingData, G as GeoLoc, m as InputModalityTag, o as MultimodalContent, O as OutputConfig, p as ProviderFormat, R as RerankDocument, q as RerankQuery, t as RerankResult, S as ServerTool, u as ServerToolTypeWebSearch, w as SourcesEventIssueCode, x as SourcesEventParseResult, T as ThinkingConfig, A as ThinkingHigh, D as ThinkingHighMinMaxTokens, F as ThinkingMax, H as ThinkingMaxFallbackMaxTokens, J as ThinkingOff, W as WebSearchConfig, L as WebSearchSource, N as WindowLimitStatus, X as bucketInfoIsCommercial, Y as bucketRowIsCommercial, Z as classifySourcesEvent, _ as getAdapter, $ as getAdapterForModel, a0 as newThinkingConfig, a1 as newWebSearchTool, a2 as parseSettlement, a3 as parseSourcesEvent } from './index-yOZUFtNQ.js';
5
5
  import { M as MinimalSanitizeConfig } from './index-Bah9A83R.js';
6
6
  export { A as sanitize } from './index-Bah9A83R.js';
7
7
  export { AnthropicAdapter } from './adapters/anthropic.js';
@@ -41,6 +41,57 @@ function newWebSearchTool(cfg) {
41
41
  }
42
42
  return st;
43
43
  }
44
+ function classifySourcesEvent(ev) {
45
+ let parsed;
46
+ try {
47
+ parsed = JSON.parse(ev.data);
48
+ } catch {
49
+ return ev.event === "sources" ? { kind: "malformed_sources", code: "invalid_json" } : { kind: "not_sources" };
50
+ }
51
+ const wrapper = typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : null;
52
+ if (wrapper?.type !== "sources" && ev.event !== "sources") {
53
+ return { kind: "not_sources" };
54
+ }
55
+ if (!wrapper || !Object.prototype.hasOwnProperty.call(wrapper, "sources")) {
56
+ return { kind: "malformed_sources", code: "missing_sources" };
57
+ }
58
+ if (Object.prototype.hasOwnProperty.call(wrapper, "session_id") && wrapper.session_id !== void 0 && typeof wrapper.session_id !== "string") {
59
+ return { kind: "malformed_sources", code: "session_id_invalid" };
60
+ }
61
+ if (!Array.isArray(wrapper.sources)) {
62
+ return { kind: "malformed_sources", code: "sources_not_array" };
63
+ }
64
+ const sessionID = typeof wrapper.session_id === "string" ? wrapper.session_id : void 0;
65
+ if (wrapper.sources.length === 0) {
66
+ return {
67
+ kind: "empty_sources",
68
+ ...sessionID === void 0 ? {} : { session_id: sessionID }
69
+ };
70
+ }
71
+ for (const source of wrapper.sources) {
72
+ if (typeof source !== "object" || source === null || Array.isArray(source)) {
73
+ return { kind: "malformed_sources", code: "source_not_object" };
74
+ }
75
+ const item = source;
76
+ if (typeof item.title !== "string") {
77
+ return { kind: "malformed_sources", code: "source_title_invalid" };
78
+ }
79
+ if (typeof item.url !== "string") {
80
+ return { kind: "malformed_sources", code: "source_url_invalid" };
81
+ }
82
+ if (Object.prototype.hasOwnProperty.call(item, "snippet") && item.snippet !== void 0 && typeof item.snippet !== "string") {
83
+ return { kind: "malformed_sources", code: "source_snippet_invalid" };
84
+ }
85
+ }
86
+ return {
87
+ kind: "sources",
88
+ value: {
89
+ ...wrapper,
90
+ sources: wrapper.sources,
91
+ ...sessionID === void 0 ? {} : { session_id: sessionID }
92
+ }
93
+ };
94
+ }
44
95
  function parseSourcesEvent(ev) {
45
96
  let wrapper;
46
97
  try {
@@ -3608,9 +3659,7 @@ function normalizeInputModalities(models) {
3608
3659
  if (Array.isArray(m.inputModalities)) continue;
3609
3660
  const snake = m.input_modalities;
3610
3661
  if (Array.isArray(snake)) {
3611
- m.inputModalities = snake.filter(
3612
- (v) => v === "text" || v === "image"
3613
- );
3662
+ m.inputModalities = snake.filter((v) => typeof v === "string");
3614
3663
  }
3615
3664
  }
3616
3665
  return models;
@@ -7679,6 +7728,6 @@ function brandCredential(c) {
7679
7728
  return c;
7680
7729
  }
7681
7730
 
7682
- 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, 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, getWindowLimitStreamDetails, isBillingConfirmable, isChannelInboundEvent, isComplianceBusinessError, isComplianceTerminalError, isContinuableWindowLimitError, isIntegrationStatus, isInvalidGrantError, isPlatform, isRegion, isSSECommentLine, isSSLError, isTerminalRemoteEvent, isValidTokenSet, isWindowLimitError, isWindowLimitStreamError, 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 };
7731
+ 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, 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, classifySourcesEvent, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getAdapter, getAdapterForModel, getWindowLimitStreamDetails, isBillingConfirmable, isChannelInboundEvent, isComplianceBusinessError, isComplianceTerminalError, isContinuableWindowLimitError, isIntegrationStatus, isInvalidGrantError, isPlatform, isRegion, isSSECommentLine, isSSLError, isTerminalRemoteEvent, isValidTokenSet, isWindowLimitError, isWindowLimitStreamError, 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 };
7683
7732
  //# sourceMappingURL=index.mjs.map
7684
7733
  //# sourceMappingURL=index.mjs.map