@mindstudio-ai/agent 0.1.7 → 0.1.10
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 +43 -2
- package/dist/cli.js +1518 -28
- package/dist/index.d.ts +944 -78
- package/dist/index.js +1506 -24
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +1518 -28
- package/llms.txt +53 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,9 +95,15 @@ npx @mindstudio-ai/agent generate-text --message "Hello"
|
|
|
95
95
|
|
|
96
96
|
### MCP server
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
**Claude Code** (one-time setup):
|
|
99
|
+
```bash
|
|
100
|
+
claude mcp add mindstudio -- mindstudio mcp
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
That's it — Claude Code will discover the MCP server on next launch. Auth is picked up from `mindstudio login` automatically.
|
|
104
|
+
|
|
105
|
+
**Other MCP clients** (Cursor, VS Code, Windsurf, etc.) — add to your config:
|
|
99
106
|
|
|
100
|
-
**With standalone binary** (recommended — faster startup, no Node required):
|
|
101
107
|
```json
|
|
102
108
|
{
|
|
103
109
|
"mcpServers": {
|
|
@@ -334,6 +340,37 @@ await agent.generateText({ message: 'My name is Alice' }); // creates a thread
|
|
|
334
340
|
await agent.generateText({ message: 'What is my name?' }); // reuses it automatically
|
|
335
341
|
```
|
|
336
342
|
|
|
343
|
+
## Managed databases and auth
|
|
344
|
+
|
|
345
|
+
When running inside a MindStudio app (managed mode), the SDK provides `db`, `auth`, and `resolveUser` for working with the app's managed SQLite databases and role-based access control. These are available as top-level imports:
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
import { db, auth, Roles, resolveUser, User } from '@mindstudio-ai/agent';
|
|
349
|
+
|
|
350
|
+
// Define a typed table
|
|
351
|
+
const Orders = db.defineTable<Order>('orders');
|
|
352
|
+
|
|
353
|
+
// Query with a chainable API
|
|
354
|
+
const pending = await Orders
|
|
355
|
+
.filter(o => o.status === 'pending')
|
|
356
|
+
.sortBy(o => o.createdAt)
|
|
357
|
+
.reverse()
|
|
358
|
+
.take(20);
|
|
359
|
+
|
|
360
|
+
// Write
|
|
361
|
+
const order = await Orders.push({ item: 'Laptop', amount: 999, status: 'pending' });
|
|
362
|
+
await Orders.update(order.id, { status: 'approved' });
|
|
363
|
+
|
|
364
|
+
// Role-based access control
|
|
365
|
+
auth.requireRole(Roles.admin);
|
|
366
|
+
const admins = auth.getUsersByRole(Roles.admin);
|
|
367
|
+
|
|
368
|
+
// Resolve user display info
|
|
369
|
+
const user = await resolveUser(order.requestedBy);
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
See `src/db/README.md` and `src/auth/README.md` for the full API reference.
|
|
373
|
+
|
|
337
374
|
## Configuration
|
|
338
375
|
|
|
339
376
|
```typescript
|
|
@@ -351,6 +388,10 @@ const agent = new MindStudioAgent({
|
|
|
351
388
|
// Auto-reuse the first returned thread ID for all subsequent calls (default: false)
|
|
352
389
|
// Or set MINDSTUDIO_REUSE_THREAD_ID=true env var
|
|
353
390
|
reuseThreadId: true,
|
|
391
|
+
|
|
392
|
+
// App ID for managed database/auth context (managed mode only)
|
|
393
|
+
// Or set MINDSTUDIO_APP_ID env var. Auto-detected in sandbox.
|
|
394
|
+
appId: 'your-app-id',
|
|
354
395
|
});
|
|
355
396
|
```
|
|
356
397
|
|