@mindstudio-ai/agent 0.1.181 → 0.1.182

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/index.js CHANGED
@@ -3525,6 +3525,42 @@ var Store = class {
3525
3525
  });
3526
3526
  return this._toFile(key, meta);
3527
3527
  }
3528
+ /**
3529
+ * The file one of this store's URLs names: the URL an action given
3530
+ * `{ store }` returned, a `file.url` kept in a row, a share link. Makes no
3531
+ * call, so it carries the key, `url` and `shareUrl()` but no size or type
3532
+ * (`head(key)` reads those), and doesn't say the object exists.
3533
+ *
3534
+ * Throws `not_a_store_url` for a URL that isn't a file of this store.
3535
+ *
3536
+ * @example
3537
+ * ```ts
3538
+ * const { videoUrl } = await mindstudio.downloadVideo(
3539
+ * { videoUrl: input.url, format: 'mp3' },
3540
+ * { store: Recordings },
3541
+ * );
3542
+ * const { key } = Recordings.fileFromUrl(videoUrl);
3543
+ * ```
3544
+ */
3545
+ fileFromUrl(url) {
3546
+ const prefix = `/_/files/${this._access}/${this._store}/`;
3547
+ let key;
3548
+ try {
3549
+ const { pathname } = new URL(url, "https://app.invalid");
3550
+ if (pathname.startsWith(prefix) && pathname.length > prefix.length) {
3551
+ key = pathname.slice(prefix.length).split("/").map(decodeURIComponent).join("/");
3552
+ }
3553
+ } catch {
3554
+ }
3555
+ if (key === void 0) {
3556
+ throw new MindStudioError(
3557
+ `Not a URL of a file in the ${this._access} store "${this._store}": ${url}`,
3558
+ "not_a_store_url",
3559
+ 400
3560
+ );
3561
+ }
3562
+ return this._toFile(key, void 0);
3563
+ }
3528
3564
  /** Whether an object exists. */
3529
3565
  async exists(key) {
3530
3566
  try {
@@ -5067,6 +5103,13 @@ var stepMetadata = {
5067
5103
  inputSchema: { "type": "object", "properties": { "documentId": { "type": "string", "description": "Google Spreadsheet ID or URL" }, "sheetName": { "type": "string", "description": "Sheet/tab name (defaults to first sheet)" }, "startRow": { "type": "string", "description": "First row to delete (1-based, inclusive)" }, "endRow": { "type": "string", "description": "Last row to delete (1-based, inclusive)" }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" } }, "required": ["documentId", "startRow", "endRow"] },
5068
5104
  outputSchema: { "description": "This step does not produce output data." }
5069
5105
  },
5106
+ "describeExternalModel": {
5107
+ stepType: "describeExternalModel",
5108
+ description: "Read what a community model on Replicate takes, returns and costs, before running it",
5109
+ usageNotes: "- Returns the model pinned to a version (`model`, to pass to `runExternalModel` as it is), its input and output schemas, its licence and its price per second of run time\n- Free. Use it while building, to learn a model's field names, and keep the pinned `model` in the app's code: a model's latest version can change its fields\n- Models Replicate maintains itself (\"official\" models) and private models are refused",
5110
+ inputSchema: { "type": "object", "properties": { "replicate": { "type": "object", "properties": { "model": { "type": "string", "description": "The model, as `owner/name`, or `owner/name:version` for one version of it. Without a version, the latest" } }, "required": ["model"], "description": "A public community model on Replicate" } }, "required": ["replicate"] },
5111
+ outputSchema: { "type": "object", "properties": { "model": { "type": "string", "description": "The model pinned to a version, as `owner/name:version`: what `runExternalModel` takes" }, "url": { "type": "string", "description": "The model's page" }, "description": { "type": "string", "description": "What the model does, in its author's words" }, "inputSchema": { "type": "object", "properties": {}, "required": [], "description": "The JSON Schema of the model's input: its field names, types, defaults and which are required" }, "outputSchema": { "type": "object", "properties": {}, "required": [], "description": "The JSON Schema of what the model returns" }, "licenseUrl": { "type": "string", "description": "Where the model's licence is published, when its author names one" }, "pricePerSecond": { "type": "number", "description": "Dollars a second of run time costs" }, "priceIsUpperBound": { "type": "boolean", "description": "True when the model's own price couldn't be read, and `pricePerSecond` is the highest rate a run can bill at" } }, "required": ["model", "url", "description", "inputSchema", "outputSchema", "pricePerSecond", "priceIsUpperBound"] }
5112
+ },
5070
5113
  "detectChanges": {
5071
5114
  stepType: "detectChanges",
5072
5115
  description: "Detect changes between runs by comparing current input against previously stored state. Routes execution based on whether a change occurred.",
@@ -5167,10 +5210,10 @@ var stepMetadata = {
5167
5210
  },
5168
5211
  "fetchYoutubeChannel": {
5169
5212
  stepType: "fetchYoutubeChannel",
5170
- description: "Retrieve metadata and recent videos for a YouTube channel.",
5171
- usageNotes: "- Accepts a YouTube channel URL (e.g. https://www.youtube.com/@ChannelName or /channel/ID).\n- Returns channel info and video listings as a JSON object.",
5213
+ description: "Retrieve the recent videos of a YouTube channel.",
5214
+ usageNotes: "- Accepts a YouTube channel URL (e.g. https://www.youtube.com/@ChannelName or /channel/ID).\n- Returns `videos`, the channel's most recent first, each with id, title, link, views, length, published_time and thumbnail.",
5172
5215
  inputSchema: { "type": "object", "properties": { "channelUrl": { "type": "string", "description": "YouTube channel URL (e.g. https://www.youtube.com/@ChannelName or /channel/ID)" } }, "required": ["channelUrl"] },
5173
- outputSchema: { "type": "object", "properties": {}, "required": [] }
5216
+ outputSchema: { "type": "object", "properties": { "videos": { "type": "array", "items": { "type": "object", "properties": { "position": { "type": "number" }, "id": { "type": "string" }, "title": { "type": "string" }, "link": { "type": "string" }, "views": { "type": "number" }, "length": { "type": "string", "description": `The video's length as YouTube shows it, e.g. "3:26:40"` }, "published_time": { "type": "string", "description": 'When it was published, relative to now, e.g. "18 hours ago"' }, "channel": { "type": "object", "properties": { "is_verified": { "type": "boolean" } } }, "thumbnail": { "type": "object", "properties": { "static": { "type": "string" }, "rich": { "type": "string" } }, "description": "URLs of the still thumbnail and the animated preview" } } }, "description": "The channel's videos, most recent first" } } }
5174
5217
  },
5175
5218
  "fetchYoutubeComments": {
5176
5219
  stepType: "fetchYoutubeComments",
@@ -5182,9 +5225,9 @@ var stepMetadata = {
5182
5225
  "fetchYoutubeVideo": {
5183
5226
  stepType: "fetchYoutubeVideo",
5184
5227
  description: "Retrieve metadata for a YouTube video (title, description, stats, channel info).",
5185
- usageNotes: "- Returns video metadata, channel info, and engagement stats.\n- Video format data is excluded from the response.",
5228
+ usageNotes: "- Returns `video` (title, description, author, length_seconds, views, likes, published_time, thumbnail), `channel` (name, link, subscribers) and `comment.total`, plus chapters, key moments and recommended videos when the video has them.\n- A field YouTube doesn't show for the video is absent.\n- Video format data is excluded from the response.",
5186
5229
  inputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "YouTube video URL to fetch metadata for" } }, "required": ["videoUrl"] },
5187
- outputSchema: { "type": "object", "properties": {}, "required": [] }
5230
+ outputSchema: { "type": "object", "properties": { "video": { "type": "object", "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "description": { "type": "string" }, "author": { "type": "string", "description": "The channel's name" }, "category": { "type": "string" }, "length_seconds": { "type": "number" }, "views": { "type": "number" }, "likes": { "type": "number" }, "published_time": { "type": "string", "description": "The publish date as YouTube shows it" }, "keywords": { "type": "array", "items": { "type": "string" } }, "is_family_safe": { "type": "boolean" }, "thumbnail": { "type": "string", "description": "URL of the video's thumbnail" } }, "description": "The video itself" }, "channel": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "link": { "type": "string" }, "subscribers": { "type": "number" }, "thumbnail": { "type": "string" } }, "description": "The channel that published it" }, "comment": { "type": "object", "properties": { "total": { "type": "number", "description": "How many comments the video has" } } }, "chapters": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string" }, "timestamp": { "type": "string" }, "thumbnail": { "type": "string" } } } }, "key_moments": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string" }, "start_seconds": { "type": "number" }, "thumbnail": { "type": "string" } } } }, "available_transcripts_languages": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "lang": { "type": "string" } } }, "description": "The languages `fetchYoutubeCaptions` can return for this video" }, "recommended_videos": { "type": "object", "properties": { "videos": { "type": "array", "items": { "type": "object", "properties": { "position": { "type": "number" }, "id": { "type": "string" }, "title": { "type": "string" }, "link": { "type": "string" }, "views": { "type": "number" }, "channel": { "type": "string" }, "length": { "type": "string" }, "published_time": { "type": "string" }, "thumbnail": { "type": "string" } } } } } } } }
5188
5231
  },
5189
5232
  "generate3dModel": {
5190
5233
  stepType: "generate3dModel",
@@ -5656,6 +5699,13 @@ var stepMetadata = {
5656
5699
  inputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the source video to resize" }, "mode": { "enum": ["fit", "exact"], "type": "string", "description": "Resize mode: 'fit' scales within max dimensions, 'exact' forces exact dimensions" }, "maxWidth": { "type": "number", "description": "Maximum width in pixels (used with 'fit' mode)" }, "maxHeight": { "type": "number", "description": "Maximum height in pixels (used with 'fit' mode)" }, "width": { "type": "number", "description": "Exact width in pixels (used with 'exact' mode)" }, "height": { "type": "number", "description": "Exact height in pixels (used with 'exact' mode)" }, "strategy": { "enum": ["pad", "crop"], "type": "string", "description": "Strategy for handling aspect ratio mismatch in 'exact' mode" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" } }, "required": ["videoUrl", "mode"] },
5657
5700
  outputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the resized video" } }, "required": ["videoUrl"] }
5658
5701
  },
5702
+ "runExternalModel": {
5703
+ stepType: "runExternalModel",
5704
+ description: "Run a public community model the model catalog doesn't carry, on Replicate",
5705
+ usageNotes: "- For a kind of model no other action covers (separating a song's stems, aligning words to audio, depth or segmentation maps, a published fine-tune). A model the catalog has is run with its own action\n- `replicate.model` is `owner/name:version`. Call `describeExternalModel` first: it returns the model pinned to its latest version, its input and output schemas, its licence and its price\n- `replicate.input` is the model's own input, passed through as given. A file input is a URL; a private file of the app's own is signed for the run\n- `output` is whatever the model returns. Its files are copied before Replicate deletes them, an hour after the run: into the store passed as `store`, or onto the public CDN without one, so pass a private store for anything confidential\n- Billed for the seconds the model ran (`runSeconds`), at the model's own per-second price. A cold start is waited for and not billed, and can take minutes on a model that hasn't run lately: `timeoutSeconds` covers the wait and the run together\n- A run that fails throws with the model's own error. One that passes `timeoutSeconds` is cancelled and throws `external_model_timed_out`\n- Models Replicate maintains itself (\"official\" models) and private models are refused. Each model's licence is its author's: `describeExternalModel` links it",
5706
+ inputSchema: { "type": "object", "properties": { "replicate": { "type": "object", "properties": { "model": { "type": "string", "description": "The model and the version of it to run, as `owner/name:version`. `describeExternalModel` returns it" }, "input": { "type": "object", "properties": {}, "required": [], "description": "The model's input, by the field names its input schema gives. A file is a URL, and one of the app's own private files is signed for the run" }, "timeoutSeconds": { "type": "number", "description": "Seconds the whole run may take, a cold start included, before it's cancelled. 600 by default, at most 1500" } }, "required": ["model", "input"], "description": "A public community model on Replicate" }, "intermediateAsset": { "type": "boolean", "description": "When true, the output's files are created but hidden from the user's gallery (tagged as intermediate)" } }, "required": ["replicate"] },
5707
+ outputSchema: { "type": "object", "properties": { "output": { "description": "The model's output, in the model's own shape. Every file in it is a URL in the app's store when the call named one, on the CDN otherwise" }, "runSeconds": { "type": "number", "description": "Seconds the model ran, which is what the run is billed for" } }, "required": ["output", "runSeconds"] }
5708
+ },
5659
5709
  "runFfmpeg": {
5660
5710
  stepType: "runFfmpeg",
5661
5711
  description: "Run an ffmpeg command on media files",
@@ -5789,9 +5839,9 @@ var stepMetadata = {
5789
5839
  "searchYoutubeTrends": {
5790
5840
  stepType: "searchYoutubeTrends",
5791
5841
  description: "Retrieve trending videos on YouTube by category and region.",
5792
- usageNotes: '- Categories: "now" (trending now), "music", "gaming", "films".\n- Supports country and language filtering.',
5842
+ usageNotes: '- Categories: "now" (trending now), "music", "gaming", "films".\n- Supports country and language filtering.\n- Returns `trending`, each video with id, title, link, views, channel, length, published_time and thumbnail; some categories add `recently_trending` and `shorts`.',
5793
5843
  inputSchema: { "type": "object", "properties": { "bp": { "enum": ["now", "music", "gaming", "films"], "type": "string", "description": 'Trending category: "now" (trending now), "music", "gaming", or "films"' }, "hl": { "type": "string", "description": 'Language code (e.g. "en")' }, "gl": { "type": "string", "description": 'Country code (e.g. "US")' } }, "required": ["bp", "hl", "gl"] },
5794
- outputSchema: { "type": "object", "properties": {}, "required": [] }
5844
+ outputSchema: { "type": "object", "properties": { "trending": { "type": "array", "items": { "type": "object", "properties": { "position": { "type": "number" }, "id": { "type": "string" }, "title": { "type": "string" }, "link": { "type": "string" }, "views": { "type": "number" }, "channel": { "type": "object", "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "link": { "type": "string" }, "is_verified": { "type": "boolean" }, "thumbnail": { "type": "string" } } }, "length": { "type": "string", "description": "The video's length as YouTube shows it" }, "published_time": { "type": "string", "description": "When it was published, relative to now" }, "thumbnail": { "type": "string" } } }, "description": "The videos trending in the category and region" }, "recently_trending": { "type": "array", "items": { "type": "object", "properties": { "position": { "type": "number" }, "id": { "type": "string" }, "title": { "type": "string" }, "link": { "type": "string" }, "views": { "type": "number" }, "channel": { "type": "object", "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "link": { "type": "string" }, "is_verified": { "type": "boolean" }, "thumbnail": { "type": "string" } } }, "length": { "type": "string", "description": "The video's length as YouTube shows it" }, "published_time": { "type": "string", "description": "When it was published, relative to now" }, "thumbnail": { "type": "string" } } } }, "shorts": { "type": "array", "items": { "type": "object", "properties": { "position": { "type": "number" }, "id": { "type": "string" }, "title": { "type": "string" }, "link": { "type": "string" }, "views": { "type": "number" }, "thumbnail": { "type": "string" } } }, "description": "Trending Shorts" } } }
5795
5845
  },
5796
5846
  "sendEmail": {
5797
5847
  stepType: "sendEmail",
@@ -6900,6 +6950,9 @@ function applyStepMethods(AgentClass) {
6900
6950
  proto.deleteGoogleSheetRows = function(step, options) {
6901
6951
  return this.executeStep("deleteGoogleSheetRows", step, options);
6902
6952
  };
6953
+ proto.describeExternalModel = function(step, options) {
6954
+ return this.executeStep("describeExternalModel", step, options);
6955
+ };
6903
6956
  proto.detectChanges = function(step, options) {
6904
6957
  return this.executeStep("detectChanges", step, options);
6905
6958
  };
@@ -7140,6 +7193,9 @@ function applyStepMethods(AgentClass) {
7140
7193
  proto.resizeVideo = function(step, options) {
7141
7194
  return this.executeStep("resizeVideo", step, options);
7142
7195
  };
7196
+ proto.runExternalModel = function(step, options) {
7197
+ return this.executeStep("runExternalModel", step, options);
7198
+ };
7143
7199
  proto.runFfmpeg = function(step, options) {
7144
7200
  return this.executeStep("runFfmpeg", step, options);
7145
7201
  };
@@ -9943,6 +9999,7 @@ var monacoSnippets = {
9943
9999
  "deleteGmailEmail": { fields: [["messageId", "string"]], outputKeys: [] },
9944
10000
  "deleteGoogleCalendarEvent": { fields: [["eventId", "string"]], outputKeys: [] },
9945
10001
  "deleteGoogleSheetRows": { fields: [["documentId", "string"], ["startRow", "string"], ["endRow", "string"]], outputKeys: [] },
10002
+ "describeExternalModel": { fields: [["replicate", "object"]], outputKeys: ["model", "url", "description", "inputSchema", "outputSchema", "pricePerSecond", "priceIsUpperBound"] },
9946
10003
  "detectChanges": { fields: [["mode", ["ai", "comparison"]], ["input", "string"]], outputKeys: ["hasChanged", "currentValue", "previousValue", "isFirstRun"] },
9947
10004
  "detectPII": { fields: [["input", "string"], ["language", "string"], ["entities", "array"]], outputKeys: ["detected", "detections"] },
9948
10005
  "downloadVideo": { fields: [["videoUrl", "string"], ["format", ["mp4", "mp3"]]], outputKeys: ["videoUrl"] },
@@ -10025,6 +10082,7 @@ var monacoSnippets = {
10025
10082
  "renderVideoFromHtmlComposition": { fields: [], outputKeys: ["videoUrl", "durationSec", "frames"] },
10026
10083
  "replyToGmailEmail": { fields: [["messageId", "string"], ["message", "string"], ["messageType", ["plain", "html", "markdown"]]], outputKeys: ["messageId"] },
10027
10084
  "resizeVideo": { fields: [["videoUrl", "string"], ["mode", ["fit", "exact"]]], outputKeys: ["videoUrl"] },
10085
+ "runExternalModel": { fields: [["replicate", "object"]], outputKeys: ["output", "runSeconds"] },
10028
10086
  "runFfmpeg": { fields: [["inputs", "object"], ["args", "array"]], outputKeys: ["outputs"] },
10029
10087
  "runFromConnectorRegistry": { fields: [["actionId", "string"], ["displayName", "string"], ["icon", "string"], ["configurationValues", "object"]], outputKeys: ["data"] },
10030
10088
  "scrapeLinkedInCompany": { fields: [["url", "string"]], outputKeys: ["company"] },