@mindstudio-ai/agent 0.1.13 → 0.1.15

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/cli.js CHANGED
@@ -3115,6 +3115,8 @@ var init_client = __esm({
3115
3115
  _reuseThreadId;
3116
3116
  /** @internal */
3117
3117
  _threadId;
3118
+ /** @internal Stream ID for SSE token streaming. Set by sandbox via STREAM_ID env var. */
3119
+ _streamId;
3118
3120
  // ---- App context (db + auth) ----
3119
3121
  /**
3120
3122
  * @internal App ID for context resolution. Resolved from:
@@ -3155,6 +3157,7 @@ var init_client = __esm({
3155
3157
  if (authType === "internal") {
3156
3158
  this._trySandboxHydration();
3157
3159
  }
3160
+ this._streamId = process.env.STREAM_ID ?? void 0;
3158
3161
  }
3159
3162
  /**
3160
3163
  * Execute any step by its type name. This is the low-level method that all
@@ -3170,7 +3173,8 @@ var init_client = __esm({
3170
3173
  const { data, headers } = await request(this._httpConfig, "POST", `/steps/${stepType}/execute`, {
3171
3174
  step,
3172
3175
  ...options?.appId != null && { appId: options.appId },
3173
- ...threadId != null && { threadId }
3176
+ ...threadId != null && { threadId },
3177
+ ...this._streamId != null && { streamId: this._streamId }
3174
3178
  });
3175
3179
  let output;
3176
3180
  if (data.output != null) {
@@ -3892,7 +3896,7 @@ async function startMcpServer(options) {
3892
3896
  capabilities: { tools: {} },
3893
3897
  serverInfo: {
3894
3898
  name: "mindstudio-agent",
3895
- version: "0.1.13"
3899
+ version: "0.1.15"
3896
3900
  },
3897
3901
  instructions: "Welcome to MindStudio \u2014 a platform with 200+ AI models, 850+ third-party integrations, and pre-built agents.\n\nGetting started:\n1. Call `listAgents` to verify your connection and see available agents.\n2. Call `changeName` to set your display name \u2014 use your name or whatever your user calls you. This is how you'll appear in MindStudio request logs.\n3. If you have a profile picture or icon, call `uploadFile` to upload it, then `changeProfilePicture` with the returned URL. This helps users identify your requests in their logs.\n4. Call `listActions` to discover all available actions.\n\nThen use the tools to generate text, images, video, audio, search the web, work with data sources, run agents, and more.\n\nImportant:\n- AI-powered actions (text generation, image generation, video, audio, etc.) cost money. Before running these, call `estimateActionCost` and confirm with the user before proceeding \u2014 unless they've explicitly told you to go ahead.\n- Not all agents from `listAgents` are configured for API use. Do not try to run an agent just because it appears in the list \u2014 it will likely fail. Only run agents the user specifically asks you to run."
3898
3902
  });
@@ -4800,7 +4804,7 @@ function isNewerVersion(current, latest) {
4800
4804
  return false;
4801
4805
  }
4802
4806
  async function checkForUpdate() {
4803
- const currentVersion = "0.1.13";
4807
+ const currentVersion = "0.1.15";
4804
4808
  if (!currentVersion) return null;
4805
4809
  try {
4806
4810
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -4829,7 +4833,7 @@ async function checkForUpdate() {
4829
4833
  }
4830
4834
  }
4831
4835
  function printUpdateNotice(latestVersion) {
4832
- const currentVersion = "0.1.13";
4836
+ const currentVersion = "0.1.15";
4833
4837
  process.stderr.write(
4834
4838
  `
4835
4839
  ${ansi.cyanBright("Update available")} ${ansi.gray(currentVersion + " \u2192")} ${ansi.cyanBold(latestVersion)}
@@ -4904,7 +4908,7 @@ async function cmdLogin(options) {
4904
4908
  process.stderr.write("\n");
4905
4909
  printLogo();
4906
4910
  process.stderr.write("\n");
4907
- const ver = "0.1.13";
4911
+ const ver = "0.1.15";
4908
4912
  process.stderr.write(
4909
4913
  ` ${ansi.bold("MindStudio Agent")} ${ver ? " " + ansi.gray("v" + ver) : ""}
4910
4914
  `
package/dist/index.d.ts CHANGED
@@ -545,14 +545,36 @@ declare const Roles: Record<string, string>;
545
545
  * stripped to support either naming convention in table interfaces.
546
546
  */
547
547
  type SystemFields = 'id' | 'created_at' | 'createdAt' | 'updated_at' | 'updatedAt' | 'last_updated_by' | 'lastUpdatedBy';
548
+ /**
549
+ * System columns added to every row on read. This is the concrete shape
550
+ * of the platform-managed columns — used to augment user-defined interfaces
551
+ * so reads include id, timestamps, etc. regardless of whether the user
552
+ * declared them.
553
+ */
554
+ interface SystemColumns {
555
+ id: string;
556
+ created_at: number;
557
+ updated_at: number;
558
+ last_updated_by: string;
559
+ }
560
+ /**
561
+ * A row as returned from the database. Merges the user-defined type T
562
+ * with system columns. If T already includes system columns (e.g., the
563
+ * user declared `id: string`), the intersection is harmless — same type.
564
+ *
565
+ * This ensures TypeScript knows about `id`, `created_at`, etc. on read
566
+ * results even if the user's interface only declares their own fields.
567
+ */
568
+ type Row<T> = T & SystemColumns;
548
569
  /**
549
570
  * Input type for `Table.push()`. Excludes system-managed fields.
550
571
  * Optional fields in T remain optional.
551
572
  *
552
573
  * @example
553
574
  * ```ts
554
- * // If Order has { id, createdAt, updatedAt, lastUpdatedBy, item, amount }
575
+ * // If Order has { item: string; amount: number }
555
576
  * // then PushInput<Order> is { item: string; amount: number }
577
+ * // (system fields like id, created_at are not required)
556
578
  * ```
557
579
  */
558
580
  type PushInput<T> = Omit<T, SystemFields>;
@@ -750,17 +772,17 @@ declare class Table<T> {
750
772
  /** @internal */
751
773
  private readonly _config;
752
774
  constructor(config: TableConfig);
753
- get(id: string): Promise<T | null>;
754
- findOne(predicate: Predicate<T>): Promise<T | null>;
755
- count(predicate?: Predicate<T>): Promise<number>;
756
- some(predicate: Predicate<T>): Promise<boolean>;
757
- every(predicate: Predicate<T>): Promise<boolean>;
775
+ get(id: string): Promise<Row<T> | null>;
776
+ findOne(predicate: Predicate<Row<T>>): Promise<Row<T> | null>;
777
+ count(predicate?: Predicate<Row<T>>): Promise<number>;
778
+ some(predicate: Predicate<Row<T>>): Promise<boolean>;
779
+ every(predicate: Predicate<Row<T>>): Promise<boolean>;
758
780
  isEmpty(): Promise<boolean>;
759
- min(accessor: Accessor<T, number>): Promise<T | null>;
760
- max(accessor: Accessor<T, number>): Promise<T | null>;
761
- groupBy<K extends string | number>(accessor: Accessor<T, K>): Promise<Map<K, T[]>>;
762
- filter(predicate: Predicate<T>): Query<T>;
763
- sortBy(accessor: Accessor<T>): Query<T>;
781
+ min(accessor: Accessor<Row<T>, number>): Promise<Row<T> | null>;
782
+ max(accessor: Accessor<Row<T>, number>): Promise<Row<T> | null>;
783
+ groupBy<K extends string | number>(accessor: Accessor<Row<T>, K>): Promise<Map<K, Row<T>[]>>;
784
+ filter(predicate: Predicate<Row<T>>): Query<Row<T>>;
785
+ sortBy(accessor: Accessor<Row<T>>): Query<Row<T>>;
764
786
  /**
765
787
  * Insert one or more rows. Returns the created row(s) with system fields
766
788
  * populated (id, createdAt, updatedAt, lastUpdatedBy).
@@ -768,18 +790,18 @@ declare class Table<T> {
768
790
  * Uses `INSERT ... RETURNING *` so the created row comes back in a
769
791
  * single round trip — no separate SELECT needed.
770
792
  */
771
- push(data: PushInput<T>): Promise<T>;
772
- push(data: PushInput<T>[]): Promise<T[]>;
793
+ push(data: PushInput<T>): Promise<Row<T>>;
794
+ push(data: PushInput<T>[]): Promise<Row<T>[]>;
773
795
  /**
774
796
  * Update a row by ID. Only the provided fields are changed.
775
797
  * Returns the updated row via `UPDATE ... RETURNING *`.
776
798
  */
777
- update(id: string, data: UpdateInput<T>): Promise<T>;
799
+ update(id: string, data: UpdateInput<T>): Promise<Row<T>>;
778
800
  remove(id: string): Promise<void>;
779
801
  /**
780
802
  * Remove all rows matching a predicate. Returns the count removed.
781
803
  */
782
- removeAll(predicate: Predicate<T>): Promise<number>;
804
+ removeAll(predicate: Predicate<Row<T>>): Promise<number>;
783
805
  clear(): Promise<void>;
784
806
  }
785
807
 
@@ -950,6 +972,8 @@ declare class MindStudioAgent$1 {
950
972
  private _reuseThreadId;
951
973
  /** @internal */
952
974
  private _threadId;
975
+ /** @internal Stream ID for SSE token streaming. Set by sandbox via STREAM_ID env var. */
976
+ private _streamId;
953
977
  /**
954
978
  * @internal App ID for context resolution. Resolved from:
955
979
  * constructor appId → MINDSTUDIO_APP_ID env → sandbox globals →
package/dist/index.js CHANGED
@@ -1827,6 +1827,8 @@ var MindStudioAgent = class {
1827
1827
  _reuseThreadId;
1828
1828
  /** @internal */
1829
1829
  _threadId;
1830
+ /** @internal Stream ID for SSE token streaming. Set by sandbox via STREAM_ID env var. */
1831
+ _streamId;
1830
1832
  // ---- App context (db + auth) ----
1831
1833
  /**
1832
1834
  * @internal App ID for context resolution. Resolved from:
@@ -1867,6 +1869,7 @@ var MindStudioAgent = class {
1867
1869
  if (authType === "internal") {
1868
1870
  this._trySandboxHydration();
1869
1871
  }
1872
+ this._streamId = process.env.STREAM_ID ?? void 0;
1870
1873
  }
1871
1874
  /**
1872
1875
  * Execute any step by its type name. This is the low-level method that all
@@ -1882,7 +1885,8 @@ var MindStudioAgent = class {
1882
1885
  const { data, headers } = await request(this._httpConfig, "POST", `/steps/${stepType}/execute`, {
1883
1886
  step,
1884
1887
  ...options?.appId != null && { appId: options.appId },
1885
- ...threadId != null && { threadId }
1888
+ ...threadId != null && { threadId },
1889
+ ...this._streamId != null && { streamId: this._streamId }
1886
1890
  });
1887
1891
  let output;
1888
1892
  if (data.output != null) {