@mindstudio-ai/agent 0.0.16 → 0.0.18

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/llms.txt CHANGED
@@ -36,10 +36,25 @@ mindstudio info generate-image
36
36
  npx @mindstudio-ai/agent generate-text --message "Hello"
37
37
  ```
38
38
 
39
- Auth: set `MINDSTUDIO_API_KEY` env var or pass `--api-key <key>`.
39
+ Auth: run `mindstudio login`, set `MINDSTUDIO_API_KEY` env var, or pass `--api-key <key>`.
40
40
  Method names are kebab-case on the CLI (camelCase also accepted). Flags are kebab-case (`--video-url` for `videoUrl`).
41
41
  Use `--output-key <key>` to extract a single field, `--no-meta` to strip $-prefixed metadata.
42
42
 
43
+ ### Authentication
44
+
45
+ ```bash
46
+ # Interactive login (opens browser, saves key to ~/.mindstudio/config.json)
47
+ mindstudio login
48
+
49
+ # Check current auth status
50
+ mindstudio whoami
51
+
52
+ # Clear stored credentials
53
+ mindstudio logout
54
+ ```
55
+
56
+ Auth resolution order: `--api-key` flag > `MINDSTUDIO_API_KEY` env > `~/.mindstudio/config.json` > `CALLBACK_TOKEN` env.
57
+
43
58
  ## MCP server
44
59
 
45
60
  The package includes an MCP server exposing all methods as tools:
@@ -68,20 +83,39 @@ import { MindStudioAgent } from '@mindstudio-ai/agent';
68
83
 
69
84
  // With API key (or set MINDSTUDIO_API_KEY env var)
70
85
  const agent = new MindStudioAgent({ apiKey: 'your-key' });
71
-
72
- // Inside MindStudio custom functions, auth is automatic (CALLBACK_TOKEN + REMOTE_HOSTNAME)
73
- const agent = new MindStudioAgent();
74
86
  ```
75
87
 
88
+ Your MindStudio API key authenticates all requests. MindStudio routes to the correct AI provider (OpenAI, Google, Anthropic, etc.) server-side — you do NOT need separate provider API keys.
89
+
76
90
  Constructor options:
77
91
  ```typescript
78
92
  new MindStudioAgent({
79
- apiKey?: string, // Auth token. Falls back to MINDSTUDIO_API_KEY env, then CALLBACK_TOKEN env.
80
- baseUrl?: string, // API base URL. Falls back to MINDSTUDIO_BASE_URL env, then REMOTE_HOSTNAME env, then "https://v1.mindstudio-api.com".
93
+ apiKey?: string, // Auth token. Falls back to MINDSTUDIO_API_KEY env var.
94
+ baseUrl?: string, // API base URL. Defaults to "https://v1.mindstudio-api.com".
81
95
  maxRetries?: number, // Retries on 429 rate limit (default: 3). Uses Retry-After header for delay.
82
96
  })
83
97
  ```
84
98
 
99
+ ## Models
100
+
101
+ MindStudio provides access to models from many providers (OpenAI, Google, Anthropic, Meta, xAI, DeepSeek, etc.) through a single API key. You do NOT need provider-specific API keys.
102
+
103
+ Use `listModels()` or `listModelsByType("llm_chat")` to discover available models. Pass a model ID to `modelOverride.model` in methods like `generateText` to select a specific model:
104
+
105
+ ```typescript
106
+ const { models } = await agent.listModelsByType('llm_chat');
107
+ const model = models.find(m => m.name.includes("Gemini"));
108
+
109
+ const { content } = await agent.generateText({
110
+ message: 'Hello',
111
+ modelOverride: {
112
+ model: model.rawName,
113
+ temperature: 0.7,
114
+ maxResponseTokens: 1024,
115
+ },
116
+ });
117
+ ```
118
+
85
119
  ## Calling convention
86
120
 
87
121
  Every method has the signature:
@@ -138,7 +172,6 @@ try {
138
172
  ```
139
173
 
140
174
  429 rate limit errors are retried automatically (configurable via `maxRetries`).
141
- Internal tokens (CALLBACK_TOKEN) are capped at 500 calls — exceeding this throws `call_cap_exceeded`.
142
175
 
143
176
  ## Low-level access
144
177
 
@@ -218,6 +251,37 @@ Scan text for personally identifiable information using Microsoft Presidio.
218
251
  - Input: `{ input: string, language: string, entities: string[], detectedStepId?: string, notDetectedStepId?: string, outputLogVariable?: string | null }`
219
252
  - Output: `{ detected: boolean, detections: { entity_type: string, start: number, end: number, score: number }[] }`
220
253
 
254
+ #### discordEditMessage
255
+ Edit a previously sent Discord channel message. Use with the message ID returned by Send Discord Message.
256
+ - Only messages sent by the bot can be edited.
257
+ - The messageId is returned by the Send Discord Message step.
258
+ - Optionally attach a file by providing a URL to attachmentUrl. The file is downloaded and uploaded to Discord.
259
+ - When editing with an attachment, the new attachment replaces any previous attachments on the message.
260
+ - URLs in the text are automatically embedded by Discord (link previews for images, videos, etc.).
261
+ - Input: `{ botToken: string, channelId: string, messageId: string, text: string, attachmentUrl?: string }`
262
+ - Output: `unknown`
263
+
264
+ #### discordSendFollowUp
265
+ Send a follow-up message to a Discord slash command interaction.
266
+ - Requires the applicationId and interactionToken from the Discord trigger variables.
267
+ - Follow-up messages appear as new messages in the channel after the initial response.
268
+ - Returns the sent message ID.
269
+ - Interaction tokens expire after 15 minutes.
270
+ - Optionally attach a file by providing a URL to attachmentUrl. The file is downloaded and uploaded to Discord.
271
+ - URLs in the text are automatically embedded by Discord (link previews for images, videos, etc.).
272
+ - Input: `{ applicationId: string, interactionToken: string, text: string, attachmentUrl?: string }`
273
+ - Output: `{ messageId: string }`
274
+
275
+ #### discordSendMessage
276
+ Send a message to Discord — either edit the loading message or send a new channel message.
277
+ - mode "edit" replaces the loading message (interaction response) with the final result. Uses applicationId and interactionToken from trigger variables. No bot permissions required.
278
+ - mode "send" sends a new message to a channel. Uses botToken and channelId from trigger variables. Returns a messageId that can be used with Edit Discord Message.
279
+ - Optionally attach a file by providing a URL to attachmentUrl. The file is downloaded and uploaded to Discord.
280
+ - URLs in the text are automatically embedded by Discord (link previews for images, videos, etc.).
281
+ - Interaction tokens expire after 15 minutes.
282
+ - Input: `{ mode: "edit" | "send", text: string, applicationId?: string, interactionToken?: string, botToken?: string, channelId?: string, attachmentUrl?: string }`
283
+ - Output: `{ messageId?: string }`
284
+
221
285
  #### downloadVideo
222
286
  Download a video file
223
287
  - Works with YouTube, TikTok, etc., by using ytdlp behind the scenes
@@ -372,12 +436,13 @@ List all data sources for the current app.
372
436
  - Output: `unknown`
373
437
 
374
438
  #### logic
375
- Use an AI model to evaluate which condition from a list is most true, given a context prompt.
376
- - This is "fuzzy" logic evaluated by an AI model, not computational logic. The model picks the most accurate statement.
377
- - All possible cases must be specified there is no default/fallback case.
439
+ Route execution to different branches based on AI evaluation, comparison operators, or workflow jumps.
440
+ - Supports two modes: "ai" (default) uses an AI model to pick the most accurate statement; "comparison" uses operator-based checks.
441
+ - In AI mode, the model picks the most accurate statement from the list. All possible cases must be specified.
442
+ - In comparison mode, the context is the left operand and each case's condition is the right operand. First matching case wins. Use operator "default" as a fallback.
378
443
  - Requires at least two cases.
379
- - In workflow mode, transitions to the destinationStepId of the winning case. In direct execution, returns the winning case ID and condition.
380
- - Input: `{ context: string, cases: ({ id: string, condition: string, destinationStepId?: string } | string)[] }`
444
+ - Each case can transition to a step in the current workflow (destinationStepId) or jump to another workflow (destinationWorkflowId).
445
+ - Input: `{ mode?: "ai" | "comparison", context: string, cases: ({ id: string, condition: string, operator?: "eq" | "neq" | "gt" | "lt" | "gte" | "lte" | "exists" | "not_exists" | "contains" | "not_contains" | "default", destinationStepId?: string, destinationWorkflowId?: string } | string)[], modelOverride?: { model: string, temperature: number, maxResponseTokens: number, ignorePreamble?: boolean, userMessagePreprocessor?: { dataSource?: string, messageTemplate?: string, maxResults?: number, enabled?: boolean, shouldInherit?: boolean }, preamble?: string, multiModelEnabled?: boolean, editResponseEnabled?: boolean, config?: object } }`
381
446
  - Output: `{ selectedCase: number }`
382
447
 
383
448
  #### makeDotComRunScenario
@@ -558,9 +623,12 @@ Send an email to one or more configured recipient addresses.
558
623
  - Output: `{ recipients: string[] }`
559
624
 
560
625
  #### sendSMS
561
- Send an SMS text message to a phone number configured via OAuth connection.
626
+ Send an SMS or MMS message to a phone number configured via OAuth connection.
562
627
  - User is responsible for configuring the connection to the number (MindStudio requires double opt-in to prevent spam)
563
- - Input: `{ body: string, connectionId?: string }`
628
+ - If mediaUrls are provided, the message is sent as MMS instead of SMS
629
+ - MMS supports up to 10 media URLs (images, video, audio, PDF) with a 5MB limit per file
630
+ - MMS is only supported on US and Canadian carriers; international numbers will receive SMS only (media silently dropped)
631
+ - Input: `{ body: string, connectionId?: string, mediaUrls?: string[] }`
564
632
  - Output: `unknown`
565
633
 
566
634
  #### setRunTitle
@@ -576,6 +644,22 @@ Explicitly set a variable to a given value.
576
644
  - Input: `{ value: string | string[] }`
577
645
  - Output: `object`
578
646
 
647
+ #### telegramEditMessage
648
+ Edit a previously sent Telegram message. Use with the message ID returned by Send Telegram Message.
649
+ - Only text messages sent by the bot can be edited.
650
+ - The messageId is returned by the Send Telegram Message step.
651
+ - Common pattern: send a "Processing..." message, do work, then edit it with the result.
652
+ - Input: `{ botToken: string, chatId: string, messageId: string, text: string }`
653
+ - Output: `unknown`
654
+
655
+ #### telegramReplyToMessage
656
+ Send a reply to a specific Telegram message. The reply will be visually threaded in the chat.
657
+ - Use the rawMessage.message_id from the incoming trigger variables to reply to the user's message.
658
+ - Especially useful in group chats where replies provide context.
659
+ - Returns the sent message ID, which can be used with Edit Telegram Message.
660
+ - Input: `{ botToken: string, chatId: string, replyToMessageId: string, text: string }`
661
+ - Output: `{ messageId: number }`
662
+
579
663
  #### telegramSendAudio
580
664
  Send an audio file to a Telegram chat as music or a voice note via a bot.
581
665
  - "audio" mode sends as a standard audio file. "voice" mode sends as a voice message (re-uploads the file for large file support).
@@ -596,8 +680,9 @@ Send an image to a Telegram chat via a bot.
596
680
  Send a text message to a Telegram chat via a bot.
597
681
  - Messages are sent using MarkdownV2 formatting. Special characters are auto-escaped.
598
682
  - botToken format is "botId:token" — both parts are required.
683
+ - Returns the sent message ID, which can be used with Edit Telegram Message to update the message later.
599
684
  - Input: `{ botToken: string, chatId: string, text: string }`
600
- - Output: `unknown`
685
+ - Output: `{ messageId: number }`
601
686
 
602
687
  #### telegramSendVideo
603
688
  Send a video to a Telegram chat via a bot.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",