@mindstudio-ai/agent 0.1.47 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +81 -47
- package/dist/index.d.ts +12 -6
- package/dist/index.js +70 -37
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +81 -47
- package/llms.txt +24 -26
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -104,24 +104,21 @@ MCP client config (standalone binary — recommended):
|
|
|
104
104
|
|
|
105
105
|
## Setup
|
|
106
106
|
|
|
107
|
+
Inside MindStudio apps (auth is automatic):
|
|
107
108
|
```typescript
|
|
108
|
-
import {
|
|
109
|
+
import { mindstudio, db, auth, Roles, stream } from '@mindstudio-ai/agent';
|
|
109
110
|
|
|
110
|
-
|
|
111
|
-
const agent = new MindStudioAgent({ apiKey: 'your-key' });
|
|
111
|
+
const { imageUrl } = await mindstudio.generateImage({ prompt: 'a sunset' });
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
Constructor options:
|
|
114
|
+
External usage (API key required):
|
|
117
115
|
```typescript
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
baseUrl?: string, // API base URL. Defaults to "https://v1.mindstudio-api.com".
|
|
121
|
-
maxRetries?: number, // Retries on 429 rate limit (default: 3). Uses Retry-After header for delay.
|
|
122
|
-
})
|
|
116
|
+
import { MindStudioAgent } from '@mindstudio-ai/agent';
|
|
117
|
+
const agent = new MindStudioAgent({ apiKey: 'your-key' });
|
|
123
118
|
```
|
|
124
119
|
|
|
120
|
+
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.
|
|
121
|
+
|
|
125
122
|
## Models
|
|
126
123
|
|
|
127
124
|
Direct access to 200+ AI models from every major provider — all through a single API key, billed at cost with no markups.
|
|
@@ -129,10 +126,10 @@ Direct access to 200+ AI models from every major provider — all through a sing
|
|
|
129
126
|
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:
|
|
130
127
|
|
|
131
128
|
```typescript
|
|
132
|
-
const { models } = await
|
|
129
|
+
const { models } = await mindstudio.listModelsByType('llm_chat');
|
|
133
130
|
const model = models.find(m => m.name.includes("Gemini"));
|
|
134
131
|
|
|
135
|
-
const { content } = await
|
|
132
|
+
const { content } = await mindstudio.generateText({
|
|
136
133
|
message: 'Hello',
|
|
137
134
|
modelOverride: {
|
|
138
135
|
model: model.id,
|
|
@@ -146,7 +143,7 @@ const { content } = await agent.generateText({
|
|
|
146
143
|
|
|
147
144
|
Every method has the signature:
|
|
148
145
|
```typescript
|
|
149
|
-
|
|
146
|
+
mindstudio.methodName(input: InputType, options?: { appId?: string, threadId?: string }): Promise<OutputType & StepExecutionMeta>
|
|
150
147
|
```
|
|
151
148
|
|
|
152
149
|
The first argument is the step-specific input object. The optional second argument controls thread/app context.
|
|
@@ -154,10 +151,10 @@ The first argument is the step-specific input object. The optional second argume
|
|
|
154
151
|
**Results are returned flat** — output fields are spread at the top level alongside metadata:
|
|
155
152
|
|
|
156
153
|
```typescript
|
|
157
|
-
const { content } = await
|
|
154
|
+
const { content } = await mindstudio.generateText({ message: 'Hello' });
|
|
158
155
|
|
|
159
156
|
// Full result shape for any method:
|
|
160
|
-
const result = await
|
|
157
|
+
const result = await mindstudio.generateText({ message: `Hello` });
|
|
161
158
|
result.content; // step-specific output field
|
|
162
159
|
result.$appId; // string — app ID for this execution
|
|
163
160
|
result.$threadId; // string — thread ID for this execution
|
|
@@ -171,8 +168,8 @@ result.$billingEvents; // object[] | undefined — itemized billing events
|
|
|
171
168
|
Pass `$appId`/`$threadId` from a previous result to maintain conversation state, variable state, or other context across calls:
|
|
172
169
|
|
|
173
170
|
```typescript
|
|
174
|
-
const r1 = await
|
|
175
|
-
const r2 = await
|
|
171
|
+
const r1 = await mindstudio.generateText({ message: 'My name is Alice' });
|
|
172
|
+
const r2 = await mindstudio.generateText(
|
|
176
173
|
{ message: 'What is my name?' },
|
|
177
174
|
{ threadId: r1.$threadId, appId: r1.$appId },
|
|
178
175
|
);
|
|
@@ -186,7 +183,7 @@ All errors throw `MindStudioError`:
|
|
|
186
183
|
import { MindStudioError } from '@mindstudio-ai/agent';
|
|
187
184
|
|
|
188
185
|
try {
|
|
189
|
-
await
|
|
186
|
+
await mindstudio.generateImage({ prompt: '...' });
|
|
190
187
|
} catch (err) {
|
|
191
188
|
if (err instanceof MindStudioError) {
|
|
192
189
|
err.message; // Human-readable error message
|
|
@@ -203,7 +200,7 @@ try {
|
|
|
203
200
|
|
|
204
201
|
For action types not covered by generated methods:
|
|
205
202
|
```typescript
|
|
206
|
-
const result = await
|
|
203
|
+
const result = await mindstudio.executeStep('stepType', { ...params });
|
|
207
204
|
```
|
|
208
205
|
|
|
209
206
|
## Batch execution
|
|
@@ -212,7 +209,7 @@ Execute multiple steps in parallel in a single request. Maximum 50 steps per bat
|
|
|
212
209
|
Individual step failures do not affect other steps — partial success is possible.
|
|
213
210
|
|
|
214
211
|
```typescript
|
|
215
|
-
const result = await
|
|
212
|
+
const result = await mindstudio.executeStepBatch([
|
|
216
213
|
{ stepType: 'generateImage', step: { prompt: 'a sunset' } },
|
|
217
214
|
{ stepType: 'textToSpeech', step: { text: 'hello world' } },
|
|
218
215
|
], { appId?, threadId? });
|
|
@@ -393,8 +390,9 @@ Extract audio MP3 from a video file
|
|
|
393
390
|
- Output: `{ audioUrl: string }`
|
|
394
391
|
|
|
395
392
|
#### extractText
|
|
396
|
-
Download a file from a URL and extract its text content. Supports PDFs, plain text files, and other document formats.
|
|
393
|
+
Download a file from a URL and extract its text content. Supports PDFs (including scanned/image-based PDFs via OCR), plain text files, and other document formats.
|
|
397
394
|
- Best suited for PDFs and raw text/document files. For web pages, use the scrapeUrl step instead.
|
|
395
|
+
- Handles both text-layer PDFs and image-based/scanned PDFs (e.g. Figma/Canva exports, scanned documents). Image-based PDFs are processed with OCR automatically — there is no need to convert PDF pages to images first.
|
|
398
396
|
- Accepts a single URL, a comma-separated list of URLs, or a JSON array of URLs.
|
|
399
397
|
- Files are rehosted on the MindStudio CDN before extraction.
|
|
400
398
|
- Maximum file size is 50MB per URL.
|
|
@@ -1595,7 +1593,7 @@ Output:
|
|
|
1595
1593
|
Estimate the cost of executing a step before running it. Pass the same step config you would use for execution.
|
|
1596
1594
|
|
|
1597
1595
|
```typescript
|
|
1598
|
-
const estimate = await
|
|
1596
|
+
const estimate = await mindstudio.estimateStepCost('generateText', { message: 'Hello' });
|
|
1599
1597
|
```
|
|
1600
1598
|
|
|
1601
1599
|
- `stepType`: string — The action name (e.g. `"generateText"`).
|
|
@@ -1621,14 +1619,14 @@ Output:
|
|
|
1621
1619
|
Update the display name of the authenticated agent. Useful for agents to set their own name after connecting.
|
|
1622
1620
|
|
|
1623
1621
|
```typescript
|
|
1624
|
-
await
|
|
1622
|
+
await mindstudio.changeName('My Agent');
|
|
1625
1623
|
```
|
|
1626
1624
|
|
|
1627
1625
|
#### `changeProfilePicture(profilePictureUrl)`
|
|
1628
1626
|
Update the profile picture of the authenticated agent. Useful for agents to set their own avatar after connecting.
|
|
1629
1627
|
|
|
1630
1628
|
```typescript
|
|
1631
|
-
await
|
|
1629
|
+
await mindstudio.changeProfilePicture('https://example.com/avatar.png');
|
|
1632
1630
|
```
|
|
1633
1631
|
|
|
1634
1632
|
#### `uploadFile(content, options)`
|
|
@@ -1636,7 +1634,7 @@ Upload a file to the MindStudio CDN. Gets a signed upload URL, PUTs the file con
|
|
|
1636
1634
|
|
|
1637
1635
|
```typescript
|
|
1638
1636
|
import { readFileSync } from 'fs';
|
|
1639
|
-
const { url } = await
|
|
1637
|
+
const { url } = await mindstudio.uploadFile(readFileSync('photo.png'), { extension: 'png', type: 'image/png' });
|
|
1640
1638
|
```
|
|
1641
1639
|
|
|
1642
1640
|
- `content`: `Buffer | Uint8Array` — The file content.
|