@mastra/code-sdk 1.1.2-alpha.4 → 1.1.2-alpha.6
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/CHANGELOG.md +31 -0
- package/dist/agents/prompts/agent-instructions.d.ts +5 -3
- package/dist/agents/prompts/agent-instructions.d.ts.map +1 -1
- package/dist/agents/prompts/agent-instructions.js +4 -4
- package/dist/agents/prompts/agent-instructions.js.map +1 -1
- package/dist/agents/prompts/index.d.ts.map +1 -1
- package/dist/agents/prompts/index.js +2 -1
- package/dist/agents/prompts/index.js.map +1 -1
- package/dist/schema.d.ts +7 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +1 -0
- package/dist/schema.js.map +1 -1
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @mastra/code-sdk
|
|
2
2
|
|
|
3
|
+
## 1.1.2-alpha.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added `skipGlobalInstructions` to session state. When set, a session ignores the agent instruction files in the machine's home directory (`~/.claude/CLAUDE.md`, `~/.mastracode/AGENTS.md`, and the other supported locations) and reads only the ones in the project it works on. Servers that run sessions on behalf of other people set it so a run never inherits the personal configuration of whoever hosts the process. ([#20633](https://github.com/mastra-ai/mastra/pull/20633))
|
|
8
|
+
|
|
9
|
+
Seed it on the controller to cover every session it creates:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
prepareAgentControllerMount({
|
|
13
|
+
initialState: { skipGlobalInstructions: true },
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Sessions you drive yourself are unaffected and still read your home directory instructions.
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`a19e5b7`](https://github.com/mastra-ai/mastra/commit/a19e5b79b76fffa92f9cf17e0e89c3fa714534e8), [`82201f7`](https://github.com/mastra-ai/mastra/commit/82201f75fae8e050a8de2df08b74875ee74c6b83), [`19ccefa`](https://github.com/mastra-ai/mastra/commit/19ccefa628dc971b4bfa2058a324a6ac9b846358), [`19ccefa`](https://github.com/mastra-ai/mastra/commit/19ccefa628dc971b4bfa2058a324a6ac9b846358), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`0a6598b`](https://github.com/mastra-ai/mastra/commit/0a6598bde80bde008986ad6616bed9632b9294cb), [`9e1dad8`](https://github.com/mastra-ai/mastra/commit/9e1dad8f7b1cab2bb7ade90e5b7561f24577b88a), [`2f43145`](https://github.com/mastra-ai/mastra/commit/2f4314504c03cbba280414ac81ba3197448ee6b0), [`34d34d8`](https://github.com/mastra-ai/mastra/commit/34d34d8c811df512fef4dd5459f79b7821be1866), [`f6e002c`](https://github.com/mastra-ai/mastra/commit/f6e002c9e15eda94fcb35c350c60f9bba1b823d4), [`34d34d8`](https://github.com/mastra-ai/mastra/commit/34d34d8c811df512fef4dd5459f79b7821be1866)]:
|
|
20
|
+
- @mastra/mcp@1.15.1-alpha.1
|
|
21
|
+
- @mastra/core@1.56.0-alpha.6
|
|
22
|
+
- @mastra/pg@1.19.0-alpha.3
|
|
23
|
+
- @mastra/libsql@1.19.0-alpha.2
|
|
24
|
+
- @mastra/duckdb@1.6.0-alpha.0
|
|
25
|
+
- @mastra/memory@1.25.0-alpha.2
|
|
26
|
+
|
|
27
|
+
## 1.1.2-alpha.5
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`db4e6ff`](https://github.com/mastra-ai/mastra/commit/db4e6ff744503112eb64deeaf6c2b54bf26a54c7), [`6d19a65`](https://github.com/mastra-ai/mastra/commit/6d19a6517f5da3911023d446b7e2d5dad8adb1cb)]:
|
|
32
|
+
- @mastra/core@1.56.0-alpha.5
|
|
33
|
+
|
|
3
34
|
## 1.1.2-alpha.4
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -47,10 +47,12 @@ export declare function createGitRefReminderReader(projectPath: string, ref: str
|
|
|
47
47
|
* Returns an array of instruction sources, with global ones first.
|
|
48
48
|
*
|
|
49
49
|
* `projectReader` controls where project-scope content comes from (defaults to
|
|
50
|
-
* the working tree). Global instructions
|
|
51
|
-
* filesystem.
|
|
50
|
+
* the working tree). Global instructions read the operator machine's
|
|
51
|
+
* filesystem, unless `skipGlobal` keeps them out entirely.
|
|
52
52
|
*/
|
|
53
|
-
export declare function loadAgentInstructions(projectPath: string, configDirName?: string, projectReader?: InstructionFileReader
|
|
53
|
+
export declare function loadAgentInstructions(projectPath: string, configDirName?: string, projectReader?: InstructionFileReader, { skipGlobal }?: {
|
|
54
|
+
skipGlobal?: boolean;
|
|
55
|
+
}): InstructionSource[];
|
|
54
56
|
export declare function getStaticallyLoadedInstructionPaths(projectPath: string, configDirName?: string, projectReader?: InstructionFileReader): string[];
|
|
55
57
|
/**
|
|
56
58
|
* Format loaded instructions into a string for the system prompt.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-instructions.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/agent-instructions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAOD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,qBAAqB,CA+BrG;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,GACV;IACD,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC,CA4CA;AAgBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,aAAa,SAAqB,EAClC,aAAa,GAAE,qBAA2C,
|
|
1
|
+
{"version":3,"file":"agent-instructions.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/agent-instructions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAOD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,qBAAqB,CA+BrG;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,GACV;IACD,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC,CA4CA;AAgBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,aAAa,SAAqB,EAClC,aAAa,GAAE,qBAA2C,EAC1D,EAAE,UAAkB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACpD,iBAAiB,EAAE,CAwDrB;AAED,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,MAAM,EACnB,aAAa,SAAqB,EAClC,aAAa,CAAC,EAAE,qBAAqB,GACpC,MAAM,EAAE,CAEV;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAU5E"}
|
|
@@ -140,14 +140,14 @@ function findInstructionFile(basePath, reader = fsInstructionReader) {
|
|
|
140
140
|
* Returns an array of instruction sources, with global ones first.
|
|
141
141
|
*
|
|
142
142
|
* `projectReader` controls where project-scope content comes from (defaults to
|
|
143
|
-
* the working tree). Global instructions
|
|
144
|
-
* filesystem.
|
|
143
|
+
* the working tree). Global instructions read the operator machine's
|
|
144
|
+
* filesystem, unless `skipGlobal` keeps them out entirely.
|
|
145
145
|
*/
|
|
146
|
-
function loadAgentInstructions(projectPath, configDirName = DEFAULT_CONFIG_DIR, projectReader = fsInstructionReader) {
|
|
146
|
+
function loadAgentInstructions(projectPath, configDirName = DEFAULT_CONFIG_DIR, projectReader = fsInstructionReader, { skipGlobal = false } = {}) {
|
|
147
147
|
const sources = [];
|
|
148
148
|
const home = homedir();
|
|
149
149
|
const projectLocations = PROJECT_LOCATIONS.map((loc) => loc === ".mastracode" ? configDirName : loc);
|
|
150
|
-
const globalLocations = GLOBAL_LOCATIONS.map((loc) => {
|
|
150
|
+
const globalLocations = skipGlobal ? [] : GLOBAL_LOCATIONS.map((loc) => {
|
|
151
151
|
if (loc === ".mastracode") return configDirName;
|
|
152
152
|
if (loc === ".config/mastracode") return ".config/" + configDirName.replace(/^\./, "");
|
|
153
153
|
return loc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-instructions.js","names":[],"sources":["../../../src/agents/prompts/agent-instructions.ts"],"sourcesContent":["/**\n * Load project and global agent instruction files (AGENTS.md, CLAUDE.md).\n * Prefers AGENTS.md over CLAUDE.md when multiple exist at the same location.\n */\n\nimport { execFileSync } from 'node:child_process';\nimport { existsSync, readFileSync, statSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { isAbsolute, join, normalize, relative, sep } from 'node:path';\nimport { DEFAULT_CONFIG_DIR } from '../../constants.js';\n\n// Filenames to check, in order of preference\nconst INSTRUCTION_FILES = ['AGENTS.md', 'CLAUDE.md'];\n\n// Locations to scan (relative to project root or home)\nconst PROJECT_LOCATIONS = [\n '', // project root\n '.claude',\n '.mastracode',\n];\n\nconst GLOBAL_LOCATIONS = ['.claude', '.mastracode', '.config/claude', '.config/mastracode'];\n\nexport interface InstructionSource {\n path: string;\n content: string;\n scope: 'global' | 'project';\n /** Git ref the content was read from, when not read off the working tree. */\n ref?: string;\n}\n\n/**\n * Reads project-scope instruction files. The default implementation reads the\n * working tree via `fs`; alternative readers can serve content from another\n * source (e.g. a trusted git ref) while keeping working-tree paths as the\n * addressing scheme.\n */\nexport interface InstructionFileReader {\n exists(path: string): boolean;\n read(path: string): string;\n /** Git ref backing this reader, recorded on the loaded sources. */\n ref?: string;\n}\n\nconst fsInstructionReader: InstructionFileReader = {\n exists: path => existsSync(path),\n read: path => readFileSync(path, 'utf-8'),\n};\n\n/**\n * Create a reader that serves instruction files from a git ref instead of the\n * working tree. Paths are still addressed as working-tree paths under\n * `projectPath`; content comes from `git show <ref>:<relpath>` so an untrusted\n * checkout (e.g. a PR branch under review) cannot influence what is loaded.\n * Tries `origin/<ref>` first (remote truth), then the local ref. Any git\n * failure (missing ref, missing file, no repo) reports the file as absent.\n */\nexport function createGitRefInstructionReader(projectPath: string, ref: string): InstructionFileReader {\n const toRelative = (path: string): string | null => {\n const rel = relative(projectPath, path);\n if (!rel || rel.startsWith('..') || isAbsolute(rel)) return null;\n return rel.split(sep).join('/');\n };\n const show = (path: string): string | null => {\n const rel = toRelative(path);\n if (rel === null) return null;\n for (const candidate of [`origin/${ref}`, ref]) {\n try {\n return execFileSync('git', ['-C', projectPath, 'show', `${candidate}:${rel}`], {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n maxBuffer: 1024 * 1024,\n });\n } catch {\n // Ref or file missing at this candidate — try the next one.\n }\n }\n return null;\n };\n return {\n ref,\n exists: path => show(path) !== null,\n read: path => {\n const content = show(path);\n if (content === null) throw new Error(`Not found at ref ${ref}: ${path}`);\n return content;\n },\n };\n}\n\n/**\n * Reader for the reactive reminder channel (AgentsMDInjector) that serves\n * paths under `projectPath` from a trusted git ref. Paths outside the project\n * fall back to the operator machine's filesystem (those are trusted); paths\n * inside the project are only ever resolved against the ref, never the\n * working tree, so an untrusted checkout cannot feed content in.\n */\nexport function createGitRefReminderReader(\n projectPath: string,\n ref: string,\n): {\n pathExists: (path: string) => boolean;\n isDirectory: (path: string) => boolean;\n readFile: (path: string) => string;\n} {\n const gitReader = createGitRefInstructionReader(projectPath, ref);\n const toRelative = (path: string): string | null => {\n const rel = relative(projectPath, normalize(path));\n if (rel.startsWith('..') || isAbsolute(rel)) return null;\n return rel.split(sep).join('/');\n };\n const objectType = (rel: string): string | null => {\n if (rel === '') return 'tree'; // project root\n for (const candidate of [`origin/${ref}`, ref]) {\n try {\n return execFileSync('git', ['-C', projectPath, 'cat-file', '-t', `${candidate}:${rel}`], {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n }).trim();\n } catch {\n // Ref or object missing at this candidate — try the next one.\n }\n }\n return null;\n };\n return {\n pathExists: path => {\n const rel = toRelative(path);\n if (rel === null) return existsSync(path);\n return objectType(rel) !== null;\n },\n isDirectory: path => {\n const rel = toRelative(path);\n if (rel === null) {\n try {\n return statSync(path).isDirectory();\n } catch {\n return false;\n }\n }\n return objectType(rel) === 'tree';\n },\n readFile: path => {\n const rel = toRelative(path);\n if (rel === null) return readFileSync(path, 'utf-8');\n return gitReader.read(path);\n },\n };\n}\n\n/**\n * Find the first existing instruction file at a given base path.\n * Prefers AGENTS.md over CLAUDE.md.\n */\nfunction findInstructionFile(basePath: string, reader: InstructionFileReader = fsInstructionReader): string | null {\n for (const filename of INSTRUCTION_FILES) {\n const fullPath = join(basePath, filename);\n if (reader.exists(fullPath)) {\n return fullPath;\n }\n }\n return null;\n}\n\n/**\n * Load all agent instruction files from global and project locations.\n * Returns an array of instruction sources, with global ones first.\n *\n * `projectReader` controls where project-scope content comes from (defaults to\n * the working tree). Global instructions always read the operator machine's\n * filesystem.\n */\nexport function loadAgentInstructions(\n projectPath: string,\n configDirName = DEFAULT_CONFIG_DIR,\n projectReader: InstructionFileReader = fsInstructionReader,\n): InstructionSource[] {\n const sources: InstructionSource[] = [];\n const home = homedir();\n\n // Derive location arrays from the base constants, substituting the config dir name\n const projectLocations = PROJECT_LOCATIONS.map(loc => (loc === '.mastracode' ? configDirName : loc));\n const globalLocations = GLOBAL_LOCATIONS.map(loc => {\n if (loc === '.mastracode') return configDirName;\n // XDG-style path (~/.config/<name>): strip the leading dot since the\n // .config/ prefix already signals a hidden/config directory.\n if (loc === '.config/mastracode') return '.config/' + configDirName.replace(/^\\./, '');\n return loc;\n });\n\n // Load global instructions first\n for (const location of globalLocations) {\n const basePath = join(home, location);\n const filePath = findInstructionFile(basePath);\n if (filePath) {\n try {\n const content = readFileSync(filePath, 'utf-8').trim();\n if (content) {\n sources.push({ path: filePath, content, scope: 'global' });\n break; // Only use first found global instruction file\n }\n } catch {\n // Skip unreadable files\n }\n }\n }\n\n // Load project instructions\n for (const location of projectLocations) {\n const basePath = location ? join(projectPath, location) : projectPath;\n const filePath = findInstructionFile(basePath, projectReader);\n if (filePath) {\n try {\n const content = projectReader.read(filePath).trim();\n if (content) {\n sources.push({\n path: filePath,\n content,\n scope: 'project',\n ...(projectReader.ref ? { ref: projectReader.ref } : {}),\n });\n break; // Only use first found project instruction file\n }\n } catch {\n // Skip unreadable files\n }\n }\n }\n\n return sources;\n}\n\nexport function getStaticallyLoadedInstructionPaths(\n projectPath: string,\n configDirName = DEFAULT_CONFIG_DIR,\n projectReader?: InstructionFileReader,\n): string[] {\n return loadAgentInstructions(projectPath, configDirName, projectReader).map(source => normalize(source.path));\n}\n\n/**\n * Format loaded instructions into a string for the system prompt.\n */\nexport function formatAgentInstructions(sources: InstructionSource[]): string {\n if (sources.length === 0) return '';\n\n const sections = sources.map(source => {\n const label = source.scope === 'global' ? 'Global' : 'Project';\n const origin = source.ref ? `${source.path} (at ref ${source.ref})` : source.path;\n return `<!-- ${label} instructions from ${origin} -->\\n${source.content}`;\n });\n\n return `\\n# Agent Instructions\\n\\n${sections.join('\\n\\n')}\\n`;\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,oBAAoB,CAAC,aAAa,WAAW;AAGnD,MAAM,oBAAoB;CACxB;CACA;CACA;AACF;AAEA,MAAM,mBAAmB;CAAC;CAAW;CAAe;CAAkB;AAAoB;AAuB1F,MAAM,sBAA6C;CACjD,SAAQ,SAAQ,WAAW,IAAI;CAC/B,OAAM,SAAQ,aAAa,MAAM,OAAO;AAC1C;;;;;;;;;AAUA,SAAgB,8BAA8B,aAAqB,KAAoC;CACrG,MAAM,cAAc,SAAgC;EAClD,MAAM,MAAM,SAAS,aAAa,IAAI;EACtC,IAAI,CAAC,OAAO,IAAI,WAAW,IAAI,KAAK,WAAW,GAAG,GAAG,OAAO;EAC5D,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;CAChC;CACA,MAAM,QAAQ,SAAgC;EAC5C,MAAM,MAAM,WAAW,IAAI;EAC3B,IAAI,QAAQ,MAAM,OAAO;EACzB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GAClD,IAAI,SAAS;IACX,QAAQ,KAAK;KACX,MAAM;KACN;KACA,OAAO;KACP,GAAI,cAAc,MAAM,EAAE,KAAK,cAAc,IAAI,IAAI,CAAC;IACxD,CAAC;IACD;GACF;EACF,QAAQ,CAER;CAEJ;CAEA,OAAO;AACT;AAEA,SAAgB,oCACd,aACA,gBAAgB,oBAChB,eACU;CACV,OAAO,sBAAsB,aAAa,eAAe,aAAa,CAAC,CAAC,KAAI,WAAU,UAAU,OAAO,IAAI,CAAC;AAC9G;;;;AAKA,SAAgB,wBAAwB,SAAsC;CAC5E,IAAI,QAAQ,WAAW,GAAG,OAAO;CAQjC,OAAO,6BANU,QAAQ,KAAI,WAAU;EAGrC,OAAO,QAFO,OAAO,UAAU,WAAW,WAAW,UAEhC,qBADN,OAAO,MAAM,GAAG,OAAO,KAAK,WAAW,OAAO,IAAI,KAAK,OAAO,KAC5B,QAAQ,OAAO;CAClE,CAE2C,CAAC,CAAC,KAAK,MAAM,EAAE;AAC5D"}
|
|
1
|
+
{"version":3,"file":"agent-instructions.js","names":[],"sources":["../../../src/agents/prompts/agent-instructions.ts"],"sourcesContent":["/**\n * Load project and global agent instruction files (AGENTS.md, CLAUDE.md).\n * Prefers AGENTS.md over CLAUDE.md when multiple exist at the same location.\n */\n\nimport { execFileSync } from 'node:child_process';\nimport { existsSync, readFileSync, statSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { isAbsolute, join, normalize, relative, sep } from 'node:path';\nimport { DEFAULT_CONFIG_DIR } from '../../constants.js';\n\n// Filenames to check, in order of preference\nconst INSTRUCTION_FILES = ['AGENTS.md', 'CLAUDE.md'];\n\n// Locations to scan (relative to project root or home)\nconst PROJECT_LOCATIONS = [\n '', // project root\n '.claude',\n '.mastracode',\n];\n\nconst GLOBAL_LOCATIONS = ['.claude', '.mastracode', '.config/claude', '.config/mastracode'];\n\nexport interface InstructionSource {\n path: string;\n content: string;\n scope: 'global' | 'project';\n /** Git ref the content was read from, when not read off the working tree. */\n ref?: string;\n}\n\n/**\n * Reads project-scope instruction files. The default implementation reads the\n * working tree via `fs`; alternative readers can serve content from another\n * source (e.g. a trusted git ref) while keeping working-tree paths as the\n * addressing scheme.\n */\nexport interface InstructionFileReader {\n exists(path: string): boolean;\n read(path: string): string;\n /** Git ref backing this reader, recorded on the loaded sources. */\n ref?: string;\n}\n\nconst fsInstructionReader: InstructionFileReader = {\n exists: path => existsSync(path),\n read: path => readFileSync(path, 'utf-8'),\n};\n\n/**\n * Create a reader that serves instruction files from a git ref instead of the\n * working tree. Paths are still addressed as working-tree paths under\n * `projectPath`; content comes from `git show <ref>:<relpath>` so an untrusted\n * checkout (e.g. a PR branch under review) cannot influence what is loaded.\n * Tries `origin/<ref>` first (remote truth), then the local ref. Any git\n * failure (missing ref, missing file, no repo) reports the file as absent.\n */\nexport function createGitRefInstructionReader(projectPath: string, ref: string): InstructionFileReader {\n const toRelative = (path: string): string | null => {\n const rel = relative(projectPath, path);\n if (!rel || rel.startsWith('..') || isAbsolute(rel)) return null;\n return rel.split(sep).join('/');\n };\n const show = (path: string): string | null => {\n const rel = toRelative(path);\n if (rel === null) return null;\n for (const candidate of [`origin/${ref}`, ref]) {\n try {\n return execFileSync('git', ['-C', projectPath, 'show', `${candidate}:${rel}`], {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n maxBuffer: 1024 * 1024,\n });\n } catch {\n // Ref or file missing at this candidate — try the next one.\n }\n }\n return null;\n };\n return {\n ref,\n exists: path => show(path) !== null,\n read: path => {\n const content = show(path);\n if (content === null) throw new Error(`Not found at ref ${ref}: ${path}`);\n return content;\n },\n };\n}\n\n/**\n * Reader for the reactive reminder channel (AgentsMDInjector) that serves\n * paths under `projectPath` from a trusted git ref. Paths outside the project\n * fall back to the operator machine's filesystem (those are trusted); paths\n * inside the project are only ever resolved against the ref, never the\n * working tree, so an untrusted checkout cannot feed content in.\n */\nexport function createGitRefReminderReader(\n projectPath: string,\n ref: string,\n): {\n pathExists: (path: string) => boolean;\n isDirectory: (path: string) => boolean;\n readFile: (path: string) => string;\n} {\n const gitReader = createGitRefInstructionReader(projectPath, ref);\n const toRelative = (path: string): string | null => {\n const rel = relative(projectPath, normalize(path));\n if (rel.startsWith('..') || isAbsolute(rel)) return null;\n return rel.split(sep).join('/');\n };\n const objectType = (rel: string): string | null => {\n if (rel === '') return 'tree'; // project root\n for (const candidate of [`origin/${ref}`, ref]) {\n try {\n return execFileSync('git', ['-C', projectPath, 'cat-file', '-t', `${candidate}:${rel}`], {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n }).trim();\n } catch {\n // Ref or object missing at this candidate — try the next one.\n }\n }\n return null;\n };\n return {\n pathExists: path => {\n const rel = toRelative(path);\n if (rel === null) return existsSync(path);\n return objectType(rel) !== null;\n },\n isDirectory: path => {\n const rel = toRelative(path);\n if (rel === null) {\n try {\n return statSync(path).isDirectory();\n } catch {\n return false;\n }\n }\n return objectType(rel) === 'tree';\n },\n readFile: path => {\n const rel = toRelative(path);\n if (rel === null) return readFileSync(path, 'utf-8');\n return gitReader.read(path);\n },\n };\n}\n\n/**\n * Find the first existing instruction file at a given base path.\n * Prefers AGENTS.md over CLAUDE.md.\n */\nfunction findInstructionFile(basePath: string, reader: InstructionFileReader = fsInstructionReader): string | null {\n for (const filename of INSTRUCTION_FILES) {\n const fullPath = join(basePath, filename);\n if (reader.exists(fullPath)) {\n return fullPath;\n }\n }\n return null;\n}\n\n/**\n * Load all agent instruction files from global and project locations.\n * Returns an array of instruction sources, with global ones first.\n *\n * `projectReader` controls where project-scope content comes from (defaults to\n * the working tree). Global instructions read the operator machine's\n * filesystem, unless `skipGlobal` keeps them out entirely.\n */\nexport function loadAgentInstructions(\n projectPath: string,\n configDirName = DEFAULT_CONFIG_DIR,\n projectReader: InstructionFileReader = fsInstructionReader,\n { skipGlobal = false }: { skipGlobal?: boolean } = {},\n): InstructionSource[] {\n const sources: InstructionSource[] = [];\n const home = homedir();\n\n // Derive location arrays from the base constants, substituting the config dir name\n const projectLocations = PROJECT_LOCATIONS.map(loc => (loc === '.mastracode' ? configDirName : loc));\n const globalLocations = skipGlobal\n ? []\n : GLOBAL_LOCATIONS.map(loc => {\n if (loc === '.mastracode') return configDirName;\n // XDG-style path (~/.config/<name>): strip the leading dot since the\n // .config/ prefix already signals a hidden/config directory.\n if (loc === '.config/mastracode') return '.config/' + configDirName.replace(/^\\./, '');\n return loc;\n });\n\n // Load global instructions first\n for (const location of globalLocations) {\n const basePath = join(home, location);\n const filePath = findInstructionFile(basePath);\n if (filePath) {\n try {\n const content = readFileSync(filePath, 'utf-8').trim();\n if (content) {\n sources.push({ path: filePath, content, scope: 'global' });\n break; // Only use first found global instruction file\n }\n } catch {\n // Skip unreadable files\n }\n }\n }\n\n // Load project instructions\n for (const location of projectLocations) {\n const basePath = location ? join(projectPath, location) : projectPath;\n const filePath = findInstructionFile(basePath, projectReader);\n if (filePath) {\n try {\n const content = projectReader.read(filePath).trim();\n if (content) {\n sources.push({\n path: filePath,\n content,\n scope: 'project',\n ...(projectReader.ref ? { ref: projectReader.ref } : {}),\n });\n break; // Only use first found project instruction file\n }\n } catch {\n // Skip unreadable files\n }\n }\n }\n\n return sources;\n}\n\nexport function getStaticallyLoadedInstructionPaths(\n projectPath: string,\n configDirName = DEFAULT_CONFIG_DIR,\n projectReader?: InstructionFileReader,\n): string[] {\n return loadAgentInstructions(projectPath, configDirName, projectReader).map(source => normalize(source.path));\n}\n\n/**\n * Format loaded instructions into a string for the system prompt.\n */\nexport function formatAgentInstructions(sources: InstructionSource[]): string {\n if (sources.length === 0) return '';\n\n const sections = sources.map(source => {\n const label = source.scope === 'global' ? 'Global' : 'Project';\n const origin = source.ref ? `${source.path} (at ref ${source.ref})` : source.path;\n return `<!-- ${label} instructions from ${origin} -->\\n${source.content}`;\n });\n\n return `\\n# Agent Instructions\\n\\n${sections.join('\\n\\n')}\\n`;\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,oBAAoB,CAAC,aAAa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
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAUpF,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAQD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAUpF,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAQD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAqE1D"}
|
|
@@ -46,6 +46,7 @@ function buildFullPrompt(ctx) {
|
|
|
46
46
|
const modelSpecific = ctx.modelId ? modelSpecificPrompts[ctx.modelId] ?? "" : "";
|
|
47
47
|
const configDir = ctx.state?.configDir;
|
|
48
48
|
const untrustedCheckout = ctx.state?.untrustedCheckout === true;
|
|
49
|
+
const skipGlobalInstructions = ctx.state?.skipGlobalInstructions === true;
|
|
49
50
|
const baseRef = typeof ctx.state?.baseRef === "string" ? ctx.state.baseRef : void 0;
|
|
50
51
|
const projectReader = untrustedCheckout ? baseRef ? createGitRefInstructionReader(ctx.workingDir, baseRef) : {
|
|
51
52
|
exists: () => false,
|
|
@@ -53,7 +54,7 @@ function buildFullPrompt(ctx) {
|
|
|
53
54
|
} : void 0;
|
|
54
55
|
return [
|
|
55
56
|
base,
|
|
56
|
-
formatAgentInstructions(loadAgentInstructions(ctx.workingDir, configDir, projectReader)).trim(),
|
|
57
|
+
formatAgentInstructions(loadAgentInstructions(ctx.workingDir, configDir, projectReader, { skipGlobal: skipGlobalInstructions })).trim(),
|
|
57
58
|
modelSpecific.trim(),
|
|
58
59
|
modeSpecific.trim()
|
|
59
60
|
].filter(Boolean).join("\n\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/agents/prompts/index.ts"],"sourcesContent":["/**\n * Prompt system — exports the prompt builder and mode-specific prompts.\n */\n\nexport { buildModePrompt, buildModePromptFn } from './build.js';\nexport { planModePrompt } from './plan.js';\nexport { fastModePrompt } from './fast.js';\n\nimport { buildBasePrompt } from '@mastra/core/coding-agent';\nimport type { PromptContext as BasePromptContext } from '@mastra/core/coding-agent';\nimport { hasTavilyKey } from '../../tools/index.js';\nimport { loadAgentInstructions, formatAgentInstructions, createGitRefInstructionReader } from './agent-instructions.js';\nimport { buildModePromptFn } from './build.js';\nimport { fastModePrompt } from './fast.js';\nimport { modelSpecificPrompts } from './model.js';\nimport { planModePrompt } from './plan.js';\nimport { buildToolGuidance } from './tool-guidance.js';\n\n// Extended prompt context that includes runtime information\nexport interface PromptContext extends Omit<BasePromptContext, 'toolGuidance'> {\n modeId: string;\n state?: any;\n currentDate: string;\n workingDir: string;\n}\n\nconst modePrompts: Record<string, string | ((ctx: PromptContext) => string)> = {\n build: buildModePromptFn,\n plan: planModePrompt,\n fast: fastModePrompt,\n};\n\n/**\n * Build the full system prompt for a given mode and context.\n * Combines the base prompt with mode-specific instructions.\n */\nexport function buildFullPrompt(ctx: PromptContext): string {\n // Determine whether web search tools are available\n const modelId = ctx.modelId;\n const hasWebSearch = hasTavilyKey() || (!!modelId && modelId.startsWith('anthropic/'));\n\n // Collect per-tool deny rules so guidance omits denied tools\n const deniedTools = new Set<string>();\n const permRules = ctx.state?.permissionRules as { tools?: Record<string, string> } | undefined;\n if (permRules?.tools) {\n for (const [name, policy] of Object.entries(permRules.tools)) {\n if (policy === 'deny') deniedTools.add(name);\n }\n }\n\n // Build mode-aware tool guidance\n const toolGuidance = buildToolGuidance(ctx.modeId, { hasWebSearch, deniedTools });\n\n // Map new context to base context\n const baseCtx: BasePromptContext = {\n projectPath: ctx.workingDir,\n projectName: ctx.projectName || 'unknown',\n gitBranch: ctx.gitBranch,\n platform: process.platform,\n commonBinaries: ctx.commonBinaries,\n date: ctx.currentDate,\n mode: ctx.modeId,\n modelId: ctx.modelId,\n activePlan: ctx.state?.activePlan,\n toolGuidance,\n };\n\n const base = buildBasePrompt(baseCtx);\n const entry = modePrompts[ctx.modeId] || modePrompts.build;\n const modeSpecific = (typeof entry === 'function' ? entry(ctx) : entry) ?? '';\n const modelSpecific = ctx.modelId\n ? (modelSpecificPrompts[ctx.modelId as keyof typeof modelSpecificPrompts] ?? '')\n : '';\n\n // The current task list is carried on the agent state-signal lane (see\n // TaskStateProcessor) rather than injected into the cached system prompt. This\n // keeps the prompt prefix stable across task updates (preserving prompt cache)\n // while still surviving observational-memory truncation.\n\n // Load and inject agent instructions from AGENTS.md/CLAUDE.md files.\n // Untrusted checkouts (e.g. a PR branch under review) never read\n // project-scope files off the working tree: their AGENTS.md is\n // attacker-writable and would otherwise land in the system prompt as\n // trusted configuration. When the session carries a trusted base ref, the\n // project instructions are served from that ref instead (`git show`);\n // without one, project-scope files are skipped entirely.
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/agents/prompts/index.ts"],"sourcesContent":["/**\n * Prompt system — exports the prompt builder and mode-specific prompts.\n */\n\nexport { buildModePrompt, buildModePromptFn } from './build.js';\nexport { planModePrompt } from './plan.js';\nexport { fastModePrompt } from './fast.js';\n\nimport { buildBasePrompt } from '@mastra/core/coding-agent';\nimport type { PromptContext as BasePromptContext } from '@mastra/core/coding-agent';\nimport { hasTavilyKey } from '../../tools/index.js';\nimport { loadAgentInstructions, formatAgentInstructions, createGitRefInstructionReader } from './agent-instructions.js';\nimport { buildModePromptFn } from './build.js';\nimport { fastModePrompt } from './fast.js';\nimport { modelSpecificPrompts } from './model.js';\nimport { planModePrompt } from './plan.js';\nimport { buildToolGuidance } from './tool-guidance.js';\n\n// Extended prompt context that includes runtime information\nexport interface PromptContext extends Omit<BasePromptContext, 'toolGuidance'> {\n modeId: string;\n state?: any;\n currentDate: string;\n workingDir: string;\n}\n\nconst modePrompts: Record<string, string | ((ctx: PromptContext) => string)> = {\n build: buildModePromptFn,\n plan: planModePrompt,\n fast: fastModePrompt,\n};\n\n/**\n * Build the full system prompt for a given mode and context.\n * Combines the base prompt with mode-specific instructions.\n */\nexport function buildFullPrompt(ctx: PromptContext): string {\n // Determine whether web search tools are available\n const modelId = ctx.modelId;\n const hasWebSearch = hasTavilyKey() || (!!modelId && modelId.startsWith('anthropic/'));\n\n // Collect per-tool deny rules so guidance omits denied tools\n const deniedTools = new Set<string>();\n const permRules = ctx.state?.permissionRules as { tools?: Record<string, string> } | undefined;\n if (permRules?.tools) {\n for (const [name, policy] of Object.entries(permRules.tools)) {\n if (policy === 'deny') deniedTools.add(name);\n }\n }\n\n // Build mode-aware tool guidance\n const toolGuidance = buildToolGuidance(ctx.modeId, { hasWebSearch, deniedTools });\n\n // Map new context to base context\n const baseCtx: BasePromptContext = {\n projectPath: ctx.workingDir,\n projectName: ctx.projectName || 'unknown',\n gitBranch: ctx.gitBranch,\n platform: process.platform,\n commonBinaries: ctx.commonBinaries,\n date: ctx.currentDate,\n mode: ctx.modeId,\n modelId: ctx.modelId,\n activePlan: ctx.state?.activePlan,\n toolGuidance,\n };\n\n const base = buildBasePrompt(baseCtx);\n const entry = modePrompts[ctx.modeId] || modePrompts.build;\n const modeSpecific = (typeof entry === 'function' ? entry(ctx) : entry) ?? '';\n const modelSpecific = ctx.modelId\n ? (modelSpecificPrompts[ctx.modelId as keyof typeof modelSpecificPrompts] ?? '')\n : '';\n\n // The current task list is carried on the agent state-signal lane (see\n // TaskStateProcessor) rather than injected into the cached system prompt. This\n // keeps the prompt prefix stable across task updates (preserving prompt cache)\n // while still surviving observational-memory truncation.\n\n // Load and inject agent instructions from AGENTS.md/CLAUDE.md files.\n // Untrusted checkouts (e.g. a PR branch under review) never read\n // project-scope files off the working tree: their AGENTS.md is\n // attacker-writable and would otherwise land in the system prompt as\n // trusted configuration. When the session carries a trusted base ref, the\n // project instructions are served from that ref instead (`git show`);\n // without one, project-scope files are skipped entirely. Home-directory\n // (global) instructions belong to whoever owns the machine, so hosts that\n // run sessions for someone else opt out of them entirely.\n const configDir = ctx.state?.configDir as string | undefined;\n const untrustedCheckout = ctx.state?.untrustedCheckout === true;\n const skipGlobalInstructions = ctx.state?.skipGlobalInstructions === true;\n const baseRef = typeof ctx.state?.baseRef === 'string' ? ctx.state.baseRef : undefined;\n const projectReader = untrustedCheckout\n ? baseRef\n ? createGitRefInstructionReader(ctx.workingDir, baseRef)\n : { exists: () => false, read: () => '' }\n : undefined;\n const instructionSources = loadAgentInstructions(ctx.workingDir, configDir, projectReader, {\n skipGlobal: skipGlobalInstructions,\n });\n const instructionsSection = formatAgentInstructions(instructionSources);\n\n const sections = [base, instructionsSection.trim(), modelSpecific.trim(), modeSpecific.trim()].filter(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YAAY,WAAW,eAAe,EACzF,YAAY,uBACd,CACqE,CAE3B,CAAC,CAAC,KAAK;EAAG,cAAc,KAAK;EAAG,aAAa,KAAK;CAAC,CAAC,CAAC,OAAO,OAExF,CAAC,CAAC,KAAK,MAAM;AAC7B"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -36,6 +36,12 @@ export interface MastraCodeState {
|
|
|
36
36
|
* project-scope instruction files are skipped entirely.
|
|
37
37
|
*/
|
|
38
38
|
baseRef?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Skip the home-directory instruction files (~/.claude/AGENTS.md and
|
|
41
|
+
* friends). Hosts running sessions for someone else set this so a run never
|
|
42
|
+
* inherits the machine owner's personal configuration.
|
|
43
|
+
*/
|
|
44
|
+
skipGlobalInstructions?: boolean;
|
|
39
45
|
configDir: string;
|
|
40
46
|
homeDir?: string;
|
|
41
47
|
gitBranch?: string;
|
|
@@ -100,6 +106,7 @@ export declare const stateSchema: z.ZodObject<{
|
|
|
100
106
|
branch: z.ZodOptional<z.ZodString>;
|
|
101
107
|
untrustedCheckout: z.ZodOptional<z.ZodBoolean>;
|
|
102
108
|
baseRef: z.ZodOptional<z.ZodString>;
|
|
109
|
+
skipGlobalInstructions: z.ZodOptional<z.ZodBoolean>;
|
|
103
110
|
configDir: z.ZodDefault<z.ZodString>;
|
|
104
111
|
homeDir: z.ZodOptional<z.ZodString>;
|
|
105
112
|
gitBranch: z.ZodOptional<z.ZodString>;
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAExD,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;C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YACT,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE;YACV,GAAG,EAAE,OAAO,GAAG,aAAa,CAAC;YAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,SAAS,CAAC,EAAE,MAAM,CAAC;SACpB,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyGtB,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -15,6 +15,7 @@ const stateSchema = z.object({
|
|
|
15
15
|
branch: z.string().optional(),
|
|
16
16
|
untrustedCheckout: z.boolean().optional(),
|
|
17
17
|
baseRef: z.string().optional(),
|
|
18
|
+
skipGlobalInstructions: z.boolean().optional(),
|
|
18
19
|
configDir: z.string().default(DEFAULT_CONFIG_DIR),
|
|
19
20
|
homeDir: z.string().optional(),
|
|
20
21
|
gitBranch: z.string().optional(),
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { z } from 'zod';\nimport { DEFAULT_CONFIG_DIR, DEFAULT_OM_MODEL_ID } from './constants.js';\n\nexport type PermissionPolicy = 'allow' | 'ask' | 'deny';\n\nexport type MastraCodeSessionState = {\n currentModelId: string;\n modeId: string;\n};\n\nexport type MastraCodeComposedState = MastraCodeState & MastraCodeSessionState;\n\nexport interface MastraCodeState {\n [key: string]: unknown;\n [key: `subagentModelId_${string}`]: string | undefined;\n subagentModelId?: string;\n projectPath?: string;\n projectName?: string;\n /** Factory project that owns this session. */\n factoryProjectId?: string;\n /** Linked repository used by this session when source-control execution is required. */\n projectRepositoryId?: string;\n /** Persisted sandbox id for reattaching the project's cloud workspace. */\n sandboxId?: string;\n /** Path inside the sandbox the repo is cloned into. */\n sandboxWorkdir?: string;\n /** Active git worktree path inside the sandbox for the current unit of work. */\n worktreePath?: string;\n /** Active feature branch checked out in the worktree. */\n branch?: string;\n /**\n * The session's checkout contains third-party content (e.g. a PR branch\n * under review). Project-level instruction files (AGENTS.md, CLAUDE.md)\n * are attacker-writable there and must not be ingested into the system\n * prompt or injected as reminders.\n */\n untrustedCheckout?: boolean;\n /**\n * Trusted git ref (typically the PR's base branch) to serve project\n * instruction files from when the checkout is untrusted. Without it,\n * project-scope instruction files are skipped entirely.\n */\n baseRef?: string;\n configDir: string;\n homeDir?: string;\n gitBranch?: string;\n lastCommand?: string;\n observerModelId: string;\n reflectorModelId: string;\n observationThreshold: number;\n reflectionThreshold: number;\n cavemanObservations: boolean;\n observeAttachments: 'auto' | boolean;\n omScope?: 'thread' | 'resource';\n thinkingLevel: 'off' | 'low' | 'medium' | 'high' | 'xhigh';\n yolo: boolean;\n permissionRules: {\n categories: Record<string, PermissionPolicy>;\n tools: Record<string, PermissionPolicy>;\n };\n smartEditing: boolean;\n notifications: 'bell' | 'system' | 'both' | 'off';\n tasks: Array<{\n id?: string;\n content: string;\n status: 'pending' | 'in_progress' | 'completed';\n activeForm: string;\n }>;\n sandboxAllowedPaths: string[];\n pluginSkillPaths: string[];\n pluginCommandPaths: string[];\n pluginInstructions: string[];\n activePlan: {\n title: string;\n plan: string;\n approvedAt: string;\n } | null;\n activeBrowserSettings?: {\n enabled: boolean;\n provider: 'stagehand' | 'agent-browser';\n headless?: boolean;\n viewport?: {\n width: number;\n height: number;\n };\n cdpUrl?: string;\n stagehand?: {\n env: 'LOCAL' | 'BROWSERBASE';\n apiKey?: string;\n projectId?: string;\n };\n };\n}\n\nexport const stateSchema = z.object({\n // Session-scoped selection.\n // validates state against this schema, so they MUST be declared here — Zod\n // strips unknown keys on parse, which would otherwise silently discard the\n // seeded model and leave the controller with no model selected.\n currentModelId: z.string().optional(),\n modeId: z.string().optional(),\n subagentModelId: z.string().optional(),\n projectPath: z.string().optional(),\n projectName: z.string().optional(),\n factoryProjectId: z.string().optional(),\n projectRepositoryId: z.string().optional(),\n sandboxId: z.string().optional(),\n sandboxWorkdir: z.string().optional(),\n worktreePath: z.string().optional(),\n branch: z.string().optional(),\n // Session operates on an untrusted checkout — suppress AGENTS.md ingestion.\n untrustedCheckout: z.boolean().optional(),\n // Trusted ref to serve instruction files from on untrusted checkouts.\n baseRef: z.string().optional(),\n configDir: z.string().default(DEFAULT_CONFIG_DIR),\n homeDir: z.string().optional(),\n gitBranch: z.string().optional(),\n lastCommand: z.string().optional(),\n // Observational Memory model settings\n observerModelId: z.string().default(DEFAULT_OM_MODEL_ID),\n reflectorModelId: z.string().default(DEFAULT_OM_MODEL_ID),\n // Observational Memory threshold settings\n observationThreshold: z.number().default(30_000),\n reflectionThreshold: z.number().default(40_000),\n // Whether observations and reflections use the terse caveman-style instruction.\n // Off by default — caveman style is opt-in via `/om` settings; observers and\n // reflectors fall back to their built-in (prose) behavior unless enabled.\n cavemanObservations: z.boolean().default(false),\n // Whether OM forwards image/file attachment parts to the Observer LLM.\n // 'auto' (default) checks the provider capabilities registry to decide.\n // true/false forces the setting regardless of model capabilities.\n observeAttachments: z.union([z.literal('auto'), z.boolean()]).default('auto'),\n // Observational Memory scope — 'thread' (per-conversation) or 'resource' (shared across threads)\n omScope: z.enum(['thread', 'resource']).optional(),\n // Thinking level for model reasoning effort\n thinkingLevel: z.enum(['off', 'low', 'medium', 'high', 'xhigh']).default('off'),\n // YOLO mode — auto-approve all tool calls\n yolo: z.boolean().default(false),\n // Permission rules — per-category and per-tool approval policies\n permissionRules: z\n .object({\n categories: z.record(z.string(), z.enum(['allow', 'ask', 'deny'])).default({}),\n tools: z.record(z.string(), z.enum(['allow', 'ask', 'deny'])).default({}),\n })\n .default({ categories: {}, tools: {} }),\n // Smart editing mode — use AST-based analysis for code edits\n smartEditing: z.boolean().default(true),\n // Notification mode — alert when TUI needs user attention\n notifications: z.enum(['bell', 'system', 'both', 'off']).default('off'),\n // Task list (ephemeral per-thread, cleared on thread switch/creation)\n tasks: z\n .array(\n z.object({\n id: z.string().optional(),\n content: z.string(),\n status: z.enum(['pending', 'in_progress', 'completed']),\n activeForm: z.string(),\n }),\n )\n .default([]),\n // Sandbox allowed paths (per-thread, absolute paths allowed in addition to project root)\n sandboxAllowedPaths: z.array(z.string()).default([]),\n // Asset directories contributed by active plugins.\n pluginSkillPaths: z.array(z.string()).default([]),\n pluginCommandPaths: z.array(z.string()).default([]),\n pluginInstructions: z.array(z.string()).default([]),\n // Active plan (set when a plan is approved in Plan mode)\n activePlan: z\n .object({\n title: z.string(),\n plan: z.string(),\n approvedAt: z.string(),\n })\n .nullable()\n .default(null),\n // Active browser settings (tracks what's actually running vs. what's in the settings file)\n activeBrowserSettings: z\n .object({\n enabled: z.boolean(),\n provider: z.enum(['stagehand', 'agent-browser']),\n headless: z.boolean().optional(),\n viewport: z\n .object({\n width: z.number(),\n height: z.number(),\n })\n .optional(),\n cdpUrl: z.string().optional(),\n stagehand: z\n .object({\n env: z.enum(['LOCAL', 'BROWSERBASE']),\n apiKey: z.string().optional(),\n projectId: z.string().optional(),\n })\n .optional(),\n })\n .optional(),\n});\n"],"mappings":";;;AA8FA,MAAa,cAAc,EAAE,OAAO;CAKlC,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,iBAAiB,EAAE,OAAO,CAAC,CAAC,SAAS;CACrC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS;CACtC,qBAAqB,EAAE,OAAO,CAAC,CAAC,SAAS;CACzC,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,cAAc,EAAE,O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,EAAE,OAAO,CAAC,CAAC,SAAS;GAC5B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;EACjC,CAAC,CAAC,CACD,SAAS;CACd,CAAC,CAAC,CACD,SAAS;AACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { z } from 'zod';\nimport { DEFAULT_CONFIG_DIR, DEFAULT_OM_MODEL_ID } from './constants.js';\n\nexport type PermissionPolicy = 'allow' | 'ask' | 'deny';\n\nexport type MastraCodeSessionState = {\n currentModelId: string;\n modeId: string;\n};\n\nexport type MastraCodeComposedState = MastraCodeState & MastraCodeSessionState;\n\nexport interface MastraCodeState {\n [key: string]: unknown;\n [key: `subagentModelId_${string}`]: string | undefined;\n subagentModelId?: string;\n projectPath?: string;\n projectName?: string;\n /** Factory project that owns this session. */\n factoryProjectId?: string;\n /** Linked repository used by this session when source-control execution is required. */\n projectRepositoryId?: string;\n /** Persisted sandbox id for reattaching the project's cloud workspace. */\n sandboxId?: string;\n /** Path inside the sandbox the repo is cloned into. */\n sandboxWorkdir?: string;\n /** Active git worktree path inside the sandbox for the current unit of work. */\n worktreePath?: string;\n /** Active feature branch checked out in the worktree. */\n branch?: string;\n /**\n * The session's checkout contains third-party content (e.g. a PR branch\n * under review). Project-level instruction files (AGENTS.md, CLAUDE.md)\n * are attacker-writable there and must not be ingested into the system\n * prompt or injected as reminders.\n */\n untrustedCheckout?: boolean;\n /**\n * Trusted git ref (typically the PR's base branch) to serve project\n * instruction files from when the checkout is untrusted. Without it,\n * project-scope instruction files are skipped entirely.\n */\n baseRef?: string;\n /**\n * Skip the home-directory instruction files (~/.claude/AGENTS.md and\n * friends). Hosts running sessions for someone else set this so a run never\n * inherits the machine owner's personal configuration.\n */\n skipGlobalInstructions?: boolean;\n configDir: string;\n homeDir?: string;\n gitBranch?: string;\n lastCommand?: string;\n observerModelId: string;\n reflectorModelId: string;\n observationThreshold: number;\n reflectionThreshold: number;\n cavemanObservations: boolean;\n observeAttachments: 'auto' | boolean;\n omScope?: 'thread' | 'resource';\n thinkingLevel: 'off' | 'low' | 'medium' | 'high' | 'xhigh';\n yolo: boolean;\n permissionRules: {\n categories: Record<string, PermissionPolicy>;\n tools: Record<string, PermissionPolicy>;\n };\n smartEditing: boolean;\n notifications: 'bell' | 'system' | 'both' | 'off';\n tasks: Array<{\n id?: string;\n content: string;\n status: 'pending' | 'in_progress' | 'completed';\n activeForm: string;\n }>;\n sandboxAllowedPaths: string[];\n pluginSkillPaths: string[];\n pluginCommandPaths: string[];\n pluginInstructions: string[];\n activePlan: {\n title: string;\n plan: string;\n approvedAt: string;\n } | null;\n activeBrowserSettings?: {\n enabled: boolean;\n provider: 'stagehand' | 'agent-browser';\n headless?: boolean;\n viewport?: {\n width: number;\n height: number;\n };\n cdpUrl?: string;\n stagehand?: {\n env: 'LOCAL' | 'BROWSERBASE';\n apiKey?: string;\n projectId?: string;\n };\n };\n}\n\nexport const stateSchema = z.object({\n // Session-scoped selection.\n // validates state against this schema, so they MUST be declared here — Zod\n // strips unknown keys on parse, which would otherwise silently discard the\n // seeded model and leave the controller with no model selected.\n currentModelId: z.string().optional(),\n modeId: z.string().optional(),\n subagentModelId: z.string().optional(),\n projectPath: z.string().optional(),\n projectName: z.string().optional(),\n factoryProjectId: z.string().optional(),\n projectRepositoryId: z.string().optional(),\n sandboxId: z.string().optional(),\n sandboxWorkdir: z.string().optional(),\n worktreePath: z.string().optional(),\n branch: z.string().optional(),\n // Session operates on an untrusted checkout — suppress AGENTS.md ingestion.\n untrustedCheckout: z.boolean().optional(),\n // Trusted ref to serve instruction files from on untrusted checkouts.\n baseRef: z.string().optional(),\n // Skip the operator machine's home-directory instruction files.\n skipGlobalInstructions: z.boolean().optional(),\n configDir: z.string().default(DEFAULT_CONFIG_DIR),\n homeDir: z.string().optional(),\n gitBranch: z.string().optional(),\n lastCommand: z.string().optional(),\n // Observational Memory model settings\n observerModelId: z.string().default(DEFAULT_OM_MODEL_ID),\n reflectorModelId: z.string().default(DEFAULT_OM_MODEL_ID),\n // Observational Memory threshold settings\n observationThreshold: z.number().default(30_000),\n reflectionThreshold: z.number().default(40_000),\n // Whether observations and reflections use the terse caveman-style instruction.\n // Off by default — caveman style is opt-in via `/om` settings; observers and\n // reflectors fall back to their built-in (prose) behavior unless enabled.\n cavemanObservations: z.boolean().default(false),\n // Whether OM forwards image/file attachment parts to the Observer LLM.\n // 'auto' (default) checks the provider capabilities registry to decide.\n // true/false forces the setting regardless of model capabilities.\n observeAttachments: z.union([z.literal('auto'), z.boolean()]).default('auto'),\n // Observational Memory scope — 'thread' (per-conversation) or 'resource' (shared across threads)\n omScope: z.enum(['thread', 'resource']).optional(),\n // Thinking level for model reasoning effort\n thinkingLevel: z.enum(['off', 'low', 'medium', 'high', 'xhigh']).default('off'),\n // YOLO mode — auto-approve all tool calls\n yolo: z.boolean().default(false),\n // Permission rules — per-category and per-tool approval policies\n permissionRules: z\n .object({\n categories: z.record(z.string(), z.enum(['allow', 'ask', 'deny'])).default({}),\n tools: z.record(z.string(), z.enum(['allow', 'ask', 'deny'])).default({}),\n })\n .default({ categories: {}, tools: {} }),\n // Smart editing mode — use AST-based analysis for code edits\n smartEditing: z.boolean().default(true),\n // Notification mode — alert when TUI needs user attention\n notifications: z.enum(['bell', 'system', 'both', 'off']).default('off'),\n // Task list (ephemeral per-thread, cleared on thread switch/creation)\n tasks: z\n .array(\n z.object({\n id: z.string().optional(),\n content: z.string(),\n status: z.enum(['pending', 'in_progress', 'completed']),\n activeForm: z.string(),\n }),\n )\n .default([]),\n // Sandbox allowed paths (per-thread, absolute paths allowed in addition to project root)\n sandboxAllowedPaths: z.array(z.string()).default([]),\n // Asset directories contributed by active plugins.\n pluginSkillPaths: z.array(z.string()).default([]),\n pluginCommandPaths: z.array(z.string()).default([]),\n pluginInstructions: z.array(z.string()).default([]),\n // Active plan (set when a plan is approved in Plan mode)\n activePlan: z\n .object({\n title: z.string(),\n plan: z.string(),\n approvedAt: z.string(),\n })\n .nullable()\n .default(null),\n // Active browser settings (tracks what's actually running vs. what's in the settings file)\n activeBrowserSettings: z\n .object({\n enabled: z.boolean(),\n provider: z.enum(['stagehand', 'agent-browser']),\n headless: z.boolean().optional(),\n viewport: z\n .object({\n width: z.number(),\n height: z.number(),\n })\n .optional(),\n cdpUrl: z.string().optional(),\n stagehand: z\n .object({\n env: z.enum(['LOCAL', 'BROWSERBASE']),\n apiKey: z.string().optional(),\n projectId: z.string().optional(),\n })\n .optional(),\n })\n .optional(),\n});\n"],"mappings":";;;AAoGA,MAAa,cAAc,EAAE,OAAO;CAKlC,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,iBAAiB,EAAE,OAAO,CAAC,CAAC,SAAS;CACrC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS;CACtC,qBAAqB,EAAE,OAAO,CAAC,CAAC,SAAS;CACzC,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAE5B,mBAAmB,EAAE,QAAQ,CAAC,CAAC,SAAS;CAExC,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;CAE7B,wBAAwB,EAAE,QAAQ,CAAC,CAAC,SAAS;CAC7C,WAAW,EAAE,OAAO,CAAC,CAAC,QAAQ,kBAAkB;CAChD,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;CAC7B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CAEjC,iBAAiB,EAAE,OAAO,CAAC,CAAC,QAAQ,mBAAmB;CACvD,kBAA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C,CAAC;CAEb,qBAAqB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAEnD,kBAAkB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAChD,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAClD,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAElD,YAAY,EACT,OAAO;EACN,OAAO,EAAE,OAAO;EAChB,MAAM,EAAE,OAAO;EACf,YAAY,EAAE,OAAO;CACvB,CAAC,CAAC,CACD,SAAS,CAAC,CACV,QAAQ,IAAI;CAEf,uBAAuB,EACpB,OAAO;EACN,SAAS,EAAE,QAAQ;EACnB,UAAU,EAAE,KAAK,CAAC,aAAa,eAAe,CAAC;EAC/C,UAAU,EAAE,QAAQ,CAAC,CAAC,SAAS;EAC/B,UAAU,EACP,OAAO;GACN,OAAO,EAAE,OAAO;GAChB,QAAQ,EAAE,OAAO;EACnB,CAAC,CAAC,CACD,SAAS;EACZ,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;EAC5B,WAAW,EACR,OAAO;GACN,KAAK,EAAE,KAAK,CAAC,SAAS,aAAa,CAAC;GACpC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;GAC5B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;EACjC,CAAC,CAAC,CACD,SAAS;CACd,CAAC,CAAC,CACD,SAAS;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/code-sdk",
|
|
3
|
-
"version": "1.1.2-alpha.
|
|
3
|
+
"version": "1.1.2-alpha.6",
|
|
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": {
|
|
@@ -56,19 +56,19 @@
|
|
|
56
56
|
"vscode-languageserver-protocol": "^3.17.5",
|
|
57
57
|
"yaml": "^2.7.1",
|
|
58
58
|
"zod": "^4.3.6",
|
|
59
|
-
"@mastra/
|
|
60
|
-
"@mastra/
|
|
61
|
-
"@mastra/github-signals": "0.2.3-alpha.0",
|
|
62
|
-
"@mastra/fastembed": "1.2.0",
|
|
59
|
+
"@mastra/core": "1.56.0-alpha.6",
|
|
60
|
+
"@mastra/duckdb": "1.6.0-alpha.0",
|
|
63
61
|
"@mastra/agent-browser": "0.4.1",
|
|
64
|
-
"@mastra/
|
|
65
|
-
"@mastra/
|
|
66
|
-
"@mastra/
|
|
67
|
-
"@mastra/
|
|
62
|
+
"@mastra/fastembed": "1.2.0",
|
|
63
|
+
"@mastra/github-signals": "0.2.3-alpha.0",
|
|
64
|
+
"@mastra/mcp": "1.15.1-alpha.1",
|
|
65
|
+
"@mastra/libsql": "1.19.0-alpha.2",
|
|
66
|
+
"@mastra/memory": "1.25.0-alpha.2",
|
|
67
|
+
"@mastra/pg": "1.19.0-alpha.3",
|
|
68
68
|
"@mastra/schema-compat": "1.3.4",
|
|
69
|
-
"@mastra/
|
|
70
|
-
"@mastra/
|
|
71
|
-
"@mastra/
|
|
69
|
+
"@mastra/observability": "1.16.4-alpha.2",
|
|
70
|
+
"@mastra/stagehand": "0.3.1",
|
|
71
|
+
"@mastra/tavily": "1.1.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@libsql/client": "^0.17.4",
|