@mindstudio-ai/agent 0.1.6 → 0.1.9

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,32 +1,3 @@
1
- type AuthType = 'internal' | 'apiKey';
2
- declare class RateLimiter {
3
- readonly authType: AuthType;
4
- private inflight;
5
- private concurrencyLimit;
6
- private callCount;
7
- private callCap;
8
- private queue;
9
- constructor(authType: AuthType);
10
- /** Acquire a slot. Resolves when a concurrent slot is available. */
11
- acquire(): Promise<void>;
12
- /** Release a slot and let the next queued request proceed. */
13
- release(): void;
14
- /** Update limits from response headers. */
15
- updateFromHeaders(headers: Headers): void;
16
- /** Read current rate limit state from response headers. */
17
- static parseHeaders(headers: Headers): {
18
- remaining: number | undefined;
19
- concurrencyRemaining: number | undefined;
20
- };
21
- }
22
-
23
- interface HttpClientConfig {
24
- baseUrl: string;
25
- token: string;
26
- rateLimiter: RateLimiter;
27
- maxRetries: number;
28
- }
29
-
30
1
  /** Configuration options for creating a {@link MindStudioAgent}. */
31
2
  interface AgentOptions {
32
3
  /**
@@ -53,6 +24,18 @@ interface AgentOptions {
53
24
  * @default 3
54
25
  */
55
26
  maxRetries?: number;
27
+ /**
28
+ * App ID for auth and database context. Required when using `auth` or
29
+ * `db` namespaces outside the MindStudio sandbox.
30
+ *
31
+ * If omitted, the SDK checks:
32
+ * 1. `MINDSTUDIO_APP_ID` environment variable
33
+ * 2. Sandbox globals (when running inside MindStudio)
34
+ * 3. Auto-detected from the first `executeStep` response header
35
+ *
36
+ * Not needed for plain step execution — only for `db` and `auth`.
37
+ */
38
+ appId?: string;
56
39
  /**
57
40
  * When true, the thread ID from the first API response is automatically
58
41
  * reused for all subsequent calls (unless an explicit `threadId` is passed).
@@ -152,6 +135,44 @@ interface UserInfoResult {
152
135
  isAgent: boolean;
153
136
  }[];
154
137
  }
138
+ /**
139
+ * A reference to a MindStudio platform user. Stored as a UUID string.
140
+ *
141
+ * In the database, user values are stored with a `@@user@@` prefix
142
+ * (e.g. `@@user@@550e8400-...`). The SDK handles this automatically —
143
+ * values are clean UUIDs in application code, prefixed/stripped
144
+ * transparently during read/write operations.
145
+ *
146
+ * Use `resolveUser(userId)` when you need display info (name, email, etc.).
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * interface Order {
151
+ * id: string;
152
+ * createdAt: number;
153
+ * updatedAt: number;
154
+ * lastUpdatedBy: string;
155
+ * requestedBy: User;
156
+ * }
157
+ * ```
158
+ */
159
+ type User = string & {
160
+ readonly __brand: 'User';
161
+ };
162
+ /**
163
+ * Resolved display info for a platform user. Returned by `resolveUser()`
164
+ * and `resolveUsers()`.
165
+ */
166
+ interface ResolvedUser {
167
+ /** User ID. */
168
+ id: string;
169
+ /** Display name. */
170
+ name: string;
171
+ /** Email address, if available. */
172
+ email?: string | null;
173
+ /** Profile picture URL, if set. */
174
+ profilePictureUrl?: string | null;
175
+ }
155
176
  /** An AI model available on MindStudio. */
156
177
  interface MindStudioModel {
157
178
  id?: string;
@@ -176,6 +197,40 @@ interface MindStudioModelSummary {
176
197
  }
177
198
  /** Supported model type categories for filtering. */
178
199
  type ModelType = 'llm_chat' | 'image_generation' | 'video_generation' | 'video_analysis' | 'text_to_speech' | 'vision' | 'transcription';
200
+ /** Role assignment for a user within an app. */
201
+ interface AppRoleAssignment {
202
+ userId: string;
203
+ roleName: string;
204
+ }
205
+ /** Auth context for an app. */
206
+ interface AppAuthContext {
207
+ /** The authenticated user ID. */
208
+ userId: string;
209
+ /** All role assignments for this app (all users, all roles). */
210
+ roleAssignments: AppRoleAssignment[];
211
+ }
212
+ /** Column schema for a managed database table. */
213
+ interface AppDatabaseColumnSchema {
214
+ name: string;
215
+ type: 'text' | 'number' | 'boolean' | 'json' | 'user';
216
+ required: boolean;
217
+ }
218
+ /** Table schema within a managed database. */
219
+ interface AppDatabaseTable {
220
+ name: string;
221
+ schema: AppDatabaseColumnSchema[];
222
+ }
223
+ /** A managed SQLite database for an app. */
224
+ interface AppDatabase {
225
+ id: string;
226
+ name: string;
227
+ tables: AppDatabaseTable[];
228
+ }
229
+ /** Result of {@link MindStudioAgent.getAppContext}. */
230
+ interface AppContextResult {
231
+ auth: AppAuthContext;
232
+ databases: AppDatabase[];
233
+ }
179
234
  /** An OAuth connector service with its available actions. Third-party integration from the MindStudio Connector Registry. */
180
235
  interface ConnectorService {
181
236
  id?: string;
@@ -292,29 +347,816 @@ interface ExecuteStepBatchOptions {
292
347
  /** Thread ID for state persistence. If omitted, an ephemeral thread is created. */
293
348
  threadId?: string;
294
349
  }
295
- /** Result of {@link MindStudioAgent.executeStepBatch}. */
296
- interface ExecuteStepBatchResult {
297
- /** Results in the same order as the input steps. */
298
- results: BatchStepResult[];
299
- /** Sum of billingCost across all successful steps. */
300
- totalBillingCost?: number;
301
- /** The app ID used for execution. */
302
- appId?: string;
303
- /** The thread ID used for execution. */
304
- threadId?: string;
350
+ /** Result of {@link MindStudioAgent.executeStepBatch}. */
351
+ interface ExecuteStepBatchResult {
352
+ /** Results in the same order as the input steps. */
353
+ results: BatchStepResult[];
354
+ /** Sum of billingCost across all successful steps. */
355
+ totalBillingCost?: number;
356
+ /** The app ID used for execution. */
357
+ appId?: string;
358
+ /** The thread ID used for execution. */
359
+ threadId?: string;
360
+ }
361
+ /** Result of a successful agent run. */
362
+ interface RunAgentResult {
363
+ /** Whether the run succeeded. */
364
+ success: boolean;
365
+ /** Thread ID for the run. */
366
+ threadId: string;
367
+ /** The result content (last system message). */
368
+ result: string;
369
+ /** Thread messages, if returned. */
370
+ thread?: unknown;
371
+ /** Cost in credits, if `includeBillingCost` was set. */
372
+ billingCost?: number;
373
+ }
374
+
375
+ type AuthType = 'internal' | 'apiKey';
376
+ declare class RateLimiter {
377
+ readonly authType: AuthType;
378
+ private inflight;
379
+ private concurrencyLimit;
380
+ private callCount;
381
+ private callCap;
382
+ private queue;
383
+ constructor(authType: AuthType);
384
+ /** Acquire a slot. Resolves when a concurrent slot is available. */
385
+ acquire(): Promise<void>;
386
+ /** Release a slot and let the next queued request proceed. */
387
+ release(): void;
388
+ /** Update limits from response headers. */
389
+ updateFromHeaders(headers: Headers): void;
390
+ /** Read current rate limit state from response headers. */
391
+ static parseHeaders(headers: Headers): {
392
+ remaining: number | undefined;
393
+ concurrencyRemaining: number | undefined;
394
+ };
395
+ }
396
+
397
+ interface HttpClientConfig {
398
+ baseUrl: string;
399
+ token: string;
400
+ rateLimiter: RateLimiter;
401
+ maxRetries: number;
402
+ }
403
+
404
+ /**
405
+ * Auth namespace — role-based access control for MindStudio apps.
406
+ *
407
+ * Provides synchronous access to the current user's identity and roles
408
+ * within an app. Hydrated once from app context (either sandbox globals
409
+ * or the `GET /helpers/app-context` endpoint), then all access is sync.
410
+ *
411
+ * ## How it works
412
+ *
413
+ * 1. The platform stores role assignments per app: `{ userId, roleName }[]`
414
+ * 2. On context hydration, the full role map is loaded into memory
415
+ * 3. `auth.hasRole()` / `auth.requireRole()` are simple array lookups
416
+ * 4. `auth.getUsersByRole()` scans the preloaded assignments
417
+ *
418
+ * ## Usage
419
+ *
420
+ * ```ts
421
+ * import { auth, Roles } from '@mindstudio-ai/agent';
422
+ *
423
+ * // Check permissions
424
+ * if (auth.hasRole(Roles.admin, Roles.approver)) {
425
+ * // user has at least one of these roles
426
+ * }
427
+ *
428
+ * // Gate a route — throws 403 if user lacks the role
429
+ * auth.requireRole(Roles.admin);
430
+ *
431
+ * // Look up who has a role
432
+ * const admins = auth.getUsersByRole(Roles.admin);
433
+ * ```
434
+ *
435
+ * ## Roles proxy
436
+ *
437
+ * `Roles` is a convenience proxy: `Roles.admin` === `"admin"`. It provides
438
+ * discoverability and typo prevention. In the future, the compilation
439
+ * pipeline will generate a typed `Roles` object from `app.json`, giving
440
+ * compile-time safety. For now, any string property access works.
441
+ */
442
+
443
+ /**
444
+ * Auth context for the current execution. Created from the app's role
445
+ * assignments and the current user's identity.
446
+ *
447
+ * All methods are synchronous — the full role map is preloaded at
448
+ * context hydration time.
449
+ */
450
+ declare class AuthContext {
451
+ /** The current user's ID. */
452
+ readonly userId: string;
453
+ /** The current user's roles in this app. */
454
+ readonly roles: readonly string[];
455
+ /** All role assignments for this app (all users, all roles). */
456
+ private readonly _roleAssignments;
457
+ constructor(ctx: AppAuthContext);
458
+ /**
459
+ * Check if the current user has **any** of the given roles.
460
+ * Returns true if at least one matches.
461
+ *
462
+ * @example
463
+ * ```ts
464
+ * if (auth.hasRole(Roles.admin, Roles.approver)) {
465
+ * // user is an admin OR an approver
466
+ * }
467
+ * ```
468
+ */
469
+ hasRole(...roles: string[]): boolean;
470
+ /**
471
+ * Require the current user to have at least one of the given roles.
472
+ * Throws a `MindStudioError` with code `'forbidden'` and status 403
473
+ * if the user lacks all of the specified roles.
474
+ *
475
+ * Use this at the top of route handlers to gate access.
476
+ *
477
+ * @example
478
+ * ```ts
479
+ * auth.requireRole(Roles.admin);
480
+ * // code below only runs if user is an admin
481
+ * ```
482
+ */
483
+ requireRole(...roles: string[]): void;
484
+ /**
485
+ * Get all user IDs that have the given role in this app.
486
+ * Synchronous — scans the preloaded role assignments.
487
+ *
488
+ * @example
489
+ * ```ts
490
+ * const reviewers = auth.getUsersByRole(Roles.reviewer);
491
+ * // ['user-id-1', 'user-id-2', ...]
492
+ * ```
493
+ */
494
+ getUsersByRole(role: string): string[];
495
+ }
496
+ /**
497
+ * Convenience proxy for referencing role names. Any property access
498
+ * returns the property name as a string: `Roles.admin === "admin"`.
499
+ *
500
+ * This provides:
501
+ * - Discoverability via autocomplete (in typed environments)
502
+ * - Typo prevention (vs raw string literals)
503
+ * - Forward compatibility with the future typed Roles generation
504
+ *
505
+ * In the future, the compilation pipeline will generate a typed `Roles`
506
+ * object from `app.json` roles, replacing this proxy with compile-time
507
+ * checked constants.
508
+ *
509
+ * @example
510
+ * ```ts
511
+ * Roles.admin // "admin"
512
+ * Roles.approver // "approver"
513
+ * Roles.anything // "anything" (no runtime error, any string works)
514
+ * ```
515
+ */
516
+ declare const Roles: Record<string, string>;
517
+
518
+ /**
519
+ * Internal type definitions for the `db` namespace.
520
+ *
521
+ * These types power the chainable collection API over MindStudio's managed
522
+ * SQLite databases. They're used internally by Table, Query, and the
523
+ * predicate compiler — most are also re-exported from the package for
524
+ * consumers who need them in type annotations.
525
+ *
526
+ * Key concepts:
527
+ * - **SystemFields**: columns managed by the platform (id, timestamps, audit).
528
+ * Stripped from write inputs automatically.
529
+ * - **Predicate / Accessor**: callback shapes used in filter(), sortBy(), etc.
530
+ * Predicates are compiled to SQL WHERE clauses when possible, with a JS
531
+ * fallback for complex expressions.
532
+ * - **TableConfig**: runtime binding between a Table instance and the
533
+ * underlying queryAppDatabase step execution.
534
+ */
535
+
536
+ /**
537
+ * Names of columns that the platform manages automatically.
538
+ *
539
+ * - `id`: UUID primary key, generated on INSERT
540
+ * - `createdAt`: unix timestamp (ms), set on INSERT
541
+ * - `updatedAt`: unix timestamp (ms), set on INSERT and every UPDATE
542
+ * - `lastUpdatedBy`: reference to the run ID that last wrote this row
543
+ */
544
+ type SystemFields = 'id' | 'createdAt' | 'updatedAt' | 'lastUpdatedBy';
545
+ /**
546
+ * Input type for `Table.push()`. Excludes system-managed fields.
547
+ * Optional fields in T remain optional.
548
+ *
549
+ * @example
550
+ * ```ts
551
+ * // If Order has { id, createdAt, updatedAt, lastUpdatedBy, item, amount }
552
+ * // then PushInput<Order> is { item: string; amount: number }
553
+ * ```
554
+ */
555
+ type PushInput<T> = Omit<T, SystemFields>;
556
+ /**
557
+ * Input type for `Table.update()`. Excludes system-managed fields,
558
+ * and all remaining fields are optional (partial update).
559
+ */
560
+ type UpdateInput<T> = Partial<Omit<T, SystemFields>>;
561
+ /**
562
+ * A predicate function for filtering rows. Receives a typed row and
563
+ * returns a boolean.
564
+ *
565
+ * The SDK attempts to compile the predicate to a SQL WHERE clause for
566
+ * performance. Simple expressions (field comparisons, &&/||, .includes())
567
+ * compile to efficient SQL. If the predicate can't be compiled (function
568
+ * calls, regex, computed expressions), the SDK falls back to fetching all
569
+ * rows and evaluating in JS. Both paths produce identical results.
570
+ */
571
+ type Predicate<T> = (row: T) => boolean;
572
+ /**
573
+ * A field accessor function used by sortBy(), min(), max(), groupBy().
574
+ * Receives a typed row and returns the value to sort/aggregate by.
575
+ *
576
+ * @example
577
+ * ```ts
578
+ * .sortBy(o => o.createdAt) // sort by createdAt
579
+ * .min(o => o.amount) // row with smallest amount
580
+ * .groupBy(o => o.status) // group rows by status
581
+ * ```
582
+ */
583
+ type Accessor<T, R = unknown> = (row: T) => R;
584
+ /**
585
+ * Runtime configuration for a Table instance. Created by `createDb()` when
586
+ * `defineTable()` is called. Contains everything the Table needs to execute
587
+ * queries against the correct database.
588
+ */
589
+ interface TableConfig {
590
+ /** The managed database ID (from app context metadata). */
591
+ databaseId: string;
592
+ /** The SQL table name (as declared in defineTable). */
593
+ tableName: string;
594
+ /**
595
+ * Column schema from app context. Used to identify user-type columns
596
+ * (which need @@user@@ prefix handling) and for validation.
597
+ */
598
+ columns: AppDatabaseColumnSchema[];
599
+ /**
600
+ * Execute a SQL query against the managed database. This is bound to
601
+ * `agent.executeStep('queryAppDatabase', ...)` at creation time.
602
+ *
603
+ * @param sql - The SQL query string (fully formed, no placeholders)
604
+ * @returns The query result: rows for SELECT, changes count for writes
605
+ */
606
+ executeQuery: (sql: string) => Promise<{
607
+ rows: unknown[];
608
+ changes: number;
609
+ }>;
610
+ }
611
+
612
+ /**
613
+ * Query chain builder — lazy, immutable query construction for database reads.
614
+ *
615
+ * A Query<T> represents a pending database query. It accumulates operations
616
+ * (filter, sort, limit, skip) without executing anything. Execution happens
617
+ * only when the query is awaited (via PromiseLike) or a terminal method
618
+ * is called (first, last, count, some, every, min, max, groupBy).
619
+ *
620
+ * ## Immutability
621
+ *
622
+ * Every chain method returns a NEW Query instance. This means chains can
623
+ * safely fork:
624
+ *
625
+ * ```ts
626
+ * const base = Orders.filter(o => o.status === 'active');
627
+ * const recent = base.sortBy(o => o.createdAt).reverse().take(10);
628
+ * const count = await base.count(); // doesn't affect `recent`
629
+ * ```
630
+ *
631
+ * ## Execution strategy (SQL fast path vs JS fallback)
632
+ *
633
+ * When a Query is executed, it attempts to compile all predicates to SQL:
634
+ *
635
+ * - **Fast path**: All predicates compile → single SQL query with WHERE,
636
+ * ORDER BY, LIMIT, OFFSET. Efficient, minimal data transfer.
637
+ *
638
+ * - **Fallback path**: Any predicate fails to compile → fetch ALL rows
639
+ * from the table (SELECT *), then apply the entire chain as native JS
640
+ * array operations (Array.filter, Array.sort, Array.slice, etc.).
641
+ * A warning is logged so developers can optimize if needed.
642
+ *
643
+ * Both paths produce identical results. The SQL path is a transparent
644
+ * performance optimization.
645
+ *
646
+ * ## Data flow
647
+ *
648
+ * ```
649
+ * .filter(pred1).filter(pred2).sortBy(fn).reverse().take(10)
650
+ * ↓
651
+ * Query { predicates: [pred1, pred2], sortAccessor: fn, reversed: true, limit: 10 }
652
+ * ↓ (on await)
653
+ * compilePredicate(pred1) → SQL? compilePredicate(pred2) → SQL?
654
+ * ↓
655
+ * All SQL? → buildSelect('table', { where: 'p1 AND p2', orderBy, desc, limit })
656
+ * → executeQuery(sql) → deserialize rows → return T[]
657
+ *
658
+ * Any JS? → buildSelect('table', {}) → executeQuery → deserialize all rows
659
+ * → Array.filter(pred1).filter(pred2).sort(...).slice(0, 10) → return T[]
660
+ * ```
661
+ */
662
+
663
+ /**
664
+ * A lazy, chainable database query. Implements PromiseLike<T[]> so it
665
+ * can be awaited directly to get the result rows.
666
+ *
667
+ * @example
668
+ * ```ts
669
+ * // Chain operations (nothing executes yet)
670
+ * const query = Orders
671
+ * .filter(o => o.status === 'active')
672
+ * .sortBy(o => o.createdAt)
673
+ * .reverse()
674
+ * .take(10);
675
+ *
676
+ * // Execute the query by awaiting it
677
+ * const rows = await query;
678
+ * ```
679
+ */
680
+ declare class Query<T> implements PromiseLike<T[]> {
681
+ /** @internal Accumulated predicate functions to filter by. */
682
+ private readonly _predicates;
683
+ /** @internal The field accessor for sorting, if set. */
684
+ private readonly _sortAccessor;
685
+ /** @internal Whether the sort order is reversed (DESC). */
686
+ private readonly _reversed;
687
+ /** @internal Maximum number of results (SQL LIMIT). */
688
+ private readonly _limit;
689
+ /** @internal Number of results to skip (SQL OFFSET). */
690
+ private readonly _offset;
691
+ /** @internal Binding to the database execution layer. */
692
+ private readonly _config;
693
+ constructor(config: TableConfig, options?: {
694
+ predicates?: Predicate<T>[];
695
+ sortAccessor?: Accessor<T>;
696
+ reversed?: boolean;
697
+ limit?: number;
698
+ offset?: number;
699
+ });
700
+ /**
701
+ * Create a clone of this query with some options overridden.
702
+ * Used internally by chain methods to maintain immutability.
703
+ */
704
+ private _clone;
705
+ /**
706
+ * Add a filter predicate. Multiple filters are ANDed together.
707
+ *
708
+ * @example
709
+ * ```ts
710
+ * const active = Orders.filter(o => o.status === 'active');
711
+ * const expensive = active.filter(o => o.amount > 5000);
712
+ * // WHERE status = 'active' AND amount > 5000
713
+ * ```
714
+ */
715
+ filter(predicate: Predicate<T>): Query<T>;
716
+ /**
717
+ * Sort results by a field (ascending by default).
718
+ * Use `.reverse()` after `.sortBy()` for descending order.
719
+ *
720
+ * @example
721
+ * ```ts
722
+ * const newest = Orders.sortBy(o => o.createdAt).reverse();
723
+ * ```
724
+ */
725
+ sortBy(accessor: Accessor<T>): Query<T>;
726
+ /**
727
+ * Reverse the current sort order. If no sort is set, this has no effect.
728
+ */
729
+ reverse(): Query<T>;
730
+ /**
731
+ * Limit the number of results returned.
732
+ *
733
+ * @example
734
+ * ```ts
735
+ * const top10 = Orders.sortBy(o => o.amount).reverse().take(10);
736
+ * ```
737
+ */
738
+ take(n: number): Query<T>;
739
+ /**
740
+ * Skip the first n results. Use with `.take()` for pagination.
741
+ *
742
+ * @example
743
+ * ```ts
744
+ * const page2 = Orders.sortBy(o => o.createdAt).skip(50).take(50);
745
+ * ```
746
+ */
747
+ skip(n: number): Query<T>;
748
+ /**
749
+ * Return the first matching row, or null if no rows match.
750
+ * Applies the current sort order before taking the first result.
751
+ */
752
+ first(): Promise<T | null>;
753
+ /**
754
+ * Return the last matching row (per current sort), or null.
755
+ * Flips the sort direction and takes 1 row.
756
+ */
757
+ last(): Promise<T | null>;
758
+ /**
759
+ * Count matching rows. Returns a number, not the rows themselves.
760
+ * Executes as `SELECT COUNT(*)` when predicates compile to SQL.
761
+ */
762
+ count(): Promise<number>;
763
+ /**
764
+ * Check if any row matches the current filters. Short-circuits —
765
+ * doesn't load all rows when using SQL.
766
+ */
767
+ some(): Promise<boolean>;
768
+ /**
769
+ * Check if all rows match the current filters. Short-circuits on false.
770
+ *
771
+ * Implemented as NOT EXISTS(... WHERE NOT predicate) — returns true
772
+ * if no rows fail the predicate.
773
+ */
774
+ every(): Promise<boolean>;
775
+ /**
776
+ * Return the row with the minimum value for the given field.
777
+ * Executes as `ORDER BY field ASC LIMIT 1` in SQL.
778
+ */
779
+ min(accessor: Accessor<T, number>): Promise<T | null>;
780
+ /**
781
+ * Return the row with the maximum value for the given field.
782
+ * Executes as `ORDER BY field DESC LIMIT 1` in SQL.
783
+ */
784
+ max(accessor: Accessor<T, number>): Promise<T | null>;
785
+ /**
786
+ * Group rows by a field value. Returns a Map.
787
+ * Always executes in JS (no SQL equivalent for grouping into a Map).
788
+ */
789
+ groupBy<K extends string | number>(accessor: Accessor<T, K>): Promise<Map<K, T[]>>;
790
+ /**
791
+ * PromiseLike.then() — executes the query and pipes the result.
792
+ * This is what makes `const rows = await query` work.
793
+ */
794
+ then<TResult1 = T[], TResult2 = never>(onfulfilled?: ((value: T[]) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
795
+ /**
796
+ * Execute the query and return typed result rows.
797
+ *
798
+ * This is the core execution method. It:
799
+ * 1. Tries to compile all predicates to SQL
800
+ * 2. If all compile → builds and executes a single SQL query
801
+ * 3. If any fail → fetches all rows and processes in JS
802
+ * 4. Deserializes rows (user prefix stripping, JSON parsing)
803
+ */
804
+ private _execute;
805
+ /**
806
+ * Compile all accumulated predicates and determine the execution strategy.
807
+ *
808
+ * Returns an object with:
809
+ * - `allSql`: whether all predicates compiled to SQL
810
+ * - `sqlWhere`: combined WHERE clause (ANDed) if all compiled
811
+ * - `compiled`: individual compilation results
812
+ */
813
+ private _compilePredicates;
814
+ /**
815
+ * Fetch all rows from the table and apply JS predicates.
816
+ * This is the fallback path when SQL compilation fails.
817
+ *
818
+ * Logs a warning to stderr so developers know they're on the slow path.
819
+ */
820
+ private _fetchAndFilterInJs;
821
+ /**
822
+ * Fetch all rows from the table (SELECT * with no WHERE).
823
+ * Used by the JS fallback path.
824
+ */
825
+ private _fetchAllRows;
826
+ }
827
+
828
+ /**
829
+ * Table<T> — a typed persistent collection backed by SQLite.
830
+ *
831
+ * Created via `db.defineTable<T>(name)`. The returned object is the full
832
+ * API for interacting with that table. Every method either returns a
833
+ * chainable Query<T> (for lazy reads) or a Promise (for terminal reads
834
+ * and writes).
835
+ *
836
+ * ## Read vs Write operations
837
+ *
838
+ * **Reads** come in two flavors:
839
+ * - **Direct reads**: `get(id)`, `findOne()`, `count()`, `some()`, `every()`,
840
+ * `isEmpty()`, `min()`, `max()`, `groupBy()` — return Promises directly.
841
+ * - **Chainable reads**: `filter()`, `sortBy()` — return a Query<T> that
842
+ * accumulates operations lazily. The query executes when awaited.
843
+ *
844
+ * **Writes** are always immediate (return Promises):
845
+ * - `push()` — INSERT + SELECT to return the created row with system fields
846
+ * - `update()` — UPDATE + SELECT to return the updated row
847
+ * - `remove()` — DELETE by ID
848
+ * - `removeAll()` — DELETE with compiled WHERE clause
849
+ * - `clear()` — DELETE all rows
850
+ *
851
+ * ## System columns
852
+ *
853
+ * Every row has platform-managed columns: `id`, `createdAt`, `updatedAt`,
854
+ * `lastUpdatedBy`. These are:
855
+ * - Included in read results (populated by the platform)
856
+ * - Excluded from `push()` and `update()` inputs (TypeScript enforces this
857
+ * via PushInput<T> and UpdateInput<T>; runtime also strips them)
858
+ *
859
+ * ## User type handling
860
+ *
861
+ * Columns with schema type `'user'` store values with a `@@user@@` prefix
862
+ * in SQLite. This is handled transparently:
863
+ * - On read: prefix is stripped, application code gets clean UUID strings
864
+ * - On write: prefix is added before sending to the database
865
+ */
866
+
867
+ declare class Table<T> {
868
+ /** @internal Runtime config binding this table to the execution layer. */
869
+ private readonly _config;
870
+ constructor(config: TableConfig);
871
+ /**
872
+ * Get a single row by ID. Returns null if not found.
873
+ *
874
+ * @example
875
+ * ```ts
876
+ * const order = await Orders.get('abc-123');
877
+ * if (order) console.log(order.status);
878
+ * ```
879
+ */
880
+ get(id: string): Promise<T | null>;
881
+ /**
882
+ * Find the first row matching a predicate. Returns null if none match.
883
+ *
884
+ * @example
885
+ * ```ts
886
+ * const activeOrder = await Orders.findOne(o => o.status === 'active');
887
+ * ```
888
+ */
889
+ findOne(predicate: Predicate<T>): Promise<T | null>;
890
+ /**
891
+ * Count rows, optionally filtered by a predicate.
892
+ *
893
+ * @example
894
+ * ```ts
895
+ * const total = await Orders.count();
896
+ * const pending = await Orders.count(o => o.status === 'pending');
897
+ * ```
898
+ */
899
+ count(predicate?: Predicate<T>): Promise<number>;
900
+ /**
901
+ * Check if any row matches a predicate. Short-circuits.
902
+ *
903
+ * @example
904
+ * ```ts
905
+ * const hasActive = await Orders.some(o => o.status === 'active');
906
+ * ```
907
+ */
908
+ some(predicate: Predicate<T>): Promise<boolean>;
909
+ /**
910
+ * Check if all rows match a predicate.
911
+ *
912
+ * @example
913
+ * ```ts
914
+ * const allComplete = await Orders.every(o => o.status === 'completed');
915
+ * ```
916
+ */
917
+ every(predicate: Predicate<T>): Promise<boolean>;
918
+ /**
919
+ * Check if the table has zero rows.
920
+ *
921
+ * @example
922
+ * ```ts
923
+ * if (await Orders.isEmpty()) console.log('No orders yet');
924
+ * ```
925
+ */
926
+ isEmpty(): Promise<boolean>;
927
+ /**
928
+ * Return the row with the minimum value for a field.
929
+ * Executes as `ORDER BY field ASC LIMIT 1`.
930
+ *
931
+ * @example
932
+ * ```ts
933
+ * const cheapest = await Orders.min(o => o.amount);
934
+ * ```
935
+ */
936
+ min(accessor: Accessor<T, number>): Promise<T | null>;
937
+ /**
938
+ * Return the row with the maximum value for a field.
939
+ * Executes as `ORDER BY field DESC LIMIT 1`.
940
+ *
941
+ * @example
942
+ * ```ts
943
+ * const mostExpensive = await Orders.max(o => o.amount);
944
+ * ```
945
+ */
946
+ max(accessor: Accessor<T, number>): Promise<T | null>;
947
+ /**
948
+ * Group all rows by a field value. Returns a Map.
949
+ *
950
+ * @example
951
+ * ```ts
952
+ * const byStatus = await Orders.groupBy(o => o.status);
953
+ * // Map { 'pending' => [...], 'approved' => [...] }
954
+ * ```
955
+ */
956
+ groupBy<K extends string | number>(accessor: Accessor<T, K>): Promise<Map<K, T[]>>;
957
+ /**
958
+ * Filter rows by a predicate. Returns a chainable Query.
959
+ *
960
+ * The predicate is compiled to SQL when possible. If compilation fails,
961
+ * the query falls back to fetching all rows and filtering in JS.
962
+ *
963
+ * @example
964
+ * ```ts
965
+ * const active = await Orders.filter(o => o.status === 'active');
966
+ * const recentActive = await Orders
967
+ * .filter(o => o.status === 'active')
968
+ * .sortBy(o => o.createdAt)
969
+ * .reverse()
970
+ * .take(10);
971
+ * ```
972
+ */
973
+ filter(predicate: Predicate<T>): Query<T>;
974
+ /**
975
+ * Sort all rows by a field. Returns a chainable Query.
976
+ *
977
+ * @example
978
+ * ```ts
979
+ * const newest = await Orders.sortBy(o => o.createdAt).reverse().take(5);
980
+ * ```
981
+ */
982
+ sortBy(accessor: Accessor<T>): Query<T>;
983
+ /**
984
+ * Insert one or more rows. Returns the created row(s) with system fields
985
+ * populated (id, createdAt, updatedAt, lastUpdatedBy).
986
+ *
987
+ * System columns are stripped from the input automatically — you don't
988
+ * need to (and can't) set id, createdAt, etc.
989
+ *
990
+ * @example
991
+ * ```ts
992
+ * // Single row
993
+ * const order = await Orders.push({ item: 'Laptop', amount: 999, status: 'pending' });
994
+ * console.log(order.id, order.createdAt); // system fields populated
995
+ *
996
+ * // Multiple rows
997
+ * const orders = await Orders.push([
998
+ * { item: 'Monitor', amount: 300, status: 'pending' },
999
+ * { item: 'Keyboard', amount: 50, status: 'pending' },
1000
+ * ]);
1001
+ * ```
1002
+ */
1003
+ push(data: PushInput<T>): Promise<T>;
1004
+ push(data: PushInput<T>[]): Promise<T[]>;
1005
+ /**
1006
+ * Update a row by ID. Only the provided fields are changed.
1007
+ * Returns the updated row.
1008
+ *
1009
+ * System columns cannot be updated — they're stripped automatically.
1010
+ * `updatedAt` and `lastUpdatedBy` are set by the platform.
1011
+ *
1012
+ * @example
1013
+ * ```ts
1014
+ * const updated = await Orders.update(order.id, { status: 'approved' });
1015
+ * console.log(updated.updatedAt); // freshly updated
1016
+ * ```
1017
+ */
1018
+ update(id: string, data: UpdateInput<T>): Promise<T>;
1019
+ /**
1020
+ * Remove a row by ID.
1021
+ *
1022
+ * @example
1023
+ * ```ts
1024
+ * await Orders.remove('abc-123');
1025
+ * ```
1026
+ */
1027
+ remove(id: string): Promise<void>;
1028
+ /**
1029
+ * Remove all rows matching a predicate. Returns the count removed.
1030
+ *
1031
+ * The predicate is compiled to SQL when possible. If compilation fails,
1032
+ * the function fetches all matching rows, collects their IDs, and
1033
+ * deletes them individually.
1034
+ *
1035
+ * @example
1036
+ * ```ts
1037
+ * const removed = await Orders.removeAll(o => o.status === 'rejected');
1038
+ * console.log(`Removed ${removed} orders`);
1039
+ * ```
1040
+ */
1041
+ removeAll(predicate: Predicate<T>): Promise<number>;
1042
+ /**
1043
+ * Remove all rows from the table.
1044
+ *
1045
+ * @example
1046
+ * ```ts
1047
+ * await Orders.clear();
1048
+ * ```
1049
+ */
1050
+ clear(): Promise<void>;
1051
+ }
1052
+
1053
+ /**
1054
+ * The `db` namespace — factory and time helpers for MindStudio managed databases.
1055
+ *
1056
+ * This module provides `createDb()`, which builds the `Db` object that users
1057
+ * interact with. The Db object has:
1058
+ *
1059
+ * - `defineTable<T>(name)` — creates a typed Table<T> for a given table name
1060
+ * - Time helpers: `now()`, `days()`, `hours()`, `minutes()`, `ago()`, `fromNow()`
1061
+ *
1062
+ * ## How defineTable works
1063
+ *
1064
+ * `defineTable` is a factory that binds a table name to the correct database
1065
+ * and execution context. It:
1066
+ *
1067
+ * 1. Looks up the table name in the app context database metadata
1068
+ * 2. Resolves the databaseId (implicit if only one database exists)
1069
+ * 3. Gets the column schema (for user-type handling and JSON parsing)
1070
+ * 4. Returns a Table<T> instance bound to the executeQuery function
1071
+ *
1072
+ * Tables are typically defined at module scope and imported into route handlers:
1073
+ *
1074
+ * ```ts
1075
+ * // tables/orders.ts
1076
+ * import { db } from '@mindstudio-ai/agent';
1077
+ * export const Orders = db.defineTable<Order>('orders');
1078
+ *
1079
+ * // routes/getOrders.ts
1080
+ * import { Orders } from '../tables/orders';
1081
+ * const active = await Orders.filter(o => o.status === 'active').take(10);
1082
+ * ```
1083
+ *
1084
+ * Since `defineTable()` is lazy (no queries execute until you await something
1085
+ * on the Table), it's safe to call at module scope. The actual database
1086
+ * context resolution happens on first query execution.
1087
+ *
1088
+ * ## Time helpers
1089
+ *
1090
+ * All timestamps in MindStudio databases are unix timestamps (milliseconds
1091
+ * since epoch). The time helpers make it easy to work with relative times
1092
+ * without writing `Date.now() - 48 * 60 * 60 * 1000` everywhere:
1093
+ *
1094
+ * ```ts
1095
+ * const cutoff = db.ago(db.days(2)); // 2 days ago (unix ms)
1096
+ * const deadline = db.fromNow(db.hours(48)); // 48 hours from now
1097
+ * const window = db.days(7) + db.hours(12); // composable durations
1098
+ * ```
1099
+ */
1100
+
1101
+ /**
1102
+ * Options for `db.defineTable()`.
1103
+ */
1104
+ interface DefineTableOptions {
1105
+ /**
1106
+ * Database name or ID to target. Required when the app has multiple
1107
+ * databases and the table name alone is ambiguous.
1108
+ *
1109
+ * Accepts either the database's display name or its ID. The SDK
1110
+ * matches against both.
1111
+ *
1112
+ * If omitted, the SDK resolves the database automatically:
1113
+ * - Single database → used implicitly
1114
+ * - Multiple databases → searched by table name
1115
+ */
1116
+ database?: string;
305
1117
  }
306
- /** Result of a successful agent run. */
307
- interface RunAgentResult {
308
- /** Whether the run succeeded. */
309
- success: boolean;
310
- /** Thread ID for the run. */
311
- threadId: string;
312
- /** The result content (last system message). */
313
- result: string;
314
- /** Thread messages, if returned. */
315
- thread?: unknown;
316
- /** Cost in credits, if `includeBillingCost` was set. */
317
- billingCost?: number;
1118
+
1119
+ /**
1120
+ * The `db` namespace object. Contains `defineTable()` for creating typed
1121
+ * collections and time helpers for working with unix timestamps.
1122
+ */
1123
+ interface Db {
1124
+ /**
1125
+ * Define a typed table. Returns a Table<T> bound to the app's managed
1126
+ * database. The table name must match a table in the app's database schema.
1127
+ *
1128
+ * Tables are lazy nothing executes until you call a method on the Table
1129
+ * and await the result. This makes it safe to call `defineTable()` at
1130
+ * module scope.
1131
+ *
1132
+ * Database resolution:
1133
+ * - If the app has a single database (common case), it's used automatically.
1134
+ * - If the app has multiple databases, pass `{ database }` with the
1135
+ * database name or ID to target the right one. If omitted, the SDK
1136
+ * searches all databases by table name.
1137
+ *
1138
+ * @example
1139
+ * ```ts
1140
+ * // Single database (common) — no need to specify
1141
+ * const Orders = db.defineTable<Order>('orders');
1142
+ *
1143
+ * // Multiple databases — specify which one
1144
+ * const Orders = db.defineTable<Order>('orders', { database: 'main' });
1145
+ * ```
1146
+ */
1147
+ defineTable<T>(name: string, options?: DefineTableOptions): Table<T>;
1148
+ /** Returns the current time as a unix timestamp (ms). Equivalent to `Date.now()`. */
1149
+ now(): number;
1150
+ /** Returns milliseconds for n days. Composable with `+`. */
1151
+ days(n: number): number;
1152
+ /** Returns milliseconds for n hours. Composable with `+`. */
1153
+ hours(n: number): number;
1154
+ /** Returns milliseconds for n minutes. Composable with `+`. */
1155
+ minutes(n: number): number;
1156
+ /** Returns a unix timestamp for (now - duration). Use with days/hours/minutes. */
1157
+ ago(ms: number): number;
1158
+ /** Returns a unix timestamp for (now + duration). Use with days/hours/minutes. */
1159
+ fromNow(ms: number): number;
318
1160
  }
319
1161
 
320
1162
  /**
@@ -353,6 +1195,29 @@ declare class MindStudioAgent$1 {
353
1195
  private _reuseThreadId;
354
1196
  /** @internal */
355
1197
  private _threadId;
1198
+ /**
1199
+ * @internal App ID for context resolution. Resolved from:
1200
+ * constructor appId → MINDSTUDIO_APP_ID env → sandbox globals →
1201
+ * auto-detected from first executeStep response header.
1202
+ */
1203
+ private _appId;
1204
+ /**
1205
+ * @internal Cached app context (auth + databases). Populated by
1206
+ * ensureContext() and cached for the lifetime of the instance.
1207
+ */
1208
+ private _context;
1209
+ /**
1210
+ * @internal Deduplication promise for ensureContext(). Ensures only one
1211
+ * context fetch is in-flight at a time, even if multiple db/auth
1212
+ * operations trigger it concurrently.
1213
+ */
1214
+ private _contextPromise;
1215
+ /** @internal Cached AuthContext instance, created during context hydration. */
1216
+ private _auth;
1217
+ /** @internal Cached Db namespace instance, created during context hydration. */
1218
+ private _db;
1219
+ /** @internal Auth type — 'internal' for CALLBACK_TOKEN (managed mode), 'apiKey' otherwise. */
1220
+ private _authType;
356
1221
  constructor(options?: AgentOptions);
357
1222
  /**
358
1223
  * Execute any step by its type name. This is the low-level method that all
@@ -462,6 +1327,167 @@ declare class MindStudioAgent$1 {
462
1327
  costType?: string;
463
1328
  estimates?: StepCostEstimateEntry[];
464
1329
  }>;
1330
+ /**
1331
+ * The `auth` namespace — synchronous role-based access control.
1332
+ *
1333
+ * Provides the current user's identity and roles. All methods are
1334
+ * synchronous since the role map is preloaded during context hydration.
1335
+ *
1336
+ * **Important**: Context must be hydrated before accessing `auth`.
1337
+ * - Inside the MindStudio sandbox: automatic (populated from globals)
1338
+ * - Outside the sandbox: call `await agent.ensureContext()` first,
1339
+ * or access `auth` after any `db` operation (which auto-hydrates)
1340
+ *
1341
+ * @throws {MindStudioError} if context has not been hydrated yet
1342
+ *
1343
+ * @example
1344
+ * ```ts
1345
+ * await agent.ensureContext();
1346
+ * agent.auth.requireRole(Roles.admin);
1347
+ * const admins = agent.auth.getUsersByRole(Roles.admin);
1348
+ * ```
1349
+ */
1350
+ get auth(): AuthContext;
1351
+ /**
1352
+ * The `db` namespace — chainable collection API over managed databases.
1353
+ *
1354
+ * Use `db.defineTable<T>(name)` to get a typed Table<T>, then call
1355
+ * collection methods (filter, sortBy, push, update, etc.) on it.
1356
+ *
1357
+ * Context is auto-hydrated on first query execution — you can safely
1358
+ * call `defineTable()` at module scope without triggering any HTTP.
1359
+ *
1360
+ * @example
1361
+ * ```ts
1362
+ * const Orders = agent.db.defineTable<Order>('orders');
1363
+ * const active = await Orders.filter(o => o.status === 'active').take(10);
1364
+ * ```
1365
+ */
1366
+ get db(): Db;
1367
+ /**
1368
+ * Hydrate the app context (auth + database metadata). This must be
1369
+ * called before using `auth` synchronously. For `db`, hydration happens
1370
+ * automatically on first query.
1371
+ *
1372
+ * Context is fetched once and cached for the instance's lifetime.
1373
+ * Calling `ensureContext()` multiple times is safe (no-op after first).
1374
+ *
1375
+ * Context sources (checked in order):
1376
+ * 1. Sandbox globals (`globalThis.ai.auth`, `globalThis.ai.databases`)
1377
+ * 2. HTTP: `GET /developer/v2/helpers/app-context?appId={appId}`
1378
+ *
1379
+ * @throws {MindStudioError} if no `appId` is available
1380
+ *
1381
+ * @example
1382
+ * ```ts
1383
+ * await agent.ensureContext();
1384
+ * // auth is now available synchronously
1385
+ * agent.auth.requireRole(Roles.admin);
1386
+ * ```
1387
+ */
1388
+ ensureContext(): Promise<void>;
1389
+ /**
1390
+ * @internal Fetch and cache app context, then create auth + db instances.
1391
+ *
1392
+ * In managed mode (CALLBACK_TOKEN), the platform resolves the app from
1393
+ * the token — no appId needed. With an API key, appId is required.
1394
+ */
1395
+ private _hydrateContext;
1396
+ /**
1397
+ * @internal Apply a resolved context object — creates AuthContext and Db.
1398
+ * Used by both the HTTP path and sandbox hydration.
1399
+ */
1400
+ private _applyContext;
1401
+ /**
1402
+ * @internal Try to hydrate context synchronously from sandbox globals.
1403
+ * Called in the constructor when CALLBACK_TOKEN auth is detected.
1404
+ *
1405
+ * The MindStudio sandbox pre-populates `globalThis.ai` with:
1406
+ * - `ai.auth`: { userId, roleAssignments[] }
1407
+ * - `ai.databases`: [{ id, name, tables[] }]
1408
+ */
1409
+ private _trySandboxHydration;
1410
+ /**
1411
+ * @internal Execute a SQL query against a managed database.
1412
+ * Used as the `executeQuery` callback for Table instances.
1413
+ *
1414
+ * Calls the `queryAppDatabase` step with `parameterize: false`
1415
+ * (the SDK builds fully-formed SQL with escaped inline values).
1416
+ */
1417
+ private _executeDbQuery;
1418
+ /**
1419
+ * @internal Create a lazy Db proxy that auto-hydrates context.
1420
+ *
1421
+ * defineTable() returns Table instances immediately (no async needed).
1422
+ * But the Table's executeQuery callback is wrapped to call ensureContext()
1423
+ * before the first query, so context is fetched lazily.
1424
+ */
1425
+ private _createLazyDb;
1426
+ /**
1427
+ * Resolve a single user ID to display info (name, email, profile picture).
1428
+ *
1429
+ * Use this when you have a `User`-typed field value and need the person's
1430
+ * display name, email, or avatar. Returns null if the user ID is not found.
1431
+ *
1432
+ * Also available as a top-level import:
1433
+ * ```ts
1434
+ * import { resolveUser } from '@mindstudio-ai/agent';
1435
+ * ```
1436
+ *
1437
+ * @param userId - The user ID to resolve (a `User` branded string or plain UUID)
1438
+ * @returns Resolved user info, or null if not found
1439
+ *
1440
+ * @example
1441
+ * ```ts
1442
+ * const user = await agent.resolveUser(order.requestedBy);
1443
+ * if (user) {
1444
+ * console.log(user.name); // "Jane Smith"
1445
+ * console.log(user.email); // "jane@example.com"
1446
+ * console.log(user.profilePictureUrl); // "https://..." or null
1447
+ * }
1448
+ * ```
1449
+ */
1450
+ resolveUser(userId: string): Promise<ResolvedUser | null>;
1451
+ /**
1452
+ * Resolve multiple user IDs to display info in a single request.
1453
+ * Maximum 100 user IDs per request.
1454
+ *
1455
+ * Use this for batch resolution when you have multiple user references
1456
+ * to display (e.g. all approvers on a purchase order, all team members).
1457
+ *
1458
+ * @param userIds - Array of user IDs to resolve (max 100)
1459
+ * @returns Object with `users` array of resolved user info
1460
+ *
1461
+ * @example
1462
+ * ```ts
1463
+ * // Resolve all approvers at once
1464
+ * const approverIds = approvals.map(a => a.assignedTo);
1465
+ * const { users } = await agent.resolveUsers(approverIds);
1466
+ *
1467
+ * for (const u of users) {
1468
+ * console.log(`${u.name} (${u.email})`);
1469
+ * }
1470
+ * ```
1471
+ */
1472
+ resolveUsers(userIds: string[]): Promise<{
1473
+ users: ResolvedUser[];
1474
+ }>;
1475
+ /**
1476
+ * Get auth and database context for an app.
1477
+ *
1478
+ * Returns role assignments and managed database schemas. Useful for
1479
+ * hydrating `auth` and `db` namespaces when running outside the sandbox.
1480
+ *
1481
+ * When called with a CALLBACK_TOKEN (managed mode), `appId` is optional —
1482
+ * the platform resolves the app from the token. With an API key, `appId`
1483
+ * is required.
1484
+ *
1485
+ * ```ts
1486
+ * const ctx = await agent.getAppContext('your-app-id');
1487
+ * console.log(ctx.auth.roleAssignments, ctx.databases);
1488
+ * ```
1489
+ */
1490
+ getAppContext(appId?: string): Promise<AppContextResult>;
465
1491
  /** Update the display name of the authenticated user/agent. */
466
1492
  changeName(displayName: string): Promise<void>;
467
1493
  /** Update the profile picture of the authenticated user/agent. */
@@ -538,8 +1564,8 @@ interface AddSubtitlesToVideoStepInput {
538
1564
  wordsPerSubtitle: number;
539
1565
  /** When true, enables bounce-style entrance animation for subtitles. Default: true. */
540
1566
  enableAnimation: boolean;
541
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
542
- skipAssetCreation?: boolean;
1567
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
1568
+ intermediateAsset?: boolean;
543
1569
  }
544
1570
  interface AddSubtitlesToVideoStepOutput {
545
1571
  /** URL of the video with subtitles added */
@@ -723,6 +1749,24 @@ interface CaptureThumbnailStepOutput {
723
1749
  /** URL of the captured thumbnail image */
724
1750
  thumbnailUrl: string;
725
1751
  }
1752
+ interface CheckAppRoleStepInput {
1753
+ /** The role name to check (supports {{variables}}) */
1754
+ roleName: string;
1755
+ /** Step to transition to if the user has the role (same workflow) */
1756
+ hasRoleStepId?: string;
1757
+ /** Workflow to jump to if the user has the role (cross workflow) */
1758
+ hasRoleWorkflowId?: string;
1759
+ /** Step to transition to if the user does not have the role (same workflow) */
1760
+ noRoleStepId?: string;
1761
+ /** Workflow to jump to if the user does not have the role (cross workflow) */
1762
+ noRoleWorkflowId?: string;
1763
+ }
1764
+ interface CheckAppRoleStepOutput {
1765
+ /** Whether the current user has the checked role */
1766
+ hasRole: boolean;
1767
+ /** All roles assigned to the current user for this app */
1768
+ userRoles: string[];
1769
+ }
726
1770
  interface CodaCreateUpdatePageStepInput {
727
1771
  /** Coda OAuth connection ID */
728
1772
  connectionId?: string;
@@ -1668,8 +2712,8 @@ interface GenerateChartStepOutput {
1668
2712
  interface GenerateImageStepInput {
1669
2713
  /** Text prompt describing the image to generate */
1670
2714
  prompt: string;
1671
- /** If true, the image will not appear in the user's asset history */
1672
- skipAssetCreation?: boolean;
2715
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
2716
+ intermediateAsset?: boolean;
1673
2717
  /** Optional model configuration override. Uses the workflow's default image model if not specified */
1674
2718
  imageModelOverride?: {
1675
2719
  /** Image generation model identifier */
@@ -1689,8 +2733,8 @@ interface GenerateImageStepOutput {
1689
2733
  imageUrl: string | string[];
1690
2734
  }
1691
2735
  interface GenerateLipsyncStepInput {
1692
- /** If true, the generated video will not appear in the user's asset history */
1693
- skipAssetCreation?: boolean;
2736
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
2737
+ intermediateAsset?: boolean;
1694
2738
  /** Whether to add a MindStudio watermark to the generated video */
1695
2739
  addWatermark?: boolean;
1696
2740
  /** Optional model configuration override. Uses the workflow's default lipsync model if not specified */
@@ -1703,8 +2747,8 @@ type GenerateLipsyncStepOutput = unknown;
1703
2747
  interface GenerateMusicStepInput {
1704
2748
  /** The instructions (prompt) for the music generation */
1705
2749
  text: string;
1706
- /** If true, the generated audio will not appear in the user's asset history */
1707
- skipAssetCreation?: boolean;
2750
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
2751
+ intermediateAsset?: boolean;
1708
2752
  /** Optional model configuration override. Uses the workflow's default music model if not specified */
1709
2753
  musicModelOverride?: {
1710
2754
  model: string;
@@ -1793,8 +2837,8 @@ interface GeneratePdfStepInput {
1793
2837
  shareControl?: "default" | "hidden";
1794
2838
  /** URL of a custom Open Graph share image */
1795
2839
  shareImageUrl?: string;
1796
- /** If true, the asset will not appear in the user's asset history */
1797
- skipAssetCreation?: boolean;
2840
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
2841
+ intermediateAsset?: boolean;
1798
2842
  }
1799
2843
  interface GeneratePdfStepOutput {
1800
2844
  /** CDN URL of the generated asset (PDF, PNG, HTML, or MP4 depending on outputFormat) */
@@ -1813,8 +2857,8 @@ interface GenerateStaticVideoFromImageStepOutput {
1813
2857
  interface GenerateVideoStepInput {
1814
2858
  /** Text prompt describing the video to generate */
1815
2859
  prompt: string;
1816
- /** If true, the video will not appear in the user's asset history */
1817
- skipAssetCreation?: boolean;
2860
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
2861
+ intermediateAsset?: boolean;
1818
2862
  /** Optional model configuration override. Uses the workflow's default video model if not specified */
1819
2863
  videoModelOverride?: {
1820
2864
  /** Video generation model identifier */
@@ -2307,8 +3351,8 @@ interface ImageRemoveWatermarkStepInput {
2307
3351
  imageUrl: string;
2308
3352
  /** Watermark removal engine to use */
2309
3353
  engine: string;
2310
- /** When true, the result will not appear in the user's asset history */
2311
- skipAssetCreation?: boolean;
3354
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
3355
+ intermediateAsset?: boolean;
2312
3356
  }
2313
3357
  interface ImageRemoveWatermarkStepOutput {
2314
3358
  /** CDN URL of the processed image with watermark removed (PNG) */
@@ -2330,8 +3374,8 @@ interface InsertVideoClipsStepInput {
2330
3374
  transitionDuration?: number;
2331
3375
  /** When true, uses audio from the overlay clips instead of the base video audio during inserts */
2332
3376
  useOverlayAudio?: boolean;
2333
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
2334
- skipAssetCreation?: boolean;
3377
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
3378
+ intermediateAsset?: boolean;
2335
3379
  }
2336
3380
  interface InsertVideoClipsStepOutput {
2337
3381
  /** URL of the video with clips inserted */
@@ -2522,8 +3566,8 @@ interface MergeAudioStepInput {
2522
3566
  fileMetadata?: Record<string, unknown>;
2523
3567
  /** URL of an image to embed as album art in the output file */
2524
3568
  albumArtUrl?: string;
2525
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
2526
- skipAssetCreation?: boolean;
3569
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
3570
+ intermediateAsset?: boolean;
2527
3571
  }
2528
3572
  interface MergeAudioStepOutput {
2529
3573
  /** URL of the merged audio file */
@@ -2536,8 +3580,8 @@ interface MergeVideosStepInput {
2536
3580
  transition?: string;
2537
3581
  /** Duration of the transition in seconds */
2538
3582
  transitionDuration?: number;
2539
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
2540
- skipAssetCreation?: boolean;
3583
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
3584
+ intermediateAsset?: boolean;
2541
3585
  }
2542
3586
  interface MergeVideosStepOutput {
2543
3587
  /** URL of the merged video */
@@ -2559,8 +3603,8 @@ interface MixAudioIntoVideoStepInput {
2559
3603
  /** When true, loops the audio track to match the video duration. Defaults to false. */
2560
3604
  loopAudio?: boolean;
2561
3605
  };
2562
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
2563
- skipAssetCreation?: boolean;
3606
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
3607
+ intermediateAsset?: boolean;
2564
3608
  }
2565
3609
  interface MixAudioIntoVideoStepOutput {
2566
3610
  /** URL of the video with the mixed audio track */
@@ -2569,8 +3613,8 @@ interface MixAudioIntoVideoStepOutput {
2569
3613
  interface MuteVideoStepInput {
2570
3614
  /** URL of the source video to mute */
2571
3615
  videoUrl: string;
2572
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
2573
- skipAssetCreation?: boolean;
3616
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
3617
+ intermediateAsset?: boolean;
2574
3618
  }
2575
3619
  interface MuteVideoStepOutput {
2576
3620
  /** URL of the muted video */
@@ -2678,14 +3722,18 @@ interface PostToLinkedInStepInput {
2678
3722
  message: string;
2679
3723
  /** Who can see the post: "PUBLIC" or "CONNECTIONS" */
2680
3724
  visibility: "PUBLIC" | "CONNECTIONS";
3725
+ /** URL of an image to attach to the post */
3726
+ imageUrl?: string;
2681
3727
  /** URL of a video to attach to the post */
2682
3728
  videoUrl?: string;
2683
- /** Description text for link/media attachments */
2684
- descriptionText?: string;
2685
- /** Title text for link/media attachments */
3729
+ /** URL of a document (PDF, PPT, DOC) to attach to the post */
3730
+ documentUrl?: string;
3731
+ /** URL to share as an article link preview */
3732
+ articleUrl?: string;
3733
+ /** Title text for media or article attachments */
2686
3734
  titleText?: string;
2687
- /** URL of an image to attach to the post */
2688
- imageUrl?: string;
3735
+ /** Description text for article attachments */
3736
+ descriptionText?: string;
2689
3737
  /** LinkedIn OAuth connection ID */
2690
3738
  connectionId?: string;
2691
3739
  }
@@ -2720,6 +3768,33 @@ interface PostToZapierStepOutput {
2720
3768
  /** Parsed webhook response from Zapier (JSON object, array, or string) */
2721
3769
  data: unknown;
2722
3770
  }
3771
+ interface QueryAppDatabaseStepInput {
3772
+ /** Name or ID of the app data database to query */
3773
+ databaseId: string;
3774
+ /**
3775
+ * SQL query to execute. Use {{variables}} directly in the SQL — they are handled according to the `parameterize` setting.
3776
+ *
3777
+ * When parameterize is true (default): {{variables}} are extracted from the SQL, replaced with ? placeholders, resolved via the full MindStudio handlebars pipeline, and passed as safe parameterized values to SQLite. This prevents SQL injection. Example: INSERT INTO contacts (name, email) VALUES ({{name}}, {{email}})
3778
+ *
3779
+ * When parameterize is false: The entire SQL string is resolved via compileString (standard handlebars interpolation) and executed as-is. Use this for dynamic/generated SQL where another step builds the query. The user is responsible for safety. Example: {{generatedInsertQuery}}
3780
+ *
3781
+ * Ask the user for the database schema if they have not already provided it.
3782
+ */
3783
+ sql: string;
3784
+ /**
3785
+ * Whether to treat {{variables}} as parameterized query values (default: true).
3786
+ *
3787
+ * - true: {{vars}} are extracted, replaced with ?, and passed as bind params. Safe from SQL injection. Use for standard CRUD operations.
3788
+ * - false: {{vars}} are interpolated directly into the SQL string via handlebars. Use when another step generates full or partial SQL (e.g. bulk inserts with precomputed VALUES). The user is responsible for sanitization.
3789
+ */
3790
+ parameterize?: boolean;
3791
+ }
3792
+ interface QueryAppDatabaseStepOutput {
3793
+ /** Result rows for SELECT queries (empty array for write queries) */
3794
+ rows: unknown[];
3795
+ /** Number of rows affected by INSERT, UPDATE, or DELETE queries (0 for SELECT) */
3796
+ changes: number;
3797
+ }
2723
3798
  interface QueryDataSourceStepInput {
2724
3799
  /** ID of the vector data source to query */
2725
3800
  dataSourceId: string;
@@ -2801,8 +3876,8 @@ interface ResizeVideoStepInput {
2801
3876
  height?: number;
2802
3877
  /** Strategy for handling aspect ratio mismatch in 'exact' mode */
2803
3878
  strategy?: "pad" | "crop";
2804
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
2805
- skipAssetCreation?: boolean;
3879
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
3880
+ intermediateAsset?: boolean;
2806
3881
  }
2807
3882
  interface ResizeVideoStepOutput {
2808
3883
  /** URL of the resized video */
@@ -3564,7 +4639,7 @@ type TelegramSetTypingStepOutput = unknown;
3564
4639
  interface TextToSpeechStepInput {
3565
4640
  /** The text to convert to speech */
3566
4641
  text: string;
3567
- skipAssetCreation?: boolean;
4642
+ intermediateAsset?: boolean;
3568
4643
  /** Optional model configuration override. Uses the workflow's default speech model if not specified */
3569
4644
  speechModelOverride?: {
3570
4645
  /** Speech synthesis model identifier */
@@ -3601,8 +4676,8 @@ interface TrimMediaStepInput {
3601
4676
  start?: number | string;
3602
4677
  /** Duration of the trimmed segment in seconds. Omit to trim to the end of the clip. */
3603
4678
  duration?: string | number;
3604
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
3605
- skipAssetCreation?: boolean;
4679
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
4680
+ intermediateAsset?: boolean;
3606
4681
  }
3607
4682
  interface TrimMediaStepOutput {
3608
4683
  /** URL of the trimmed media file */
@@ -3710,8 +4785,8 @@ interface UpscaleVideoStepInput {
3710
4785
  targetResolution: "720p" | "1080p" | "2K" | "4K";
3711
4786
  /** Upscaling engine to use. Higher tiers produce better quality at higher cost. */
3712
4787
  engine: "standard" | "pro" | "ultimate" | "flashvsr" | "seedance" | "seedvr2" | "runwayml/upscale-v1";
3713
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
3714
- skipAssetCreation?: boolean;
4788
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
4789
+ intermediateAsset?: boolean;
3715
4790
  }
3716
4791
  interface UpscaleVideoStepOutput {
3717
4792
  /** URL of the upscaled video */
@@ -3774,8 +4849,8 @@ interface VideoFaceSwapStepInput {
3774
4849
  targetIndex: number;
3775
4850
  /** Face swap engine to use */
3776
4851
  engine: string;
3777
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
3778
- skipAssetCreation?: boolean;
4852
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
4853
+ intermediateAsset?: boolean;
3779
4854
  }
3780
4855
  interface VideoFaceSwapStepOutput {
3781
4856
  /** URL of the face-swapped video */
@@ -3790,8 +4865,8 @@ interface VideoRemoveBackgroundStepInput {
3790
4865
  newBackgroundImageUrl?: string;
3791
4866
  /** Background removal engine to use */
3792
4867
  engine: string;
3793
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
3794
- skipAssetCreation?: boolean;
4868
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
4869
+ intermediateAsset?: boolean;
3795
4870
  }
3796
4871
  interface VideoRemoveBackgroundStepOutput {
3797
4872
  /** URL of the video with background removed or replaced */
@@ -3802,8 +4877,8 @@ interface VideoRemoveWatermarkStepInput {
3802
4877
  videoUrl: string;
3803
4878
  /** Watermark removal engine to use */
3804
4879
  engine: string;
3805
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
3806
- skipAssetCreation?: boolean;
4880
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
4881
+ intermediateAsset?: boolean;
3807
4882
  }
3808
4883
  interface VideoRemoveWatermarkStepOutput {
3809
4884
  /** URL of the video with watermark removed */
@@ -3820,8 +4895,8 @@ interface WatermarkImageStepInput {
3820
4895
  paddingPx: number;
3821
4896
  /** Width of the watermark overlay in pixels */
3822
4897
  widthPx: number;
3823
- /** When true, the result will not appear in the user's asset history */
3824
- skipAssetCreation?: boolean;
4898
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
4899
+ intermediateAsset?: boolean;
3825
4900
  }
3826
4901
  interface WatermarkImageStepOutput {
3827
4902
  /** CDN URL of the watermarked image */
@@ -3838,8 +4913,8 @@ interface WatermarkVideoStepInput {
3838
4913
  paddingPx: number;
3839
4914
  /** Width of the watermark overlay in pixels */
3840
4915
  widthPx: number;
3841
- /** When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps. */
3842
- skipAssetCreation?: boolean;
4916
+ /** When true, the asset is created but hidden from the user's gallery (tagged as intermediate) */
4917
+ intermediateAsset?: boolean;
3843
4918
  }
3844
4919
  interface WatermarkVideoStepOutput {
3845
4920
  /** URL of the watermarked video */
@@ -3850,7 +4925,7 @@ type GenerateAssetStepOutput = GeneratePdfStepOutput;
3850
4925
  type GenerateTextStepInput = UserMessageStepInput;
3851
4926
  type GenerateTextStepOutput = UserMessageStepOutput;
3852
4927
  /** Union of all available step type names. */
3853
- type StepName = "activeCampaignAddNote" | "activeCampaignCreateContact" | "addSubtitlesToVideo" | "airtableCreateUpdateRecord" | "airtableDeleteRecord" | "airtableGetRecord" | "airtableGetTableRecords" | "analyzeImage" | "analyzeVideo" | "captureThumbnail" | "codaCreateUpdatePage" | "codaCreateUpdateRow" | "codaFindRow" | "codaGetPage" | "codaGetTableRows" | "convertPdfToImages" | "createDataSource" | "createGmailDraft" | "createGoogleCalendarEvent" | "createGoogleDoc" | "createGoogleSheet" | "deleteDataSource" | "deleteDataSourceDocument" | "deleteGmailEmail" | "deleteGoogleCalendarEvent" | "deleteGoogleSheetRows" | "detectChanges" | "detectPII" | "discordEditMessage" | "discordSendFollowUp" | "discordSendMessage" | "downloadVideo" | "enhanceImageGenerationPrompt" | "enhanceVideoGenerationPrompt" | "enrichPerson" | "extractAudioFromVideo" | "extractText" | "fetchDataSourceDocument" | "fetchGoogleDoc" | "fetchGoogleSheet" | "fetchSlackChannelHistory" | "fetchYoutubeCaptions" | "fetchYoutubeChannel" | "fetchYoutubeComments" | "fetchYoutubeVideo" | "generateChart" | "generateImage" | "generateLipsync" | "generateMusic" | "generatePdf" | "generateStaticVideoFromImage" | "generateVideo" | "getGmailAttachments" | "getGmailDraft" | "getGmailEmail" | "getGmailUnreadCount" | "getGoogleCalendarEvent" | "getGoogleDriveFile" | "getGoogleSheetInfo" | "getMediaMetadata" | "httpRequest" | "hubspotCreateCompany" | "hubspotCreateContact" | "hubspotGetCompany" | "hubspotGetContact" | "hunterApiCompanyEnrichment" | "hunterApiDomainSearch" | "hunterApiEmailFinder" | "hunterApiEmailVerification" | "hunterApiPersonEnrichment" | "imageFaceSwap" | "imageRemoveWatermark" | "insertVideoClips" | "listDataSources" | "listGmailDrafts" | "listGmailLabels" | "listGoogleCalendarEvents" | "listGoogleDriveFiles" | "listRecentGmailEmails" | "logic" | "makeDotComRunScenario" | "mergeAudio" | "mergeVideos" | "mixAudioIntoVideo" | "muteVideo" | "n8nRunNode" | "notionCreatePage" | "notionUpdatePage" | "peopleSearch" | "postToLinkedIn" | "postToSlackChannel" | "postToX" | "postToZapier" | "queryDataSource" | "queryExternalDatabase" | "redactPII" | "removeBackgroundFromImage" | "replyToGmailEmail" | "resizeVideo" | "runFromConnectorRegistry" | "runPackagedWorkflow" | "scrapeFacebookPage" | "scrapeFacebookPosts" | "scrapeInstagramComments" | "scrapeInstagramMentions" | "scrapeInstagramPosts" | "scrapeInstagramProfile" | "scrapeInstagramReels" | "scrapeLinkedInCompany" | "scrapeLinkedInProfile" | "scrapeMetaThreadsProfile" | "scrapeUrl" | "scrapeXPost" | "scrapeXProfile" | "searchGmailEmails" | "searchGoogle" | "searchGoogleCalendarEvents" | "searchGoogleDrive" | "searchGoogleImages" | "searchGoogleNews" | "searchGoogleTrends" | "searchPerplexity" | "searchXPosts" | "searchYoutube" | "searchYoutubeTrends" | "sendEmail" | "sendGmailDraft" | "sendGmailMessage" | "sendSMS" | "setGmailReadStatus" | "setRunTitle" | "setVariable" | "telegramEditMessage" | "telegramReplyToMessage" | "telegramSendAudio" | "telegramSendFile" | "telegramSendImage" | "telegramSendMessage" | "telegramSendVideo" | "telegramSetTyping" | "textToSpeech" | "transcribeAudio" | "trimMedia" | "updateGmailLabels" | "updateGoogleCalendarEvent" | "updateGoogleDoc" | "updateGoogleSheet" | "uploadDataSourceDocument" | "upscaleImage" | "upscaleVideo" | "userMessage" | "videoFaceSwap" | "videoRemoveBackground" | "videoRemoveWatermark" | "watermarkImage" | "watermarkVideo";
4928
+ type StepName = "activeCampaignAddNote" | "activeCampaignCreateContact" | "addSubtitlesToVideo" | "airtableCreateUpdateRecord" | "airtableDeleteRecord" | "airtableGetRecord" | "airtableGetTableRecords" | "analyzeImage" | "analyzeVideo" | "captureThumbnail" | "checkAppRole" | "codaCreateUpdatePage" | "codaCreateUpdateRow" | "codaFindRow" | "codaGetPage" | "codaGetTableRows" | "convertPdfToImages" | "createDataSource" | "createGmailDraft" | "createGoogleCalendarEvent" | "createGoogleDoc" | "createGoogleSheet" | "deleteDataSource" | "deleteDataSourceDocument" | "deleteGmailEmail" | "deleteGoogleCalendarEvent" | "deleteGoogleSheetRows" | "detectChanges" | "detectPII" | "discordEditMessage" | "discordSendFollowUp" | "discordSendMessage" | "downloadVideo" | "enhanceImageGenerationPrompt" | "enhanceVideoGenerationPrompt" | "enrichPerson" | "extractAudioFromVideo" | "extractText" | "fetchDataSourceDocument" | "fetchGoogleDoc" | "fetchGoogleSheet" | "fetchSlackChannelHistory" | "fetchYoutubeCaptions" | "fetchYoutubeChannel" | "fetchYoutubeComments" | "fetchYoutubeVideo" | "generateChart" | "generateImage" | "generateLipsync" | "generateMusic" | "generatePdf" | "generateStaticVideoFromImage" | "generateVideo" | "getGmailAttachments" | "getGmailDraft" | "getGmailEmail" | "getGmailUnreadCount" | "getGoogleCalendarEvent" | "getGoogleDriveFile" | "getGoogleSheetInfo" | "getMediaMetadata" | "httpRequest" | "hubspotCreateCompany" | "hubspotCreateContact" | "hubspotGetCompany" | "hubspotGetContact" | "hunterApiCompanyEnrichment" | "hunterApiDomainSearch" | "hunterApiEmailFinder" | "hunterApiEmailVerification" | "hunterApiPersonEnrichment" | "imageFaceSwap" | "imageRemoveWatermark" | "insertVideoClips" | "listDataSources" | "listGmailDrafts" | "listGmailLabels" | "listGoogleCalendarEvents" | "listGoogleDriveFiles" | "listRecentGmailEmails" | "logic" | "makeDotComRunScenario" | "mergeAudio" | "mergeVideos" | "mixAudioIntoVideo" | "muteVideo" | "n8nRunNode" | "notionCreatePage" | "notionUpdatePage" | "peopleSearch" | "postToLinkedIn" | "postToSlackChannel" | "postToX" | "postToZapier" | "queryAppDatabase" | "queryDataSource" | "queryExternalDatabase" | "redactPII" | "removeBackgroundFromImage" | "replyToGmailEmail" | "resizeVideo" | "runFromConnectorRegistry" | "runPackagedWorkflow" | "scrapeFacebookPage" | "scrapeFacebookPosts" | "scrapeInstagramComments" | "scrapeInstagramMentions" | "scrapeInstagramPosts" | "scrapeInstagramProfile" | "scrapeInstagramReels" | "scrapeLinkedInCompany" | "scrapeLinkedInProfile" | "scrapeMetaThreadsProfile" | "scrapeUrl" | "scrapeXPost" | "scrapeXProfile" | "searchGmailEmails" | "searchGoogle" | "searchGoogleCalendarEvents" | "searchGoogleDrive" | "searchGoogleImages" | "searchGoogleNews" | "searchGoogleTrends" | "searchPerplexity" | "searchXPosts" | "searchYoutube" | "searchYoutubeTrends" | "sendEmail" | "sendGmailDraft" | "sendGmailMessage" | "sendSMS" | "setGmailReadStatus" | "setRunTitle" | "setVariable" | "telegramEditMessage" | "telegramReplyToMessage" | "telegramSendAudio" | "telegramSendFile" | "telegramSendImage" | "telegramSendMessage" | "telegramSendVideo" | "telegramSetTyping" | "textToSpeech" | "transcribeAudio" | "trimMedia" | "updateGmailLabels" | "updateGoogleCalendarEvent" | "updateGoogleDoc" | "updateGoogleSheet" | "uploadDataSourceDocument" | "upscaleImage" | "upscaleVideo" | "userMessage" | "videoFaceSwap" | "videoRemoveBackground" | "videoRemoveWatermark" | "watermarkImage" | "watermarkVideo";
3854
4929
  /** Maps step names to their input types. */
3855
4930
  interface StepInputMap {
3856
4931
  activeCampaignAddNote: ActiveCampaignAddNoteStepInput;
@@ -3863,6 +4938,7 @@ interface StepInputMap {
3863
4938
  analyzeImage: AnalyzeImageStepInput;
3864
4939
  analyzeVideo: AnalyzeVideoStepInput;
3865
4940
  captureThumbnail: CaptureThumbnailStepInput;
4941
+ checkAppRole: CheckAppRoleStepInput;
3866
4942
  codaCreateUpdatePage: CodaCreateUpdatePageStepInput;
3867
4943
  codaCreateUpdateRow: CodaCreateUpdateRowStepInput;
3868
4944
  codaFindRow: CodaFindRowStepInput;
@@ -3946,6 +5022,7 @@ interface StepInputMap {
3946
5022
  postToSlackChannel: PostToSlackChannelStepInput;
3947
5023
  postToX: PostToXStepInput;
3948
5024
  postToZapier: PostToZapierStepInput;
5025
+ queryAppDatabase: QueryAppDatabaseStepInput;
3949
5026
  queryDataSource: QueryDataSourceStepInput;
3950
5027
  queryExternalDatabase: QueryExternalDatabaseStepInput;
3951
5028
  redactPII: RedactPIIStepInput;
@@ -4022,6 +5099,7 @@ interface StepOutputMap {
4022
5099
  analyzeImage: AnalyzeImageStepOutput;
4023
5100
  analyzeVideo: AnalyzeVideoStepOutput;
4024
5101
  captureThumbnail: CaptureThumbnailStepOutput;
5102
+ checkAppRole: CheckAppRoleStepOutput;
4025
5103
  codaCreateUpdatePage: CodaCreateUpdatePageStepOutput;
4026
5104
  codaCreateUpdateRow: CodaCreateUpdateRowStepOutput;
4027
5105
  codaFindRow: CodaFindRowStepOutput;
@@ -4105,6 +5183,7 @@ interface StepOutputMap {
4105
5183
  postToSlackChannel: PostToSlackChannelStepOutput;
4106
5184
  postToX: PostToXStepOutput;
4107
5185
  postToZapier: PostToZapierStepOutput;
5186
+ queryAppDatabase: QueryAppDatabaseStepOutput;
4108
5187
  queryDataSource: QueryDataSourceStepOutput;
4109
5188
  queryExternalDatabase: QueryExternalDatabaseStepOutput;
4110
5189
  redactPII: RedactPIIStepOutput;
@@ -4350,6 +5429,24 @@ interface StepMethods {
4350
5429
  * ```
4351
5430
  */
4352
5431
  captureThumbnail(step: CaptureThumbnailStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<CaptureThumbnailStepOutput>>;
5432
+ /**
5433
+ * Check whether the current user has a specific app role and branch accordingly.
5434
+ *
5435
+ * @remarks
5436
+ * - Checks if the current user has been assigned a specific role in this app.
5437
+ * - If the user has the role, transitions to the "has role" path.
5438
+ * - If the user does not have the role, transitions to the "no role" path, or errors if no path is configured.
5439
+ * - Role names are defined by the app creator and assigned to users via the app roles system.
5440
+ * - The roleName field supports {{variables}} for dynamic role checks.
5441
+ *
5442
+ * @example
5443
+ * ```typescript
5444
+ * const result = await agent.checkAppRole({
5445
+ * roleName: ``,
5446
+ * });
5447
+ * ```
5448
+ */
5449
+ checkAppRole(step: CheckAppRoleStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<CheckAppRoleStepOutput>>;
4353
5450
  /**
4354
5451
  * Create a new page or update an existing page in a Coda document.
4355
5452
  *
@@ -5649,7 +6746,10 @@ interface StepMethods {
5649
6746
  *
5650
6747
  * @remarks
5651
6748
  * - Requires a LinkedIn OAuth connection (connectionId).
5652
- * - Supports text posts, image posts, and video posts.
6749
+ * - Supports text posts, image posts, video posts, document posts, and article posts.
6750
+ * - Attach one media type per post: image, video, document, or article.
6751
+ * - Documents support PDF, PPT, PPTX, DOC, DOCX (max 100MB, 300 pages). Displays as a slideshow carousel.
6752
+ * - Articles create a link preview with optional custom title, description, and thumbnail.
5653
6753
  * - Visibility controls who can see the post.
5654
6754
  *
5655
6755
  * @example
@@ -5714,6 +6814,32 @@ interface StepMethods {
5714
6814
  * ```
5715
6815
  */
5716
6816
  postToZapier(step: PostToZapierStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<PostToZapierStepOutput>>;
6817
+ /**
6818
+ * Execute a SQL query against the app managed database.
6819
+ *
6820
+ * @remarks
6821
+ * - Executes raw SQL against a SQLite database managed by the app.
6822
+ * - For SELECT queries, returns rows as JSON.
6823
+ * - For INSERT/UPDATE/DELETE, returns the number of affected rows.
6824
+ * - Use {{variables}} directly in your SQL. By default they are automatically extracted
6825
+ * and passed as safe parameterized values (preventing SQL injection).
6826
+ * Example: INSERT INTO contacts (name, comment) VALUES ({{name}}, {{comment}})
6827
+ * - Full MindStudio handlebars syntax is supported, including helpers like {{json myVar}},
6828
+ * {{get myVar "$.path"}}, {{global.orgName}}, etc.
6829
+ * - Set parameterize to false for raw/dynamic SQL where variables are interpolated directly
6830
+ * into the query string. Use this when another step generates full or partial SQL, e.g.
6831
+ * a bulk INSERT with a precomputed VALUES list. The user is responsible for sanitization
6832
+ * when parameterize is false.
6833
+ *
6834
+ * @example
6835
+ * ```typescript
6836
+ * const result = await agent.queryAppDatabase({
6837
+ * databaseId: ``,
6838
+ * sql: ``,
6839
+ * });
6840
+ * ```
6841
+ */
6842
+ queryAppDatabase(step: QueryAppDatabaseStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<QueryAppDatabaseStepOutput>>;
5717
6843
  /**
5718
6844
  * Search a vector data source (RAG) and return relevant document chunks.
5719
6845
  *
@@ -6775,4 +7901,52 @@ declare const MindStudioAgent: {
6775
7901
  new (options?: AgentOptions): MindStudioAgent;
6776
7902
  };
6777
7903
 
6778
- export { type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, type AgentInfo, type AgentOptions, type AirtableCreateUpdateRecordStepInput, type AirtableCreateUpdateRecordStepOutput, type AirtableDeleteRecordStepInput, type AirtableDeleteRecordStepOutput, type AirtableGetRecordStepInput, type AirtableGetRecordStepOutput, type AirtableGetTableRecordsStepInput, type AirtableGetTableRecordsStepOutput, type AnalyzeImageStepInput, type AnalyzeImageStepOutput, type AnalyzeVideoStepInput, type AnalyzeVideoStepOutput, type BatchStepInput, type BatchStepResult, type CaptureThumbnailStepInput, type CaptureThumbnailStepOutput, type CodaCreateUpdatePageStepInput, type CodaCreateUpdatePageStepOutput, type CodaCreateUpdateRowStepInput, type CodaCreateUpdateRowStepOutput, type CodaFindRowStepInput, type CodaFindRowStepOutput, type CodaGetPageStepInput, type CodaGetPageStepOutput, type CodaGetTableRowsStepInput, type CodaGetTableRowsStepOutput, type Connection, type ConnectorActionDetail, type ConnectorService, type ConvertPdfToImagesStepInput, type ConvertPdfToImagesStepOutput, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGmailDraftStepInput, type CreateGmailDraftStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type DeleteDataSourceDocumentStepInput, type DeleteDataSourceDocumentStepOutput, type DeleteDataSourceStepInput, type DeleteDataSourceStepOutput, type DeleteGmailEmailStepInput, type DeleteGmailEmailStepOutput, type DeleteGoogleCalendarEventStepInput, type DeleteGoogleCalendarEventStepOutput, type DeleteGoogleSheetRowsStepInput, type DeleteGoogleSheetRowsStepOutput, type DetectChangesStepInput, type DetectChangesStepOutput, type DetectPIIStepInput, type DetectPIIStepOutput, type DiscordEditMessageStepInput, type DiscordEditMessageStepOutput, type DiscordSendFollowUpStepInput, type DiscordSendFollowUpStepOutput, type DiscordSendMessageStepInput, type DiscordSendMessageStepOutput, type DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, type ExecuteStepBatchOptions, type ExecuteStepBatchResult, type ExtractAudioFromVideoStepInput, type ExtractAudioFromVideoStepOutput, type ExtractTextStepInput, type ExtractTextStepOutput, type FetchDataSourceDocumentStepInput, type FetchDataSourceDocumentStepOutput, type FetchGoogleDocStepInput, type FetchGoogleDocStepOutput, type FetchGoogleSheetStepInput, type FetchGoogleSheetStepOutput, type FetchSlackChannelHistoryStepInput, type FetchSlackChannelHistoryStepOutput, type FetchYoutubeCaptionsStepInput, type FetchYoutubeCaptionsStepOutput, type FetchYoutubeChannelStepInput, type FetchYoutubeChannelStepOutput, type FetchYoutubeCommentsStepInput, type FetchYoutubeCommentsStepOutput, type FetchYoutubeVideoStepInput, type FetchYoutubeVideoStepOutput, type GenerateAssetStepInput, type GenerateAssetStepOutput, type GenerateChartStepInput, type GenerateChartStepOutput, type GenerateImageStepInput, type GenerateImageStepOutput, type GenerateLipsyncStepInput, type GenerateLipsyncStepOutput, type GenerateMusicStepInput, type GenerateMusicStepOutput, type GeneratePdfStepInput, type GeneratePdfStepOutput, type GenerateStaticVideoFromImageStepInput, type GenerateStaticVideoFromImageStepOutput, type GenerateTextStepInput, type GenerateTextStepOutput, type GenerateVideoStepInput, type GenerateVideoStepOutput, type GetGmailAttachmentsStepInput, type GetGmailAttachmentsStepOutput, type GetGmailDraftStepInput, type GetGmailDraftStepOutput, type GetGmailEmailStepInput, type GetGmailEmailStepOutput, type GetGmailUnreadCountStepInput, type GetGmailUnreadCountStepOutput, type GetGoogleCalendarEventStepInput, type GetGoogleCalendarEventStepOutput, type GetGoogleDriveFileStepInput, type GetGoogleDriveFileStepOutput, type GetGoogleSheetInfoStepInput, type GetGoogleSheetInfoStepOutput, type GetMediaMetadataStepInput, type GetMediaMetadataStepOutput, type HttpRequestStepInput, type HttpRequestStepOutput, type HubspotCreateCompanyStepInput, type HubspotCreateCompanyStepOutput, type HubspotCreateContactStepInput, type HubspotCreateContactStepOutput, type HubspotGetCompanyStepInput, type HubspotGetCompanyStepOutput, type HubspotGetContactStepInput, type HubspotGetContactStepOutput, type HunterApiCompanyEnrichmentStepInput, type HunterApiCompanyEnrichmentStepOutput, type HunterApiDomainSearchStepInput, type HunterApiDomainSearchStepOutput, type HunterApiEmailFinderStepInput, type HunterApiEmailFinderStepOutput, type HunterApiEmailVerificationStepInput, type HunterApiEmailVerificationStepOutput, type HunterApiPersonEnrichmentStepInput, type HunterApiPersonEnrichmentStepOutput, type ImageFaceSwapStepInput, type ImageFaceSwapStepOutput, type ImageRemoveWatermarkStepInput, type ImageRemoveWatermarkStepOutput, type InsertVideoClipsStepInput, type InsertVideoClipsStepOutput, type ListAgentsResult, type ListDataSourcesStepInput, type ListDataSourcesStepOutput, type ListGmailDraftsStepInput, type ListGmailDraftsStepOutput, type ListGmailLabelsStepInput, type ListGmailLabelsStepOutput, type ListGoogleCalendarEventsStepInput, type ListGoogleCalendarEventsStepOutput, type ListGoogleDriveFilesStepInput, type ListGoogleDriveFilesStepOutput, type ListRecentGmailEmailsStepInput, type ListRecentGmailEmailsStepOutput, type LogicStepInput, type LogicStepOutput, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, MindStudioAgent, MindStudioError, type MindStudioModel, type MindStudioModelSummary, type MixAudioIntoVideoStepInput, type MixAudioIntoVideoStepOutput, type ModelType, type MonacoSnippet, type MonacoSnippetField, type MonacoSnippetFieldType, type MuteVideoStepInput, type MuteVideoStepOutput, type N8nRunNodeStepInput, type N8nRunNodeStepOutput, type NotionCreatePageStepInput, type NotionCreatePageStepOutput, type NotionUpdatePageStepInput, type NotionUpdatePageStepOutput, type PeopleSearchStepInput, type PeopleSearchStepOutput, type PostToLinkedInStepInput, type PostToLinkedInStepOutput, type PostToSlackChannelStepInput, type PostToSlackChannelStepOutput, type PostToXStepInput, type PostToXStepOutput, type PostToZapierStepInput, type PostToZapierStepOutput, type QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type ReplyToGmailEmailStepInput, type ReplyToGmailEmailStepOutput, type ResizeVideoStepInput, type ResizeVideoStepOutput, type RunAgentOptions, type RunAgentResult, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunPackagedWorkflowStepInput, type RunPackagedWorkflowStepOutput, type ScrapeFacebookPageStepInput, type ScrapeFacebookPageStepOutput, type ScrapeFacebookPostsStepInput, type ScrapeFacebookPostsStepOutput, type ScrapeInstagramCommentsStepInput, type ScrapeInstagramCommentsStepOutput, type ScrapeInstagramMentionsStepInput, type ScrapeInstagramMentionsStepOutput, type ScrapeInstagramPostsStepInput, type ScrapeInstagramPostsStepOutput, type ScrapeInstagramProfileStepInput, type ScrapeInstagramProfileStepOutput, type ScrapeInstagramReelsStepInput, type ScrapeInstagramReelsStepOutput, type ScrapeLinkedInCompanyStepInput, type ScrapeLinkedInCompanyStepOutput, type ScrapeLinkedInProfileStepInput, type ScrapeLinkedInProfileStepOutput, type ScrapeMetaThreadsProfileStepInput, type ScrapeMetaThreadsProfileStepOutput, type ScrapeUrlStepInput, type ScrapeUrlStepOutput, type ScrapeXPostStepInput, type ScrapeXPostStepOutput, type ScrapeXProfileStepInput, type ScrapeXProfileStepOutput, type SearchGmailEmailsStepInput, type SearchGmailEmailsStepOutput, type SearchGoogleCalendarEventsStepInput, type SearchGoogleCalendarEventsStepOutput, type SearchGoogleDriveStepInput, type SearchGoogleDriveStepOutput, type SearchGoogleImagesStepInput, type SearchGoogleImagesStepOutput, type SearchGoogleNewsStepInput, type SearchGoogleNewsStepOutput, type SearchGoogleStepInput, type SearchGoogleStepOutput, type SearchGoogleTrendsStepInput, type SearchGoogleTrendsStepOutput, type SearchPerplexityStepInput, type SearchPerplexityStepOutput, type SearchXPostsStepInput, type SearchXPostsStepOutput, type SearchYoutubeStepInput, type SearchYoutubeStepOutput, type SearchYoutubeTrendsStepInput, type SearchYoutubeTrendsStepOutput, type SendEmailStepInput, type SendEmailStepOutput, type SendGmailDraftStepInput, type SendGmailDraftStepOutput, type SendGmailMessageStepInput, type SendGmailMessageStepOutput, type SendSMSStepInput, type SendSMSStepOutput, type SetGmailReadStatusStepInput, type SetGmailReadStatusStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepCostEstimateEntry, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepMetadata, type StepMethods, type StepName, type StepOutputMap, type TelegramEditMessageStepInput, type TelegramEditMessageStepOutput, type TelegramReplyToMessageStepInput, type TelegramReplyToMessageStepOutput, type TelegramSendAudioStepInput, type TelegramSendAudioStepOutput, type TelegramSendFileStepInput, type TelegramSendFileStepOutput, type TelegramSendImageStepInput, type TelegramSendImageStepOutput, type TelegramSendMessageStepInput, type TelegramSendMessageStepOutput, type TelegramSendVideoStepInput, type TelegramSendVideoStepOutput, type TelegramSetTypingStepInput, type TelegramSetTypingStepOutput, type TextToSpeechStepInput, type TextToSpeechStepOutput, type TranscribeAudioStepInput, type TranscribeAudioStepOutput, type TrimMediaStepInput, type TrimMediaStepOutput, type UpdateGmailLabelsStepInput, type UpdateGmailLabelsStepOutput, type UpdateGoogleCalendarEventStepInput, type UpdateGoogleCalendarEventStepOutput, type UpdateGoogleDocStepInput, type UpdateGoogleDocStepOutput, type UpdateGoogleSheetStepInput, type UpdateGoogleSheetStepOutput, type UploadDataSourceDocumentStepInput, type UploadDataSourceDocumentStepOutput, type UploadFileResult, type UpscaleImageStepInput, type UpscaleImageStepOutput, type UpscaleVideoStepInput, type UpscaleVideoStepOutput, type UserInfoResult, type UserMessageStepInput, type UserMessageStepOutput, type VideoFaceSwapStepInput, type VideoFaceSwapStepOutput, type VideoRemoveBackgroundStepInput, type VideoRemoveBackgroundStepOutput, type VideoRemoveWatermarkStepInput, type VideoRemoveWatermarkStepOutput, type WatermarkImageStepInput, type WatermarkImageStepOutput, type WatermarkVideoStepInput, type WatermarkVideoStepOutput, blockTypeAliases, monacoSnippets, stepMetadata };
7904
+ declare const mindstudio: MindStudioAgent;
7905
+
7906
+ /**
7907
+ * Top-level `auth` namespace bound to the default singleton.
7908
+ *
7909
+ * Provides the current user's identity and roles. Requires context
7910
+ * hydration before use — call `await mindstudio.ensureContext()` or
7911
+ * perform any `db` operation first.
7912
+ *
7913
+ * @example
7914
+ * ```ts
7915
+ * import { auth, Roles } from '@mindstudio-ai/agent';
7916
+ *
7917
+ * auth.requireRole(Roles.admin);
7918
+ * const admins = auth.getUsersByRole(Roles.admin);
7919
+ * ```
7920
+ */
7921
+ declare const auth: AuthContext;
7922
+ /**
7923
+ * Top-level `db` namespace bound to the default singleton.
7924
+ *
7925
+ * Use `db.defineTable<T>(name)` to create typed collections. Table
7926
+ * definitions are lazy — no HTTP until you await a query. Context is
7927
+ * auto-hydrated on first query execution.
7928
+ *
7929
+ * @example
7930
+ * ```ts
7931
+ * import { db } from '@mindstudio-ai/agent';
7932
+ *
7933
+ * const Orders = db.defineTable<Order>('orders');
7934
+ * const active = await Orders.filter(o => o.status === 'active').take(10);
7935
+ * ```
7936
+ */
7937
+ declare const db: Db;
7938
+ /**
7939
+ * Resolve a user ID to display info (name, email, profile picture).
7940
+ * Bound to the default singleton.
7941
+ *
7942
+ * @example
7943
+ * ```ts
7944
+ * import { resolveUser } from '@mindstudio-ai/agent';
7945
+ *
7946
+ * const user = await resolveUser(order.requestedBy);
7947
+ * if (user) console.log(user.name, user.email);
7948
+ * ```
7949
+ */
7950
+ declare const resolveUser: (userId: string) => Promise<ResolvedUser | null>;
7951
+
7952
+ export { type Accessor, type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, type AgentInfo, type AgentOptions, type AirtableCreateUpdateRecordStepInput, type AirtableCreateUpdateRecordStepOutput, type AirtableDeleteRecordStepInput, type AirtableDeleteRecordStepOutput, type AirtableGetRecordStepInput, type AirtableGetRecordStepOutput, type AirtableGetTableRecordsStepInput, type AirtableGetTableRecordsStepOutput, type AnalyzeImageStepInput, type AnalyzeImageStepOutput, type AnalyzeVideoStepInput, type AnalyzeVideoStepOutput, type AppAuthContext, type AppContextResult, type AppDatabase, type AppDatabaseColumnSchema, type AppDatabaseTable, type AppRoleAssignment, AuthContext, type BatchStepInput, type BatchStepResult, type CaptureThumbnailStepInput, type CaptureThumbnailStepOutput, type CheckAppRoleStepInput, type CheckAppRoleStepOutput, type CodaCreateUpdatePageStepInput, type CodaCreateUpdatePageStepOutput, type CodaCreateUpdateRowStepInput, type CodaCreateUpdateRowStepOutput, type CodaFindRowStepInput, type CodaFindRowStepOutput, type CodaGetPageStepInput, type CodaGetPageStepOutput, type CodaGetTableRowsStepInput, type CodaGetTableRowsStepOutput, type Connection, type ConnectorActionDetail, type ConnectorService, type ConvertPdfToImagesStepInput, type ConvertPdfToImagesStepOutput, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGmailDraftStepInput, type CreateGmailDraftStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type Db, type DefineTableOptions, type DeleteDataSourceDocumentStepInput, type DeleteDataSourceDocumentStepOutput, type DeleteDataSourceStepInput, type DeleteDataSourceStepOutput, type DeleteGmailEmailStepInput, type DeleteGmailEmailStepOutput, type DeleteGoogleCalendarEventStepInput, type DeleteGoogleCalendarEventStepOutput, type DeleteGoogleSheetRowsStepInput, type DeleteGoogleSheetRowsStepOutput, type DetectChangesStepInput, type DetectChangesStepOutput, type DetectPIIStepInput, type DetectPIIStepOutput, type DiscordEditMessageStepInput, type DiscordEditMessageStepOutput, type DiscordSendFollowUpStepInput, type DiscordSendFollowUpStepOutput, type DiscordSendMessageStepInput, type DiscordSendMessageStepOutput, type DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, type ExecuteStepBatchOptions, type ExecuteStepBatchResult, type ExtractAudioFromVideoStepInput, type ExtractAudioFromVideoStepOutput, type ExtractTextStepInput, type ExtractTextStepOutput, type FetchDataSourceDocumentStepInput, type FetchDataSourceDocumentStepOutput, type FetchGoogleDocStepInput, type FetchGoogleDocStepOutput, type FetchGoogleSheetStepInput, type FetchGoogleSheetStepOutput, type FetchSlackChannelHistoryStepInput, type FetchSlackChannelHistoryStepOutput, type FetchYoutubeCaptionsStepInput, type FetchYoutubeCaptionsStepOutput, type FetchYoutubeChannelStepInput, type FetchYoutubeChannelStepOutput, type FetchYoutubeCommentsStepInput, type FetchYoutubeCommentsStepOutput, type FetchYoutubeVideoStepInput, type FetchYoutubeVideoStepOutput, type GenerateAssetStepInput, type GenerateAssetStepOutput, type GenerateChartStepInput, type GenerateChartStepOutput, type GenerateImageStepInput, type GenerateImageStepOutput, type GenerateLipsyncStepInput, type GenerateLipsyncStepOutput, type GenerateMusicStepInput, type GenerateMusicStepOutput, type GeneratePdfStepInput, type GeneratePdfStepOutput, type GenerateStaticVideoFromImageStepInput, type GenerateStaticVideoFromImageStepOutput, type GenerateTextStepInput, type GenerateTextStepOutput, type GenerateVideoStepInput, type GenerateVideoStepOutput, type GetGmailAttachmentsStepInput, type GetGmailAttachmentsStepOutput, type GetGmailDraftStepInput, type GetGmailDraftStepOutput, type GetGmailEmailStepInput, type GetGmailEmailStepOutput, type GetGmailUnreadCountStepInput, type GetGmailUnreadCountStepOutput, type GetGoogleCalendarEventStepInput, type GetGoogleCalendarEventStepOutput, type GetGoogleDriveFileStepInput, type GetGoogleDriveFileStepOutput, type GetGoogleSheetInfoStepInput, type GetGoogleSheetInfoStepOutput, type GetMediaMetadataStepInput, type GetMediaMetadataStepOutput, type HttpRequestStepInput, type HttpRequestStepOutput, type HubspotCreateCompanyStepInput, type HubspotCreateCompanyStepOutput, type HubspotCreateContactStepInput, type HubspotCreateContactStepOutput, type HubspotGetCompanyStepInput, type HubspotGetCompanyStepOutput, type HubspotGetContactStepInput, type HubspotGetContactStepOutput, type HunterApiCompanyEnrichmentStepInput, type HunterApiCompanyEnrichmentStepOutput, type HunterApiDomainSearchStepInput, type HunterApiDomainSearchStepOutput, type HunterApiEmailFinderStepInput, type HunterApiEmailFinderStepOutput, type HunterApiEmailVerificationStepInput, type HunterApiEmailVerificationStepOutput, type HunterApiPersonEnrichmentStepInput, type HunterApiPersonEnrichmentStepOutput, type ImageFaceSwapStepInput, type ImageFaceSwapStepOutput, type ImageRemoveWatermarkStepInput, type ImageRemoveWatermarkStepOutput, type InsertVideoClipsStepInput, type InsertVideoClipsStepOutput, type ListAgentsResult, type ListDataSourcesStepInput, type ListDataSourcesStepOutput, type ListGmailDraftsStepInput, type ListGmailDraftsStepOutput, type ListGmailLabelsStepInput, type ListGmailLabelsStepOutput, type ListGoogleCalendarEventsStepInput, type ListGoogleCalendarEventsStepOutput, type ListGoogleDriveFilesStepInput, type ListGoogleDriveFilesStepOutput, type ListRecentGmailEmailsStepInput, type ListRecentGmailEmailsStepOutput, type LogicStepInput, type LogicStepOutput, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, MindStudioAgent, MindStudioError, type MindStudioModel, type MindStudioModelSummary, type MixAudioIntoVideoStepInput, type MixAudioIntoVideoStepOutput, type ModelType, type MonacoSnippet, type MonacoSnippetField, type MonacoSnippetFieldType, type MuteVideoStepInput, type MuteVideoStepOutput, type N8nRunNodeStepInput, type N8nRunNodeStepOutput, type NotionCreatePageStepInput, type NotionCreatePageStepOutput, type NotionUpdatePageStepInput, type NotionUpdatePageStepOutput, type PeopleSearchStepInput, type PeopleSearchStepOutput, type PostToLinkedInStepInput, type PostToLinkedInStepOutput, type PostToSlackChannelStepInput, type PostToSlackChannelStepOutput, type PostToXStepInput, type PostToXStepOutput, type PostToZapierStepInput, type PostToZapierStepOutput, type Predicate, type PushInput, Query, type QueryAppDatabaseStepInput, type QueryAppDatabaseStepOutput, type QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type ReplyToGmailEmailStepInput, type ReplyToGmailEmailStepOutput, type ResizeVideoStepInput, type ResizeVideoStepOutput, type ResolvedUser, Roles, type RunAgentOptions, type RunAgentResult, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunPackagedWorkflowStepInput, type RunPackagedWorkflowStepOutput, type ScrapeFacebookPageStepInput, type ScrapeFacebookPageStepOutput, type ScrapeFacebookPostsStepInput, type ScrapeFacebookPostsStepOutput, type ScrapeInstagramCommentsStepInput, type ScrapeInstagramCommentsStepOutput, type ScrapeInstagramMentionsStepInput, type ScrapeInstagramMentionsStepOutput, type ScrapeInstagramPostsStepInput, type ScrapeInstagramPostsStepOutput, type ScrapeInstagramProfileStepInput, type ScrapeInstagramProfileStepOutput, type ScrapeInstagramReelsStepInput, type ScrapeInstagramReelsStepOutput, type ScrapeLinkedInCompanyStepInput, type ScrapeLinkedInCompanyStepOutput, type ScrapeLinkedInProfileStepInput, type ScrapeLinkedInProfileStepOutput, type ScrapeMetaThreadsProfileStepInput, type ScrapeMetaThreadsProfileStepOutput, type ScrapeUrlStepInput, type ScrapeUrlStepOutput, type ScrapeXPostStepInput, type ScrapeXPostStepOutput, type ScrapeXProfileStepInput, type ScrapeXProfileStepOutput, type SearchGmailEmailsStepInput, type SearchGmailEmailsStepOutput, type SearchGoogleCalendarEventsStepInput, type SearchGoogleCalendarEventsStepOutput, type SearchGoogleDriveStepInput, type SearchGoogleDriveStepOutput, type SearchGoogleImagesStepInput, type SearchGoogleImagesStepOutput, type SearchGoogleNewsStepInput, type SearchGoogleNewsStepOutput, type SearchGoogleStepInput, type SearchGoogleStepOutput, type SearchGoogleTrendsStepInput, type SearchGoogleTrendsStepOutput, type SearchPerplexityStepInput, type SearchPerplexityStepOutput, type SearchXPostsStepInput, type SearchXPostsStepOutput, type SearchYoutubeStepInput, type SearchYoutubeStepOutput, type SearchYoutubeTrendsStepInput, type SearchYoutubeTrendsStepOutput, type SendEmailStepInput, type SendEmailStepOutput, type SendGmailDraftStepInput, type SendGmailDraftStepOutput, type SendGmailMessageStepInput, type SendGmailMessageStepOutput, type SendSMSStepInput, type SendSMSStepOutput, type SetGmailReadStatusStepInput, type SetGmailReadStatusStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepCostEstimateEntry, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepMetadata, type StepMethods, type StepName, type StepOutputMap, type SystemFields, Table, type TelegramEditMessageStepInput, type TelegramEditMessageStepOutput, type TelegramReplyToMessageStepInput, type TelegramReplyToMessageStepOutput, type TelegramSendAudioStepInput, type TelegramSendAudioStepOutput, type TelegramSendFileStepInput, type TelegramSendFileStepOutput, type TelegramSendImageStepInput, type TelegramSendImageStepOutput, type TelegramSendMessageStepInput, type TelegramSendMessageStepOutput, type TelegramSendVideoStepInput, type TelegramSendVideoStepOutput, type TelegramSetTypingStepInput, type TelegramSetTypingStepOutput, type TextToSpeechStepInput, type TextToSpeechStepOutput, type TranscribeAudioStepInput, type TranscribeAudioStepOutput, type TrimMediaStepInput, type TrimMediaStepOutput, type UpdateGmailLabelsStepInput, type UpdateGmailLabelsStepOutput, type UpdateGoogleCalendarEventStepInput, type UpdateGoogleCalendarEventStepOutput, type UpdateGoogleDocStepInput, type UpdateGoogleDocStepOutput, type UpdateGoogleSheetStepInput, type UpdateGoogleSheetStepOutput, type UpdateInput, type UploadDataSourceDocumentStepInput, type UploadDataSourceDocumentStepOutput, type UploadFileResult, type UpscaleImageStepInput, type UpscaleImageStepOutput, type UpscaleVideoStepInput, type UpscaleVideoStepOutput, type User, type UserInfoResult, type UserMessageStepInput, type UserMessageStepOutput, type VideoFaceSwapStepInput, type VideoFaceSwapStepOutput, type VideoRemoveBackgroundStepInput, type VideoRemoveBackgroundStepOutput, type VideoRemoveWatermarkStepInput, type VideoRemoveWatermarkStepOutput, type WatermarkImageStepInput, type WatermarkImageStepOutput, type WatermarkVideoStepInput, type WatermarkVideoStepOutput, auth, blockTypeAliases, db, mindstudio as default, mindstudio, monacoSnippets, resolveUser, stepMetadata };