@flashbacktech/tsclient 0.4.63 → 0.4.65

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.d.cts CHANGED
@@ -426,6 +426,30 @@ interface InviteOrgResult {
426
426
  organization: Organization;
427
427
  owner: OrganizationUser;
428
428
  }
429
+ /**
430
+ * One outstanding org or member invite, as surfaced by the platform-admin
431
+ * invite-management list (GET /admin/org-invites). Reconstructed server-side
432
+ * from the latest ORG_INVITE token joined to the invited user + org — there is
433
+ * no dedicated invite table. `status` is derived: a validated user has
434
+ * `redeemed`; otherwise `pending` until `expiresAt`, then `expired`.
435
+ */
436
+ interface OrgInvite {
437
+ userId: string;
438
+ email: string;
439
+ name: string;
440
+ lastName?: string;
441
+ orgId: string;
442
+ orgName: string;
443
+ /** Org role integer of the invitee (255 = Owner for founding-owner invites). */
444
+ orgRole?: number | null;
445
+ status: 'pending' | 'redeemed' | 'expired';
446
+ /** Token mint time, ISO-8601. Treated as "invited at". */
447
+ invitedAt: string;
448
+ /** Invite link expiry, ISO-8601. */
449
+ expiresAt: string;
450
+ /** When the invite was consumed, ISO-8601, or null while unredeemed. */
451
+ redeemedAt?: string | null;
452
+ }
429
453
  interface SimpleOrgResponse {
430
454
  success: boolean;
431
455
  message?: string;
@@ -533,6 +557,26 @@ declare class OrganizationClient {
533
557
  * ADMIN_ORGANIZATION; 409 when the owner email already exists.
534
558
  */
535
559
  inviteOrg(body: InviteOrgRequest): Promise<InviteOrgResult>;
560
+ /**
561
+ * Platform-admin only: list every outstanding org + member invite (founding-
562
+ * owner invites from `inviteOrg` and members added via `addUserToOrg`) with
563
+ * derived status, newest first. Cancelled invites (soft-deleted) and live
564
+ * non-invited orgs are excluded. Returns 403 unless platform admin.
565
+ */
566
+ listOrgInvites(): Promise<OrgInvite[]>;
567
+ /**
568
+ * Platform-admin only: re-send an invite — mints a fresh 7-day token and
569
+ * re-emails the link. Returns 403 unless platform admin; 404 when no pending
570
+ * invite exists; 409 once the invite has been redeemed.
571
+ */
572
+ resendOrgInvite(userId: string): Promise<SimpleOrgResponse>;
573
+ /**
574
+ * Platform-admin only: cancel a pending invite. Soft-deletes the invited user
575
+ * (and the shell org, for a never-redeemed founding-owner invite with no other
576
+ * members) and revokes the token, freeing the email for re-invite. Returns 403
577
+ * unless platform admin; 404 when absent; 409 once the invite has been redeemed.
578
+ */
579
+ cancelOrgInvite(userId: string): Promise<SimpleOrgResponse>;
536
580
  /**
537
581
  * Platform-admin only: enable or disable the debug surface for an org.
538
582
  * Returns the updated org entry with the new allowDebug value.
@@ -2615,6 +2659,73 @@ declare class ResellerClient {
2615
2659
  updatePayout(payoutId: string, body: UpdatePayoutRequest): Promise<ResellerPayout>;
2616
2660
  }
2617
2661
 
2662
+ /** Global settings managed by a platform admin (backend PlatformSettings row). */
2663
+ interface PlatformSettings {
2664
+ openRegistration: boolean;
2665
+ freeTierCreditsOrgMicros: number;
2666
+ freeTierCreditsIndividualMicros: number;
2667
+ updatedAt: string;
2668
+ updatedBy?: string | null;
2669
+ }
2670
+ /** Body for PUT /admin/platform-settings. */
2671
+ interface UpdatePlatformSettingsRequest {
2672
+ openRegistration: boolean;
2673
+ freeTierCreditsOrgMicros: number;
2674
+ freeTierCreditsIndividualMicros: number;
2675
+ }
2676
+ /**
2677
+ * Chat-model selection: the ordered provider priority plus the per-provider,
2678
+ * per-role model id map. Mirrors the agent's chat_models.json shape.
2679
+ * Roles: CHAT_LOOP_MODEL | SUMMARY_MODEL | SAFETY_CLASSIFIER_MODEL.
2680
+ * Providers: OPENAI | ANTHROPIC | GEMINI | BEDROCK.
2681
+ */
2682
+ interface ModelSelection {
2683
+ priority: string[];
2684
+ modelsByProvider: Record<string, Record<string, string>>;
2685
+ }
2686
+ /** Body for PATCH /admin/model-selection — upsert a single slot. */
2687
+ interface PatchModelSelectionRequest {
2688
+ provider: string;
2689
+ role: string;
2690
+ modelId: string;
2691
+ }
2692
+ /** One row of the agent's model_pricing table (USD micros per 1M tokens). */
2693
+ interface ModelPricingRow {
2694
+ model: string;
2695
+ input_usd_micros_per_million: number;
2696
+ output_usd_micros_per_million: number;
2697
+ cached_input_discount_bps: number;
2698
+ counts_toward_budget: boolean;
2699
+ /** Platform-key markup in bps; 10000 = 1.00x (no markup). */
2700
+ surcharge_coefficient_bps: number;
2701
+ notes?: string;
2702
+ updated_at?: string;
2703
+ }
2704
+
2705
+ /**
2706
+ * Platform-admin global config. All endpoints are gated server-side on the
2707
+ * caller's home org being a platform-admin org. The model-selection / pricing
2708
+ * methods are proxied through the backend to the cloud-agent service.
2709
+ */
2710
+ declare class PlatformAdminClient {
2711
+ private readonly http;
2712
+ constructor(http: BaseClient);
2713
+ /** Current global settings. */
2714
+ getPlatformSettings(): Promise<PlatformSettings>;
2715
+ /** Update the global settings. */
2716
+ updatePlatformSettings(body: UpdatePlatformSettingsRequest): Promise<PlatformSettings>;
2717
+ /** Current model selection (provider priority + per-provider/role models). */
2718
+ getModelSelection(): Promise<ModelSelection>;
2719
+ /** Full replace of the model selection. Returns the fresh selection. */
2720
+ putModelSelection(body: ModelSelection): Promise<ModelSelection>;
2721
+ /** Upsert a single (provider, role) → model slot. Returns the fresh selection. */
2722
+ patchModelSelection(body: PatchModelSelectionRequest): Promise<ModelSelection>;
2723
+ /** All model_pricing rows. */
2724
+ listModelPricing(): Promise<ModelPricingRow[]>;
2725
+ /** Upsert one model_pricing row. Returns the fresh list. */
2726
+ putModelPricing(row: ModelPricingRow): Promise<ModelPricingRow[]>;
2727
+ }
2728
+
2618
2729
  type CloudAgentClientOptions = BaseClientOptions;
2619
2730
  declare class AgentEngineFacade {
2620
2731
  readonly templates: TemplatesClient;
@@ -2644,6 +2755,7 @@ declare class CloudAgentClient {
2644
2755
  readonly budgets: BudgetsClient;
2645
2756
  readonly referrals: ReferralsClient;
2646
2757
  readonly reseller: ResellerClient;
2758
+ readonly platformAdmin: PlatformAdminClient;
2647
2759
  constructor(options: CloudAgentClientOptions);
2648
2760
  }
2649
2761
 
@@ -2658,4 +2770,4 @@ declare class NotImplementedError extends Error {
2658
2770
  constructor(method: string);
2659
2771
  }
2660
2772
 
2661
- export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AddUserToOrgRequest, type AddUserToOrgResult, type AdjustOrgCreditsRequest, type AdjustOrgCreditsResult, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AppendProgramConfigRequest, type AssociatedOrg, type AuthUser, BaseClient, type BaseClientOptions, type BillingProgramConfig, type BudgetScope, BudgetsClient, type BuyCreditPackRequest, type BuyCreditPackResponse, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, 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 ChatFeedback, type ChatFeedbackEnvelope, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleNotifyOn, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ChatTurnStatus, 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 CreateOrganizationRequest, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditPack, 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 GeneratePayoutsRequest, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type InviteOrgRequest, type InviteOrgResult, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatFeedbackResponse, 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 MintReferralCodeRequest, type ModeType, type MonthlyCreditStats, NotImplementedError, type NotifyChannelOption, type NotifyEventType, type NotifySubscription, type OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, type OrgNotifySubscriptions, type OrgRef, OrgRoles, type OrgSearchResult, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type PreviewChangeRequest, type PreviewChangeResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type PublicConfig, type Query, type ReconcileScope, type ReconcileTuple, type RedeemReferralCodeRequest, type ReferralAdminOverview, type ReferralAdminStats, type ReferralCode, type ReferralRedemption, type ReferralRedemptionAdmin, type ReferralStats, ReferralsClient, type RefreshRequest, type RegisterRequest, type RequestOptions, ResellerClient, type ResellerCommission, type ResellerPayout, type ResellerPerformance, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledChange, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SetOrgNotifySubscriptionsRequest, type SetResellerRequest, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type SubmitChatFeedbackRequest, 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 UpdatePayoutRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageCostSplit, 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 };
2773
+ export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AddUserToOrgRequest, type AddUserToOrgResult, type AdjustOrgCreditsRequest, type AdjustOrgCreditsResult, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AppendProgramConfigRequest, type AssociatedOrg, type AuthUser, BaseClient, type BaseClientOptions, type BillingProgramConfig, type BudgetScope, BudgetsClient, type BuyCreditPackRequest, type BuyCreditPackResponse, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, 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 ChatFeedback, type ChatFeedbackEnvelope, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleNotifyOn, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ChatTurnStatus, 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 CreateOrganizationRequest, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditPack, 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 GeneratePayoutsRequest, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type InviteOrgRequest, type InviteOrgResult, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatFeedbackResponse, 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 MintReferralCodeRequest, type ModeType, type ModelPricingRow, type ModelSelection, type MonthlyCreditStats, NotImplementedError, type NotifyChannelOption, type NotifyEventType, type NotifySubscription, type OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, type OrgInvite, type OrgNotifySubscriptions, type OrgRef, OrgRoles, type OrgSearchResult, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type PatchModelSelectionRequest, type Payment, type PeekScanLeaseResponse, PlatformAdminClient, type PlatformSettings, type PostChatMessageRequest, type PostChatMessageResponse, type PreviewChangeRequest, type PreviewChangeResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type PublicConfig, type Query, type ReconcileScope, type ReconcileTuple, type RedeemReferralCodeRequest, type ReferralAdminOverview, type ReferralAdminStats, type ReferralCode, type ReferralRedemption, type ReferralRedemptionAdmin, type ReferralStats, ReferralsClient, type RefreshRequest, type RegisterRequest, type RequestOptions, ResellerClient, type ResellerCommission, type ResellerPayout, type ResellerPerformance, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledChange, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SetOrgNotifySubscriptionsRequest, type SetResellerRequest, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type SubmitChatFeedbackRequest, 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 UpdatePayoutRequest, type UpdatePlatformSettingsRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageCostSplit, 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
@@ -426,6 +426,30 @@ interface InviteOrgResult {
426
426
  organization: Organization;
427
427
  owner: OrganizationUser;
428
428
  }
429
+ /**
430
+ * One outstanding org or member invite, as surfaced by the platform-admin
431
+ * invite-management list (GET /admin/org-invites). Reconstructed server-side
432
+ * from the latest ORG_INVITE token joined to the invited user + org — there is
433
+ * no dedicated invite table. `status` is derived: a validated user has
434
+ * `redeemed`; otherwise `pending` until `expiresAt`, then `expired`.
435
+ */
436
+ interface OrgInvite {
437
+ userId: string;
438
+ email: string;
439
+ name: string;
440
+ lastName?: string;
441
+ orgId: string;
442
+ orgName: string;
443
+ /** Org role integer of the invitee (255 = Owner for founding-owner invites). */
444
+ orgRole?: number | null;
445
+ status: 'pending' | 'redeemed' | 'expired';
446
+ /** Token mint time, ISO-8601. Treated as "invited at". */
447
+ invitedAt: string;
448
+ /** Invite link expiry, ISO-8601. */
449
+ expiresAt: string;
450
+ /** When the invite was consumed, ISO-8601, or null while unredeemed. */
451
+ redeemedAt?: string | null;
452
+ }
429
453
  interface SimpleOrgResponse {
430
454
  success: boolean;
431
455
  message?: string;
@@ -533,6 +557,26 @@ declare class OrganizationClient {
533
557
  * ADMIN_ORGANIZATION; 409 when the owner email already exists.
534
558
  */
535
559
  inviteOrg(body: InviteOrgRequest): Promise<InviteOrgResult>;
560
+ /**
561
+ * Platform-admin only: list every outstanding org + member invite (founding-
562
+ * owner invites from `inviteOrg` and members added via `addUserToOrg`) with
563
+ * derived status, newest first. Cancelled invites (soft-deleted) and live
564
+ * non-invited orgs are excluded. Returns 403 unless platform admin.
565
+ */
566
+ listOrgInvites(): Promise<OrgInvite[]>;
567
+ /**
568
+ * Platform-admin only: re-send an invite — mints a fresh 7-day token and
569
+ * re-emails the link. Returns 403 unless platform admin; 404 when no pending
570
+ * invite exists; 409 once the invite has been redeemed.
571
+ */
572
+ resendOrgInvite(userId: string): Promise<SimpleOrgResponse>;
573
+ /**
574
+ * Platform-admin only: cancel a pending invite. Soft-deletes the invited user
575
+ * (and the shell org, for a never-redeemed founding-owner invite with no other
576
+ * members) and revokes the token, freeing the email for re-invite. Returns 403
577
+ * unless platform admin; 404 when absent; 409 once the invite has been redeemed.
578
+ */
579
+ cancelOrgInvite(userId: string): Promise<SimpleOrgResponse>;
536
580
  /**
537
581
  * Platform-admin only: enable or disable the debug surface for an org.
538
582
  * Returns the updated org entry with the new allowDebug value.
@@ -2615,6 +2659,73 @@ declare class ResellerClient {
2615
2659
  updatePayout(payoutId: string, body: UpdatePayoutRequest): Promise<ResellerPayout>;
2616
2660
  }
2617
2661
 
2662
+ /** Global settings managed by a platform admin (backend PlatformSettings row). */
2663
+ interface PlatformSettings {
2664
+ openRegistration: boolean;
2665
+ freeTierCreditsOrgMicros: number;
2666
+ freeTierCreditsIndividualMicros: number;
2667
+ updatedAt: string;
2668
+ updatedBy?: string | null;
2669
+ }
2670
+ /** Body for PUT /admin/platform-settings. */
2671
+ interface UpdatePlatformSettingsRequest {
2672
+ openRegistration: boolean;
2673
+ freeTierCreditsOrgMicros: number;
2674
+ freeTierCreditsIndividualMicros: number;
2675
+ }
2676
+ /**
2677
+ * Chat-model selection: the ordered provider priority plus the per-provider,
2678
+ * per-role model id map. Mirrors the agent's chat_models.json shape.
2679
+ * Roles: CHAT_LOOP_MODEL | SUMMARY_MODEL | SAFETY_CLASSIFIER_MODEL.
2680
+ * Providers: OPENAI | ANTHROPIC | GEMINI | BEDROCK.
2681
+ */
2682
+ interface ModelSelection {
2683
+ priority: string[];
2684
+ modelsByProvider: Record<string, Record<string, string>>;
2685
+ }
2686
+ /** Body for PATCH /admin/model-selection — upsert a single slot. */
2687
+ interface PatchModelSelectionRequest {
2688
+ provider: string;
2689
+ role: string;
2690
+ modelId: string;
2691
+ }
2692
+ /** One row of the agent's model_pricing table (USD micros per 1M tokens). */
2693
+ interface ModelPricingRow {
2694
+ model: string;
2695
+ input_usd_micros_per_million: number;
2696
+ output_usd_micros_per_million: number;
2697
+ cached_input_discount_bps: number;
2698
+ counts_toward_budget: boolean;
2699
+ /** Platform-key markup in bps; 10000 = 1.00x (no markup). */
2700
+ surcharge_coefficient_bps: number;
2701
+ notes?: string;
2702
+ updated_at?: string;
2703
+ }
2704
+
2705
+ /**
2706
+ * Platform-admin global config. All endpoints are gated server-side on the
2707
+ * caller's home org being a platform-admin org. The model-selection / pricing
2708
+ * methods are proxied through the backend to the cloud-agent service.
2709
+ */
2710
+ declare class PlatformAdminClient {
2711
+ private readonly http;
2712
+ constructor(http: BaseClient);
2713
+ /** Current global settings. */
2714
+ getPlatformSettings(): Promise<PlatformSettings>;
2715
+ /** Update the global settings. */
2716
+ updatePlatformSettings(body: UpdatePlatformSettingsRequest): Promise<PlatformSettings>;
2717
+ /** Current model selection (provider priority + per-provider/role models). */
2718
+ getModelSelection(): Promise<ModelSelection>;
2719
+ /** Full replace of the model selection. Returns the fresh selection. */
2720
+ putModelSelection(body: ModelSelection): Promise<ModelSelection>;
2721
+ /** Upsert a single (provider, role) → model slot. Returns the fresh selection. */
2722
+ patchModelSelection(body: PatchModelSelectionRequest): Promise<ModelSelection>;
2723
+ /** All model_pricing rows. */
2724
+ listModelPricing(): Promise<ModelPricingRow[]>;
2725
+ /** Upsert one model_pricing row. Returns the fresh list. */
2726
+ putModelPricing(row: ModelPricingRow): Promise<ModelPricingRow[]>;
2727
+ }
2728
+
2618
2729
  type CloudAgentClientOptions = BaseClientOptions;
2619
2730
  declare class AgentEngineFacade {
2620
2731
  readonly templates: TemplatesClient;
@@ -2644,6 +2755,7 @@ declare class CloudAgentClient {
2644
2755
  readonly budgets: BudgetsClient;
2645
2756
  readonly referrals: ReferralsClient;
2646
2757
  readonly reseller: ResellerClient;
2758
+ readonly platformAdmin: PlatformAdminClient;
2647
2759
  constructor(options: CloudAgentClientOptions);
2648
2760
  }
2649
2761
 
@@ -2658,4 +2770,4 @@ declare class NotImplementedError extends Error {
2658
2770
  constructor(method: string);
2659
2771
  }
2660
2772
 
2661
- export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AddUserToOrgRequest, type AddUserToOrgResult, type AdjustOrgCreditsRequest, type AdjustOrgCreditsResult, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AppendProgramConfigRequest, type AssociatedOrg, type AuthUser, BaseClient, type BaseClientOptions, type BillingProgramConfig, type BudgetScope, BudgetsClient, type BuyCreditPackRequest, type BuyCreditPackResponse, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, 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 ChatFeedback, type ChatFeedbackEnvelope, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleNotifyOn, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ChatTurnStatus, 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 CreateOrganizationRequest, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditPack, 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 GeneratePayoutsRequest, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type InviteOrgRequest, type InviteOrgResult, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatFeedbackResponse, 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 MintReferralCodeRequest, type ModeType, type MonthlyCreditStats, NotImplementedError, type NotifyChannelOption, type NotifyEventType, type NotifySubscription, type OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, type OrgNotifySubscriptions, type OrgRef, OrgRoles, type OrgSearchResult, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type PreviewChangeRequest, type PreviewChangeResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type PublicConfig, type Query, type ReconcileScope, type ReconcileTuple, type RedeemReferralCodeRequest, type ReferralAdminOverview, type ReferralAdminStats, type ReferralCode, type ReferralRedemption, type ReferralRedemptionAdmin, type ReferralStats, ReferralsClient, type RefreshRequest, type RegisterRequest, type RequestOptions, ResellerClient, type ResellerCommission, type ResellerPayout, type ResellerPerformance, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledChange, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SetOrgNotifySubscriptionsRequest, type SetResellerRequest, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type SubmitChatFeedbackRequest, 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 UpdatePayoutRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageCostSplit, 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 };
2773
+ export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AddUserToOrgRequest, type AddUserToOrgResult, type AdjustOrgCreditsRequest, type AdjustOrgCreditsResult, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AppendProgramConfigRequest, type AssociatedOrg, type AuthUser, BaseClient, type BaseClientOptions, type BillingProgramConfig, type BudgetScope, BudgetsClient, type BuyCreditPackRequest, type BuyCreditPackResponse, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, 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 ChatFeedback, type ChatFeedbackEnvelope, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleNotifyOn, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ChatTurnStatus, 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 CreateOrganizationRequest, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditPack, 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 GeneratePayoutsRequest, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type InviteOrgRequest, type InviteOrgResult, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatFeedbackResponse, 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 MintReferralCodeRequest, type ModeType, type ModelPricingRow, type ModelSelection, type MonthlyCreditStats, NotImplementedError, type NotifyChannelOption, type NotifyEventType, type NotifySubscription, type OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, type OrgInvite, type OrgNotifySubscriptions, type OrgRef, OrgRoles, type OrgSearchResult, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type PatchModelSelectionRequest, type Payment, type PeekScanLeaseResponse, PlatformAdminClient, type PlatformSettings, type PostChatMessageRequest, type PostChatMessageResponse, type PreviewChangeRequest, type PreviewChangeResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type PublicConfig, type Query, type ReconcileScope, type ReconcileTuple, type RedeemReferralCodeRequest, type ReferralAdminOverview, type ReferralAdminStats, type ReferralCode, type ReferralRedemption, type ReferralRedemptionAdmin, type ReferralStats, ReferralsClient, type RefreshRequest, type RegisterRequest, type RequestOptions, ResellerClient, type ResellerCommission, type ResellerPayout, type ResellerPerformance, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledChange, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SetOrgNotifySubscriptionsRequest, type SetResellerRequest, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type SubmitChatFeedbackRequest, 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 UpdatePayoutRequest, type UpdatePlatformSettingsRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageCostSplit, 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
@@ -333,6 +333,33 @@ var OrganizationClient = class {
333
333
  );
334
334
  return unwrapData(res);
335
335
  }
336
+ /**
337
+ * Platform-admin only: list every outstanding org + member invite (founding-
338
+ * owner invites from `inviteOrg` and members added via `addUserToOrg`) with
339
+ * derived status, newest first. Cancelled invites (soft-deleted) and live
340
+ * non-invited orgs are excluded. Returns 403 unless platform admin.
341
+ */
342
+ async listOrgInvites() {
343
+ const res = await this.http.get("/admin/org-invites");
344
+ return res.data ?? [];
345
+ }
346
+ /**
347
+ * Platform-admin only: re-send an invite — mints a fresh 7-day token and
348
+ * re-emails the link. Returns 403 unless platform admin; 404 when no pending
349
+ * invite exists; 409 once the invite has been redeemed.
350
+ */
351
+ resendOrgInvite(userId) {
352
+ return this.http.post(`/admin/org-invites/${userId}/resend`, {});
353
+ }
354
+ /**
355
+ * Platform-admin only: cancel a pending invite. Soft-deletes the invited user
356
+ * (and the shell org, for a never-redeemed founding-owner invite with no other
357
+ * members) and revokes the token, freeing the email for re-invite. Returns 403
358
+ * unless platform admin; 404 when absent; 409 once the invite has been redeemed.
359
+ */
360
+ cancelOrgInvite(userId) {
361
+ return this.http.post(`/admin/org-invites/${userId}/cancel`, {});
362
+ }
336
363
  /**
337
364
  * Platform-admin only: enable or disable the debug surface for an org.
338
365
  * Returns the updated org entry with the new allowDebug value.
@@ -1424,6 +1451,60 @@ var ResellerClient = class {
1424
1451
  }
1425
1452
  };
1426
1453
 
1454
+ // src/modules/platformAdmin/PlatformAdminClient.ts
1455
+ var PlatformAdminClient = class {
1456
+ constructor(http) {
1457
+ this.http = http;
1458
+ }
1459
+ // --- Global backend settings (open registration + free-tier credits) ---
1460
+ /** Current global settings. */
1461
+ async getPlatformSettings() {
1462
+ const res = await this.http.get("/admin/platform-settings");
1463
+ return unwrapData(res);
1464
+ }
1465
+ /** Update the global settings. */
1466
+ async updatePlatformSettings(body) {
1467
+ const res = await this.http.put("/admin/platform-settings", {
1468
+ body
1469
+ });
1470
+ return unwrapData(res);
1471
+ }
1472
+ // --- Chat-model selection (bridged to cloud-agent) ---
1473
+ /** Current model selection (provider priority + per-provider/role models). */
1474
+ async getModelSelection() {
1475
+ const res = await this.http.get("/admin/model-selection");
1476
+ return unwrapData(res);
1477
+ }
1478
+ /** Full replace of the model selection. Returns the fresh selection. */
1479
+ async putModelSelection(body) {
1480
+ const res = await this.http.put("/admin/model-selection", { body });
1481
+ return unwrapData(res);
1482
+ }
1483
+ /** Upsert a single (provider, role) → model slot. Returns the fresh selection. */
1484
+ async patchModelSelection(body) {
1485
+ const res = await this.http.patch("/admin/model-selection", {
1486
+ body
1487
+ });
1488
+ return unwrapData(res);
1489
+ }
1490
+ // --- Model pricing / surcharge (bridged to cloud-agent) ---
1491
+ /** All model_pricing rows. */
1492
+ async listModelPricing() {
1493
+ const res = await this.http.get(
1494
+ "/admin/model-pricing"
1495
+ );
1496
+ return unwrapData(res).pricing ?? [];
1497
+ }
1498
+ /** Upsert one model_pricing row. Returns the fresh list. */
1499
+ async putModelPricing(row) {
1500
+ const res = await this.http.put(
1501
+ "/admin/model-pricing",
1502
+ { body: row }
1503
+ );
1504
+ return unwrapData(res).pricing ?? [];
1505
+ }
1506
+ };
1507
+
1427
1508
  // src/client.ts
1428
1509
  var AgentEngineFacade = class {
1429
1510
  constructor(templates, scheduledTasks) {
@@ -1459,6 +1540,7 @@ var CloudAgentClient = class {
1459
1540
  this.budgets = new BudgetsClient(this.http);
1460
1541
  this.referrals = new ReferralsClient(this.http);
1461
1542
  this.reseller = new ResellerClient(this.http);
1543
+ this.platformAdmin = new PlatformAdminClient(this.http);
1462
1544
  }
1463
1545
  };
1464
1546
 
@@ -2293,6 +2375,6 @@ var usdMicros = {
2293
2375
  fromDollars: (dollars) => Math.round(dollars * 1e6)
2294
2376
  };
2295
2377
 
2296
- export { AccessType, BaseClient, BudgetsClient, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, CAP_STORAGE, CAP_VCS, CloudAgentClient, HttpError, MFAType, NotImplementedError, OrgRoles, PROVIDER_CATALOG, ProviderType, ReferralsClient, ResellerClient, ResourcesClient, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
2378
+ export { AccessType, BaseClient, BudgetsClient, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, CAP_STORAGE, CAP_VCS, CloudAgentClient, HttpError, MFAType, NotImplementedError, OrgRoles, PROVIDER_CATALOG, PlatformAdminClient, ProviderType, ReferralsClient, ResellerClient, ResourcesClient, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
2297
2379
  //# sourceMappingURL=index.js.map
2298
2380
  //# sourceMappingURL=index.js.map