@mindstudio-ai/agent 0.1.47 → 0.1.48
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 +74 -41
- package/dist/index.d.ts +3 -2
- package/dist/index.js +68 -35
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +74 -41
- package/package.json +1 -1
package/dist/postinstall.js
CHANGED
|
@@ -2776,15 +2776,16 @@ var init_table = __esm({
|
|
|
2776
2776
|
// -------------------------------------------------------------------------
|
|
2777
2777
|
// Internal helpers
|
|
2778
2778
|
// -------------------------------------------------------------------------
|
|
2779
|
-
/** @internal Throw if data includes a platform-managed
|
|
2779
|
+
/** @internal Throw if data includes a platform-managed read-only column. */
|
|
2780
2780
|
_checkManagedColumns(data) {
|
|
2781
2781
|
const mc = this._config.managedColumns;
|
|
2782
2782
|
if (!mc) return;
|
|
2783
2783
|
const keys = Object.keys(data);
|
|
2784
2784
|
for (const key of keys) {
|
|
2785
|
-
if (mc.email && key === mc.email || mc.phone && key === mc.phone) {
|
|
2785
|
+
if (mc.email && key === mc.email || mc.phone && key === mc.phone || mc.apiKey && key === mc.apiKey) {
|
|
2786
|
+
const friendly = key === mc.email ? "email" : key === mc.phone ? "phone" : "API key";
|
|
2786
2787
|
throw new MindStudioError(
|
|
2787
|
-
`Cannot write to "${key}" \u2014 this column is managed by auth. Use the auth API to change a user's ${
|
|
2788
|
+
`Cannot write to "${key}" \u2014 this column is managed by auth. Use the auth API to change a user's ${friendly}.`,
|
|
2788
2789
|
"managed_column_write",
|
|
2789
2790
|
400
|
|
2790
2791
|
);
|
|
@@ -3854,48 +3855,80 @@ var init_client = __esm({
|
|
|
3854
3855
|
);
|
|
3855
3856
|
}
|
|
3856
3857
|
const threadId = options?.threadId ?? (this._reuseThreadId && !getRequestContext() ? this._threadId : void 0);
|
|
3857
|
-
const { data, headers } = await request(this.
|
|
3858
|
+
const { data: asyncData, headers } = await request(this._currentHttpConfig, "POST", `/steps/${stepType}/execute-async`, {
|
|
3858
3859
|
step,
|
|
3859
3860
|
...options?.appId != null && { appId: options.appId },
|
|
3860
3861
|
...threadId != null && { threadId },
|
|
3861
3862
|
...this._currentStreamId != null && { streamId: this._currentStreamId }
|
|
3862
3863
|
});
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3864
|
+
const remaining = headers.get("x-ratelimit-remaining");
|
|
3865
|
+
const returnedThreadId = asyncData.threadId ?? "";
|
|
3866
|
+
if (this._reuseThreadId && returnedThreadId && !getRequestContext()) {
|
|
3867
|
+
this._threadId = returnedThreadId;
|
|
3868
|
+
}
|
|
3869
|
+
if (!this._appId && asyncData.appId && !getRequestContext()) {
|
|
3870
|
+
this._appId = asyncData.appId;
|
|
3871
|
+
}
|
|
3872
|
+
const pollUrl = `${this._currentHttpConfig.baseUrl}/developer/v2/steps/${stepType}/execute-async/poll/${asyncData.executionToken}`;
|
|
3873
|
+
let pollDelay = 100;
|
|
3874
|
+
while (true) {
|
|
3875
|
+
await sleep3(pollDelay);
|
|
3876
|
+
pollDelay = Math.min(pollDelay * 2, 5e3);
|
|
3877
|
+
const res = await fetch(pollUrl, {
|
|
3878
|
+
headers: { "User-Agent": "@mindstudio-ai/agent" }
|
|
3879
|
+
});
|
|
3880
|
+
if (res.status === 502 || res.status === 503 || res.status === 504) continue;
|
|
3881
|
+
if (res.status === 404) {
|
|
3882
|
+
throw new MindStudioError(
|
|
3883
|
+
`[${stepType}] Execution token expired.`,
|
|
3884
|
+
"poll_token_expired",
|
|
3885
|
+
404
|
|
3886
|
+
);
|
|
3887
|
+
}
|
|
3868
3888
|
if (!res.ok) {
|
|
3889
|
+
const errorBody = await res.json().catch(() => ({}));
|
|
3869
3890
|
throw new MindStudioError(
|
|
3870
|
-
|
|
3871
|
-
"
|
|
3872
|
-
res.status
|
|
3891
|
+
errorBody.message ?? errorBody.error ?? `[${stepType}] Poll failed: ${res.status} ${res.statusText}`,
|
|
3892
|
+
errorBody.code ?? "poll_error",
|
|
3893
|
+
res.status,
|
|
3894
|
+
errorBody
|
|
3873
3895
|
);
|
|
3874
3896
|
}
|
|
3875
|
-
const
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3897
|
+
const poll = await res.json();
|
|
3898
|
+
if (poll.status === "pending") continue;
|
|
3899
|
+
if (poll.status === "error") {
|
|
3900
|
+
throw new MindStudioError(
|
|
3901
|
+
`[${stepType}] ${poll.error ?? "Step execution failed."}`,
|
|
3902
|
+
"step_error",
|
|
3903
|
+
500
|
|
3904
|
+
);
|
|
3905
|
+
}
|
|
3906
|
+
let output;
|
|
3907
|
+
if (poll.output != null) {
|
|
3908
|
+
output = poll.output;
|
|
3909
|
+
} else if (poll.outputUrl) {
|
|
3910
|
+
const s3Res = await fetch(poll.outputUrl);
|
|
3911
|
+
if (!s3Res.ok) {
|
|
3912
|
+
throw new MindStudioError(
|
|
3913
|
+
`Failed to fetch ${stepType} output from S3: ${s3Res.status} ${s3Res.statusText}`,
|
|
3914
|
+
"output_fetch_error",
|
|
3915
|
+
s3Res.status
|
|
3916
|
+
);
|
|
3917
|
+
}
|
|
3918
|
+
const envelope = await s3Res.json();
|
|
3919
|
+
output = envelope.value;
|
|
3920
|
+
} else {
|
|
3921
|
+
output = void 0;
|
|
3922
|
+
}
|
|
3923
|
+
return {
|
|
3924
|
+
...output,
|
|
3925
|
+
$appId: poll.appId ?? asyncData.appId ?? "",
|
|
3926
|
+
$threadId: poll.threadId ?? returnedThreadId,
|
|
3927
|
+
$rateLimitRemaining: remaining != null ? parseInt(remaining, 10) : void 0,
|
|
3928
|
+
$billingCost: poll.billingCost,
|
|
3929
|
+
$billingEvents: poll.billingEvents
|
|
3930
|
+
};
|
|
3887
3931
|
}
|
|
3888
|
-
const remaining = headers.get("x-ratelimit-remaining");
|
|
3889
|
-
const billingCost = headers.get("x-mindstudio-billing-cost");
|
|
3890
|
-
const billingEvents = headers.get("x-mindstudio-billing-events");
|
|
3891
|
-
return {
|
|
3892
|
-
...output,
|
|
3893
|
-
$appId: headers.get("x-mindstudio-app-id") ?? "",
|
|
3894
|
-
$threadId: returnedThreadId,
|
|
3895
|
-
$rateLimitRemaining: remaining != null ? parseInt(remaining, 10) : void 0,
|
|
3896
|
-
$billingCost: billingCost != null ? parseFloat(billingCost) : void 0,
|
|
3897
|
-
$billingEvents: billingEvents != null ? JSON.parse(billingEvents) : void 0
|
|
3898
|
-
};
|
|
3899
3932
|
}
|
|
3900
3933
|
/**
|
|
3901
3934
|
* @internal Streaming step execution — sends `Accept: text/event-stream`
|
|
@@ -5525,7 +5558,7 @@ async function startMcpServer(options) {
|
|
|
5525
5558
|
capabilities: { tools: {} },
|
|
5526
5559
|
serverInfo: {
|
|
5527
5560
|
name: "mindstudio-agent",
|
|
5528
|
-
version: "0.1.
|
|
5561
|
+
version: "0.1.48"
|
|
5529
5562
|
},
|
|
5530
5563
|
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.'
|
|
5531
5564
|
});
|
|
@@ -6386,7 +6419,7 @@ function isNewerVersion(current, latest) {
|
|
|
6386
6419
|
return false;
|
|
6387
6420
|
}
|
|
6388
6421
|
async function checkForUpdate() {
|
|
6389
|
-
const currentVersion = "0.1.
|
|
6422
|
+
const currentVersion = "0.1.48";
|
|
6390
6423
|
if (!currentVersion) return null;
|
|
6391
6424
|
try {
|
|
6392
6425
|
const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
@@ -6415,7 +6448,7 @@ async function checkForUpdate() {
|
|
|
6415
6448
|
}
|
|
6416
6449
|
}
|
|
6417
6450
|
function printUpdateNotice(latestVersion) {
|
|
6418
|
-
const currentVersion = "0.1.
|
|
6451
|
+
const currentVersion = "0.1.48";
|
|
6419
6452
|
process.stderr.write(
|
|
6420
6453
|
`
|
|
6421
6454
|
${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
|
|
@@ -6428,7 +6461,7 @@ function isStandaloneBinary() {
|
|
|
6428
6461
|
return !argv1.includes("node_modules");
|
|
6429
6462
|
}
|
|
6430
6463
|
async function cmdUpdate() {
|
|
6431
|
-
const currentVersion = "0.1.
|
|
6464
|
+
const currentVersion = "0.1.48";
|
|
6432
6465
|
process.stderr.write(
|
|
6433
6466
|
` ${ansi2.gray("Current version:")} ${currentVersion}
|
|
6434
6467
|
`
|
|
@@ -6543,7 +6576,7 @@ async function cmdLogin(options) {
|
|
|
6543
6576
|
process.stderr.write("\n");
|
|
6544
6577
|
printLogo();
|
|
6545
6578
|
process.stderr.write("\n");
|
|
6546
|
-
const ver = "0.1.
|
|
6579
|
+
const ver = "0.1.48";
|
|
6547
6580
|
process.stderr.write(
|
|
6548
6581
|
` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
|
|
6549
6582
|
`
|
|
@@ -6854,7 +6887,7 @@ async function main() {
|
|
|
6854
6887
|
try {
|
|
6855
6888
|
if (command === "version" || command === "-v") {
|
|
6856
6889
|
process.stdout.write(
|
|
6857
|
-
"0.1.
|
|
6890
|
+
"0.1.48\n"
|
|
6858
6891
|
);
|
|
6859
6892
|
return;
|
|
6860
6893
|
}
|