@mindstudio-ai/agent 0.1.164 → 0.1.166

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,18 @@ 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.166
8
+
9
+ ### Changed behavior
10
+
11
+ - `renderVideoFromHtmlComposition` renders with HyperFrames 0.8.148, and its usage notes and `llms.txt` say so. In it, an mp4 or mov keeps sound and picture in sync when the source's streams start apart, and a long render with many clips no longer stalls at 90%. Check: an app that pins HyperFrames' CLI or `@hyperframes/player` at the platform's version for authoring or previewing moves it to 0.8.148.
12
+
13
+ ## 0.1.165
14
+
15
+ ### New
16
+
17
+ - The CLI can log what each call costs. When `MINDSTUDIO_USAGE_LOG` names a file, every billed call from an action, `batch` (a line per step) or `ask` appends one JSON line to it: `{ ts, action, billingCost, billingEvents?, durationMs }`, with `billingCost` in nano-dollars. It's for a tool that runs the CLI and keeps its own record of spend, whatever happens to the command's output. App code isn't affected.
18
+
7
19
  ## 0.1.164
8
20
 
9
21
  ### New
package/dist/cli.js CHANGED
@@ -9,6 +9,31 @@ var __export = (target, all) => {
9
9
  __defProp(target, name, { get: all[name], enumerable: true });
10
10
  };
11
11
 
12
+ // src/usageLog.ts
13
+ import { appendFileSync } from "fs";
14
+ function logUsage(entry) {
15
+ const file = process.env.MINDSTUDIO_USAGE_LOG;
16
+ if (!file || typeof entry.billingCost !== "number") {
17
+ return;
18
+ }
19
+ const line = {
20
+ ts: Date.now(),
21
+ action: entry.action,
22
+ billingCost: entry.billingCost,
23
+ ...entry.billingEvents?.length && { billingEvents: entry.billingEvents },
24
+ durationMs: Date.now() - entry.startedAt
25
+ };
26
+ try {
27
+ appendFileSync(file, JSON.stringify(line) + "\n");
28
+ } catch {
29
+ }
30
+ }
31
+ var init_usageLog = __esm({
32
+ "src/usageLog.ts"() {
33
+ "use strict";
34
+ }
35
+ });
36
+
12
37
  // src/generated/metadata.ts
13
38
  var metadata_exports = {};
14
39
  __export(metadata_exports, {
@@ -795,7 +820,7 @@ var init_metadata = __esm({
795
820
  "renderVideoFromHtmlComposition": {
796
821
  stepType: "renderVideoFromHtmlComposition",
797
822
  description: "Render an HTML composition (HTML, CSS, media and seekable animation on a timeline) to a video file",
798
- usageNotes: "- Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.143, in Chrome off the app's own sandbox; author for that version\n- Pass the composition as `html`, the page itself (up to 10 MB), or as `project`, the URL of a zip of a project's folder (`index.html` at its root, or the file `entryFile` names) or of one HTML file, up to 2 GiB: an app file or any public URL\n- `variables` overrides the composition's `data-composition-variables` defaults, which it reads with `window.__hyperframes.getVariables()`\n- Whatever the composition loads itself (fonts, scripts, images, video) is fetched as it renders, so each is in the project or at a public URL; a private app file needs a signed URL\n- fps 24, 30 or 60 (default 30); quality draft, standard or high (default standard); format mp4 (default), webm or mov (both keep transparency), or gif\n- An mp4, webm or mov renders in chunks of about 10 seconds side by side, so a long video takes little longer than a short one; a call finishes within about 30 minutes, and reports its progress as it goes. A gif renders whole, within 15 minutes\n- A composition HyperFrames can't render fails with HyperFrames' own reason",
823
+ usageNotes: "- Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.148, in Chrome off the app's own sandbox; author for that version\n- Pass the composition as `html`, the page itself (up to 10 MB), or as `project`, the URL of a zip of a project's folder (`index.html` at its root, or the file `entryFile` names) or of one HTML file, up to 2 GiB: an app file or any public URL\n- `variables` overrides the composition's `data-composition-variables` defaults, which it reads with `window.__hyperframes.getVariables()`\n- Whatever the composition loads itself (fonts, scripts, images, video) is fetched as it renders, so each is in the project or at a public URL; a private app file needs a signed URL\n- fps 24, 30 or 60 (default 30); quality draft, standard or high (default standard); format mp4 (default), webm or mov (both keep transparency), or gif\n- An mp4, webm or mov renders in chunks of about 10 seconds side by side, so a long video takes little longer than a short one; a call finishes within about 30 minutes, and reports its progress as it goes. A gif renders whole, within 15 minutes\n- A composition HyperFrames can't render fails with HyperFrames' own reason",
799
824
  inputSchema: { "type": "object", "properties": { "html": { "type": "string", "description": "The composition's HTML, up to 10 MB; give this or project" }, "project": { "type": "string", "description": "URL of a zip of the project's folder, or of one self-contained HTML file; give this or html" }, "entryFile": { "type": "string", "description": "The entry HTML inside the zip, relative to its root; index.html when omitted" }, "variables": { "type": "object", "properties": {}, "required": [], "description": "Values over the composition's declared variables" }, "fps": { "enum": [24, 30, 60], "type": "number", "description": "Frames per second: 24, 30 (default) or 60" }, "quality": { "enum": ["draft", "standard", "high"], "type": "string", "description": "Encode quality: draft, standard (default) or high" }, "format": { "enum": ["mp4", "webm", "mov", "gif"], "type": "string", "description": "mp4 (default), webm or mov (both keep transparency), or gif" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" } } },
800
825
  outputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the rendered video" }, "durationSec": { "type": "number", "description": "Its length in seconds" }, "frames": { "type": "number", "description": "How many frames it has" } }, "required": ["videoUrl", "durationSec", "frames"] }
801
826
  },
@@ -9307,6 +9332,7 @@ function summarizeInput(input) {
9307
9332
  async function cmdAsk(question, options) {
9308
9333
  try {
9309
9334
  let lineBuffer = "";
9335
+ const startedAt = Date.now();
9310
9336
  const result = await runAsk(question, options, (event) => {
9311
9337
  switch (event.type) {
9312
9338
  case "text":
@@ -9336,6 +9362,12 @@ async function cmdAsk(question, options) {
9336
9362
  if (lineBuffer) {
9337
9363
  process.stderr.write(lineBuffer);
9338
9364
  }
9365
+ logUsage({
9366
+ action: "ask",
9367
+ billingCost: result.billingCost,
9368
+ billingEvents: result.billingEvents,
9369
+ startedAt
9370
+ });
9339
9371
  if (options.json) {
9340
9372
  process.stdout.write(
9341
9373
  JSON.stringify({
@@ -9360,6 +9392,7 @@ var init_ask = __esm({
9360
9392
  async "src/ask/index.ts"() {
9361
9393
  "use strict";
9362
9394
  await init_client();
9395
+ init_usageLog();
9363
9396
  init_context2();
9364
9397
  init_sse();
9365
9398
  init_tools();
@@ -9434,7 +9467,7 @@ async function startMcpServer(options) {
9434
9467
  capabilities: { tools: {} },
9435
9468
  serverInfo: {
9436
9469
  name: "mindstudio-agent",
9437
- version: "0.1.164"
9470
+ version: "0.1.166"
9438
9471
  },
9439
9472
  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.'
9440
9473
  });
@@ -9885,6 +9918,7 @@ var init_mcp = __esm({
9885
9918
  });
9886
9919
 
9887
9920
  // src/cli.ts
9921
+ init_usageLog();
9888
9922
  import { parseArgs } from "util";
9889
9923
  import { execSync } from "child_process";
9890
9924
  import { readFileSync as readFileSync3 } from "fs";
@@ -10204,11 +10238,18 @@ async function cmdExec(method, input, options) {
10204
10238
  `);
10205
10239
  };
10206
10240
  }
10241
+ const startedAt = Date.now();
10207
10242
  const result = await agent.executeStep(meta.stepType, input, {
10208
10243
  appId: options.appId,
10209
10244
  threadId: options.threadId,
10210
10245
  onLog
10211
10246
  });
10247
+ logUsage({
10248
+ action: camelToKebab(method),
10249
+ billingCost: result.$billingCost,
10250
+ billingEvents: result.$billingEvents,
10251
+ startedAt
10252
+ });
10212
10253
  if (options.outputKey) {
10213
10254
  const val = result[options.outputKey];
10214
10255
  if (typeof val === "string") {
@@ -10384,10 +10425,18 @@ Example: mindstudio batch '[{"stepType":"generateImage","step":{"prompt":"a cat"
10384
10425
  return { stepType: item.stepType, step: item.step };
10385
10426
  });
10386
10427
  const agent = await createAgent(options);
10428
+ const startedAt = Date.now();
10387
10429
  const result = await agent.executeStepBatch(steps, {
10388
10430
  appId: options.appId,
10389
10431
  threadId: options.threadId
10390
10432
  });
10433
+ for (const step of result.results) {
10434
+ logUsage({
10435
+ action: `batch:${step.stepType}`,
10436
+ billingCost: step.billingCost,
10437
+ startedAt
10438
+ });
10439
+ }
10391
10440
  if (options.noMeta) {
10392
10441
  process.stdout.write(JSON.stringify(result.results, null, 2) + "\n");
10393
10442
  } else {
@@ -10458,7 +10507,7 @@ function isNewerVersion(current, latest) {
10458
10507
  return false;
10459
10508
  }
10460
10509
  async function checkForUpdate() {
10461
- const currentVersion = "0.1.164";
10510
+ const currentVersion = "0.1.166";
10462
10511
  if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
10463
10512
  return null;
10464
10513
  }
@@ -10493,7 +10542,7 @@ async function checkForUpdate() {
10493
10542
  }
10494
10543
  }
10495
10544
  function printUpdateNotice(latestVersion) {
10496
- const currentVersion = "0.1.164";
10545
+ const currentVersion = "0.1.166";
10497
10546
  process.stderr.write(
10498
10547
  `
10499
10548
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -10506,7 +10555,7 @@ function isStandaloneBinary() {
10506
10555
  return !argv1.includes("node_modules");
10507
10556
  }
10508
10557
  async function cmdUpdate() {
10509
- const currentVersion = "0.1.164";
10558
+ const currentVersion = "0.1.166";
10510
10559
  process.stderr.write(
10511
10560
  ` ${ansi2.gray("Current version:")} ${currentVersion}
10512
10561
  `
@@ -10647,7 +10696,7 @@ async function cmdLogin(options) {
10647
10696
  process.stderr.write("\n");
10648
10697
  printLogo();
10649
10698
  process.stderr.write("\n");
10650
- const ver = "0.1.164";
10699
+ const ver = "0.1.166";
10651
10700
  process.stderr.write(
10652
10701
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
10653
10702
  `
@@ -10975,7 +11024,7 @@ async function main() {
10975
11024
  const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
10976
11025
  try {
10977
11026
  if (command === "version" || command === "-v") {
10978
- process.stdout.write("0.1.164\n");
11027
+ process.stdout.write("0.1.166\n");
10979
11028
  return;
10980
11029
  }
10981
11030
  if (command === "login") {
package/dist/index.d.ts CHANGED
@@ -11159,7 +11159,7 @@ interface StepMethods {
11159
11159
  * Render an HTML composition (HTML, CSS, media and seekable animation on a timeline) to a video file
11160
11160
  *
11161
11161
  * @remarks
11162
- * - Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.143, in Chrome off the app's own sandbox; author for that version
11162
+ * - Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.148, in Chrome off the app's own sandbox; author for that version
11163
11163
  * - Pass the composition as `html`, the page itself (up to 10 MB), or as `project`, the URL of a zip of a project's folder (`index.html` at its root, or the file `entryFile` names) or of one HTML file, up to 2 GiB: an app file or any public URL
11164
11164
  * - `variables` overrides the composition's `data-composition-variables` defaults, which it reads with `window.__hyperframes.getVariables()`
11165
11165
  * - Whatever the composition loads itself (fonts, scripts, images, video) is fetched as it renders, so each is in the project or at a public URL; a private app file needs a signed URL
package/dist/index.js CHANGED
@@ -5102,7 +5102,7 @@ var stepMetadata = {
5102
5102
  "renderVideoFromHtmlComposition": {
5103
5103
  stepType: "renderVideoFromHtmlComposition",
5104
5104
  description: "Render an HTML composition (HTML, CSS, media and seekable animation on a timeline) to a video file",
5105
- usageNotes: "- Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.143, in Chrome off the app's own sandbox; author for that version\n- Pass the composition as `html`, the page itself (up to 10 MB), or as `project`, the URL of a zip of a project's folder (`index.html` at its root, or the file `entryFile` names) or of one HTML file, up to 2 GiB: an app file or any public URL\n- `variables` overrides the composition's `data-composition-variables` defaults, which it reads with `window.__hyperframes.getVariables()`\n- Whatever the composition loads itself (fonts, scripts, images, video) is fetched as it renders, so each is in the project or at a public URL; a private app file needs a signed URL\n- fps 24, 30 or 60 (default 30); quality draft, standard or high (default standard); format mp4 (default), webm or mov (both keep transparency), or gif\n- An mp4, webm or mov renders in chunks of about 10 seconds side by side, so a long video takes little longer than a short one; a call finishes within about 30 minutes, and reports its progress as it goes. A gif renders whole, within 15 minutes\n- A composition HyperFrames can't render fails with HyperFrames' own reason",
5105
+ usageNotes: "- Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.148, in Chrome off the app's own sandbox; author for that version\n- Pass the composition as `html`, the page itself (up to 10 MB), or as `project`, the URL of a zip of a project's folder (`index.html` at its root, or the file `entryFile` names) or of one HTML file, up to 2 GiB: an app file or any public URL\n- `variables` overrides the composition's `data-composition-variables` defaults, which it reads with `window.__hyperframes.getVariables()`\n- Whatever the composition loads itself (fonts, scripts, images, video) is fetched as it renders, so each is in the project or at a public URL; a private app file needs a signed URL\n- fps 24, 30 or 60 (default 30); quality draft, standard or high (default standard); format mp4 (default), webm or mov (both keep transparency), or gif\n- An mp4, webm or mov renders in chunks of about 10 seconds side by side, so a long video takes little longer than a short one; a call finishes within about 30 minutes, and reports its progress as it goes. A gif renders whole, within 15 minutes\n- A composition HyperFrames can't render fails with HyperFrames' own reason",
5106
5106
  inputSchema: { "type": "object", "properties": { "html": { "type": "string", "description": "The composition's HTML, up to 10 MB; give this or project" }, "project": { "type": "string", "description": "URL of a zip of the project's folder, or of one self-contained HTML file; give this or html" }, "entryFile": { "type": "string", "description": "The entry HTML inside the zip, relative to its root; index.html when omitted" }, "variables": { "type": "object", "properties": {}, "required": [], "description": "Values over the composition's declared variables" }, "fps": { "enum": [24, 30, 60], "type": "number", "description": "Frames per second: 24, 30 (default) or 60" }, "quality": { "enum": ["draft", "standard", "high"], "type": "string", "description": "Encode quality: draft, standard (default) or high" }, "format": { "enum": ["mp4", "webm", "mov", "gif"], "type": "string", "description": "mp4 (default), webm or mov (both keep transparency), or gif" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" } } },
5107
5107
  outputSchema: { "type": "object", "properties": { "videoUrl": { "type": "string", "description": "URL of the rendered video" }, "durationSec": { "type": "number", "description": "Its length in seconds" }, "frames": { "type": "number", "description": "How many frames it has" } }, "required": ["videoUrl", "durationSec", "frames"] }
5108
5108
  },