@flashbacktech/tsclient 0.4.33 → 0.4.35
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/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -3
- package/dist/index.d.ts +73 -3
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -822,7 +822,7 @@ interface ClarificationOption {
|
|
|
822
822
|
label: string;
|
|
823
823
|
description?: string;
|
|
824
824
|
}
|
|
825
|
-
type ChatEventType = 'phase' | 'question' | 'plan_draft' | 'step_started' | 'step_completed' | 'step_failed' | 'step_progress' | 'narration' | 'assistant_message' | 'done' | 'session_title' | 'tool_call_started' | 'tool_call_finished' | 'llm_call_finished' | 'tool_call_confirmation_required';
|
|
825
|
+
type ChatEventType = 'phase' | 'question' | 'plan_draft' | 'step_started' | 'step_completed' | 'step_failed' | 'step_progress' | 'narration' | 'assistant_message' | 'done' | 'session_title' | 'tool_call_started' | 'tool_call_finished' | 'llm_call_finished' | 'tool_call_confirmation_required' | 'chat_compaction_fired' | 'chat_checkpointed';
|
|
826
826
|
type ChatPhase = 'classifying' | 'clarifying' | 'executing' | 'answering' | 'done';
|
|
827
827
|
interface ChatPhasePayload {
|
|
828
828
|
phase: ChatPhase;
|
|
@@ -957,13 +957,38 @@ interface ChatDonePayload {
|
|
|
957
957
|
interface ChatSessionTitlePayload {
|
|
958
958
|
title: string;
|
|
959
959
|
}
|
|
960
|
+
/**
|
|
961
|
+
* Sent with `chat_compaction_fired` once per Run when the chat-loop
|
|
962
|
+
* mid-session replaces older history with a structured progress note
|
|
963
|
+
* (chat-compact-optimization Front #1). The session-debug view uses
|
|
964
|
+
* this to mark the boundary in the rendered transcript so operators
|
|
965
|
+
* can see how aggressively the loop is trimming context.
|
|
966
|
+
*/
|
|
967
|
+
interface ChatCompactionFiredPayload {
|
|
968
|
+
turn_index: number;
|
|
969
|
+
prompt_tokens_before: number;
|
|
970
|
+
compactor_model: string;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Sent with `chat_checkpointed` when the chat-loop, on its final
|
|
974
|
+
* allowed iteration, emits a structured terminal summary instead of
|
|
975
|
+
* running another open-ended LLM call (chat-compact-optimization Front
|
|
976
|
+
* #2). The accompanying assistant message is the checkpoint body; the
|
|
977
|
+
* dashboard should render the session's StopReason
|
|
978
|
+
* ("max_turns_checkpointed") with a distinct chip and offer a "Continue
|
|
979
|
+
* this work" affordance that POSTs a canned follow-up.
|
|
980
|
+
*/
|
|
981
|
+
interface ChatCheckpointedPayload {
|
|
982
|
+
turn_index: number;
|
|
983
|
+
checkpoint_model: string;
|
|
984
|
+
}
|
|
960
985
|
interface ChatEvent {
|
|
961
986
|
conversation_id: string;
|
|
962
987
|
turn_id: string;
|
|
963
988
|
type: ChatEventType;
|
|
964
989
|
plan_id?: string;
|
|
965
990
|
step_id?: string;
|
|
966
|
-
payload?: ChatPhasePayload | ChatQuestionPayload | ChatPlanDraftPayload | ChatStepEventPayload | ChatStepProgressPayload | ChatNarrationPayload | ChatAssistantMessagePayload | ChatDonePayload | ChatSessionTitlePayload | ChatToolCallStartedPayload | ChatToolCallFinishedPayload | ChatLLMCallFinishedPayload | ChatToolCallConfirmationRequiredPayload | unknown;
|
|
991
|
+
payload?: ChatPhasePayload | ChatQuestionPayload | ChatPlanDraftPayload | ChatStepEventPayload | ChatStepProgressPayload | ChatNarrationPayload | ChatAssistantMessagePayload | ChatDonePayload | ChatSessionTitlePayload | ChatToolCallStartedPayload | ChatToolCallFinishedPayload | ChatLLMCallFinishedPayload | ChatToolCallConfirmationRequiredPayload | ChatCompactionFiredPayload | ChatCheckpointedPayload | unknown;
|
|
967
992
|
timestamp: string;
|
|
968
993
|
event_id?: number;
|
|
969
994
|
}
|
|
@@ -1636,6 +1661,37 @@ interface MonthlyCreditStats {
|
|
|
1636
1661
|
grantsCents: number;
|
|
1637
1662
|
balanceCents: number;
|
|
1638
1663
|
}
|
|
1664
|
+
/**
|
|
1665
|
+
* "Other amount" PAYG purchase config, served by
|
|
1666
|
+
* GET /credits/packs/custom-config. Disabled =>
|
|
1667
|
+
* `{ enabled: false, minCents: 0, maxCents: 0, presetCents: [] }` so
|
|
1668
|
+
* the frontend can hide the tile cleanly without nil checks.
|
|
1669
|
+
*/
|
|
1670
|
+
interface CustomCreditPurchaseConfig {
|
|
1671
|
+
enabled: boolean;
|
|
1672
|
+
minCents: number;
|
|
1673
|
+
maxCents: number;
|
|
1674
|
+
/** Suggested one-click amounts (in cents) for the "Other" tile. */
|
|
1675
|
+
presetCents: number[];
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Body for POST /credits/packs/buy-custom. `amountCents` is the
|
|
1679
|
+
* arbitrary dollar amount the user typed, converted to USD-cents
|
|
1680
|
+
* before the API call. Server enforces `min <= amount <= max`.
|
|
1681
|
+
* Credit ratio is 1:1 (pay $X, get $X of credits in the permanent
|
|
1682
|
+
* bucket).
|
|
1683
|
+
*/
|
|
1684
|
+
interface BuyCustomCreditRequest {
|
|
1685
|
+
amountCents: number;
|
|
1686
|
+
}
|
|
1687
|
+
/** Response from POST /credits/packs/buy-custom. Mirrors the fixed-pack response. */
|
|
1688
|
+
interface BuyCustomCreditResponse {
|
|
1689
|
+
success: boolean;
|
|
1690
|
+
checkoutUrl?: string;
|
|
1691
|
+
sessionId?: string;
|
|
1692
|
+
error_code?: string;
|
|
1693
|
+
message?: string;
|
|
1694
|
+
}
|
|
1639
1695
|
/**
|
|
1640
1696
|
* Refusal reasons from POST /v1/agent/chat/sessions/:id/messages when
|
|
1641
1697
|
* the billing preflight rejects a turn (HTTP 402). Frontend maps these
|
|
@@ -1674,6 +1730,20 @@ declare class CreditsClient {
|
|
|
1674
1730
|
listTransactions(query?: ListCreditsTransactionsQuery): Promise<ListCreditsTransactionsResponse>;
|
|
1675
1731
|
/** Backend currently returns 501. Surfaced for forward-compat. */
|
|
1676
1732
|
getMonthlyStats(): Promise<MonthlyCreditStats[]>;
|
|
1733
|
+
/**
|
|
1734
|
+
* "Other amount" PAYG config — bounds + presets for the
|
|
1735
|
+
* arbitrary-dollar tile. Public endpoint; returns a disabled
|
|
1736
|
+
* shape (`enabled: false`) when the feature is off so the
|
|
1737
|
+
* frontend can hide the tile without throwing.
|
|
1738
|
+
*/
|
|
1739
|
+
getCustomConfig(): Promise<CustomCreditPurchaseConfig>;
|
|
1740
|
+
/**
|
|
1741
|
+
* Buy an arbitrary-dollar PAYG amount. The Stripe Checkout
|
|
1742
|
+
* session is built with `price_data` inline (no pre-created
|
|
1743
|
+
* Price), so the catalog has nothing to provision for this — it
|
|
1744
|
+
* is purely a per-purchase flow.
|
|
1745
|
+
*/
|
|
1746
|
+
buyCustom(body: BuyCustomCreditRequest): Promise<BuyCustomCreditResponse>;
|
|
1677
1747
|
}
|
|
1678
1748
|
|
|
1679
1749
|
interface UsageWindow {
|
|
@@ -1950,4 +2020,4 @@ declare class NotImplementedError extends Error {
|
|
|
1950
2020
|
constructor(method: string);
|
|
1951
2021
|
}
|
|
1952
2022
|
|
|
1953
|
-
export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AuthUser, BaseClient, type BaseClientOptions, type BudgetScope, BudgetsClient, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_STORAGE, CAP_VCS, type CancelChatTurnResponse, type CancelSubscriptionResponse, type ChatAssistantMessagePayload, type ChatBillingRefuseCode, type ChatBillingRefuseError, type ChatBudget, type ChatDonePayload, type ChatEvent, type ChatEventType, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ClarificationOption, CloudAgentClient, type CloudAgentClientOptions, type CloudResource, type CloudResourceContainerRef, type CloudResourceEdge, type CloudScanHistory, type CloudScanLease, type ConfirmChatToolCallRequest, type ConfirmChatToolCallResponse, type CreateAgentTemplateRequest, type CreateChatScheduleRequest, type CreateChatSessionRequest, type CreateChatSessionResponse, type CreateCredentialRequest, type CreateGatewayTokenRequest, type CreateGatewayTokenResponse, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditTransaction, type CreditTransactionKind, type CreditTransactionType, type DebugPayload, type DebugReceipt, type EffectiveChatBudget, type ExchangeCodeRequest, type FieldSpec, type FieldType, type FineTuneParams, type GatewayToken, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatScheduleRunsResponse, type ListChatSchedulesResponse, type ListChatSessionsQuery, type ListChatSessionsResponse, type ListCredentialsQuery, type ListCreditsTransactionsQuery, type ListCreditsTransactionsResponse, type ListPaymentsResponse, type ListSandboxesQuery, type ListScanHistoryQuery, type ListScanHistoryResponse, type ListScheduledTasksQuery, type ListScheduledTasksResponse, type LoginRequest, type MFASetupResponse, type MFASimpleResponse, type MFAStatus, MFAType, type MFAVerifyLoginRequest, type MFAVerifyLoginResponse, type MFAVerifySetupRequest, type MagicLinkActivateRequest, type MagicLinkSendResponse, type ModeType, type MonthlyCreditStats, NotImplementedError, type OpenChatStreamOptions, type OrgBudget, OrgRoles, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type Query, type ReconcileScope, type ReconcileTuple, type RefreshRequest, type RegisterRequest, type RequestOptions, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type Subscription, type SubscriptionCapability, type SubscriptionPeriod, type SystemEvent, type SystemEventQuery, type SystemEventQueryResponse, type SystemEventReadResponse, type Template, type TokenProvider, type UnauthorizedHandler, type UpdateChatBudgetRequest, type UpdateChatScheduleRequest, type UpdateCostLimitRequest, type UpdateCredentialRequest, type UpdateMemberRoleRequest, type UpdateOrgBudgetRequest, type UpdateOrgUserRequest, type UpdateOrganizationRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageReportQuery, type UsageReportResponse, type UsageSummary, type UsageSummaryQuery, type UsageSummaryResponse, type UsageTotals, type UsageWindow, type UserProfile, type UserSummary, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
|
|
2023
|
+
export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AuthUser, BaseClient, type BaseClientOptions, type BudgetScope, BudgetsClient, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_STORAGE, CAP_VCS, type CancelChatTurnResponse, type CancelSubscriptionResponse, type ChatAssistantMessagePayload, type ChatBillingRefuseCode, type ChatBillingRefuseError, type ChatBudget, type ChatCheckpointedPayload, type ChatCompactionFiredPayload, type ChatDonePayload, type ChatEvent, type ChatEventType, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ClarificationOption, CloudAgentClient, type CloudAgentClientOptions, type CloudResource, type CloudResourceContainerRef, type CloudResourceEdge, type CloudScanHistory, type CloudScanLease, type ConfirmChatToolCallRequest, type ConfirmChatToolCallResponse, type CreateAgentTemplateRequest, type CreateChatScheduleRequest, type CreateChatSessionRequest, type CreateChatSessionResponse, type CreateCredentialRequest, type CreateGatewayTokenRequest, type CreateGatewayTokenResponse, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditTransaction, type CreditTransactionKind, type CreditTransactionType, type CustomCreditPurchaseConfig, type DebugPayload, type DebugReceipt, type EffectiveChatBudget, type ExchangeCodeRequest, type FieldSpec, type FieldType, type FineTuneParams, type GatewayToken, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatScheduleRunsResponse, type ListChatSchedulesResponse, type ListChatSessionsQuery, type ListChatSessionsResponse, type ListCredentialsQuery, type ListCreditsTransactionsQuery, type ListCreditsTransactionsResponse, type ListPaymentsResponse, type ListSandboxesQuery, type ListScanHistoryQuery, type ListScanHistoryResponse, type ListScheduledTasksQuery, type ListScheduledTasksResponse, type LoginRequest, type MFASetupResponse, type MFASimpleResponse, type MFAStatus, MFAType, type MFAVerifyLoginRequest, type MFAVerifyLoginResponse, type MFAVerifySetupRequest, type MagicLinkActivateRequest, type MagicLinkSendResponse, type ModeType, type MonthlyCreditStats, NotImplementedError, type OpenChatStreamOptions, type OrgBudget, OrgRoles, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type Query, type ReconcileScope, type ReconcileTuple, type RefreshRequest, type RegisterRequest, type RequestOptions, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type Subscription, type SubscriptionCapability, type SubscriptionPeriod, type SystemEvent, type SystemEventQuery, type SystemEventQueryResponse, type SystemEventReadResponse, type Template, type TokenProvider, type UnauthorizedHandler, type UpdateChatBudgetRequest, type UpdateChatScheduleRequest, type UpdateCostLimitRequest, type UpdateCredentialRequest, type UpdateMemberRoleRequest, type UpdateOrgBudgetRequest, type UpdateOrgUserRequest, type UpdateOrganizationRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageReportQuery, type UsageReportResponse, type UsageSummary, type UsageSummaryQuery, type UsageSummaryResponse, type UsageTotals, type UsageWindow, type UserProfile, type UserSummary, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
|
package/dist/index.d.ts
CHANGED
|
@@ -822,7 +822,7 @@ interface ClarificationOption {
|
|
|
822
822
|
label: string;
|
|
823
823
|
description?: string;
|
|
824
824
|
}
|
|
825
|
-
type ChatEventType = 'phase' | 'question' | 'plan_draft' | 'step_started' | 'step_completed' | 'step_failed' | 'step_progress' | 'narration' | 'assistant_message' | 'done' | 'session_title' | 'tool_call_started' | 'tool_call_finished' | 'llm_call_finished' | 'tool_call_confirmation_required';
|
|
825
|
+
type ChatEventType = 'phase' | 'question' | 'plan_draft' | 'step_started' | 'step_completed' | 'step_failed' | 'step_progress' | 'narration' | 'assistant_message' | 'done' | 'session_title' | 'tool_call_started' | 'tool_call_finished' | 'llm_call_finished' | 'tool_call_confirmation_required' | 'chat_compaction_fired' | 'chat_checkpointed';
|
|
826
826
|
type ChatPhase = 'classifying' | 'clarifying' | 'executing' | 'answering' | 'done';
|
|
827
827
|
interface ChatPhasePayload {
|
|
828
828
|
phase: ChatPhase;
|
|
@@ -957,13 +957,38 @@ interface ChatDonePayload {
|
|
|
957
957
|
interface ChatSessionTitlePayload {
|
|
958
958
|
title: string;
|
|
959
959
|
}
|
|
960
|
+
/**
|
|
961
|
+
* Sent with `chat_compaction_fired` once per Run when the chat-loop
|
|
962
|
+
* mid-session replaces older history with a structured progress note
|
|
963
|
+
* (chat-compact-optimization Front #1). The session-debug view uses
|
|
964
|
+
* this to mark the boundary in the rendered transcript so operators
|
|
965
|
+
* can see how aggressively the loop is trimming context.
|
|
966
|
+
*/
|
|
967
|
+
interface ChatCompactionFiredPayload {
|
|
968
|
+
turn_index: number;
|
|
969
|
+
prompt_tokens_before: number;
|
|
970
|
+
compactor_model: string;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Sent with `chat_checkpointed` when the chat-loop, on its final
|
|
974
|
+
* allowed iteration, emits a structured terminal summary instead of
|
|
975
|
+
* running another open-ended LLM call (chat-compact-optimization Front
|
|
976
|
+
* #2). The accompanying assistant message is the checkpoint body; the
|
|
977
|
+
* dashboard should render the session's StopReason
|
|
978
|
+
* ("max_turns_checkpointed") with a distinct chip and offer a "Continue
|
|
979
|
+
* this work" affordance that POSTs a canned follow-up.
|
|
980
|
+
*/
|
|
981
|
+
interface ChatCheckpointedPayload {
|
|
982
|
+
turn_index: number;
|
|
983
|
+
checkpoint_model: string;
|
|
984
|
+
}
|
|
960
985
|
interface ChatEvent {
|
|
961
986
|
conversation_id: string;
|
|
962
987
|
turn_id: string;
|
|
963
988
|
type: ChatEventType;
|
|
964
989
|
plan_id?: string;
|
|
965
990
|
step_id?: string;
|
|
966
|
-
payload?: ChatPhasePayload | ChatQuestionPayload | ChatPlanDraftPayload | ChatStepEventPayload | ChatStepProgressPayload | ChatNarrationPayload | ChatAssistantMessagePayload | ChatDonePayload | ChatSessionTitlePayload | ChatToolCallStartedPayload | ChatToolCallFinishedPayload | ChatLLMCallFinishedPayload | ChatToolCallConfirmationRequiredPayload | unknown;
|
|
991
|
+
payload?: ChatPhasePayload | ChatQuestionPayload | ChatPlanDraftPayload | ChatStepEventPayload | ChatStepProgressPayload | ChatNarrationPayload | ChatAssistantMessagePayload | ChatDonePayload | ChatSessionTitlePayload | ChatToolCallStartedPayload | ChatToolCallFinishedPayload | ChatLLMCallFinishedPayload | ChatToolCallConfirmationRequiredPayload | ChatCompactionFiredPayload | ChatCheckpointedPayload | unknown;
|
|
967
992
|
timestamp: string;
|
|
968
993
|
event_id?: number;
|
|
969
994
|
}
|
|
@@ -1636,6 +1661,37 @@ interface MonthlyCreditStats {
|
|
|
1636
1661
|
grantsCents: number;
|
|
1637
1662
|
balanceCents: number;
|
|
1638
1663
|
}
|
|
1664
|
+
/**
|
|
1665
|
+
* "Other amount" PAYG purchase config, served by
|
|
1666
|
+
* GET /credits/packs/custom-config. Disabled =>
|
|
1667
|
+
* `{ enabled: false, minCents: 0, maxCents: 0, presetCents: [] }` so
|
|
1668
|
+
* the frontend can hide the tile cleanly without nil checks.
|
|
1669
|
+
*/
|
|
1670
|
+
interface CustomCreditPurchaseConfig {
|
|
1671
|
+
enabled: boolean;
|
|
1672
|
+
minCents: number;
|
|
1673
|
+
maxCents: number;
|
|
1674
|
+
/** Suggested one-click amounts (in cents) for the "Other" tile. */
|
|
1675
|
+
presetCents: number[];
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Body for POST /credits/packs/buy-custom. `amountCents` is the
|
|
1679
|
+
* arbitrary dollar amount the user typed, converted to USD-cents
|
|
1680
|
+
* before the API call. Server enforces `min <= amount <= max`.
|
|
1681
|
+
* Credit ratio is 1:1 (pay $X, get $X of credits in the permanent
|
|
1682
|
+
* bucket).
|
|
1683
|
+
*/
|
|
1684
|
+
interface BuyCustomCreditRequest {
|
|
1685
|
+
amountCents: number;
|
|
1686
|
+
}
|
|
1687
|
+
/** Response from POST /credits/packs/buy-custom. Mirrors the fixed-pack response. */
|
|
1688
|
+
interface BuyCustomCreditResponse {
|
|
1689
|
+
success: boolean;
|
|
1690
|
+
checkoutUrl?: string;
|
|
1691
|
+
sessionId?: string;
|
|
1692
|
+
error_code?: string;
|
|
1693
|
+
message?: string;
|
|
1694
|
+
}
|
|
1639
1695
|
/**
|
|
1640
1696
|
* Refusal reasons from POST /v1/agent/chat/sessions/:id/messages when
|
|
1641
1697
|
* the billing preflight rejects a turn (HTTP 402). Frontend maps these
|
|
@@ -1674,6 +1730,20 @@ declare class CreditsClient {
|
|
|
1674
1730
|
listTransactions(query?: ListCreditsTransactionsQuery): Promise<ListCreditsTransactionsResponse>;
|
|
1675
1731
|
/** Backend currently returns 501. Surfaced for forward-compat. */
|
|
1676
1732
|
getMonthlyStats(): Promise<MonthlyCreditStats[]>;
|
|
1733
|
+
/**
|
|
1734
|
+
* "Other amount" PAYG config — bounds + presets for the
|
|
1735
|
+
* arbitrary-dollar tile. Public endpoint; returns a disabled
|
|
1736
|
+
* shape (`enabled: false`) when the feature is off so the
|
|
1737
|
+
* frontend can hide the tile without throwing.
|
|
1738
|
+
*/
|
|
1739
|
+
getCustomConfig(): Promise<CustomCreditPurchaseConfig>;
|
|
1740
|
+
/**
|
|
1741
|
+
* Buy an arbitrary-dollar PAYG amount. The Stripe Checkout
|
|
1742
|
+
* session is built with `price_data` inline (no pre-created
|
|
1743
|
+
* Price), so the catalog has nothing to provision for this — it
|
|
1744
|
+
* is purely a per-purchase flow.
|
|
1745
|
+
*/
|
|
1746
|
+
buyCustom(body: BuyCustomCreditRequest): Promise<BuyCustomCreditResponse>;
|
|
1677
1747
|
}
|
|
1678
1748
|
|
|
1679
1749
|
interface UsageWindow {
|
|
@@ -1950,4 +2020,4 @@ declare class NotImplementedError extends Error {
|
|
|
1950
2020
|
constructor(method: string);
|
|
1951
2021
|
}
|
|
1952
2022
|
|
|
1953
|
-
export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AuthUser, BaseClient, type BaseClientOptions, type BudgetScope, BudgetsClient, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_STORAGE, CAP_VCS, type CancelChatTurnResponse, type CancelSubscriptionResponse, type ChatAssistantMessagePayload, type ChatBillingRefuseCode, type ChatBillingRefuseError, type ChatBudget, type ChatDonePayload, type ChatEvent, type ChatEventType, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ClarificationOption, CloudAgentClient, type CloudAgentClientOptions, type CloudResource, type CloudResourceContainerRef, type CloudResourceEdge, type CloudScanHistory, type CloudScanLease, type ConfirmChatToolCallRequest, type ConfirmChatToolCallResponse, type CreateAgentTemplateRequest, type CreateChatScheduleRequest, type CreateChatSessionRequest, type CreateChatSessionResponse, type CreateCredentialRequest, type CreateGatewayTokenRequest, type CreateGatewayTokenResponse, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditTransaction, type CreditTransactionKind, type CreditTransactionType, type DebugPayload, type DebugReceipt, type EffectiveChatBudget, type ExchangeCodeRequest, type FieldSpec, type FieldType, type FineTuneParams, type GatewayToken, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatScheduleRunsResponse, type ListChatSchedulesResponse, type ListChatSessionsQuery, type ListChatSessionsResponse, type ListCredentialsQuery, type ListCreditsTransactionsQuery, type ListCreditsTransactionsResponse, type ListPaymentsResponse, type ListSandboxesQuery, type ListScanHistoryQuery, type ListScanHistoryResponse, type ListScheduledTasksQuery, type ListScheduledTasksResponse, type LoginRequest, type MFASetupResponse, type MFASimpleResponse, type MFAStatus, MFAType, type MFAVerifyLoginRequest, type MFAVerifyLoginResponse, type MFAVerifySetupRequest, type MagicLinkActivateRequest, type MagicLinkSendResponse, type ModeType, type MonthlyCreditStats, NotImplementedError, type OpenChatStreamOptions, type OrgBudget, OrgRoles, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type Query, type ReconcileScope, type ReconcileTuple, type RefreshRequest, type RegisterRequest, type RequestOptions, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type Subscription, type SubscriptionCapability, type SubscriptionPeriod, type SystemEvent, type SystemEventQuery, type SystemEventQueryResponse, type SystemEventReadResponse, type Template, type TokenProvider, type UnauthorizedHandler, type UpdateChatBudgetRequest, type UpdateChatScheduleRequest, type UpdateCostLimitRequest, type UpdateCredentialRequest, type UpdateMemberRoleRequest, type UpdateOrgBudgetRequest, type UpdateOrgUserRequest, type UpdateOrganizationRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageReportQuery, type UsageReportResponse, type UsageSummary, type UsageSummaryQuery, type UsageSummaryResponse, type UsageTotals, type UsageWindow, type UserProfile, type UserSummary, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
|
|
2023
|
+
export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AuthUser, BaseClient, type BaseClientOptions, type BudgetScope, BudgetsClient, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_STORAGE, CAP_VCS, type CancelChatTurnResponse, type CancelSubscriptionResponse, type ChatAssistantMessagePayload, type ChatBillingRefuseCode, type ChatBillingRefuseError, type ChatBudget, type ChatCheckpointedPayload, type ChatCompactionFiredPayload, type ChatDonePayload, type ChatEvent, type ChatEventType, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ClarificationOption, CloudAgentClient, type CloudAgentClientOptions, type CloudResource, type CloudResourceContainerRef, type CloudResourceEdge, type CloudScanHistory, type CloudScanLease, type ConfirmChatToolCallRequest, type ConfirmChatToolCallResponse, type CreateAgentTemplateRequest, type CreateChatScheduleRequest, type CreateChatSessionRequest, type CreateChatSessionResponse, type CreateCredentialRequest, type CreateGatewayTokenRequest, type CreateGatewayTokenResponse, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditTransaction, type CreditTransactionKind, type CreditTransactionType, type CustomCreditPurchaseConfig, type DebugPayload, type DebugReceipt, type EffectiveChatBudget, type ExchangeCodeRequest, type FieldSpec, type FieldType, type FineTuneParams, type GatewayToken, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatScheduleRunsResponse, type ListChatSchedulesResponse, type ListChatSessionsQuery, type ListChatSessionsResponse, type ListCredentialsQuery, type ListCreditsTransactionsQuery, type ListCreditsTransactionsResponse, type ListPaymentsResponse, type ListSandboxesQuery, type ListScanHistoryQuery, type ListScanHistoryResponse, type ListScheduledTasksQuery, type ListScheduledTasksResponse, type LoginRequest, type MFASetupResponse, type MFASimpleResponse, type MFAStatus, MFAType, type MFAVerifyLoginRequest, type MFAVerifyLoginResponse, type MFAVerifySetupRequest, type MagicLinkActivateRequest, type MagicLinkSendResponse, type ModeType, type MonthlyCreditStats, NotImplementedError, type OpenChatStreamOptions, type OrgBudget, OrgRoles, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type Query, type ReconcileScope, type ReconcileTuple, type RefreshRequest, type RegisterRequest, type RequestOptions, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type Subscription, type SubscriptionCapability, type SubscriptionPeriod, type SystemEvent, type SystemEventQuery, type SystemEventQueryResponse, type SystemEventReadResponse, type Template, type TokenProvider, type UnauthorizedHandler, type UpdateChatBudgetRequest, type UpdateChatScheduleRequest, type UpdateCostLimitRequest, type UpdateCredentialRequest, type UpdateMemberRoleRequest, type UpdateOrgBudgetRequest, type UpdateOrgUserRequest, type UpdateOrganizationRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageReportQuery, type UsageReportResponse, type UsageSummary, type UsageSummaryQuery, type UsageSummaryResponse, type UsageTotals, type UsageWindow, type UserProfile, type UserSummary, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
|
package/dist/index.js
CHANGED
|
@@ -964,6 +964,25 @@ var CreditsClient = class {
|
|
|
964
964
|
const res = await this.http.get("/credits/stats/monthly");
|
|
965
965
|
return res.data ?? [];
|
|
966
966
|
}
|
|
967
|
+
/**
|
|
968
|
+
* "Other amount" PAYG config — bounds + presets for the
|
|
969
|
+
* arbitrary-dollar tile. Public endpoint; returns a disabled
|
|
970
|
+
* shape (`enabled: false`) when the feature is off so the
|
|
971
|
+
* frontend can hide the tile without throwing.
|
|
972
|
+
*/
|
|
973
|
+
async getCustomConfig() {
|
|
974
|
+
const res = await this.http.get("/credits/packs/custom-config");
|
|
975
|
+
return unwrapData(res);
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Buy an arbitrary-dollar PAYG amount. The Stripe Checkout
|
|
979
|
+
* session is built with `price_data` inline (no pre-created
|
|
980
|
+
* Price), so the catalog has nothing to provision for this — it
|
|
981
|
+
* is purely a per-purchase flow.
|
|
982
|
+
*/
|
|
983
|
+
buyCustom(body) {
|
|
984
|
+
return this.http.post("/credits/packs/buy-custom", { body });
|
|
985
|
+
}
|
|
967
986
|
};
|
|
968
987
|
|
|
969
988
|
// src/modules/usage/UsageClient.ts
|