@acosmi/sdk-ts 2.5.1 → 2.6.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.
- package/CHANGELOG.md +39 -0
- package/README.md +28 -10
- package/dist/browser/index.mjs +45 -9
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +45 -9
- package/dist/index.mjs.map +1 -1
- package/dist/node/adapters/anthropic.cjs.map +1 -1
- package/dist/node/adapters/anthropic.d.cts +1 -1
- package/dist/node/adapters/anthropic.d.ts +1 -1
- package/dist/node/adapters/anthropic.mjs.map +1 -1
- package/dist/node/adapters/openai.cjs.map +1 -1
- package/dist/node/adapters/openai.d.cts +2 -2
- package/dist/node/adapters/openai.d.ts +2 -2
- package/dist/node/adapters/openai.mjs.map +1 -1
- package/dist/node/{index-BdzF9tmA.d.cts → index-BrbgHn0E.d.cts} +12 -0
- package/dist/node/{index-BdzF9tmA.d.ts → index-BrbgHn0E.d.ts} +12 -0
- package/dist/node/index.cjs +49 -8
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +160 -54
- package/dist/node/index.d.ts +160 -54
- package/dist/node/index.mjs +45 -9
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{openai-B5xWiGMs.d.cts → openai-CeM2k04b.d.cts} +1 -1
- package/dist/node/{openai-C3DcaljC.d.ts → openai-DoPpzZmv.d.ts} +1 -1
- package/docs//345/274/200/345/217/221/344/270/216/345/217/221/345/270/203/346/211/213/345/206/214.md +9 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -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
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
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("
|
|
4583
|
+
u.searchParams.set("ticket", ticket);
|
|
4570
4584
|
let conn;
|
|
4571
4585
|
try {
|
|
4572
4586
|
conn = new WSCtor(u.toString());
|
|
@@ -6734,14 +6748,36 @@ Client.prototype.listPlans = async function(audience, signal) {
|
|
|
6734
6748
|
);
|
|
6735
6749
|
return Array.isArray(resp.data) ? resp.data : [];
|
|
6736
6750
|
};
|
|
6737
|
-
Client.prototype.
|
|
6751
|
+
Client.prototype.getMembership = async function(signal) {
|
|
6738
6752
|
const resp = await this.doJSON(
|
|
6739
6753
|
"GET",
|
|
6740
|
-
"/
|
|
6754
|
+
"/entitlements/membership",
|
|
6741
6755
|
null,
|
|
6742
6756
|
signal
|
|
6743
6757
|
);
|
|
6744
|
-
return
|
|
6758
|
+
return resp.data;
|
|
6759
|
+
};
|
|
6760
|
+
Client.prototype.getSubscriptionTier = async function(signal) {
|
|
6761
|
+
const resp = await this.doJSON(
|
|
6762
|
+
"GET",
|
|
6763
|
+
"/entitlements/subscription",
|
|
6764
|
+
null,
|
|
6765
|
+
signal
|
|
6766
|
+
);
|
|
6767
|
+
return resp.data;
|
|
6768
|
+
};
|
|
6769
|
+
Client.prototype.subscriptionPrecheck = async function(signal) {
|
|
6770
|
+
const resp = await this.doJSON(
|
|
6771
|
+
"GET",
|
|
6772
|
+
"/consumer/subscriptions/precheck",
|
|
6773
|
+
null,
|
|
6774
|
+
signal
|
|
6775
|
+
);
|
|
6776
|
+
return resp.data;
|
|
6777
|
+
};
|
|
6778
|
+
Client.prototype.listUserSubscriptions = async function(signal) {
|
|
6779
|
+
const m = await this.getMembership(signal);
|
|
6780
|
+
return m.hasActive ? [m] : [];
|
|
6745
6781
|
};
|
|
6746
6782
|
Client.prototype.getPlanByCode = async function(planCode, signal) {
|
|
6747
6783
|
if (!planCode) return null;
|
|
@@ -7156,6 +7192,6 @@ function asCredentialRef(s) {
|
|
|
7156
7192
|
return s;
|
|
7157
7193
|
}
|
|
7158
7194
|
|
|
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, 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 };
|
|
7195
|
+
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, 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
7196
|
//# sourceMappingURL=index.mjs.map
|
|
7161
7197
|
//# sourceMappingURL=index.mjs.map
|