@mindstudio-ai/agent 0.1.163 → 0.1.164

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.
@@ -2413,6 +2413,25 @@ function nestedComparison(node, negated, params) {
2413
2413
  function withNulls(core, field, nullsMatch) {
2414
2414
  return nullsMatch ? `(${core} OR ${field.sql} IS NULL)` : core;
2415
2415
  }
2416
+ function readsBackAsWritten(value) {
2417
+ if (typeof value !== "string") {
2418
+ return false;
2419
+ }
2420
+ try {
2421
+ JSON.parse(value);
2422
+ return false;
2423
+ } catch {
2424
+ return true;
2425
+ }
2426
+ }
2427
+ function jsonColumnIn(field, values, negated, params) {
2428
+ params.push(JSON.stringify(values.flatMap((v) => [v, JSON.stringify(v)])));
2429
+ return withNulls(
2430
+ `${field.sql} ${negated ? "NOT IN" : "IN"} (SELECT value FROM json_each(?))`,
2431
+ field,
2432
+ negated
2433
+ );
2434
+ }
2416
2435
  function compileNode(node, negated, columns, params) {
2417
2436
  const column = (field) => field.nested ? void 0 : columns.find((c) => c.name === field.column);
2418
2437
  const stored = (field, value) => field.nested ? serializeColumnParam(value, "", []) : serializeColumnParam(value, field.column, columns);
@@ -2430,6 +2449,10 @@ function compileNode(node, negated, columns, params) {
2430
2449
  return nestedComparison(node, negated, params);
2431
2450
  }
2432
2451
  const type = column(node.field)?.type;
2452
+ if (type === "json") {
2453
+ const strictEquals = node.op === "===" ? !negated : node.op === "!==" ? negated : null;
2454
+ return strictEquals !== null && readsBackAsWritten(node.value) ? jsonColumnIn(node.field, [node.value], !strictEquals, params) : null;
2455
+ }
2433
2456
  if (!type || typeof node.value !== VALUE_KIND[type]) {
2434
2457
  return null;
2435
2458
  }
@@ -2450,10 +2473,16 @@ function compileNode(node, negated, columns, params) {
2450
2473
  return null;
2451
2474
  }
2452
2475
  const isNull = negated ? !node.isNull : node.isNull;
2476
+ if (column(node.field)?.type === "json") {
2477
+ return isNull ? `(${node.field.sql} IS NULL OR ${node.field.sql} = 'null')` : `(${node.field.sql} IS NOT NULL AND ${node.field.sql} <> 'null')`;
2478
+ }
2453
2479
  return `${node.field.sql} ${isNull ? "IS NULL" : "IS NOT NULL"}`;
2454
2480
  }
2455
2481
  case "in": {
2456
2482
  const type = column(node.field)?.type;
2483
+ if (type === "json") {
2484
+ return node.values.every(readsBackAsWritten) ? jsonColumnIn(node.field, node.values, negated, params) : null;
2485
+ }
2457
2486
  if (!type || node.values.some(
2458
2487
  (v) => v !== null && v !== void 0 && typeof v !== VALUE_KIND[type]
2459
2488
  )) {
@@ -2473,6 +2502,7 @@ function compileNode(node, negated, columns, params) {
2473
2502
  case "includes": {
2474
2503
  const type = column(node.field)?.type;
2475
2504
  if (type === "json") {
2505
+ const col = node.field.sql;
2476
2506
  let element;
2477
2507
  if (typeof node.needle === "boolean") {
2478
2508
  element = `type = '${node.needle}'`;
@@ -2480,7 +2510,9 @@ function compileNode(node, negated, columns, params) {
2480
2510
  params.push(node.needle);
2481
2511
  element = `type IN ${JSON_TYPES[typeof node.needle]} AND value = ?`;
2482
2512
  }
2483
- return `(json_type(${node.field.sql}) = 'array' AND ${negated ? "NOT EXISTS" : "EXISTS"} (SELECT 1 FROM json_each(${node.field.sql}) WHERE ${element}))`;
2513
+ const substring = `${negated ? "=" : ">"} 0`;
2514
+ params.push(String(node.needle), String(node.needle));
2515
+ return `(CASE WHEN json_valid(${col}) THEN CASE json_type(${col}) WHEN 'array' THEN ${negated ? "NOT EXISTS" : "EXISTS"} (SELECT 1 FROM json_each(${col}) WHERE ${element}) WHEN 'text' THEN instr(${col} ->> '$', ?) ${substring} ELSE 0 END ELSE instr(${col}, ?) ${substring} END)`;
2484
2516
  }
2485
2517
  if ((type === "text" || type === "user") && typeof node.needle === "string") {
2486
2518
  params.push(node.needle);
@@ -9402,7 +9434,7 @@ async function startMcpServer(options) {
9402
9434
  capabilities: { tools: {} },
9403
9435
  serverInfo: {
9404
9436
  name: "mindstudio-agent",
9405
- version: "0.1.163"
9437
+ version: "0.1.164"
9406
9438
  },
9407
9439
  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, pass its public image URL to `changeProfilePicture`.\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.'
9408
9440
  });
@@ -10329,7 +10361,7 @@ function isNewerVersion(current, latest) {
10329
10361
  return false;
10330
10362
  }
10331
10363
  async function checkForUpdate() {
10332
- const currentVersion = "0.1.163";
10364
+ const currentVersion = "0.1.164";
10333
10365
  if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
10334
10366
  return null;
10335
10367
  }
@@ -10364,7 +10396,7 @@ async function checkForUpdate() {
10364
10396
  }
10365
10397
  }
10366
10398
  function printUpdateNotice(latestVersion) {
10367
- const currentVersion = "0.1.163";
10399
+ const currentVersion = "0.1.164";
10368
10400
  process.stderr.write(
10369
10401
  `
10370
10402
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -10377,7 +10409,7 @@ function isStandaloneBinary() {
10377
10409
  return !argv1.includes("node_modules");
10378
10410
  }
10379
10411
  async function cmdUpdate() {
10380
- const currentVersion = "0.1.163";
10412
+ const currentVersion = "0.1.164";
10381
10413
  process.stderr.write(
10382
10414
  ` ${ansi2.gray("Current version:")} ${currentVersion}
10383
10415
  `
@@ -10498,7 +10530,7 @@ async function cmdLogin(options) {
10498
10530
  process.stderr.write("\n");
10499
10531
  printLogo();
10500
10532
  process.stderr.write("\n");
10501
- const ver = "0.1.163";
10533
+ const ver = "0.1.164";
10502
10534
  process.stderr.write(
10503
10535
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
10504
10536
  `
@@ -10810,7 +10842,7 @@ async function main() {
10810
10842
  const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
10811
10843
  try {
10812
10844
  if (command === "version" || command === "-v") {
10813
- process.stdout.write("0.1.163\n");
10845
+ process.stdout.write("0.1.164\n");
10814
10846
  return;
10815
10847
  }
10816
10848
  if (command === "login") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.163",
3
+ "version": "0.1.164",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,8 @@
17
17
  },
18
18
  "files": [
19
19
  "dist",
20
- "llms.txt"
20
+ "llms.txt",
21
+ "CHANGELOG.md"
21
22
  ],
22
23
  "scripts": {
23
24
  "build": "npm run codegen && tsup",