@mindstudio-ai/agent 0.1.157 → 0.1.159
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/cli.js +10 -8
- package/dist/index.d.ts +70 -1
- package/dist/index.js +131 -4
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +10 -8
- package/llms.txt +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -11722,6 +11722,7 @@ interface StepMethods {
|
|
|
11722
11722
|
* - `subtitles: 'srt' | 'vtt'` — also return the transcript as a subtitle file, in the `subtitles` output, timed by the segments. Any model that returns segments.
|
|
11723
11723
|
* - gemini-3.5-transcribe can't take `keyterms` together with speakers, word timings or subtitles, and voxtral-mini-transcribe-2 can't take `language` together with word timings or subtitles; either asked for both is refused.
|
|
11724
11724
|
* - The `segments` output carries timings, confidence and speakers as structured data, so there is no need to slice the audio up to recover them. It is populated by Scribe, deepgram-nova-3, grok-stt, whisper-1, gpt-4o-transcribe-diarize, voxtral-mini-transcribe-2 (unless given a language), gemini-3.5-transcribe (with word timings or subtitles) and the DeepInfra-served whisper and qwen models, and absent for models that return nothing but text (gpt-transcribe, gpt-4o-transcribe, gpt-4o-mini-transcribe, the DeepInfra-served voxtral models).
|
|
11725
|
+
* - In a workflow, `destinationVar` receives the transcript text. Name `segmentsVar` to also keep the `segments` array. A model that returns no segments leaves that variable unset.
|
|
11725
11726
|
* - A recording of any length can be transcribed. One longer than a model takes at once (OpenAI's and DeepInfra's models, Gemini) is transcribed in pieces and joined, its timings running from the start of the recording. Speakers can't be followed from one piece to the next, so with speakers on, such a recording is refused; Scribe and Deepgram label speakers at any length.
|
|
11726
11727
|
* - `confidence` is always 0..1 with higher meaning more confident, whichever model produced it.
|
|
11727
11728
|
*
|
|
@@ -12102,6 +12103,74 @@ declare class MindStudioError extends Error {
|
|
|
12102
12103
|
toJSON(): Record<string, unknown>;
|
|
12103
12104
|
}
|
|
12104
12105
|
|
|
12106
|
+
/** The largest inline body, in bytes. A larger one is a stored file: `respond.file`. */
|
|
12107
|
+
declare const RESPONSE_BODY_MAX_BYTES: number;
|
|
12108
|
+
/** Response headers. An array sends the header once per value (`Set-Cookie`). */
|
|
12109
|
+
type HttpResponseHeaders = Record<string, string | string[]>;
|
|
12110
|
+
interface HttpResponseInit {
|
|
12111
|
+
/** 200 to 599. Defaults to 200. */
|
|
12112
|
+
status?: number;
|
|
12113
|
+
headers?: HttpResponseHeaders;
|
|
12114
|
+
}
|
|
12115
|
+
interface HttpResponseOptions extends HttpResponseInit {
|
|
12116
|
+
/** Text, or bytes (`Uint8Array` or `Buffer`). */
|
|
12117
|
+
body?: string | Uint8Array;
|
|
12118
|
+
}
|
|
12119
|
+
/** A stored file to answer with: what a store's `put`, `get` or `list` returns. */
|
|
12120
|
+
interface HttpResponseFile {
|
|
12121
|
+
store: string;
|
|
12122
|
+
key: string;
|
|
12123
|
+
access: FileAccess;
|
|
12124
|
+
}
|
|
12125
|
+
/** A response a method returns. Build one with {@link respond}. */
|
|
12126
|
+
declare class HttpResponse {
|
|
12127
|
+
readonly status: number;
|
|
12128
|
+
readonly headers: HttpResponseHeaders;
|
|
12129
|
+
readonly body?: string | Uint8Array;
|
|
12130
|
+
readonly file?: HttpResponseFile;
|
|
12131
|
+
constructor(options: HttpResponseOptions & {
|
|
12132
|
+
file?: HttpResponseFile;
|
|
12133
|
+
});
|
|
12134
|
+
toJSON(): Record<string, unknown>;
|
|
12135
|
+
}
|
|
12136
|
+
/**
|
|
12137
|
+
* Answer an API or webhook request with an HTTP response of the method's own:
|
|
12138
|
+
* a status, headers and a text or binary body.
|
|
12139
|
+
*
|
|
12140
|
+
* Only for a method whose answer is HTTP itself. A method that returns data
|
|
12141
|
+
* keeps returning it, and every caller gets it; a method that returns a
|
|
12142
|
+
* response can only be called through the API and webhook interfaces. A
|
|
12143
|
+
* failure any caller should see is still a thrown `MindStudioError`.
|
|
12144
|
+
*
|
|
12145
|
+
* @example
|
|
12146
|
+
* ```ts
|
|
12147
|
+
* import { respond } from '@mindstudio-ai/agent';
|
|
12148
|
+
*
|
|
12149
|
+
* export async function voiceCall() {
|
|
12150
|
+
* return respond.text('<Response><Say>Hello</Say></Response>', {
|
|
12151
|
+
* headers: { 'Content-Type': 'text/xml' },
|
|
12152
|
+
* });
|
|
12153
|
+
* }
|
|
12154
|
+
* ```
|
|
12155
|
+
*/
|
|
12156
|
+
declare const respond: ((options?: HttpResponseOptions) => HttpResponse) & {
|
|
12157
|
+
/** Text, as `text/plain; charset=utf-8` unless the headers name a type. */
|
|
12158
|
+
text(body: string, init?: HttpResponseInit): HttpResponse;
|
|
12159
|
+
/** JSON, with a status or headers of the method's choosing. */
|
|
12160
|
+
json(value: unknown, init?: HttpResponseInit): HttpResponse;
|
|
12161
|
+
/** A redirect: 301, 302 (the default), 303, 307 or 308. */
|
|
12162
|
+
redirect(url: string, status?: number): HttpResponse;
|
|
12163
|
+
/**
|
|
12164
|
+
* A stored file, sent at the request's own URL with no redirect for the
|
|
12165
|
+
* client to follow. The bytes come straight from storage, never through
|
|
12166
|
+
* the method, so a file of any size works, and range requests too. The
|
|
12167
|
+
* stored content type is sent unless the headers name one.
|
|
12168
|
+
*/
|
|
12169
|
+
file(file: HttpResponseFile, init?: {
|
|
12170
|
+
headers?: HttpResponseHeaders;
|
|
12171
|
+
}): HttpResponse;
|
|
12172
|
+
};
|
|
12173
|
+
|
|
12105
12174
|
/**
|
|
12106
12175
|
* AsyncLocalStorage-based request context for concurrent execution.
|
|
12107
12176
|
*
|
|
@@ -12890,4 +12959,4 @@ declare const prerender: {
|
|
|
12890
12959
|
}>;
|
|
12891
12960
|
};
|
|
12892
12961
|
|
|
12893
|
-
export { type Accessor, type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, type AddThumbnailToVideoStepInput, type AddThumbnailToVideoStepOutput, type AgentInfo, type AgentOptions, type AggregateRow, type AggregateSelect, type AggregateTerm, type AiSourceVendor, type AirtableCreateUpdateRecordStepInput, type AirtableCreateUpdateRecordStepOutput, type AirtableDeleteRecordStepInput, type AirtableDeleteRecordStepOutput, type AirtableGetRecordStepInput, type AirtableGetRecordStepOutput, type AirtableGetTableRecordsStepInput, type AirtableGetTableRecordsStepOutput, type Analytics, type AnalyticsDateRange, type AnalyticsDimension, type AnalyticsFilter, type AnalyticsFilterOp, type AnalyticsGranularity, type AnalyticsMetric, type AnalyticsQueryResponse, type AnalyticsQueryResultRow, type AnalyticsQuerySpec, type AnalyticsReadOptions, 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 Batchable, 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 CrawlerBucket, type CrawlerHit, type CrawlerOverview, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGmailDraftStepInput, type CreateGmailDraftStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type Db, type DecomposeImageStepInput, type DecomposeImageStepOutput, 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 DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, type EvaluateDecisionStepInput, type EvaluateDecisionStepOutput, type EventGrantOptions, type EventGrantResult, type Events, 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 FromSchema, type Generate3dModelStepInput, type Generate3dModelStepOutput, type GenerateAssetStepInput, type GenerateAssetStepOutput, type GenerateImageStepInput, type GenerateImageStepOutput, type GenerateLipsyncStepInput, type GenerateLipsyncStepOutput, type GenerateMusicStepInput, type GenerateMusicStepOutput, type GeneratePdfStepInput, type GeneratePdfStepOutput, type GenerateSoundStepInput, type GenerateSoundStepOutput, 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 GetStreamOptions, 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 ImportFromUrlStepInput, type ImportFromUrlStepOutput, type InsertVideoClipsStepInput, type InsertVideoClipsStepOutput, type Jewel, type JewelConfig, type JewelGradeContext, type JewelMethod, type JewelMethodInput, type JewelPairRecord, type JewelProposal, type JewelProposeOutcome, type JewelProposeResult, type JewelQueueItem, type JewelQueueResolution, type JewelQueueResolveResult, type JewelRunParams, type JewelVerdict, type JewelsApi, type JsonObjectSchema, type JsonSchema, type JsonSchemaTypeName, 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 LiveNow, type LogicStepInput, type LogicStepOutput, MAX_EVENT_PAYLOAD_CHARS, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MapObject, type MapOutcome, type MapPoint, type MapRunObject, type MapRunOutcome, type MapRunParams, type MapRunRecord, type MapRunResult, type MappedDocument, type Mapper, type MapperConfig, 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 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, type PutStream, Query, type QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type QuickbooksApiRequestStepInput, type QuickbooksApiRequestStepOutput, RawQuery, type ReadDelivery, type ReadRunParams, type ReadRunRecord, type ReadRunResult, type Reader, type ReaderConfig, type ReaderDocument, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type RenderVideoFromHtmlCompositionStepInput, type RenderVideoFromHtmlCompositionStepOutput, type ReplyToGmailEmailStepInput, type ReplyToGmailEmailStepOutput, type ReportIssueInput, type ReportedIssue, type RequestContext, type ResizeVideoStepInput, type ResizeVideoStepOutput, type ResolvedUser, Roles, type RunAgentOptions, type RunAgentResult, type RunFfmpegStepInput, type RunFfmpegStepOutput, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunTaskOptions, type RunTaskOptionsWithExample, type RunTaskOptionsWithSchema, type RunTaskResult, type SchemaValidationError, 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 SessionContext, 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 TextToSpeechStepInput, type TextToSpeechStepOutput, type TopSource, type TranscribeAudioStepInput, type TranscribeAudioStepOutput, type TrimMediaStepInput, type TrimMediaStepOutput, type TypesafeEvaluateStepInput, type TypesafeEvaluateStepOutput, 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, analytics, auth, blockTypeAliases, dataSources, db, mindstudio as default, defineJewel, defineMapper, defineReader, deletes, documents, email, events, files, getRequestContext, mindstudio, monacoSnippets, passthrough, prerender, reportIssue, resolveUser, runWithContext, session, skip, stepMetadata, stream, voice, waitUntil };
|
|
12962
|
+
export { type Accessor, type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, type AddThumbnailToVideoStepInput, type AddThumbnailToVideoStepOutput, type AgentInfo, type AgentOptions, type AggregateRow, type AggregateSelect, type AggregateTerm, type AiSourceVendor, type AirtableCreateUpdateRecordStepInput, type AirtableCreateUpdateRecordStepOutput, type AirtableDeleteRecordStepInput, type AirtableDeleteRecordStepOutput, type AirtableGetRecordStepInput, type AirtableGetRecordStepOutput, type AirtableGetTableRecordsStepInput, type AirtableGetTableRecordsStepOutput, type Analytics, type AnalyticsDateRange, type AnalyticsDimension, type AnalyticsFilter, type AnalyticsFilterOp, type AnalyticsGranularity, type AnalyticsMetric, type AnalyticsQueryResponse, type AnalyticsQueryResultRow, type AnalyticsQuerySpec, type AnalyticsReadOptions, 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 Batchable, 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 CrawlerBucket, type CrawlerHit, type CrawlerOverview, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGmailDraftStepInput, type CreateGmailDraftStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type Db, type DecomposeImageStepInput, type DecomposeImageStepOutput, 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 DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, type EvaluateDecisionStepInput, type EvaluateDecisionStepOutput, type EventGrantOptions, type EventGrantResult, type Events, 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 FromSchema, type Generate3dModelStepInput, type Generate3dModelStepOutput, type GenerateAssetStepInput, type GenerateAssetStepOutput, type GenerateImageStepInput, type GenerateImageStepOutput, type GenerateLipsyncStepInput, type GenerateLipsyncStepOutput, type GenerateMusicStepInput, type GenerateMusicStepOutput, type GeneratePdfStepInput, type GeneratePdfStepOutput, type GenerateSoundStepInput, type GenerateSoundStepOutput, 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 GetStreamOptions, HttpResponse, type HttpResponseFile, type HttpResponseHeaders, type HttpResponseInit, type HttpResponseOptions, 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 ImportFromUrlStepInput, type ImportFromUrlStepOutput, type InsertVideoClipsStepInput, type InsertVideoClipsStepOutput, type Jewel, type JewelConfig, type JewelGradeContext, type JewelMethod, type JewelMethodInput, type JewelPairRecord, type JewelProposal, type JewelProposeOutcome, type JewelProposeResult, type JewelQueueItem, type JewelQueueResolution, type JewelQueueResolveResult, type JewelRunParams, type JewelVerdict, type JewelsApi, type JsonObjectSchema, type JsonSchema, type JsonSchemaTypeName, 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 LiveNow, type LogicStepInput, type LogicStepOutput, MAX_EVENT_PAYLOAD_CHARS, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MapObject, type MapOutcome, type MapPoint, type MapRunObject, type MapRunOutcome, type MapRunParams, type MapRunRecord, type MapRunResult, type MappedDocument, type Mapper, type MapperConfig, 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 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, type PutStream, Query, type QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type QuickbooksApiRequestStepInput, type QuickbooksApiRequestStepOutput, RESPONSE_BODY_MAX_BYTES, RawQuery, type ReadDelivery, type ReadRunParams, type ReadRunRecord, type ReadRunResult, type Reader, type ReaderConfig, type ReaderDocument, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type RenderVideoFromHtmlCompositionStepInput, type RenderVideoFromHtmlCompositionStepOutput, type ReplyToGmailEmailStepInput, type ReplyToGmailEmailStepOutput, type ReportIssueInput, type ReportedIssue, type RequestContext, type ResizeVideoStepInput, type ResizeVideoStepOutput, type ResolvedUser, Roles, type RunAgentOptions, type RunAgentResult, type RunFfmpegStepInput, type RunFfmpegStepOutput, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunTaskOptions, type RunTaskOptionsWithExample, type RunTaskOptionsWithSchema, type RunTaskResult, type SchemaValidationError, 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 SessionContext, 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 TextToSpeechStepInput, type TextToSpeechStepOutput, type TopSource, type TranscribeAudioStepInput, type TranscribeAudioStepOutput, type TrimMediaStepInput, type TrimMediaStepOutput, type TypesafeEvaluateStepInput, type TypesafeEvaluateStepOutput, 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, analytics, auth, blockTypeAliases, dataSources, db, mindstudio as default, defineJewel, defineMapper, defineReader, deletes, documents, email, events, files, getRequestContext, mindstudio, monacoSnippets, passthrough, prerender, reportIssue, resolveUser, respond, runWithContext, session, skip, stepMetadata, stream, voice, waitUntil };
|
package/dist/index.js
CHANGED
|
@@ -5121,7 +5121,7 @@ var stepMetadata = {
|
|
|
5121
5121
|
"transcribeAudio": {
|
|
5122
5122
|
stepType: "transcribeAudio",
|
|
5123
5123
|
description: "Convert an audio file to text using a transcription model.",
|
|
5124
|
-
usageNotes: "- The default model is elevenlabs-scribe-v2: speakers, word timings, key terms and redaction, at any length.\n- The prompt field gives context (speaker names, domain) to OpenAI's and DeepInfra's models. Other models ignore it; give them `keyterms` instead.\n- Options go in `transcriptionModelOverride.config`, and support varies by model:\n - `language` \u2014 the spoken language as a code such as `en` or `es`; left out, the model detects it. Every model takes it. deepgram-nova-3 assumes `en` unless told, and also takes `multi` for speech that switches language (billed at its multilingual rate).\n - `detectLanguage: 'yes'` \u2014 detect the language instead of assuming English (deepgram-nova-3 only).\n - `includeSpeakers: 'yes'` \u2014 label each passage with a speaker. Supported by elevenlabs-scribe-v2, elevenlabs-scribe-v2-medical, deepgram-nova-3, grok-stt, voxtral-mini-transcribe-2 and gemini-3.5-transcribe; gpt-4o-transcribe-diarize always does. Scribe and Voxtral also switch `text` to a timestamped, speaker-labelled block format; Deepgram, Gemini and gpt-4o-transcribe-diarize to `Speaker N:` lines.\n - `numSpeakers` \u2014 the most people talking, to help tell them apart (Scribe).\n - `keyterms` \u2014 a list of names, products and terms the audio contains, so they're spelled right. Supported by gpt-transcribe, Scribe, deepgram-nova-3, grok-stt, voxtral-mini-transcribe-2 and gemini-3.5-transcribe. Billed as an add-on on Scribe and Deepgram.\n - `redactPii: 'yes'` \u2014 replace names, phone numbers, addresses and other personal information with a label of what was there (Scribe, deepgram-nova-3). Billed as an add-on.\n - `includeWordTimings: 'yes'` \u2014 add per-word timings and confidence inside each segment. Supported by Scribe, deepgram-nova-3, whisper-1, grok-stt, voxtral-mini-transcribe-2 and gemini-3.5-transcribe. Off by default because an hour of speech is roughly ten thousand words.\n - `subtitles: 'srt' | 'vtt'` \u2014 also return the transcript as a subtitle file, in the `subtitles` output, timed by the segments. Any model that returns segments.\n- gemini-3.5-transcribe can't take `keyterms` together with speakers, word timings or subtitles, and voxtral-mini-transcribe-2 can't take `language` together with word timings or subtitles; either asked for both is refused.\n- The `segments` output carries timings, confidence and speakers as structured data, so there is no need to slice the audio up to recover them. It is populated by Scribe, deepgram-nova-3, grok-stt, whisper-1, gpt-4o-transcribe-diarize, voxtral-mini-transcribe-2 (unless given a language), gemini-3.5-transcribe (with word timings or subtitles) and the DeepInfra-served whisper and qwen models, and absent for models that return nothing but text (gpt-transcribe, gpt-4o-transcribe, gpt-4o-mini-transcribe, the DeepInfra-served voxtral models).\n- A recording of any length can be transcribed. One longer than a model takes at once (OpenAI's and DeepInfra's models, Gemini) is transcribed in pieces and joined, its timings running from the start of the recording. Speakers can't be followed from one piece to the next, so with speakers on, such a recording is refused; Scribe and Deepgram label speakers at any length.\n- `confidence` is always 0..1 with higher meaning more confident, whichever model produced it.",
|
|
5124
|
+
usageNotes: "- The default model is elevenlabs-scribe-v2: speakers, word timings, key terms and redaction, at any length.\n- The prompt field gives context (speaker names, domain) to OpenAI's and DeepInfra's models. Other models ignore it; give them `keyterms` instead.\n- Options go in `transcriptionModelOverride.config`, and support varies by model:\n - `language` \u2014 the spoken language as a code such as `en` or `es`; left out, the model detects it. Every model takes it. deepgram-nova-3 assumes `en` unless told, and also takes `multi` for speech that switches language (billed at its multilingual rate).\n - `detectLanguage: 'yes'` \u2014 detect the language instead of assuming English (deepgram-nova-3 only).\n - `includeSpeakers: 'yes'` \u2014 label each passage with a speaker. Supported by elevenlabs-scribe-v2, elevenlabs-scribe-v2-medical, deepgram-nova-3, grok-stt, voxtral-mini-transcribe-2 and gemini-3.5-transcribe; gpt-4o-transcribe-diarize always does. Scribe and Voxtral also switch `text` to a timestamped, speaker-labelled block format; Deepgram, Gemini and gpt-4o-transcribe-diarize to `Speaker N:` lines.\n - `numSpeakers` \u2014 the most people talking, to help tell them apart (Scribe).\n - `keyterms` \u2014 a list of names, products and terms the audio contains, so they're spelled right. Supported by gpt-transcribe, Scribe, deepgram-nova-3, grok-stt, voxtral-mini-transcribe-2 and gemini-3.5-transcribe. Billed as an add-on on Scribe and Deepgram.\n - `redactPii: 'yes'` \u2014 replace names, phone numbers, addresses and other personal information with a label of what was there (Scribe, deepgram-nova-3). Billed as an add-on.\n - `includeWordTimings: 'yes'` \u2014 add per-word timings and confidence inside each segment. Supported by Scribe, deepgram-nova-3, whisper-1, grok-stt, voxtral-mini-transcribe-2 and gemini-3.5-transcribe. Off by default because an hour of speech is roughly ten thousand words.\n - `subtitles: 'srt' | 'vtt'` \u2014 also return the transcript as a subtitle file, in the `subtitles` output, timed by the segments. Any model that returns segments.\n- gemini-3.5-transcribe can't take `keyterms` together with speakers, word timings or subtitles, and voxtral-mini-transcribe-2 can't take `language` together with word timings or subtitles; either asked for both is refused.\n- The `segments` output carries timings, confidence and speakers as structured data, so there is no need to slice the audio up to recover them. It is populated by Scribe, deepgram-nova-3, grok-stt, whisper-1, gpt-4o-transcribe-diarize, voxtral-mini-transcribe-2 (unless given a language), gemini-3.5-transcribe (with word timings or subtitles) and the DeepInfra-served whisper and qwen models, and absent for models that return nothing but text (gpt-transcribe, gpt-4o-transcribe, gpt-4o-mini-transcribe, the DeepInfra-served voxtral models).\n- In a workflow, `destinationVar` receives the transcript text. Name `segmentsVar` to also keep the `segments` array. A model that returns no segments leaves that variable unset.\n- A recording of any length can be transcribed. One longer than a model takes at once (OpenAI's and DeepInfra's models, Gemini) is transcribed in pieces and joined, its timings running from the start of the recording. Speakers can't be followed from one piece to the next, so with speakers on, such a recording is refused; Scribe and Deepgram label speakers at any length.\n- `confidence` is always 0..1 with higher meaning more confident, whichever model produced it.",
|
|
5125
5125
|
inputSchema: { "type": "object", "properties": { "audioUrl": { "type": "string", "description": "URL of the audio file to transcribe" }, "prompt": { "type": "string", "description": "Optional context to improve transcription accuracy (e.g. language, speaker names, domain terms)" }, "transcriptionModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "Audio transcription model identifier" }, "config": { "type": "object", "properties": {}, "required": [], "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default transcription model if not specified" } }, "required": ["audioUrl", "prompt"] },
|
|
5126
5126
|
outputSchema: { "type": "object", "properties": { "text": { "type": "string", "description": "The transcribed text from the audio file" }, "segments": { "type": "array", "items": { "type": "object", "properties": { "start": { "type": "number", "description": "Seconds from the start of the audio." }, "end": { "type": "number" }, "text": { "type": "string", "description": "The passage, spacing normalized." }, "confidence": { "type": "number", "description": "How sure the model was, always `0..1` with higher meaning more confident \u2014 whatever the provider reported.\n\nNormalizing this is the whole point of the type. Providers disagree on both the scale and the direction: Deepgram reports a probability in `0..1`, ElevenLabs and Whisper report a log probability in `(-inf, 0]`. Handing those through untouched would make `confidence < 0.5` mean opposite things depending on which model the caller happened to pick. Log probabilities are converted with `Math.exp`; probabilities pass through." }, "speaker": { "type": "string", "description": "Present only when diarization was asked for and the provider supports it." }, "language": { "type": "string", "description": "Present only for providers that report language per passage rather than per request. Most report it once for the whole audio \u2014 see `TranscriptionResponse.language`." }, "words": { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string" }, "start": { "type": "number", "description": "Seconds from the start of the audio." }, "end": { "type": "number" }, "confidence": { "type": "number", "description": "See the confidence convention on `TranscriptSegment`." }, "speaker": { "type": "string", "description": "Provider-assigned speaker id, present only when diarization was asked for." } }, "required": ["text"], "description": "One recognized token.\n\n`text` rather than `word` because an entry is not always a word \u2014 providers emit punctuation, spacing and non-speech audio events (laughter, footsteps) through the same channel." }, "description": "Word-level detail, when the caller asked for it (`includeWordTimings`). Off by default: an hour of speech is roughly ten thousand words, an order of magnitude more payload than the segments that contain them." } }, "required": ["start", "end", "text"], "description": "A contiguous passage of one speaker's speech, bounded in time.\n\nThe unit a review UI works in: short enough to seek to and highlight, coarse enough that an hour of audio is a few hundred entries rather than ten thousand." }, "description": "Timed passages with per-segment confidence, speaker attribution and optional word-level detail \u2014 see the step's usage notes for which models populate it. Absent for models that return nothing but text." }, "language": { "type": "string", "description": "Detected or declared language of the audio, when the model reports it." }, "durationSeconds": { "type": "number", "description": "Length of the transcribed audio, when the model reports it." }, "subtitles": { "type": "string", "description": "The transcript as an SRT or WebVTT file, when `subtitles` was asked for in the model's config and the model returned segments to time it by." } }, "required": ["text"] }
|
|
5127
5127
|
},
|
|
@@ -8386,6 +8386,130 @@ function resolveToken(provided, config) {
|
|
|
8386
8386
|
);
|
|
8387
8387
|
}
|
|
8388
8388
|
|
|
8389
|
+
// src/respond.ts
|
|
8390
|
+
var RESPONSE_BODY_MAX_BYTES = 5 * 1024 * 1024;
|
|
8391
|
+
var TOKEN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
8392
|
+
var HEADER_VALUE = /^[\t\x20-\x7e\x80-\xff]*$/;
|
|
8393
|
+
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
8394
|
+
var HttpResponse = class {
|
|
8395
|
+
status;
|
|
8396
|
+
headers;
|
|
8397
|
+
body;
|
|
8398
|
+
file;
|
|
8399
|
+
constructor(options) {
|
|
8400
|
+
const status = options.status ?? 200;
|
|
8401
|
+
if (!Number.isInteger(status) || status < 200 || status > 599) {
|
|
8402
|
+
throw invalid(
|
|
8403
|
+
`status must be a whole number from 200 to 599, not ${status}`
|
|
8404
|
+
);
|
|
8405
|
+
}
|
|
8406
|
+
const headers = options.headers ?? {};
|
|
8407
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
8408
|
+
if (!TOKEN.test(name)) {
|
|
8409
|
+
throw invalid(`"${name}" isn't a valid header name`);
|
|
8410
|
+
}
|
|
8411
|
+
for (const one of Array.isArray(value) ? value : [value]) {
|
|
8412
|
+
if (typeof one !== "string" || !HEADER_VALUE.test(one)) {
|
|
8413
|
+
throw invalid(
|
|
8414
|
+
`header "${name}" must be a string of printable Latin-1 characters, with no line breaks`
|
|
8415
|
+
);
|
|
8416
|
+
}
|
|
8417
|
+
}
|
|
8418
|
+
}
|
|
8419
|
+
if (options.body !== void 0) {
|
|
8420
|
+
const bytes = typeof options.body === "string" ? Buffer.byteLength(options.body) : options.body.byteLength;
|
|
8421
|
+
if (bytes > RESPONSE_BODY_MAX_BYTES) {
|
|
8422
|
+
throw invalid(
|
|
8423
|
+
`the body is ${bytes} bytes, over the ${RESPONSE_BODY_MAX_BYTES} limit; put it in a store and answer with respond.file`
|
|
8424
|
+
);
|
|
8425
|
+
}
|
|
8426
|
+
}
|
|
8427
|
+
this.status = status;
|
|
8428
|
+
this.headers = headers;
|
|
8429
|
+
this.body = options.body;
|
|
8430
|
+
this.file = options.file;
|
|
8431
|
+
}
|
|
8432
|
+
toJSON() {
|
|
8433
|
+
return {
|
|
8434
|
+
$mindstudio: "http-response",
|
|
8435
|
+
v: 1,
|
|
8436
|
+
status: this.status,
|
|
8437
|
+
headers: this.headers,
|
|
8438
|
+
...typeof this.body === "string" && { body: { text: this.body } },
|
|
8439
|
+
...this.body instanceof Uint8Array && {
|
|
8440
|
+
body: { base64: Buffer.from(this.body).toString("base64") }
|
|
8441
|
+
},
|
|
8442
|
+
...this.file && {
|
|
8443
|
+
file: {
|
|
8444
|
+
store: this.file.store,
|
|
8445
|
+
key: this.file.key,
|
|
8446
|
+
access: this.file.access
|
|
8447
|
+
}
|
|
8448
|
+
}
|
|
8449
|
+
};
|
|
8450
|
+
}
|
|
8451
|
+
};
|
|
8452
|
+
function invalid(message) {
|
|
8453
|
+
return new MindStudioError(
|
|
8454
|
+
`Invalid HTTP response: ${message}.`,
|
|
8455
|
+
"invalid_http_response",
|
|
8456
|
+
500
|
|
8457
|
+
);
|
|
8458
|
+
}
|
|
8459
|
+
function withDefault(headers, name, value) {
|
|
8460
|
+
const has = Object.keys(headers ?? {}).some(
|
|
8461
|
+
(key) => key.toLowerCase() === name.toLowerCase()
|
|
8462
|
+
);
|
|
8463
|
+
return has ? { ...headers } : { ...headers, [name]: value };
|
|
8464
|
+
}
|
|
8465
|
+
var respond = Object.assign(
|
|
8466
|
+
(options = {}) => new HttpResponse(options),
|
|
8467
|
+
{
|
|
8468
|
+
/** Text, as `text/plain; charset=utf-8` unless the headers name a type. */
|
|
8469
|
+
text(body, init = {}) {
|
|
8470
|
+
return new HttpResponse({
|
|
8471
|
+
...init,
|
|
8472
|
+
body,
|
|
8473
|
+
headers: withDefault(
|
|
8474
|
+
init.headers,
|
|
8475
|
+
"Content-Type",
|
|
8476
|
+
"text/plain; charset=utf-8"
|
|
8477
|
+
)
|
|
8478
|
+
});
|
|
8479
|
+
},
|
|
8480
|
+
/** JSON, with a status or headers of the method's choosing. */
|
|
8481
|
+
json(value, init = {}) {
|
|
8482
|
+
return new HttpResponse({
|
|
8483
|
+
...init,
|
|
8484
|
+
body: JSON.stringify(value),
|
|
8485
|
+
headers: withDefault(
|
|
8486
|
+
init.headers,
|
|
8487
|
+
"Content-Type",
|
|
8488
|
+
"application/json; charset=utf-8"
|
|
8489
|
+
)
|
|
8490
|
+
});
|
|
8491
|
+
},
|
|
8492
|
+
/** A redirect: 301, 302 (the default), 303, 307 or 308. */
|
|
8493
|
+
redirect(url, status = 302) {
|
|
8494
|
+
if (!REDIRECT_STATUSES.has(status)) {
|
|
8495
|
+
throw invalid(
|
|
8496
|
+
`a redirect's status is 301, 302, 303, 307 or 308, not ${status}`
|
|
8497
|
+
);
|
|
8498
|
+
}
|
|
8499
|
+
return new HttpResponse({ status, headers: { Location: url } });
|
|
8500
|
+
},
|
|
8501
|
+
/**
|
|
8502
|
+
* A stored file, sent at the request's own URL with no redirect for the
|
|
8503
|
+
* client to follow. The bytes come straight from storage, never through
|
|
8504
|
+
* the method, so a file of any size works, and range requests too. The
|
|
8505
|
+
* stored content type is sent unless the headers name one.
|
|
8506
|
+
*/
|
|
8507
|
+
file(file, init = {}) {
|
|
8508
|
+
return new HttpResponse({ headers: init.headers, file });
|
|
8509
|
+
}
|
|
8510
|
+
}
|
|
8511
|
+
);
|
|
8512
|
+
|
|
8389
8513
|
// src/jewel/index.ts
|
|
8390
8514
|
function errorInfo(e) {
|
|
8391
8515
|
if (e instanceof Error) {
|
|
@@ -8609,17 +8733,17 @@ function objectFor(input) {
|
|
|
8609
8733
|
var OUTCOME_KINDS = /* @__PURE__ */ new Set(["documents", "passthrough", "skip", "deletes"]);
|
|
8610
8734
|
function normalizeOutcome(value) {
|
|
8611
8735
|
const outcome = value;
|
|
8612
|
-
const
|
|
8736
|
+
const invalid2 = () => ({
|
|
8613
8737
|
kind: "error",
|
|
8614
8738
|
error: {
|
|
8615
8739
|
message: `map returned an invalid outcome: ${JSON.stringify(value)?.slice(0, 200)}. Return documents(), passthrough(), skip() or deletes().`
|
|
8616
8740
|
}
|
|
8617
8741
|
});
|
|
8618
8742
|
if (!outcome || typeof outcome !== "object" || !OUTCOME_KINDS.has(outcome.kind)) {
|
|
8619
|
-
return
|
|
8743
|
+
return invalid2();
|
|
8620
8744
|
}
|
|
8621
8745
|
if (outcome.kind === "documents" && !isIterable(outcome.documents) && !isAsyncIterable(outcome.documents)) {
|
|
8622
|
-
return
|
|
8746
|
+
return invalid2();
|
|
8623
8747
|
}
|
|
8624
8748
|
return outcome;
|
|
8625
8749
|
}
|
|
@@ -9213,9 +9337,11 @@ var prerender = {
|
|
|
9213
9337
|
};
|
|
9214
9338
|
export {
|
|
9215
9339
|
AuthContext,
|
|
9340
|
+
HttpResponse,
|
|
9216
9341
|
MAX_EVENT_PAYLOAD_CHARS,
|
|
9217
9342
|
MindStudioAgent2 as MindStudioAgent,
|
|
9218
9343
|
MindStudioError,
|
|
9344
|
+
RESPONSE_BODY_MAX_BYTES,
|
|
9219
9345
|
Roles,
|
|
9220
9346
|
analytics,
|
|
9221
9347
|
auth,
|
|
@@ -9238,6 +9364,7 @@ export {
|
|
|
9238
9364
|
prerender,
|
|
9239
9365
|
reportIssue,
|
|
9240
9366
|
resolveUser,
|
|
9367
|
+
respond,
|
|
9241
9368
|
runWithContext,
|
|
9242
9369
|
session,
|
|
9243
9370
|
skip,
|