@scalemule/sdk 0.0.80 → 0.0.82

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.mts CHANGED
@@ -1,6 +1,8 @@
1
1
  export { PHONE_COUNTRIES, PhoneCountry, PhoneNormalizationResult, composePhoneNumber, countryFlag, detectCountryFromE164, findPhoneCountryByCode, findPhoneCountryByDialCode, isValidE164Phone, normalizeAndValidatePhone, normalizePhoneNumber } from '@scalemule/ui/phone';
2
2
  import { E as ExperimentAssignment } from './experiments-RH_CTd1R.mjs';
3
3
  export { a as EXPERIMENTS_PROPERTY, b as EXPERIMENT_EXPOSED_EVENT, c as ExperimentAssignments, d as ExperimentEvaluationLike, M as MAX_EXPERIMENTS_PER_EVENT, e as experimentVariant, f as exposureEvent, g as exposureStorageKey, i as isExperimentKey, h as isVariantKey, n as normalizeExperiments, w as withExperiments } from './experiments-RH_CTd1R.mjs';
4
+ import { ScaleMuleAi, SummarizeInput, SummarizeOptions, AiResult, SummarizeResult, AiRequestOptions, AiRun } from '@scalemule/ai';
5
+ export { CreateRunInput as AiCreateRunInput, EventsOptions as AiEventsOptions, AiError as AiFacadeErrorShape, AiRequestOptions, AiResult, AiRun, AiRunError, AiRunEvent, AiRunStatus, WaitOptions as AiWaitOptions, SummarizeInput, SummarizeOptions, SummarizeOutput, SummarizeResult } from '@scalemule/ai';
4
6
 
5
7
  /**
6
8
  * ScaleMule SDK Types
@@ -4489,6 +4491,39 @@ declare class DecisionsService extends ServiceModule {
4489
4491
  verifyReceipt(receiptId: string, requestOptions?: RequestOptions): Promise<ApiResponse<ReceiptVerification>>;
4490
4492
  }
4491
4493
 
4494
+ /**
4495
+ * AI Service Module — ScaleMule AI facade (`sm.ai`)
4496
+ *
4497
+ * Thin adapter over `@scalemule/ai`: the same typed client, wired to this
4498
+ * SDK's credentials (API key, session token, active workspace).
4499
+ *
4500
+ * Routes (gateway prefix /v1/ai):
4501
+ * POST /runs → create a run (idempotent)
4502
+ * GET /runs/{id} → read a run
4503
+ * GET /runs/{id}/events → lifecycle events (SSE)
4504
+ * POST /runs/{id}/cancel → cancel
4505
+ *
4506
+ * Account scope: the active workspace (`sm.setWorkspaceContext`) is sent as
4507
+ * `x-requested-account-id`; the gateway verifies membership. A publishable
4508
+ * key with a signed-in user runs as that member; a server-side secret key
4509
+ * runs in service mode.
4510
+ */
4511
+
4512
+ interface AiServiceOptions {
4513
+ /** Custom fetch (tests, polyfills). Defaults to `globalThis.fetch`. */
4514
+ fetch?: typeof fetch;
4515
+ }
4516
+ declare class AiService {
4517
+ private readonly ai;
4518
+ constructor(client: ScaleMuleClient, options?: AiServiceOptions);
4519
+ /** Low-level run API: `create`, `get`, `wait`, `cancel`, `events`. */
4520
+ get runs(): ScaleMuleAi['runs'];
4521
+ /** Summarize text and wait for the typed result. */
4522
+ summarize(input: SummarizeInput, options?: SummarizeOptions): Promise<AiResult<SummarizeResult>>;
4523
+ /** Read one run (alias of `runs.get`). */
4524
+ getRun<TOutput = unknown>(runId: string, options?: AiRequestOptions): Promise<AiResult<AiRun<TOutput>>>;
4525
+ }
4526
+
4492
4527
  /**
4493
4528
  * Bookings Service Module — quotes, customer stats and booking completion
4494
4529
  * (the appointment system of record for Business Logic Plane decisions).
@@ -6208,6 +6243,149 @@ declare class WebhooksService extends ServiceModule {
6208
6243
  }>>;
6209
6244
  }
6210
6245
 
6246
+ /**
6247
+ * Newsletters Service Module
6248
+ *
6249
+ * Reader-side newsletter subscriptions with compliance-grade consent
6250
+ * evidence. The gateway records the reader's IP, browser, device fingerprint
6251
+ * and location on every call, so sign-ups made from the reader's browser
6252
+ * carry their own proof. Server-side apps forwarding a reader request must
6253
+ * use the server helper in `@scalemule/nextjs` so the reader's evidence (not
6254
+ * the server's) is recorded.
6255
+ *
6256
+ * Routes (all under /v1/newsletters):
6257
+ * GET /lists → active lists + consent text to show
6258
+ * POST /lists/{slug}/subscriptions → sign up (double opt-in email)
6259
+ * POST /subscriptions/confirm → confirm from the email link token
6260
+ * POST /unsubscribe → opt out with an unsubscribe token
6261
+ * GET /preferences?token= → preference centre (email-only readers)
6262
+ * PUT /preferences?token= → change cadence / pause / resume
6263
+ * GET /me/subscriptions → signed-in reader's subscriptions
6264
+ * PUT /me/subscriptions → signed-in reader changes
6265
+ */
6266
+
6267
+ /** `edition` = one email per published edition. Lists choose which they offer. */
6268
+ type NewsletterCadence = 'daily' | 'weekly' | 'edition' | (string & NonNullable<unknown>);
6269
+ /** A list a form can offer, with the consent text the form must display. */
6270
+ interface NewsletterList {
6271
+ id: string;
6272
+ slug: string;
6273
+ name: string;
6274
+ description: string | null;
6275
+ kind: 'digest' | 'campaign' | 'announcement';
6276
+ channels: string[];
6277
+ cadence_options: NewsletterCadence[];
6278
+ default_cadence: NewsletterCadence;
6279
+ default_timezone: string;
6280
+ double_opt_in_required: boolean;
6281
+ /** Show `consent_text` next to an unticked checkbox; null when no policy is published. */
6282
+ policy: {
6283
+ version: string;
6284
+ consent_text: string;
6285
+ privacy_policy_url: string | null;
6286
+ } | null;
6287
+ }
6288
+ interface NewsletterSubscribeInput {
6289
+ email?: string;
6290
+ /** Must be true: the reader ticked an unticked consent box. */
6291
+ consent: true;
6292
+ channel?: 'email';
6293
+ cadence?: NewsletterCadence;
6294
+ /** IANA timezone, e.g. `America/Los_Angeles`. */
6295
+ timezone?: string;
6296
+ /** Where the form lives, e.g. `footer`, `article_inline`. */
6297
+ collection_point?: string;
6298
+ collection_url?: string;
6299
+ placement?: string;
6300
+ /** What the reader was looking at, e.g. an article path. */
6301
+ origin_ref?: string;
6302
+ locale?: string;
6303
+ }
6304
+ /**
6305
+ * Sign-up result. `check_email` is returned whether or not the address was
6306
+ * new (no account enumeration); `active` only when the list skips double
6307
+ * opt-in.
6308
+ */
6309
+ type NewsletterSubscribeResult = {
6310
+ status: 'check_email';
6311
+ } | {
6312
+ status: 'active';
6313
+ /** The signed-in reader's verified address was already subscribed. */
6314
+ already_subscribed?: boolean;
6315
+ list?: {
6316
+ slug: string;
6317
+ name: string;
6318
+ };
6319
+ cadence: NewsletterCadence;
6320
+ next_delivery_at?: string | null;
6321
+ };
6322
+ interface NewsletterConfirmResult {
6323
+ status: 'active';
6324
+ already_confirmed: boolean;
6325
+ list: {
6326
+ slug: string;
6327
+ name: string;
6328
+ };
6329
+ cadence: NewsletterCadence;
6330
+ next_delivery_at?: string | null;
6331
+ /** Preference-centre link for this reader (bearer token inside: do not log). */
6332
+ manage_url?: string;
6333
+ placement: string | null;
6334
+ origin_ref: string | null;
6335
+ }
6336
+ interface NewsletterSubscription {
6337
+ subscription_id: string;
6338
+ list_id: string;
6339
+ slug: string;
6340
+ name: string;
6341
+ cadence_options: NewsletterCadence[];
6342
+ channel: string;
6343
+ cadence: NewsletterCadence;
6344
+ timezone: string;
6345
+ status: 'active' | 'unconfirmed' | 'paused' | 'unsubscribed' | 'suppressed';
6346
+ confirmed_at: string | null;
6347
+ next_delivery_at: string | null;
6348
+ /** Send back as `expected_revision`; a stale value is rejected with 409. */
6349
+ revision: number;
6350
+ }
6351
+ interface NewsletterPreferenceChange {
6352
+ subscription_id: string;
6353
+ expected_revision: number;
6354
+ cadence?: NewsletterCadence;
6355
+ timezone?: string;
6356
+ /** false pauses or unsubscribes, true resumes. */
6357
+ active?: boolean;
6358
+ }
6359
+ declare class NewslettersService extends ServiceModule {
6360
+ protected basePath: string;
6361
+ /** Active lists of this application, with the consent text each form must show. */
6362
+ lists(options?: RequestOptions): Promise<ApiResponse<{
6363
+ lists: NewsletterList[];
6364
+ }>>;
6365
+ /** Signs a reader up. Call from the reader's browser so their own evidence is recorded. */
6366
+ subscribe(slug: string, input: NewsletterSubscribeInput, options?: RequestOptions): Promise<ApiResponse<NewsletterSubscribeResult>>;
6367
+ /** Confirms a sign-up with the token from the confirmation email link. */
6368
+ confirm(token: string, options?: RequestOptions): Promise<ApiResponse<NewsletterConfirmResult>>;
6369
+ /** Opts out with the token from an unsubscribe link. Always succeeds for a well-formed token. */
6370
+ unsubscribe(token: string, reason?: string, options?: RequestOptions): Promise<ApiResponse<{
6371
+ unsubscribed: boolean;
6372
+ }>>;
6373
+ /** Preference centre for readers without an account (token from the manage link). */
6374
+ preferences(token: string, options?: RequestOptions): Promise<ApiResponse<{
6375
+ subscriptions: NewsletterSubscription[];
6376
+ }>>;
6377
+ updatePreferences(token: string, changes: NewsletterPreferenceChange[], options?: RequestOptions): Promise<ApiResponse<{
6378
+ subscriptions: NewsletterSubscription[];
6379
+ }>>;
6380
+ /** The signed-in reader's subscriptions (verified account email only). */
6381
+ mySubscriptions(options?: RequestOptions): Promise<ApiResponse<{
6382
+ subscriptions: NewsletterSubscription[];
6383
+ }>>;
6384
+ updateMySubscriptions(changes: NewsletterPreferenceChange[], options?: RequestOptions): Promise<ApiResponse<{
6385
+ subscriptions: NewsletterSubscription[];
6386
+ }>>;
6387
+ }
6388
+
6211
6389
  /**
6212
6390
  * Search Service Module
6213
6391
  *
@@ -8532,6 +8710,7 @@ declare class ScaleMule {
8532
8710
  readonly search: SearchService;
8533
8711
  readonly logger: LoggerService;
8534
8712
  readonly webhooks: WebhooksService;
8713
+ readonly newsletters: NewslettersService;
8535
8714
  readonly leaderboard: LeaderboardService;
8536
8715
  readonly listings: ListingsService;
8537
8716
  readonly communityMaps: CommunityMapsService;
@@ -8554,6 +8733,7 @@ declare class ScaleMule {
8554
8733
  readonly agentTools: AgentToolsService;
8555
8734
  readonly agentModels: AgentModelsService;
8556
8735
  readonly agentSessions: AgentSessionsService;
8736
+ readonly ai: AiService;
8557
8737
  constructor(config: ScaleMuleConfig);
8558
8738
  /**
8559
8739
  * Initialize the client — loads persisted session from storage.
@@ -8618,4 +8798,4 @@ declare class ScaleMule {
8618
8798
  getClient(): ScaleMuleClient;
8619
8799
  }
8620
8800
 
8621
- export { type AcceptQuoteInput, type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type AppointmentDepositValue, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type BookingCompletionResult, BookingsService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CommunityMapArea, type CommunityMapCanonicalArea, type CommunityMapCollection, type CommunityMapCollectionConfig, type CommunityMapComment, type CommunityMapCommentInput, type CommunityMapCommentPage, type CommunityMapConsent, type CommunityMapDevicePosition, type CommunityMapDevicePositionMethod, type CommunityMapEditorialCollection, type CommunityMapEditorialComment, type CommunityMapEditorialFeature, type CommunityMapEditorialMedia, type CommunityMapFeature, type CommunityMapFeatureDraft, type CommunityMapFeatureQuery, type CommunityMapFeatureStatus, type CommunityMapGeometry, type CommunityMapMedia, type CommunityMapMediaReceipt, type CommunityMapOwnSubmission, type CommunityMapOwnSubmissionPage, type CommunityMapPage, type CommunityMapPhotoCapture, type CommunityMapPosition, type CommunityMapPrecision, type CommunityMapPrivateReport, type CommunityMapPrivateSubmission, type CommunityMapProposal, type CommunityMapPublicContent, type CommunityMapQueueQuery, type CommunityMapReactionDefinition, type CommunityMapReceipt, type CommunityMapReportInput, type CommunityMapReportReason, type CommunityMapRevision, type CommunityMapSource, type CommunityMapSubmissionInput, type CommunityMapSubmissionPolicy, type CommunityMapSubmissionStatus, type CommunityMapSubmissionUpdate, type CommunityMapView, type CommunityMapVote, CommunityMapsEditorialService, CommunityMapsGeographyService, CommunityMapsService, type CommunityValueOutcome, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateLeadInput, type CreatePollInput, type CreateQuoteInput, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type CustomerStats, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DecisionBatchItem, type DecisionBatchResult, type DecisionEvaluateOptions, type DecisionOutcome, type DecisionProposedAction, type DecisionReceipt, type DecisionResult, type DecisionTraceLevel, type DecisionVersions, DecisionsService, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, ExperimentAssignment, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type IntelligenceAction, type IntelligenceCache, type IntelligenceChangePage, type IntelligenceClaim, type IntelligenceEvent, type IntelligenceKind, type IntelligenceRecordPage, type IntelligenceRelease, type IntelligenceReleaseReceipt, type IntelligenceSection, type IntelligenceSource, type IntelligenceStatus, type IntelligenceVerification, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, LEGACY_ANONYMOUS_ID_KEYS, type Lead, type Leaderboard, type LeaderboardEntry, LeaderboardService, LeadsService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LocalBriefing, type LocalIntelligencePreferences, type LocalIntelligenceRecord, LocalIntelligenceService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, MEDIA_PRESETS, type MediaAsset, type MediaCaptureSession, type MediaKind, type MediaManifest, type MediaManifestOptions, type MediaPolicy, type MediaPreset, type MediaPresetSpec, MediaService, type MediaUploadEvent, type MediaUploadOptions, type MediaUploadPhase, type MediaUploadResult, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type Poll, type PollBallot, type PollChoice, type PollChoiceInput, type PollListOptions, type PollMedia, type PollMediaKind, type PollStatus, PollsService, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type Quote, type QuoteDeposit, type QuoteState, type ReadStatus, RealtimeService, type ReceiptVerification, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, STORAGE_KEYS, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialContentProjection, type SocialContentProjectionInput, type SocialDiscoveryCreatorInput, type SocialPolicyAction, type SocialPolicyBatchDecisionItem, type SocialPolicyBatchDecisionRequest, type SocialPolicyBatchDecisionResponse, type SocialPolicyBatchDecisionTarget, type SocialPolicyBlockRequest, type SocialPolicyContactRequest, type SocialPolicyContactRequestListItem, type SocialPolicyContactRequestQuery, type SocialPolicyContactRequestRequest, type SocialPolicyContext, type SocialPolicyDecision, type SocialPolicyDecisionLimits, type SocialPolicyDecisionRequest, type SocialPolicyDecisionResponse, type SocialPolicyIdentity, type SocialPolicyIdentityType, type SocialPolicyMuteRequest, type SocialPolicyPolicyPack, type SocialPolicyRelationship, type SocialPolicyRelationshipQuery, type SocialPolicyRelationshipRequest, type SocialPolicyReportRequest, SocialPolicyService, type SocialPolicySettings, type SocialPolicyUnblockRequest, type SocialPolicyUpdateSettingsRequest, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdatePollInput, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, type VoteState, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, applyIntelligenceChanges, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, devicePositionPayload, ensureAnonymousId, extractClientContext, generateAnonymousId, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, pollSharePercent, pollVoterKey, prepareCommunityMapAttachment, readAnonymousId, resolveStrategy, startMediaCapture, uploadMultipartToS3, uploadSingleToS3, validateIP };
8801
+ export { type AcceptQuoteInput, type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, AiService, type AiServiceOptions, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type AppointmentDepositValue, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type BookingCompletionResult, BookingsService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CommunityMapArea, type CommunityMapCanonicalArea, type CommunityMapCollection, type CommunityMapCollectionConfig, type CommunityMapComment, type CommunityMapCommentInput, type CommunityMapCommentPage, type CommunityMapConsent, type CommunityMapDevicePosition, type CommunityMapDevicePositionMethod, type CommunityMapEditorialCollection, type CommunityMapEditorialComment, type CommunityMapEditorialFeature, type CommunityMapEditorialMedia, type CommunityMapFeature, type CommunityMapFeatureDraft, type CommunityMapFeatureQuery, type CommunityMapFeatureStatus, type CommunityMapGeometry, type CommunityMapMedia, type CommunityMapMediaReceipt, type CommunityMapOwnSubmission, type CommunityMapOwnSubmissionPage, type CommunityMapPage, type CommunityMapPhotoCapture, type CommunityMapPosition, type CommunityMapPrecision, type CommunityMapPrivateReport, type CommunityMapPrivateSubmission, type CommunityMapProposal, type CommunityMapPublicContent, type CommunityMapQueueQuery, type CommunityMapReactionDefinition, type CommunityMapReceipt, type CommunityMapReportInput, type CommunityMapReportReason, type CommunityMapRevision, type CommunityMapSource, type CommunityMapSubmissionInput, type CommunityMapSubmissionPolicy, type CommunityMapSubmissionStatus, type CommunityMapSubmissionUpdate, type CommunityMapView, type CommunityMapVote, CommunityMapsEditorialService, CommunityMapsGeographyService, CommunityMapsService, type CommunityValueOutcome, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateLeadInput, type CreatePollInput, type CreateQuoteInput, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type CustomerStats, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DecisionBatchItem, type DecisionBatchResult, type DecisionEvaluateOptions, type DecisionOutcome, type DecisionProposedAction, type DecisionReceipt, type DecisionResult, type DecisionTraceLevel, type DecisionVersions, DecisionsService, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, ExperimentAssignment, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type IntelligenceAction, type IntelligenceCache, type IntelligenceChangePage, type IntelligenceClaim, type IntelligenceEvent, type IntelligenceKind, type IntelligenceRecordPage, type IntelligenceRelease, type IntelligenceReleaseReceipt, type IntelligenceSection, type IntelligenceSource, type IntelligenceStatus, type IntelligenceVerification, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, LEGACY_ANONYMOUS_ID_KEYS, type Lead, type Leaderboard, type LeaderboardEntry, LeaderboardService, LeadsService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LocalBriefing, type LocalIntelligencePreferences, type LocalIntelligenceRecord, LocalIntelligenceService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, MEDIA_PRESETS, type MediaAsset, type MediaCaptureSession, type MediaKind, type MediaManifest, type MediaManifestOptions, type MediaPolicy, type MediaPreset, type MediaPresetSpec, MediaService, type MediaUploadEvent, type MediaUploadOptions, type MediaUploadPhase, type MediaUploadResult, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type NewsletterCadence, type NewsletterConfirmResult, type NewsletterList, type NewsletterPreferenceChange, type NewsletterSubscribeInput, type NewsletterSubscribeResult, type NewsletterSubscription, NewslettersService, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type Poll, type PollBallot, type PollChoice, type PollChoiceInput, type PollListOptions, type PollMedia, type PollMediaKind, type PollStatus, PollsService, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type Quote, type QuoteDeposit, type QuoteState, type ReadStatus, RealtimeService, type ReceiptVerification, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, STORAGE_KEYS, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialContentProjection, type SocialContentProjectionInput, type SocialDiscoveryCreatorInput, type SocialPolicyAction, type SocialPolicyBatchDecisionItem, type SocialPolicyBatchDecisionRequest, type SocialPolicyBatchDecisionResponse, type SocialPolicyBatchDecisionTarget, type SocialPolicyBlockRequest, type SocialPolicyContactRequest, type SocialPolicyContactRequestListItem, type SocialPolicyContactRequestQuery, type SocialPolicyContactRequestRequest, type SocialPolicyContext, type SocialPolicyDecision, type SocialPolicyDecisionLimits, type SocialPolicyDecisionRequest, type SocialPolicyDecisionResponse, type SocialPolicyIdentity, type SocialPolicyIdentityType, type SocialPolicyMuteRequest, type SocialPolicyPolicyPack, type SocialPolicyRelationship, type SocialPolicyRelationshipQuery, type SocialPolicyRelationshipRequest, type SocialPolicyReportRequest, SocialPolicyService, type SocialPolicySettings, type SocialPolicyUnblockRequest, type SocialPolicyUpdateSettingsRequest, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdatePollInput, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, type VoteState, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, applyIntelligenceChanges, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, devicePositionPayload, ensureAnonymousId, extractClientContext, generateAnonymousId, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, pollSharePercent, pollVoterKey, prepareCommunityMapAttachment, readAnonymousId, resolveStrategy, startMediaCapture, uploadMultipartToS3, uploadSingleToS3, validateIP };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export { PHONE_COUNTRIES, PhoneCountry, PhoneNormalizationResult, composePhoneNumber, countryFlag, detectCountryFromE164, findPhoneCountryByCode, findPhoneCountryByDialCode, isValidE164Phone, normalizeAndValidatePhone, normalizePhoneNumber } from '@scalemule/ui/phone';
2
2
  import { E as ExperimentAssignment } from './experiments-RH_CTd1R.js';
3
3
  export { a as EXPERIMENTS_PROPERTY, b as EXPERIMENT_EXPOSED_EVENT, c as ExperimentAssignments, d as ExperimentEvaluationLike, M as MAX_EXPERIMENTS_PER_EVENT, e as experimentVariant, f as exposureEvent, g as exposureStorageKey, i as isExperimentKey, h as isVariantKey, n as normalizeExperiments, w as withExperiments } from './experiments-RH_CTd1R.js';
4
+ import { ScaleMuleAi, SummarizeInput, SummarizeOptions, AiResult, SummarizeResult, AiRequestOptions, AiRun } from '@scalemule/ai';
5
+ export { CreateRunInput as AiCreateRunInput, EventsOptions as AiEventsOptions, AiError as AiFacadeErrorShape, AiRequestOptions, AiResult, AiRun, AiRunError, AiRunEvent, AiRunStatus, WaitOptions as AiWaitOptions, SummarizeInput, SummarizeOptions, SummarizeOutput, SummarizeResult } from '@scalemule/ai';
4
6
 
5
7
  /**
6
8
  * ScaleMule SDK Types
@@ -4489,6 +4491,39 @@ declare class DecisionsService extends ServiceModule {
4489
4491
  verifyReceipt(receiptId: string, requestOptions?: RequestOptions): Promise<ApiResponse<ReceiptVerification>>;
4490
4492
  }
4491
4493
 
4494
+ /**
4495
+ * AI Service Module — ScaleMule AI facade (`sm.ai`)
4496
+ *
4497
+ * Thin adapter over `@scalemule/ai`: the same typed client, wired to this
4498
+ * SDK's credentials (API key, session token, active workspace).
4499
+ *
4500
+ * Routes (gateway prefix /v1/ai):
4501
+ * POST /runs → create a run (idempotent)
4502
+ * GET /runs/{id} → read a run
4503
+ * GET /runs/{id}/events → lifecycle events (SSE)
4504
+ * POST /runs/{id}/cancel → cancel
4505
+ *
4506
+ * Account scope: the active workspace (`sm.setWorkspaceContext`) is sent as
4507
+ * `x-requested-account-id`; the gateway verifies membership. A publishable
4508
+ * key with a signed-in user runs as that member; a server-side secret key
4509
+ * runs in service mode.
4510
+ */
4511
+
4512
+ interface AiServiceOptions {
4513
+ /** Custom fetch (tests, polyfills). Defaults to `globalThis.fetch`. */
4514
+ fetch?: typeof fetch;
4515
+ }
4516
+ declare class AiService {
4517
+ private readonly ai;
4518
+ constructor(client: ScaleMuleClient, options?: AiServiceOptions);
4519
+ /** Low-level run API: `create`, `get`, `wait`, `cancel`, `events`. */
4520
+ get runs(): ScaleMuleAi['runs'];
4521
+ /** Summarize text and wait for the typed result. */
4522
+ summarize(input: SummarizeInput, options?: SummarizeOptions): Promise<AiResult<SummarizeResult>>;
4523
+ /** Read one run (alias of `runs.get`). */
4524
+ getRun<TOutput = unknown>(runId: string, options?: AiRequestOptions): Promise<AiResult<AiRun<TOutput>>>;
4525
+ }
4526
+
4492
4527
  /**
4493
4528
  * Bookings Service Module — quotes, customer stats and booking completion
4494
4529
  * (the appointment system of record for Business Logic Plane decisions).
@@ -6208,6 +6243,149 @@ declare class WebhooksService extends ServiceModule {
6208
6243
  }>>;
6209
6244
  }
6210
6245
 
6246
+ /**
6247
+ * Newsletters Service Module
6248
+ *
6249
+ * Reader-side newsletter subscriptions with compliance-grade consent
6250
+ * evidence. The gateway records the reader's IP, browser, device fingerprint
6251
+ * and location on every call, so sign-ups made from the reader's browser
6252
+ * carry their own proof. Server-side apps forwarding a reader request must
6253
+ * use the server helper in `@scalemule/nextjs` so the reader's evidence (not
6254
+ * the server's) is recorded.
6255
+ *
6256
+ * Routes (all under /v1/newsletters):
6257
+ * GET /lists → active lists + consent text to show
6258
+ * POST /lists/{slug}/subscriptions → sign up (double opt-in email)
6259
+ * POST /subscriptions/confirm → confirm from the email link token
6260
+ * POST /unsubscribe → opt out with an unsubscribe token
6261
+ * GET /preferences?token= → preference centre (email-only readers)
6262
+ * PUT /preferences?token= → change cadence / pause / resume
6263
+ * GET /me/subscriptions → signed-in reader's subscriptions
6264
+ * PUT /me/subscriptions → signed-in reader changes
6265
+ */
6266
+
6267
+ /** `edition` = one email per published edition. Lists choose which they offer. */
6268
+ type NewsletterCadence = 'daily' | 'weekly' | 'edition' | (string & NonNullable<unknown>);
6269
+ /** A list a form can offer, with the consent text the form must display. */
6270
+ interface NewsletterList {
6271
+ id: string;
6272
+ slug: string;
6273
+ name: string;
6274
+ description: string | null;
6275
+ kind: 'digest' | 'campaign' | 'announcement';
6276
+ channels: string[];
6277
+ cadence_options: NewsletterCadence[];
6278
+ default_cadence: NewsletterCadence;
6279
+ default_timezone: string;
6280
+ double_opt_in_required: boolean;
6281
+ /** Show `consent_text` next to an unticked checkbox; null when no policy is published. */
6282
+ policy: {
6283
+ version: string;
6284
+ consent_text: string;
6285
+ privacy_policy_url: string | null;
6286
+ } | null;
6287
+ }
6288
+ interface NewsletterSubscribeInput {
6289
+ email?: string;
6290
+ /** Must be true: the reader ticked an unticked consent box. */
6291
+ consent: true;
6292
+ channel?: 'email';
6293
+ cadence?: NewsletterCadence;
6294
+ /** IANA timezone, e.g. `America/Los_Angeles`. */
6295
+ timezone?: string;
6296
+ /** Where the form lives, e.g. `footer`, `article_inline`. */
6297
+ collection_point?: string;
6298
+ collection_url?: string;
6299
+ placement?: string;
6300
+ /** What the reader was looking at, e.g. an article path. */
6301
+ origin_ref?: string;
6302
+ locale?: string;
6303
+ }
6304
+ /**
6305
+ * Sign-up result. `check_email` is returned whether or not the address was
6306
+ * new (no account enumeration); `active` only when the list skips double
6307
+ * opt-in.
6308
+ */
6309
+ type NewsletterSubscribeResult = {
6310
+ status: 'check_email';
6311
+ } | {
6312
+ status: 'active';
6313
+ /** The signed-in reader's verified address was already subscribed. */
6314
+ already_subscribed?: boolean;
6315
+ list?: {
6316
+ slug: string;
6317
+ name: string;
6318
+ };
6319
+ cadence: NewsletterCadence;
6320
+ next_delivery_at?: string | null;
6321
+ };
6322
+ interface NewsletterConfirmResult {
6323
+ status: 'active';
6324
+ already_confirmed: boolean;
6325
+ list: {
6326
+ slug: string;
6327
+ name: string;
6328
+ };
6329
+ cadence: NewsletterCadence;
6330
+ next_delivery_at?: string | null;
6331
+ /** Preference-centre link for this reader (bearer token inside: do not log). */
6332
+ manage_url?: string;
6333
+ placement: string | null;
6334
+ origin_ref: string | null;
6335
+ }
6336
+ interface NewsletterSubscription {
6337
+ subscription_id: string;
6338
+ list_id: string;
6339
+ slug: string;
6340
+ name: string;
6341
+ cadence_options: NewsletterCadence[];
6342
+ channel: string;
6343
+ cadence: NewsletterCadence;
6344
+ timezone: string;
6345
+ status: 'active' | 'unconfirmed' | 'paused' | 'unsubscribed' | 'suppressed';
6346
+ confirmed_at: string | null;
6347
+ next_delivery_at: string | null;
6348
+ /** Send back as `expected_revision`; a stale value is rejected with 409. */
6349
+ revision: number;
6350
+ }
6351
+ interface NewsletterPreferenceChange {
6352
+ subscription_id: string;
6353
+ expected_revision: number;
6354
+ cadence?: NewsletterCadence;
6355
+ timezone?: string;
6356
+ /** false pauses or unsubscribes, true resumes. */
6357
+ active?: boolean;
6358
+ }
6359
+ declare class NewslettersService extends ServiceModule {
6360
+ protected basePath: string;
6361
+ /** Active lists of this application, with the consent text each form must show. */
6362
+ lists(options?: RequestOptions): Promise<ApiResponse<{
6363
+ lists: NewsletterList[];
6364
+ }>>;
6365
+ /** Signs a reader up. Call from the reader's browser so their own evidence is recorded. */
6366
+ subscribe(slug: string, input: NewsletterSubscribeInput, options?: RequestOptions): Promise<ApiResponse<NewsletterSubscribeResult>>;
6367
+ /** Confirms a sign-up with the token from the confirmation email link. */
6368
+ confirm(token: string, options?: RequestOptions): Promise<ApiResponse<NewsletterConfirmResult>>;
6369
+ /** Opts out with the token from an unsubscribe link. Always succeeds for a well-formed token. */
6370
+ unsubscribe(token: string, reason?: string, options?: RequestOptions): Promise<ApiResponse<{
6371
+ unsubscribed: boolean;
6372
+ }>>;
6373
+ /** Preference centre for readers without an account (token from the manage link). */
6374
+ preferences(token: string, options?: RequestOptions): Promise<ApiResponse<{
6375
+ subscriptions: NewsletterSubscription[];
6376
+ }>>;
6377
+ updatePreferences(token: string, changes: NewsletterPreferenceChange[], options?: RequestOptions): Promise<ApiResponse<{
6378
+ subscriptions: NewsletterSubscription[];
6379
+ }>>;
6380
+ /** The signed-in reader's subscriptions (verified account email only). */
6381
+ mySubscriptions(options?: RequestOptions): Promise<ApiResponse<{
6382
+ subscriptions: NewsletterSubscription[];
6383
+ }>>;
6384
+ updateMySubscriptions(changes: NewsletterPreferenceChange[], options?: RequestOptions): Promise<ApiResponse<{
6385
+ subscriptions: NewsletterSubscription[];
6386
+ }>>;
6387
+ }
6388
+
6211
6389
  /**
6212
6390
  * Search Service Module
6213
6391
  *
@@ -8532,6 +8710,7 @@ declare class ScaleMule {
8532
8710
  readonly search: SearchService;
8533
8711
  readonly logger: LoggerService;
8534
8712
  readonly webhooks: WebhooksService;
8713
+ readonly newsletters: NewslettersService;
8535
8714
  readonly leaderboard: LeaderboardService;
8536
8715
  readonly listings: ListingsService;
8537
8716
  readonly communityMaps: CommunityMapsService;
@@ -8554,6 +8733,7 @@ declare class ScaleMule {
8554
8733
  readonly agentTools: AgentToolsService;
8555
8734
  readonly agentModels: AgentModelsService;
8556
8735
  readonly agentSessions: AgentSessionsService;
8736
+ readonly ai: AiService;
8557
8737
  constructor(config: ScaleMuleConfig);
8558
8738
  /**
8559
8739
  * Initialize the client — loads persisted session from storage.
@@ -8618,4 +8798,4 @@ declare class ScaleMule {
8618
8798
  getClient(): ScaleMuleClient;
8619
8799
  }
8620
8800
 
8621
- export { type AcceptQuoteInput, type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type AppointmentDepositValue, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type BookingCompletionResult, BookingsService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CommunityMapArea, type CommunityMapCanonicalArea, type CommunityMapCollection, type CommunityMapCollectionConfig, type CommunityMapComment, type CommunityMapCommentInput, type CommunityMapCommentPage, type CommunityMapConsent, type CommunityMapDevicePosition, type CommunityMapDevicePositionMethod, type CommunityMapEditorialCollection, type CommunityMapEditorialComment, type CommunityMapEditorialFeature, type CommunityMapEditorialMedia, type CommunityMapFeature, type CommunityMapFeatureDraft, type CommunityMapFeatureQuery, type CommunityMapFeatureStatus, type CommunityMapGeometry, type CommunityMapMedia, type CommunityMapMediaReceipt, type CommunityMapOwnSubmission, type CommunityMapOwnSubmissionPage, type CommunityMapPage, type CommunityMapPhotoCapture, type CommunityMapPosition, type CommunityMapPrecision, type CommunityMapPrivateReport, type CommunityMapPrivateSubmission, type CommunityMapProposal, type CommunityMapPublicContent, type CommunityMapQueueQuery, type CommunityMapReactionDefinition, type CommunityMapReceipt, type CommunityMapReportInput, type CommunityMapReportReason, type CommunityMapRevision, type CommunityMapSource, type CommunityMapSubmissionInput, type CommunityMapSubmissionPolicy, type CommunityMapSubmissionStatus, type CommunityMapSubmissionUpdate, type CommunityMapView, type CommunityMapVote, CommunityMapsEditorialService, CommunityMapsGeographyService, CommunityMapsService, type CommunityValueOutcome, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateLeadInput, type CreatePollInput, type CreateQuoteInput, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type CustomerStats, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DecisionBatchItem, type DecisionBatchResult, type DecisionEvaluateOptions, type DecisionOutcome, type DecisionProposedAction, type DecisionReceipt, type DecisionResult, type DecisionTraceLevel, type DecisionVersions, DecisionsService, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, ExperimentAssignment, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type IntelligenceAction, type IntelligenceCache, type IntelligenceChangePage, type IntelligenceClaim, type IntelligenceEvent, type IntelligenceKind, type IntelligenceRecordPage, type IntelligenceRelease, type IntelligenceReleaseReceipt, type IntelligenceSection, type IntelligenceSource, type IntelligenceStatus, type IntelligenceVerification, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, LEGACY_ANONYMOUS_ID_KEYS, type Lead, type Leaderboard, type LeaderboardEntry, LeaderboardService, LeadsService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LocalBriefing, type LocalIntelligencePreferences, type LocalIntelligenceRecord, LocalIntelligenceService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, MEDIA_PRESETS, type MediaAsset, type MediaCaptureSession, type MediaKind, type MediaManifest, type MediaManifestOptions, type MediaPolicy, type MediaPreset, type MediaPresetSpec, MediaService, type MediaUploadEvent, type MediaUploadOptions, type MediaUploadPhase, type MediaUploadResult, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type Poll, type PollBallot, type PollChoice, type PollChoiceInput, type PollListOptions, type PollMedia, type PollMediaKind, type PollStatus, PollsService, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type Quote, type QuoteDeposit, type QuoteState, type ReadStatus, RealtimeService, type ReceiptVerification, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, STORAGE_KEYS, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialContentProjection, type SocialContentProjectionInput, type SocialDiscoveryCreatorInput, type SocialPolicyAction, type SocialPolicyBatchDecisionItem, type SocialPolicyBatchDecisionRequest, type SocialPolicyBatchDecisionResponse, type SocialPolicyBatchDecisionTarget, type SocialPolicyBlockRequest, type SocialPolicyContactRequest, type SocialPolicyContactRequestListItem, type SocialPolicyContactRequestQuery, type SocialPolicyContactRequestRequest, type SocialPolicyContext, type SocialPolicyDecision, type SocialPolicyDecisionLimits, type SocialPolicyDecisionRequest, type SocialPolicyDecisionResponse, type SocialPolicyIdentity, type SocialPolicyIdentityType, type SocialPolicyMuteRequest, type SocialPolicyPolicyPack, type SocialPolicyRelationship, type SocialPolicyRelationshipQuery, type SocialPolicyRelationshipRequest, type SocialPolicyReportRequest, SocialPolicyService, type SocialPolicySettings, type SocialPolicyUnblockRequest, type SocialPolicyUpdateSettingsRequest, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdatePollInput, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, type VoteState, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, applyIntelligenceChanges, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, devicePositionPayload, ensureAnonymousId, extractClientContext, generateAnonymousId, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, pollSharePercent, pollVoterKey, prepareCommunityMapAttachment, readAnonymousId, resolveStrategy, startMediaCapture, uploadMultipartToS3, uploadSingleToS3, validateIP };
8801
+ export { type AcceptQuoteInput, type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, AiService, type AiServiceOptions, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type AppointmentDepositValue, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type BookingCompletionResult, BookingsService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CommunityMapArea, type CommunityMapCanonicalArea, type CommunityMapCollection, type CommunityMapCollectionConfig, type CommunityMapComment, type CommunityMapCommentInput, type CommunityMapCommentPage, type CommunityMapConsent, type CommunityMapDevicePosition, type CommunityMapDevicePositionMethod, type CommunityMapEditorialCollection, type CommunityMapEditorialComment, type CommunityMapEditorialFeature, type CommunityMapEditorialMedia, type CommunityMapFeature, type CommunityMapFeatureDraft, type CommunityMapFeatureQuery, type CommunityMapFeatureStatus, type CommunityMapGeometry, type CommunityMapMedia, type CommunityMapMediaReceipt, type CommunityMapOwnSubmission, type CommunityMapOwnSubmissionPage, type CommunityMapPage, type CommunityMapPhotoCapture, type CommunityMapPosition, type CommunityMapPrecision, type CommunityMapPrivateReport, type CommunityMapPrivateSubmission, type CommunityMapProposal, type CommunityMapPublicContent, type CommunityMapQueueQuery, type CommunityMapReactionDefinition, type CommunityMapReceipt, type CommunityMapReportInput, type CommunityMapReportReason, type CommunityMapRevision, type CommunityMapSource, type CommunityMapSubmissionInput, type CommunityMapSubmissionPolicy, type CommunityMapSubmissionStatus, type CommunityMapSubmissionUpdate, type CommunityMapView, type CommunityMapVote, CommunityMapsEditorialService, CommunityMapsGeographyService, CommunityMapsService, type CommunityValueOutcome, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateLeadInput, type CreatePollInput, type CreateQuoteInput, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type CustomerStats, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DecisionBatchItem, type DecisionBatchResult, type DecisionEvaluateOptions, type DecisionOutcome, type DecisionProposedAction, type DecisionReceipt, type DecisionResult, type DecisionTraceLevel, type DecisionVersions, DecisionsService, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, ExperimentAssignment, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type IntelligenceAction, type IntelligenceCache, type IntelligenceChangePage, type IntelligenceClaim, type IntelligenceEvent, type IntelligenceKind, type IntelligenceRecordPage, type IntelligenceRelease, type IntelligenceReleaseReceipt, type IntelligenceSection, type IntelligenceSource, type IntelligenceStatus, type IntelligenceVerification, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, LEGACY_ANONYMOUS_ID_KEYS, type Lead, type Leaderboard, type LeaderboardEntry, LeaderboardService, LeadsService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LocalBriefing, type LocalIntelligencePreferences, type LocalIntelligenceRecord, LocalIntelligenceService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, MEDIA_PRESETS, type MediaAsset, type MediaCaptureSession, type MediaKind, type MediaManifest, type MediaManifestOptions, type MediaPolicy, type MediaPreset, type MediaPresetSpec, MediaService, type MediaUploadEvent, type MediaUploadOptions, type MediaUploadPhase, type MediaUploadResult, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type NewsletterCadence, type NewsletterConfirmResult, type NewsletterList, type NewsletterPreferenceChange, type NewsletterSubscribeInput, type NewsletterSubscribeResult, type NewsletterSubscription, NewslettersService, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type Poll, type PollBallot, type PollChoice, type PollChoiceInput, type PollListOptions, type PollMedia, type PollMediaKind, type PollStatus, PollsService, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type Quote, type QuoteDeposit, type QuoteState, type ReadStatus, RealtimeService, type ReceiptVerification, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, STORAGE_KEYS, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialContentProjection, type SocialContentProjectionInput, type SocialDiscoveryCreatorInput, type SocialPolicyAction, type SocialPolicyBatchDecisionItem, type SocialPolicyBatchDecisionRequest, type SocialPolicyBatchDecisionResponse, type SocialPolicyBatchDecisionTarget, type SocialPolicyBlockRequest, type SocialPolicyContactRequest, type SocialPolicyContactRequestListItem, type SocialPolicyContactRequestQuery, type SocialPolicyContactRequestRequest, type SocialPolicyContext, type SocialPolicyDecision, type SocialPolicyDecisionLimits, type SocialPolicyDecisionRequest, type SocialPolicyDecisionResponse, type SocialPolicyIdentity, type SocialPolicyIdentityType, type SocialPolicyMuteRequest, type SocialPolicyPolicyPack, type SocialPolicyRelationship, type SocialPolicyRelationshipQuery, type SocialPolicyRelationshipRequest, type SocialPolicyReportRequest, SocialPolicyService, type SocialPolicySettings, type SocialPolicyUnblockRequest, type SocialPolicyUpdateSettingsRequest, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdatePollInput, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, type VoteState, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, applyIntelligenceChanges, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, devicePositionPayload, ensureAnonymousId, extractClientContext, generateAnonymousId, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, pollSharePercent, pollVoterKey, prepareCommunityMapAttachment, readAnonymousId, resolveStrategy, startMediaCapture, uploadMultipartToS3, uploadSingleToS3, validateIP };
package/dist/index.js CHANGED
@@ -311,6 +311,7 @@ __export(index_exports, {
311
311
  AgentSessionsService: () => AgentSessionsService,
312
312
  AgentToolsService: () => AgentToolsService,
313
313
  AgentsService: () => AgentsService,
314
+ AiService: () => AiService,
314
315
  AnalyticsService: () => AnalyticsService,
315
316
  AudioService: () => AudioService,
316
317
  AuthService: () => AuthService,
@@ -346,6 +347,7 @@ __export(index_exports, {
346
347
  MAX_EXPERIMENTS_PER_EVENT: () => MAX_EXPERIMENTS_PER_EVENT,
347
348
  MEDIA_PRESETS: () => MEDIA_PRESETS,
348
349
  MediaService: () => MediaService,
350
+ NewslettersService: () => NewslettersService,
349
351
  NotificationsService: () => NotificationsService,
350
352
  OrchestratorService: () => OrchestratorService,
351
353
  PHONE_COUNTRIES: () => PHONE_COUNTRIES,
@@ -6630,6 +6632,38 @@ var DecisionsService = class extends ServiceModule {
6630
6632
  }
6631
6633
  };
6632
6634
 
6635
+ // src/services/ai.ts
6636
+ var import_ai = require("@scalemule/ai");
6637
+ var AiService = class {
6638
+ constructor(client, options = {}) {
6639
+ const transport = (0, import_ai.createFetchTransport)({
6640
+ baseUrl: client.getBaseUrl(),
6641
+ fetch: options.fetch,
6642
+ headers: () => {
6643
+ const headers = { "x-api-key": client.getApiKey() };
6644
+ const token = client.getSessionToken();
6645
+ if (token) headers["authorization"] = `Bearer ${token}`;
6646
+ const workspaceId = client.getWorkspaceId();
6647
+ if (workspaceId) headers["x-requested-account-id"] = workspaceId;
6648
+ return headers;
6649
+ }
6650
+ });
6651
+ this.ai = new import_ai.ScaleMuleAi({ transport });
6652
+ }
6653
+ /** Low-level run API: `create`, `get`, `wait`, `cancel`, `events`. */
6654
+ get runs() {
6655
+ return this.ai.runs;
6656
+ }
6657
+ /** Summarize text and wait for the typed result. */
6658
+ summarize(input, options) {
6659
+ return this.ai.summarize(input, options);
6660
+ }
6661
+ /** Read one run (alias of `runs.get`). */
6662
+ getRun(runId, options) {
6663
+ return this.ai.runs.get(runId, options);
6664
+ }
6665
+ };
6666
+
6633
6667
  // src/services/bookings.ts
6634
6668
  var BookingsService = class extends ServiceModule {
6635
6669
  constructor() {
@@ -7520,6 +7554,52 @@ var WebhooksService = class extends ServiceModule {
7520
7554
  }
7521
7555
  };
7522
7556
 
7557
+ // src/services/newsletters.ts
7558
+ var NewslettersService = class extends ServiceModule {
7559
+ constructor() {
7560
+ super(...arguments);
7561
+ this.basePath = "/v1/newsletters";
7562
+ }
7563
+ /** Active lists of this application, with the consent text each form must show. */
7564
+ async lists(options) {
7565
+ return this._get("/lists", options);
7566
+ }
7567
+ /** Signs a reader up. Call from the reader's browser so their own evidence is recorded. */
7568
+ async subscribe(slug, input, options) {
7569
+ return this.post(
7570
+ `/lists/${encodeURIComponent(slug)}/subscriptions`,
7571
+ { channel: "email", ...input },
7572
+ { skipRetry: true, ...options }
7573
+ );
7574
+ }
7575
+ /** Confirms a sign-up with the token from the confirmation email link. */
7576
+ async confirm(token, options) {
7577
+ return this.post("/subscriptions/confirm", { token }, options);
7578
+ }
7579
+ /** Opts out with the token from an unsubscribe link. Always succeeds for a well-formed token. */
7580
+ async unsubscribe(token, reason, options) {
7581
+ return this.post("/unsubscribe", reason ? { token, reason } : { token }, options);
7582
+ }
7583
+ /** Preference centre for readers without an account (token from the manage link). */
7584
+ async preferences(token, options) {
7585
+ return this._get(this.withQuery("/preferences", { token }), options);
7586
+ }
7587
+ async updatePreferences(token, changes, options) {
7588
+ return this.put(
7589
+ this.withQuery("/preferences", { token }),
7590
+ { changes },
7591
+ options
7592
+ );
7593
+ }
7594
+ /** The signed-in reader's subscriptions (verified account email only). */
7595
+ async mySubscriptions(options) {
7596
+ return this._get("/me/subscriptions", options);
7597
+ }
7598
+ async updateMySubscriptions(changes, options) {
7599
+ return this.put("/me/subscriptions", { changes }, options);
7600
+ }
7601
+ };
7602
+
7523
7603
  // src/services/search.ts
7524
7604
  var SearchService = class extends ServiceModule {
7525
7605
  constructor() {
@@ -9473,6 +9553,7 @@ var ScaleMule = class {
9473
9553
  this.search = new SearchService(this._client);
9474
9554
  this.logger = new LoggerService(this._client);
9475
9555
  this.webhooks = new WebhooksService(this._client);
9556
+ this.newsletters = new NewslettersService(this._client);
9476
9557
  this.leaderboard = new LeaderboardService(this._client);
9477
9558
  this.listings = new ListingsService(this._client);
9478
9559
  this.communityMaps = new CommunityMapsService(this._client);
@@ -9495,6 +9576,7 @@ var ScaleMule = class {
9495
9576
  this.agentTools = new AgentToolsService(this._client);
9496
9577
  this.agentModels = new AgentModelsService(this._client);
9497
9578
  this.agentSessions = new AgentSessionsService(this._client);
9579
+ this.ai = new AiService(this._client);
9498
9580
  }
9499
9581
  /**
9500
9582
  * Initialize the client — loads persisted session from storage.
@@ -9627,6 +9709,7 @@ var index_default = ScaleMule;
9627
9709
  AgentSessionsService,
9628
9710
  AgentToolsService,
9629
9711
  AgentsService,
9712
+ AiService,
9630
9713
  AnalyticsService,
9631
9714
  AudioService,
9632
9715
  AuthService,
@@ -9662,6 +9745,7 @@ var index_default = ScaleMule;
9662
9745
  MAX_EXPERIMENTS_PER_EVENT,
9663
9746
  MEDIA_PRESETS,
9664
9747
  MediaService,
9748
+ NewslettersService,
9665
9749
  NotificationsService,
9666
9750
  OrchestratorService,
9667
9751
  PHONE_COUNTRIES,
package/dist/index.mjs CHANGED
@@ -6493,6 +6493,38 @@ var DecisionsService = class extends ServiceModule {
6493
6493
  }
6494
6494
  };
6495
6495
 
6496
+ // src/services/ai.ts
6497
+ import { ScaleMuleAi, createFetchTransport } from "@scalemule/ai";
6498
+ var AiService = class {
6499
+ constructor(client, options = {}) {
6500
+ const transport = createFetchTransport({
6501
+ baseUrl: client.getBaseUrl(),
6502
+ fetch: options.fetch,
6503
+ headers: () => {
6504
+ const headers = { "x-api-key": client.getApiKey() };
6505
+ const token = client.getSessionToken();
6506
+ if (token) headers["authorization"] = `Bearer ${token}`;
6507
+ const workspaceId = client.getWorkspaceId();
6508
+ if (workspaceId) headers["x-requested-account-id"] = workspaceId;
6509
+ return headers;
6510
+ }
6511
+ });
6512
+ this.ai = new ScaleMuleAi({ transport });
6513
+ }
6514
+ /** Low-level run API: `create`, `get`, `wait`, `cancel`, `events`. */
6515
+ get runs() {
6516
+ return this.ai.runs;
6517
+ }
6518
+ /** Summarize text and wait for the typed result. */
6519
+ summarize(input, options) {
6520
+ return this.ai.summarize(input, options);
6521
+ }
6522
+ /** Read one run (alias of `runs.get`). */
6523
+ getRun(runId, options) {
6524
+ return this.ai.runs.get(runId, options);
6525
+ }
6526
+ };
6527
+
6496
6528
  // src/services/bookings.ts
6497
6529
  var BookingsService = class extends ServiceModule {
6498
6530
  constructor() {
@@ -7383,6 +7415,52 @@ var WebhooksService = class extends ServiceModule {
7383
7415
  }
7384
7416
  };
7385
7417
 
7418
+ // src/services/newsletters.ts
7419
+ var NewslettersService = class extends ServiceModule {
7420
+ constructor() {
7421
+ super(...arguments);
7422
+ this.basePath = "/v1/newsletters";
7423
+ }
7424
+ /** Active lists of this application, with the consent text each form must show. */
7425
+ async lists(options) {
7426
+ return this._get("/lists", options);
7427
+ }
7428
+ /** Signs a reader up. Call from the reader's browser so their own evidence is recorded. */
7429
+ async subscribe(slug, input, options) {
7430
+ return this.post(
7431
+ `/lists/${encodeURIComponent(slug)}/subscriptions`,
7432
+ { channel: "email", ...input },
7433
+ { skipRetry: true, ...options }
7434
+ );
7435
+ }
7436
+ /** Confirms a sign-up with the token from the confirmation email link. */
7437
+ async confirm(token, options) {
7438
+ return this.post("/subscriptions/confirm", { token }, options);
7439
+ }
7440
+ /** Opts out with the token from an unsubscribe link. Always succeeds for a well-formed token. */
7441
+ async unsubscribe(token, reason, options) {
7442
+ return this.post("/unsubscribe", reason ? { token, reason } : { token }, options);
7443
+ }
7444
+ /** Preference centre for readers without an account (token from the manage link). */
7445
+ async preferences(token, options) {
7446
+ return this._get(this.withQuery("/preferences", { token }), options);
7447
+ }
7448
+ async updatePreferences(token, changes, options) {
7449
+ return this.put(
7450
+ this.withQuery("/preferences", { token }),
7451
+ { changes },
7452
+ options
7453
+ );
7454
+ }
7455
+ /** The signed-in reader's subscriptions (verified account email only). */
7456
+ async mySubscriptions(options) {
7457
+ return this._get("/me/subscriptions", options);
7458
+ }
7459
+ async updateMySubscriptions(changes, options) {
7460
+ return this.put("/me/subscriptions", { changes }, options);
7461
+ }
7462
+ };
7463
+
7386
7464
  // src/services/search.ts
7387
7465
  var SearchService = class extends ServiceModule {
7388
7466
  constructor() {
@@ -9336,6 +9414,7 @@ var ScaleMule = class {
9336
9414
  this.search = new SearchService(this._client);
9337
9415
  this.logger = new LoggerService(this._client);
9338
9416
  this.webhooks = new WebhooksService(this._client);
9417
+ this.newsletters = new NewslettersService(this._client);
9339
9418
  this.leaderboard = new LeaderboardService(this._client);
9340
9419
  this.listings = new ListingsService(this._client);
9341
9420
  this.communityMaps = new CommunityMapsService(this._client);
@@ -9358,6 +9437,7 @@ var ScaleMule = class {
9358
9437
  this.agentTools = new AgentToolsService(this._client);
9359
9438
  this.agentModels = new AgentModelsService(this._client);
9360
9439
  this.agentSessions = new AgentSessionsService(this._client);
9440
+ this.ai = new AiService(this._client);
9361
9441
  }
9362
9442
  /**
9363
9443
  * Initialize the client — loads persisted session from storage.
@@ -9489,6 +9569,7 @@ export {
9489
9569
  AgentSessionsService,
9490
9570
  AgentToolsService,
9491
9571
  AgentsService,
9572
+ AiService,
9492
9573
  AnalyticsService,
9493
9574
  AudioService,
9494
9575
  AuthService,
@@ -9524,6 +9605,7 @@ export {
9524
9605
  MAX_EXPERIMENTS_PER_EVENT,
9525
9606
  MEDIA_PRESETS,
9526
9607
  MediaService,
9608
+ NewslettersService,
9527
9609
  NotificationsService,
9528
9610
  OrchestratorService,
9529
9611
  PHONE_COUNTRIES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/sdk",
3
- "version": "0.0.80",
3
+ "version": "0.0.82",
4
4
  "description": "Official TypeScript/JavaScript SDK for ScaleMule Backend-as-a-Service",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -62,9 +62,10 @@
62
62
  "node": ">=18.0.0"
63
63
  },
64
64
  "dependencies": {
65
+ "@scalemule/ai": "^0.0.1",
65
66
  "@scalemule/ui": ">=0.0.1",
66
- "semver": "^7.7.4",
67
- "browser-image-compression": "^2.0.2"
67
+ "browser-image-compression": "^2.0.2",
68
+ "semver": "^7.7.4"
68
69
  },
69
70
  "devDependencies": {
70
71
  "@scalemule/ui": ">=0.0.1",