@mindstudio-ai/agent 0.1.174 → 0.1.176
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/CHANGELOG.md +14 -0
- package/dist/cli.js +55 -12
- package/dist/index.d.ts +24 -1
- package/dist/index.js +41 -5
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +55 -12
- package/llms.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ What changed in `@mindstudio-ai/agent`, newest first, each version under its own
|
|
|
4
4
|
|
|
5
5
|
Versions before 0.1.163 aren't recorded here.
|
|
6
6
|
|
|
7
|
+
## 0.1.176
|
|
8
|
+
|
|
9
|
+
### Changed behavior
|
|
10
|
+
|
|
11
|
+
- The platform limits how many file calls an app's methods make a minute, all of a store's operations together (`put`, `get`, `head`, `list`, `delete`, uploads and their parts, signed URLs), at 10,000 by default. A file call it refuses never ran, so the SDK sends it again every few seconds for a little over a minute, and only then throws `MindStudioError` with `code === 'rate_limited'`. An app moving files flat out runs at the limit, its calls taking longer, rather than failing past it. Check: code that moves many files in one go (an import, a bulk copy) should expect it to take minutes at that rate, and a loop that times its own file calls should allow for the wait.
|
|
12
|
+
- `renderVideoFromHtmlComposition` renders with HyperFrames 0.8.186, and its usage notes name that version, where they named 0.8.148. A render now fails where a frame can't be read, where it used to finish a shorter or smaller video than it asked for without saying why. Check: a composition written for 0.8.148 still lints clean under 0.8.186's `hyperframes lint`, and an app that installed `@hyperframes/player` at 0.8.148 for previews moves it to 0.8.186, so the preview matches the render.
|
|
13
|
+
|
|
14
|
+
## 0.1.175
|
|
15
|
+
|
|
16
|
+
### New
|
|
17
|
+
|
|
18
|
+
- `defineTable` takes `indexes`: column groups, each a plain (non-unique) index for the columns the table's queries filter or sort by, like `indexes: [['status'], ['customerId', 'createdAt']]`. The platform adds and drops them in place as the list changes, without rebuilding the table. A table can declare up to 16. Check: a table whose queries filter a column that isn't the first of a `unique` group reads every row; declaring an index on it makes those lookups.
|
|
19
|
+
- A query that took a while because it read every row of a table logs `[mindstudio] A query read every row of '<table>' (<n> ms)…`, from the platform's plan of it, at most once per statement shape every 15 minutes. An index on the columns it filters or sorts by makes it a lookup.
|
|
20
|
+
|
|
7
21
|
## 0.1.174
|
|
8
22
|
|
|
9
23
|
### New
|
package/dist/cli.js
CHANGED
|
@@ -825,7 +825,7 @@ var init_metadata = __esm({
|
|
|
825
825
|
"renderVideoFromHtmlComposition": {
|
|
826
826
|
stepType: "renderVideoFromHtmlComposition",
|
|
827
827
|
description: "Render an HTML composition (HTML, CSS, media and seekable animation on a timeline) to a video file",
|
|
828
|
-
usageNotes: "- Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.
|
|
828
|
+
usageNotes: "- Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.186, in Chrome off the app's own sandbox; author for that version\n- Pass the composition as `html`, the page itself (up to 10 MB), or as `project`, the URL of a zip of a project's folder (`index.html` at its root, or the file `entryFile` names) or of one HTML file, up to 2 GiB: an app file or any public URL\n- `variables` overrides the composition's `data-composition-variables` defaults, which it reads with `window.__hyperframes.getVariables()`\n- Whatever the composition loads itself (fonts, scripts, images, video) is fetched as it renders, so each is in the project or at a public URL; a private app file needs a signed URL\n- fps 24, 30 or 60 (default 30); quality draft, standard or high (default standard); format mp4 (default), webm or mov (both keep transparency), or gif\n- An mp4, webm or mov renders in chunks of about 10 seconds side by side, so a long video takes little longer than a short one; a call finishes within about 30 minutes, and reports its progress as it goes. A gif renders whole, within 15 minutes\n- A composition HyperFrames can't render fails with HyperFrames' own reason",
|
|
829
829
|
inputSchema: { "type": "object", "properties": { "html": { "type": "string", "description": "The composition's HTML, up to 10 MB; give this or project" }, "project": { "type": "string", "description": "URL of a zip of the project's folder, or of one self-contained HTML file; give this or html" }, "entryFile": { "type": "string", "description": "The entry HTML inside the zip, relative to its root; index.html when omitted" }, "variables": { "type": "object", "properties": {}, "required": [], "description": "Values over the composition's declared variables" }, "fps": { "enum": [24, 30, 60], "type": "number", "description": "Frames per second: 24, 30 (default) or 60" }, "quality": { "enum": ["draft", "standard", "high"], "type": "string", "description": "Encode quality: draft, standard (default) or high" }, "format": { "enum": ["mp4", "webm", "mov", "gif"], "type": "string", "description": "mp4 (default), webm or mov (both keep transparency), or gif" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" } } },
|
|
830
830
|
outputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the rendered video" }, "durationSec": { "type": "number", "description": "Its length in seconds" }, "frames": { "type": "number", "description": "How many frames it has" } }, "required": ["videoUrl", "durationSec", "frames"] }
|
|
831
831
|
},
|
|
@@ -1368,6 +1368,26 @@ var init_context = __esm({
|
|
|
1368
1368
|
}
|
|
1369
1369
|
});
|
|
1370
1370
|
|
|
1371
|
+
// src/db/scanHints.ts
|
|
1372
|
+
function warnTableScans(scans) {
|
|
1373
|
+
if (!Array.isArray(scans)) {
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
for (const scan of scans) {
|
|
1377
|
+
if (typeof scan?.table !== "string" || typeof scan?.ms !== "number" || !Number.isFinite(scan.ms)) {
|
|
1378
|
+
continue;
|
|
1379
|
+
}
|
|
1380
|
+
console.warn(
|
|
1381
|
+
`[mindstudio] A query read every row of '${scan.table}' (${Math.round(scan.ms)} ms). An index on the columns it filters or sorts by (defineTable's indexes) would make it a lookup.`
|
|
1382
|
+
);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
var init_scanHints = __esm({
|
|
1386
|
+
"src/db/scanHints.ts"() {
|
|
1387
|
+
"use strict";
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
|
|
1371
1391
|
// src/db-ws.ts
|
|
1372
1392
|
function isReadOnlySql(sql) {
|
|
1373
1393
|
const head = sql.trimStart().slice(0, 8).toUpperCase();
|
|
@@ -1435,6 +1455,7 @@ function deliver(self, msg) {
|
|
|
1435
1455
|
)
|
|
1436
1456
|
);
|
|
1437
1457
|
} else {
|
|
1458
|
+
warnTableScans(msg.scans);
|
|
1438
1459
|
p.resolve(msg.results);
|
|
1439
1460
|
}
|
|
1440
1461
|
}
|
|
@@ -1629,6 +1650,7 @@ var DB_WS_SUBPROTOCOL, WS_ACK_TIMEOUT_MS, WS_IDLE_TIMEOUT_MS, WS_OPEN_TIMEOUT_MS
|
|
|
1629
1650
|
var init_db_ws = __esm({
|
|
1630
1651
|
"src/db-ws.ts"() {
|
|
1631
1652
|
"use strict";
|
|
1653
|
+
init_scanHints();
|
|
1632
1654
|
init_errors();
|
|
1633
1655
|
DB_WS_SUBPROTOCOL = "ms-db-v2";
|
|
1634
1656
|
WS_ACK_TIMEOUT_MS = 2e4;
|
|
@@ -7589,7 +7611,7 @@ function resolveToken(provided, config) {
|
|
|
7589
7611
|
401
|
|
7590
7612
|
);
|
|
7591
7613
|
}
|
|
7592
|
-
var DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, toStepLogEvent, stepFailure, MindStudioAgent;
|
|
7614
|
+
var DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, FILES_RATE_LIMIT_WAIT_MS, toStepLogEvent, stepFailure, MindStudioAgent;
|
|
7593
7615
|
var init_client = __esm({
|
|
7594
7616
|
async "src/client.ts"() {
|
|
7595
7617
|
"use strict";
|
|
@@ -7604,6 +7626,7 @@ var init_client = __esm({
|
|
|
7604
7626
|
init_sql();
|
|
7605
7627
|
init_time();
|
|
7606
7628
|
init_readBatching();
|
|
7629
|
+
init_scanHints();
|
|
7607
7630
|
init_files();
|
|
7608
7631
|
init_datasources();
|
|
7609
7632
|
init_voice();
|
|
@@ -7616,6 +7639,7 @@ var init_client = __esm({
|
|
|
7616
7639
|
init_metadata();
|
|
7617
7640
|
DEFAULT_BASE_URL = "https://v1.mindstudio-api.com";
|
|
7618
7641
|
DEFAULT_MAX_RETRIES = 3;
|
|
7642
|
+
FILES_RATE_LIMIT_WAIT_MS = 75e3;
|
|
7619
7643
|
toStepLogEvent = (event) => ({
|
|
7620
7644
|
value: event.value,
|
|
7621
7645
|
tag: event.tag,
|
|
@@ -8879,12 +8903,30 @@ var init_client = __esm({
|
|
|
8879
8903
|
/**
|
|
8880
8904
|
* @internal Transport for the `files` namespace — POST /_internal/v2/files/<op>
|
|
8881
8905
|
* with the raw hook token (mirrors `_executeDbBatch`).
|
|
8906
|
+
*
|
|
8907
|
+
* Waits out the platform's per-app limit on file calls: its 429 comes before
|
|
8908
|
+
* the call does anything, whatever the op, so the call is sent again every
|
|
8909
|
+
* few seconds for a little over the limit's one-minute window, and only then
|
|
8910
|
+
* throws `rate_limited`. An app moving files flat out runs at the limit
|
|
8911
|
+
* rather than failing past it.
|
|
8882
8912
|
*/
|
|
8883
8913
|
async _filesRequest(op, body) {
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8914
|
+
const giveUpAt = Date.now() + FILES_RATE_LIMIT_WAIT_MS;
|
|
8915
|
+
while (true) {
|
|
8916
|
+
try {
|
|
8917
|
+
return await this._brokeredRequest("files", op, body, {
|
|
8918
|
+
fallbackMessage: "File operation failed",
|
|
8919
|
+
fallbackCode: "file_error"
|
|
8920
|
+
});
|
|
8921
|
+
} catch (err) {
|
|
8922
|
+
if (!(err instanceof MindStudioError) || err.status !== 429 || Date.now() >= giveUpAt) {
|
|
8923
|
+
throw err;
|
|
8924
|
+
}
|
|
8925
|
+
await new Promise(
|
|
8926
|
+
(resolve) => setTimeout(resolve, 4e3 + Math.random() * 2e3)
|
|
8927
|
+
);
|
|
8928
|
+
}
|
|
8929
|
+
}
|
|
8888
8930
|
}
|
|
8889
8931
|
/**
|
|
8890
8932
|
* @internal Transport for the `dataSources` namespace —
|
|
@@ -9084,6 +9126,7 @@ var init_client = __esm({
|
|
|
9084
9126
|
throw new MindStudioError(`[db] ${message}`, code, res.status);
|
|
9085
9127
|
}
|
|
9086
9128
|
const data = await res.json();
|
|
9129
|
+
warnTableScans(data.scans);
|
|
9087
9130
|
return data.results;
|
|
9088
9131
|
}
|
|
9089
9132
|
/**
|
|
@@ -10043,7 +10086,7 @@ async function startMcpServer(options) {
|
|
|
10043
10086
|
capabilities: { tools: {} },
|
|
10044
10087
|
serverInfo: {
|
|
10045
10088
|
name: "mindstudio-agent",
|
|
10046
|
-
version: "0.1.
|
|
10089
|
+
version: "0.1.176"
|
|
10047
10090
|
},
|
|
10048
10091
|
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, pass its public image URL to `changeProfilePicture`.\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.'
|
|
10049
10092
|
});
|
|
@@ -11083,7 +11126,7 @@ function isNewerVersion(current, latest) {
|
|
|
11083
11126
|
return false;
|
|
11084
11127
|
}
|
|
11085
11128
|
async function checkForUpdate() {
|
|
11086
|
-
const currentVersion = "0.1.
|
|
11129
|
+
const currentVersion = "0.1.176";
|
|
11087
11130
|
if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
|
|
11088
11131
|
return null;
|
|
11089
11132
|
}
|
|
@@ -11118,7 +11161,7 @@ async function checkForUpdate() {
|
|
|
11118
11161
|
}
|
|
11119
11162
|
}
|
|
11120
11163
|
function printUpdateNotice(latestVersion) {
|
|
11121
|
-
const currentVersion = "0.1.
|
|
11164
|
+
const currentVersion = "0.1.176";
|
|
11122
11165
|
process.stderr.write(
|
|
11123
11166
|
`
|
|
11124
11167
|
${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
|
|
@@ -11131,7 +11174,7 @@ function isStandaloneBinary() {
|
|
|
11131
11174
|
return !argv1.includes("node_modules");
|
|
11132
11175
|
}
|
|
11133
11176
|
async function cmdUpdate() {
|
|
11134
|
-
const currentVersion = "0.1.
|
|
11177
|
+
const currentVersion = "0.1.176";
|
|
11135
11178
|
process.stderr.write(
|
|
11136
11179
|
` ${ansi2.gray("Current version:")} ${currentVersion}
|
|
11137
11180
|
`
|
|
@@ -11272,7 +11315,7 @@ async function cmdLogin(options) {
|
|
|
11272
11315
|
process.stderr.write("\n");
|
|
11273
11316
|
printLogo();
|
|
11274
11317
|
process.stderr.write("\n");
|
|
11275
|
-
const ver = "0.1.
|
|
11318
|
+
const ver = "0.1.176";
|
|
11276
11319
|
process.stderr.write(
|
|
11277
11320
|
` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
|
|
11278
11321
|
`
|
|
@@ -11600,7 +11643,7 @@ async function main() {
|
|
|
11600
11643
|
const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
|
|
11601
11644
|
try {
|
|
11602
11645
|
if (command === "version" || command === "-v") {
|
|
11603
|
-
process.stdout.write("0.1.
|
|
11646
|
+
process.stdout.write("0.1.176\n");
|
|
11604
11647
|
return;
|
|
11605
11648
|
}
|
|
11606
11649
|
if (command === "login") {
|
package/dist/index.d.ts
CHANGED
|
@@ -1860,6 +1860,23 @@ interface DefineTableOptions<T = unknown> {
|
|
|
1860
1860
|
* ```
|
|
1861
1861
|
*/
|
|
1862
1862
|
unique?: (keyof T & string)[][];
|
|
1863
|
+
/**
|
|
1864
|
+
* Indexes for the table, for the columns its queries filter or sort by.
|
|
1865
|
+
* Each entry is an array of column names, most selective first; the
|
|
1866
|
+
* platform creates a plain (non-unique) SQLite index for each, and adds or
|
|
1867
|
+
* drops one in place when the list changes, without rebuilding the table.
|
|
1868
|
+
* An index makes a lookup on its columns read a few rows rather than the
|
|
1869
|
+
* whole table, and costs a little on every write, so declare the ones the
|
|
1870
|
+
* app's queries use.
|
|
1871
|
+
*
|
|
1872
|
+
* @example
|
|
1873
|
+
* ```ts
|
|
1874
|
+
* db.defineTable<Order>('orders', {
|
|
1875
|
+
* indexes: [['status'], ['customerId', 'createdAt']],
|
|
1876
|
+
* });
|
|
1877
|
+
* ```
|
|
1878
|
+
*/
|
|
1879
|
+
indexes?: (keyof T & string)[][];
|
|
1863
1880
|
/**
|
|
1864
1881
|
* Default values for columns, applied client-side in `push()` and
|
|
1865
1882
|
* `upsert()`. Explicit values in the input override defaults.
|
|
@@ -5435,6 +5452,12 @@ declare class MindStudioAgent$1 {
|
|
|
5435
5452
|
/**
|
|
5436
5453
|
* @internal Transport for the `files` namespace — POST /_internal/v2/files/<op>
|
|
5437
5454
|
* with the raw hook token (mirrors `_executeDbBatch`).
|
|
5455
|
+
*
|
|
5456
|
+
* Waits out the platform's per-app limit on file calls: its 429 comes before
|
|
5457
|
+
* the call does anything, whatever the op, so the call is sent again every
|
|
5458
|
+
* few seconds for a little over the limit's one-minute window, and only then
|
|
5459
|
+
* throws `rate_limited`. An app moving files flat out runs at the limit
|
|
5460
|
+
* rather than failing past it.
|
|
5438
5461
|
*/
|
|
5439
5462
|
private _filesRequest;
|
|
5440
5463
|
/**
|
|
@@ -11701,7 +11724,7 @@ interface StepMethods {
|
|
|
11701
11724
|
* Render an HTML composition (HTML, CSS, media and seekable animation on a timeline) to a video file
|
|
11702
11725
|
*
|
|
11703
11726
|
* @remarks
|
|
11704
|
-
* - Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.
|
|
11727
|
+
* - Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.186, in Chrome off the app's own sandbox; author for that version
|
|
11705
11728
|
* - Pass the composition as `html`, the page itself (up to 10 MB), or as `project`, the URL of a zip of a project's folder (`index.html` at its root, or the file `entryFile` names) or of one HTML file, up to 2 GiB: an app file or any public URL
|
|
11706
11729
|
* - `variables` overrides the composition's `data-composition-variables` defaults, which it reads with `window.__hyperframes.getVariables()`
|
|
11707
11730
|
* - Whatever the composition loads itself (fonts, scripts, images, video) is fetched as it renders, so each is in the project or at a public URL; a private app file needs a signed URL
|
package/dist/index.js
CHANGED
|
@@ -125,6 +125,21 @@ function runWithContext(ctx, fn) {
|
|
|
125
125
|
return als.run(ctx, fn);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
// src/db/scanHints.ts
|
|
129
|
+
function warnTableScans(scans) {
|
|
130
|
+
if (!Array.isArray(scans)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
for (const scan of scans) {
|
|
134
|
+
if (typeof scan?.table !== "string" || typeof scan?.ms !== "number" || !Number.isFinite(scan.ms)) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
console.warn(
|
|
138
|
+
`[mindstudio] A query read every row of '${scan.table}' (${Math.round(scan.ms)} ms). An index on the columns it filters or sorts by (defineTable's indexes) would make it a lookup.`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
128
143
|
// src/db-ws.ts
|
|
129
144
|
var DB_WS_SUBPROTOCOL = "ms-db-v2";
|
|
130
145
|
var WS_ACK_TIMEOUT_MS = 2e4;
|
|
@@ -210,6 +225,7 @@ function deliver(self, msg) {
|
|
|
210
225
|
)
|
|
211
226
|
);
|
|
212
227
|
} else {
|
|
228
|
+
warnTableScans(msg.scans);
|
|
213
229
|
p.resolve(msg.results);
|
|
214
230
|
}
|
|
215
231
|
}
|
|
@@ -5621,7 +5637,7 @@ var stepMetadata = {
|
|
|
5621
5637
|
"renderVideoFromHtmlComposition": {
|
|
5622
5638
|
stepType: "renderVideoFromHtmlComposition",
|
|
5623
5639
|
description: "Render an HTML composition (HTML, CSS, media and seekable animation on a timeline) to a video file",
|
|
5624
|
-
usageNotes: "- Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.
|
|
5640
|
+
usageNotes: "- Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.186, in Chrome off the app's own sandbox; author for that version\n- Pass the composition as `html`, the page itself (up to 10 MB), or as `project`, the URL of a zip of a project's folder (`index.html` at its root, or the file `entryFile` names) or of one HTML file, up to 2 GiB: an app file or any public URL\n- `variables` overrides the composition's `data-composition-variables` defaults, which it reads with `window.__hyperframes.getVariables()`\n- Whatever the composition loads itself (fonts, scripts, images, video) is fetched as it renders, so each is in the project or at a public URL; a private app file needs a signed URL\n- fps 24, 30 or 60 (default 30); quality draft, standard or high (default standard); format mp4 (default), webm or mov (both keep transparency), or gif\n- An mp4, webm or mov renders in chunks of about 10 seconds side by side, so a long video takes little longer than a short one; a call finishes within about 30 minutes, and reports its progress as it goes. A gif renders whole, within 15 minutes\n- A composition HyperFrames can't render fails with HyperFrames' own reason",
|
|
5625
5641
|
inputSchema: { "type": "object", "properties": { "html": { "type": "string", "description": "The composition's HTML, up to 10 MB; give this or project" }, "project": { "type": "string", "description": "URL of a zip of the project's folder, or of one self-contained HTML file; give this or html" }, "entryFile": { "type": "string", "description": "The entry HTML inside the zip, relative to its root; index.html when omitted" }, "variables": { "type": "object", "properties": {}, "required": [], "description": "Values over the composition's declared variables" }, "fps": { "enum": [24, 30, 60], "type": "number", "description": "Frames per second: 24, 30 (default) or 60" }, "quality": { "enum": ["draft", "standard", "high"], "type": "string", "description": "Encode quality: draft, standard (default) or high" }, "format": { "enum": ["mp4", "webm", "mov", "gif"], "type": "string", "description": "mp4 (default), webm or mov (both keep transparency), or gif" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" } } },
|
|
5626
5642
|
outputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the rendered video" }, "durationSec": { "type": "number", "description": "Its length in seconds" }, "frames": { "type": "number", "description": "How many frames it has" } }, "required": ["videoUrl", "durationSec", "frames"] }
|
|
5627
5643
|
},
|
|
@@ -7275,6 +7291,7 @@ function applyStepMethods(AgentClass) {
|
|
|
7275
7291
|
// src/client.ts
|
|
7276
7292
|
var DEFAULT_BASE_URL = "https://v1.mindstudio-api.com";
|
|
7277
7293
|
var DEFAULT_MAX_RETRIES = 3;
|
|
7294
|
+
var FILES_RATE_LIMIT_WAIT_MS = 75e3;
|
|
7278
7295
|
var toStepLogEvent = (event) => ({
|
|
7279
7296
|
value: event.value,
|
|
7280
7297
|
tag: event.tag,
|
|
@@ -8538,12 +8555,30 @@ var MindStudioAgent = class {
|
|
|
8538
8555
|
/**
|
|
8539
8556
|
* @internal Transport for the `files` namespace — POST /_internal/v2/files/<op>
|
|
8540
8557
|
* with the raw hook token (mirrors `_executeDbBatch`).
|
|
8558
|
+
*
|
|
8559
|
+
* Waits out the platform's per-app limit on file calls: its 429 comes before
|
|
8560
|
+
* the call does anything, whatever the op, so the call is sent again every
|
|
8561
|
+
* few seconds for a little over the limit's one-minute window, and only then
|
|
8562
|
+
* throws `rate_limited`. An app moving files flat out runs at the limit
|
|
8563
|
+
* rather than failing past it.
|
|
8541
8564
|
*/
|
|
8542
8565
|
async _filesRequest(op, body) {
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8566
|
+
const giveUpAt = Date.now() + FILES_RATE_LIMIT_WAIT_MS;
|
|
8567
|
+
while (true) {
|
|
8568
|
+
try {
|
|
8569
|
+
return await this._brokeredRequest("files", op, body, {
|
|
8570
|
+
fallbackMessage: "File operation failed",
|
|
8571
|
+
fallbackCode: "file_error"
|
|
8572
|
+
});
|
|
8573
|
+
} catch (err) {
|
|
8574
|
+
if (!(err instanceof MindStudioError) || err.status !== 429 || Date.now() >= giveUpAt) {
|
|
8575
|
+
throw err;
|
|
8576
|
+
}
|
|
8577
|
+
await new Promise(
|
|
8578
|
+
(resolve) => setTimeout(resolve, 4e3 + Math.random() * 2e3)
|
|
8579
|
+
);
|
|
8580
|
+
}
|
|
8581
|
+
}
|
|
8547
8582
|
}
|
|
8548
8583
|
/**
|
|
8549
8584
|
* @internal Transport for the `dataSources` namespace —
|
|
@@ -8743,6 +8778,7 @@ var MindStudioAgent = class {
|
|
|
8743
8778
|
throw new MindStudioError(`[db] ${message}`, code, res.status);
|
|
8744
8779
|
}
|
|
8745
8780
|
const data = await res.json();
|
|
8781
|
+
warnTableScans(data.scans);
|
|
8746
8782
|
return data.results;
|
|
8747
8783
|
}
|
|
8748
8784
|
/**
|