@mindstudio-ai/agent 0.1.89 → 0.1.90
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 +43 -16
- package/dist/index.d.ts +3 -0
- package/dist/index.js +36 -9
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +43 -16
- package/llms.txt +2 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3211,6 +3211,8 @@ interface ExtractAudioFromVideoStepOutput {
|
|
|
3211
3211
|
interface ExtractTextStepInput {
|
|
3212
3212
|
/** URL or array of URLs to extract text from. Accepts a single URL, comma-separated list, or JSON array */
|
|
3213
3213
|
url: string | string[];
|
|
3214
|
+
/** Optional extraction model id (a `document_extraction` model, e.g. `mistral-ocr-latest`, `llamaparse`, `google-document-ai`). Defaults to the platform default when omitted. */
|
|
3215
|
+
model?: string;
|
|
3214
3216
|
}
|
|
3215
3217
|
interface ExtractTextStepOutput {
|
|
3216
3218
|
/** Extracted text content. A single string for one URL, or an array for multiple URLs */
|
|
@@ -7269,6 +7271,7 @@ interface StepMethods {
|
|
|
7269
7271
|
* - 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.
|
|
7270
7272
|
* - Accepts a single URL, a comma-separated list of URLs, or a JSON array of URLs.
|
|
7271
7273
|
* - Files are rehosted on the MindStudio CDN before extraction.
|
|
7274
|
+
* - Optionally set `model` to a specific document-extraction model (`mistral-ocr-latest`, `llamaparse`, `google-document-ai`); omit to use the platform default.
|
|
7272
7275
|
* - Maximum file size is 50MB per URL.
|
|
7273
7276
|
*
|
|
7274
7277
|
* @example
|
package/dist/index.js
CHANGED
|
@@ -107,8 +107,16 @@ var WS_OPEN_TIMEOUT_MS = 5e3;
|
|
|
107
107
|
var WS_OPEN = 1;
|
|
108
108
|
var WS_MAX_FRAME_CHARS = 9e5;
|
|
109
109
|
var DbWsTransportError = class extends Error {
|
|
110
|
+
constructor(message, sent = false) {
|
|
111
|
+
super(message);
|
|
112
|
+
this.sent = sent;
|
|
113
|
+
}
|
|
110
114
|
name = "DbWsTransportError";
|
|
111
115
|
};
|
|
116
|
+
function isReadOnlySql(sql) {
|
|
117
|
+
const head = sql.trimStart().slice(0, 8).toUpperCase();
|
|
118
|
+
return head.startsWith("SELECT") || head.startsWith("PRAGMA") || head.startsWith("EXPLAIN");
|
|
119
|
+
}
|
|
112
120
|
var socket = null;
|
|
113
121
|
var opening = null;
|
|
114
122
|
var idCounter = 0;
|
|
@@ -136,7 +144,7 @@ function getOrOpen(url) {
|
|
|
136
144
|
opening = null;
|
|
137
145
|
for (const [, p] of pending) {
|
|
138
146
|
clearTimeout(p.timer);
|
|
139
|
-
p.reject(err);
|
|
147
|
+
p.reject(new DbWsTransportError(err.message, true));
|
|
140
148
|
}
|
|
141
149
|
pending.clear();
|
|
142
150
|
reject(err);
|
|
@@ -206,7 +214,7 @@ async function executeDbBatchOverWs(url, token, databaseId, queries) {
|
|
|
206
214
|
return await new Promise((resolve, reject) => {
|
|
207
215
|
const timer = setTimeout(() => {
|
|
208
216
|
pending.delete(id);
|
|
209
|
-
reject(new DbWsTransportError("ws execute timed out"));
|
|
217
|
+
reject(new DbWsTransportError("ws execute timed out", true));
|
|
210
218
|
}, WS_REQUEST_TIMEOUT_MS);
|
|
211
219
|
pending.set(id, { resolve, reject, timer });
|
|
212
220
|
try {
|
|
@@ -215,7 +223,10 @@ async function executeDbBatchOverWs(url, token, databaseId, queries) {
|
|
|
215
223
|
clearTimeout(timer);
|
|
216
224
|
pending.delete(id);
|
|
217
225
|
reject(
|
|
218
|
-
new DbWsTransportError(
|
|
226
|
+
new DbWsTransportError(
|
|
227
|
+
`ws send failed: ${err?.message || "unknown"}`,
|
|
228
|
+
false
|
|
229
|
+
)
|
|
219
230
|
);
|
|
220
231
|
}
|
|
221
232
|
});
|
|
@@ -2509,8 +2520,8 @@ var stepMetadata = {
|
|
|
2509
2520
|
"extractText": {
|
|
2510
2521
|
stepType: "extractText",
|
|
2511
2522
|
description: "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.",
|
|
2512
|
-
usageNotes: "- Best suited for PDFs and raw text/document files. For web pages, use the scrapeUrl step instead.\n- 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 \u2014 there is no need to convert PDF pages to images first.\n- Accepts a single URL, a comma-separated list of URLs, or a JSON array of URLs.\n- Files are rehosted on the MindStudio CDN before extraction.\n- Maximum file size is 50MB per URL.",
|
|
2513
|
-
inputSchema: { "type": "object", "properties": { "url": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["url"] },
|
|
2523
|
+
usageNotes: "- Best suited for PDFs and raw text/document files. For web pages, use the scrapeUrl step instead.\n- 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 \u2014 there is no need to convert PDF pages to images first.\n- Accepts a single URL, a comma-separated list of URLs, or a JSON array of URLs.\n- Files are rehosted on the MindStudio CDN before extraction.\n- Optionally set `model` to a specific document-extraction model (`mistral-ocr-latest`, `llamaparse`, `google-document-ai`); omit to use the platform default.\n- Maximum file size is 50MB per URL.",
|
|
2524
|
+
inputSchema: { "type": "object", "properties": { "url": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] }, "model": { "type": "string", "description": "Optional extraction model id (a `document_extraction` model, e.g. `mistral-ocr-latest`, `llamaparse`, `google-document-ai`). Defaults to the platform default when omitted." } }, "required": ["url"] },
|
|
2514
2525
|
outputSchema: { "type": "object", "properties": { "text": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["text"] }
|
|
2515
2526
|
},
|
|
2516
2527
|
"fetchDataSourceDocument": {
|
|
@@ -4353,7 +4364,9 @@ var MindStudioAgent = class {
|
|
|
4353
4364
|
...options?.appId != null && { appId: options.appId },
|
|
4354
4365
|
...threadId != null && { threadId },
|
|
4355
4366
|
...this._currentStreamId != null && { streamId: this._currentStreamId },
|
|
4356
|
-
...this._requestSource != null && {
|
|
4367
|
+
...this._requestSource != null && {
|
|
4368
|
+
requestSource: this._requestSource
|
|
4369
|
+
},
|
|
4357
4370
|
...assetStoreBody(options?.store)
|
|
4358
4371
|
});
|
|
4359
4372
|
const remaining = headers.get("x-ratelimit-remaining");
|
|
@@ -4438,7 +4451,9 @@ var MindStudioAgent = class {
|
|
|
4438
4451
|
...options.appId != null && { appId: options.appId },
|
|
4439
4452
|
...threadId != null && { threadId },
|
|
4440
4453
|
...this._currentStreamId != null && { streamId: this._currentStreamId },
|
|
4441
|
-
...this._requestSource != null && {
|
|
4454
|
+
...this._requestSource != null && {
|
|
4455
|
+
requestSource: this._requestSource
|
|
4456
|
+
},
|
|
4442
4457
|
...assetStoreBody(options.store)
|
|
4443
4458
|
};
|
|
4444
4459
|
await this._httpConfig.rateLimiter.acquire();
|
|
@@ -4626,7 +4641,9 @@ var MindStudioAgent = class {
|
|
|
4626
4641
|
})),
|
|
4627
4642
|
...options?.appId != null && { appId: options.appId },
|
|
4628
4643
|
...threadId != null && { threadId },
|
|
4629
|
-
...this._requestSource != null && {
|
|
4644
|
+
...this._requestSource != null && {
|
|
4645
|
+
requestSource: this._requestSource
|
|
4646
|
+
},
|
|
4630
4647
|
...assetStoreBody(options?.store)
|
|
4631
4648
|
});
|
|
4632
4649
|
const pollUrl = `${this._currentHttpConfig.baseUrl}/developer/v2/steps/execute-batch-async/poll/${asyncData.batchToken}`;
|
|
@@ -5242,6 +5259,13 @@ var MindStudioAgent = class {
|
|
|
5242
5259
|
if (!(err instanceof DbWsTransportError)) {
|
|
5243
5260
|
throw err;
|
|
5244
5261
|
}
|
|
5262
|
+
if (err.sent && queries.some((q) => !isReadOnlySql(q.sql))) {
|
|
5263
|
+
throw new MindStudioError(
|
|
5264
|
+
"[db] Connection was interrupted after this query was sent; because it contains a write, it was not automatically retried (the write may or may not have been applied). Verify the current state before re-running it.",
|
|
5265
|
+
"db_transport_interrupted",
|
|
5266
|
+
503
|
|
5267
|
+
);
|
|
5268
|
+
}
|
|
5245
5269
|
console.warn(
|
|
5246
5270
|
`[mindstudio] db: WebSocket transport unavailable (${err.message}); using HTTP for this query.`
|
|
5247
5271
|
);
|
|
@@ -5632,7 +5656,10 @@ var MindStudioAgent = class {
|
|
|
5632
5656
|
content.byteOffset,
|
|
5633
5657
|
content.byteOffset + content.byteLength
|
|
5634
5658
|
);
|
|
5635
|
-
const fileBlob = new Blob(
|
|
5659
|
+
const fileBlob = new Blob(
|
|
5660
|
+
[buf],
|
|
5661
|
+
options.type ? { type: options.type } : void 0
|
|
5662
|
+
);
|
|
5636
5663
|
form.append("file", fileBlob, filename);
|
|
5637
5664
|
const res = await fetch(data.url, { method: "POST", body: form });
|
|
5638
5665
|
if (!res.ok) {
|