@mindstudio-ai/agent 0.1.62 → 0.1.64
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 +149 -34
- package/dist/index.d.ts +401 -5
- package/dist/index.js +150 -26
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +149 -34
- package/llms.txt +119 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57,12 +57,13 @@ async function requestWithRetry(config, method, url, body, attempt) {
|
|
|
57
57
|
try {
|
|
58
58
|
const body2 = JSON.parse(text);
|
|
59
59
|
details = body2;
|
|
60
|
-
const errMsg = (typeof body2.error === "string" ? body2.error : void 0) ?? (typeof body2.message === "string" ? body2.message : void 0) ?? (typeof body2.details === "string" ? body2.details : void 0);
|
|
60
|
+
const errMsg = (typeof body2.errorMessage === "string" ? body2.errorMessage : void 0) ?? (typeof body2.errorString === "string" ? body2.errorString : void 0) ?? (typeof body2.error === "string" ? body2.error : void 0) ?? (typeof body2.message === "string" ? body2.message : void 0) ?? (typeof body2.details === "string" ? body2.details : void 0);
|
|
61
61
|
if (errMsg) message = errMsg;
|
|
62
62
|
else if (body2.error || body2.message || body2.details) {
|
|
63
63
|
message = JSON.stringify(body2.error ?? body2.message ?? body2.details);
|
|
64
64
|
}
|
|
65
|
-
if (body2.code) code = body2.code;
|
|
65
|
+
if (body2.code) code = String(body2.code);
|
|
66
|
+
else if (typeof body2.errorString === "string") code = body2.errorString;
|
|
66
67
|
} catch {
|
|
67
68
|
if (text) {
|
|
68
69
|
const stripped = text.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
@@ -2501,6 +2502,48 @@ var stepMetadata = {
|
|
|
2501
2502
|
inputSchema: { "type": "object", "properties": { "pageId": { "type": "string", "description": "Notion page ID to update" }, "content": { "type": "string", "description": "New content in markdown format" }, "mode": { "enum": ["append", "overwrite"], "type": "string", "description": "How to apply the content: 'append' adds to end, 'overwrite' replaces all existing content" }, "connectionId": { "type": "string", "description": "Notion OAuth connection ID" } }, "required": ["pageId", "content", "mode"] },
|
|
2502
2503
|
outputSchema: { "type": "object", "properties": { "pageId": { "type": "string", "description": "Notion page ID of the updated page" }, "pageUrl": { "type": "string", "description": "URL to view the page in Notion" } }, "required": ["pageId", "pageUrl"] }
|
|
2503
2504
|
},
|
|
2505
|
+
"particlePodcastsFindMentions": {
|
|
2506
|
+
stepType: "particlePodcastsFindMentions",
|
|
2507
|
+
description: "Find every dialogue line mentioning a specific entity or company across all podcasts.",
|
|
2508
|
+
usageNotes: "- Provide `entityId` (for people, products, places) OR `companyId` (for organizations). At least one is required.\n- Use `contextLines` to include surrounding dialogue with each mention (default behavior is set by Particle).\n- Resolve a name to an `entityId` / `companyId` first via Search Companies (or by inspecting a Search Dialogue response).\n- Cursor-paginated; expect potentially large result sets for popular entities.",
|
|
2509
|
+
inputSchema: { "type": "object", "properties": { "entityId": { "type": "string", "description": "Knowledge-graph entity ID (person, product, place, etc.)" }, "companyId": { "type": "string", "description": "Company ID" }, "contextLines": { "type": "number", "description": "Surrounding dialogue lines to include with each mention" }, "limit": { "type": "number", "description": "Max results, up to 100" }, "cursor": { "type": "string", "description": "Pagination cursor" } } },
|
|
2510
|
+
outputSchema: { "type": "string" }
|
|
2511
|
+
},
|
|
2512
|
+
"particlePodcastsGetEpisode": {
|
|
2513
|
+
stepType: "particlePodcastsGetEpisode",
|
|
2514
|
+
description: "Fetch full metadata for a single episode: details, speakers, entities, clips, and ads \u2014 merged into one response.",
|
|
2515
|
+
usageNotes: "- Pass an episode ID or slug as `id`.\n- Returns five sub-resources merged: `episode` (metadata), `speakers` (diarized speaker list), `entities` (knowledge-graph mentions), `clips` (AI-extracted highlights), `ads` (detected ad spots).\n- Use Get Episode Transcript separately when you need the full transcript text \u2014 it isn't bundled here because the payload is large and has its own format/range options.\n- Bills as 5 units against the get-episode event type (one per sub-call).",
|
|
2516
|
+
inputSchema: { "type": "object", "properties": { "id": { "type": "string", "description": "Episode ID or slug" } }, "required": ["id"] },
|
|
2517
|
+
outputSchema: { "type": "string" }
|
|
2518
|
+
},
|
|
2519
|
+
"particlePodcastsGetEpisodeTranscript": {
|
|
2520
|
+
stepType: "particlePodcastsGetEpisodeTranscript",
|
|
2521
|
+
description: "Fetch the diarized transcript for an episode in dialogue, plain text, or SRT subtitle format.",
|
|
2522
|
+
usageNotes: '- Pass an episode ID or slug as `id`.\n- Use `format` = "dialogue" (default, with speaker turns), "text" (plain), or "srt" (subtitle).\n- Filter to a single speaker with `speaker`, or to a time range with `start` / `end` (seconds).\n- Transcripts are large \u2014 prefer time-range filtering when you only need a snippet.',
|
|
2523
|
+
inputSchema: { "type": "object", "properties": { "id": { "type": "string", "description": "Episode ID or slug" }, "format": { "enum": ["dialogue", "text", "srt"], "type": "string", "description": "Transcript format" }, "speaker": { "type": "string", "description": "Filter to a single speaker" }, "start": { "type": "number", "description": "Start time in seconds" }, "end": { "type": "number", "description": "End time in seconds" } }, "required": ["id"] },
|
|
2524
|
+
outputSchema: { "type": "string" }
|
|
2525
|
+
},
|
|
2526
|
+
"particlePodcastsSearchCompanies": {
|
|
2527
|
+
stepType: "particlePodcastsSearchCompanies",
|
|
2528
|
+
description: "Search the Particle knowledge graph for companies by name, ticker, domain, CIK, or QID.",
|
|
2529
|
+
usageNotes: '- Provide one or more identifiers: `q` (free-text name), `ticker` (e.g. "TSLA"), `domain` (e.g. "tesla.com"), `cik` (SEC), or `qid` (Wikidata).\n- Use this to resolve a company name to a canonical `companyId` for use with Find Mentions or Search Dialogue.\n- Returned company objects include slugs, domains, and IDs \u2014 any of these can be passed to downstream blocks.',
|
|
2530
|
+
inputSchema: { "type": "object", "properties": { "q": { "type": "string", "description": "Free-text company name" }, "ticker": { "type": "string", "description": "Stock ticker" }, "domain": { "type": "string", "description": "Company domain" }, "cik": { "type": "string", "description": "SEC CIK" }, "qid": { "type": "string", "description": "Wikidata QID" }, "entityId": { "type": "string", "description": "Knowledge-graph entity ID" }, "updatedAfter": { "type": "string", "description": "Only include companies updated after this ISO timestamp" }, "limit": { "type": "number", "description": "Max results" }, "cursor": { "type": "string", "description": "Pagination cursor" } } },
|
|
2531
|
+
outputSchema: { "type": "string" }
|
|
2532
|
+
},
|
|
2533
|
+
"particlePodcastsSearchDialogue": {
|
|
2534
|
+
stepType: "particlePodcastsSearchDialogue",
|
|
2535
|
+
description: "Search across podcast dialogue using semantic or keyword search. Returns matched lines grouped by episode.",
|
|
2536
|
+
usageNotes: '- Provide `semanticSearch` for meaning-based discovery ("find moments where someone talks about market timing") or `keywordSearch` for exact phrase/proper-noun matching. At least one must be provided.\n- Filter to a specific entity or company by passing `entityId` / `companyId`.\n- Each returned dialogue line carries the source episode + speaker so you can chain to Get Episode or Get Episode Transcript for context.\n- Cursor-paginated.',
|
|
2537
|
+
inputSchema: { "type": "object", "properties": { "semanticSearch": { "type": "string", "description": "Meaning-based dialogue search" }, "keywordSearch": { "type": "string", "description": "Exact-phrase dialogue search" }, "entityId": { "type": "string", "description": "Restrict to dialogue mentioning this entity" }, "companyId": { "type": "string", "description": "Restrict to dialogue mentioning this company" }, "limit": { "type": "number", "description": "Max results, up to 100" }, "cursor": { "type": "string", "description": "Pagination cursor" } } },
|
|
2538
|
+
outputSchema: { "type": "string" }
|
|
2539
|
+
},
|
|
2540
|
+
"particlePodcastsSearchPodcasts": {
|
|
2541
|
+
stepType: "particlePodcastsSearchPodcasts",
|
|
2542
|
+
description: "Search and list podcasts in the Particle catalog by keyword, topic, or language.",
|
|
2543
|
+
usageNotes: '- Use `q` for free-text keyword search across podcast titles and descriptions.\n- Use `topic` to filter to a Particle taxonomy topic.\n- Use `language` (BCP 47, e.g. "en") to restrict to a language.\n- Returns podcast objects with canonical IDs and slugs. Pass either to other Particle Podcasts blocks.\n- Cursor-paginated; pass the returned `cursor` back to `cursor` for the next page.',
|
|
2544
|
+
inputSchema: { "type": "object", "properties": { "q": { "type": "string", "description": "Free-text query across podcast title and description" }, "topic": { "type": "string", "description": "Particle taxonomy topic slug" }, "language": { "type": "string", "description": "BCP 47 language code" }, "suitabilityTier": { "type": "string", "description": "Brand-suitability tier filter" }, "limit": { "type": "number", "description": "Max results, up to 100" }, "cursor": { "type": "string", "description": "Pagination cursor" } } },
|
|
2545
|
+
outputSchema: { "type": "string" }
|
|
2546
|
+
},
|
|
2504
2547
|
"peopleSearch": {
|
|
2505
2548
|
stepType: "peopleSearch",
|
|
2506
2549
|
description: "Search for people matching specific criteria using Apollo.io. Supports natural language queries and advanced filters.",
|
|
@@ -2567,8 +2610,10 @@ var stepMetadata = {
|
|
|
2567
2610
|
"removeBackgroundFromImage": {
|
|
2568
2611
|
stepType: "removeBackgroundFromImage",
|
|
2569
2612
|
description: "Remove the background from an image using AI, producing a transparent PNG.",
|
|
2570
|
-
usageNotes:
|
|
2571
|
-
|
|
2613
|
+
usageNotes: `- Uses the Bria background removal model via fal.ai by default.
|
|
2614
|
+
- Uses WaveSpeed's Ideogram background removal model when type is "advanced".
|
|
2615
|
+
- Output is re-hosted on the CDN as a PNG with transparency.`,
|
|
2616
|
+
inputSchema: { "type": "object", "properties": { "type": { "enum": ["standard", "advanced"], "type": "string" }, "imageUrl": { "type": "string", "description": "URL of the source image to remove the background from" } }, "required": ["imageUrl"] },
|
|
2572
2617
|
outputSchema: { "type": "object", "properties": { "imageUrl": { "type": "string", "description": "CDN URL of the image with background removed (transparent PNG)" } }, "required": ["imageUrl"] }
|
|
2573
2618
|
},
|
|
2574
2619
|
"replyToGmailEmail": {
|
|
@@ -3015,6 +3060,41 @@ var stepMetadata = {
|
|
|
3015
3060
|
usageNotes: "",
|
|
3016
3061
|
inputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the source video" }, "imageUrl": { "type": "string", "description": "URL of the watermark image to overlay" }, "corner": { "enum": ["top-left", "top-right", "bottom-left", "bottom-right"], "type": "string", "description": "Corner position for the watermark placement" }, "paddingPx": { "type": "number", "description": "Padding from the corner in pixels" }, "widthPx": { "type": "number", "description": "Width of the watermark overlay in pixels" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" } }, "required": ["videoUrl", "imageUrl", "corner", "paddingPx", "widthPx"] },
|
|
3017
3062
|
outputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the watermarked video" } }, "required": ["videoUrl"] }
|
|
3063
|
+
},
|
|
3064
|
+
"youDotComFinanceResearch": {
|
|
3065
|
+
stepType: "youDotComFinanceResearch",
|
|
3066
|
+
description: "Ask a financial research question using You.com Finance Research and return the sourced response.",
|
|
3067
|
+
usageNotes: "- Use this for financial questions such as company analysis, earnings, market research, filings, macroeconomics, and due diligence.\n- researchEffort supports deep (default) or exhaustive.\n- Finance Research returns the same response shape as Web Research, but searches a finance-optimized index.\n- Use it for cited synthesis, not raw price feeds or structured time-series exports.",
|
|
3068
|
+
inputSchema: { "type": "object", "properties": { "input": { "type": "string", "description": "Financial research question" }, "researchEffort": { "enum": ["deep", "exhaustive"], "type": "string", "description": "Depth of finance research to perform" } }, "required": ["input"] },
|
|
3069
|
+
outputSchema: { "type": "object", "properties": { "data": { "anyOf": [{ "type": "object", "properties": {}, "required": [] }, { "type": "array", "items": {} }] } }, "required": ["data"] }
|
|
3070
|
+
},
|
|
3071
|
+
"youDotComGetPageContent": {
|
|
3072
|
+
stepType: "youDotComGetPageContent",
|
|
3073
|
+
description: "Fetch clean Markdown, HTML, or metadata for known URLs using the You.com Contents API.",
|
|
3074
|
+
usageNotes: "- Use this step when you already know the URLs. Use Web Search with livecrawl when You.com should discover pages from a query.\n- A single request supports up to 10 URLs.\n- Request only the formats you need. Markdown is recommended for LLM consumption.\n- Increase crawlTimeout for JavaScript-heavy pages, up to 60 seconds.\n- Individual pages can partially fail; check each returned item before processing.",
|
|
3075
|
+
inputSchema: { "type": "object", "properties": { "urls": { "type": "array", "items": { "type": "string" }, "description": "URLs to fetch, max 10" }, "formats": { "type": "array", "items": { "enum": ["markdown", "html", "metadata"], "type": "string" }, "description": "Content formats to return; defaults to markdown" }, "crawlTimeout": { "type": "number", "description": "Per-URL crawl timeout in seconds" } }, "required": ["urls"] },
|
|
3076
|
+
outputSchema: { "type": "object", "properties": { "data": { "anyOf": [{ "type": "object", "properties": {}, "required": [] }, { "type": "array", "items": {} }] } }, "required": ["data"] }
|
|
3077
|
+
},
|
|
3078
|
+
"youDotComLiveNews": {
|
|
3079
|
+
stepType: "youDotComLiveNews",
|
|
3080
|
+
description: "Fetch live news articles through the You.com Search API and return the full structured response.",
|
|
3081
|
+
usageNotes: "- Defaults freshness to day for breaking or recent news.\n- Use country and language together to monitor regional or non-English news.\n- Use livecrawl: 'news' with livecrawlFormats: ['markdown'] when you need full article text.\n- Use a custom freshness range like YYYY-MM-DDtoYYYY-MM-DD for historical news windows.",
|
|
3082
|
+
inputSchema: { "type": "object", "properties": { "query": { "type": "string", "description": "News query" }, "freshness": { "type": "string", "description": "Recency filter; defaults to day" }, "count": { "type": "number", "description": "Max results per section, up to 100" }, "country": { "type": "string", "description": "ISO 3166-1 alpha-2 country code" }, "language": { "type": "string", "description": "BCP 47 language code" }, "safesearch": { "enum": ["off", "moderate", "strict"], "type": "string", "description": "Content moderation level" }, "livecrawl": { "enum": ["news", "all"], "type": "string", "description": "Fetch full content for news or all results" }, "livecrawlFormats": { "type": "array", "items": { "enum": ["markdown", "html"], "type": "string" }, "description": "Full-content formats to return when livecrawl is enabled" } }, "required": ["query"] },
|
|
3083
|
+
outputSchema: { "type": "object", "properties": { "data": { "anyOf": [{ "type": "object", "properties": {}, "required": [] }, { "type": "array", "items": {} }] } }, "required": ["data"] }
|
|
3084
|
+
},
|
|
3085
|
+
"youDotComWebResearch": {
|
|
3086
|
+
stepType: "youDotComWebResearch",
|
|
3087
|
+
description: "Ask a research question and return a grounded You.com Research API answer with sources.",
|
|
3088
|
+
usageNotes: "- Use Web Search when you need raw URLs and snippets. Use Web Research when you want a synthesized answer with citations.\n- researchEffort controls depth and latency: lite, standard, deep, or exhaustive. standard is a good default.\n- sourceControl can restrict, exclude, or boost domains, and can apply freshness or country filters.\n- includeDomains cannot be combined with excludeDomains or boostDomains.\n- outputSchema returns structured output.content and is supported by standard, deep, and exhaustive, not lite.",
|
|
3089
|
+
inputSchema: { "type": "object", "properties": { "input": { "type": "string", "description": "Research question" }, "researchEffort": { "enum": ["lite", "standard", "deep", "exhaustive"], "type": "string", "description": "Depth of research to perform" }, "sourceControl": { "anyOf": [{ "type": "object", "properties": { "includeDomains": { "type": "array", "items": { "type": "string" } }, "excludeDomains": { "type": "array", "items": { "type": "string" } }, "boostDomains": { "type": "array", "items": { "type": "string" } }, "freshness": { "type": "string" }, "country": { "type": "string" } } }, { "type": "string" }] }, "outputSchema": { "anyOf": [{ "type": "object", "properties": {}, "required": [] }, { "type": "string" }] } }, "required": ["input"] },
|
|
3090
|
+
outputSchema: { "type": "object", "properties": { "data": { "anyOf": [{ "type": "object", "properties": {}, "required": [] }, { "type": "array", "items": {} }] } }, "required": ["data"] }
|
|
3091
|
+
},
|
|
3092
|
+
"youDotComWebSearch": {
|
|
3093
|
+
stepType: "youDotComWebSearch",
|
|
3094
|
+
description: "Search the web and news using the You.com Search API and return the full structured response.",
|
|
3095
|
+
usageNotes: "- Query supports You.com search operators:\n\n| Operator | Description | Example |\n| -------- | ----------- | ------- |\n| site: | Search within a domain and its subdomains | site:uscourts.gov |\n| filetype: | Search for a specific file type | filetype:pdf |\n| + | Require the exact term after the operator | +GAAP |\n| - | Exclude the exact term after the operator | -prs |\n| AND | Require both expressions | guitar AND Fender |\n| OR | Match either expression | guitar OR drum |\n| NOT | Negate an expression | NOT site:uscourts.gov |\n\n- Use livecrawl with livecrawlFormats: ['markdown'] when you need full page content instead of snippets.\n- Use the Get Page Content step when you already know the URLs to fetch.\n- Use freshness for recency: day, week, month, year, or YYYY-MM-DDtoYYYY-MM-DD.\n- Use country (ISO 3166-1 alpha-2) and language (BCP 47) to focus results geographically or linguistically.\n- includeDomains cannot be combined with excludeDomains or boostDomains.",
|
|
3096
|
+
inputSchema: { "type": "object", "properties": { "query": { "type": "string", "description": "Search query; supports You.com search operators" }, "count": { "type": "number", "description": "Max results per section, up to 100" }, "freshness": { "type": "string", "description": "Recency filter: day, week, month, year, or YYYY-MM-DDtoYYYY-MM-DD" }, "country": { "type": "string", "description": "ISO 3166-1 alpha-2 country code" }, "language": { "type": "string", "description": "BCP 47 language code" }, "offset": { "type": "number", "description": "Pagination offset, 0-9" }, "safesearch": { "enum": ["off", "moderate", "strict"], "type": "string", "description": "Content moderation level" }, "livecrawl": { "enum": ["web", "news", "all"], "type": "string", "description": "Fetch full content for web, news, or all results" }, "livecrawlFormats": { "type": "array", "items": { "enum": ["markdown", "html"], "type": "string" }, "description": "Full-content formats to return when livecrawl is enabled" }, "crawlTimeout": { "type": "number", "description": "Maximum livecrawl timeout in seconds" }, "includeDomains": { "type": "array", "items": { "type": "string" }, "description": "Restrict results to these domains" }, "excludeDomains": { "type": "array", "items": { "type": "string" }, "description": "Exclude these domains" }, "boostDomains": { "type": "array", "items": { "type": "string" }, "description": "Boost these domains without excluding other domains" } }, "required": ["query"] },
|
|
3097
|
+
outputSchema: { "type": "object", "properties": { "data": { "anyOf": [{ "type": "object", "properties": {}, "required": [] }, { "type": "array", "items": {} }] } }, "required": ["data"] }
|
|
3018
3098
|
}
|
|
3019
3099
|
};
|
|
3020
3100
|
|
|
@@ -3515,6 +3595,24 @@ function applyStepMethods(AgentClass) {
|
|
|
3515
3595
|
proto.notionUpdatePage = function(step, options) {
|
|
3516
3596
|
return this.executeStep("notionUpdatePage", step, options);
|
|
3517
3597
|
};
|
|
3598
|
+
proto.particlePodcastsFindMentions = function(step, options) {
|
|
3599
|
+
return this.executeStep("particlePodcastsFindMentions", step, options);
|
|
3600
|
+
};
|
|
3601
|
+
proto.particlePodcastsGetEpisode = function(step, options) {
|
|
3602
|
+
return this.executeStep("particlePodcastsGetEpisode", step, options);
|
|
3603
|
+
};
|
|
3604
|
+
proto.particlePodcastsGetEpisodeTranscript = function(step, options) {
|
|
3605
|
+
return this.executeStep("particlePodcastsGetEpisodeTranscript", step, options);
|
|
3606
|
+
};
|
|
3607
|
+
proto.particlePodcastsSearchCompanies = function(step, options) {
|
|
3608
|
+
return this.executeStep("particlePodcastsSearchCompanies", step, options);
|
|
3609
|
+
};
|
|
3610
|
+
proto.particlePodcastsSearchDialogue = function(step, options) {
|
|
3611
|
+
return this.executeStep("particlePodcastsSearchDialogue", step, options);
|
|
3612
|
+
};
|
|
3613
|
+
proto.particlePodcastsSearchPodcasts = function(step, options) {
|
|
3614
|
+
return this.executeStep("particlePodcastsSearchPodcasts", step, options);
|
|
3615
|
+
};
|
|
3518
3616
|
proto.peopleSearch = function(step, options) {
|
|
3519
3617
|
return this.executeStep("peopleSearch", step, options);
|
|
3520
3618
|
};
|
|
@@ -3728,6 +3826,21 @@ function applyStepMethods(AgentClass) {
|
|
|
3728
3826
|
proto.watermarkVideo = function(step, options) {
|
|
3729
3827
|
return this.executeStep("watermarkVideo", step, options);
|
|
3730
3828
|
};
|
|
3829
|
+
proto.youDotComFinanceResearch = function(step, options) {
|
|
3830
|
+
return this.executeStep("youDotComFinanceResearch", step, options);
|
|
3831
|
+
};
|
|
3832
|
+
proto.youDotComGetPageContent = function(step, options) {
|
|
3833
|
+
return this.executeStep("youDotComGetPageContent", step, options);
|
|
3834
|
+
};
|
|
3835
|
+
proto.youDotComLiveNews = function(step, options) {
|
|
3836
|
+
return this.executeStep("youDotComLiveNews", step, options);
|
|
3837
|
+
};
|
|
3838
|
+
proto.youDotComWebResearch = function(step, options) {
|
|
3839
|
+
return this.executeStep("youDotComWebResearch", step, options);
|
|
3840
|
+
};
|
|
3841
|
+
proto.youDotComWebSearch = function(step, options) {
|
|
3842
|
+
return this.executeStep("youDotComWebSearch", step, options);
|
|
3843
|
+
};
|
|
3731
3844
|
}
|
|
3732
3845
|
|
|
3733
3846
|
// src/client.ts
|
|
@@ -4886,38 +4999,38 @@ var MindStudioAgent = class {
|
|
|
4886
4999
|
/**
|
|
4887
5000
|
* Upload a file to the MindStudio CDN.
|
|
4888
5001
|
*
|
|
4889
|
-
* Gets a
|
|
4890
|
-
* permanent public URL.
|
|
5002
|
+
* Gets a presigned upload request from the API, POSTs the file as
|
|
5003
|
+
* multipart/form-data, and returns the permanent public URL.
|
|
4891
5004
|
*/
|
|
4892
5005
|
async uploadFile(content, options) {
|
|
4893
|
-
const
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
{
|
|
4898
|
-
extension: options.extension,
|
|
4899
|
-
...options.type != null && { type: options.type }
|
|
4900
|
-
}
|
|
4901
|
-
);
|
|
5006
|
+
const filename = options.filename ?? `upload.${options.extension}`;
|
|
5007
|
+
const { data } = await request(this._currentHttpConfig, "POST", "/account/upload", { filename });
|
|
5008
|
+
const form = new FormData();
|
|
5009
|
+
for (const [k, v] of Object.entries(data.fields)) form.append(k, v);
|
|
4902
5010
|
const buf = content.buffer.slice(
|
|
4903
5011
|
content.byteOffset,
|
|
4904
5012
|
content.byteOffset + content.byteLength
|
|
4905
5013
|
);
|
|
4906
|
-
const
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
headers: options.type ? { "Content-Type": options.type } : {}
|
|
4910
|
-
});
|
|
5014
|
+
const fileBlob = new Blob([buf], options.type ? { type: options.type } : void 0);
|
|
5015
|
+
form.append("file", fileBlob, filename);
|
|
5016
|
+
const res = await fetch(data.url, { method: "POST", body: form });
|
|
4911
5017
|
if (!res.ok) {
|
|
4912
|
-
const
|
|
5018
|
+
const errorText = await res.text().catch(() => "");
|
|
4913
5019
|
throw new MindStudioError(
|
|
4914
|
-
|
|
4915
|
-
|
|
5020
|
+
`Upload failed: ${res.status} ${res.statusText}${errorText ? ` \u2014 ${errorText.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim().slice(0, 200)}` : ""}`,
|
|
5021
|
+
"upload_error",
|
|
4916
5022
|
res.status,
|
|
4917
|
-
|
|
5023
|
+
errorText || void 0
|
|
5024
|
+
);
|
|
5025
|
+
}
|
|
5026
|
+
if (!data.publicUrl) {
|
|
5027
|
+
throw new MindStudioError(
|
|
5028
|
+
"Upload succeeded but server did not return a public URL.",
|
|
5029
|
+
"missing_public_url",
|
|
5030
|
+
500
|
|
4918
5031
|
);
|
|
4919
5032
|
}
|
|
4920
|
-
return { url: data.
|
|
5033
|
+
return { url: data.publicUrl };
|
|
4921
5034
|
}
|
|
4922
5035
|
};
|
|
4923
5036
|
function sleep3(ms) {
|
|
@@ -5044,6 +5157,12 @@ var monacoSnippets = {
|
|
|
5044
5157
|
"n8nRunNode": { fields: [["method", "string"], ["authentication", ["none", "basic", "string"]], ["user", "string"], ["password", "string"], ["webhookUrl", "string"], ["input", "object"]], outputKeys: ["data"] },
|
|
5045
5158
|
"notionCreatePage": { fields: [["pageId", "string"], ["content", "string"], ["title", "string"]], outputKeys: ["pageId", "pageUrl"] },
|
|
5046
5159
|
"notionUpdatePage": { fields: [["pageId", "string"], ["content", "string"], ["mode", ["append", "overwrite"]]], outputKeys: ["pageId", "pageUrl"] },
|
|
5160
|
+
"particlePodcastsFindMentions": { fields: [], outputKeys: [] },
|
|
5161
|
+
"particlePodcastsGetEpisode": { fields: [["id", "string"]], outputKeys: [] },
|
|
5162
|
+
"particlePodcastsGetEpisodeTranscript": { fields: [["id", "string"]], outputKeys: [] },
|
|
5163
|
+
"particlePodcastsSearchCompanies": { fields: [], outputKeys: [] },
|
|
5164
|
+
"particlePodcastsSearchDialogue": { fields: [], outputKeys: [] },
|
|
5165
|
+
"particlePodcastsSearchPodcasts": { fields: [], outputKeys: [] },
|
|
5047
5166
|
"peopleSearch": { fields: [["smartQuery", "string"], ["enrichPeople", "boolean"], ["enrichOrganizations", "boolean"], ["limit", "string"], ["page", "string"], ["params", "object"]], outputKeys: ["results"] },
|
|
5048
5167
|
"postToLinkedIn": { fields: [["message", "string"], ["visibility", ["PUBLIC", "CONNECTIONS"]]], outputKeys: [] },
|
|
5049
5168
|
"postToSlackChannel": { fields: [["channelId", "string"], ["messageType", ["string", "blocks"]], ["message", "string"]], outputKeys: [] },
|
|
@@ -5114,7 +5233,12 @@ var monacoSnippets = {
|
|
|
5114
5233
|
"videoRemoveBackground": { fields: [["videoUrl", "string"], ["newBackground", ["transparent", "image"]], ["engine", "string"]], outputKeys: ["videoUrl"] },
|
|
5115
5234
|
"videoRemoveWatermark": { fields: [["videoUrl", "string"], ["engine", "string"]], outputKeys: ["videoUrl"] },
|
|
5116
5235
|
"watermarkImage": { fields: [["imageUrl", "string"], ["watermarkImageUrl", "string"], ["corner", ["top-left", "top-right", "bottom-left", "bottom-right"]], ["paddingPx", "number"], ["widthPx", "number"]], outputKeys: ["imageUrl"] },
|
|
5117
|
-
"watermarkVideo": { fields: [["videoUrl", "string"], ["imageUrl", "string"], ["corner", ["top-left", "top-right", "bottom-left", "bottom-right"]], ["paddingPx", "number"], ["widthPx", "number"]], outputKeys: ["videoUrl"] }
|
|
5236
|
+
"watermarkVideo": { fields: [["videoUrl", "string"], ["imageUrl", "string"], ["corner", ["top-left", "top-right", "bottom-left", "bottom-right"]], ["paddingPx", "number"], ["widthPx", "number"]], outputKeys: ["videoUrl"] },
|
|
5237
|
+
"youDotComFinanceResearch": { fields: [["input", "string"]], outputKeys: ["data"] },
|
|
5238
|
+
"youDotComGetPageContent": { fields: [["urls", "array"]], outputKeys: ["data"] },
|
|
5239
|
+
"youDotComLiveNews": { fields: [["query", "string"]], outputKeys: ["data"] },
|
|
5240
|
+
"youDotComWebResearch": { fields: [["input", "string"]], outputKeys: ["data"] },
|
|
5241
|
+
"youDotComWebSearch": { fields: [["query", "string"]], outputKeys: ["data"] }
|
|
5118
5242
|
};
|
|
5119
5243
|
var blockTypeAliases = {
|
|
5120
5244
|
"userMessage": "generateText",
|