@mindstudio-ai/agent 0.1.87 → 0.1.89

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.d.ts CHANGED
@@ -1,3 +1,159 @@
1
+ /**
2
+ * Access level of a file store. `private` (the default) → reads are signed /
3
+ * session-authorized; `public` → world-readable, CDN-served on the app's own
4
+ * domain (and resizable via image query params).
5
+ */
6
+ type FileAccess = 'public' | 'private';
7
+ /** Options for {@link Store.put}. */
8
+ interface PutOptions {
9
+ /**
10
+ * Object key within the store (nested paths allowed, e.g. `reports/q1.pdf`).
11
+ * Omit to auto-generate a UUID key (with `filename`'s extension, if given).
12
+ */
13
+ key?: string;
14
+ /** MIME type stored on the object and returned on read. */
15
+ contentType?: string;
16
+ /** Original filename — used only to derive an extension when `key` is omitted. */
17
+ filename?: string;
18
+ /**
19
+ * When true (and no explicit `key`), derive the key from a content hash
20
+ * (`<sha256>.<ext>`) instead of a random UUID — immutable + idempotent, so
21
+ * re-uploading identical bytes yields the same key/URL. Ideal for public
22
+ * assets baked into source.
23
+ */
24
+ contentAddressed?: boolean;
25
+ }
26
+ /** Options for {@link Store.list}. */
27
+ interface ListOptions {
28
+ /** Restrict to keys under this prefix (relative to the store). */
29
+ prefix?: string;
30
+ /** Pagination cursor from a previous page. */
31
+ cursor?: string;
32
+ /** Max objects per page. */
33
+ limit?: number;
34
+ }
35
+ /** A stored object plus a ready-to-use URL. */
36
+ interface StoredFile {
37
+ store: string;
38
+ key: string;
39
+ access: FileAccess;
40
+ size?: number;
41
+ contentType?: string;
42
+ updatedAt?: string;
43
+ /**
44
+ * Stable, on-domain URL for the app's own frontend — drop straight into
45
+ * `<img src>`, `fetch`, or `<a download>`. Relative (resolves against the
46
+ * app's origin); a same-origin logged-in request authorizes automatically
47
+ * via the app session, so there's nothing to await.
48
+ */
49
+ url: string;
50
+ /**
51
+ * Mint an ABSOLUTE, signed share URL that works with **no** active session —
52
+ * email it, or embed it on another site. Expires (default 24h). Private
53
+ * stores only.
54
+ */
55
+ shareUrl(options?: {
56
+ expiresIn?: number;
57
+ }): Promise<string>;
58
+ }
59
+ /**
60
+ * A token for a client-direct upload, from {@link Store.createUploadToken}.
61
+ * Return it from a backend method and pass it straight to the frontend's
62
+ * `platform.upload(token, file)` — the browser then POSTs the file directly to
63
+ * storage (no bytes through the platform).
64
+ */
65
+ interface UploadToken {
66
+ /** The object key the upload will land at (within the store). */
67
+ key: string;
68
+ /** The stable on-domain URL the file will be readable at once uploaded. */
69
+ url: string;
70
+ /** @internal The scoped presigned POST the frontend submits to. */
71
+ upload: {
72
+ url: string;
73
+ fields: Record<string, string>;
74
+ };
75
+ }
76
+ /** @internal Per-store upload policy carried from `defineStore`. */
77
+ interface StorePolicy {
78
+ maxSize?: number;
79
+ contentTypes?: string[];
80
+ }
81
+ /** @internal Transport: `POST /_internal/v2/files/<op>` with the hook token. */
82
+ type FilesTransport = (op: string, body: unknown) => Promise<any>;
83
+ /**
84
+ * A typed handle to one named file store. Lazy — nothing executes until a
85
+ * method is awaited, so it's safe to `defineStore()` at module scope and import
86
+ * the handle into route handlers (same ergonomics as `db.defineTable`).
87
+ */
88
+ declare class Store {
89
+ private readonly _store;
90
+ private readonly _access;
91
+ private readonly _call;
92
+ private readonly _policy;
93
+ constructor(_store: string, _access: FileAccess, _call: FilesTransport, _policy?: StorePolicy);
94
+ /** The store's name. */
95
+ get name(): string;
96
+ /** The store's access level. */
97
+ get access(): FileAccess;
98
+ /** Store bytes. Returns a {@link StoredFile} with a ready-to-use `url`. */
99
+ put(content: Buffer | Uint8Array | string, options?: PutOptions): Promise<StoredFile>;
100
+ /** Read an object's bytes (backend / trusted context). */
101
+ get(key: string): Promise<Buffer>;
102
+ /** Metadata without downloading. Rejects if the object doesn't exist. */
103
+ head(key: string): Promise<StoredFile>;
104
+ /** Whether an object exists. */
105
+ exists(key: string): Promise<boolean>;
106
+ /** List objects in the store (optionally under `prefix`), one page at a time. */
107
+ list(options?: ListOptions): Promise<{
108
+ files: StoredFile[];
109
+ cursor?: string;
110
+ }>;
111
+ /** Delete an object. No-op if it doesn't exist. */
112
+ delete(key: string): Promise<void>;
113
+ /**
114
+ * Mint an ABSOLUTE, signed share URL for a key — works with **no** active
115
+ * session (email it, or embed it on another site). Expires (default 24h).
116
+ * Private stores only.
117
+ *
118
+ * The same link is available as `file.shareUrl()` on a {@link StoredFile};
119
+ * this convenience skips the `head()` when you already hold just the key.
120
+ */
121
+ shareUrl(key: string, options?: {
122
+ expiresIn?: number;
123
+ }): Promise<string>;
124
+ /**
125
+ * Mint an {@link UploadToken} for a **client-direct** upload — the browser
126
+ * POSTs the file straight to storage, so the bytes never pass through the
127
+ * platform. Return the token from a backend method and hand it to the
128
+ * frontend's `platform.upload(token, file)`. Works for private + public stores.
129
+ *
130
+ * Enforced at upload time by the presigned POST: a max size (this call's
131
+ * `maxSize`, else the store's, else the platform default) and — when
132
+ * `contentType` is set — an exact content-type match. When the store declares
133
+ * `contentTypes`, `contentType` must be one of them.
134
+ *
135
+ * Note: a presigned POST can pin exactly ONE content-type per token, so the
136
+ * *allowlist* is declared on `defineStore({ contentTypes })` and each token
137
+ * pins one type from it. This is by design, not a per-token limitation.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * // backend method
142
+ * export async function getUploadSlot(input: { contentType: string }) {
143
+ * return Uploads.createUploadToken({ contentType: input.contentType, maxSize: 50 * 1024 * 1024 });
144
+ * }
145
+ * ```
146
+ */
147
+ createUploadToken(options?: {
148
+ key?: string;
149
+ contentType?: string;
150
+ filename?: string;
151
+ maxSize?: number;
152
+ expiresIn?: number;
153
+ }): Promise<UploadToken>;
154
+ private _toFile;
155
+ }
156
+
1
157
  /** Configuration options for creating a {@link MindStudioAgent}. */
2
158
  interface AgentOptions {
3
159
  /**
@@ -83,6 +239,33 @@ interface StepExecutionOptions {
83
239
  * selection and token info.
84
240
  */
85
241
  onLog?: (event: StepLogEvent) => void;
242
+ /**
243
+ * Send any asset this step generates to one of the app's own file stores
244
+ * instead of the shared public MindStudio CDN.
245
+ *
246
+ * **Optional — the default is fine for most cases.** Omit it and generated
247
+ * assets keep going to the public CDN, exactly as before. Reach for it when
248
+ * the asset is user-specific, should be private, or belongs alongside the
249
+ * app's other files (where it shows up in the app's Files dashboard).
250
+ *
251
+ * The store's `access` comes from its `defineStore()`, so a private store
252
+ * yields a private asset — the returned URL is an on-domain
253
+ * `/_/files/private/...` link that only an authorized session can load,
254
+ * rather than a permanent public one.
255
+ *
256
+ * v2 apps only.
257
+ *
258
+ * @example
259
+ * ```ts
260
+ * const Photos = files.defineStore('product-photos', { access: 'public' });
261
+ *
262
+ * const { imageUrl } = await agent.generateImage(
263
+ * { prompt: 'a red sneaker on concrete' },
264
+ * { store: Photos },
265
+ * );
266
+ * ```
267
+ */
268
+ store?: Store;
86
269
  }
87
270
  /** Execution metadata returned alongside every step result. */
88
271
  interface StepExecutionMeta {
@@ -232,7 +415,7 @@ interface MindStudioModel {
232
415
  id?: string;
233
416
  /** Display name of the model. */
234
417
  name?: string;
235
- /** One of: `llm_chat`, `image_generation`, `video_generation`, `video_analysis`, `text_to_speech`, `vision`, `transcription`. */
418
+ /** See `ModelType` for the full set. */
236
419
  type?: ModelType;
237
420
  maxTemperature?: number;
238
421
  maxResponseSize?: number;
@@ -244,13 +427,20 @@ interface MindStudioModelSummary {
244
427
  id?: string;
245
428
  /** Display name of the model. */
246
429
  name?: string;
247
- /** One of: `llm_chat`, `image_generation`, `video_generation`, `video_analysis`, `text_to_speech`, `vision`, `transcription`. */
430
+ /** See `ModelType` for the full set. */
248
431
  type?: ModelType;
249
432
  /** Comma-separated tags for the model. */
250
433
  tags?: string;
251
434
  }
252
- /** Supported model type categories for filtering. */
253
- type ModelType = 'llm_chat' | 'image_generation' | 'video_generation' | 'video_analysis' | 'text_to_speech' | 'vision' | 'transcription';
435
+ /**
436
+ * Supported model type categories for filtering.
437
+ *
438
+ * `embedding`, `reranking` and `document_extraction` have no SDK step — the
439
+ * data-source pipeline chooses those platform-side and reports the result on
440
+ * `pipeline.embeddingModelId`. They are listed so the catalog can be queried
441
+ * and described, not so they can be passed to a generate call.
442
+ */
443
+ type ModelType = 'llm_chat' | 'image_generation' | '3d_generation' | 'video_generation' | 'video_analysis' | 'text_to_speech' | 'music_generation' | 'lipsync' | 'vision' | 'transcription' | 'embedding' | 'reranking' | 'document_extraction';
254
444
  /** Role assignment for a user within an app. */
255
445
  interface AppRoleAssignment {
256
446
  userId: string;
@@ -478,6 +668,12 @@ interface ExecuteStepBatchOptions {
478
668
  threadId?: string;
479
669
  /** Progress callback, called on each poll while the batch is running. */
480
670
  onProgress?: (completedSteps: number, totalSteps: number) => void;
671
+ /**
672
+ * Send assets generated by any step in this batch to one of the app's own
673
+ * file stores instead of the shared public MindStudio CDN. Optional; applies
674
+ * to every step in the batch. See {@link StepExecutionOptions.store}.
675
+ */
676
+ store?: Store;
481
677
  }
482
678
  /** Result of {@link MindStudioAgent.executeStepBatch}. */
483
679
  interface ExecuteStepBatchResult {
@@ -1292,160 +1488,6 @@ interface Db {
1292
1488
  batch(...queries: PromiseLike<unknown>[]): Promise<unknown[]>;
1293
1489
  }
1294
1490
 
1295
- /**
1296
- * Access level of a file store. `private` (the default) → reads are signed /
1297
- * session-authorized; `public` → world-readable, CDN-served on the app's own
1298
- * domain (and resizable via image query params).
1299
- */
1300
- type FileAccess = 'public' | 'private';
1301
- /** Options for {@link Store.put}. */
1302
- interface PutOptions {
1303
- /**
1304
- * Object key within the store (nested paths allowed, e.g. `reports/q1.pdf`).
1305
- * Omit to auto-generate a UUID key (with `filename`'s extension, if given).
1306
- */
1307
- key?: string;
1308
- /** MIME type stored on the object and returned on read. */
1309
- contentType?: string;
1310
- /** Original filename — used only to derive an extension when `key` is omitted. */
1311
- filename?: string;
1312
- /**
1313
- * When true (and no explicit `key`), derive the key from a content hash
1314
- * (`<sha256>.<ext>`) instead of a random UUID — immutable + idempotent, so
1315
- * re-uploading identical bytes yields the same key/URL. Ideal for public
1316
- * assets baked into source.
1317
- */
1318
- contentAddressed?: boolean;
1319
- }
1320
- /** Options for {@link Store.list}. */
1321
- interface ListOptions {
1322
- /** Restrict to keys under this prefix (relative to the store). */
1323
- prefix?: string;
1324
- /** Pagination cursor from a previous page. */
1325
- cursor?: string;
1326
- /** Max objects per page. */
1327
- limit?: number;
1328
- }
1329
- /** A stored object plus a ready-to-use URL. */
1330
- interface StoredFile {
1331
- store: string;
1332
- key: string;
1333
- access: FileAccess;
1334
- size?: number;
1335
- contentType?: string;
1336
- updatedAt?: string;
1337
- /**
1338
- * Stable, on-domain URL for the app's own frontend — drop straight into
1339
- * `<img src>`, `fetch`, or `<a download>`. Relative (resolves against the
1340
- * app's origin); a same-origin logged-in request authorizes automatically
1341
- * via the app session, so there's nothing to await.
1342
- */
1343
- url: string;
1344
- /**
1345
- * Mint an ABSOLUTE, signed share URL that works with **no** active session —
1346
- * email it, or embed it on another site. Expires (default 24h). Private
1347
- * stores only.
1348
- */
1349
- shareUrl(options?: {
1350
- expiresIn?: number;
1351
- }): Promise<string>;
1352
- }
1353
- /**
1354
- * A token for a client-direct upload, from {@link Store.createUploadToken}.
1355
- * Return it from a backend method and pass it straight to the frontend's
1356
- * `platform.upload(token, file)` — the browser then POSTs the file directly to
1357
- * storage (no bytes through the platform).
1358
- */
1359
- interface UploadToken {
1360
- /** The object key the upload will land at (within the store). */
1361
- key: string;
1362
- /** The stable on-domain URL the file will be readable at once uploaded. */
1363
- url: string;
1364
- /** @internal The scoped presigned POST the frontend submits to. */
1365
- upload: {
1366
- url: string;
1367
- fields: Record<string, string>;
1368
- };
1369
- }
1370
- /** @internal Per-store upload policy carried from `defineStore`. */
1371
- interface StorePolicy {
1372
- maxSize?: number;
1373
- contentTypes?: string[];
1374
- }
1375
- /** @internal Transport: `POST /_internal/v2/files/<op>` with the hook token. */
1376
- type FilesTransport = (op: string, body: unknown) => Promise<any>;
1377
- /**
1378
- * A typed handle to one named file store. Lazy — nothing executes until a
1379
- * method is awaited, so it's safe to `defineStore()` at module scope and import
1380
- * the handle into route handlers (same ergonomics as `db.defineTable`).
1381
- */
1382
- declare class Store {
1383
- private readonly _store;
1384
- private readonly _access;
1385
- private readonly _call;
1386
- private readonly _policy;
1387
- constructor(_store: string, _access: FileAccess, _call: FilesTransport, _policy?: StorePolicy);
1388
- /** The store's access level. */
1389
- get access(): FileAccess;
1390
- /** Store bytes. Returns a {@link StoredFile} with a ready-to-use `url`. */
1391
- put(content: Buffer | Uint8Array | string, options?: PutOptions): Promise<StoredFile>;
1392
- /** Read an object's bytes (backend / trusted context). */
1393
- get(key: string): Promise<Buffer>;
1394
- /** Metadata without downloading. Rejects if the object doesn't exist. */
1395
- head(key: string): Promise<StoredFile>;
1396
- /** Whether an object exists. */
1397
- exists(key: string): Promise<boolean>;
1398
- /** List objects in the store (optionally under `prefix`), one page at a time. */
1399
- list(options?: ListOptions): Promise<{
1400
- files: StoredFile[];
1401
- cursor?: string;
1402
- }>;
1403
- /** Delete an object. No-op if it doesn't exist. */
1404
- delete(key: string): Promise<void>;
1405
- /**
1406
- * Mint an ABSOLUTE, signed share URL for a key — works with **no** active
1407
- * session (email it, or embed it on another site). Expires (default 24h).
1408
- * Private stores only.
1409
- *
1410
- * The same link is available as `file.shareUrl()` on a {@link StoredFile};
1411
- * this convenience skips the `head()` when you already hold just the key.
1412
- */
1413
- shareUrl(key: string, options?: {
1414
- expiresIn?: number;
1415
- }): Promise<string>;
1416
- /**
1417
- * Mint an {@link UploadToken} for a **client-direct** upload — the browser
1418
- * POSTs the file straight to storage, so the bytes never pass through the
1419
- * platform. Return the token from a backend method and hand it to the
1420
- * frontend's `platform.upload(token, file)`. Works for private + public stores.
1421
- *
1422
- * Enforced at upload time by the presigned POST: a max size (this call's
1423
- * `maxSize`, else the store's, else the platform default) and — when
1424
- * `contentType` is set — an exact content-type match. When the store declares
1425
- * `contentTypes`, `contentType` must be one of them.
1426
- *
1427
- * Note: a presigned POST can pin exactly ONE content-type per token, so the
1428
- * *allowlist* is declared on `defineStore({ contentTypes })` and each token
1429
- * pins one type from it. This is by design, not a per-token limitation.
1430
- *
1431
- * @example
1432
- * ```ts
1433
- * // backend method
1434
- * export async function getUploadSlot(input: { contentType: string }) {
1435
- * return Uploads.createUploadToken({ contentType: input.contentType, maxSize: 50 * 1024 * 1024 });
1436
- * }
1437
- * ```
1438
- */
1439
- createUploadToken(options?: {
1440
- key?: string;
1441
- contentType?: string;
1442
- filename?: string;
1443
- maxSize?: number;
1444
- expiresIn?: number;
1445
- }): Promise<UploadToken>;
1446
- private _toFile;
1447
- }
1448
-
1449
1491
  /**
1450
1492
  * The `files` namespace — typed, private-by-default file storage for MindStudio
1451
1493
  * apps. Think of a store as a CDN-backed bucket the app talks to, not app-defined
@@ -3710,7 +3752,11 @@ interface GenerateImageStepInput {
3710
3752
  generateVariants?: boolean;
3711
3753
  /** Number of variants to generate (max 10) */
3712
3754
  numVariants?: number;
3713
- /** Whether to add a MindStudio watermark to the generated image */
3755
+ /**
3756
+ * Whether to add a MindStudio watermark to the generated image.
3757
+ *
3758
+ * The watermark is a product mark on assets generated in the MindStudio UI. A step run directly via the SDK or API is producing the app's own asset, so it is never watermarked and this flag has no effect there.
3759
+ */
3714
3760
  addWatermark?: boolean;
3715
3761
  }
3716
3762
  interface GenerateImageStepOutput {
@@ -3720,7 +3766,11 @@ interface GenerateImageStepOutput {
3720
3766
  interface GenerateLipsyncStepInput {
3721
3767
  /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
3722
3768
  intermediateAsset?: boolean;
3723
- /** Whether to add a MindStudio watermark to the generated video */
3769
+ /**
3770
+ * Whether to add a MindStudio watermark to the generated video.
3771
+ *
3772
+ * The watermark is a product mark on assets generated in the MindStudio UI. A step run directly via the SDK or API is producing the app's own asset, so it is never watermarked and this flag has no effect there.
3773
+ */
3724
3774
  addWatermark?: boolean;
3725
3775
  /** Optional model configuration override. Uses the workflow's default lipsync model if not specified */
3726
3776
  lipsyncModelOverride?: {
@@ -3855,7 +3905,11 @@ interface GenerateVideoStepInput {
3855
3905
  generateVariants?: boolean;
3856
3906
  /** Number of variants to generate (max 10) */
3857
3907
  numVariants?: number;
3858
- /** Whether to add a MindStudio watermark to the generated video */
3908
+ /**
3909
+ * Whether to add a MindStudio watermark to the generated video.
3910
+ *
3911
+ * The watermark is a product mark on assets generated in the MindStudio UI. A step run directly via the SDK or API is producing the app's own asset, so it is never watermarked and this flag has no effect there.
3912
+ */
3859
3913
  addWatermark?: boolean;
3860
3914
  }
3861
3915
  interface GenerateVideoStepOutput {
@@ -6869,7 +6923,7 @@ interface StepMethods {
6869
6923
  */
6870
6924
  convertPdfToImages(step: ConvertPdfToImagesStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<ConvertPdfToImagesStepOutput>>;
6871
6925
  /**
6872
- * Create a new empty vector data source for the current app.
6926
+ * @deprecated Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Create a new empty vector data source for the current app.
6873
6927
  *
6874
6928
  * @remarks
6875
6929
  * - Creates a new data source (vector database) associated with the current app version.
@@ -6951,7 +7005,7 @@ interface StepMethods {
6951
7005
  */
6952
7006
  createGoogleSheet(step: CreateGoogleSheetStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<CreateGoogleSheetStepOutput>>;
6953
7007
  /**
6954
- * Delete a vector data source from the current app.
7008
+ * @deprecated Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Delete a vector data source from the current app.
6955
7009
  *
6956
7010
  * @remarks
6957
7011
  * - Soft-deletes a data source (vector database) by marking it as deleted.
@@ -6967,7 +7021,7 @@ interface StepMethods {
6967
7021
  */
6968
7022
  deleteDataSource(step: DeleteDataSourceStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<DeleteDataSourceStepOutput>>;
6969
7023
  /**
6970
- * Delete a single document from a data source.
7024
+ * @deprecated Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Delete a single document from a data source.
6971
7025
  *
6972
7026
  * @remarks
6973
7027
  * - Soft-deletes a document by marking it as deleted.
@@ -7226,7 +7280,7 @@ interface StepMethods {
7226
7280
  */
7227
7281
  extractText(step: ExtractTextStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<ExtractTextStepOutput>>;
7228
7282
  /**
7229
- * Fetch the full extracted text contents of a document in a data source.
7283
+ * @deprecated Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Fetch the full extracted text contents of a document in a data source.
7230
7284
  *
7231
7285
  * @remarks
7232
7286
  * - Loads a document by ID and returns its full extracted text content.
@@ -7800,7 +7854,7 @@ interface StepMethods {
7800
7854
  */
7801
7855
  insertVideoClips(step: InsertVideoClipsStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<InsertVideoClipsStepOutput>>;
7802
7856
  /**
7803
- * List all data sources for the current app.
7857
+ * @deprecated Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. List all data sources for the current app.
7804
7858
  *
7805
7859
  * @remarks
7806
7860
  * - Returns metadata for every data source associated with the current app version.
@@ -8343,7 +8397,7 @@ interface StepMethods {
8343
8397
  */
8344
8398
  queryAppDatabase(step: QueryAppDatabaseStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<QueryAppDatabaseStepOutput>>;
8345
8399
  /**
8346
- * Search a vector data source (RAG) and return relevant document chunks.
8400
+ * @deprecated Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Search a vector data source (RAG) and return relevant document chunks.
8347
8401
  *
8348
8402
  * @remarks
8349
8403
  * - Queries a vectorized data source and returns the most relevant chunks.
@@ -9173,7 +9227,7 @@ interface StepMethods {
9173
9227
  */
9174
9228
  updateGoogleSheet(step: UpdateGoogleSheetStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<UpdateGoogleSheetStepOutput>>;
9175
9229
  /**
9176
- * Upload a file into an existing data source from a URL or raw text content.
9230
+ * @deprecated Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Upload a file into an existing data source from a URL or raw text content.
9177
9231
  *
9178
9232
  * @remarks
9179
9233
  * - If "file" is a single URL, the file is downloaded from that URL and uploaded.
package/dist/index.js CHANGED
@@ -1945,6 +1945,10 @@ var Store = class {
1945
1945
  this._call = _call;
1946
1946
  this._policy = _policy;
1947
1947
  }
1948
+ /** The store's name. */
1949
+ get name() {
1950
+ return this._store;
1951
+ }
1948
1952
  /** The store's access level. */
1949
1953
  get access() {
1950
1954
  return this._access;
@@ -2362,7 +2366,7 @@ var stepMetadata = {
2362
2366
  },
2363
2367
  "createDataSource": {
2364
2368
  stepType: "createDataSource",
2365
- description: "Create a new empty vector data source for the current app.",
2369
+ description: "Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Create a new empty vector data source for the current app.",
2366
2370
  usageNotes: '- Creates a new data source (vector database) associated with the current app version.\n- The data source is created empty \u2014 use the "Upload Data Source Document" block to add documents.\n- Returns the new data source ID which can be used in subsequent blocks.',
2367
2371
  inputSchema: { "type": "object", "properties": { "name": { "type": "string", "description": "Name for the new data source (supports variable interpolation)" } }, "required": ["name"] },
2368
2372
  outputSchema: { "description": "This step does not produce output data." }
@@ -2399,14 +2403,14 @@ var stepMetadata = {
2399
2403
  },
2400
2404
  "deleteDataSource": {
2401
2405
  stepType: "deleteDataSource",
2402
- description: "Delete a vector data source from the current app.",
2406
+ description: "Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Delete a vector data source from the current app.",
2403
2407
  usageNotes: "- Soft-deletes a data source (vector database) by marking it as deleted.\n- The Milvus partition is cleaned up asynchronously by a background cron job.\n- The data source must belong to the current app version.",
2404
2408
  inputSchema: { "type": "object", "properties": { "dataSourceId": { "type": "string", "description": "ID of the data source to delete (supports variable interpolation)" } }, "required": ["dataSourceId"] },
2405
2409
  outputSchema: { "description": "This step does not produce output data." }
2406
2410
  },
2407
2411
  "deleteDataSourceDocument": {
2408
2412
  stepType: "deleteDataSourceDocument",
2409
- description: "Delete a single document from a data source.",
2413
+ description: "Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Delete a single document from a data source.",
2410
2414
  usageNotes: "- Soft-deletes a document by marking it as deleted.\n- Requires both the data source ID and document ID.\n- After deletion, reloads vectors into Milvus so the data source reflects the change immediately.",
2411
2415
  inputSchema: { "type": "object", "properties": { "dataSourceId": { "type": "string", "description": "ID of the data source containing the document (supports variable interpolation)" }, "documentId": { "type": "string", "description": "ID of the document to delete (supports variable interpolation)" } }, "required": ["dataSourceId", "documentId"] },
2412
2416
  outputSchema: { "description": "This step does not produce output data." }
@@ -2511,7 +2515,7 @@ var stepMetadata = {
2511
2515
  },
2512
2516
  "fetchDataSourceDocument": {
2513
2517
  stepType: "fetchDataSourceDocument",
2514
- description: "Fetch the full extracted text contents of a document in a data source.",
2518
+ description: "Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Fetch the full extracted text contents of a document in a data source.",
2515
2519
  usageNotes: '- Loads a document by ID and returns its full extracted text content.\n- The document must have been successfully processed (status "done").\n- Also returns document metadata (name, summary, word count).',
2516
2520
  inputSchema: { "type": "object", "properties": { "dataSourceId": { "type": "string", "description": "ID of the data source containing the document (supports variable interpolation)" }, "documentId": { "type": "string", "description": "ID of the document to fetch (supports variable interpolation)" } }, "required": ["dataSourceId", "documentId"] },
2517
2521
  outputSchema: { "description": "This step does not produce output data." }
@@ -2590,14 +2594,14 @@ var stepMetadata = {
2590
2594
  stepType: "generateImage",
2591
2595
  description: "Generate an image from a text prompt using an AI model.",
2592
2596
  usageNotes: "- Prompts should be descriptive but concise (roughly 3\u20136 sentences).\n- Images are automatically hosted on a CDN.\n- In foreground mode, the image is displayed to the user. In background mode, the URL is saved to a variable.\n- When generateVariants is true with numVariants > 1, multiple images are generated in parallel.\n- In direct execution, foreground mode behaves as background, and userSelect variant behavior behaves as saveAll.",
2593
- inputSchema: { "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt describing the image to generate" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "imageModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "Image generation model identifier" }, "config": { "type": "object", "properties": {}, "required": [], "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default image model if not specified" }, "generateVariants": { "type": "boolean", "description": "Whether to generate multiple image variants in parallel" }, "numVariants": { "type": "number", "description": "Number of variants to generate (max 10)" }, "addWatermark": { "type": "boolean", "description": "Whether to add a MindStudio watermark to the generated image" } }, "required": ["prompt"] },
2597
+ inputSchema: { "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt describing the image to generate" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "imageModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "Image generation model identifier" }, "config": { "type": "object", "properties": {}, "required": [], "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default image model if not specified" }, "generateVariants": { "type": "boolean", "description": "Whether to generate multiple image variants in parallel" }, "numVariants": { "type": "number", "description": "Number of variants to generate (max 10)" }, "addWatermark": { "type": "boolean", "description": "Whether to add a MindStudio watermark to the generated image.\n\nThe watermark is a product mark on assets generated in the MindStudio UI. A step run directly via the SDK or API is producing the app's own asset, so it is never watermarked and this flag has no effect there." } }, "required": ["prompt"] },
2594
2598
  outputSchema: { "type": "object", "properties": { "imageUrl": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["imageUrl"] }
2595
2599
  },
2596
2600
  "generateLipsync": {
2597
2601
  stepType: "generateLipsync",
2598
2602
  description: "Generate a lip sync video from provided audio and image.",
2599
2603
  usageNotes: "- In foreground mode, the video is displayed to the user. In background mode, the URL is saved to a variable.",
2600
- inputSchema: { "type": "object", "properties": { "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "addWatermark": { "type": "boolean", "description": "Whether to add a MindStudio watermark to the generated video" }, "lipsyncModelOverride": { "type": "object", "properties": { "model": { "type": "string" }, "config": { "type": "object", "properties": {}, "required": [] } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default lipsync model if not specified" } } },
2604
+ inputSchema: { "type": "object", "properties": { "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "addWatermark": { "type": "boolean", "description": "Whether to add a MindStudio watermark to the generated video.\n\nThe watermark is a product mark on assets generated in the MindStudio UI. A step run directly via the SDK or API is producing the app's own asset, so it is never watermarked and this flag has no effect there." }, "lipsyncModelOverride": { "type": "object", "properties": { "model": { "type": "string" }, "config": { "type": "object", "properties": {}, "required": [] } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default lipsync model if not specified" } } },
2601
2605
  outputSchema: { "description": "This step does not produce output data." }
2602
2606
  },
2603
2607
  "generateMusic": {
@@ -2643,7 +2647,7 @@ var stepMetadata = {
2643
2647
  stepType: "generateVideo",
2644
2648
  description: "Generate a video from a text prompt using an AI model.",
2645
2649
  usageNotes: "- Prompts should be descriptive but concise (roughly 3\u20136 sentences).\n- Videos are automatically hosted on a CDN.\n- In foreground mode, the video is displayed to the user. In background mode, the URL is saved to a variable.\n- When generateVariants is true with numVariants > 1, multiple videos are generated in parallel.\n- In direct execution, foreground mode behaves as background, and userSelect variant behavior behaves as saveAll.",
2646
- inputSchema: { "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt describing the video to generate" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "videoModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "Video generation model identifier" }, "config": { "type": "object", "properties": {}, "required": [], "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default video model if not specified" }, "generateVariants": { "type": "boolean", "description": "Whether to generate multiple video variants in parallel" }, "numVariants": { "type": "number", "description": "Number of variants to generate (max 10)" }, "addWatermark": { "type": "boolean", "description": "Whether to add a MindStudio watermark to the generated video" } }, "required": ["prompt"] },
2650
+ inputSchema: { "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt describing the video to generate" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "videoModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "Video generation model identifier" }, "config": { "type": "object", "properties": {}, "required": [], "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default video model if not specified" }, "generateVariants": { "type": "boolean", "description": "Whether to generate multiple video variants in parallel" }, "numVariants": { "type": "number", "description": "Number of variants to generate (max 10)" }, "addWatermark": { "type": "boolean", "description": "Whether to add a MindStudio watermark to the generated video.\n\nThe watermark is a product mark on assets generated in the MindStudio UI. A step run directly via the SDK or API is producing the app's own asset, so it is never watermarked and this flag has no effect there." } }, "required": ["prompt"] },
2647
2651
  outputSchema: { "type": "object", "properties": { "videoUrl": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["videoUrl"] }
2648
2652
  },
2649
2653
  "getGmailAttachments": {
@@ -2788,7 +2792,7 @@ var stepMetadata = {
2788
2792
  },
2789
2793
  "listDataSources": {
2790
2794
  stepType: "listDataSources",
2791
- description: "List all data sources for the current app.",
2795
+ description: "Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. List all data sources for the current app.",
2792
2796
  usageNotes: "- Returns metadata for every data source associated with the current app version.\n- Each entry includes the data source ID, name, description, status, and document list.",
2793
2797
  inputSchema: { "type": "object", "properties": {}, "required": [] },
2794
2798
  outputSchema: { "description": "This step does not produce output data." }
@@ -3023,7 +3027,7 @@ var stepMetadata = {
3023
3027
  },
3024
3028
  "queryDataSource": {
3025
3029
  stepType: "queryDataSource",
3026
- description: "Search a vector data source (RAG) and return relevant document chunks.",
3030
+ description: "Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Search a vector data source (RAG) and return relevant document chunks.",
3027
3031
  usageNotes: "- Queries a vectorized data source and returns the most relevant chunks.\n- Useful for retrieval-augmented generation (RAG) workflows.",
3028
3032
  inputSchema: { "type": "object", "properties": { "dataSourceId": { "type": "string", "description": "ID of the vector data source to query" }, "query": { "type": "string", "description": "The search query to run against the data source" }, "maxResults": { "type": "number", "description": "Maximum number of chunks to return (recommended 1-3)" } }, "required": ["dataSourceId", "query", "maxResults"] },
3029
3033
  outputSchema: { "type": "object", "properties": { "text": { "type": "string", "description": "All matching chunks joined with newlines" }, "chunks": { "type": "array", "items": { "type": "string" }, "description": "Individual matching text chunks from the data source" }, "query": { "type": "string", "description": "The resolved search query that was executed" }, "citations": { "type": "array", "items": {}, "description": "Source citations for the matched chunks" }, "latencyMs": { "type": "number", "description": "Query execution time in milliseconds" } }, "required": ["text", "chunks", "query", "citations", "latencyMs"] }
@@ -3380,7 +3384,7 @@ var stepMetadata = {
3380
3384
  },
3381
3385
  "uploadDataSourceDocument": {
3382
3386
  stepType: "uploadDataSourceDocument",
3383
- description: "Upload a file into an existing data source from a URL or raw text content.",
3387
+ description: "Legacy v1 data sources. v2 apps should use `dataSources.defineDataSource()` from @mindstudio-ai/agent instead, which owns parsing, chunking, embedding and citations. Upload a file into an existing data source from a URL or raw text content.",
3384
3388
  usageNotes: '- If "file" is a single URL, the file is downloaded from that URL and uploaded.\n- If "file" is any other string, a .txt document is created from that content and uploaded.\n- The block waits (polls) for processing to complete before transitioning, up to 5 minutes.\n- Once processing finishes, vectors are loaded into Milvus so the data source is immediately queryable.\n- Supported file types (when using a URL) are the same as the data source upload UI (PDF, DOCX, TXT, etc.).',
3385
3389
  inputSchema: { "type": "object", "properties": { "dataSourceId": { "type": "string", "description": "ID of the target data source (supports variable interpolation)" }, "file": { "type": "string", "description": "A URL to download, or raw text content to create a .txt document from (supports variable interpolation)" }, "fileName": { "type": "string", "description": "Display name for the document (supports variable interpolation)" } }, "required": ["dataSourceId", "file", "fileName"] },
3386
3390
  outputSchema: { "description": "This step does not produce output data." }
@@ -4349,7 +4353,8 @@ var MindStudioAgent = class {
4349
4353
  ...options?.appId != null && { appId: options.appId },
4350
4354
  ...threadId != null && { threadId },
4351
4355
  ...this._currentStreamId != null && { streamId: this._currentStreamId },
4352
- ...this._requestSource != null && { requestSource: this._requestSource }
4356
+ ...this._requestSource != null && { requestSource: this._requestSource },
4357
+ ...assetStoreBody(options?.store)
4353
4358
  });
4354
4359
  const remaining = headers.get("x-ratelimit-remaining");
4355
4360
  const returnedThreadId = asyncData.threadId ?? "";
@@ -4433,7 +4438,8 @@ var MindStudioAgent = class {
4433
4438
  ...options.appId != null && { appId: options.appId },
4434
4439
  ...threadId != null && { threadId },
4435
4440
  ...this._currentStreamId != null && { streamId: this._currentStreamId },
4436
- ...this._requestSource != null && { requestSource: this._requestSource }
4441
+ ...this._requestSource != null && { requestSource: this._requestSource },
4442
+ ...assetStoreBody(options.store)
4437
4443
  };
4438
4444
  await this._httpConfig.rateLimiter.acquire();
4439
4445
  let res;
@@ -4620,7 +4626,8 @@ var MindStudioAgent = class {
4620
4626
  })),
4621
4627
  ...options?.appId != null && { appId: options.appId },
4622
4628
  ...threadId != null && { threadId },
4623
- ...this._requestSource != null && { requestSource: this._requestSource }
4629
+ ...this._requestSource != null && { requestSource: this._requestSource },
4630
+ ...assetStoreBody(options?.store)
4624
4631
  });
4625
4632
  const pollUrl = `${this._currentHttpConfig.baseUrl}/developer/v2/steps/execute-batch-async/poll/${asyncData.batchToken}`;
4626
4633
  let pollDelay = 300;
@@ -5651,6 +5658,9 @@ function sleep3(ms) {
5651
5658
  return new Promise((resolve) => setTimeout(resolve, ms));
5652
5659
  }
5653
5660
  applyStepMethods(MindStudioAgent);
5661
+ function assetStoreBody(store) {
5662
+ return store ? { assetStore: { store: store.name, access: store.access } } : {};
5663
+ }
5654
5664
  function resolveStepType2(name) {
5655
5665
  const meta = stepMetadata[name];
5656
5666
  return meta ? meta.stepType : name;