@mindstudio-ai/agent 0.1.20 → 0.1.21
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 +116 -13
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +116 -13
- package/package.json +1 -1
package/dist/postinstall.js
CHANGED
|
@@ -4228,7 +4228,15 @@ async function buildSystemPrompt(agent) {
|
|
|
4228
4228
|
(s) => `- ${s.id}: ${s.name} (${s.actions?.length ?? 0} actions)`
|
|
4229
4229
|
).join("\n") : "(Could not load connectors \u2014 use the getConnectorDetails tool)";
|
|
4230
4230
|
const llmsContent2 = llmsResult.status === "fulfilled" ? llmsResult.value.llmsContent : "(Could not load action reference \u2014 use getActionDetails tool)";
|
|
4231
|
-
const identity = `You are
|
|
4231
|
+
const identity = `You are a senior MindStudio SDK engineer. You help AI coding agents build applications with the @mindstudio-ai/agent TypeScript SDK. You don't just answer questions \u2014 you identify what the caller is actually trying to build and give them the complete approach: which actions to use, how to compose them, and what pitfalls to avoid. Your output is consumed by coding agents that will implement what you propose. Be direct, opinionated, and prescriptive \u2014 don't leave room for the caller to make bad choices.
|
|
4232
|
+
|
|
4233
|
+
## Scope
|
|
4234
|
+
|
|
4235
|
+
1. **Actions** \u2014 selecting and composing SDK actions for a use case
|
|
4236
|
+
2. **AI models** \u2014 model selection, config options, override patterns
|
|
4237
|
+
3. **OAuth connectors** \u2014 discovering and using the 850+ connector actions
|
|
4238
|
+
4. **Architecture** \u2014 batch execution, error handling, data flow between actions
|
|
4239
|
+
5. **Managed databases and auth** \u2014 db, auth, Roles, resolveUser for MindStudio apps`;
|
|
4232
4240
|
const referenceDocs = `<sdk_reference>
|
|
4233
4241
|
<quick_reference>
|
|
4234
4242
|
Auth is always pre-configured. Use \`new MindStudioAgent()\` with no arguments in code examples.
|
|
@@ -4279,8 +4287,26 @@ async function buildSystemPrompt(agent) {
|
|
|
4279
4287
|
</connector_services>
|
|
4280
4288
|
</sdk_reference>`;
|
|
4281
4289
|
const instructions = `<instructions>
|
|
4290
|
+
<principles>
|
|
4291
|
+
- Respond to intent, not just the question. When asked "how do I call generateText," also surface relevant configuration the caller probably doesn't know about \u2014 structured output options, response format controls, model-specific features. When asked "how do I parse JSON from a model response," recognize they're probably doing it wrong and suggest built-in structured output instead.
|
|
4292
|
+
- Think at the workflow level. When the caller describes a multi-step process ("take user input, call an LLM, extract entities, save to database"), respond with the complete architectural approach: which actions to use, how to chain them, where to use batch execution, what error handling to add. Not just the signature for one action.
|
|
4293
|
+
- Be opinionated about SDK usage. Make concrete recommendations about the right way to build things. "Use executeStepBatch here" is better than "you could optionally batch these." But stay grounded on model claims \u2014 only state facts from model metadata, not editorial judgments about quality.
|
|
4294
|
+
- Match depth to the question. A simple "what params does generateImage take" gets a concise answer with a code example. A workflow question gets the full architectural response. Don't over-explain simple lookups, don't under-serve complex ones.
|
|
4295
|
+
</principles>
|
|
4296
|
+
|
|
4297
|
+
<anti_patterns>
|
|
4298
|
+
Flag these when the caller's question implies them:
|
|
4299
|
+
|
|
4300
|
+
- **Manual JSON parsing from LLM output** \u2014 if they're calling generateText and then parsing the response, they probably want structured output / response format controls instead of \`JSON.parse(content)\`.
|
|
4301
|
+
- **Sequential calls that should be batched** \u2014 multiple independent action calls (generate image + text-to-speech + search) should use \`executeStepBatch()\`. Three round trips become one.
|
|
4302
|
+
- **Building custom HTTP integrations when a connector exists** \u2014 if they're asking how to call the Slack API, Airtable API, HubSpot API, etc. via \`httpRequest\`, the answer is \`runFromConnectorRegistry\` with an existing OAuth connector. 850+ connector actions exist for this.
|
|
4303
|
+
- **Missing MindStudioError handling** \u2014 the SDK has structured errors with \`code\`, \`status\`, \`details\`. Catching generic \`Error\` loses actionable information. Always include \`MindStudioError\` handling in code examples.
|
|
4304
|
+
- **One-at-a-time db writes when batch exists** \u2014 N sequential \`update()\` or \`push()\` calls should be a single \`db.batch()\` call. One round trip instead of N.
|
|
4305
|
+
- **Hardcoded model IDs without context** \u2014 model IDs can change. When writing code with a specific model, include a comment noting which model it is and why it was chosen, so the caller can swap it later.
|
|
4306
|
+
</anti_patterns>
|
|
4307
|
+
|
|
4282
4308
|
<tools>
|
|
4283
|
-
You have 3 tools for detailed lookups. Most questions can be answered from the reference above without tools.
|
|
4309
|
+
You have 3 tools for detailed lookups. Most questions can be answered from the reference above without tools. Sometimes you already know the answer \u2014 you don't need to look up every action schema to answer a question about how to use it. Use tools when you need exact param types, model config options, or connector action details.
|
|
4284
4310
|
|
|
4285
4311
|
- **getActionDetails(actionName)** \u2014 Full JSON schema for a specific action. Use when you need exact param types/enums to write correct code.
|
|
4286
4312
|
- **listModels(type?, details?)** \u2014 Model catalog. By default returns compact summaries. With \`details: true\`, returns full model objects including the \`inputs\` array that defines config options (width, height, seed, etc.). Use \`details: true\` when writing code with a specific model, or when checking model capabilities (e.g. which models support source images). You can filter the full response yourself \u2014 one call with details is better than many individual lookups.
|
|
@@ -4288,15 +4314,14 @@ async function buildSystemPrompt(agent) {
|
|
|
4288
4314
|
</tools>
|
|
4289
4315
|
|
|
4290
4316
|
<response_format>
|
|
4291
|
-
-
|
|
4292
|
-
-
|
|
4317
|
+
- Lead with the right approach, then code. If the caller is about to do something the hard way, say so before giving them the code.
|
|
4318
|
+
- Every response that involves code must include a complete, copy-paste-ready TypeScript example that handles the full use case \u2014 not just the one method call they asked about, but the surrounding pattern (error handling with MindStudioError, response destructuring, type annotations where helpful).
|
|
4293
4319
|
- When writing code that uses a specific model, call listModels with details=true to get the model's config options and include them.
|
|
4294
4320
|
- When building code examples, use getActionDetails to get the exact input schema first.
|
|
4295
4321
|
- After the code block, optionally list config constraints (ranges, defaults) in a compact format.
|
|
4296
4322
|
- For discovery questions ("what can I do?"), return a compact list from the reference docs.
|
|
4297
4323
|
- Assume the caller already knows what the SDK is, how to install it, and how auth works.
|
|
4298
|
-
-
|
|
4299
|
-
- Model tags in the summary are editorial labels, not technical specs. When answering questions about model capabilities (supported inputs, config options, dimensions, etc.), call listModels with details=true to check the \`inputs\` array \u2014 that is the source of truth. For example, a model supports start frame images if it has an input with type "imageUrl" or "imageUrlArray", not because its tags say "Source Image".
|
|
4324
|
+
- Model tags in the summary are editorial labels, not technical specs. When answering questions about model capabilities (supported inputs, config options, dimensions, etc.), call listModels with details=true to check the \`inputs\` array \u2014 that is the source of truth.
|
|
4300
4325
|
</response_format>
|
|
4301
4326
|
</instructions>`;
|
|
4302
4327
|
return `${identity}
|
|
@@ -4522,7 +4547,7 @@ async function startMcpServer(options) {
|
|
|
4522
4547
|
capabilities: { tools: {} },
|
|
4523
4548
|
serverInfo: {
|
|
4524
4549
|
name: "mindstudio-agent",
|
|
4525
|
-
version: "0.1.
|
|
4550
|
+
version: "0.1.21"
|
|
4526
4551
|
},
|
|
4527
4552
|
instructions: 'Welcome to MindStudio \u2014 a platform with 200+ AI models, 850+ third-party integrations, and pre-built agents.\n\nGetting started:\n1. Call `ask` with any question about the SDK \u2014 it knows every action, model, and connector and returns working code with real model IDs and config options. Examples: ask("generate an image with FLUX"), ask("what models support vision?"), ask("how do I send a Slack message?").\n2. Call `changeName` to set your display name \u2014 use your name or whatever your user calls you. This is how you\'ll appear in MindStudio request logs.\n3. If you have a profile picture or icon, call `uploadFile` to upload it, then `changeProfilePicture` with the returned URL.\n4. For manual browsing, call `listActions` to discover all available actions.\n\nThen use the tools to generate text, images, video, audio, search the web, work with data sources, run agents, and more.\n\nImportant:\n- AI-powered actions (text generation, image generation, video, audio, etc.) cost money. Before running these, call `estimateActionCost` and confirm with the user before proceeding \u2014 unless they\'ve explicitly told you to go ahead.\n- Not all agents from `listAgents` are configured for API use. Do not try to run an agent just because it appears in the list \u2014 it will likely fail. Only run agents the user specifically asks you to run.'
|
|
4528
4553
|
});
|
|
@@ -5362,7 +5387,7 @@ function isNewerVersion(current, latest) {
|
|
|
5362
5387
|
return false;
|
|
5363
5388
|
}
|
|
5364
5389
|
async function checkForUpdate() {
|
|
5365
|
-
const currentVersion = "0.1.
|
|
5390
|
+
const currentVersion = "0.1.21";
|
|
5366
5391
|
if (!currentVersion) return null;
|
|
5367
5392
|
try {
|
|
5368
5393
|
const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
@@ -5391,13 +5416,86 @@ async function checkForUpdate() {
|
|
|
5391
5416
|
}
|
|
5392
5417
|
}
|
|
5393
5418
|
function printUpdateNotice(latestVersion) {
|
|
5394
|
-
const currentVersion = "0.1.
|
|
5419
|
+
const currentVersion = "0.1.21";
|
|
5395
5420
|
process.stderr.write(
|
|
5396
5421
|
`
|
|
5397
5422
|
${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
|
|
5398
|
-
${ansi2.gray("Run")}
|
|
5423
|
+
${ansi2.gray("Run")} mindstudio update ${ansi2.gray("to update")}
|
|
5424
|
+
`
|
|
5425
|
+
);
|
|
5426
|
+
}
|
|
5427
|
+
function isStandaloneBinary() {
|
|
5428
|
+
const argv1 = process.argv[1] ?? "";
|
|
5429
|
+
return !argv1.includes("node_modules");
|
|
5430
|
+
}
|
|
5431
|
+
async function cmdUpdate() {
|
|
5432
|
+
const currentVersion = "0.1.21";
|
|
5433
|
+
process.stderr.write(
|
|
5434
|
+
` ${ansi2.gray("Current version:")} ${currentVersion}
|
|
5435
|
+
`
|
|
5436
|
+
);
|
|
5437
|
+
process.stderr.write(` ${ansi2.gray("Checking for updates...")}
|
|
5438
|
+
`);
|
|
5439
|
+
let latestVersion;
|
|
5440
|
+
try {
|
|
5441
|
+
const res = await fetch(
|
|
5442
|
+
"https://registry.npmjs.org/@mindstudio-ai/agent/latest",
|
|
5443
|
+
{ signal: AbortSignal.timeout(1e4) }
|
|
5444
|
+
);
|
|
5445
|
+
if (!res.ok) {
|
|
5446
|
+
fatal("Failed to check for updates. Please try again later.");
|
|
5447
|
+
}
|
|
5448
|
+
const data = await res.json();
|
|
5449
|
+
latestVersion = data.version ?? "";
|
|
5450
|
+
if (!latestVersion) {
|
|
5451
|
+
fatal("Failed to check for updates. Please try again later.");
|
|
5452
|
+
}
|
|
5453
|
+
} catch {
|
|
5454
|
+
fatal(
|
|
5455
|
+
"Failed to check for updates. Please check your internet connection."
|
|
5456
|
+
);
|
|
5457
|
+
}
|
|
5458
|
+
if (!isNewerVersion(currentVersion, latestVersion)) {
|
|
5459
|
+
process.stderr.write(
|
|
5460
|
+
` ${ansi2.greenBold("Already up to date!")} ${ansi2.gray("(" + currentVersion + ")")}
|
|
5461
|
+
`
|
|
5462
|
+
);
|
|
5463
|
+
return;
|
|
5464
|
+
}
|
|
5465
|
+
process.stderr.write(
|
|
5466
|
+
` ${ansi2.cyanBright("Updating")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
|
|
5399
5467
|
`
|
|
5400
5468
|
);
|
|
5469
|
+
if (isStandaloneBinary()) {
|
|
5470
|
+
const platform = process.platform;
|
|
5471
|
+
try {
|
|
5472
|
+
if (platform === "win32") {
|
|
5473
|
+
execSync(
|
|
5474
|
+
'powershell -Command "irm https://msagent.ai/install.ps1 | iex"',
|
|
5475
|
+
{ stdio: "inherit" }
|
|
5476
|
+
);
|
|
5477
|
+
} else {
|
|
5478
|
+
execSync("curl -fsSL https://msagent.ai/install.sh | bash", {
|
|
5479
|
+
stdio: "inherit"
|
|
5480
|
+
});
|
|
5481
|
+
}
|
|
5482
|
+
process.stderr.write(
|
|
5483
|
+
`
|
|
5484
|
+
${ansi2.greenBold("Updated to " + latestVersion)}
|
|
5485
|
+
`
|
|
5486
|
+
);
|
|
5487
|
+
} catch {
|
|
5488
|
+
fatal("Update failed. Try running the install command manually.");
|
|
5489
|
+
}
|
|
5490
|
+
} else {
|
|
5491
|
+
process.stderr.write(
|
|
5492
|
+
`
|
|
5493
|
+
${ansi2.gray("Run the following command to update:")}
|
|
5494
|
+
|
|
5495
|
+
npm install -g @mindstudio-ai/agent@latest
|
|
5496
|
+
`
|
|
5497
|
+
);
|
|
5498
|
+
}
|
|
5401
5499
|
}
|
|
5402
5500
|
function printLogo() {
|
|
5403
5501
|
const lines = LOGO.split("\n");
|
|
@@ -5446,7 +5544,7 @@ async function cmdLogin(options) {
|
|
|
5446
5544
|
process.stderr.write("\n");
|
|
5447
5545
|
printLogo();
|
|
5448
5546
|
process.stderr.write("\n");
|
|
5449
|
-
const ver = "0.1.
|
|
5547
|
+
const ver = "0.1.21";
|
|
5450
5548
|
process.stderr.write(
|
|
5451
5549
|
` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
|
|
5452
5550
|
`
|
|
@@ -5746,11 +5844,11 @@ async function main() {
|
|
|
5746
5844
|
process.exit(1);
|
|
5747
5845
|
}
|
|
5748
5846
|
const command = positionals[0];
|
|
5749
|
-
const updatePromise = command !== "mcp" && command !== "login" ? checkForUpdate() : Promise.resolve(null);
|
|
5847
|
+
const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
|
|
5750
5848
|
try {
|
|
5751
5849
|
if (command === "version" || command === "-v") {
|
|
5752
5850
|
process.stdout.write(
|
|
5753
|
-
"0.1.
|
|
5851
|
+
"0.1.21\n"
|
|
5754
5852
|
);
|
|
5755
5853
|
return;
|
|
5756
5854
|
}
|
|
@@ -5771,6 +5869,10 @@ async function main() {
|
|
|
5771
5869
|
});
|
|
5772
5870
|
return;
|
|
5773
5871
|
}
|
|
5872
|
+
if (command === "update") {
|
|
5873
|
+
await cmdUpdate();
|
|
5874
|
+
return;
|
|
5875
|
+
}
|
|
5774
5876
|
if (command === "ask") {
|
|
5775
5877
|
let question = positionals.slice(1).join(" ");
|
|
5776
5878
|
if (!question && !process.stdin.isTTY) {
|
|
@@ -6211,6 +6313,7 @@ Account:
|
|
|
6211
6313
|
change-name <name> Update your display name
|
|
6212
6314
|
change-profile-picture <url> Update your profile picture
|
|
6213
6315
|
upload <filepath> Upload a file to the MindStudio CDN
|
|
6316
|
+
update Update to the latest version
|
|
6214
6317
|
|
|
6215
6318
|
OAuth integrations:
|
|
6216
6319
|
list-connectors [<id> [<actionId>]] Browse OAuth connector services
|