@mindstudio-ai/agent 0.1.172 → 0.1.174

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 CHANGED
@@ -4,6 +4,42 @@ 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.174
8
+
9
+ ### New
10
+
11
+ - `session.environment`: `'live'`, `'preview'` or `'dev'`, on every run, so a method can keep a dev run's fixed-key file-store writes (a generated sitemap, a `config/latest.json`) off what live reads, since file stores are shared across environments. Absent on older platform versions.
12
+ - `session.host`: the host the request was served on (a custom domain, the app's own subdomain, a preview host, or the parent's host under a mount), set by the platform, so one app serving several sites can tell which one a call came from. On web, API, webhook, MCP and agent-chat calls; absent on cron, inbound email, voice and task-agent tool calls, and dev runs.
13
+ - `prerender.invalidate` takes full URLs as well as paths: `https://site-a.com/blog/x` purges that page on that host only, for an app whose sites have different content at one path. A path still purges the page on every host. App code isn't affected.
14
+ - `analytics` reads how pages were read and how visits went, recorded by `@mindstudio-ai/interface` 0.1.38:
15
+ - Metrics `timeOnPage` (seconds), `scrollDepth` (%), `visitDuration` (seconds) and `bounceRate` (%), each `null` rather than 0 when there's nothing to average. Time on page and scroll depth are lifetime, app-wide or per page; visit duration and bounce rate come from the last 90 days.
16
+ - Visit dimensions `entryPath`, `exitPath`, `visitReferrerHost`, `visitSourceCategory` and `visitUtmSource`…`visitUtmContent`, describing the whole visit a row belongs to. Grouping a custom event by `visitReferrerHost` gives its conversions by source.
17
+ - `prop:<key>` groups or filters custom events by a property, and the filter `visitEvent` keeps the visits that fired an event (`[['is', 'visitEvent', ['signup']]]` by `path` is the pages that led to signups).
18
+ - `orderBy` takes `visits` where the query carries it.
19
+ - `analytics.funnel({ steps, breakdown? })` counts visits through ordered steps (pages or events) and where they dropped off. `analytics.paths({ from?, depth? })` shows where visits went after a page and their commonest routes. Both follow a visitor across the apps sharing the host (an app's mounts) and count as 5 reads.
20
+ - An app that keeps its own visit records for any of these (a visit tracker, a webhook that records reads, its own funnel or journey tables) can read them from the platform instead and drop its own. Visit-level reads start when the platform began recording visits, and say so in `meta.clamped` and `meta.window.served`.
21
+
22
+ ### Changed behavior
23
+
24
+ - `session` is no longer set only for a caller's session: a run no caller started (cron, inbound email, a webhook) has one too, with `environment` and no `channel`. Check: code that took any `session` field being set to mean a voice or agent-chat call should check `session.channel` instead.
25
+
26
+ ## 0.1.173
27
+
28
+ ### New
29
+
30
+ - `voice.call({ to, from? })`: an app can hold several phone numbers, and `from` names which of them the call comes from. It must be one of the app's active numbers (`from_not_app_number`). With one number it can be left out, as before. With several it can't: a call without it throws `from_required`.
31
+ - A phone call's `session.sip` carries `appNumber`, the app's own number on the call: the number dialed on an inbound call, the caller ID on an outbound one. An app that gives each of its tenants a number finds the tenant by it, whichever way the call went. Absent on older platform versions.
32
+ - `downloadVideo` takes `item`, which item of a URL holding several to download (a carousel, a playlist, a post with several videos), counting from 1, and `start` and `duration`, in seconds, for a clip. An mp4 clip is cut without re-encoding, so it can start a moment before `start`; an mp3 clip is exact. Its output adds `title`, `durationSec` (the downloaded file's own length) and `itemCount` (how many items the URL holds, absent for a playlist the site doesn't count up front). App code isn't affected.
33
+ - A browser session's `screenshot({ boxes })` takes elements, named as an action names them, and the shot's `boxes` say where each is in it, in its CSS pixels, measured as the shot is taken (`null` for one the page doesn't have). Draw highlights from these: an action's `box` is where the element was as the action landed, and a page can move after, as when a banner arrives and pushes it down, so a highlight drawn from it can miss on a later shot. They also hold on a `fullPage` shot, where an action's viewport `box` doesn't. Check: an app that draws a highlight on a screenshot from an action's `box` should ask the screenshot for it instead.
34
+
35
+ ### Changed behavior
36
+
37
+ - An app with more than one active phone number must pass `from` to `voice.call`. Apps with one number aren't affected.
38
+
39
+ ### Fixed
40
+
41
+ - `downloadVideo` on an Instagram link to one slide of a carousel (`?img_index=3`) downloads that slide, where it downloaded the first. A photo, and an item past the end of a URL's list, now fail at once with `video_unavailable`, where they retried and then failed with `download_failed`. An app that matched `download_failed` for those should match `video_unavailable`.
42
+
7
43
  ## 0.1.172
8
44
 
9
45
  ### New
package/dist/cli.js CHANGED
@@ -271,9 +271,9 @@ var init_metadata = __esm({
271
271
  "downloadVideo": {
272
272
  stepType: "downloadVideo",
273
273
  description: "Download a video file",
274
- usageNotes: "- Works with YouTube, TikTok, etc., by using ytdlp behind the scenes\n- Can save as mp4 or mp3",
275
- inputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the video to download (supports YouTube, TikTok, etc. via yt-dlp)" }, "format": { "enum": ["mp4", "mp3"], "type": "string", "description": "Output format for the downloaded file" } }, "required": ["videoUrl", "format"] },
276
- outputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the downloaded and re-hosted video file" } }, "required": ["videoUrl"] }
274
+ usageNotes: "- Works with YouTube, TikTok, etc., by using ytdlp behind the scenes\n- Can save as mp4 or mp3\n- `item` picks one item of a URL that holds several: a carousel, a playlist, a post with several videos. A link to one slide of a carousel downloads that slide. `itemCount` in the output says how many there are, so download item 1 and loop for the rest\n- `start` and `duration` (seconds) download a clip. An mp4 clip is cut without re-encoding, so it can start a moment before `start` (for an exact cut, trim the result with `trimMedia`); an mp3 clip is exact\n- Videos and audio only: a photo (a photo post, a photo in a carousel) fails as `video_unavailable`, and so does an item the URL doesn't have",
275
+ inputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the video to download (supports YouTube, TikTok, etc. via yt-dlp)" }, "format": { "enum": ["mp4", "mp3"], "type": "string", "description": "Output format for the downloaded file" }, "item": { "type": "number", "description": "Which item to download from a URL that holds several (a carousel, a playlist, a post with several videos), counting from 1. Omit for the one the URL names, else the first" }, "start": { "type": "number", "description": "Start of a clip, in seconds. Omit to start at the beginning" }, "duration": { "type": "number", "description": "Length of a clip, in seconds. Omit to run to the end" } }, "required": ["videoUrl", "format"] },
276
+ outputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the downloaded and re-hosted video file" }, "title": { "type": "string", "description": "The video's title, as the site gives it" }, "durationSec": { "type": "number", "description": "How long the downloaded file runs, in seconds: a clip's own length" }, "itemCount": { "type": "number", "description": "How many items the URL holds: 1 for a single video. Absent for a playlist the site doesn't count up front (a channel, a long playlist)" } }, "required": ["videoUrl"] }
277
277
  },
278
278
  "enhanceImageGenerationPrompt": {
279
279
  stepType: "enhanceImageGenerationPrompt",
@@ -5591,6 +5591,7 @@ function createVoice(call) {
5591
5591
  async call(params) {
5592
5592
  return await call("call", {
5593
5593
  to: params.to,
5594
+ ...params.from !== void 0 ? { from: params.from } : {},
5594
5595
  assumeIdentity: params.assumeIdentity === true
5595
5596
  });
5596
5597
  }
@@ -5612,6 +5613,12 @@ function createAnalytics(call) {
5612
5613
  const res = await call("query-batch", { queries: specs });
5613
5614
  return res.results;
5614
5615
  },
5616
+ funnel(options) {
5617
+ return call("funnel", options);
5618
+ },
5619
+ paths(options) {
5620
+ return call("paths", options ?? {});
5621
+ },
5615
5622
  live() {
5616
5623
  return call("live", {});
5617
5624
  },
@@ -5906,36 +5913,35 @@ Then describe the page briefly: its layout, its content, and what state it is in
5906
5913
  });
5907
5914
  }
5908
5915
  async screenshot(options = {}) {
5909
- const { store, key, fullPage, cursor } = options;
5916
+ const { store, key, fullPage, cursor, boxes } = options;
5917
+ const asked = {
5918
+ op: "screenshot",
5919
+ fullPage: !!fullPage,
5920
+ cursor: !!cursor,
5921
+ ...boxes?.length ? { boxes: boxes.map(toWireTarget) } : {}
5922
+ };
5923
+ const measured = (shot2) => ({
5924
+ width: shot2.width,
5925
+ height: shot2.height,
5926
+ deviceScaleFactor: shot2.deviceScaleFactor,
5927
+ ...shot2.boxes ? { boxes: shot2.boxes } : {}
5928
+ });
5910
5929
  if (store) {
5911
5930
  const token = await store.createUploadToken({
5912
5931
  ...key ? { key } : { filename: "screenshot.png" },
5913
5932
  contentType: "image/png"
5914
5933
  });
5915
5934
  const shot2 = await this.run({
5916
- op: "screenshot",
5917
- fullPage: !!fullPage,
5918
- cursor: !!cursor,
5935
+ ...asked,
5919
5936
  upload: { url: token.upload.url, fields: token.upload.fields }
5920
5937
  });
5921
- return {
5922
- ...await store.head(token.key),
5923
- width: shot2.width,
5924
- height: shot2.height,
5925
- deviceScaleFactor: shot2.deviceScaleFactor
5926
- };
5938
+ return { ...await store.head(token.key), ...measured(shot2) };
5927
5939
  }
5928
- const shot = await this.run({
5929
- op: "screenshot",
5930
- fullPage: !!fullPage,
5931
- cursor: !!cursor
5932
- });
5940
+ const shot = await this.run(asked);
5933
5941
  return {
5934
5942
  data: Buffer.from(shot.data ?? "", "base64"),
5935
5943
  contentType: "image/png",
5936
- width: shot.width,
5937
- height: shot.height,
5938
- deviceScaleFactor: shot.deviceScaleFactor
5944
+ ...measured(shot)
5939
5945
  };
5940
5946
  }
5941
5947
  /**
@@ -8690,10 +8696,11 @@ var init_client = __esm({
8690
8696
  }
8691
8697
  /**
8692
8698
  * The `analytics` namespace — read the app's own traffic + event analytics
8693
- * (auto-tracked pageviews, `analytics.track()` events). One general
8694
- * `query()` (metrics × dimensions × filters × time) plus `live()`,
8695
- * `sources()`, `map()`, `aiSources()`, `crawlers.*`. See {@link Analytics}
8696
- * for the lifetime-rollup vs 90-day-events split.
8699
+ * (auto-tracked pageviews and engagement, `analytics.track()` events). One
8700
+ * general `query()` (metrics × dimensions × filters × time) plus
8701
+ * `funnel()`, `paths()`, `live()`, `sources()`, `map()`, `aiSources()`,
8702
+ * `crawlers.*`. See {@link Analytics} for the lifetime-rollup vs
8703
+ * 90-day-events split.
8697
8704
  *
8698
8705
  * @example
8699
8706
  * ```ts
@@ -9341,10 +9348,11 @@ var init_client = __esm({
9341
9348
  * page changes (e.g. a short URL's target). Omit `paths` (or pass an empty
9342
9349
  * array) to purge every snapshot for the app.
9343
9350
  *
9344
- * `paths` are this app's OWN route paths (`/u/abc`), whatever host the page is
9345
- * served on. If another app mounts this one under a path prefix, the copies
9346
- * cached at that prefix are purged too — no need to know or pass the mount
9347
- * path.
9351
+ * `paths` are this app's OWN route paths (`/u/abc`), which purge the page
9352
+ * whatever host it is served on, or full URLs (`https://site-a.com/u/abc`),
9353
+ * which purge it on that host only. If another app mounts this one under a
9354
+ * path prefix, the copies cached at that prefix are purged too — no need to
9355
+ * know or pass the mount path.
9348
9356
  *
9349
9357
  * Raw hook-token call (mirrors `reportIssue`) — the appId comes from the
9350
9358
  * token. Backend / managed-context only.
@@ -10035,7 +10043,7 @@ async function startMcpServer(options) {
10035
10043
  capabilities: { tools: {} },
10036
10044
  serverInfo: {
10037
10045
  name: "mindstudio-agent",
10038
- version: "0.1.172"
10046
+ version: "0.1.174"
10039
10047
  },
10040
10048
  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.'
10041
10049
  });
@@ -11075,7 +11083,7 @@ function isNewerVersion(current, latest) {
11075
11083
  return false;
11076
11084
  }
11077
11085
  async function checkForUpdate() {
11078
- const currentVersion = "0.1.172";
11086
+ const currentVersion = "0.1.174";
11079
11087
  if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
11080
11088
  return null;
11081
11089
  }
@@ -11110,7 +11118,7 @@ async function checkForUpdate() {
11110
11118
  }
11111
11119
  }
11112
11120
  function printUpdateNotice(latestVersion) {
11113
- const currentVersion = "0.1.172";
11121
+ const currentVersion = "0.1.174";
11114
11122
  process.stderr.write(
11115
11123
  `
11116
11124
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -11123,7 +11131,7 @@ function isStandaloneBinary() {
11123
11131
  return !argv1.includes("node_modules");
11124
11132
  }
11125
11133
  async function cmdUpdate() {
11126
- const currentVersion = "0.1.172";
11134
+ const currentVersion = "0.1.174";
11127
11135
  process.stderr.write(
11128
11136
  ` ${ansi2.gray("Current version:")} ${currentVersion}
11129
11137
  `
@@ -11264,7 +11272,7 @@ async function cmdLogin(options) {
11264
11272
  process.stderr.write("\n");
11265
11273
  printLogo();
11266
11274
  process.stderr.write("\n");
11267
- const ver = "0.1.172";
11275
+ const ver = "0.1.174";
11268
11276
  process.stderr.write(
11269
11277
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
11270
11278
  `
@@ -11592,7 +11600,7 @@ async function main() {
11592
11600
  const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
11593
11601
  try {
11594
11602
  if (command === "version" || command === "-v") {
11595
- process.stdout.write("0.1.172\n");
11603
+ process.stdout.write("0.1.174\n");
11596
11604
  return;
11597
11605
  }
11598
11606
  if (command === "login") {