@mindstudio-ai/agent 0.1.89 → 0.1.91

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.ts CHANGED
@@ -1579,6 +1579,49 @@ interface Citation {
1579
1579
  */
1580
1580
  url: string;
1581
1581
  }
1582
+ /** A metadata value as stored on a document: scalars only. */
1583
+ type MetadataValue = string | number | boolean;
1584
+ /**
1585
+ * Tags attached to a document when it's added — department, year, doc type,
1586
+ * a per-user scope — and matched by {@link SearchFilter.metadata} at query
1587
+ * time. Up to 16 keys per document; keys are alphanumeric with `_`/`-`.
1588
+ */
1589
+ type DocumentMetadata = Record<string, MetadataValue>;
1590
+ /**
1591
+ * Which retrieval branches run for a search.
1592
+ *
1593
+ * - `hybrid` — semantic and keyword retrieval fused. The default.
1594
+ * - `semantic` — the embedding alone (what `hybrid: false` selects).
1595
+ * - `lexical` — keyword matching alone, with NO query embedding. The cheapest
1596
+ * and fastest mode; right when the query is an identifier (an error code, a
1597
+ * SKU, a name) rather than a meaning.
1598
+ */
1599
+ type SearchMode = 'hybrid' | 'semantic' | 'lexical';
1600
+ /**
1601
+ * Narrow a search before ranking. Every condition ANDs with the others, and a
1602
+ * filter can only ever narrow — it runs inside your corpus, not across it.
1603
+ */
1604
+ interface SearchFilter {
1605
+ /**
1606
+ * Match document metadata set at add time. A scalar must equal; an array
1607
+ * matches any of its values. Keys AND together:
1608
+ * `{ department: 'legal', year: [2025, 2026] }`.
1609
+ */
1610
+ metadata?: Record<string, MetadataValue | MetadataValue[]>;
1611
+ /** Exact filename, or any of several. */
1612
+ filename?: string | string[];
1613
+ /** Restrict to specific documents (ids from {@link DataSource.documents}). */
1614
+ documentIds?: string[];
1615
+ /** Page range, inclusive — for paged formats like PDF. */
1616
+ pages?: {
1617
+ min?: number;
1618
+ max?: number;
1619
+ };
1620
+ /** Chunk text must contain ALL of these words, in any order. */
1621
+ contains?: string;
1622
+ /** Chunk text must contain this exact word sequence, adjacent and in order. */
1623
+ phrase?: string;
1624
+ }
1582
1625
  /** Where one retrieval branch put a hit, and what that branch scored it. */
1583
1626
  interface BranchPosition {
1584
1627
  /** 0-based position within that branch's own results. */
@@ -1622,6 +1665,15 @@ interface SearchHit {
1622
1665
  before: string[];
1623
1666
  after: string[];
1624
1667
  };
1668
+ /**
1669
+ * Only when `highlight` was requested: where query terms land in `text`, as
1670
+ * `text.slice(start, end)` ranges. Keyword-based — a hit that matched
1671
+ * semantically may report an empty array, which is itself informative.
1672
+ */
1673
+ matches?: {
1674
+ start: number;
1675
+ end: number;
1676
+ }[];
1625
1677
  }
1626
1678
  /**
1627
1679
  * Per-query overrides.
@@ -1640,6 +1692,29 @@ interface SearchOptions {
1640
1692
  topK?: number;
1641
1693
  /** Drop hits below this score. Provider-specific scale — measure before using. */
1642
1694
  scoreThreshold?: number;
1695
+ /**
1696
+ * Narrow the search to matching chunks before ranking — by document
1697
+ * metadata, filename, document ids, page range, or required words/phrases.
1698
+ * See {@link SearchFilter}.
1699
+ */
1700
+ filter?: SearchFilter;
1701
+ /**
1702
+ * Which retrieval branches run. Defaults to the source's configuration
1703
+ * (hybrid). `'lexical'` skips the query embedding entirely — fastest, and
1704
+ * right for identifier-shaped queries. See {@link SearchMode}.
1705
+ */
1706
+ mode?: SearchMode;
1707
+ /**
1708
+ * At most this many hits per document, backfilled from other documents —
1709
+ * stops one document from monopolizing the results. Useful whenever the
1710
+ * answer should draw on several sources.
1711
+ */
1712
+ maxPerDocument?: number;
1713
+ /**
1714
+ * Return `matches` on each hit: offsets of query terms within its text, for
1715
+ * rendering highlights.
1716
+ */
1717
+ highlight?: boolean;
1643
1718
  /**
1644
1719
  * Rerank results with a cross-encoder before returning them. On by default.
1645
1720
  *
@@ -1653,6 +1728,8 @@ interface SearchOptions {
1653
1728
  *
1654
1729
  * Keyword matching is what finds part numbers, error codes and proper nouns
1655
1730
  * that an embedding model never learned. Rarely worth disabling.
1731
+ * `hybrid: false` is the same as `mode: 'semantic'`; prefer `mode`, which
1732
+ * also offers `'lexical'`.
1656
1733
  */
1657
1734
  hybrid?: boolean;
1658
1735
  /**
@@ -1680,6 +1757,13 @@ interface AddOptions {
1680
1757
  */
1681
1758
  filename: string;
1682
1759
  contentType?: string;
1760
+ /**
1761
+ * Tags to attach — filterable at search time via
1762
+ * {@link SearchFilter.metadata}. Scalars only, up to 16 keys. Re-adding the
1763
+ * same bytes with different metadata updates the tags in place with no
1764
+ * re-processing; supplying metadata replaces the whole object.
1765
+ */
1766
+ metadata?: DocumentMetadata;
1683
1767
  }
1684
1768
  interface DataSourceDocument {
1685
1769
  id: string;
@@ -1688,6 +1772,8 @@ interface DataSourceDocument {
1688
1772
  errorMessage: string | null;
1689
1773
  chunkCount: number | null;
1690
1774
  pageCount: number | null;
1775
+ /** Tags set at add time. See {@link AddOptions.metadata}. */
1776
+ metadata: DocumentMetadata | null;
1691
1777
  createdAt: string;
1692
1778
  ingestedAt: string | null;
1693
1779
  }
@@ -1883,6 +1969,29 @@ interface DataSources {
1883
1969
  defineDataSource(name: string): DataSource;
1884
1970
  }
1885
1971
 
1972
+ /** The accepted outbound call, already dialing. */
1973
+ interface VoiceCallResult {
1974
+ /** The call record's session id (appears in the app's voice call log). */
1975
+ sessionId: string;
1976
+ status: 'dialing';
1977
+ /** The caller-ID number the callee sees. */
1978
+ from: string;
1979
+ /** The dialed number. */
1980
+ to: string;
1981
+ }
1982
+ /** The `voice` namespace object. */
1983
+ interface Voice {
1984
+ /**
1985
+ * Place an outbound call to `to` (E.164, e.g. `+13105551234`) and connect
1986
+ * the callee to this app's voice agent. Returns as soon as dialing starts;
1987
+ * the outcome (answered, busy, no answer) lands on the call record.
1988
+ */
1989
+ call(params: {
1990
+ to: string;
1991
+ assumeIdentity?: boolean;
1992
+ }): Promise<VoiceCallResult>;
1993
+ }
1994
+
1886
1995
  /**
1887
1996
  * Types for the task agent runtime.
1888
1997
  *
@@ -2038,6 +2147,7 @@ declare class MindStudioAgent$1 {
2038
2147
  /** @internal Cached Files namespace instance (lazy; no context hydration needed). */
2039
2148
  private _files;
2040
2149
  private _dataSources;
2150
+ private _voice;
2041
2151
  /** @internal Auth type — 'internal' for CALLBACK_TOKEN (managed mode), 'apiKey' otherwise. */
2042
2152
  private _authType;
2043
2153
  /** @internal Usage source sent on step executions (from MINDSTUDIO_REQUEST_SOURCE).
@@ -2327,6 +2437,15 @@ declare class MindStudioAgent$1 {
2327
2437
  * ```
2328
2438
  */
2329
2439
  get dataSources(): DataSources;
2440
+ /**
2441
+ * Telephony: outbound calls answered by this app's voice agent.
2442
+ *
2443
+ * @example
2444
+ * ```ts
2445
+ * await agent.voice.call({ to: '+13105551234', assumeIdentity: true });
2446
+ * ```
2447
+ */
2448
+ get voice(): Voice;
2330
2449
  /**
2331
2450
  * @internal Transport for the `files` namespace — POST /_internal/v2/files/<op>
2332
2451
  * with the raw hook token (mirrors `_executeDbBatch`).
@@ -2337,6 +2456,11 @@ declare class MindStudioAgent$1 {
2337
2456
  * POST /_internal/v2/datasources/<op> with the raw hook token.
2338
2457
  */
2339
2458
  private _dataSourcesRequest;
2459
+ /**
2460
+ * @internal Transport for the `voice` namespace —
2461
+ * POST /_internal/v2/voice/<op> with the raw hook token.
2462
+ */
2463
+ private _voiceRequest;
2340
2464
  /**
2341
2465
  * @internal Shared shape for the brokered `/_internal/v2/<ns>/<op>` data
2342
2466
  * planes. Factored out rather than copied per namespace so error handling
@@ -3211,6 +3335,8 @@ interface ExtractAudioFromVideoStepOutput {
3211
3335
  interface ExtractTextStepInput {
3212
3336
  /** URL or array of URLs to extract text from. Accepts a single URL, comma-separated list, or JSON array */
3213
3337
  url: string | string[];
3338
+ /** Optional extraction model id (a `document_extraction` model, e.g. `mistral-ocr-latest`, `llamaparse`, `google-document-ai`). Defaults to the platform default when omitted. */
3339
+ model?: string;
3214
3340
  }
3215
3341
  interface ExtractTextStepOutput {
3216
3342
  /** Extracted text content. A single string for one URL, or an array for multiple URLs */
@@ -7269,6 +7395,7 @@ interface StepMethods {
7269
7395
  * - Handles both text-layer PDFs and image-based/scanned PDFs (e.g. Figma/Canva exports, scanned documents). Image-based PDFs are processed with OCR automatically — there is no need to convert PDF pages to images first.
7270
7396
  * - Accepts a single URL, a comma-separated list of URLs, or a JSON array of URLs.
7271
7397
  * - Files are rehosted on the MindStudio CDN before extraction.
7398
+ * - Optionally set `model` to a specific document-extraction model (`mistral-ocr-latest`, `llamaparse`, `google-document-ai`); omit to use the platform default.
7272
7399
  * - Maximum file size is 50MB per URL.
7273
7400
  *
7274
7401
  * @example
@@ -9649,6 +9776,20 @@ declare const files: Files;
9649
9776
  * ```
9650
9777
  */
9651
9778
  declare const dataSources: DataSources;
9779
+ /**
9780
+ * Top-level `voice` namespace bound to the default singleton.
9781
+ *
9782
+ * Telephony: outbound calls answered by this app's voice agent. See the
9783
+ * `voice` module docs for identity, limits, and compliance notes.
9784
+ *
9785
+ * @example
9786
+ * ```ts
9787
+ * import { voice } from '@mindstudio-ai/agent';
9788
+ *
9789
+ * await voice.call({ to: '+13105551234', assumeIdentity: true });
9790
+ * ```
9791
+ */
9792
+ declare const voice: Voice;
9652
9793
  /**
9653
9794
  * Top-level `stream` function bound to the default singleton.
9654
9795
  *
@@ -9712,4 +9853,4 @@ declare const prerender: {
9712
9853
  }>;
9713
9854
  };
9714
9855
 
9715
- export { type Accessor, type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, type AgentInfo, type AgentOptions, type AirtableCreateUpdateRecordStepInput, type AirtableCreateUpdateRecordStepOutput, type AirtableDeleteRecordStepInput, type AirtableDeleteRecordStepOutput, type AirtableGetRecordStepInput, type AirtableGetRecordStepOutput, type AirtableGetTableRecordsStepInput, type AirtableGetTableRecordsStepOutput, type AnalyzeImageStepInput, type AnalyzeImageStepOutput, type AnalyzeVideoStepInput, type AnalyzeVideoStepOutput, type AppAuthContext, type AppContextResult, type AppDatabase, type AppDatabaseColumnSchema, type AppDatabaseTable, type AppRoleAssignment, AuthContext, type AuthTableConfig, type BatchStepInput, type BatchStepResult, type CaptureThumbnailStepInput, type CaptureThumbnailStepOutput, type CheckAppRoleStepInput, type CheckAppRoleStepOutput, type CodaCreateUpdatePageStepInput, type CodaCreateUpdatePageStepOutput, type CodaCreateUpdateRowStepInput, type CodaCreateUpdateRowStepOutput, type CodaFindRowStepInput, type CodaFindRowStepOutput, type CodaGetPageStepInput, type CodaGetPageStepOutput, type CodaGetTableRowsStepInput, type CodaGetTableRowsStepOutput, type Connection, type ConnectorActionDetail, type ConnectorService, type ConvertPdfToImagesStepInput, type ConvertPdfToImagesStepOutput, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGmailDraftStepInput, type CreateGmailDraftStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type Db, type DefineStoreOptions, type DefineTableOptions, type DeleteDataSourceDocumentStepInput, type DeleteDataSourceDocumentStepOutput, type DeleteDataSourceStepInput, type DeleteDataSourceStepOutput, type DeleteGmailEmailStepInput, type DeleteGmailEmailStepOutput, type DeleteGoogleCalendarEventStepInput, type DeleteGoogleCalendarEventStepOutput, type DeleteGoogleSheetRowsStepInput, type DeleteGoogleSheetRowsStepOutput, type DetectChangesStepInput, type DetectChangesStepOutput, type DetectPIIStepInput, type DetectPIIStepOutput, type DiscordEditMessageStepInput, type DiscordEditMessageStepOutput, type DiscordSendFollowUpStepInput, type DiscordSendFollowUpStepOutput, type DiscordSendMessageStepInput, type DiscordSendMessageStepOutput, type DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, type ExecuteStepBatchOptions, type ExecuteStepBatchResult, type ExtractAudioFromVideoStepInput, type ExtractAudioFromVideoStepOutput, type ExtractTextStepInput, type ExtractTextStepOutput, type FetchDataSourceDocumentStepInput, type FetchDataSourceDocumentStepOutput, type FetchGoogleDocStepInput, type FetchGoogleDocStepOutput, type FetchGoogleSheetStepInput, type FetchGoogleSheetStepOutput, type FetchSlackChannelHistoryStepInput, type FetchSlackChannelHistoryStepOutput, type FetchYoutubeCaptionsStepInput, type FetchYoutubeCaptionsStepOutput, type FetchYoutubeChannelStepInput, type FetchYoutubeChannelStepOutput, type FetchYoutubeCommentsStepInput, type FetchYoutubeCommentsStepOutput, type FetchYoutubeVideoStepInput, type FetchYoutubeVideoStepOutput, type FileAccess, type Files, type Generate3dModelStepInput, type Generate3dModelStepOutput, type GenerateAssetStepInput, type GenerateAssetStepOutput, type GenerateChartStepInput, type GenerateChartStepOutput, type GenerateImageStepInput, type GenerateImageStepOutput, type GenerateLipsyncStepInput, type GenerateLipsyncStepOutput, type GenerateMusicStepInput, type GenerateMusicStepOutput, type GeneratePdfStepInput, type GeneratePdfStepOutput, type GenerateStaticVideoFromImageStepInput, type GenerateStaticVideoFromImageStepOutput, type GenerateTextStepInput, type GenerateTextStepOutput, type GenerateVideoStepInput, type GenerateVideoStepOutput, type GetGmailAttachmentsStepInput, type GetGmailAttachmentsStepOutput, type GetGmailDraftStepInput, type GetGmailDraftStepOutput, type GetGmailEmailStepInput, type GetGmailEmailStepOutput, type GetGmailUnreadCountStepInput, type GetGmailUnreadCountStepOutput, type GetGoogleCalendarEventStepInput, type GetGoogleCalendarEventStepOutput, type GetGoogleDriveFileStepInput, type GetGoogleDriveFileStepOutput, type GetGoogleSheetInfoStepInput, type GetGoogleSheetInfoStepOutput, type GetMediaMetadataStepInput, type GetMediaMetadataStepOutput, type HubspotCreateCompanyStepInput, type HubspotCreateCompanyStepOutput, type HubspotCreateContactStepInput, type HubspotCreateContactStepOutput, type HubspotGetCompanyStepInput, type HubspotGetCompanyStepOutput, type HubspotGetContactStepInput, type HubspotGetContactStepOutput, type HunterApiCompanyEnrichmentStepInput, type HunterApiCompanyEnrichmentStepOutput, type HunterApiDomainSearchStepInput, type HunterApiDomainSearchStepOutput, type HunterApiEmailFinderStepInput, type HunterApiEmailFinderStepOutput, type HunterApiEmailVerificationStepInput, type HunterApiEmailVerificationStepOutput, type HunterApiPersonEnrichmentStepInput, type HunterApiPersonEnrichmentStepOutput, type ImageFaceSwapStepInput, type ImageFaceSwapStepOutput, type ImageRemoveWatermarkStepInput, type ImageRemoveWatermarkStepOutput, type InsertVideoClipsStepInput, type InsertVideoClipsStepOutput, type ListAgentsResult, type ListDataSourcesStepInput, type ListDataSourcesStepOutput, type ListGmailDraftsStepInput, type ListGmailDraftsStepOutput, type ListGmailLabelsStepInput, type ListGmailLabelsStepOutput, type ListGoogleCalendarEventsStepInput, type ListGoogleCalendarEventsStepOutput, type ListGoogleDriveFilesStepInput, type ListGoogleDriveFilesStepOutput, type ListOptions, type ListRecentGmailEmailsStepInput, type ListRecentGmailEmailsStepOutput, type LogicStepInput, type LogicStepOutput, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, type MeshyAnimateStepInput, type MeshyAnimateStepOutput, type MeshyImageTo3dStepInput, type MeshyImageTo3dStepOutput, type MeshyRemeshStepInput, type MeshyRemeshStepOutput, type MeshyRigStepInput, type MeshyRigStepOutput, type MeshyTextTo3dStepInput, type MeshyTextTo3dStepOutput, type MeshyTextureStepInput, type MeshyTextureStepOutput, MindStudioAgent, MindStudioError, type MindStudioModel, type MindStudioModelSummary, type MixAudioIntoVideoStepInput, type MixAudioIntoVideoStepOutput, type ModelType, type MonacoSnippet, type MonacoSnippetField, type MonacoSnippetFieldType, type MuteVideoStepInput, type MuteVideoStepOutput, type N8nRunNodeStepInput, type N8nRunNodeStepOutput, type NotionCreatePageStepInput, type NotionCreatePageStepOutput, type NotionUpdatePageStepInput, type NotionUpdatePageStepOutput, type PackagedWorkflow, type PackagedWorkflowInput, type PackagedWorkflowSignature, type ParticlePodcastsFindMentionsStepInput, type ParticlePodcastsFindMentionsStepOutput, type ParticlePodcastsGetEpisodeStepInput, type ParticlePodcastsGetEpisodeStepOutput, type ParticlePodcastsGetEpisodeTranscriptStepInput, type ParticlePodcastsGetEpisodeTranscriptStepOutput, type ParticlePodcastsSearchCompaniesStepInput, type ParticlePodcastsSearchCompaniesStepOutput, type ParticlePodcastsSearchDialogueStepInput, type ParticlePodcastsSearchDialogueStepOutput, type ParticlePodcastsSearchPodcastsStepInput, type ParticlePodcastsSearchPodcastsStepOutput, type PeopleSearchStepInput, type PeopleSearchStepOutput, type PostToLinkedInStepInput, type PostToLinkedInStepOutput, type PostToSlackChannelStepInput, type PostToSlackChannelStepOutput, type PostToXStepInput, type PostToXStepOutput, type PostToZapierStepInput, type PostToZapierStepOutput, type Predicate, type PushInput, type PutOptions, Query, type QueryAppDatabaseStepInput, type QueryAppDatabaseStepOutput, type QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type ReplyToGmailEmailStepInput, type ReplyToGmailEmailStepOutput, type ReportIssueInput, type ReportedIssue, type RequestContext, type ResizeVideoStepInput, type ResizeVideoStepOutput, type ResolvedUser, Roles, type RunAgentOptions, type RunAgentResult, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunPackagedWorkflowStepInput, type RunPackagedWorkflowStepOutput, type RunTaskOptions, type RunTaskResult, type ScrapeLinkedInCompanyStepInput, type ScrapeLinkedInCompanyStepOutput, type ScrapeLinkedInProfileStepInput, type ScrapeLinkedInProfileStepOutput, type ScrapeUrlStepInput, type ScrapeUrlStepOutput, type ScrapeXPostStepInput, type ScrapeXPostStepOutput, type ScrapeXProfileStepInput, type ScrapeXProfileStepOutput, type ScreenshotUrlStepInput, type ScreenshotUrlStepOutput, type SearchGmailEmailsStepInput, type SearchGmailEmailsStepOutput, type SearchGoogleCalendarEventsStepInput, type SearchGoogleCalendarEventsStepOutput, type SearchGoogleDriveStepInput, type SearchGoogleDriveStepOutput, type SearchGoogleImagesStepInput, type SearchGoogleImagesStepOutput, type SearchGoogleNewsStepInput, type SearchGoogleNewsStepOutput, type SearchGoogleStepInput, type SearchGoogleStepOutput, type SearchGoogleTrendsStepInput, type SearchGoogleTrendsStepOutput, type SearchPerplexityStepInput, type SearchPerplexityStepOutput, type SearchXPostsStepInput, type SearchXPostsStepOutput, type SearchYoutubeStepInput, type SearchYoutubeStepOutput, type SearchYoutubeTrendsStepInput, type SearchYoutubeTrendsStepOutput, type SendEmailStepInput, type SendEmailStepOutput, type SendGmailDraftStepInput, type SendGmailDraftStepOutput, type SendGmailMessageStepInput, type SendGmailMessageStepOutput, type SendSMSStepInput, type SendSMSStepOutput, type SendSlackDirectMessageStepInput, type SendSlackDirectMessageStepOutput, type SetGmailReadStatusStepInput, type SetGmailReadStatusStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepCostEstimateEntry, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepLogEvent, type StepMetadata, type StepMethods, type StepName, type StepOutputMap, Store, type StoredFile, type SystemFields, Table, type TaskEvent, type TaskToolCall, type TaskToolConfig, type TaskUsage, type TelegramEditMessageStepInput, type TelegramEditMessageStepOutput, type TelegramReplyToMessageStepInput, type TelegramReplyToMessageStepOutput, type TelegramSendAudioStepInput, type TelegramSendAudioStepOutput, type TelegramSendFileStepInput, type TelegramSendFileStepOutput, type TelegramSendImageStepInput, type TelegramSendImageStepOutput, type TelegramSendMessageStepInput, type TelegramSendMessageStepOutput, type TelegramSendVideoStepInput, type TelegramSendVideoStepOutput, type TelegramSetTypingStepInput, type TelegramSetTypingStepOutput, type TextToSpeechStepInput, type TextToSpeechStepOutput, type TranscribeAudioStepInput, type TranscribeAudioStepOutput, type TrimMediaStepInput, type TrimMediaStepOutput, type UpdateGmailLabelsStepInput, type UpdateGmailLabelsStepOutput, type UpdateGoogleCalendarEventStepInput, type UpdateGoogleCalendarEventStepOutput, type UpdateGoogleDocStepInput, type UpdateGoogleDocStepOutput, type UpdateGoogleSheetStepInput, type UpdateGoogleSheetStepOutput, type UpdateInput, type UploadDataSourceDocumentStepInput, type UploadDataSourceDocumentStepOutput, type UploadFileResult, type UploadToken, type UpscaleImageStepInput, type UpscaleImageStepOutput, type UpscaleVideoStepInput, type UpscaleVideoStepOutput, type User, type UserInfoResult, type UserMessageStepInput, type UserMessageStepOutput, type VideoFaceSwapStepInput, type VideoFaceSwapStepOutput, type VideoRemoveBackgroundStepInput, type VideoRemoveBackgroundStepOutput, type VideoRemoveWatermarkStepInput, type VideoRemoveWatermarkStepOutput, type WatermarkImageStepInput, type WatermarkImageStepOutput, type WatermarkVideoStepInput, type WatermarkVideoStepOutput, type YouDotComFinanceResearchStepInput, type YouDotComFinanceResearchStepOutput, type YouDotComGetPageContentStepInput, type YouDotComGetPageContentStepOutput, type YouDotComLiveNewsStepInput, type YouDotComLiveNewsStepOutput, type YouDotComWebResearchStepInput, type YouDotComWebResearchStepOutput, type YouDotComWebSearchStepInput, type YouDotComWebSearchStepOutput, auth, blockTypeAliases, dataSources, db, mindstudio as default, files, getRequestContext, mindstudio, monacoSnippets, prerender, reportIssue, resolveUser, runWithContext, stepMetadata, stream };
9856
+ export { type Accessor, type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, type AgentInfo, type AgentOptions, type AirtableCreateUpdateRecordStepInput, type AirtableCreateUpdateRecordStepOutput, type AirtableDeleteRecordStepInput, type AirtableDeleteRecordStepOutput, type AirtableGetRecordStepInput, type AirtableGetRecordStepOutput, type AirtableGetTableRecordsStepInput, type AirtableGetTableRecordsStepOutput, type AnalyzeImageStepInput, type AnalyzeImageStepOutput, type AnalyzeVideoStepInput, type AnalyzeVideoStepOutput, type AppAuthContext, type AppContextResult, type AppDatabase, type AppDatabaseColumnSchema, type AppDatabaseTable, type AppRoleAssignment, AuthContext, type AuthTableConfig, type BatchStepInput, type BatchStepResult, type CaptureThumbnailStepInput, type CaptureThumbnailStepOutput, type CheckAppRoleStepInput, type CheckAppRoleStepOutput, type CodaCreateUpdatePageStepInput, type CodaCreateUpdatePageStepOutput, type CodaCreateUpdateRowStepInput, type CodaCreateUpdateRowStepOutput, type CodaFindRowStepInput, type CodaFindRowStepOutput, type CodaGetPageStepInput, type CodaGetPageStepOutput, type CodaGetTableRowsStepInput, type CodaGetTableRowsStepOutput, type Connection, type ConnectorActionDetail, type ConnectorService, type ConvertPdfToImagesStepInput, type ConvertPdfToImagesStepOutput, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGmailDraftStepInput, type CreateGmailDraftStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type Db, type DefineStoreOptions, type DefineTableOptions, type DeleteDataSourceDocumentStepInput, type DeleteDataSourceDocumentStepOutput, type DeleteDataSourceStepInput, type DeleteDataSourceStepOutput, type DeleteGmailEmailStepInput, type DeleteGmailEmailStepOutput, type DeleteGoogleCalendarEventStepInput, type DeleteGoogleCalendarEventStepOutput, type DeleteGoogleSheetRowsStepInput, type DeleteGoogleSheetRowsStepOutput, type DetectChangesStepInput, type DetectChangesStepOutput, type DetectPIIStepInput, type DetectPIIStepOutput, type DiscordEditMessageStepInput, type DiscordEditMessageStepOutput, type DiscordSendFollowUpStepInput, type DiscordSendFollowUpStepOutput, type DiscordSendMessageStepInput, type DiscordSendMessageStepOutput, type DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, type ExecuteStepBatchOptions, type ExecuteStepBatchResult, type ExtractAudioFromVideoStepInput, type ExtractAudioFromVideoStepOutput, type ExtractTextStepInput, type ExtractTextStepOutput, type FetchDataSourceDocumentStepInput, type FetchDataSourceDocumentStepOutput, type FetchGoogleDocStepInput, type FetchGoogleDocStepOutput, type FetchGoogleSheetStepInput, type FetchGoogleSheetStepOutput, type FetchSlackChannelHistoryStepInput, type FetchSlackChannelHistoryStepOutput, type FetchYoutubeCaptionsStepInput, type FetchYoutubeCaptionsStepOutput, type FetchYoutubeChannelStepInput, type FetchYoutubeChannelStepOutput, type FetchYoutubeCommentsStepInput, type FetchYoutubeCommentsStepOutput, type FetchYoutubeVideoStepInput, type FetchYoutubeVideoStepOutput, type FileAccess, type Files, type Generate3dModelStepInput, type Generate3dModelStepOutput, type GenerateAssetStepInput, type GenerateAssetStepOutput, type GenerateChartStepInput, type GenerateChartStepOutput, type GenerateImageStepInput, type GenerateImageStepOutput, type GenerateLipsyncStepInput, type GenerateLipsyncStepOutput, type GenerateMusicStepInput, type GenerateMusicStepOutput, type GeneratePdfStepInput, type GeneratePdfStepOutput, type GenerateStaticVideoFromImageStepInput, type GenerateStaticVideoFromImageStepOutput, type GenerateTextStepInput, type GenerateTextStepOutput, type GenerateVideoStepInput, type GenerateVideoStepOutput, type GetGmailAttachmentsStepInput, type GetGmailAttachmentsStepOutput, type GetGmailDraftStepInput, type GetGmailDraftStepOutput, type GetGmailEmailStepInput, type GetGmailEmailStepOutput, type GetGmailUnreadCountStepInput, type GetGmailUnreadCountStepOutput, type GetGoogleCalendarEventStepInput, type GetGoogleCalendarEventStepOutput, type GetGoogleDriveFileStepInput, type GetGoogleDriveFileStepOutput, type GetGoogleSheetInfoStepInput, type GetGoogleSheetInfoStepOutput, type GetMediaMetadataStepInput, type GetMediaMetadataStepOutput, type HubspotCreateCompanyStepInput, type HubspotCreateCompanyStepOutput, type HubspotCreateContactStepInput, type HubspotCreateContactStepOutput, type HubspotGetCompanyStepInput, type HubspotGetCompanyStepOutput, type HubspotGetContactStepInput, type HubspotGetContactStepOutput, type HunterApiCompanyEnrichmentStepInput, type HunterApiCompanyEnrichmentStepOutput, type HunterApiDomainSearchStepInput, type HunterApiDomainSearchStepOutput, type HunterApiEmailFinderStepInput, type HunterApiEmailFinderStepOutput, type HunterApiEmailVerificationStepInput, type HunterApiEmailVerificationStepOutput, type HunterApiPersonEnrichmentStepInput, type HunterApiPersonEnrichmentStepOutput, type ImageFaceSwapStepInput, type ImageFaceSwapStepOutput, type ImageRemoveWatermarkStepInput, type ImageRemoveWatermarkStepOutput, type InsertVideoClipsStepInput, type InsertVideoClipsStepOutput, type ListAgentsResult, type ListDataSourcesStepInput, type ListDataSourcesStepOutput, type ListGmailDraftsStepInput, type ListGmailDraftsStepOutput, type ListGmailLabelsStepInput, type ListGmailLabelsStepOutput, type ListGoogleCalendarEventsStepInput, type ListGoogleCalendarEventsStepOutput, type ListGoogleDriveFilesStepInput, type ListGoogleDriveFilesStepOutput, type ListOptions, type ListRecentGmailEmailsStepInput, type ListRecentGmailEmailsStepOutput, type LogicStepInput, type LogicStepOutput, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, type MeshyAnimateStepInput, type MeshyAnimateStepOutput, type MeshyImageTo3dStepInput, type MeshyImageTo3dStepOutput, type MeshyRemeshStepInput, type MeshyRemeshStepOutput, type MeshyRigStepInput, type MeshyRigStepOutput, type MeshyTextTo3dStepInput, type MeshyTextTo3dStepOutput, type MeshyTextureStepInput, type MeshyTextureStepOutput, MindStudioAgent, MindStudioError, type MindStudioModel, type MindStudioModelSummary, type MixAudioIntoVideoStepInput, type MixAudioIntoVideoStepOutput, type ModelType, type MonacoSnippet, type MonacoSnippetField, type MonacoSnippetFieldType, type MuteVideoStepInput, type MuteVideoStepOutput, type N8nRunNodeStepInput, type N8nRunNodeStepOutput, type NotionCreatePageStepInput, type NotionCreatePageStepOutput, type NotionUpdatePageStepInput, type NotionUpdatePageStepOutput, type PackagedWorkflow, type PackagedWorkflowInput, type PackagedWorkflowSignature, type ParticlePodcastsFindMentionsStepInput, type ParticlePodcastsFindMentionsStepOutput, type ParticlePodcastsGetEpisodeStepInput, type ParticlePodcastsGetEpisodeStepOutput, type ParticlePodcastsGetEpisodeTranscriptStepInput, type ParticlePodcastsGetEpisodeTranscriptStepOutput, type ParticlePodcastsSearchCompaniesStepInput, type ParticlePodcastsSearchCompaniesStepOutput, type ParticlePodcastsSearchDialogueStepInput, type ParticlePodcastsSearchDialogueStepOutput, type ParticlePodcastsSearchPodcastsStepInput, type ParticlePodcastsSearchPodcastsStepOutput, type PeopleSearchStepInput, type PeopleSearchStepOutput, type PostToLinkedInStepInput, type PostToLinkedInStepOutput, type PostToSlackChannelStepInput, type PostToSlackChannelStepOutput, type PostToXStepInput, type PostToXStepOutput, type PostToZapierStepInput, type PostToZapierStepOutput, type Predicate, type PushInput, type PutOptions, Query, type QueryAppDatabaseStepInput, type QueryAppDatabaseStepOutput, type QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type ReplyToGmailEmailStepInput, type ReplyToGmailEmailStepOutput, type ReportIssueInput, type ReportedIssue, type RequestContext, type ResizeVideoStepInput, type ResizeVideoStepOutput, type ResolvedUser, Roles, type RunAgentOptions, type RunAgentResult, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunPackagedWorkflowStepInput, type RunPackagedWorkflowStepOutput, type RunTaskOptions, type RunTaskResult, type ScrapeLinkedInCompanyStepInput, type ScrapeLinkedInCompanyStepOutput, type ScrapeLinkedInProfileStepInput, type ScrapeLinkedInProfileStepOutput, type ScrapeUrlStepInput, type ScrapeUrlStepOutput, type ScrapeXPostStepInput, type ScrapeXPostStepOutput, type ScrapeXProfileStepInput, type ScrapeXProfileStepOutput, type ScreenshotUrlStepInput, type ScreenshotUrlStepOutput, type SearchGmailEmailsStepInput, type SearchGmailEmailsStepOutput, type SearchGoogleCalendarEventsStepInput, type SearchGoogleCalendarEventsStepOutput, type SearchGoogleDriveStepInput, type SearchGoogleDriveStepOutput, type SearchGoogleImagesStepInput, type SearchGoogleImagesStepOutput, type SearchGoogleNewsStepInput, type SearchGoogleNewsStepOutput, type SearchGoogleStepInput, type SearchGoogleStepOutput, type SearchGoogleTrendsStepInput, type SearchGoogleTrendsStepOutput, type SearchPerplexityStepInput, type SearchPerplexityStepOutput, type SearchXPostsStepInput, type SearchXPostsStepOutput, type SearchYoutubeStepInput, type SearchYoutubeStepOutput, type SearchYoutubeTrendsStepInput, type SearchYoutubeTrendsStepOutput, type SendEmailStepInput, type SendEmailStepOutput, type SendGmailDraftStepInput, type SendGmailDraftStepOutput, type SendGmailMessageStepInput, type SendGmailMessageStepOutput, type SendSMSStepInput, type SendSMSStepOutput, type SendSlackDirectMessageStepInput, type SendSlackDirectMessageStepOutput, type SetGmailReadStatusStepInput, type SetGmailReadStatusStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepCostEstimateEntry, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepLogEvent, type StepMetadata, type StepMethods, type StepName, type StepOutputMap, Store, type StoredFile, type SystemFields, Table, type TaskEvent, type TaskToolCall, type TaskToolConfig, type TaskUsage, type TelegramEditMessageStepInput, type TelegramEditMessageStepOutput, type TelegramReplyToMessageStepInput, type TelegramReplyToMessageStepOutput, type TelegramSendAudioStepInput, type TelegramSendAudioStepOutput, type TelegramSendFileStepInput, type TelegramSendFileStepOutput, type TelegramSendImageStepInput, type TelegramSendImageStepOutput, type TelegramSendMessageStepInput, type TelegramSendMessageStepOutput, type TelegramSendVideoStepInput, type TelegramSendVideoStepOutput, type TelegramSetTypingStepInput, type TelegramSetTypingStepOutput, type TextToSpeechStepInput, type TextToSpeechStepOutput, type TranscribeAudioStepInput, type TranscribeAudioStepOutput, type TrimMediaStepInput, type TrimMediaStepOutput, type UpdateGmailLabelsStepInput, type UpdateGmailLabelsStepOutput, type UpdateGoogleCalendarEventStepInput, type UpdateGoogleCalendarEventStepOutput, type UpdateGoogleDocStepInput, type UpdateGoogleDocStepOutput, type UpdateGoogleSheetStepInput, type UpdateGoogleSheetStepOutput, type UpdateInput, type UploadDataSourceDocumentStepInput, type UploadDataSourceDocumentStepOutput, type UploadFileResult, type UploadToken, type UpscaleImageStepInput, type UpscaleImageStepOutput, type UpscaleVideoStepInput, type UpscaleVideoStepOutput, type User, type UserInfoResult, type UserMessageStepInput, type UserMessageStepOutput, type VideoFaceSwapStepInput, type VideoFaceSwapStepOutput, type VideoRemoveBackgroundStepInput, type VideoRemoveBackgroundStepOutput, type VideoRemoveWatermarkStepInput, type VideoRemoveWatermarkStepOutput, type Voice, type VoiceCallResult, type WatermarkImageStepInput, type WatermarkImageStepOutput, type WatermarkVideoStepInput, type WatermarkVideoStepOutput, type YouDotComFinanceResearchStepInput, type YouDotComFinanceResearchStepOutput, type YouDotComGetPageContentStepInput, type YouDotComGetPageContentStepOutput, type YouDotComLiveNewsStepInput, type YouDotComLiveNewsStepOutput, type YouDotComWebResearchStepInput, type YouDotComWebResearchStepOutput, type YouDotComWebSearchStepInput, type YouDotComWebSearchStepOutput, auth, blockTypeAliases, dataSources, db, mindstudio as default, files, getRequestContext, mindstudio, monacoSnippets, prerender, reportIssue, resolveUser, runWithContext, stepMetadata, stream, voice };
package/dist/index.js CHANGED
@@ -107,8 +107,16 @@ var WS_OPEN_TIMEOUT_MS = 5e3;
107
107
  var WS_OPEN = 1;
108
108
  var WS_MAX_FRAME_CHARS = 9e5;
109
109
  var DbWsTransportError = class extends Error {
110
+ constructor(message, sent = false) {
111
+ super(message);
112
+ this.sent = sent;
113
+ }
110
114
  name = "DbWsTransportError";
111
115
  };
116
+ function isReadOnlySql(sql) {
117
+ const head = sql.trimStart().slice(0, 8).toUpperCase();
118
+ return head.startsWith("SELECT") || head.startsWith("PRAGMA") || head.startsWith("EXPLAIN");
119
+ }
112
120
  var socket = null;
113
121
  var opening = null;
114
122
  var idCounter = 0;
@@ -136,7 +144,7 @@ function getOrOpen(url) {
136
144
  opening = null;
137
145
  for (const [, p] of pending) {
138
146
  clearTimeout(p.timer);
139
- p.reject(err);
147
+ p.reject(new DbWsTransportError(err.message, true));
140
148
  }
141
149
  pending.clear();
142
150
  reject(err);
@@ -206,7 +214,7 @@ async function executeDbBatchOverWs(url, token, databaseId, queries) {
206
214
  return await new Promise((resolve, reject) => {
207
215
  const timer = setTimeout(() => {
208
216
  pending.delete(id);
209
- reject(new DbWsTransportError("ws execute timed out"));
217
+ reject(new DbWsTransportError("ws execute timed out", true));
210
218
  }, WS_REQUEST_TIMEOUT_MS);
211
219
  pending.set(id, { resolve, reject, timer });
212
220
  try {
@@ -215,7 +223,10 @@ async function executeDbBatchOverWs(url, token, databaseId, queries) {
215
223
  clearTimeout(timer);
216
224
  pending.delete(id);
217
225
  reject(
218
- new DbWsTransportError(`ws send failed: ${err?.message || "unknown"}`)
226
+ new DbWsTransportError(
227
+ `ws send failed: ${err?.message || "unknown"}`,
228
+ false
229
+ )
219
230
  );
220
231
  }
221
232
  });
@@ -2145,6 +2156,10 @@ var DataSource = class {
2145
2156
  query,
2146
2157
  ...options?.topK !== void 0 ? { topK: options.topK } : {},
2147
2158
  ...options?.scoreThreshold !== void 0 ? { scoreThreshold: options.scoreThreshold } : {},
2159
+ ...options?.filter !== void 0 ? { filter: options.filter } : {},
2160
+ ...options?.mode !== void 0 ? { mode: options.mode } : {},
2161
+ ...options?.maxPerDocument !== void 0 ? { maxPerDocument: options.maxPerDocument } : {},
2162
+ ...options?.highlight !== void 0 ? { highlight: options.highlight } : {},
2148
2163
  ...options?.rerank !== void 0 ? { rerank: options.rerank } : {},
2149
2164
  ...options?.hybrid !== void 0 ? { hybrid: options.hybrid } : {},
2150
2165
  ...options?.explain !== void 0 ? { explain: options.explain } : {},
@@ -2200,6 +2215,7 @@ var DataSource = class {
2200
2215
  slug: this._slug,
2201
2216
  filename: options.filename,
2202
2217
  ...options.contentType ? { contentType: options.contentType } : {},
2218
+ ...options.metadata !== void 0 ? { metadata: options.metadata } : {},
2203
2219
  body: bytes.toString("base64")
2204
2220
  });
2205
2221
  }
@@ -2243,6 +2259,18 @@ function createDataSources(call) {
2243
2259
  };
2244
2260
  }
2245
2261
 
2262
+ // src/voice/index.ts
2263
+ function createVoice(call) {
2264
+ return {
2265
+ async call(params) {
2266
+ return await call("call", {
2267
+ to: params.to,
2268
+ assumeIdentity: params.assumeIdentity === true
2269
+ });
2270
+ }
2271
+ };
2272
+ }
2273
+
2246
2274
  // src/generated/metadata.ts
2247
2275
  var stepMetadata = {
2248
2276
  "activeCampaignAddNote": {
@@ -2509,8 +2537,8 @@ var stepMetadata = {
2509
2537
  "extractText": {
2510
2538
  stepType: "extractText",
2511
2539
  description: "Download a file from a URL and extract its text content. Supports PDFs (including scanned/image-based PDFs via OCR), plain text files, and other document formats.",
2512
- usageNotes: "- Best suited for PDFs and raw text/document files. For web pages, use the scrapeUrl step instead.\n- Handles both text-layer PDFs and image-based/scanned PDFs (e.g. Figma/Canva exports, scanned documents). Image-based PDFs are processed with OCR automatically \u2014 there is no need to convert PDF pages to images first.\n- Accepts a single URL, a comma-separated list of URLs, or a JSON array of URLs.\n- Files are rehosted on the MindStudio CDN before extraction.\n- Maximum file size is 50MB per URL.",
2513
- inputSchema: { "type": "object", "properties": { "url": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["url"] },
2540
+ usageNotes: "- Best suited for PDFs and raw text/document files. For web pages, use the scrapeUrl step instead.\n- Handles both text-layer PDFs and image-based/scanned PDFs (e.g. Figma/Canva exports, scanned documents). Image-based PDFs are processed with OCR automatically \u2014 there is no need to convert PDF pages to images first.\n- Accepts a single URL, a comma-separated list of URLs, or a JSON array of URLs.\n- Files are rehosted on the MindStudio CDN before extraction.\n- Optionally set `model` to a specific document-extraction model (`mistral-ocr-latest`, `llamaparse`, `google-document-ai`); omit to use the platform default.\n- Maximum file size is 50MB per URL.",
2541
+ inputSchema: { "type": "object", "properties": { "url": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] }, "model": { "type": "string", "description": "Optional extraction model id (a `document_extraction` model, e.g. `mistral-ocr-latest`, `llamaparse`, `google-document-ai`). Defaults to the platform default when omitted." } }, "required": ["url"] },
2514
2542
  outputSchema: { "type": "object", "properties": { "text": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["text"] }
2515
2543
  },
2516
2544
  "fetchDataSourceDocument": {
@@ -4258,6 +4286,7 @@ var MindStudioAgent = class {
4258
4286
  /** @internal Cached Files namespace instance (lazy; no context hydration needed). */
4259
4287
  _files;
4260
4288
  _dataSources;
4289
+ _voice;
4261
4290
  /** @internal Auth type — 'internal' for CALLBACK_TOKEN (managed mode), 'apiKey' otherwise. */
4262
4291
  _authType;
4263
4292
  /** @internal Usage source sent on step executions (from MINDSTUDIO_REQUEST_SOURCE).
@@ -4353,7 +4382,9 @@ var MindStudioAgent = class {
4353
4382
  ...options?.appId != null && { appId: options.appId },
4354
4383
  ...threadId != null && { threadId },
4355
4384
  ...this._currentStreamId != null && { streamId: this._currentStreamId },
4356
- ...this._requestSource != null && { requestSource: this._requestSource },
4385
+ ...this._requestSource != null && {
4386
+ requestSource: this._requestSource
4387
+ },
4357
4388
  ...assetStoreBody(options?.store)
4358
4389
  });
4359
4390
  const remaining = headers.get("x-ratelimit-remaining");
@@ -4438,7 +4469,9 @@ var MindStudioAgent = class {
4438
4469
  ...options.appId != null && { appId: options.appId },
4439
4470
  ...threadId != null && { threadId },
4440
4471
  ...this._currentStreamId != null && { streamId: this._currentStreamId },
4441
- ...this._requestSource != null && { requestSource: this._requestSource },
4472
+ ...this._requestSource != null && {
4473
+ requestSource: this._requestSource
4474
+ },
4442
4475
  ...assetStoreBody(options.store)
4443
4476
  };
4444
4477
  await this._httpConfig.rateLimiter.acquire();
@@ -4626,7 +4659,9 @@ var MindStudioAgent = class {
4626
4659
  })),
4627
4660
  ...options?.appId != null && { appId: options.appId },
4628
4661
  ...threadId != null && { threadId },
4629
- ...this._requestSource != null && { requestSource: this._requestSource },
4662
+ ...this._requestSource != null && {
4663
+ requestSource: this._requestSource
4664
+ },
4630
4665
  ...assetStoreBody(options?.store)
4631
4666
  });
4632
4667
  const pollUrl = `${this._currentHttpConfig.baseUrl}/developer/v2/steps/execute-batch-async/poll/${asyncData.batchToken}`;
@@ -5166,6 +5201,17 @@ var MindStudioAgent = class {
5166
5201
  this._dataSourcesRequest.bind(this)
5167
5202
  );
5168
5203
  }
5204
+ /**
5205
+ * Telephony: outbound calls answered by this app's voice agent.
5206
+ *
5207
+ * @example
5208
+ * ```ts
5209
+ * await agent.voice.call({ to: '+13105551234', assumeIdentity: true });
5210
+ * ```
5211
+ */
5212
+ get voice() {
5213
+ return this._voice ??= createVoice(this._voiceRequest.bind(this));
5214
+ }
5169
5215
  /**
5170
5216
  * @internal Transport for the `files` namespace — POST /_internal/v2/files/<op>
5171
5217
  * with the raw hook token (mirrors `_executeDbBatch`).
@@ -5186,6 +5232,16 @@ var MindStudioAgent = class {
5186
5232
  fallbackCode: "data_source_error"
5187
5233
  });
5188
5234
  }
5235
+ /**
5236
+ * @internal Transport for the `voice` namespace —
5237
+ * POST /_internal/v2/voice/<op> with the raw hook token.
5238
+ */
5239
+ async _voiceRequest(op, body) {
5240
+ return this._brokeredRequest("voice", op, body, {
5241
+ fallbackMessage: "Voice operation failed",
5242
+ fallbackCode: "voice_error"
5243
+ });
5244
+ }
5189
5245
  /**
5190
5246
  * @internal Shared shape for the brokered `/_internal/v2/<ns>/<op>` data
5191
5247
  * planes. Factored out rather than copied per namespace so error handling
@@ -5242,6 +5298,13 @@ var MindStudioAgent = class {
5242
5298
  if (!(err instanceof DbWsTransportError)) {
5243
5299
  throw err;
5244
5300
  }
5301
+ if (err.sent && queries.some((q) => !isReadOnlySql(q.sql))) {
5302
+ throw new MindStudioError(
5303
+ "[db] Connection was interrupted after this query was sent; because it contains a write, it was not automatically retried (the write may or may not have been applied). Verify the current state before re-running it.",
5304
+ "db_transport_interrupted",
5305
+ 503
5306
+ );
5307
+ }
5245
5308
  console.warn(
5246
5309
  `[mindstudio] db: WebSocket transport unavailable (${err.message}); using HTTP for this query.`
5247
5310
  );
@@ -5632,7 +5695,10 @@ var MindStudioAgent = class {
5632
5695
  content.byteOffset,
5633
5696
  content.byteOffset + content.byteLength
5634
5697
  );
5635
- const fileBlob = new Blob([buf], options.type ? { type: options.type } : void 0);
5698
+ const fileBlob = new Blob(
5699
+ [buf],
5700
+ options.type ? { type: options.type } : void 0
5701
+ );
5636
5702
  form.append("file", fileBlob, filename);
5637
5703
  const res = await fetch(data.url, { method: "POST", body: form });
5638
5704
  if (!res.ok) {
@@ -5915,6 +5981,13 @@ var dataSources = new Proxy(
5915
5981
  }
5916
5982
  }
5917
5983
  );
5984
+ var voice = new Proxy({}, {
5985
+ get(_, prop) {
5986
+ const target = mindstudio.voice;
5987
+ const value = Reflect.get(target, prop, target);
5988
+ return typeof value === "function" ? value.bind(target) : value;
5989
+ }
5990
+ });
5918
5991
  var stream = (data) => mindstudio.stream(data);
5919
5992
  var resolveUser = (userId) => mindstudio.resolveUser(userId);
5920
5993
  var reportIssue = (input) => mindstudio.reportIssue(input);
@@ -5940,6 +6013,7 @@ export {
5940
6013
  resolveUser,
5941
6014
  runWithContext,
5942
6015
  stepMetadata,
5943
- stream
6016
+ stream,
6017
+ voice
5944
6018
  };
5945
6019
  //# sourceMappingURL=index.js.map