@mindstudio-ai/agent 0.1.81 → 0.1.82
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 +26 -12
- package/dist/index.d.ts +48 -6
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +26 -12
- package/llms.txt +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1302,11 +1302,26 @@ interface Db {
|
|
|
1302
1302
|
/**
|
|
1303
1303
|
* Tool configuration for {@link RunTaskOptions.tools}.
|
|
1304
1304
|
* - String: SDK method name (e.g. `'searchGoogle'`).
|
|
1305
|
-
* -
|
|
1305
|
+
* - `{ method }`: SDK method name with default input overrides.
|
|
1306
|
+
* - `{ appMethod }`: one of your own app's methods, called as the invoking
|
|
1307
|
+
* user with their roles.
|
|
1308
|
+
*
|
|
1309
|
+
* Defaults win over whatever the model passes for the same field, including
|
|
1310
|
+
* nested fields — the model decides what to do, you pin how it's done.
|
|
1306
1311
|
*/
|
|
1307
1312
|
type TaskToolConfig = string | {
|
|
1308
1313
|
method: string;
|
|
1309
1314
|
defaults?: Record<string, unknown>;
|
|
1315
|
+
} | {
|
|
1316
|
+
appMethod: string;
|
|
1317
|
+
/**
|
|
1318
|
+
* How this method should be framed for *this* task. Falls back to the
|
|
1319
|
+
* method's own description. Worth writing: the same method often serves
|
|
1320
|
+
* different purposes across tasks, and the description is what tells the
|
|
1321
|
+
* model when to reach for it.
|
|
1322
|
+
*/
|
|
1323
|
+
description?: string;
|
|
1324
|
+
defaults?: Record<string, unknown>;
|
|
1310
1325
|
};
|
|
1311
1326
|
/** Options for {@link MindStudioAgent.runTask}. */
|
|
1312
1327
|
interface RunTaskOptions {
|
|
@@ -1314,7 +1329,7 @@ interface RunTaskOptions {
|
|
|
1314
1329
|
prompt: string;
|
|
1315
1330
|
/** Structured input for this task instance. Passed as the user message. */
|
|
1316
1331
|
input: Record<string, unknown>;
|
|
1317
|
-
/** SDK
|
|
1332
|
+
/** SDK actions and/or app methods to make available as tools. */
|
|
1318
1333
|
tools: TaskToolConfig[];
|
|
1319
1334
|
/** Expected output shape. Pass a JSON string or an object (will be stringified automatically). */
|
|
1320
1335
|
structuredOutputExample: string | Record<string, unknown>;
|
|
@@ -1488,11 +1503,18 @@ declare class MindStudioAgent$1 {
|
|
|
1488
1503
|
* to produce structured output. The model receives the prompt and tools,
|
|
1489
1504
|
* calls actions as needed, and returns JSON matching the output example.
|
|
1490
1505
|
*
|
|
1506
|
+
* Tools can be SDK actions, your own app's methods, or both. App methods run
|
|
1507
|
+
* as the user who invoked the method that started the task, with their roles.
|
|
1508
|
+
*
|
|
1491
1509
|
* ```ts
|
|
1492
1510
|
* const result = await agent.runTask<{ name: string; url: string }>({
|
|
1493
|
-
* prompt: 'Find canonical info for this restaurant.',
|
|
1511
|
+
* prompt: 'Find canonical info for this restaurant, then save it.',
|
|
1494
1512
|
* input: { restaurantName: 'Tartine Bakery SF' },
|
|
1495
|
-
* tools: [
|
|
1513
|
+
* tools: [
|
|
1514
|
+
* 'searchGoogle',
|
|
1515
|
+
* 'fetchUrl',
|
|
1516
|
+
* { appMethod: 'saveRestaurant', description: 'Persist the researched restaurant.' },
|
|
1517
|
+
* ],
|
|
1496
1518
|
* structuredOutputExample: JSON.stringify({ name: 'Tartine Bakery', url: 'https://tartinebakery.com' }),
|
|
1497
1519
|
* model: 'claude-4-6-sonnet',
|
|
1498
1520
|
* });
|
|
@@ -4556,6 +4578,11 @@ interface ScrapeUrlStepOutput {
|
|
|
4556
4578
|
/** Open Graph image URL */
|
|
4557
4579
|
image: string;
|
|
4558
4580
|
};
|
|
4581
|
+
/** Set when the scrape failed. `text`/`html` still carry the human-readable error so existing callers behave as before, but callers that care — billing, in particular — can tell a failure from real page content. */
|
|
4582
|
+
error?: {
|
|
4583
|
+
code: string;
|
|
4584
|
+
message: string;
|
|
4585
|
+
};
|
|
4559
4586
|
} | {
|
|
4560
4587
|
/** Markdown/plain-text content of the scraped page */
|
|
4561
4588
|
text: string;
|
|
@@ -4576,9 +4603,14 @@ interface ScrapeUrlStepOutput {
|
|
|
4576
4603
|
/** Open Graph image URL */
|
|
4577
4604
|
image: string;
|
|
4578
4605
|
};
|
|
4606
|
+
/** Set when the scrape failed. `text`/`html` still carry the human-readable error so existing callers behave as before, but callers that care — billing, in particular — can tell a failure from real page content. */
|
|
4607
|
+
error?: {
|
|
4608
|
+
code: string;
|
|
4609
|
+
message: string;
|
|
4610
|
+
};
|
|
4579
4611
|
}[];
|
|
4580
|
-
/** Screenshot URL, only present when screenshot was
|
|
4581
|
-
screenshot?: string;
|
|
4612
|
+
/** Screenshot URL(s), only present when a screenshot was captured */
|
|
4613
|
+
screenshot?: string | string[];
|
|
4582
4614
|
}
|
|
4583
4615
|
interface ScrapeXPostStepInput {
|
|
4584
4616
|
/** Full URL to the X post (e.g. https://x.com/elonmusk/status/1655608985058267139) */
|
|
@@ -4606,6 +4638,11 @@ interface ScrapeXPostStepOutput {
|
|
|
4606
4638
|
/** Open Graph image URL */
|
|
4607
4639
|
image: string;
|
|
4608
4640
|
};
|
|
4641
|
+
/** Set when the scrape failed. `text`/`html` still carry the human-readable error so existing callers behave as before, but callers that care — billing, in particular — can tell a failure from real page content. */
|
|
4642
|
+
error?: {
|
|
4643
|
+
code: string;
|
|
4644
|
+
message: string;
|
|
4645
|
+
};
|
|
4609
4646
|
};
|
|
4610
4647
|
}
|
|
4611
4648
|
interface ScrapeXProfileStepInput {
|
|
@@ -4634,6 +4671,11 @@ interface ScrapeXProfileStepOutput {
|
|
|
4634
4671
|
/** Open Graph image URL */
|
|
4635
4672
|
image: string;
|
|
4636
4673
|
};
|
|
4674
|
+
/** Set when the scrape failed. `text`/`html` still carry the human-readable error so existing callers behave as before, but callers that care — billing, in particular — can tell a failure from real page content. */
|
|
4675
|
+
error?: {
|
|
4676
|
+
code: string;
|
|
4677
|
+
message: string;
|
|
4678
|
+
};
|
|
4637
4679
|
};
|
|
4638
4680
|
}
|
|
4639
4681
|
interface ScreenshotUrlStepInput {
|
package/dist/index.js
CHANGED
|
@@ -2785,21 +2785,21 @@ var stepMetadata = {
|
|
|
2785
2785
|
description: "Extract text, HTML, or structured content from one or more web pages.",
|
|
2786
2786
|
usageNotes: '- Accepts a single URL or multiple URLs (as a JSON array, comma-separated, or newline-separated).\n- Output format controls the result shape: "text" returns markdown, "html" returns raw HTML, "json" returns structured scraper data.\n- Can optionally capture a screenshot of each page.',
|
|
2787
2787
|
inputSchema: { "type": "object", "properties": { "url": { "type": "string", "description": "URL(s) to scrape. Accepts a single URL, JSON array, or comma/newline-separated list" }, "service": { "enum": ["default", "firecrawl"], "type": "string", "description": "Scraping service to use" }, "autoEnhance": { "type": "boolean", "description": "Whether to enable enhanced scraping for social media URLs (e.g. Twitter, LinkedIn)" }, "outputFormat": { "enum": ["text", "json", "html"], "type": "string", "description": "Output format: text returns markdown, html returns raw HTML, json returns structured scraper data" }, "pageOptions": { "type": "object", "properties": { "onlyMainContent": { "type": "boolean", "description": "Whether to extract only the main content of the page, excluding navigation, footers, etc." }, "screenshot": { "type": "boolean", "description": "Whether to capture a screenshot of the page" }, "waitFor": { "type": "number", "description": "Milliseconds to wait before scraping (0 for immediate)" }, "replaceAllPathsWithAbsolutePaths": { "type": "boolean", "description": "Whether to convert relative URLs to absolute URLs in the result" }, "headers": { "type": "object", "properties": {}, "required": [], "description": "Custom HTTP request headers as key-value pairs" }, "removeTags": { "type": "array", "items": { "type": "string" }, "description": "HTML tags to remove from the scraped result" }, "mobile": { "type": "boolean", "description": "Whether to scrape using a mobile user-agent" } }, "required": ["onlyMainContent", "screenshot", "waitFor", "replaceAllPathsWithAbsolutePaths", "headers", "removeTags", "mobile"], "description": "Page-level scraping options (content filtering, screenshots, headers, etc.)" } }, "required": ["url"] },
|
|
2788
|
-
outputSchema: { "type": "object", "properties": { "content": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "object", "properties": { "text": { "type": "string", "description": "Markdown/plain-text content of the scraped page" }, "html": { "type": "string", "description": "Raw HTML content of the scraped page" }, "json": { "type": "object", "properties": {}, "required": [], "description": "Structured data extracted from the page" }, "screenshotUrl": { "type": "string", "description": "Screenshot URL of the page (if requested)" }, "metadata": { "type": "object", "properties": { "title": { "type": "string", "description": "Page title" }, "description": { "type": "string", "description": "Page meta description" }, "url": { "type": "string", "description": "Canonical URL" }, "image": { "type": "string", "description": "Open Graph image URL" } }, "required": ["title", "description", "url", "image"], "description": "Page metadata (Open Graph / meta tags)" } }, "required": ["text", "html"] }, { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string", "description": "Markdown/plain-text content of the scraped page" }, "html": { "type": "string", "description": "Raw HTML content of the scraped page" }, "json": { "type": "object", "properties": {}, "required": [], "description": "Structured data extracted from the page" }, "screenshotUrl": { "type": "string", "description": "Screenshot URL of the page (if requested)" }, "metadata": { "type": "object", "properties": { "title": { "type": "string", "description": "Page title" }, "description": { "type": "string", "description": "Page meta description" }, "url": { "type": "string", "description": "Canonical URL" }, "image": { "type": "string", "description": "Open Graph image URL" } }, "required": ["title", "description", "url", "image"], "description": "Page metadata (Open Graph / meta tags)" } }, "required": ["text", "html"] } }] }, "screenshot": { "type": "string", "
|
|
2788
|
+
outputSchema: { "type": "object", "properties": { "content": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "object", "properties": { "text": { "type": "string", "description": "Markdown/plain-text content of the scraped page" }, "html": { "type": "string", "description": "Raw HTML content of the scraped page" }, "json": { "type": "object", "properties": {}, "required": [], "description": "Structured data extracted from the page" }, "screenshotUrl": { "type": "string", "description": "Screenshot URL of the page (if requested)" }, "metadata": { "type": "object", "properties": { "title": { "type": "string", "description": "Page title" }, "description": { "type": "string", "description": "Page meta description" }, "url": { "type": "string", "description": "Canonical URL" }, "image": { "type": "string", "description": "Open Graph image URL" } }, "required": ["title", "description", "url", "image"], "description": "Page metadata (Open Graph / meta tags)" }, "error": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["code", "message"], "description": "Set when the scrape failed. `text`/`html` still carry the human-readable error so existing callers behave as before, but callers that care \u2014 billing, in particular \u2014 can tell a failure from real page content." } }, "required": ["text", "html"] }, { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string", "description": "Markdown/plain-text content of the scraped page" }, "html": { "type": "string", "description": "Raw HTML content of the scraped page" }, "json": { "type": "object", "properties": {}, "required": [], "description": "Structured data extracted from the page" }, "screenshotUrl": { "type": "string", "description": "Screenshot URL of the page (if requested)" }, "metadata": { "type": "object", "properties": { "title": { "type": "string", "description": "Page title" }, "description": { "type": "string", "description": "Page meta description" }, "url": { "type": "string", "description": "Canonical URL" }, "image": { "type": "string", "description": "Open Graph image URL" } }, "required": ["title", "description", "url", "image"], "description": "Page metadata (Open Graph / meta tags)" }, "error": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["code", "message"], "description": "Set when the scrape failed. `text`/`html` still carry the human-readable error so existing callers behave as before, but callers that care \u2014 billing, in particular \u2014 can tell a failure from real page content." } }, "required": ["text", "html"] } }] }, "screenshot": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["content"] }
|
|
2789
2789
|
},
|
|
2790
2790
|
"scrapeXPost": {
|
|
2791
2791
|
stepType: "scrapeXPost",
|
|
2792
2792
|
description: "Scrape data from a single X (Twitter) post by URL.",
|
|
2793
2793
|
usageNotes: "- Returns structured post data (text, html, optional json/screenshot/metadata).\n- Optionally saves the text content to a variable.",
|
|
2794
2794
|
inputSchema: { "type": "object", "properties": { "url": { "type": "string", "description": "Full URL to the X post (e.g. https://x.com/elonmusk/status/1655608985058267139)" } }, "required": ["url"] },
|
|
2795
|
-
outputSchema: { "type": "object", "properties": { "post": { "type": "object", "properties": { "text": { "type": "string", "description": "Markdown/plain-text content of the scraped page" }, "html": { "type": "string", "description": "Raw HTML content of the scraped page" }, "json": { "type": "object", "properties": {}, "required": [], "description": "Structured data extracted from the page" }, "screenshotUrl": { "type": "string", "description": "Screenshot URL of the page (if requested)" }, "metadata": { "type": "object", "properties": { "title": { "type": "string", "description": "Page title" }, "description": { "type": "string", "description": "Page meta description" }, "url": { "type": "string", "description": "Canonical URL" }, "image": { "type": "string", "description": "Open Graph image URL" } }, "required": ["title", "description", "url", "image"], "description": "Page metadata (Open Graph / meta tags)" } }, "required": ["text", "html"], "description": "Scraped post data including text, HTML, and optional structured JSON" } }, "required": ["post"] }
|
|
2795
|
+
outputSchema: { "type": "object", "properties": { "post": { "type": "object", "properties": { "text": { "type": "string", "description": "Markdown/plain-text content of the scraped page" }, "html": { "type": "string", "description": "Raw HTML content of the scraped page" }, "json": { "type": "object", "properties": {}, "required": [], "description": "Structured data extracted from the page" }, "screenshotUrl": { "type": "string", "description": "Screenshot URL of the page (if requested)" }, "metadata": { "type": "object", "properties": { "title": { "type": "string", "description": "Page title" }, "description": { "type": "string", "description": "Page meta description" }, "url": { "type": "string", "description": "Canonical URL" }, "image": { "type": "string", "description": "Open Graph image URL" } }, "required": ["title", "description", "url", "image"], "description": "Page metadata (Open Graph / meta tags)" }, "error": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["code", "message"], "description": "Set when the scrape failed. `text`/`html` still carry the human-readable error so existing callers behave as before, but callers that care \u2014 billing, in particular \u2014 can tell a failure from real page content." } }, "required": ["text", "html"], "description": "Scraped post data including text, HTML, and optional structured JSON" } }, "required": ["post"] }
|
|
2796
2796
|
},
|
|
2797
2797
|
"scrapeXProfile": {
|
|
2798
2798
|
stepType: "scrapeXProfile",
|
|
2799
2799
|
description: "Scrape public profile data from an X (Twitter) account by URL.",
|
|
2800
2800
|
usageNotes: "- Returns structured profile data.\n- Optionally saves the result to a variable.",
|
|
2801
2801
|
inputSchema: { "type": "object", "properties": { "url": { "type": "string", "description": "Full URL or username for the X profile (e.g. https://x.com/elonmusk)" } }, "required": ["url"] },
|
|
2802
|
-
outputSchema: { "type": "object", "properties": { "profile": { "type": "object", "properties": { "text": { "type": "string", "description": "Markdown/plain-text content of the scraped page" }, "html": { "type": "string", "description": "Raw HTML content of the scraped page" }, "json": { "type": "object", "properties": {}, "required": [], "description": "Structured data extracted from the page" }, "screenshotUrl": { "type": "string", "description": "Screenshot URL of the page (if requested)" }, "metadata": { "type": "object", "properties": { "title": { "type": "string", "description": "Page title" }, "description": { "type": "string", "description": "Page meta description" }, "url": { "type": "string", "description": "Canonical URL" }, "image": { "type": "string", "description": "Open Graph image URL" } }, "required": ["title", "description", "url", "image"], "description": "Page metadata (Open Graph / meta tags)" } }, "required": ["text", "html"], "description": "Scraped profile data including text, HTML, and optional structured JSON" } }, "required": ["profile"] }
|
|
2802
|
+
outputSchema: { "type": "object", "properties": { "profile": { "type": "object", "properties": { "text": { "type": "string", "description": "Markdown/plain-text content of the scraped page" }, "html": { "type": "string", "description": "Raw HTML content of the scraped page" }, "json": { "type": "object", "properties": {}, "required": [], "description": "Structured data extracted from the page" }, "screenshotUrl": { "type": "string", "description": "Screenshot URL of the page (if requested)" }, "metadata": { "type": "object", "properties": { "title": { "type": "string", "description": "Page title" }, "description": { "type": "string", "description": "Page meta description" }, "url": { "type": "string", "description": "Canonical URL" }, "image": { "type": "string", "description": "Open Graph image URL" } }, "required": ["title", "description", "url", "image"], "description": "Page metadata (Open Graph / meta tags)" }, "error": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["code", "message"], "description": "Set when the scrape failed. `text`/`html` still carry the human-readable error so existing callers behave as before, but callers that care \u2014 billing, in particular \u2014 can tell a failure from real page content." } }, "required": ["text", "html"], "description": "Scraped profile data including text, HTML, and optional structured JSON" } }, "required": ["profile"] }
|
|
2803
2803
|
},
|
|
2804
2804
|
"screenshotUrl": {
|
|
2805
2805
|
stepType: "screenshotUrl",
|
|
@@ -3178,6 +3178,13 @@ function resolveStepType(name) {
|
|
|
3178
3178
|
}
|
|
3179
3179
|
function mapTools(tools) {
|
|
3180
3180
|
return tools.map((t) => {
|
|
3181
|
+
if (typeof t === "object" && "appMethod" in t) {
|
|
3182
|
+
return {
|
|
3183
|
+
appMethod: t.appMethod,
|
|
3184
|
+
...t.description ? { description: t.description } : {},
|
|
3185
|
+
...t.defaults ? { defaults: t.defaults } : {}
|
|
3186
|
+
};
|
|
3187
|
+
}
|
|
3181
3188
|
const method = typeof t === "string" ? t : t.method;
|
|
3182
3189
|
const stepType = resolveStepType(method);
|
|
3183
3190
|
const defaults = typeof t === "object" ? t.defaults : void 0;
|
|
@@ -4383,11 +4390,18 @@ var MindStudioAgent = class {
|
|
|
4383
4390
|
* to produce structured output. The model receives the prompt and tools,
|
|
4384
4391
|
* calls actions as needed, and returns JSON matching the output example.
|
|
4385
4392
|
*
|
|
4393
|
+
* Tools can be SDK actions, your own app's methods, or both. App methods run
|
|
4394
|
+
* as the user who invoked the method that started the task, with their roles.
|
|
4395
|
+
*
|
|
4386
4396
|
* ```ts
|
|
4387
4397
|
* const result = await agent.runTask<{ name: string; url: string }>({
|
|
4388
|
-
* prompt: 'Find canonical info for this restaurant.',
|
|
4398
|
+
* prompt: 'Find canonical info for this restaurant, then save it.',
|
|
4389
4399
|
* input: { restaurantName: 'Tartine Bakery SF' },
|
|
4390
|
-
* tools: [
|
|
4400
|
+
* tools: [
|
|
4401
|
+
* 'searchGoogle',
|
|
4402
|
+
* 'fetchUrl',
|
|
4403
|
+
* { appMethod: 'saveRestaurant', description: 'Persist the researched restaurant.' },
|
|
4404
|
+
* ],
|
|
4391
4405
|
* structuredOutputExample: JSON.stringify({ name: 'Tartine Bakery', url: 'https://tartinebakery.com' }),
|
|
4392
4406
|
* model: 'claude-4-6-sonnet',
|
|
4393
4407
|
* });
|