@mindstudio-ai/agent 0.1.15 → 0.1.16

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.
@@ -3469,6 +3469,46 @@ var init_client = __esm({
3469
3469
  return data;
3470
3470
  }
3471
3471
  // -------------------------------------------------------------------------
3472
+ // Streaming
3473
+ // -------------------------------------------------------------------------
3474
+ /**
3475
+ * Send a stream chunk to the caller via SSE.
3476
+ *
3477
+ * When invoked from a method that was called with `stream: true`, chunks
3478
+ * are delivered in real-time as Server-Sent Events. When there is no active
3479
+ * stream (no `STREAM_ID`), calls are silently ignored — so it's safe to
3480
+ * call unconditionally.
3481
+ *
3482
+ * Accepts strings (sent as `type: 'token'`) or structured data (sent as
3483
+ * `type: 'data'`). The caller receives each chunk as an SSE event.
3484
+ *
3485
+ * @example
3486
+ * ```ts
3487
+ * // Stream text tokens
3488
+ * await agent.stream('Processing item 1...');
3489
+ *
3490
+ * // Stream structured data
3491
+ * await agent.stream({ progress: 50, currentItem: 'abc' });
3492
+ * ```
3493
+ */
3494
+ stream = async (data) => {
3495
+ if (!this._streamId) return;
3496
+ const url = `${this._httpConfig.baseUrl}/_internal/v2/stream-chunk`;
3497
+ const body = typeof data === "string" ? { streamId: this._streamId, type: "token", text: data } : { streamId: this._streamId, type: "data", data };
3498
+ const res = await fetch(url, {
3499
+ method: "POST",
3500
+ headers: {
3501
+ "Content-Type": "application/json",
3502
+ Authorization: this._httpConfig.token
3503
+ },
3504
+ body: JSON.stringify(body)
3505
+ });
3506
+ if (!res.ok) {
3507
+ const text = await res.text().catch(() => "");
3508
+ console.warn(`[mindstudio] stream chunk failed: ${res.status} ${text}`);
3509
+ }
3510
+ };
3511
+ // -------------------------------------------------------------------------
3472
3512
  // db + auth namespaces
3473
3513
  // -------------------------------------------------------------------------
3474
3514
  /**
@@ -3896,7 +3936,7 @@ async function startMcpServer(options) {
3896
3936
  capabilities: { tools: {} },
3897
3937
  serverInfo: {
3898
3938
  name: "mindstudio-agent",
3899
- version: "0.1.15"
3939
+ version: "0.1.16"
3900
3940
  },
3901
3941
  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."
3902
3942
  });
@@ -4716,7 +4756,7 @@ function isNewerVersion(current, latest) {
4716
4756
  return false;
4717
4757
  }
4718
4758
  async function checkForUpdate() {
4719
- const currentVersion = "0.1.15";
4759
+ const currentVersion = "0.1.16";
4720
4760
  if (!currentVersion) return null;
4721
4761
  try {
4722
4762
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -4745,7 +4785,7 @@ async function checkForUpdate() {
4745
4785
  }
4746
4786
  }
4747
4787
  function printUpdateNotice(latestVersion) {
4748
- const currentVersion = "0.1.15";
4788
+ const currentVersion = "0.1.16";
4749
4789
  process.stderr.write(
4750
4790
  `
4751
4791
  ${ansi.cyanBright("Update available")} ${ansi.gray(currentVersion + " \u2192")} ${ansi.cyanBold(latestVersion)}
@@ -4800,7 +4840,7 @@ async function cmdLogin(options) {
4800
4840
  process.stderr.write("\n");
4801
4841
  printLogo();
4802
4842
  process.stderr.write("\n");
4803
- const ver = "0.1.15";
4843
+ const ver = "0.1.16";
4804
4844
  process.stderr.write(
4805
4845
  ` ${ansi.bold("MindStudio Agent")} ${ver ? " " + ansi.gray("v" + ver) : ""}
4806
4846
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",