@mastra/code-sdk 1.6.1-alpha.0 → 1.7.0-alpha.10
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/dist/agents/instructions.d.ts +14 -2
- package/dist/agents/instructions.d.ts.map +1 -1
- package/dist/agents/instructions.js +12 -4
- package/dist/agents/instructions.js.map +1 -1
- package/dist/agents/memory.d.ts +15 -4
- package/dist/agents/memory.d.ts.map +1 -1
- package/dist/agents/memory.js +29 -17
- package/dist/agents/memory.js.map +1 -1
- package/dist/agents/prompts/index.d.ts +3 -0
- package/dist/agents/prompts/index.d.ts.map +1 -1
- package/dist/agents/prompts/index.js +9 -0
- package/dist/agents/prompts/index.js.map +1 -1
- package/dist/agents/prompts/tool-guidance.d.ts +3 -0
- package/dist/agents/prompts/tool-guidance.d.ts.map +1 -1
- package/dist/agents/prompts/tool-guidance.js +31 -1
- package/dist/agents/prompts/tool-guidance.js.map +1 -1
- package/dist/agents/subagents/execute.d.ts +3 -0
- package/dist/agents/subagents/execute.d.ts.map +1 -0
- package/dist/agents/subagents/execute.js +27 -0
- package/dist/agents/subagents/execute.js.map +1 -0
- package/dist/agents/subagents/explore.d.ts +3 -0
- package/dist/agents/subagents/explore.d.ts.map +1 -0
- package/dist/agents/subagents/explore.js +18 -0
- package/dist/agents/subagents/explore.js.map +1 -0
- package/dist/agents/subagents/plan.d.ts +3 -0
- package/dist/agents/subagents/plan.d.ts.map +1 -0
- package/dist/agents/subagents/plan.js +18 -0
- package/dist/agents/subagents/plan.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -5
- package/dist/index.js.map +1 -1
- package/dist/knowledge-inspector.d.ts.map +1 -1
- package/dist/knowledge-inspector.js +16 -9
- package/dist/knowledge-inspector.js.map +1 -1
- package/dist/knowledge-scope.d.ts +35 -0
- package/dist/knowledge-scope.d.ts.map +1 -0
- package/dist/knowledge-scope.js +47 -0
- package/dist/knowledge-scope.js.map +1 -0
- package/dist/providers/amazon-bedrock-gateway.d.ts.map +1 -1
- package/dist/providers/amazon-bedrock-gateway.js +1 -0
- package/dist/providers/amazon-bedrock-gateway.js.map +1 -1
- package/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/dist/providers/amazon-bedrock.js +20 -1
- package/dist/providers/amazon-bedrock.js.map +1 -1
- package/dist/tools/workflows/save-workflow.d.ts +36 -0
- package/dist/tools/workflows/save-workflow.d.ts.map +1 -1
- package/dist/utils/slash-command-processor.d.ts.map +1 -1
- package/dist/utils/slash-command-processor.js +7 -3
- package/dist/utils/slash-command-processor.js.map +1 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash-command-processor.js","names":["
|
|
1
|
+
{"version":3,"file":"slash-command-processor.js","names":["fs","path"],"sources":["../../src/utils/slash-command-processor.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport type { SlashCommandMetadata } from './slash-command-loader.js';\n\n/**\n * Process a slash command by replacing variables and executing shell commands\n */\nexport async function processSlashCommand(\n command: SlashCommandMetadata,\n args: string[],\n workingDir: string,\n): Promise<string> {\n const { result: withArgs, shouldAppendRawArgs } = replaceArguments(command.template, args);\n let result = withArgs;\n\n // Replace shell commands\n result = await replaceShellOutput(result, workingDir);\n\n // Replace file references\n result = await replaceFileReferences(result, workingDir);\n\n // Append raw args after shell/file processing to avoid executing user input\n if (shouldAppendRawArgs) {\n result = result.trimEnd() + `\\n\\nARGUMENTS: ${args.join(' ')}`;\n }\n\n return result;\n}\n\n/**\n * Replace argument variables in template\n * $ARGUMENTS - all arguments joined\n * $1, $2, etc. - positional arguments\n */\nfunction replaceArguments(template: string, args: string[]): { result: string; shouldAppendRawArgs: boolean } {\n let result = template;\n\n // Check if template references any argument variables\n const hasArgumentsVar = /\\$ARGUMENTS/.test(template);\n const hasPositionalVar = /\\$[1-9]\\d*/.test(template);\n\n // Replace $ARGUMENTS with all args joined\n result = result.replace(/\\$ARGUMENTS/g, args.join(' '));\n\n // Replace range arguments $1+, $2+, etc. before single positional arguments.\n args.forEach((_, index) => {\n const argNumber = index + 1;\n const pattern = new RegExp(`\\\\\\$${argNumber}\\\\+`, 'g');\n result = result.replace(pattern, args.slice(index).join(' '));\n });\n\n // Replace positional arguments $1, $2, etc.\n args.forEach((arg, index) => {\n const pattern = new RegExp(`\\\\\\$${index + 1}`, 'g');\n result = result.replace(pattern, arg);\n });\n\n // Clear unused positional and range arguments\n result = result.replace(/\\$[1-9]\\d*\\+?/g, '');\n\n return {\n result,\n shouldAppendRawArgs: !hasArgumentsVar && !hasPositionalVar && args.length > 0,\n };\n}\n\n/**\n * Replace shell command references with their output\n * Format: !`command`\n */\nasync function replaceShellOutput(template: string, workingDir: string): Promise<string> {\n const shellPattern = /!`([^`]+)`/g;\n const matches = [...template.matchAll(shellPattern)];\n\n let result = template;\n for (const match of matches) {\n const [fullMatch, command] = match;\n try {\n const output = execSync(command!, {\n cwd: workingDir,\n encoding: 'utf-8',\n timeout: 30000,\n maxBuffer: 1024 * 1024, // 1MB buffer\n });\n result = result.replace(fullMatch, output.trim());\n } catch (error) {\n console.error(`Error executing shell command \"${command}\":`, error);\n result = result.replace(fullMatch, `[Error: Failed to execute \"${command}\"]`);\n }\n }\n\n return result;\n}\n\n/**\n * Replace file references with file content\n * Formats: @filename, @path/to/file, @path\\to\\file, @C:\\path\\to\\file, or @C:/path/to/file\n * Spaces, quoted paths, and glob patterns are not supported.\n */\nasync function replaceFileReferences(template: string, workingDir: string): Promise<string> {\n const filePattern = /@((?:[A-Za-z]:[\\\\/])?[\\w./\\\\-]+)/g;\n const matches = [...template.matchAll(filePattern)];\n\n let result = template;\n for (const match of matches) {\n const [fullMatch, filePath] = match;\n try {\n const fullPath = resolveFileReferencePath(workingDir, filePath!);\n const content = await fs.readFile(fullPath, 'utf-8');\n result = result.replace(fullMatch, content);\n } catch {\n // Leave literal @mentions/search qualifiers such as @me intact when they do not resolve to files.\n }\n }\n\n return result;\n}\n\nfunction resolveFileReferencePath(workingDir: string, filePath: string): string {\n const usesWindowsPaths = [workingDir, filePath].some(value => /^[A-Za-z]:[\\\\/]/.test(value) || value.includes('\\\\'));\n const pathResolver = usesWindowsPaths ? path.win32 : path;\n\n return pathResolver.resolve(workingDir, filePath);\n}\n\n/**\n * Format a command for display in help/autocomplete\n */\nexport function formatCommandForDisplay(command: SlashCommandMetadata): string {\n const parts = [command.name];\n\n if (command.description) {\n parts.push(`- ${command.description}`);\n }\n\n return parts.join(' ');\n}\n\n/**\n * Group commands by namespace for display\n */\nexport function groupCommandsByNamespace(commands: SlashCommandMetadata[]): Map<string, SlashCommandMetadata[]> {\n const groups = new Map<string, SlashCommandMetadata[]>();\n\n for (const command of commands) {\n const namespace = command.namespace || command.name.split(':')[0] || 'general';\n\n if (!groups.has(namespace)) {\n groups.set(namespace, []);\n }\n\n groups.get(namespace)!.push(command);\n }\n\n return groups;\n}\n"],"mappings":";;;;;;;AAQA,eAAsB,oBACpB,SACA,MACA,YACiB;CACjB,MAAM,EAAE,QAAQ,UAAU,wBAAwB,iBAAiB,QAAQ,UAAU,IAAI;CACzF,IAAI,SAAS;CAGb,SAAS,MAAM,mBAAmB,QAAQ,UAAU;CAGpD,SAAS,MAAM,sBAAsB,QAAQ,UAAU;CAGvD,IAAI,qBACF,SAAS,OAAO,QAAQ,IAAI,kBAAkB,KAAK,KAAK,GAAG;CAG7D,OAAO;AACT;;;;;;AAOA,SAAS,iBAAiB,UAAkB,MAAkE;CAC5G,IAAI,SAAS;CAGb,MAAM,kBAAkB,cAAc,KAAK,QAAQ;CACnD,MAAM,mBAAmB,aAAa,KAAK,QAAQ;CAGnD,SAAS,OAAO,QAAQ,gBAAgB,KAAK,KAAK,GAAG,CAAC;CAGtD,KAAK,SAAS,GAAG,UAAU;EACzB,MAAM,YAAY,QAAQ;EAC1B,MAAM,UAAU,IAAI,OAAO,OAAO,UAAU,MAAM,G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B,CAAC,YAAY,QAAQ,CAAC,CAAC,MAAK,UAAS,kBAAkB,KAAK,KAAK,KAAK,MAAM,SAAS,IAAI,CAC9E,IAAIC,OAAK,QAAQA,OAAAA,CAEjC,QAAQ,YAAY,QAAQ;AAClD;;;;AAKA,SAAgB,wBAAwB,SAAuC;CAC7E,MAAM,QAAQ,CAAC,QAAQ,IAAI;CAE3B,IAAI,QAAQ,aACV,MAAM,KAAK,KAAK,QAAQ,aAAa;CAGvC,OAAO,MAAM,KAAK,GAAG;AACvB;;;;AAKA,SAAgB,yBAAyB,UAAuE;CAC9G,MAAM,yBAAS,IAAI,IAAoC;CAEvD,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,YAAY,QAAQ,aAAa,QAAQ,KAAK,MAAM,GAAG,CAAC,CAAC,MAAM;EAErE,IAAI,CAAC,OAAO,IAAI,SAAS,GACvB,OAAO,IAAI,WAAW,CAAC,CAAC;EAG1B,OAAO,IAAI,SAAS,CAAC,CAAE,KAAK,OAAO;CACrC;CAEA,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/code-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0-alpha.10",
|
|
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,20 +56,20 @@
|
|
|
56
56
|
"vscode-languageserver-protocol": "^3.17.5",
|
|
57
57
|
"yaml": "^2.7.1",
|
|
58
58
|
"zod": "^4.3.6",
|
|
59
|
+
"@mastra/core": "1.65.0-alpha.9",
|
|
59
60
|
"@mastra/agent-browser": "0.5.2",
|
|
60
|
-
"@mastra/duckdb": "1.6.4",
|
|
61
61
|
"@mastra/fastembed": "1.3.1",
|
|
62
|
-
"@mastra/libsql": "1.22.3",
|
|
63
62
|
"@mastra/github-signals": "0.4.0",
|
|
64
|
-
"@mastra/
|
|
63
|
+
"@mastra/duckdb": "1.7.0-alpha.1",
|
|
64
|
+
"@mastra/libsql": "1.22.4-alpha.0",
|
|
65
|
+
"@mastra/memory": "1.28.3-alpha.3",
|
|
65
66
|
"@mastra/mcp": "1.17.3",
|
|
66
|
-
"@mastra/
|
|
67
|
-
"@mastra/observability": "1.17.
|
|
68
|
-
"@mastra/pg": "1.
|
|
67
|
+
"@mastra/parallel": "0.1.1",
|
|
68
|
+
"@mastra/observability": "1.17.6-alpha.1",
|
|
69
|
+
"@mastra/pg": "1.23.0-alpha.3",
|
|
69
70
|
"@mastra/schema-compat": "1.3.8",
|
|
70
71
|
"@mastra/stagehand": "0.3.4",
|
|
71
|
-
"@mastra/tavily": "1.1.2"
|
|
72
|
-
"@mastra/parallel": "0.1.1"
|
|
72
|
+
"@mastra/tavily": "1.1.2"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@libsql/client": "^0.17.4",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"typescript": "^6.0.3",
|
|
81
81
|
"typescript-eslint": "^8.57.0",
|
|
82
82
|
"vitest": "4.1.10",
|
|
83
|
-
"@internal/lint": "0.0.130",
|
|
84
83
|
"@internal/types-builder": "0.0.105",
|
|
85
|
-
"@internal/workspace-test-utils": "0.0.74"
|
|
84
|
+
"@internal/workspace-test-utils": "0.0.74",
|
|
85
|
+
"@internal/lint": "0.0.130"
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|
|
88
88
|
"node": ">=22.19.0"
|