@mindstudio-ai/agent 0.1.175 → 0.1.177

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/analytics/index.d.ts +384 -0
  3. package/dist/auth/index.d.ts +113 -0
  4. package/dist/browser/index.d.ts +332 -0
  5. package/dist/cli.js +52 -33
  6. package/dist/client.d.ts +767 -0
  7. package/dist/config.d.ts +13 -0
  8. package/dist/context.d.ts +125 -0
  9. package/dist/datasources/index.d.ts +52 -0
  10. package/dist/datasources/source.d.ts +1074 -0
  11. package/dist/db/aggregate.d.ts +101 -0
  12. package/dist/db/index.d.ts +280 -0
  13. package/dist/db/mutation.d.ts +65 -0
  14. package/dist/db/predicate.d.ts +85 -0
  15. package/dist/db/query.d.ts +233 -0
  16. package/dist/db/raw.d.ts +36 -0
  17. package/dist/db/readBatching.d.ts +36 -0
  18. package/dist/db/scanHints.d.ts +8 -0
  19. package/dist/db/sql.d.ts +136 -0
  20. package/dist/db/table.d.ts +146 -0
  21. package/dist/db/time.d.ts +17 -0
  22. package/dist/db/types.d.ts +237 -0
  23. package/dist/db-ws.d.ts +35 -0
  24. package/dist/email/index.d.ts +396 -0
  25. package/dist/errors.d.ts +34 -0
  26. package/dist/events/index.d.ts +127 -0
  27. package/dist/files/index.d.ts +62 -0
  28. package/dist/files/store.d.ts +244 -0
  29. package/dist/generated/metadata.d.ts +8 -0
  30. package/dist/generated/snippets.d.ts +8 -0
  31. package/dist/generated/steps.d.ts +2745 -0
  32. package/dist/generated/types.d.ts +4234 -0
  33. package/dist/http.d.ts +22 -0
  34. package/dist/index.d.ts +59 -13323
  35. package/dist/index.js +39 -20
  36. package/dist/index.js.map +7 -1
  37. package/dist/jewel/index.d.ts +325 -0
  38. package/dist/mapper/index.d.ts +229 -0
  39. package/dist/rate-limit.d.ts +25 -0
  40. package/dist/reader/index.d.ts +170 -0
  41. package/dist/respond.d.ts +68 -0
  42. package/dist/task/index.d.ts +18 -0
  43. package/dist/task/local.d.ts +48 -0
  44. package/dist/task/schema.d.ts +120 -0
  45. package/dist/task/types.d.ts +203 -0
  46. package/dist/types.d.ts +591 -0
  47. package/dist/voice/index.d.ts +87 -0
  48. package/llms.txt +1 -1
  49. package/package.json +6 -12
  50. package/dist/postinstall.js +0 -12096
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ var noopAls = {
113
113
  var als = noopAls;
114
114
  try {
115
115
  if (typeof process !== "undefined" && process.versions?.node) {
116
- const mod = await import("async_hooks");
116
+ const mod = await import("node:async_hooks");
117
117
  als = new mod.AsyncLocalStorage();
118
118
  }
119
119
  } catch {
@@ -476,9 +476,9 @@ var RateLimiter = class {
476
476
  };
477
477
 
478
478
  // src/config.ts
479
- import { readFileSync, writeFileSync, mkdirSync } from "fs";
480
- import { join } from "path";
481
- import { homedir } from "os";
479
+ import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
480
+ import { join } from "node:path";
481
+ import { homedir } from "node:os";
482
482
  function configPaths() {
483
483
  const dir = join(homedir(), ".mindstudio");
484
484
  return { dir, file: join(dir, "config.json") };
@@ -3115,12 +3115,12 @@ var DbReadBatching = class {
3115
3115
  };
3116
3116
 
3117
3117
  // src/files/store.ts
3118
- import { createHash, randomUUID } from "crypto";
3119
- import { createReadStream, createWriteStream } from "fs";
3120
- import { readFile, stat, writeFile } from "fs/promises";
3121
- import { basename } from "path";
3122
- import { Readable } from "stream";
3123
- import { pipeline } from "stream/promises";
3118
+ import { createHash, randomUUID } from "node:crypto";
3119
+ import { createReadStream, createWriteStream } from "node:fs";
3120
+ import { readFile, stat, writeFile } from "node:fs/promises";
3121
+ import { basename } from "node:path";
3122
+ import { Readable } from "node:stream";
3123
+ import { pipeline } from "node:stream/promises";
3124
3124
  function fileUrl(access, store, key) {
3125
3125
  const path = key.split("/").map(encodeURIComponent).join("/");
3126
3126
  return `/_/files/${access}/${store}/${path}`;
@@ -3668,7 +3668,7 @@ function createFiles(call, runStep) {
3668
3668
  }
3669
3669
 
3670
3670
  // src/datasources/source.ts
3671
- import { createHash as createHash2 } from "crypto";
3671
+ import { createHash as createHash2 } from "node:crypto";
3672
3672
  var DICTIONARY_PAGE_ENTRIES = 1e4;
3673
3673
  var DICTIONARY_PAGE_BYTES = 4e6;
3674
3674
  var REMOVE_WHERE_MAX_PAGES = 100;
@@ -4345,7 +4345,7 @@ function createEvents(call) {
4345
4345
  }
4346
4346
 
4347
4347
  // src/browser/index.ts
4348
- import { randomUUID as randomUUID2 } from "crypto";
4348
+ import { randomUUID as randomUUID2 } from "node:crypto";
4349
4349
  var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
4350
4350
  var RETRY_BACKOFFS_MS = [1e3, 2e3, 4e3, 8e3, 15e3, 15e3, 15e3];
4351
4351
  var MAX_TOOL_STEPS = 20;
@@ -4857,7 +4857,7 @@ function createBrowser(call, steps) {
4857
4857
  }
4858
4858
 
4859
4859
  // src/task/local.ts
4860
- import { randomUUID as randomUUID3 } from "crypto";
4860
+ import { randomUUID as randomUUID3 } from "node:crypto";
4861
4861
 
4862
4862
  // src/generated/metadata.ts
4863
4863
  var stepMetadata = {
@@ -5637,7 +5637,7 @@ var stepMetadata = {
5637
5637
  "renderVideoFromHtmlComposition": {
5638
5638
  stepType: "renderVideoFromHtmlComposition",
5639
5639
  description: "Render an HTML composition (HTML, CSS, media and seekable animation on a timeline) to a video file",
5640
- 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",
5640
+ usageNotes: "- Renders an HTML composition in HyperFrames' format (https://hyperframes.heygen.com) with HyperFrames 0.8.186, 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",
5641
5641
  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)" } } },
5642
5642
  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"] }
5643
5643
  },
@@ -7291,6 +7291,7 @@ function applyStepMethods(AgentClass) {
7291
7291
  // src/client.ts
7292
7292
  var DEFAULT_BASE_URL = "https://v1.mindstudio-api.com";
7293
7293
  var DEFAULT_MAX_RETRIES = 3;
7294
+ var FILES_RATE_LIMIT_WAIT_MS = 75e3;
7294
7295
  var toStepLogEvent = (event) => ({
7295
7296
  value: event.value,
7296
7297
  tag: event.tag,
@@ -8554,12 +8555,30 @@ var MindStudioAgent = class {
8554
8555
  /**
8555
8556
  * @internal Transport for the `files` namespace — POST /_internal/v2/files/<op>
8556
8557
  * with the raw hook token (mirrors `_executeDbBatch`).
8558
+ *
8559
+ * Waits out the platform's per-app limit on file calls: its 429 comes before
8560
+ * the call does anything, whatever the op, so the call is sent again every
8561
+ * few seconds for a little over the limit's one-minute window, and only then
8562
+ * throws `rate_limited`. An app moving files flat out runs at the limit
8563
+ * rather than failing past it.
8557
8564
  */
8558
8565
  async _filesRequest(op, body) {
8559
- return this._brokeredRequest("files", op, body, {
8560
- fallbackMessage: "File operation failed",
8561
- fallbackCode: "file_error"
8562
- });
8566
+ const giveUpAt = Date.now() + FILES_RATE_LIMIT_WAIT_MS;
8567
+ while (true) {
8568
+ try {
8569
+ return await this._brokeredRequest("files", op, body, {
8570
+ fallbackMessage: "File operation failed",
8571
+ fallbackCode: "file_error"
8572
+ });
8573
+ } catch (err) {
8574
+ if (!(err instanceof MindStudioError) || err.status !== 429 || Date.now() >= giveUpAt) {
8575
+ throw err;
8576
+ }
8577
+ await new Promise(
8578
+ (resolve) => setTimeout(resolve, 4e3 + Math.random() * 2e3)
8579
+ );
8580
+ }
8581
+ }
8563
8582
  }
8564
8583
  /**
8565
8584
  * @internal Transport for the `dataSources` namespace —
@@ -9468,7 +9487,7 @@ function defineJewel(method, config) {
9468
9487
  }
9469
9488
 
9470
9489
  // src/mapper/index.ts
9471
- import { gzipSync } from "zlib";
9490
+ import { gzipSync } from "node:zlib";
9472
9491
  function documents(list) {
9473
9492
  return {
9474
9493
  kind: "documents",
@@ -10190,4 +10209,4 @@ export {
10190
10209
  voice,
10191
10210
  waitUntil
10192
10211
  };
10193
- //# sourceMappingURL=index.js.map
10212
+ //# sourceMappingURL=index.js.map