@mastra/code-sdk 1.20.0 → 1.21.0-alpha.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"binaries.d.ts","sourceRoot":"","sources":["../../src/utils/binaries.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAmDD,wBAAgB,oBAAoB,IAAI,YAAY,EAAE,CAOrD;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAiBzE"}
1
+ {"version":3,"file":"binaries.d.ts","sourceRoot":"","sources":["../../src/utils/binaries.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAyED,wBAAgB,oBAAoB,IAAI,YAAY,EAAE,CAIrD;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAczE"}
@@ -1,3 +1,5 @@
1
+ import { basename, dirname, join } from "path";
2
+ import { realpathSync } from "fs";
1
3
  import { execFile, execFileSync } from "child_process";
2
4
  // src/utils/binaries.ts
3
5
  const COMMON_BINARIES = [
@@ -22,12 +24,33 @@ const COMMON_BINARIES = [
22
24
  "rustc",
23
25
  "cargo"
24
26
  ];
27
+ /**
28
+ * The directory the tool lives in, with the name `which` reported still on the end.
29
+ *
30
+ * Version managers can put a directory first on PATH whose name changes on every shell (`fnm` builds one per
31
+ * shell, `fnm_multishells/<pid>_<epoch-ms>`). These paths are part of the system prompt, so a directory that
32
+ * changes from launch to launch changes that text even when the tools have not. Resolving the whole
33
+ * file instead would name the program behind a shim - `mise` points every tool at itself, BusyBox and
34
+ * OrbStack do the same for some tools, and a Homebrew link names `Cellar/<version>` - which either does not
35
+ * run the tool or changes on every upgrade. Resolving only the directory gives the stable installation and
36
+ * keeps a name that runs the tool.
37
+ */
38
+ function stablePath(path) {
39
+ if (!path) return path;
40
+ try {
41
+ return join(realpathSync(dirname(path)), basename(path));
42
+ } catch {
43
+ return path;
44
+ }
45
+ }
25
46
  let cachedBinaries = null;
26
47
  let inFlightPromise = null;
27
- function resolveBinary(name) {
28
- const command = process.platform === "win32" ? "where" : "which";
48
+ function whichCommand() {
49
+ return process.platform === "win32" ? "where" : "which";
50
+ }
51
+ function reportedBinary(name) {
29
52
  try {
30
- return execFileSync(command, [name], {
53
+ return execFileSync(whichCommand(), [name], {
31
54
  encoding: "utf-8",
32
55
  stdio: [
33
56
  "pipe",
@@ -39,10 +62,9 @@ function resolveBinary(name) {
39
62
  return null;
40
63
  }
41
64
  }
42
- function resolveBinaryAsync(name) {
43
- const command = process.platform === "win32" ? "where" : "which";
65
+ function reportedBinaryAsync(name) {
44
66
  return new Promise((resolve) => {
45
- execFile(command, [name], { encoding: "utf-8" }, (err, stdout) => {
67
+ execFile(whichCommand(), [name], { encoding: "utf-8" }, (err, stdout) => {
46
68
  if (err) {
47
69
  resolve(null);
48
70
  return;
@@ -54,7 +76,7 @@ function resolveBinaryAsync(name) {
54
76
  function detectCommonBinaries() {
55
77
  cachedBinaries ??= COMMON_BINARIES.map((name) => ({
56
78
  name,
57
- path: resolveBinary(name)
79
+ path: stablePath(reportedBinary(name))
58
80
  }));
59
81
  return cachedBinaries;
60
82
  }
@@ -63,7 +85,7 @@ async function detectCommonBinariesAsync() {
63
85
  if (inFlightPromise) return inFlightPromise;
64
86
  inFlightPromise = Promise.all(COMMON_BINARIES.map(async (name) => ({
65
87
  name,
66
- path: await resolveBinaryAsync(name)
88
+ path: stablePath(await reportedBinaryAsync(name))
67
89
  })));
68
90
  try {
69
91
  cachedBinaries = await inFlightPromise;
@@ -1 +1 @@
1
- {"version":3,"file":"binaries.js","names":[],"sources":["../../src/utils/binaries.ts"],"sourcesContent":["import { execFile, execFileSync } from 'node:child_process';\n\nexport interface CommonBinary {\n name: string;\n path: string | null;\n}\n\nconst COMMON_BINARIES = [\n 'python',\n 'python3',\n 'node',\n 'npm',\n 'pnpm',\n 'yarn',\n 'bun',\n 'git',\n 'rg',\n 'fd',\n 'fdfind',\n 'curl',\n 'wget',\n 'docker',\n 'make',\n 'gcc',\n 'g++',\n 'go',\n 'rustc',\n 'cargo',\n] as const;\n\nlet cachedBinaries: CommonBinary[] | null = null;\nlet inFlightPromise: Promise<CommonBinary[]> | null = null;\n\nfunction resolveBinary(name: string): string | null {\n const command = process.platform === 'win32' ? 'where' : 'which';\n try {\n const output = execFileSync(command, [name], { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();\n return output.split(/\\r?\\n/)[0] || null;\n } catch {\n return null;\n }\n}\n\nfunction resolveBinaryAsync(name: string): Promise<string | null> {\n const command = process.platform === 'win32' ? 'where' : 'which';\n return new Promise(resolve => {\n execFile(command, [name], { encoding: 'utf-8' }, (err, stdout) => {\n if (err) {\n resolve(null);\n return;\n }\n resolve(stdout.trim().split(/\\r?\\n/)[0] || null);\n });\n });\n}\n\nexport function detectCommonBinaries(): CommonBinary[] {\n cachedBinaries ??= COMMON_BINARIES.map(name => ({\n name,\n path: resolveBinary(name),\n }));\n\n return cachedBinaries;\n}\n\nexport async function detectCommonBinariesAsync(): Promise<CommonBinary[]> {\n if (cachedBinaries) return cachedBinaries;\n if (inFlightPromise) return inFlightPromise;\n\n inFlightPromise = Promise.all(\n COMMON_BINARIES.map(async name => ({\n name,\n path: await resolveBinaryAsync(name),\n })),\n );\n\n try {\n cachedBinaries = await inFlightPromise;\n return cachedBinaries;\n } finally {\n inFlightPromise = null;\n }\n}\n"],"mappings":";;AAOA,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAI,iBAAwC;AAC5C,IAAI,kBAAkD;AAEtD,SAAS,cAAc,MAA6B;CAClD,MAAM,UAAU,QAAQ,aAAa,UAAU,UAAU;CACzD,IAAI;EAEF,OADe,aAAa,SAAS,CAAC,IAAI,GAAG;GAAE,UAAU;GAAS,OAAO;IAAC;IAAQ;IAAQ;GAAM;EAAE,CAAC,CAAC,CAAC,KACzF,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,MAAM;CACrC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,mBAAmB,MAAsC;CAChE,MAAM,UAAU,QAAQ,aAAa,UAAU,UAAU;CACzD,OAAO,IAAI,SAAQ,YAAW;EAC5B,SAAS,SAAS,CAAC,IAAI,GAAG,EAAE,UAAU,QAAQ,IAAI,KAAK,WAAW;GAChE,IAAI,KAAK;IACP,QAAQ,IAAI;IACZ;GACF;GACA,QAAQ,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,MAAM,IAAI;EACjD,CAAC;CACH,CAAC;AACH;AAEA,SAAgB,uBAAuC;CACrD,mBAAmB,gBAAgB,KAAI,UAAS;EAC9C;EACA,MAAM,cAAc,IAAI;CAC1B,EAAE;CAEF,OAAO;AACT;AAEA,eAAsB,4BAAqD;CACzE,IAAI,gBAAgB,OAAO;CAC3B,IAAI,iBAAiB,OAAO;CAE5B,kBAAkB,QAAQ,IACxB,gBAAgB,IAAI,OAAM,UAAS;EACjC;EACA,MAAM,MAAM,mBAAmB,IAAI;CACrC,EAAE,CACJ;CAEA,IAAI;EACF,iBAAiB,MAAM;EACvB,OAAO;CACT,UAAU;EACR,kBAAkB;CACpB;AACF"}
1
+ {"version":3,"file":"binaries.js","names":[],"sources":["../../src/utils/binaries.ts"],"sourcesContent":["import { execFile, execFileSync } from 'node:child_process';\nimport { realpathSync } from 'node:fs';\nimport { basename, dirname, join } from 'node:path';\n\nexport interface CommonBinary {\n name: string;\n path: string | null;\n}\n\nconst COMMON_BINARIES = [\n 'python',\n 'python3',\n 'node',\n 'npm',\n 'pnpm',\n 'yarn',\n 'bun',\n 'git',\n 'rg',\n 'fd',\n 'fdfind',\n 'curl',\n 'wget',\n 'docker',\n 'make',\n 'gcc',\n 'g++',\n 'go',\n 'rustc',\n 'cargo',\n] as const;\n\n/**\n * The directory the tool lives in, with the name `which` reported still on the end.\n *\n * Version managers can put a directory first on PATH whose name changes on every shell (`fnm` builds one per\n * shell, `fnm_multishells/<pid>_<epoch-ms>`). These paths are part of the system prompt, so a directory that\n * changes from launch to launch changes that text even when the tools have not. Resolving the whole\n * file instead would name the program behind a shim - `mise` points every tool at itself, BusyBox and\n * OrbStack do the same for some tools, and a Homebrew link names `Cellar/<version>` - which either does not\n * run the tool or changes on every upgrade. Resolving only the directory gives the stable installation and\n * keeps a name that runs the tool.\n */\nfunction stablePath(path: string | null): string | null {\n if (!path) return path;\n try {\n return join(realpathSync(dirname(path)), basename(path));\n } catch {\n return path;\n }\n}\n\nlet cachedBinaries: CommonBinary[] | null = null;\nlet inFlightPromise: Promise<CommonBinary[]> | null = null;\n\nfunction whichCommand(): string {\n return process.platform === 'win32' ? 'where' : 'which';\n}\n\nfunction reportedBinary(name: string): string | null {\n try {\n const output = execFileSync(whichCommand(), [name], { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();\n return output.split(/\\r?\\n/)[0] || null;\n } catch {\n return null;\n }\n}\n\nfunction reportedBinaryAsync(name: string): Promise<string | null> {\n return new Promise(resolve => {\n execFile(whichCommand(), [name], { encoding: 'utf-8' }, (err, stdout) => {\n if (err) {\n resolve(null);\n return;\n }\n resolve(stdout.trim().split(/\\r?\\n/)[0] || null);\n });\n });\n}\n\nexport function detectCommonBinaries(): CommonBinary[] {\n cachedBinaries ??= COMMON_BINARIES.map(name => ({ name, path: stablePath(reportedBinary(name)) }));\n\n return cachedBinaries;\n}\n\nexport async function detectCommonBinariesAsync(): Promise<CommonBinary[]> {\n if (cachedBinaries) return cachedBinaries;\n if (inFlightPromise) return inFlightPromise;\n\n inFlightPromise = Promise.all(\n COMMON_BINARIES.map(async name => ({ name, path: stablePath(await reportedBinaryAsync(name)) })),\n );\n\n try {\n cachedBinaries = await inFlightPromise;\n return cachedBinaries;\n } finally {\n inFlightPromise = null;\n }\n}\n"],"mappings":";;;;AASA,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;;AAaA,SAAS,WAAW,MAAoC;CACtD,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI;EACF,OAAO,KAAK,aAAa,QAAQ,IAAI,CAAC,GAAG,SAAS,IAAI,CAAC;CACzD,QAAQ;EACN,OAAO;CACT;AACF;AAEA,IAAI,iBAAwC;AAC5C,IAAI,kBAAkD;AAEtD,SAAS,eAAuB;CAC9B,OAAO,QAAQ,aAAa,UAAU,UAAU;AAClD;AAEA,SAAS,eAAe,MAA6B;CACnD,IAAI;EAEF,OADe,aAAa,aAAa,GAAG,CAAC,IAAI,GAAG;GAAE,UAAU;GAAS,OAAO;IAAC;IAAQ;IAAQ;GAAM;EAAE,CAAC,CAAC,CAAC,KAChG,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,MAAM;CACrC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,oBAAoB,MAAsC;CACjE,OAAO,IAAI,SAAQ,YAAW;EAC5B,SAAS,aAAa,GAAG,CAAC,IAAI,GAAG,EAAE,UAAU,QAAQ,IAAI,KAAK,WAAW;GACvE,IAAI,KAAK;IACP,QAAQ,IAAI;IACZ;GACF;GACA,QAAQ,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,MAAM,IAAI;EACjD,CAAC;CACH,CAAC;AACH;AAEA,SAAgB,uBAAuC;CACrD,mBAAmB,gBAAgB,KAAI,UAAS;EAAE;EAAM,MAAM,WAAW,eAAe,IAAI,CAAC;CAAE,EAAE;CAEjG,OAAO;AACT;AAEA,eAAsB,4BAAqD;CACzE,IAAI,gBAAgB,OAAO;CAC3B,IAAI,iBAAiB,OAAO;CAE5B,kBAAkB,QAAQ,IACxB,gBAAgB,IAAI,OAAM,UAAS;EAAE;EAAM,MAAM,WAAW,MAAM,oBAAoB,IAAI,CAAC;CAAE,EAAE,CACjG;CAEA,IAAI;EACF,iBAAiB,MAAM;EACvB,OAAO;CACT,UAAU;EACR,kBAAkB;CACpB;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/code-sdk",
3
- "version": "1.20.0",
3
+ "version": "1.21.0-alpha.1",
4
4
  "description": "Mastra Code SDK: the agent core behind Mastra Code (everything except the TUI) — build your own UIs and surfaces on top of it",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -64,16 +64,16 @@
64
64
  "yaml": "^2.9.1",
65
65
  "zod": "^4.6.7",
66
66
  "@mastra/agent-browser": "0.6.0",
67
- "@mastra/client-js": "1.61.1",
67
+ "@mastra/client-js": "1.61.2-alpha.1",
68
68
  "@mastra/duckdb": "1.19.1",
69
- "@mastra/fastembed": "1.3.7",
69
+ "@mastra/fastembed": "1.4.0-alpha.0",
70
70
  "@mastra/github-signals": "0.5.3",
71
- "@mastra/mcp": "2.10.0",
72
71
  "@mastra/libsql": "1.31.1",
73
- "@mastra/memory": "1.41.2",
74
- "@mastra/observability": "1.24.2",
72
+ "@mastra/mcp": "2.10.1-alpha.0",
73
+ "@mastra/memory": "1.41.3-alpha.0",
74
+ "@mastra/observability": "1.24.3-alpha.0",
75
75
  "@mastra/parallel": "0.1.5",
76
- "@mastra/pg": "1.37.0",
76
+ "@mastra/pg": "1.37.1-alpha.0",
77
77
  "@mastra/schema-compat": "1.4.0",
78
78
  "@mastra/stagehand": "0.4.0",
79
79
  "@mastra/tavily": "1.1.3",
@@ -94,10 +94,10 @@
94
94
  "@internal/lint": "0.0.151",
95
95
  "@internal/types-builder": "0.0.126",
96
96
  "@internal/workspace-test-utils": "0.0.95",
97
- "@mastra/core": "1.85.0"
97
+ "@mastra/core": "1.86.0-alpha.1"
98
98
  },
99
99
  "peerDependencies": {
100
- "@mastra/core": ">=1.84.0-0 <2.0.0-0"
100
+ "@mastra/core": ">=1.85.1-0 <2.0.0-0"
101
101
  },
102
102
  "engines": {
103
103
  "node": ">=22.19.0"