@mindstudio-ai/agent 0.0.19 → 0.1.0
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 +123 -102
- package/dist/cli.js +161 -11
- package/dist/index.d.ts +378 -17
- package/dist/index.js +74 -3
- package/dist/index.js.map +1 -1
- package/llms.txt +129 -15
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mindstudio-ai/agent
|
|
2
2
|
|
|
3
|
-
TypeScript SDK, CLI, and MCP server for
|
|
3
|
+
TypeScript SDK, CLI, and MCP server for MindStudio. One API key gives you access to 200+ AI models (OpenAI, Anthropic, Google, Meta, xAI, DeepSeek, etc.) and 1,000+ integrations including 850+ third-party connectors from the open-source MindStudio Connector Registry (https://github.com/mindstudio-ai/mscr). No separate provider API keys required.
|
|
4
4
|
|
|
5
5
|
This file is the complete API reference. No other documentation is needed to use the SDK.
|
|
6
6
|
|
|
@@ -98,9 +98,9 @@ new MindStudioAgent({
|
|
|
98
98
|
|
|
99
99
|
## Models
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
Direct access to 200+ AI models from every major provider — all through a single API key, billed at cost with no markups.
|
|
102
102
|
|
|
103
|
-
Use `listModels()` or `listModelsByType(
|
|
103
|
+
Use `listModels()` or `listModelsByType()` for full model details, or `listModelsSummary()` / `listModelsSummaryByType()` for a lightweight list (id, name, type, tags) suitable for LLM context windows. Pass a model ID to `modelOverride.model` in methods like `generateText` to select a specific model:
|
|
104
104
|
|
|
105
105
|
```typescript
|
|
106
106
|
const { models } = await agent.listModelsByType('llm_chat');
|
|
@@ -109,7 +109,7 @@ const model = models.find(m => m.name.includes("Gemini"));
|
|
|
109
109
|
const { content } = await agent.generateText({
|
|
110
110
|
message: 'Hello',
|
|
111
111
|
modelOverride: {
|
|
112
|
-
model: model.
|
|
112
|
+
model: model.id,
|
|
113
113
|
temperature: 0.7,
|
|
114
114
|
maxResponseTokens: 1024,
|
|
115
115
|
},
|
|
@@ -243,6 +243,16 @@ Delete a single document from a data source.
|
|
|
243
243
|
- Input: `{ dataSourceId: string, documentId: string }`
|
|
244
244
|
- Output: `unknown`
|
|
245
245
|
|
|
246
|
+
#### detectChanges
|
|
247
|
+
Detect changes between runs by comparing current input against previously stored state. Routes execution based on whether a change occurred.
|
|
248
|
+
- Persists state across runs using a global variable keyed to the step ID.
|
|
249
|
+
- Two modes: "comparison" (default) uses strict string inequality; "ai" uses an LLM to determine if a meaningful change occurred.
|
|
250
|
+
- First run always treats the value as "changed" since there is no previous state.
|
|
251
|
+
- Each mode supports transitions to different steps/workflows for the "changed" and "unchanged" paths.
|
|
252
|
+
- AI mode bills normally for the LLM call.
|
|
253
|
+
- Input: `{ mode: "ai" | "comparison", input: string, prompt?: 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 }, previousValueVariable?: string, changedStepId?: string, changedWorkflowId?: string, unchangedStepId?: string, unchangedWorkflowId?: string }`
|
|
254
|
+
- Output: `{ hasChanged: boolean, currentValue: string, previousValue: string, isFirstRun: boolean }`
|
|
255
|
+
|
|
246
256
|
#### detectPII
|
|
247
257
|
Scan text for personally identifiable information using Microsoft Presidio.
|
|
248
258
|
- In workflow mode, transitions to detectedStepId if PII is found, notDetectedStepId otherwise.
|
|
@@ -251,6 +261,37 @@ Scan text for personally identifiable information using Microsoft Presidio.
|
|
|
251
261
|
- Input: `{ input: string, language: string, entities: string[], detectedStepId?: string, notDetectedStepId?: string, outputLogVariable?: string | null }`
|
|
252
262
|
- Output: `{ detected: boolean, detections: { entity_type: string, start: number, end: number, score: number }[] }`
|
|
253
263
|
|
|
264
|
+
#### discordEditMessage
|
|
265
|
+
Edit a previously sent Discord channel message. Use with the message ID returned by Send Discord Message.
|
|
266
|
+
- Only messages sent by the bot can be edited.
|
|
267
|
+
- The messageId is returned by the Send Discord Message step.
|
|
268
|
+
- Optionally attach a file by providing a URL to attachmentUrl. The file is downloaded and uploaded to Discord.
|
|
269
|
+
- When editing with an attachment, the new attachment replaces any previous attachments on the message.
|
|
270
|
+
- URLs in the text are automatically embedded by Discord (link previews for images, videos, etc.).
|
|
271
|
+
- Input: `{ botToken: string, channelId: string, messageId: string, text: string, attachmentUrl?: string }`
|
|
272
|
+
- Output: `unknown`
|
|
273
|
+
|
|
274
|
+
#### discordSendFollowUp
|
|
275
|
+
Send a follow-up message to a Discord slash command interaction.
|
|
276
|
+
- Requires the applicationId and interactionToken from the Discord trigger variables.
|
|
277
|
+
- Follow-up messages appear as new messages in the channel after the initial response.
|
|
278
|
+
- Returns the sent message ID.
|
|
279
|
+
- Interaction tokens expire after 15 minutes.
|
|
280
|
+
- Optionally attach a file by providing a URL to attachmentUrl. The file is downloaded and uploaded to Discord.
|
|
281
|
+
- URLs in the text are automatically embedded by Discord (link previews for images, videos, etc.).
|
|
282
|
+
- Input: `{ applicationId: string, interactionToken: string, text: string, attachmentUrl?: string }`
|
|
283
|
+
- Output: `{ messageId: string }`
|
|
284
|
+
|
|
285
|
+
#### discordSendMessage
|
|
286
|
+
Send a message to Discord — either edit the loading message or send a new channel message.
|
|
287
|
+
- mode "edit" replaces the loading message (interaction response) with the final result. Uses applicationId and interactionToken from trigger variables. No bot permissions required.
|
|
288
|
+
- 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.
|
|
289
|
+
- Optionally attach a file by providing a URL to attachmentUrl. The file is downloaded and uploaded to Discord.
|
|
290
|
+
- URLs in the text are automatically embedded by Discord (link previews for images, videos, etc.).
|
|
291
|
+
- Interaction tokens expire after 15 minutes.
|
|
292
|
+
- Input: `{ mode: "edit" | "send", text: string, applicationId?: string, interactionToken?: string, botToken?: string, channelId?: string, attachmentUrl?: string }`
|
|
293
|
+
- Output: `{ messageId?: string }`
|
|
294
|
+
|
|
254
295
|
#### downloadVideo
|
|
255
296
|
Download a video file
|
|
256
297
|
- Works with YouTube, TikTok, etc., by using ytdlp behind the scenes
|
|
@@ -405,12 +446,13 @@ List all data sources for the current app.
|
|
|
405
446
|
- Output: `unknown`
|
|
406
447
|
|
|
407
448
|
#### logic
|
|
408
|
-
|
|
409
|
-
-
|
|
410
|
-
-
|
|
449
|
+
Route execution to different branches based on AI evaluation, comparison operators, or workflow jumps.
|
|
450
|
+
- Supports two modes: "ai" (default) uses an AI model to pick the most accurate statement; "comparison" uses operator-based checks.
|
|
451
|
+
- In AI mode, the model picks the most accurate statement from the list. All possible cases must be specified.
|
|
452
|
+
- 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.
|
|
411
453
|
- Requires at least two cases.
|
|
412
|
-
-
|
|
413
|
-
- Input: `{ context: string, cases: ({ id: string, condition: string, destinationStepId?: string } | string)[] }`
|
|
454
|
+
- Each case can transition to a step in the current workflow (destinationStepId) or jump to another workflow (destinationWorkflowId).
|
|
455
|
+
- 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 } }`
|
|
414
456
|
- Output: `{ selectedCase: number }`
|
|
415
457
|
|
|
416
458
|
#### makeDotComRunScenario
|
|
@@ -499,6 +541,16 @@ Resize a video file
|
|
|
499
541
|
- Input: `{ videoUrl: string, mode: "fit" | "exact", maxWidth?: number, maxHeight?: number, width?: number, height?: number, strategy?: "pad" | "crop", skipAssetCreation?: boolean }`
|
|
500
542
|
- Output: `{ videoUrl: string }`
|
|
501
543
|
|
|
544
|
+
#### runFromConnectorRegistry
|
|
545
|
+
Run a raw API connector to a third-party service
|
|
546
|
+
- Use the /developer/v2/helpers/connectors endpoint to list available services and actions.
|
|
547
|
+
- Use /developer/v2/helpers/connectors/{serviceId}/{actionId} to get the full input configuration for an action.
|
|
548
|
+
- Use /developer/v2/helpers/connections to list your available OAuth connections.
|
|
549
|
+
- The actionId format is "serviceId/actionId" (e.g., "slack/send-message").
|
|
550
|
+
- Pass a __connectionId to authenticate the request with a specific OAuth connection, otherwise the default will be used (if configured).
|
|
551
|
+
- Input: `{ actionId: string, displayName: string, icon: string, configurationValues: object, __connectionId?: string }`
|
|
552
|
+
- Output: `{ data: object }`
|
|
553
|
+
|
|
502
554
|
#### runPackagedWorkflow
|
|
503
555
|
Run a packaged workflow ("custom block")
|
|
504
556
|
- From the user's perspective, packaged workflows are just ordinary blocks. Behind the scenes, they operate like packages/libraries in a programming language, letting the user execute custom functionality.
|
|
@@ -1250,12 +1302,10 @@ Output:
|
|
|
1250
1302
|
models: {
|
|
1251
1303
|
id: string;
|
|
1252
1304
|
name: string; // Display name
|
|
1253
|
-
rawName: string; // Full provider model identifier
|
|
1254
1305
|
type: "llm_chat" | "image_generation" | "video_generation" | "video_analysis" | "text_to_speech" | "vision" | "transcription";
|
|
1255
|
-
publisher: string;
|
|
1256
1306
|
maxTemperature: number;
|
|
1257
1307
|
maxResponseSize: number;
|
|
1258
|
-
|
|
1308
|
+
inputs: object[]; // Accepted input types
|
|
1259
1309
|
}[]
|
|
1260
1310
|
}
|
|
1261
1311
|
```
|
|
@@ -1265,12 +1315,39 @@ List AI models filtered by type.
|
|
|
1265
1315
|
- `modelType`: `"llm_chat"` | `"image_generation"` | `"video_generation"` | `"video_analysis"` | `"text_to_speech"` | `"vision"` | `"transcription"`
|
|
1266
1316
|
- Output: same as `listModels()`
|
|
1267
1317
|
|
|
1318
|
+
#### `listModelsSummary()`
|
|
1319
|
+
List all available AI models (summary). Returns only id, name, type, and tags. Suitable for display or consumption inside a model context window.
|
|
1320
|
+
|
|
1321
|
+
Output:
|
|
1322
|
+
```typescript
|
|
1323
|
+
{
|
|
1324
|
+
models: {
|
|
1325
|
+
id: string;
|
|
1326
|
+
name: string;
|
|
1327
|
+
type: "llm_chat" | "image_generation" | "video_generation" | "video_analysis" | "text_to_speech" | "vision" | "transcription";
|
|
1328
|
+
tags: string; // Comma-separated tags
|
|
1329
|
+
}[]
|
|
1330
|
+
}
|
|
1331
|
+
```
|
|
1332
|
+
|
|
1333
|
+
#### `listModelsSummaryByType(modelType)`
|
|
1334
|
+
List AI models (summary) filtered by type.
|
|
1335
|
+
- `modelType`: `"llm_chat"` | `"image_generation"` | `"video_generation"` | `"video_analysis"` | `"text_to_speech"` | `"vision"` | `"transcription"`
|
|
1336
|
+
- Output: same as `listModelsSummary()`
|
|
1337
|
+
|
|
1268
1338
|
#### `listConnectors()`
|
|
1269
|
-
List available connector services (Slack, Google, HubSpot, etc.).
|
|
1339
|
+
List available connector services (Slack, Google, HubSpot, etc.) and their actions.
|
|
1270
1340
|
|
|
1271
1341
|
Output:
|
|
1272
1342
|
```typescript
|
|
1273
|
-
{
|
|
1343
|
+
{
|
|
1344
|
+
services: {
|
|
1345
|
+
id: string;
|
|
1346
|
+
name: string;
|
|
1347
|
+
icon: string;
|
|
1348
|
+
actions: { id: string; name: string }[];
|
|
1349
|
+
}[]
|
|
1350
|
+
}
|
|
1274
1351
|
```
|
|
1275
1352
|
|
|
1276
1353
|
#### `getConnector(serviceId)`
|
|
@@ -1278,5 +1355,42 @@ Get details for a single connector service by ID.
|
|
|
1278
1355
|
|
|
1279
1356
|
Output:
|
|
1280
1357
|
```typescript
|
|
1281
|
-
{
|
|
1358
|
+
{
|
|
1359
|
+
service: {
|
|
1360
|
+
id: string;
|
|
1361
|
+
name: string;
|
|
1362
|
+
icon: string;
|
|
1363
|
+
actions: { id: string; name: string }[];
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
```
|
|
1367
|
+
|
|
1368
|
+
#### `getConnectorAction(serviceId, actionId)`
|
|
1369
|
+
Get the full configuration for a connector action, including all input fields needed to call it via `runFromConnectorRegistry`. Connectors are sourced from the open-source MindStudio Connector Registry (MSCR) with 850+ third-party service integrations.
|
|
1370
|
+
|
|
1371
|
+
Output:
|
|
1372
|
+
```typescript
|
|
1373
|
+
{
|
|
1374
|
+
action: {
|
|
1375
|
+
id: string;
|
|
1376
|
+
name: string;
|
|
1377
|
+
description: string;
|
|
1378
|
+
quickHelp: string;
|
|
1379
|
+
configuration: { title: string; items: { label: string; helpText: string; variable: string; type: string; defaultValue: string; placeholder: string; selectOptions?: object }[] }[];
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
```
|
|
1383
|
+
|
|
1384
|
+
#### `listConnections()`
|
|
1385
|
+
List OAuth connections for the organization. Use the returned connection IDs when calling connector actions. Connectors require the user to connect to the third-party service in MindStudio before they can be used.
|
|
1386
|
+
|
|
1387
|
+
Output:
|
|
1388
|
+
```typescript
|
|
1389
|
+
{
|
|
1390
|
+
connections: {
|
|
1391
|
+
id: string; // Connection ID to pass to connector actions
|
|
1392
|
+
provider: string; // Integration provider (e.g. slack, google)
|
|
1393
|
+
name: string; // Display name or account identifier
|
|
1394
|
+
}[]
|
|
1395
|
+
}
|
|
1282
1396
|
```
|