@mindstudio-ai/agent 0.0.11 → 0.0.13
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 +20 -0
- package/dist/index.d.ts +19 -1
- package/dist/index.js +143 -2
- package/dist/index.js.map +1 -1
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -82,6 +82,22 @@ const r2 = await agent.generateText(
|
|
|
82
82
|
);
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
### Automatic thread reuse
|
|
86
|
+
|
|
87
|
+
For local debugging or scripts where you want all calls to share a single thread (similar to how MindStudio custom function sandboxes work), enable `reuseThreadId`:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
const agent = new MindStudioAgent({ reuseThreadId: true });
|
|
91
|
+
|
|
92
|
+
// Or set the environment variable
|
|
93
|
+
// MINDSTUDIO_REUSE_THREAD_ID=true
|
|
94
|
+
|
|
95
|
+
await agent.generateText({ message: 'My name is Alice' }); // creates a thread
|
|
96
|
+
await agent.generateText({ message: 'What is my name?' }); // reuses the same thread automatically
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The thread ID from the first response is captured and sent with all subsequent calls. You can still override it per-call by passing an explicit `threadId` in the options.
|
|
100
|
+
|
|
85
101
|
## Rate limiting
|
|
86
102
|
|
|
87
103
|
Rate limiting is handled automatically:
|
|
@@ -147,6 +163,10 @@ const agent = new MindStudioAgent({
|
|
|
147
163
|
|
|
148
164
|
// Max retries on 429 rate limit responses (default: 3)
|
|
149
165
|
maxRetries: 5,
|
|
166
|
+
|
|
167
|
+
// Auto-reuse the first returned thread ID for all subsequent calls (default: false)
|
|
168
|
+
// Or set MINDSTUDIO_REUSE_THREAD_ID=true env var
|
|
169
|
+
reuseThreadId: true,
|
|
150
170
|
});
|
|
151
171
|
```
|
|
152
172
|
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,17 @@ interface AgentOptions {
|
|
|
52
52
|
* @default 3
|
|
53
53
|
*/
|
|
54
54
|
maxRetries?: number;
|
|
55
|
+
/**
|
|
56
|
+
* When true, the thread ID from the first API response is automatically
|
|
57
|
+
* reused for all subsequent calls (unless an explicit `threadId` is passed).
|
|
58
|
+
* Useful for local debugging to simulate custom function sandbox behavior.
|
|
59
|
+
*
|
|
60
|
+
* If omitted, the SDK checks `MINDSTUDIO_REUSE_THREAD_ID` in the environment.
|
|
61
|
+
* Any truthy value (`"true"`, `"1"`) enables reuse.
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
reuseThreadId?: boolean;
|
|
55
66
|
}
|
|
56
67
|
/** Options for a single step execution call. */
|
|
57
68
|
interface StepExecutionOptions {
|
|
@@ -126,6 +137,10 @@ type StepExecutionResult<TOutput = Record<string, unknown>> = TOutput & StepExec
|
|
|
126
137
|
declare class MindStudioAgent$1 {
|
|
127
138
|
/** @internal */
|
|
128
139
|
readonly _httpConfig: HttpClientConfig;
|
|
140
|
+
/** @internal */
|
|
141
|
+
private _reuseThreadId;
|
|
142
|
+
/** @internal */
|
|
143
|
+
private _threadId;
|
|
129
144
|
constructor(options?: AgentOptions);
|
|
130
145
|
/**
|
|
131
146
|
* Execute any step by its type name. This is the low-level method that all
|
|
@@ -5416,6 +5431,9 @@ interface StepSnippet {
|
|
|
5416
5431
|
outputKeys: string[];
|
|
5417
5432
|
}
|
|
5418
5433
|
declare const stepSnippets: Record<string, StepSnippet>;
|
|
5434
|
+
type MonacoSnippetFieldType = 'string' | 'number' | 'boolean' | 'array' | 'object' | string[];
|
|
5435
|
+
type MonacoSnippetField = [name: string, type: MonacoSnippetFieldType];
|
|
5436
|
+
declare const monacoSnippets: Record<string, MonacoSnippetField[]>;
|
|
5419
5437
|
|
|
5420
5438
|
/** MindStudioAgent with all generated step and helper methods. */
|
|
5421
5439
|
type MindStudioAgent = MindStudioAgent$1 & StepMethods & HelperMethods;
|
|
@@ -5424,4 +5442,4 @@ declare const MindStudioAgent: {
|
|
|
5424
5442
|
new (options?: AgentOptions): MindStudioAgent;
|
|
5425
5443
|
};
|
|
5426
5444
|
|
|
5427
|
-
export { type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, 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 CaptureThumbnailStepInput, type CaptureThumbnailStepOutput, type CodaCreateUpdatePageStepInput, type CodaCreateUpdatePageStepOutput, type CodaCreateUpdateRowStepInput, type CodaCreateUpdateRowStepOutput, type CodaFindRowStepInput, type CodaFindRowStepOutput, type CodaGetPageStepInput, type CodaGetPageStepOutput, type CodaGetTableRowsStepInput, type CodaGetTableRowsStepOutput, type ConvertPdfToImagesStepInput, type ConvertPdfToImagesStepOutput, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type DeleteDataSourceDocumentStepInput, type DeleteDataSourceDocumentStepOutput, type DeleteDataSourceStepInput, type DeleteDataSourceStepOutput, type DeleteGoogleCalendarEventStepInput, type DeleteGoogleCalendarEventStepOutput, type DetectPIIStepInput, type DetectPIIStepOutput, type DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, 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 GetGoogleCalendarEventStepInput, type GetGoogleCalendarEventStepOutput, type GetMediaMetadataStepInput, type GetMediaMetadataStepOutput, type HelperMethods, 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 ListDataSourcesStepInput, type ListDataSourcesStepOutput, type ListGoogleCalendarEventsStepInput, type ListGoogleCalendarEventsStepOutput, type LogicStepInput, type LogicStepOutput, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, MindStudioAgent, MindStudioError, type MindStudioModel, type MixAudioIntoVideoStepInput, type MixAudioIntoVideoStepOutput, type ModelType, 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 QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type ResizeVideoStepInput, type ResizeVideoStepOutput, 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 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 SendSMSStepInput, type SendSMSStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepMethods, type StepName, type StepOutputMap, type StepSnippet, 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 UpdateGoogleCalendarEventStepInput, type UpdateGoogleCalendarEventStepOutput, type UpdateGoogleDocStepInput, type UpdateGoogleDocStepOutput, type UpdateGoogleSheetStepInput, type UpdateGoogleSheetStepOutput, type UploadDataSourceDocumentStepInput, type UploadDataSourceDocumentStepOutput, type UpscaleImageStepInput, type UpscaleImageStepOutput, type UpscaleVideoStepInput, type UpscaleVideoStepOutput, type UserMessageStepInput, type UserMessageStepOutput, type VideoFaceSwapStepInput, type VideoFaceSwapStepOutput, type VideoRemoveBackgroundStepInput, type VideoRemoveBackgroundStepOutput, type VideoRemoveWatermarkStepInput, type VideoRemoveWatermarkStepOutput, type WatermarkImageStepInput, type WatermarkImageStepOutput, type WatermarkVideoStepInput, type WatermarkVideoStepOutput, stepSnippets };
|
|
5445
|
+
export { type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, 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 CaptureThumbnailStepInput, type CaptureThumbnailStepOutput, type CodaCreateUpdatePageStepInput, type CodaCreateUpdatePageStepOutput, type CodaCreateUpdateRowStepInput, type CodaCreateUpdateRowStepOutput, type CodaFindRowStepInput, type CodaFindRowStepOutput, type CodaGetPageStepInput, type CodaGetPageStepOutput, type CodaGetTableRowsStepInput, type CodaGetTableRowsStepOutput, type ConvertPdfToImagesStepInput, type ConvertPdfToImagesStepOutput, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type DeleteDataSourceDocumentStepInput, type DeleteDataSourceDocumentStepOutput, type DeleteDataSourceStepInput, type DeleteDataSourceStepOutput, type DeleteGoogleCalendarEventStepInput, type DeleteGoogleCalendarEventStepOutput, type DetectPIIStepInput, type DetectPIIStepOutput, type DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, 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 GetGoogleCalendarEventStepInput, type GetGoogleCalendarEventStepOutput, type GetMediaMetadataStepInput, type GetMediaMetadataStepOutput, type HelperMethods, 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 ListDataSourcesStepInput, type ListDataSourcesStepOutput, type ListGoogleCalendarEventsStepInput, type ListGoogleCalendarEventsStepOutput, type LogicStepInput, type LogicStepOutput, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, MindStudioAgent, MindStudioError, type MindStudioModel, type MixAudioIntoVideoStepInput, type MixAudioIntoVideoStepOutput, type ModelType, 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 QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type ResizeVideoStepInput, type ResizeVideoStepOutput, 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 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 SendSMSStepInput, type SendSMSStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepMethods, type StepName, type StepOutputMap, type StepSnippet, 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 UpdateGoogleCalendarEventStepInput, type UpdateGoogleCalendarEventStepOutput, type UpdateGoogleDocStepInput, type UpdateGoogleDocStepOutput, type UpdateGoogleSheetStepInput, type UpdateGoogleSheetStepOutput, type UploadDataSourceDocumentStepInput, type UploadDataSourceDocumentStepOutput, type UpscaleImageStepInput, type UpscaleImageStepOutput, type UpscaleVideoStepInput, type UpscaleVideoStepOutput, type UserMessageStepInput, type UserMessageStepOutput, type VideoFaceSwapStepInput, type VideoFaceSwapStepOutput, type VideoRemoveBackgroundStepInput, type VideoRemoveBackgroundStepOutput, type VideoRemoveWatermarkStepInput, type VideoRemoveWatermarkStepOutput, type WatermarkImageStepInput, type WatermarkImageStepOutput, type WatermarkVideoStepInput, type WatermarkVideoStepOutput, monacoSnippets, stepSnippets };
|
package/dist/index.js
CHANGED
|
@@ -532,9 +532,14 @@ var DEFAULT_MAX_RETRIES = 3;
|
|
|
532
532
|
var MindStudioAgent = class {
|
|
533
533
|
/** @internal */
|
|
534
534
|
_httpConfig;
|
|
535
|
+
/** @internal */
|
|
536
|
+
_reuseThreadId;
|
|
537
|
+
/** @internal */
|
|
538
|
+
_threadId;
|
|
535
539
|
constructor(options = {}) {
|
|
536
540
|
const { token, authType } = resolveToken(options.apiKey);
|
|
537
541
|
const baseUrl = options.baseUrl ?? process.env.MINDSTUDIO_BASE_URL ?? process.env.REMOTE_HOSTNAME ?? DEFAULT_BASE_URL;
|
|
542
|
+
this._reuseThreadId = options.reuseThreadId ?? /^(true|1)$/i.test(process.env.MINDSTUDIO_REUSE_THREAD_ID ?? "");
|
|
538
543
|
this._httpConfig = {
|
|
539
544
|
baseUrl,
|
|
540
545
|
token,
|
|
@@ -552,10 +557,11 @@ var MindStudioAgent = class {
|
|
|
552
557
|
* ```
|
|
553
558
|
*/
|
|
554
559
|
async executeStep(stepType, step, options) {
|
|
560
|
+
const threadId = options?.threadId ?? (this._reuseThreadId ? this._threadId : void 0);
|
|
555
561
|
const { data, headers } = await request(this._httpConfig, "POST", `/steps/${stepType}/execute`, {
|
|
556
562
|
step,
|
|
557
563
|
...options?.appId != null && { appId: options.appId },
|
|
558
|
-
...
|
|
564
|
+
...threadId != null && { threadId }
|
|
559
565
|
});
|
|
560
566
|
let output;
|
|
561
567
|
if (data.output != null) {
|
|
@@ -574,11 +580,15 @@ var MindStudioAgent = class {
|
|
|
574
580
|
} else {
|
|
575
581
|
output = void 0;
|
|
576
582
|
}
|
|
583
|
+
const returnedThreadId = headers.get("x-mindstudio-thread-id") ?? "";
|
|
584
|
+
if (this._reuseThreadId && returnedThreadId) {
|
|
585
|
+
this._threadId = returnedThreadId;
|
|
586
|
+
}
|
|
577
587
|
const remaining = headers.get("x-ratelimit-remaining");
|
|
578
588
|
return {
|
|
579
589
|
...output,
|
|
580
590
|
$appId: headers.get("x-mindstudio-app-id") ?? "",
|
|
581
|
-
$threadId:
|
|
591
|
+
$threadId: returnedThreadId,
|
|
582
592
|
$rateLimitRemaining: remaining != null ? parseInt(remaining, 10) : void 0
|
|
583
593
|
};
|
|
584
594
|
}
|
|
@@ -1255,12 +1265,143 @@ var stepSnippets = {
|
|
|
1255
1265
|
outputKeys: ["videoUrl"]
|
|
1256
1266
|
}
|
|
1257
1267
|
};
|
|
1268
|
+
var monacoSnippets = {
|
|
1269
|
+
"activeCampaignAddNote": [["contactId", "string"], ["note", "string"], ["connectionId", "string"]],
|
|
1270
|
+
"activeCampaignCreateContact": [["email", "string"], ["firstName", "string"], ["lastName", "string"], ["phone", "string"], ["accountId", "string"], ["customFields", "object"], ["connectionId", "string"]],
|
|
1271
|
+
"addSubtitlesToVideo": [["videoUrl", "string"], ["language", "string"], ["fontName", "string"], ["fontSize", "number"], ["fontWeight", ["normal", "bold", "black"]], ["fontColor", ["white", "black", "red", "green", "blue", "yellow", "orange", "purple", "pink", "brown", "gray", "cyan", "magenta"]], ["highlightColor", ["white", "black", "red", "green", "blue", "yellow", "orange", "purple", "pink", "brown", "gray", "cyan", "magenta"]], ["strokeWidth", "number"], ["strokeColor", ["black", "white", "red", "green", "blue", "yellow", "orange", "purple", "pink", "brown", "gray", "cyan", "magenta"]], ["backgroundColor", ["black", "white", "red", "green", "blue", "yellow", "orange", "purple", "pink", "brown", "gray", "cyan", "magenta", "none"]], ["backgroundOpacity", "number"], ["position", ["top", "center", "bottom"]], ["yOffset", "number"], ["wordsPerSubtitle", "number"], ["enableAnimation", "boolean"]],
|
|
1272
|
+
"airtableCreateUpdateRecord": [["connectionId", "string"], ["baseId", "string"], ["tableId", "string"], ["fields", "string"], ["recordData", "object"]],
|
|
1273
|
+
"airtableDeleteRecord": [["connectionId", "string"], ["baseId", "string"], ["tableId", "string"], ["recordId", "string"]],
|
|
1274
|
+
"airtableGetRecord": [["connectionId", "string"], ["baseId", "string"], ["tableId", "string"], ["recordId", "string"]],
|
|
1275
|
+
"airtableGetTableRecords": [["connectionId", "string"], ["baseId", "string"], ["tableId", "string"]],
|
|
1276
|
+
"analyzeImage": [["prompt", "string"], ["imageUrl", "string"]],
|
|
1277
|
+
"analyzeVideo": [["prompt", "string"], ["videoUrl", "string"]],
|
|
1278
|
+
"captureThumbnail": [["videoUrl", "string"], ["at", "string"]],
|
|
1279
|
+
"codaCreateUpdatePage": [["connectionId", "string"], ["pageData", "object"]],
|
|
1280
|
+
"codaCreateUpdateRow": [["connectionId", "string"], ["docId", "string"], ["tableId", "string"], ["rowData", "object"]],
|
|
1281
|
+
"codaFindRow": [["connectionId", "string"], ["docId", "string"], ["tableId", "string"], ["rowData", "object"]],
|
|
1282
|
+
"codaGetPage": [["connectionId", "string"], ["docId", "string"], ["pageId", "string"]],
|
|
1283
|
+
"codaGetTableRows": [["connectionId", "string"], ["docId", "string"], ["tableId", "string"]],
|
|
1284
|
+
"convertPdfToImages": [["pdfUrl", "string"]],
|
|
1285
|
+
"createDataSource": [["name", "string"]],
|
|
1286
|
+
"createGoogleCalendarEvent": [["connectionId", "string"], ["summary", "string"], ["startDateTime", "string"], ["endDateTime", "string"]],
|
|
1287
|
+
"createGoogleDoc": [["title", "string"], ["text", "string"], ["connectionId", "string"], ["textType", ["plain", "html", "markdown"]]],
|
|
1288
|
+
"createGoogleSheet": [["title", "string"], ["text", "string"], ["connectionId", "string"]],
|
|
1289
|
+
"deleteDataSource": [["dataSourceId", "string"]],
|
|
1290
|
+
"deleteDataSourceDocument": [["dataSourceId", "string"], ["documentId", "string"]],
|
|
1291
|
+
"deleteGoogleCalendarEvent": [["connectionId", "string"], ["eventId", "string"]],
|
|
1292
|
+
"detectPII": [["input", "string"], ["language", "string"], ["entities", "array"]],
|
|
1293
|
+
"downloadVideo": [["videoUrl", "string"], ["format", ["mp4", "mp3"]]],
|
|
1294
|
+
"enhanceImageGenerationPrompt": [["initialPrompt", "string"], ["includeNegativePrompt", "boolean"], ["systemPrompt", "string"]],
|
|
1295
|
+
"enhanceVideoGenerationPrompt": [["initialPrompt", "string"], ["includeNegativePrompt", "boolean"], ["systemPrompt", "string"]],
|
|
1296
|
+
"enrichPerson": [["params", "object"]],
|
|
1297
|
+
"extractAudioFromVideo": [["videoUrl", "string"]],
|
|
1298
|
+
"extractText": [["url", "string"]],
|
|
1299
|
+
"fetchDataSourceDocument": [["dataSourceId", "string"], ["documentId", "string"]],
|
|
1300
|
+
"fetchGoogleDoc": [["documentId", "string"], ["connectionId", "string"], ["exportType", ["html", "markdown", "json", "plain"]]],
|
|
1301
|
+
"fetchGoogleSheet": [["spreadsheetId", "string"], ["range", "string"], ["connectionId", "string"], ["exportType", ["csv", "json"]]],
|
|
1302
|
+
"fetchSlackChannelHistory": [["connectionId", "string"], ["channelId", "string"]],
|
|
1303
|
+
"fetchYoutubeCaptions": [["videoUrl", "string"], ["exportType", ["text", "json"]], ["language", "string"]],
|
|
1304
|
+
"fetchYoutubeChannel": [["channelUrl", "string"]],
|
|
1305
|
+
"fetchYoutubeComments": [["videoUrl", "string"], ["exportType", ["text", "json"]], ["limitPages", "string"]],
|
|
1306
|
+
"fetchYoutubeVideo": [["videoUrl", "string"]],
|
|
1307
|
+
"generateAsset": [["source", "string"], ["sourceType", ["html", "markdown", "spa", "raw", "dynamic", "customInterface"]], ["outputFormat", ["pdf", "png", "html", "mp4", "openGraph"]], ["pageSize", ["full", "letter", "A4", "custom"]], ["testData", "object"]],
|
|
1308
|
+
"generateChart": [["chart", "object"]],
|
|
1309
|
+
"generateImage": [["prompt", "string"]],
|
|
1310
|
+
"generateLipsync": [],
|
|
1311
|
+
"generateMusic": [["text", "string"]],
|
|
1312
|
+
"generateStaticVideoFromImage": [["imageUrl", "string"], ["duration", "string"]],
|
|
1313
|
+
"generateText": [["message", "string"]],
|
|
1314
|
+
"generateVideo": [["prompt", "string"]],
|
|
1315
|
+
"getGoogleCalendarEvent": [["connectionId", "string"], ["eventId", "string"], ["exportType", ["json", "text"]]],
|
|
1316
|
+
"getMediaMetadata": [["mediaUrl", "string"]],
|
|
1317
|
+
"httpRequest": [["url", "string"], ["method", "string"], ["headers", "object"], ["queryParams", "object"], ["body", "string"], ["bodyItems", "object"], ["contentType", ["none", "application/json", "application/x-www-form-urlencoded", "multipart/form-data", "custom"]], ["customContentType", "string"]],
|
|
1318
|
+
"hubspotCreateCompany": [["connectionId", "string"], ["company", "object"], ["enabledProperties", "array"]],
|
|
1319
|
+
"hubspotCreateContact": [["connectionId", "string"], ["contact", "object"], ["enabledProperties", "array"], ["companyDomain", "string"]],
|
|
1320
|
+
"hubspotGetCompany": [["connectionId", "string"], ["searchBy", ["domain", "id"]], ["companyDomain", "string"], ["companyId", "string"], ["additionalProperties", "array"]],
|
|
1321
|
+
"hubspotGetContact": [["connectionId", "string"], ["searchBy", ["email", "id"]], ["contactEmail", "string"], ["contactId", "string"], ["additionalProperties", "array"]],
|
|
1322
|
+
"hunterApiCompanyEnrichment": [["domain", "string"]],
|
|
1323
|
+
"hunterApiDomainSearch": [["domain", "string"]],
|
|
1324
|
+
"hunterApiEmailFinder": [["domain", "string"], ["firstName", "string"], ["lastName", "string"]],
|
|
1325
|
+
"hunterApiEmailVerification": [["email", "string"]],
|
|
1326
|
+
"hunterApiPersonEnrichment": [["email", "string"]],
|
|
1327
|
+
"imageFaceSwap": [["imageUrl", "string"], ["faceImageUrl", "string"], ["engine", "string"]],
|
|
1328
|
+
"imageRemoveWatermark": [["imageUrl", "string"], ["engine", "string"]],
|
|
1329
|
+
"insertVideoClips": [["baseVideoUrl", "string"], ["overlayVideos", "array"]],
|
|
1330
|
+
"listDataSources": [],
|
|
1331
|
+
"listGoogleCalendarEvents": [["connectionId", "string"], ["limit", "number"], ["exportType", ["json", "text"]]],
|
|
1332
|
+
"logic": [["context", "string"], ["cases", "array"]],
|
|
1333
|
+
"makeDotComRunScenario": [["webhookUrl", "string"], ["input", "object"]],
|
|
1334
|
+
"mergeAudio": [["mp3Urls", "array"]],
|
|
1335
|
+
"mergeVideos": [["videoUrls", "array"]],
|
|
1336
|
+
"mixAudioIntoVideo": [["videoUrl", "string"], ["audioUrl", "string"], ["options", "object"]],
|
|
1337
|
+
"muteVideo": [["videoUrl", "string"]],
|
|
1338
|
+
"n8nRunNode": [["method", "string"], ["authentication", ["none", "basic", "string"]], ["user", "string"], ["password", "string"], ["webhookUrl", "string"], ["input", "object"]],
|
|
1339
|
+
"notionCreatePage": [["pageId", "string"], ["content", "string"], ["title", "string"], ["connectionId", "string"]],
|
|
1340
|
+
"notionUpdatePage": [["pageId", "string"], ["content", "string"], ["mode", ["append", "overwrite"]], ["connectionId", "string"]],
|
|
1341
|
+
"peopleSearch": [["smartQuery", "string"], ["enrichPeople", "boolean"], ["enrichOrganizations", "boolean"], ["limit", "string"], ["page", "string"], ["params", "object"]],
|
|
1342
|
+
"postToLinkedIn": [["message", "string"], ["visibility", ["PUBLIC", "CONNECTIONS"]], ["connectionId", "string"]],
|
|
1343
|
+
"postToSlackChannel": [["channelId", "string"], ["messageType", ["string", "blocks"]], ["message", "string"], ["connectionId", "string"]],
|
|
1344
|
+
"postToX": [["text", "string"], ["connectionId", "string"]],
|
|
1345
|
+
"postToZapier": [["webhookUrl", "string"], ["input", "object"]],
|
|
1346
|
+
"queryDataSource": [["dataSourceId", "string"], ["query", "string"], ["maxResults", "number"]],
|
|
1347
|
+
"queryExternalDatabase": [["connectionId", "string"], ["query", "string"], ["outputFormat", ["json", "csv"]]],
|
|
1348
|
+
"redactPII": [["input", "string"], ["language", "string"], ["entities", "array"]],
|
|
1349
|
+
"removeBackgroundFromImage": [["imageUrl", "string"]],
|
|
1350
|
+
"resizeVideo": [["videoUrl", "string"], ["mode", ["fit", "exact"]]],
|
|
1351
|
+
"runPackagedWorkflow": [["appId", "string"], ["workflowId", "string"], ["inputVariables", "object"], ["outputVariables", "object"], ["name", "string"]],
|
|
1352
|
+
"scrapeFacebookPage": [["pageUrl", "string"]],
|
|
1353
|
+
"scrapeFacebookPosts": [["pageUrl", "string"]],
|
|
1354
|
+
"scrapeInstagramComments": [["postUrl", "string"], ["resultsLimit", "string"]],
|
|
1355
|
+
"scrapeInstagramMentions": [["profileUrl", "string"], ["resultsLimit", "string"]],
|
|
1356
|
+
"scrapeInstagramPosts": [["profileUrl", "string"], ["resultsLimit", "string"], ["onlyPostsNewerThan", "string"]],
|
|
1357
|
+
"scrapeInstagramProfile": [["profileUrl", "string"]],
|
|
1358
|
+
"scrapeInstagramReels": [["profileUrl", "string"], ["resultsLimit", "string"]],
|
|
1359
|
+
"scrapeLinkedInCompany": [["url", "string"]],
|
|
1360
|
+
"scrapeLinkedInProfile": [["url", "string"]],
|
|
1361
|
+
"scrapeMetaThreadsProfile": [["profileUrl", "string"]],
|
|
1362
|
+
"scrapeUrl": [["url", "string"]],
|
|
1363
|
+
"scrapeXPost": [["url", "string"]],
|
|
1364
|
+
"scrapeXProfile": [["url", "string"]],
|
|
1365
|
+
"searchGoogle": [["query", "string"], ["exportType", ["text", "json"]]],
|
|
1366
|
+
"searchGoogleImages": [["query", "string"], ["exportType", ["text", "json"]]],
|
|
1367
|
+
"searchGoogleNews": [["text", "string"], ["exportType", ["text", "json"]]],
|
|
1368
|
+
"searchGoogleTrends": [["text", "string"], ["hl", "string"], ["geo", "string"], ["data_type", ["TIMESERIES", "GEO_MAP", "GEO_MAP_0", "RELATED_TOPICS", "RELATED_QUERIES"]], ["cat", "string"], ["date", "string"], ["ts", "string"]],
|
|
1369
|
+
"searchPerplexity": [["query", "string"], ["exportType", ["text", "json"]]],
|
|
1370
|
+
"searchXPosts": [["query", "string"], ["scope", ["recent", "all"]], ["options", "object"]],
|
|
1371
|
+
"searchYoutube": [["query", "string"], ["limitPages", "string"], ["filter", "string"], ["filterType", "string"]],
|
|
1372
|
+
"searchYoutubeTrends": [["bp", ["now", "music", "gaming", "films"]], ["hl", "string"], ["gl", "string"]],
|
|
1373
|
+
"sendEmail": [["subject", "string"], ["body", "string"], ["connectionId", "string"]],
|
|
1374
|
+
"sendSMS": [["body", "string"], ["connectionId", "string"]],
|
|
1375
|
+
"setRunTitle": [["title", "string"]],
|
|
1376
|
+
"setVariable": [["value", "string"], ["type", ["imageUrl", "videoUrl", "fileUrl", "plaintext", "textArray", "imageUrlArray", "videoUrlArray"]]],
|
|
1377
|
+
"telegramSendAudio": [["botToken", "string"], ["chatId", "string"], ["audioUrl", "string"], ["mode", ["audio", "voice"]]],
|
|
1378
|
+
"telegramSendFile": [["botToken", "string"], ["chatId", "string"], ["fileUrl", "string"]],
|
|
1379
|
+
"telegramSendImage": [["botToken", "string"], ["chatId", "string"], ["imageUrl", "string"]],
|
|
1380
|
+
"telegramSendMessage": [["botToken", "string"], ["chatId", "string"], ["text", "string"]],
|
|
1381
|
+
"telegramSendVideo": [["botToken", "string"], ["chatId", "string"], ["videoUrl", "string"]],
|
|
1382
|
+
"telegramSetTyping": [["botToken", "string"], ["chatId", "string"]],
|
|
1383
|
+
"textToSpeech": [["text", "string"]],
|
|
1384
|
+
"transcribeAudio": [["audioUrl", "string"], ["prompt", "string"]],
|
|
1385
|
+
"trimMedia": [["inputUrl", "string"]],
|
|
1386
|
+
"updateGoogleCalendarEvent": [["connectionId", "string"], ["eventId", "string"]],
|
|
1387
|
+
"updateGoogleDoc": [["documentId", "string"], ["connectionId", "string"], ["text", "string"], ["textType", ["plain", "html", "markdown"]], ["operationType", ["addToTop", "addToBottom", "overwrite"]]],
|
|
1388
|
+
"updateGoogleSheet": [["text", "string"], ["connectionId", "string"], ["spreadsheetId", "string"], ["range", "string"], ["operationType", ["addToBottom", "overwrite", "range"]]],
|
|
1389
|
+
"uploadDataSourceDocument": [["dataSourceId", "string"], ["file", "string"], ["fileName", "string"]],
|
|
1390
|
+
"upscaleImage": [["imageUrl", "string"], ["targetResolution", ["2k", "4k", "8k"]], ["engine", ["standard", "pro"]]],
|
|
1391
|
+
"upscaleVideo": [["videoUrl", "string"], ["targetResolution", ["720p", "1080p", "2K", "4K"]], ["engine", ["standard", "pro", "ultimate", "flashvsr", "seedance", "seedvr2", "runwayml/upscale-v1"]]],
|
|
1392
|
+
"videoFaceSwap": [["videoUrl", "string"], ["faceImageUrl", "string"], ["targetIndex", "number"], ["engine", "string"]],
|
|
1393
|
+
"videoRemoveBackground": [["videoUrl", "string"], ["newBackground", ["transparent", "image"]], ["engine", "string"]],
|
|
1394
|
+
"videoRemoveWatermark": [["videoUrl", "string"], ["engine", "string"]],
|
|
1395
|
+
"watermarkImage": [["imageUrl", "string"], ["watermarkImageUrl", "string"], ["corner", ["top-left", "top-right", "bottom-left", "bottom-right"]], ["paddingPx", "number"], ["widthPx", "number"]],
|
|
1396
|
+
"watermarkVideo": [["videoUrl", "string"], ["imageUrl", "string"], ["corner", ["top-left", "top-right", "bottom-left", "bottom-right"]], ["paddingPx", "number"], ["widthPx", "number"]]
|
|
1397
|
+
};
|
|
1258
1398
|
|
|
1259
1399
|
// src/index.ts
|
|
1260
1400
|
var MindStudioAgent2 = MindStudioAgent;
|
|
1261
1401
|
export {
|
|
1262
1402
|
MindStudioAgent2 as MindStudioAgent,
|
|
1263
1403
|
MindStudioError,
|
|
1404
|
+
monacoSnippets,
|
|
1264
1405
|
stepSnippets
|
|
1265
1406
|
};
|
|
1266
1407
|
//# sourceMappingURL=index.js.map
|