@mindstudio-ai/agent 0.1.23 → 0.1.25

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/README.md CHANGED
@@ -96,6 +96,15 @@ $ mindstudio generate-image --prompt "A mountain landscape at sunset"
96
96
  {"imageUrl":"https://...","$billingCost":5000000}
97
97
  ```
98
98
 
99
+ For AI agents, use `--json-logs` to get structured debug logs on stderr:
100
+
101
+ ```bash
102
+ mindstudio generate-image --prompt "a cat" --json-logs
103
+ # stderr: {"type":"log","value":"Generating image with DALL·E 3...","tag":"Generate Image","ts":1774270499100}
104
+ # stderr: {"type":"log","value":"Image generated successfully","tag":"Generate Image","ts":1774270502300}
105
+ # stdout: {"imageUrl":"https://...","$billingCost":5000000}
106
+ ```
107
+
99
108
  Run via `npx` without installing:
100
109
 
101
110
  ```bash
package/dist/cli.js CHANGED
@@ -4806,7 +4806,7 @@ async function startMcpServer(options) {
4806
4806
  capabilities: { tools: {} },
4807
4807
  serverInfo: {
4808
4808
  name: "mindstudio-agent",
4809
- version: "0.1.23"
4809
+ version: "0.1.25"
4810
4810
  },
4811
4811
  instructions: 'Welcome to MindStudio \u2014 a platform with 200+ AI models, 850+ third-party integrations, and pre-built agents.\n\nGetting started:\n1. Call `ask` with any question about the SDK \u2014 it knows every action, model, and connector and returns working code with real model IDs and config options. Examples: ask("generate an image with FLUX"), ask("what models support vision?"), ask("how do I send a Slack message?").\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.\n4. For manual browsing, 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.'
4812
4812
  });
@@ -5291,6 +5291,7 @@ Options:
5291
5291
  --thread-id <id> Thread ID for state persistence
5292
5292
  --output-key <key> Extract a single field from the result
5293
5293
  --no-meta Strip $-prefixed metadata from output
5294
+ --json-logs Stream debug logs as JSONL to stderr
5294
5295
  --workflow <name> Workflow to execute (run-agent only)
5295
5296
  --version <ver> App version, e.g. "draft" (run-agent only)
5296
5297
  --json Output as JSON
@@ -5504,15 +5505,25 @@ async function cmdExec(method, input, options) {
5504
5505
  `Unknown action: ${method}. Run 'mindstudio list-actions' to see available actions.`
5505
5506
  );
5506
5507
  }
5507
- const result = await agent.executeStep(meta.stepType, input, {
5508
- appId: options.appId,
5509
- threadId: options.threadId,
5510
- onLog: process.stderr.isTTY ? (log) => {
5508
+ let onLog;
5509
+ if (options.jsonLogs) {
5510
+ onLog = (log) => {
5511
+ process.stderr.write(
5512
+ JSON.stringify({ type: "log", value: log.value, tag: log.tag, ts: log.ts }) + "\n"
5513
+ );
5514
+ };
5515
+ } else if (process.stderr.isTTY) {
5516
+ onLog = (log) => {
5511
5517
  process.stderr.write(
5512
5518
  ` ${ansi2.cyan("\u27E1")} ${ansi2.gray(log.value)}
5513
5519
  `
5514
5520
  );
5515
- } : void 0
5521
+ };
5522
+ }
5523
+ const result = await agent.executeStep(meta.stepType, input, {
5524
+ appId: options.appId,
5525
+ threadId: options.threadId,
5526
+ onLog
5516
5527
  });
5517
5528
  if (options.outputKey) {
5518
5529
  const val = result[options.outputKey];
@@ -5747,7 +5758,7 @@ function isNewerVersion(current, latest) {
5747
5758
  return false;
5748
5759
  }
5749
5760
  async function checkForUpdate() {
5750
- const currentVersion = "0.1.23";
5761
+ const currentVersion = "0.1.25";
5751
5762
  if (!currentVersion) return null;
5752
5763
  try {
5753
5764
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -5776,7 +5787,7 @@ async function checkForUpdate() {
5776
5787
  }
5777
5788
  }
5778
5789
  function printUpdateNotice(latestVersion) {
5779
- const currentVersion = "0.1.23";
5790
+ const currentVersion = "0.1.25";
5780
5791
  process.stderr.write(
5781
5792
  `
5782
5793
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -5789,7 +5800,7 @@ function isStandaloneBinary() {
5789
5800
  return !argv1.includes("node_modules");
5790
5801
  }
5791
5802
  async function cmdUpdate() {
5792
- const currentVersion = "0.1.23";
5803
+ const currentVersion = "0.1.25";
5793
5804
  process.stderr.write(
5794
5805
  ` ${ansi2.gray("Current version:")} ${currentVersion}
5795
5806
  `
@@ -5924,7 +5935,7 @@ async function cmdLogin(options) {
5924
5935
  process.stderr.write("\n");
5925
5936
  printLogo();
5926
5937
  process.stderr.write("\n");
5927
- const ver = "0.1.23";
5938
+ const ver = "0.1.25";
5928
5939
  process.stderr.write(
5929
5940
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
5930
5941
  `
@@ -6147,7 +6158,13 @@ function parseStepFlags(argv) {
6147
6158
  const result = {};
6148
6159
  for (let i = 0; i < argv.length; i++) {
6149
6160
  const arg = argv[i];
6150
- if (arg.startsWith("--") && i + 1 < argv.length) {
6161
+ if (!arg.startsWith("--")) continue;
6162
+ if (GLOBAL_BOOLEAN_FLAGS.has(arg)) continue;
6163
+ if (GLOBAL_STRING_FLAGS.has(arg)) {
6164
+ i++;
6165
+ continue;
6166
+ }
6167
+ if (i + 1 < argv.length) {
6151
6168
  const key = arg.slice(2);
6152
6169
  result[kebabToCamel2(key)] = coerce(argv[++i]);
6153
6170
  }
@@ -6163,6 +6180,13 @@ var GLOBAL_STRING_FLAGS = /* @__PURE__ */ new Set([
6163
6180
  "--workflow",
6164
6181
  "--version"
6165
6182
  ]);
6183
+ var GLOBAL_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
6184
+ "--no-meta",
6185
+ "--json-logs",
6186
+ "--json",
6187
+ "--summary",
6188
+ "--help"
6189
+ ]);
6166
6190
  function findMethodSplit(argv) {
6167
6191
  let startIdx = 0;
6168
6192
  let hasRun = false;
@@ -6205,6 +6229,7 @@ async function main() {
6205
6229
  "thread-id": { type: "string" },
6206
6230
  "output-key": { type: "string" },
6207
6231
  "no-meta": { type: "boolean", default: false },
6232
+ "json-logs": { type: "boolean", default: false },
6208
6233
  workflow: { type: "string" },
6209
6234
  version: { type: "string" },
6210
6235
  type: { type: "string" },
@@ -6237,7 +6262,7 @@ async function main() {
6237
6262
  try {
6238
6263
  if (command === "version" || command === "-v") {
6239
6264
  process.stdout.write(
6240
- "0.1.23\n"
6265
+ "0.1.25\n"
6241
6266
  );
6242
6267
  return;
6243
6268
  }
@@ -6658,7 +6683,8 @@ async function main() {
6658
6683
  appId: values["app-id"],
6659
6684
  threadId: values["thread-id"],
6660
6685
  outputKey: values["output-key"],
6661
- noMeta: values["no-meta"]
6686
+ noMeta: values["no-meta"],
6687
+ jsonLogs: values["json-logs"]
6662
6688
  });
6663
6689
  } catch (err) {
6664
6690
  const message = err instanceof Error ? err.message : String(err);