@mindstudio-ai/agent 0.1.15 → 0.1.17
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/README.md +30 -1
- package/dist/cli.js +609 -57
- package/dist/index.d.ts +61 -25
- package/dist/index.js +61 -3
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +610 -58
- package/llms.txt +10 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -557,15 +557,6 @@ interface SystemColumns {
|
|
|
557
557
|
updated_at: number;
|
|
558
558
|
last_updated_by: string;
|
|
559
559
|
}
|
|
560
|
-
/**
|
|
561
|
-
* A row as returned from the database. Merges the user-defined type T
|
|
562
|
-
* with system columns. If T already includes system columns (e.g., the
|
|
563
|
-
* user declared `id: string`), the intersection is harmless — same type.
|
|
564
|
-
*
|
|
565
|
-
* This ensures TypeScript knows about `id`, `created_at`, etc. on read
|
|
566
|
-
* results even if the user's interface only declares their own fields.
|
|
567
|
-
*/
|
|
568
|
-
type Row<T> = T & SystemColumns;
|
|
569
560
|
/**
|
|
570
561
|
* Input type for `Table.push()`. Excludes system-managed fields.
|
|
571
562
|
* Optional fields in T remain optional.
|
|
@@ -772,17 +763,17 @@ declare class Table<T> {
|
|
|
772
763
|
/** @internal */
|
|
773
764
|
private readonly _config;
|
|
774
765
|
constructor(config: TableConfig);
|
|
775
|
-
get(id: string): Promise<
|
|
776
|
-
findOne(predicate: Predicate<
|
|
777
|
-
count(predicate?: Predicate<
|
|
778
|
-
some(predicate: Predicate<
|
|
779
|
-
every(predicate: Predicate<
|
|
766
|
+
get(id: string): Promise<T | null>;
|
|
767
|
+
findOne(predicate: Predicate<T>): Promise<T | null>;
|
|
768
|
+
count(predicate?: Predicate<T>): Promise<number>;
|
|
769
|
+
some(predicate: Predicate<T>): Promise<boolean>;
|
|
770
|
+
every(predicate: Predicate<T>): Promise<boolean>;
|
|
780
771
|
isEmpty(): Promise<boolean>;
|
|
781
|
-
min(accessor: Accessor<
|
|
782
|
-
max(accessor: Accessor<
|
|
783
|
-
groupBy<K extends string | number>(accessor: Accessor<
|
|
784
|
-
filter(predicate: Predicate<
|
|
785
|
-
sortBy(accessor: Accessor<
|
|
772
|
+
min(accessor: Accessor<T, number>): Promise<T | null>;
|
|
773
|
+
max(accessor: Accessor<T, number>): Promise<T | null>;
|
|
774
|
+
groupBy<K extends string | number>(accessor: Accessor<T, K>): Promise<Map<K, T[]>>;
|
|
775
|
+
filter(predicate: Predicate<T>): Query<T>;
|
|
776
|
+
sortBy(accessor: Accessor<T>): Query<T>;
|
|
786
777
|
/**
|
|
787
778
|
* Insert one or more rows. Returns the created row(s) with system fields
|
|
788
779
|
* populated (id, createdAt, updatedAt, lastUpdatedBy).
|
|
@@ -790,18 +781,18 @@ declare class Table<T> {
|
|
|
790
781
|
* Uses `INSERT ... RETURNING *` so the created row comes back in a
|
|
791
782
|
* single round trip — no separate SELECT needed.
|
|
792
783
|
*/
|
|
793
|
-
push(data: PushInput<T>): Promise<
|
|
794
|
-
push(data: PushInput<T>[]): Promise<
|
|
784
|
+
push(data: PushInput<T>): Promise<T>;
|
|
785
|
+
push(data: PushInput<T>[]): Promise<T[]>;
|
|
795
786
|
/**
|
|
796
787
|
* Update a row by ID. Only the provided fields are changed.
|
|
797
788
|
* Returns the updated row via `UPDATE ... RETURNING *`.
|
|
798
789
|
*/
|
|
799
|
-
update(id: string, data: UpdateInput<T>): Promise<
|
|
790
|
+
update(id: string, data: UpdateInput<T>): Promise<T>;
|
|
800
791
|
remove(id: string): Promise<void>;
|
|
801
792
|
/**
|
|
802
793
|
* Remove all rows matching a predicate. Returns the count removed.
|
|
803
794
|
*/
|
|
804
|
-
removeAll(predicate: Predicate<
|
|
795
|
+
removeAll(predicate: Predicate<T>): Promise<number>;
|
|
805
796
|
clear(): Promise<void>;
|
|
806
797
|
}
|
|
807
798
|
|
|
@@ -899,7 +890,7 @@ interface Db {
|
|
|
899
890
|
* const Orders = db.defineTable<Order>('orders', { database: 'main' });
|
|
900
891
|
* ```
|
|
901
892
|
*/
|
|
902
|
-
defineTable<T>(name: string, options?: DefineTableOptions): Table<T>;
|
|
893
|
+
defineTable<T>(name: string, options?: DefineTableOptions): Table<T & SystemColumns>;
|
|
903
894
|
/** Returns the current time as a unix timestamp (ms). Equivalent to `Date.now()`. */
|
|
904
895
|
now(): number;
|
|
905
896
|
/** Returns milliseconds for n days. Composable with `+`. */
|
|
@@ -1106,6 +1097,27 @@ declare class MindStudioAgent$1 {
|
|
|
1106
1097
|
costType?: string;
|
|
1107
1098
|
estimates?: StepCostEstimateEntry[];
|
|
1108
1099
|
}>;
|
|
1100
|
+
/**
|
|
1101
|
+
* Send a stream chunk to the caller via SSE.
|
|
1102
|
+
*
|
|
1103
|
+
* When invoked from a method that was called with `stream: true`, chunks
|
|
1104
|
+
* are delivered in real-time as Server-Sent Events. When there is no active
|
|
1105
|
+
* stream (no `STREAM_ID`), calls are silently ignored — so it's safe to
|
|
1106
|
+
* call unconditionally.
|
|
1107
|
+
*
|
|
1108
|
+
* Accepts strings (sent as `type: 'token'`) or structured data (sent as
|
|
1109
|
+
* `type: 'data'`). The caller receives each chunk as an SSE event.
|
|
1110
|
+
*
|
|
1111
|
+
* @example
|
|
1112
|
+
* ```ts
|
|
1113
|
+
* // Stream text tokens
|
|
1114
|
+
* await agent.stream('Processing item 1...');
|
|
1115
|
+
*
|
|
1116
|
+
* // Stream structured data
|
|
1117
|
+
* await agent.stream({ progress: 50, currentItem: 'abc' });
|
|
1118
|
+
* ```
|
|
1119
|
+
*/
|
|
1120
|
+
stream: (data: string | Record<string, unknown>) => Promise<void>;
|
|
1109
1121
|
/**
|
|
1110
1122
|
* The `auth` namespace — synchronous role-based access control.
|
|
1111
1123
|
*
|
|
@@ -7550,6 +7562,14 @@ interface StepMethods {
|
|
|
7550
7562
|
* - Source "system" echoes the message content directly (no AI call).
|
|
7551
7563
|
* - Mode "background" saves the result to a variable. Mode "foreground" streams it to the user (not available in direct execution).
|
|
7552
7564
|
* - Structured output (JSON/CSV) can be enforced via structuredOutputType and structuredOutputExample.
|
|
7565
|
+
* - When executed inside a v2 app method (managed sandbox or local dev tunnel),
|
|
7566
|
+
* LLM token output can be streamed to the frontend in real time via an SSE
|
|
7567
|
+
* side-channel. The frontend opts in by passing { stream: true } to the method
|
|
7568
|
+
* invocation via @mindstudio-ai/interface. Tokens are published to Redis
|
|
7569
|
+
* pub/sub as they arrive and forwarded as SSE events on the invoke response.
|
|
7570
|
+
* The method code itself is unchanged — streaming is transparent to the
|
|
7571
|
+
* developer. See V2ExecutionService.ts and the invoke handler in V2Apps for
|
|
7572
|
+
* the server-side plumbing.
|
|
7553
7573
|
*
|
|
7554
7574
|
* @example
|
|
7555
7575
|
* ```typescript
|
|
@@ -7715,6 +7735,22 @@ declare const auth: AuthContext;
|
|
|
7715
7735
|
* ```
|
|
7716
7736
|
*/
|
|
7717
7737
|
declare const db: Db;
|
|
7738
|
+
/**
|
|
7739
|
+
* Top-level `stream` function bound to the default singleton.
|
|
7740
|
+
*
|
|
7741
|
+
* Send a stream chunk to the caller via SSE. When the method was called
|
|
7742
|
+
* with `stream: true`, chunks arrive in real-time. When there is no active
|
|
7743
|
+
* stream, calls are silently ignored.
|
|
7744
|
+
*
|
|
7745
|
+
* @example
|
|
7746
|
+
* ```ts
|
|
7747
|
+
* import { stream } from '@mindstudio-ai/agent';
|
|
7748
|
+
*
|
|
7749
|
+
* await stream('Processing...');
|
|
7750
|
+
* await stream({ progress: 50 });
|
|
7751
|
+
* ```
|
|
7752
|
+
*/
|
|
7753
|
+
declare const stream: (data: string | Record<string, unknown>) => Promise<void>;
|
|
7718
7754
|
/**
|
|
7719
7755
|
* Resolve a user ID to display info (name, email, profile picture).
|
|
7720
7756
|
* Bound to the default singleton.
|
|
@@ -7729,4 +7765,4 @@ declare const db: Db;
|
|
|
7729
7765
|
*/
|
|
7730
7766
|
declare const resolveUser: (userId: string) => Promise<ResolvedUser | null>;
|
|
7731
7767
|
|
|
7732
|
-
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 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 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 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 HttpRequestStepInput, type HttpRequestStepOutput, 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 ListRecentGmailEmailsStepInput, type ListRecentGmailEmailsStepOutput, type LogicStepInput, type LogicStepOutput, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, 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 PeopleSearchStepInput, type PeopleSearchStepOutput, type PostToLinkedInStepInput, type PostToLinkedInStepOutput, type PostToSlackChannelStepInput, type PostToSlackChannelStepOutput, type PostToXStepInput, type PostToXStepOutput, type PostToZapierStepInput, type PostToZapierStepOutput, type Predicate, type PushInput, 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 ResizeVideoStepInput, type ResizeVideoStepOutput, type ResolvedUser, Roles, type RunAgentOptions, type RunAgentResult, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunPackagedWorkflowStepInput, type RunPackagedWorkflowStepOutput, type ScrapeFacebookPageStepInput, type ScrapeFacebookPageStepOutput, type ScrapeFacebookPostsStepInput, type ScrapeFacebookPostsStepOutput, type ScrapeInstagramCommentsStepInput, type ScrapeInstagramCommentsStepOutput, type ScrapeInstagramMentionsStepInput, type ScrapeInstagramMentionsStepOutput, type ScrapeInstagramPostsStepInput, type ScrapeInstagramPostsStepOutput, type ScrapeInstagramProfileStepInput, type ScrapeInstagramProfileStepOutput, type ScrapeInstagramReelsStepInput, type ScrapeInstagramReelsStepOutput, type ScrapeLinkedInCompanyStepInput, type ScrapeLinkedInCompanyStepOutput, type ScrapeLinkedInProfileStepInput, type ScrapeLinkedInProfileStepOutput, type ScrapeMetaThreadsProfileStepInput, type ScrapeMetaThreadsProfileStepOutput, type ScrapeUrlStepInput, type ScrapeUrlStepOutput, type ScrapeXPostStepInput, type ScrapeXPostStepOutput, type ScrapeXProfileStepInput, type ScrapeXProfileStepOutput, 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 SetGmailReadStatusStepInput, type SetGmailReadStatusStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepCostEstimateEntry, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepMetadata, type StepMethods, type StepName, type StepOutputMap, type SystemFields, Table, 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 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, auth, blockTypeAliases, db, mindstudio as default, mindstudio, monacoSnippets, resolveUser, stepMetadata };
|
|
7768
|
+
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 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 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 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 HttpRequestStepInput, type HttpRequestStepOutput, 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 ListRecentGmailEmailsStepInput, type ListRecentGmailEmailsStepOutput, type LogicStepInput, type LogicStepOutput, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, 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 PeopleSearchStepInput, type PeopleSearchStepOutput, type PostToLinkedInStepInput, type PostToLinkedInStepOutput, type PostToSlackChannelStepInput, type PostToSlackChannelStepOutput, type PostToXStepInput, type PostToXStepOutput, type PostToZapierStepInput, type PostToZapierStepOutput, type Predicate, type PushInput, 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 ResizeVideoStepInput, type ResizeVideoStepOutput, type ResolvedUser, Roles, type RunAgentOptions, type RunAgentResult, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunPackagedWorkflowStepInput, type RunPackagedWorkflowStepOutput, type ScrapeFacebookPageStepInput, type ScrapeFacebookPageStepOutput, type ScrapeFacebookPostsStepInput, type ScrapeFacebookPostsStepOutput, type ScrapeInstagramCommentsStepInput, type ScrapeInstagramCommentsStepOutput, type ScrapeInstagramMentionsStepInput, type ScrapeInstagramMentionsStepOutput, type ScrapeInstagramPostsStepInput, type ScrapeInstagramPostsStepOutput, type ScrapeInstagramProfileStepInput, type ScrapeInstagramProfileStepOutput, type ScrapeInstagramReelsStepInput, type ScrapeInstagramReelsStepOutput, type ScrapeLinkedInCompanyStepInput, type ScrapeLinkedInCompanyStepOutput, type ScrapeLinkedInProfileStepInput, type ScrapeLinkedInProfileStepOutput, type ScrapeMetaThreadsProfileStepInput, type ScrapeMetaThreadsProfileStepOutput, type ScrapeUrlStepInput, type ScrapeUrlStepOutput, type ScrapeXPostStepInput, type ScrapeXPostStepOutput, type ScrapeXProfileStepInput, type ScrapeXProfileStepOutput, 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 SetGmailReadStatusStepInput, type SetGmailReadStatusStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepCostEstimateEntry, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepMetadata, type StepMethods, type StepName, type StepOutputMap, type SystemFields, Table, 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 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, auth, blockTypeAliases, db, mindstudio as default, mindstudio, monacoSnippets, resolveUser, stepMetadata, stream };
|
package/dist/index.js
CHANGED
|
@@ -2181,6 +2181,46 @@ var MindStudioAgent = class {
|
|
|
2181
2181
|
return data;
|
|
2182
2182
|
}
|
|
2183
2183
|
// -------------------------------------------------------------------------
|
|
2184
|
+
// Streaming
|
|
2185
|
+
// -------------------------------------------------------------------------
|
|
2186
|
+
/**
|
|
2187
|
+
* Send a stream chunk to the caller via SSE.
|
|
2188
|
+
*
|
|
2189
|
+
* When invoked from a method that was called with `stream: true`, chunks
|
|
2190
|
+
* are delivered in real-time as Server-Sent Events. When there is no active
|
|
2191
|
+
* stream (no `STREAM_ID`), calls are silently ignored — so it's safe to
|
|
2192
|
+
* call unconditionally.
|
|
2193
|
+
*
|
|
2194
|
+
* Accepts strings (sent as `type: 'token'`) or structured data (sent as
|
|
2195
|
+
* `type: 'data'`). The caller receives each chunk as an SSE event.
|
|
2196
|
+
*
|
|
2197
|
+
* @example
|
|
2198
|
+
* ```ts
|
|
2199
|
+
* // Stream text tokens
|
|
2200
|
+
* await agent.stream('Processing item 1...');
|
|
2201
|
+
*
|
|
2202
|
+
* // Stream structured data
|
|
2203
|
+
* await agent.stream({ progress: 50, currentItem: 'abc' });
|
|
2204
|
+
* ```
|
|
2205
|
+
*/
|
|
2206
|
+
stream = async (data) => {
|
|
2207
|
+
if (!this._streamId) return;
|
|
2208
|
+
const url = `${this._httpConfig.baseUrl}/_internal/v2/stream-chunk`;
|
|
2209
|
+
const body = typeof data === "string" ? { streamId: this._streamId, type: "token", text: data } : { streamId: this._streamId, type: "data", data };
|
|
2210
|
+
const res = await fetch(url, {
|
|
2211
|
+
method: "POST",
|
|
2212
|
+
headers: {
|
|
2213
|
+
"Content-Type": "application/json",
|
|
2214
|
+
Authorization: this._httpConfig.token
|
|
2215
|
+
},
|
|
2216
|
+
body: JSON.stringify(body)
|
|
2217
|
+
});
|
|
2218
|
+
if (!res.ok) {
|
|
2219
|
+
const text = await res.text().catch(() => "");
|
|
2220
|
+
console.warn(`[mindstudio] stream chunk failed: ${res.status} ${text}`);
|
|
2221
|
+
}
|
|
2222
|
+
};
|
|
2223
|
+
// -------------------------------------------------------------------------
|
|
2184
2224
|
// db + auth namespaces
|
|
2185
2225
|
// -------------------------------------------------------------------------
|
|
2186
2226
|
/**
|
|
@@ -3112,7 +3152,15 @@ var stepMetadata = {
|
|
|
3112
3152
|
usageNotes: `- Source "user" sends the message to an LLM and returns the model's response.
|
|
3113
3153
|
- Source "system" echoes the message content directly (no AI call).
|
|
3114
3154
|
- Mode "background" saves the result to a variable. Mode "foreground" streams it to the user (not available in direct execution).
|
|
3115
|
-
- Structured output (JSON/CSV) can be enforced via structuredOutputType and structuredOutputExample
|
|
3155
|
+
- Structured output (JSON/CSV) can be enforced via structuredOutputType and structuredOutputExample.
|
|
3156
|
+
- When executed inside a v2 app method (managed sandbox or local dev tunnel),
|
|
3157
|
+
LLM token output can be streamed to the frontend in real time via an SSE
|
|
3158
|
+
side-channel. The frontend opts in by passing { stream: true } to the method
|
|
3159
|
+
invocation via @mindstudio-ai/interface. Tokens are published to Redis
|
|
3160
|
+
pub/sub as they arrive and forwarded as SSE events on the invoke response.
|
|
3161
|
+
The method code itself is unchanged \u2014 streaming is transparent to the
|
|
3162
|
+
developer. See V2ExecutionService.ts and the invoke handler in V2Apps for
|
|
3163
|
+
the server-side plumbing.`,
|
|
3116
3164
|
inputSchema: { "type": "object", "properties": { "message": { "type": "string", "description": "The message to send (prompt for AI, or text for system echo)" }, "source": { "enum": ["user", "system"], "type": "string", "description": 'Message source: "user" sends to AI model, "system" echoes message content directly. Defaults to "user"' }, "modelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": 'Model identifier (e.g. "gpt-4", "claude-3-opus")' }, "temperature": { "type": "number", "description": "Sampling temperature for the model (0-2)" }, "maxResponseTokens": { "type": "number", "description": "Maximum number of tokens in the model's response" }, "ignorePreamble": { "type": "boolean", "description": "Whether to skip the system preamble/instructions" }, "userMessagePreprocessor": { "type": "object", "properties": { "dataSource": { "type": "string", "description": "Data source identifier for the preprocessor" }, "messageTemplate": { "type": "string", "description": "Template string applied to user messages before sending to the model" }, "maxResults": { "type": "number", "description": "Maximum number of results to include from the data source" }, "enabled": { "type": "boolean", "description": "Whether the preprocessor is active" }, "shouldInherit": { "type": "boolean", "description": "Whether child steps should inherit this preprocessor configuration" } }, "description": "Preprocessor applied to user messages before sending to the model" }, "preamble": { "type": "string", "description": "System preamble/instructions for the model" }, "multiModelEnabled": { "type": "boolean", "description": "Whether multi-model candidate generation is enabled" }, "editResponseEnabled": { "type": "boolean", "description": "Whether the user can edit the model's response" }, "config": { "type": "object", "description": "Additional model-specific configuration" } }, "required": ["model", "temperature", "maxResponseTokens"], "description": "Model configuration override. Optional; uses the workflow's default model if not specified" }, "structuredOutputType": { "enum": ["text", "json", "csv"], "type": "string", "description": "Output format constraint for structured responses" }, "structuredOutputExample": { "type": "string", "description": "Sample showing the desired output shape (for JSON/CSV formats). A TypeScript interface is also useful here for more complex types." }, "chatHistoryMode": { "enum": ["include", "exclude"], "type": "string", "description": "Whether to include or exclude prior chat history in the AI context" } }, "required": ["message"], "description": "Configuration for the user message step" },
|
|
3117
3165
|
outputSchema: { "type": "object", "properties": { "content": { "type": "string", "description": "The AI model's response or echoed system message content" } }, "required": ["content"] }
|
|
3118
3166
|
},
|
|
@@ -3828,7 +3876,15 @@ var stepMetadata = {
|
|
|
3828
3876
|
usageNotes: `- Source "user" sends the message to an LLM and returns the model's response.
|
|
3829
3877
|
- Source "system" echoes the message content directly (no AI call).
|
|
3830
3878
|
- Mode "background" saves the result to a variable. Mode "foreground" streams it to the user (not available in direct execution).
|
|
3831
|
-
- Structured output (JSON/CSV) can be enforced via structuredOutputType and structuredOutputExample
|
|
3879
|
+
- Structured output (JSON/CSV) can be enforced via structuredOutputType and structuredOutputExample.
|
|
3880
|
+
- When executed inside a v2 app method (managed sandbox or local dev tunnel),
|
|
3881
|
+
LLM token output can be streamed to the frontend in real time via an SSE
|
|
3882
|
+
side-channel. The frontend opts in by passing { stream: true } to the method
|
|
3883
|
+
invocation via @mindstudio-ai/interface. Tokens are published to Redis
|
|
3884
|
+
pub/sub as they arrive and forwarded as SSE events on the invoke response.
|
|
3885
|
+
The method code itself is unchanged \u2014 streaming is transparent to the
|
|
3886
|
+
developer. See V2ExecutionService.ts and the invoke handler in V2Apps for
|
|
3887
|
+
the server-side plumbing.`,
|
|
3832
3888
|
inputSchema: { "type": "object", "properties": { "message": { "type": "string", "description": "The message to send (prompt for AI, or text for system echo)" }, "source": { "enum": ["user", "system"], "type": "string", "description": 'Message source: "user" sends to AI model, "system" echoes message content directly. Defaults to "user"' }, "modelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": 'Model identifier (e.g. "gpt-4", "claude-3-opus")' }, "temperature": { "type": "number", "description": "Sampling temperature for the model (0-2)" }, "maxResponseTokens": { "type": "number", "description": "Maximum number of tokens in the model's response" }, "ignorePreamble": { "type": "boolean", "description": "Whether to skip the system preamble/instructions" }, "userMessagePreprocessor": { "type": "object", "properties": { "dataSource": { "type": "string", "description": "Data source identifier for the preprocessor" }, "messageTemplate": { "type": "string", "description": "Template string applied to user messages before sending to the model" }, "maxResults": { "type": "number", "description": "Maximum number of results to include from the data source" }, "enabled": { "type": "boolean", "description": "Whether the preprocessor is active" }, "shouldInherit": { "type": "boolean", "description": "Whether child steps should inherit this preprocessor configuration" } }, "description": "Preprocessor applied to user messages before sending to the model" }, "preamble": { "type": "string", "description": "System preamble/instructions for the model" }, "multiModelEnabled": { "type": "boolean", "description": "Whether multi-model candidate generation is enabled" }, "editResponseEnabled": { "type": "boolean", "description": "Whether the user can edit the model's response" }, "config": { "type": "object", "description": "Additional model-specific configuration" } }, "required": ["model", "temperature", "maxResponseTokens"], "description": "Model configuration override. Optional; uses the workflow's default model if not specified" }, "structuredOutputType": { "enum": ["text", "json", "csv"], "type": "string", "description": "Output format constraint for structured responses" }, "structuredOutputExample": { "type": "string", "description": "Sample showing the desired output shape (for JSON/CSV formats). A TypeScript interface is also useful here for more complex types." }, "chatHistoryMode": { "enum": ["include", "exclude"], "type": "string", "description": "Whether to include or exclude prior chat history in the AI context" } }, "required": ["message"], "description": "Configuration for the user message step" },
|
|
3833
3889
|
outputSchema: { "type": "object", "properties": { "content": { "type": "string", "description": "The AI model's response or echoed system message content" } }, "required": ["content"] }
|
|
3834
3890
|
},
|
|
@@ -3903,6 +3959,7 @@ var db = new Proxy(
|
|
|
3903
3959
|
}
|
|
3904
3960
|
}
|
|
3905
3961
|
);
|
|
3962
|
+
var stream = (data) => mindstudio.stream(data);
|
|
3906
3963
|
var resolveUser = (userId) => mindstudio.resolveUser(userId);
|
|
3907
3964
|
export {
|
|
3908
3965
|
AuthContext,
|
|
@@ -3916,6 +3973,7 @@ export {
|
|
|
3916
3973
|
mindstudio,
|
|
3917
3974
|
monacoSnippets,
|
|
3918
3975
|
resolveUser,
|
|
3919
|
-
stepMetadata
|
|
3976
|
+
stepMetadata,
|
|
3977
|
+
stream
|
|
3920
3978
|
};
|
|
3921
3979
|
//# sourceMappingURL=index.js.map
|