@mastra/deployer 1.49.0-alpha.2 → 1.49.0-alpha.4
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 +51 -0
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +11 -3
- package/dist/build/bundler.d.ts +3 -1
- package/dist/build/bundler.d.ts.map +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/fs-routing/codegen.d.ts +1 -1
- package/dist/build/fs-routing/codegen.d.ts.map +1 -1
- package/dist/build/fs-routing/discover.d.ts +7 -6
- package/dist/build/fs-routing/discover.d.ts.map +1 -1
- package/dist/build/index.cjs +23 -23
- package/dist/build/index.js +6 -6
- package/dist/build/package-info.d.ts +5 -0
- package/dist/build/package-info.d.ts.map +1 -1
- package/dist/build/types.d.ts +10 -0
- package/dist/build/types.d.ts.map +1 -1
- package/dist/build/utils.d.ts +3 -0
- package/dist/build/utils.d.ts.map +1 -1
- package/dist/build/watcher.d.ts +2 -1
- package/dist/build/watcher.d.ts.map +1 -1
- package/dist/bundler/index.cjs +3 -3
- package/dist/bundler/index.d.ts +3 -3
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-HMT7QCMZ.cjs → chunk-3GTT2N4V.cjs} +21 -47
- package/dist/chunk-3GTT2N4V.cjs.map +1 -0
- package/dist/{chunk-566UDTD4.js → chunk-4MVAT24Z.js} +140 -77
- package/dist/chunk-4MVAT24Z.js.map +1 -0
- package/dist/{chunk-WLW5IRHY.cjs → chunk-7YI2AEFO.cjs} +5 -2
- package/dist/chunk-7YI2AEFO.cjs.map +1 -0
- package/dist/{chunk-Z3DC47CH.js → chunk-ANDDGKY5.js} +5 -2
- package/dist/chunk-ANDDGKY5.js.map +1 -0
- package/dist/{chunk-CGDATNET.js → chunk-CCBU3OII.js} +3 -3
- package/dist/{chunk-CGDATNET.js.map → chunk-CCBU3OII.js.map} +1 -1
- package/dist/{chunk-2XUYQ2EJ.cjs → chunk-EU74XSTG.cjs} +43 -44
- package/dist/chunk-EU74XSTG.cjs.map +1 -0
- package/dist/{chunk-VWD7AY6H.js → chunk-FHLWDI5H.js} +332 -45
- package/dist/chunk-FHLWDI5H.js.map +1 -0
- package/dist/{chunk-IEHRALF6.cjs → chunk-IMPHNLMW.cjs} +178 -115
- package/dist/chunk-IMPHNLMW.cjs.map +1 -0
- package/dist/{chunk-6LWGRT7H.cjs → chunk-N5CQWHN3.cjs} +343 -46
- package/dist/chunk-N5CQWHN3.cjs.map +1 -0
- package/dist/{chunk-BYRFFGSN.js → chunk-ULWJZHTN.js} +12 -38
- package/dist/chunk-ULWJZHTN.js.map +1 -0
- package/dist/{chunk-VXLIM7FD.cjs → chunk-VKAFARW6.cjs} +82 -35
- package/dist/chunk-VKAFARW6.cjs.map +1 -0
- package/dist/{chunk-7RR5PJRM.cjs → chunk-VNJLLLQN.cjs} +7 -7
- package/dist/{chunk-7RR5PJRM.cjs.map → chunk-VNJLLLQN.cjs.map} +1 -1
- package/dist/{chunk-OFMQRNNY.js → chunk-YG455MPH.js} +26 -27
- package/dist/chunk-YG455MPH.js.map +1 -0
- package/dist/{chunk-5GX66TF5.js → chunk-ZL66GDLP.js} +80 -33
- package/dist/chunk-ZL66GDLP.js.map +1 -0
- package/dist/deploy/log.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +8 -8
- package/dist/docs/references/docs-deployment-cloud-providers.md +2 -0
- package/dist/docs/references/docs-deployment-mastra-server.md +2 -0
- package/dist/docs/references/docs-deployment-monorepo.md +2 -0
- package/dist/docs/references/docs-deployment-overview.md +2 -0
- package/dist/docs/references/docs-deployment-web-framework.md +2 -0
- package/dist/docs/references/docs-deployment-workflow-runners.md +2 -0
- package/dist/docs/references/reference-deployer.md +2 -0
- package/dist/index.cjs +11 -11
- package/dist/index.js +4 -4
- package/dist/server/index.cjs +10 -4
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +7 -1
- package/dist/server/index.js.map +1 -1
- package/dist/services/deps.d.ts +2 -0
- package/dist/services/deps.d.ts.map +1 -1
- package/dist/services/index.cjs +4 -4
- package/dist/services/index.js +1 -1
- package/dist/validator/custom-resolver.cjs +3 -3
- package/dist/validator/custom-resolver.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-2XUYQ2EJ.cjs.map +0 -1
- package/dist/chunk-3JVOVZ2V.cjs +0 -269
- package/dist/chunk-3JVOVZ2V.cjs.map +0 -1
- package/dist/chunk-566UDTD4.js.map +0 -1
- package/dist/chunk-5GX66TF5.js.map +0 -1
- package/dist/chunk-6LWGRT7H.cjs.map +0 -1
- package/dist/chunk-BYRFFGSN.js.map +0 -1
- package/dist/chunk-HMT7QCMZ.cjs.map +0 -1
- package/dist/chunk-IEHRALF6.cjs.map +0 -1
- package/dist/chunk-KJ4S6COO.js +0 -258
- package/dist/chunk-KJ4S6COO.js.map +0 -1
- package/dist/chunk-OFMQRNNY.js.map +0 -1
- package/dist/chunk-VWD7AY6H.js.map +0 -1
- package/dist/chunk-VXLIM7FD.cjs.map +0 -1
- package/dist/chunk-WLW5IRHY.cjs.map +0 -1
- package/dist/chunk-Z3DC47CH.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/build/watcher.ts","../src/build/serverOptions.ts","../src/build/fs-routing/discover.ts","../src/build/fs-routing/codegen.ts","../src/build/fs-routing/prepare.ts","../src/build/fs-routing/mirror.ts"],"names":["getInputOptions","readFile","join","posix","dirname","lstat","mkdir"],"mappings":";;;;;;;;;;;;AAeA,eAAsBA,gBAAAA,CACpB,SAAA,EACA,QAAA,EACA,GAAA,EACA;AAAA,EACE,S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G;AACzC,IAAA,MAAM,gBAAA,CAAiB,OAAO,CAAA,EAAG,aAAa,IAAI,KAAA,CAAM,IAAI,CAAA,CAAA,EAAI,SAAA,EAAW,QAAQ,CAAA;AAAA,EACrF;AACF;AAgBA,eAAsB,uBAAA,CAAwB,WAAmB,SAAA,EAAsC;AACrG,EAAA,MAAM,MAAA,GAAS,MAAM,gBAAA,CAAiB,SAAS,CAAA;AAC/C,EAAA,MAAM,WAAqB,EAAC;AAE5B,EAAA,KAAA,MAAW,SAAS,MAAA,EAAQ;AAC1B,IAAA,MAAM,gBAAA,CAAiB,KAAA,EAAO,KAAA,CAAM,IAAA,EAAM,WAAW,QAAQ,CAAA;AAAA,EAC/D;AAEA,EAAA,OAAO,QAAA;AACT","file":"chunk-YG455MPH.js","sourcesContent":["import { dirname, posix } from 'node:path';\nimport { noopLogger } from '@mastra/core/logger';\nimport * as pkg from 'empathic/package';\nimport type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport type { BundlerOptions } from './types';\nimport { getPackageName, slash } from './utils';\nimport type { BundlerPlatform } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: BundlerPlatform,\n env?: Record<string, string>,\n {\n sourcemap = false,\n bundlerOptions = {\n enableSourcemap: false,\n enableEsmShim: true,\n externals: true,\n },\n analysisEntries = [entryFile],\n }: { sourcemap?: boolean; bundlerOptions?: BundlerOptions; analysisEntries?: string[] } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n analysisEntries,\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform,\n isDev: true,\n bundlerOptions,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Map(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot, externalsPreset: bundlerOptions?.externals === true },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption('server', entryFile, outputDir, logger);\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n","import { lstat, readdir, readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { MAX_FS_SUBAGENT_DEPTH } from '@mastra/core/agent';\nimport matter from 'gray-matter';\nimport { slash } from '../utils';\n\n/**\n * A file-system routed agent directory discovered under `<mastraDir>/agents/`.\n * All paths are absolute and slash-normalized so they can be embedded into\n * generated module source on any platform.\n */\nexport interface DiscoveredFsAgent {\n /** Agent directory name. Used as the default `id`/`name`. */\n name: string;\n /** Absolute, slash-normalized path to the agent directory. */\n dir: string;\n /** Absolute path to `config.ts`/`config.js`, if present. */\n configPath?: string;\n /** Absolute path to `instructions.md`, if present. */\n instructionsPath?: string;\n /** Absolute path to `workspace.ts`/`workspace.js`, if present. */\n workspacePath?: string;\n /** Absolute path to `memory.ts`/`memory.js`, if present. */\n memoryPath?: string;\n /**\n * Absolute, slash-normalized path to an authored `workspace/` directory of\n * seed files, if present. These are mirrored into the deployed workspace at\n * build time (Eve parity) so the agent starts with them on disk.\n */\n workspaceSeedDir?: string;\n /** Tools discovered under `tools/`, in stable (sorted) order. */\n tools: { key: string; path: string }[];\n /** Skills discovered under `skills/`, in stable (sorted) order. */\n skills: DiscoveredFsSkill[];\n /**\n * Declared subagents discovered under `subagents/`, in stable (sorted) order.\n * Subagents may declare their own `subagents/`, up to `MAX_FS_SUBAGENT_DEPTH`\n * levels below the top-level agent; deeper `subagents/` directories are\n * ignored with a warning.\n */\n subagents: DiscoveredFsAgent[];\n}\n\n/**\n * A skill discovered under `agents/<name>/skills/`.\n *\n * - `kind: 'module'` — a `.ts`/`.js` file whose default export is a `createSkill(...)`\n * result. Codegen imports it directly; `name`/`description`/`instructions` are\n * unknown at discovery time and resolved at runtime from the module.\n * - `kind: 'packaged'` — a `SKILL.md` (optionally with a `references/` subdir) or a\n * flat `<skill>.md`. Codegen inlines it via `createSkill(...)` using the parsed\n * fields below so the deployed bundle carries no filesystem dependency.\n */\nexport type DiscoveredFsSkill =\n | {\n kind: 'module';\n /** Absolute, slash-normalized path to the `.ts`/`.js` skill module. */\n path: string;\n }\n | {\n kind: 'packaged';\n name: string;\n description: string;\n instructions: string;\n /** Reference file contents keyed by relative path (from `references/`). */\n references: Record<string, string>;\n };\n\nconst CONFIG_BASENAMES = ['config.ts', 'config.js'];\nconst WORKSPACE_BASENAMES = ['workspace.ts', 'workspace.js'];\nconst MEMORY_BASENAMES = ['memory.ts', 'memory.js'];\nconst INSTRUCTIONS_BASENAME = 'instructions.md';\nconst TOOL_EXTENSIONS = ['.ts', '.js'];\nconst SKILL_MODULE_EXTENSIONS = ['.ts', '.js'];\nconst SKILL_MD_BASENAME = 'SKILL.md';\n\n/**\n * Presence check that does NOT follow symlinks. Returns `false` for symlinks\n * (and broken links) so a symlinked `config.ts`/`instructions.md`/`workspace.ts`/\n * `memory.ts` is never inlined or imported into the generated bundle.\n */\nasync function exists(path: string): Promise<boolean> {\n try {\n return !(await lstat(path)).isSymbolicLink();\n } catch {\n return false;\n }\n}\n\n/**\n * Returns the slash-normalized path when `path` is a real directory (not a\n * symlink). Symlinked directories are rejected to prevent the build from\n * following links out of the project tree during discovery.\n */\nasync function realDirectory(path: string): Promise<string | undefined> {\n try {\n const info = await lstat(path);\n if (info.isDirectory() && !info.isSymbolicLink()) {\n return slash(path);\n }\n } catch {\n // not present\n }\n return undefined;\n}\n\nasync function directoryExists(path: string): Promise<string | undefined> {\n return realDirectory(path);\n}\n\nasync function firstExisting(dir: string, basenames: string[]): Promise<string | undefined> {\n for (const basename of basenames) {\n const candidate = join(dir, basename);\n if (await exists(candidate)) {\n return slash(candidate);\n }\n }\n return undefined;\n}\n\nfunction isTestFile(basename: string): boolean {\n return /\\.(test|spec)\\.(ts|js)$/.test(basename);\n}\n\nfunction toolKey(basename: string): string {\n return basename.replace(/\\.(ts|js)$/, '');\n}\n\nasync function discoverTools(toolsDir: string): Promise<DiscoveredFsAgent['tools']> {\n if (!(await exists(toolsDir))) {\n return [];\n }\n\n let entries: string[];\n try {\n entries = await readdir(toolsDir);\n } catch {\n return [];\n }\n\n const tools: DiscoveredFsAgent['tools'] = [];\n for (const basename of entries.sort()) {\n if (isTestFile(basename)) {\n continue;\n }\n if (!TOOL_EXTENSIONS.some(ext => basename.endsWith(ext))) {\n continue;\n }\n const path = join(toolsDir, basename);\n // Use lstat so symlinks are detected (not followed). Skip symlinks and\n // directories: a symlinked tool file could point anywhere on the build\n // machine and be embedded into generated import code.\n const stats = await lstat(path);\n if (stats.isSymbolicLink() || stats.isDirectory()) {\n continue;\n }\n tools.push({ key: toolKey(basename), path: slash(path) });\n }\n\n return tools;\n}\n\nasync function readReferences(referencesDir: string): Promise<Record<string, string>> {\n if (!(await exists(referencesDir))) {\n return {};\n }\n const references: Record<string, string> = {};\n let entries: string[];\n try {\n entries = await readdir(referencesDir);\n } catch {\n return {};\n }\n for (const basename of entries.sort()) {\n const path = join(referencesDir, basename);\n // Use lstat so symlinks are detected (not followed). Skip symlinks: a\n // symlink under `references/` could point anywhere on the build machine and\n // silently embed arbitrary file contents into the generated bundle.\n const stats = await lstat(path);\n if (stats.isSymbolicLink() || stats.isDirectory()) {\n continue;\n }\n references[basename] = await readFile(path, 'utf-8');\n }\n return references;\n}\n\nasync function parsePackagedSkill(\n skillMdPath: string,\n fallbackName: string,\n references: Record<string, string> = {},\n): Promise<Extract<DiscoveredFsSkill, { kind: 'packaged' }>> {\n const raw = await readFile(skillMdPath, 'utf-8');\n const parsed = matter(raw);\n const frontmatter = parsed.data as { name?: string; description?: string };\n const name = frontmatter.name ?? fallbackName;\n const description = frontmatter.description ?? '';\n const instructions = parsed.content.trim();\n return { kind: 'packaged', name, description, instructions, references };\n}\n\nfunction skillModuleName(basename: string): string {\n return basename.replace(/\\.(ts|js)$/, '');\n}\n\nasync function discoverSkills(skillsDir: string): Promise<DiscoveredFsSkill[]> {\n if (!(await exists(skillsDir))) {\n return [];\n }\n\n let entries: string[];\n try {\n entries = await readdir(skillsDir);\n } catch {\n return [];\n }\n\n const skills: DiscoveredFsSkill[] = [];\n for (const basename of entries.sort()) {\n if (isTestFile(basename)) {\n continue;\n }\n const path = join(skillsDir, basename);\n // Use lstat so symlinks are detected (not followed). Skip symlinks: a\n // symlinked skill module/markdown could point anywhere on the build machine\n // and be bundled or inlined into the generated output.\n const stats = await lstat(path);\n if (stats.isSymbolicLink()) {\n continue;\n }\n const isDir = stats.isDirectory();\n\n // Packaged skill directory: <skill>/SKILL.md (+ references/)\n if (isDir) {\n const skillMd = join(path, SKILL_MD_BASENAME);\n if (await exists(skillMd)) {\n const references = await readReferences(join(path, 'references'));\n skills.push(await parsePackagedSkill(skillMd, skillModuleName(basename), references));\n }\n continue;\n }\n\n // createSkill module: <skill>.ts | <skill>.js\n if (SKILL_MODULE_EXTENSIONS.some(ext => basename.endsWith(ext))) {\n skills.push({ kind: 'module', path: slash(path) });\n continue;\n }\n\n // Flat markdown skill: <skill>.md\n if (basename.endsWith('.md')) {\n const skill = await parsePackagedSkill(path, basename.replace(/\\.md$/, ''));\n skills.push(skill);\n }\n }\n\n return skills;\n}\n\n/**\n * Discover a single agent directory: its `config`/`instructions`/`workspace`\n * files plus `tools/`, `skills/`, and declared `subagents/`. Returns\n * `undefined` when `dir` is not an agent directory (no `config.(ts|js)` and no\n * `instructions.md`).\n *\n * `depth` is the subagent nesting level (`0` for top-level agents). Discovery\n * recurses into `subagents/` until `MAX_FS_SUBAGENT_DEPTH`; deeper directories\n * are ignored with a warning.\n */\nasync function discoverAgentDir(\n dir: string,\n name: string,\n depth: number,\n onWarn?: (message: string) => void,\n): Promise<DiscoveredFsAgent | undefined> {\n const configPath = await firstExisting(dir, CONFIG_BASENAMES);\n const instructionsPath = (await exists(join(dir, INSTRUCTIONS_BASENAME)))\n ? slash(join(dir, INSTRUCTIONS_BASENAME))\n : undefined;\n\n // Not an agent directory unless it has a config or instructions file.\n if (!configPath && !instructionsPath) {\n return undefined;\n }\n\n const workspacePath = await firstExisting(dir, WORKSPACE_BASENAMES);\n const memoryPath = await firstExisting(dir, MEMORY_BASENAMES);\n const workspaceSeedDir = await directoryExists(join(dir, 'workspace'));\n const tools = await discoverTools(join(dir, 'tools'));\n const skills = await discoverSkills(join(dir, 'skills'));\n const subagents = await discoverSubagents(dir, depth, onWarn);\n\n return {\n name,\n dir: slash(dir),\n configPath,\n instructionsPath,\n workspacePath,\n memoryPath,\n workspaceSeedDir,\n tools,\n skills,\n subagents,\n };\n}\n\n/**\n * Discover declared subagents under `<dir>/subagents/*`. `parentDepth` is the\n * parent agent's nesting level (`0` for top-level agents). Discovery recurses\n * until `MAX_FS_SUBAGENT_DEPTH` levels of subagents; a `subagents/` directory\n * that would exceed the cap is skipped with a warning.\n */\nasync function discoverSubagents(\n parentDir: string,\n parentDepth: number,\n onWarn?: (message: string) => void,\n): Promise<DiscoveredFsAgent[]> {\n const subagentsDir = join(parentDir, 'subagents');\n if (!(await exists(subagentsDir))) {\n return [];\n }\n\n if (parentDepth >= MAX_FS_SUBAGENT_DEPTH) {\n onWarn?.(\n `Ignoring subagents in \"${slash(subagentsDir)}\": subagents may only nest ${MAX_FS_SUBAGENT_DEPTH} levels below a top-level agent.`,\n );\n return [];\n }\n\n let entries: string[];\n try {\n entries = await readdir(subagentsDir);\n } catch {\n return [];\n }\n\n const subagents: DiscoveredFsAgent[] = [];\n for (const name of entries.sort()) {\n const dir = join(subagentsDir, name);\n if (!(await realDirectory(dir))) {\n continue;\n }\n const child = await discoverAgentDir(dir, name, parentDepth + 1, onWarn);\n if (child) {\n subagents.push(child);\n }\n }\n\n return subagents;\n}\n\n/**\n * Scan `<mastraDir>/agents/*` for file-system routed agents. A directory is\n * treated as an agent only when it contains a `config.(ts|js)` or an\n * `instructions.md`; other directories are ignored. Each agent may declare\n * `subagents/` up to `MAX_FS_SUBAGENT_DEPTH` levels deep. Returns descriptors\n * with absolute, slash-normalized paths ready for codegen. Performs no module\n * evaluation — only filesystem inspection.\n */\nexport async function discoverFsAgents(\n mastraDir: string,\n onWarn?: (message: string) => void,\n): Promise<DiscoveredFsAgent[]> {\n const agentsDir = join(mastraDir, 'agents');\n if (!(await exists(agentsDir))) {\n return [];\n }\n\n let entries: string[];\n try {\n entries = await readdir(agentsDir);\n } catch {\n return [];\n }\n\n const discovered: DiscoveredFsAgent[] = [];\n for (const name of entries.sort()) {\n const dir = join(agentsDir, name);\n if (!(await realDirectory(dir))) {\n continue;\n }\n const agent = await discoverAgentDir(dir, name, 0, onWarn);\n if (agent) {\n discovered.push(agent);\n }\n }\n\n return discovered;\n}\n","import { readFile } from 'node:fs/promises';\nimport type { DiscoveredFsAgent } from './discover';\n\nfunction sanitizeIdentifier(name: string, prefix: string, index: string): string {\n const cleaned = name.replace(/[^a-zA-Z0-9_$]/g, '_');\n return `${prefix}_${index}_${cleaned}`;\n}\n\n/**\n * Emit the imports for a single discovered agent into `lines` and return the\n * source of its `assembleAgentFromFsEntry` entry object (the `{ name, config,\n * ... }` argument). `idPath` is a dot-free, unique path index (e.g. `0` for the\n * first top-level agent, `0_1` for its second subagent) used to keep generated\n * identifiers unique across the parent/child tree. `workspaceName` is the\n * slash-joined workspace key (`<parent>/<child>` for subagents) so seed files\n * don't collide. Discovered subagents are emitted recursively as a nested\n * `subagents: [...]` field (discovery already enforces the depth cap).\n */\nasync function emitAgentEntry(\n agent: DiscoveredFsAgent,\n idPath: string,\n workspaceName: string,\n lines: string[],\n): Promise<string> {\n const configIdent = sanitizeIdentifier(agent.name, 'config', idPath);\n const toolIdents: { key: string; ident: string }[] = [];\n\n if (agent.configPath) {\n lines.push(`import ${configIdent} from ${JSON.stringify(agent.configPath)};`);\n }\n\n let workspaceIdent: string | undefined;\n if (agent.workspacePath) {\n workspaceIdent = sanitizeIdentifier(`${agent.name}_workspace`, 'workspace', idPath);\n lines.push(`import ${workspaceIdent} from ${JSON.stringify(agent.workspacePath)};`);\n }\n\n let memoryIdent: string | undefined;\n if (agent.memoryPath) {\n memoryIdent = sanitizeIdentifier(`${agent.name}_memory`, 'memory', idPath);\n lines.push(`import ${memoryIdent} from ${JSON.stringify(agent.memoryPath)};`);\n }\n\n for (let t = 0; t < agent.tools.length; t++) {\n const tool = agent.tools[t]!;\n const ident = sanitizeIdentifier(`${agent.name}_${tool.key}`, 'tool', `${idPath}_${t}`);\n lines.push(`import ${ident} from ${JSON.stringify(tool.path)};`);\n toolIdents.push({ key: tool.key, ident });\n }\n\n // Skills: `createSkill(...)` modules are imported and used directly;\n // packaged `SKILL.md` skills are inlined via `createSkill({...})`.\n const skillExprs: string[] = [];\n const agentSkills = agent.skills ?? [];\n for (let s = 0; s < agentSkills.length; s++) {\n const skill = agentSkills[s]!;\n if (skill.kind === 'module') {\n const ident = sanitizeIdentifier(`${agent.name}_skill`, 'skill', `${idPath}_${s}`);\n lines.push(`import ${ident} from ${JSON.stringify(skill.path)};`);\n skillExprs.push(ident);\n } else {\n const referenceFields = Object.entries(skill.references).map(\n ([key, value]) => `${JSON.stringify(key)}: ${JSON.stringify(value)}`,\n );\n const skillFields = [\n `name: ${JSON.stringify(skill.name)}`,\n `description: ${JSON.stringify(skill.description)}`,\n `instructions: ${JSON.stringify(skill.instructions)}`,\n ];\n if (referenceFields.length > 0) {\n skillFields.push(`references: { ${referenceFields.join(', ')} }`);\n }\n skillExprs.push(`__createSkill({ ${skillFields.join(', ')} })`);\n }\n }\n\n let instructionsMd: string | undefined;\n if (agent.instructionsPath) {\n instructionsMd = await readFile(agent.instructionsPath, 'utf-8');\n }\n\n // Declared subagents. Each is itself an `assembleAgentFromFsEntry` entry\n // object, recursively carrying its own `subagents`.\n const subagentExprs: string[] = [];\n for (let c = 0; c < agent.subagents.length; c++) {\n const child = agent.subagents[c]!;\n const childExpr = await emitAgentEntry(child, `${idPath}_${c}`, `${workspaceName}/${child.name}`, lines);\n subagentExprs.push(childExpr);\n }\n\n const entryFields: string[] = [`name: ${JSON.stringify(agent.name)}`];\n if (agent.configPath) {\n entryFields.push(`config: ${configIdent}`);\n }\n if (instructionsMd !== undefined) {\n entryFields.push(`instructionsMd: ${JSON.stringify(instructionsMd)}`);\n }\n if (toolIdents.length > 0) {\n const toolEntries = toolIdents.map(({ key, ident }) => `{ key: ${JSON.stringify(key)}, tool: ${ident} }`);\n entryFields.push(`tools: [${toolEntries.join(', ')}]`);\n }\n if (skillExprs.length > 0) {\n entryFields.push(`skills: [${skillExprs.join(', ')}]`);\n }\n if (subagentExprs.length > 0) {\n entryFields.push(`subagents: [${subagentExprs.join(', ')}]`);\n }\n if (workspaceIdent) {\n entryFields.push(`workspace: ${workspaceIdent}`);\n }\n if (memoryIdent) {\n entryFields.push(`memory: ${memoryIdent}`);\n }\n // Default-on parity: every FS agent gets a default workspace (file + shell\n // tools) rooted at a per-agent `workspace/` dir next to the bundle, unless\n // config.ts or workspace.ts supplies one. Assembly applies the explicit >\n // convention > default precedence. Subagents nest under `<parent>/<child>` so\n // their seed directories never collide with the parent's.\n entryFields.push(`defaultWorkspaceBasePath: __workspaceBasePath(${JSON.stringify(workspaceName)})`);\n\n return `{ ${entryFields.join(', ')} }`;\n}\n\n/**\n * Generate the source of a wrapper module that:\n * 1. imports the user's real Mastra entry,\n * 2. imports each discovered `config.ts`, `tools/*.ts`, `skills/*.ts`\n * (`createSkill(...)` modules), `workspace.ts`, and `memory.ts`, inlining\n * packaged `SKILL.md` skills,\n * 3. assembles `Agent` instances via `assembleAgentFromFsEntry`, wiring any\n * declared `subagents/` into the parent (nested up to `MAX_FS_SUBAGENT_DEPTH`),\n * 4. registers them onto the user's `mastra` instance (code-registered agents\n * win on name collisions), and\n * 5. re-exports everything from the user's entry so this module is a drop-in\n * replacement for the original `#mastra` target.\n *\n * `instructions.md` contents are inlined at codegen time so no markdown loader\n * plugin is required in the bundler graph.\n *\n * @param userEntry slash-normalized absolute path to the user's mastra entry.\n * @param agents discovered fs-routed agents (absolute, slash-normalized paths).\n */\nexport async function generateFsAgentsModule(userEntry: string, agents: DiscoveredFsAgent[]): Promise<string> {\n const lines: string[] = [];\n\n const hasInlineSkills = (function check(list: DiscoveredFsAgent[]): boolean {\n return list.some(a => (a.skills ?? []).some(s => s.kind === 'packaged') || check(a.subagents ?? []));\n })(agents);\n\n lines.push(`import { assembleAgentFromFsEntry } from '@mastra/core/agent';`);\n if (hasInlineSkills) {\n lines.push(`import { createSkill as __createSkill } from '@mastra/core/skills';`);\n }\n lines.push(`import { fileURLToPath as __fileURLToPath } from 'node:url';`);\n lines.push(`import { dirname as __dirname, join as __join } from 'node:path';`);\n lines.push(`import * as __userEntry from ${JSON.stringify(userEntry)};`);\n lines.push(`export * from ${JSON.stringify(userEntry)};`);\n lines.push(``);\n // Resolve workspace base paths relative to this bundled module so they point\n // at `<bundle>/workspace/<name>` wherever the bundle is deployed. Seed files\n // authored under `agents/<name>/workspace/**` are mirrored there at build time.\n // `name` may be a slash-joined path (`<parent>/<child>`) for subagents.\n lines.push(`const __bundleDir = __dirname(__fileURLToPath(import.meta.url));`);\n lines.push(`const __workspaceBasePath = name => __join(__bundleDir, 'workspace', ...name.split('/'));`);\n lines.push(``);\n\n const entryExprs: string[] = [];\n for (let i = 0; i < agents.length; i++) {\n const agent = agents[i]!;\n const expr = await emitAgentEntry(agent, `${i}`, agent.name, lines);\n entryExprs.push(expr);\n }\n\n lines.push(``);\n lines.push(`const __fsAgentEntries = [`);\n for (const expr of entryExprs) {\n lines.push(` ${expr},`);\n }\n lines.push(`];`);\n lines.push(``);\n lines.push(`const __fsAgents = Object.create(null);`);\n lines.push(`for (const __entry of __fsAgentEntries) {`);\n lines.push(` __fsAgents[__entry.name] = assembleAgentFromFsEntry(__entry, {`);\n lines.push(` onWarn: msg => __userEntry.mastra?.getLogger?.()?.warn?.(msg) ?? console.warn(msg),`);\n lines.push(` });`);\n lines.push(`}`);\n lines.push(``);\n lines.push(`if (__userEntry.mastra && typeof __userEntry.mastra.__registerFsAgents === 'function') {`);\n lines.push(` __userEntry.mastra.__registerFsAgents(__fsAgents);`);\n lines.push(`}`);\n lines.push(``);\n lines.push(`export const mastra = __userEntry.mastra;`);\n\n return lines.join('\\n');\n}\n","import { mkdir, writeFile } from 'node:fs/promises';\nimport { dirname, join, posix } from 'node:path';\nimport { slash } from '../utils';\nimport { generateFsAgentsModule } from './codegen';\nimport { discoverFsAgents } from './discover';\n\nexport interface PrepareFsAgentsEntryResult {\n /**\n * The entry file that should be fed to the bundler/analyzer. When fs-routed\n * agents are found this is a generated wrapper module that registers them onto\n * the user's mastra instance; otherwise it is the original entry unchanged.\n */\n entryFile: string;\n /**\n * Glob tool paths for tools defined under `agents/*\\/tools` so they are\n * bundled alongside the top-level `tools/` directory.\n */\n toolPaths: string[];\n /** Number of fs-routed agents discovered. */\n agentCount: number;\n /**\n * Generated wrapper source to write to {@link entryFile}, or `undefined` when\n * there are no fs-routed agents. The write is deferred so callers can run it\n * *after* `bundler.prepare()` empties the output directory — otherwise the\n * wrapper is wiped before the bundler reads it.\n */\n moduleSource?: string;\n}\n\n/**\n * Discover fs-routed agents under `<mastraDir>/agents/*` and, if any exist,\n * generate a wrapper entry module that registers them onto the user's mastra\n * instance. Returns the entry the bundler should use plus extra tool glob paths\n * so `agents/*\\/tools` are bundled.\n *\n * This does NOT write the wrapper to disk; call {@link writeFsAgentsEntry} with\n * the result after `bundler.prepare()` so the generated file is not wiped when\n * the output directory is emptied.\n *\n * When no fs-routed agents are present the original entry is returned unchanged,\n * so existing code-only projects are completely unaffected.\n */\nexport async function prepareFsAgentsEntry(\n mastraDir: string,\n entryFile: string,\n outputDirectory: string,\n): Promise<PrepareFsAgentsEntryResult> {\n const agents = await discoverFsAgents(mastraDir);\n\n if (agents.length === 0) {\n return { entryFile, toolPaths: [], agentCount: 0 };\n }\n\n const moduleSource = await generateFsAgentsModule(slash(entryFile), agents);\n const generatedEntry = join(outputDirectory, '.mastra-fs-agents-entry.mjs');\n\n const normalizedMastraDir = slash(mastraDir);\n const toolPaths = [\n posix.join(normalizedMastraDir, 'agents/*/tools/**/*.{js,ts}'),\n `!${posix.join(normalizedMastraDir, 'agents/*/tools/**/*.{test,spec}.{js,ts}')}`,\n `!${posix.join(normalizedMastraDir, 'agents/*/tools/**/__tests__/**')}`,\n ];\n\n return { entryFile: generatedEntry, toolPaths, agentCount: agents.length, moduleSource };\n}\n\n/**\n * Write the generated fs-agents wrapper produced by {@link prepareFsAgentsEntry}\n * to its `entryFile`. No-op when there are no fs-routed agents. Call this AFTER\n * `bundler.prepare()` (which empties the output directory) so the wrapper\n * survives for the bundler/watcher to read.\n */\nexport async function writeFsAgentsEntry(result: PrepareFsAgentsEntryResult): Promise<void> {\n if (!result.moduleSource) {\n return;\n }\n\n await mkdir(dirname(result.entryFile), { recursive: true });\n await writeFile(result.entryFile, result.moduleSource, 'utf-8');\n}\n","import { cp, lstat, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { discoverFsAgents } from './discover';\nimport type { DiscoveredFsAgent } from './discover';\n\n/**\n * Skip symlinks when copying workspace seeds. A symlink under\n * `agents/<name>/workspace/` could point outside the workspace and be preserved\n * in the bundle, letting the agent read arbitrary files at runtime. We copy only\n * regular files and directories.\n */\nasync function rejectSymlinks(source: string): Promise<boolean> {\n const stats = await lstat(source);\n return !stats.isSymbolicLink();\n}\n\nasync function mirrorAgentSeeds(\n agent: DiscoveredFsAgent,\n workspaceName: string,\n bundleDir: string,\n mirrored: string[],\n): Promise<void> {\n if (agent.workspaceSeedDir) {\n const destination = join(bundleDir, 'workspace', ...workspaceName.split('/'));\n await mkdir(destination, { recursive: true });\n await cp(agent.workspaceSeedDir, destination, { recursive: true, filter: rejectSymlinks });\n mirrored.push(workspaceName);\n }\n\n // Subagents nest under `<parent>/<child>`, matching the codegen workspace key.\n for (const child of agent.subagents ?? []) {\n await mirrorAgentSeeds(child, `${workspaceName}/${child.name}`, bundleDir, mirrored);\n }\n}\n\n/**\n * Mirror authored `agents/<name>/workspace/**` seed files into the bundled\n * output so each fs-routed agent starts with them on disk (Eve parity). Files\n * are copied to `<bundleDir>/workspace/<name>`, which is exactly where the\n * generated entry roots each agent's default workspace at runtime (resolved\n * relative to the bundled module via `import.meta.url`). Declared subagents\n * mirror to the nested `<bundleDir>/workspace/<parent>/<child>` path.\n *\n * Must run AFTER the bundle step, since bundling recreates the output dir.\n *\n * @param mastraDir The user's `src/mastra` directory (source of seeds).\n * @param bundleDir The final bundle directory (e.g. `<outputDirectory>/output`).\n * @returns the workspace names whose seeds were mirrored (`<parent>/<child>` for subagents).\n */\nexport async function mirrorFsAgentWorkspaces(mastraDir: string, bundleDir: string): Promise<string[]> {\n const agents = await discoverFsAgents(mastraDir);\n const mirrored: string[] = [];\n\n for (const agent of agents) {\n await mirrorAgentSeeds(agent, agent.name, bundleDir, mirrored);\n }\n\n return mirrored;\n}\n"]}
|
|
@@ -21,10 +21,16 @@ var createPinoStream = (logger) => {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
|
+
var SAFE_SHELL_ARG = /^[\w@%+=:,./^~-]*$/;
|
|
24
25
|
function createChildProcessLogger({ logger, root }) {
|
|
25
26
|
const pinoStream = createPinoStream(logger);
|
|
26
27
|
return async ({ cmd, args, env }) => {
|
|
27
28
|
try {
|
|
29
|
+
for (const arg of args) {
|
|
30
|
+
if (!SAFE_SHELL_ARG.test(arg)) {
|
|
31
|
+
throw new Error(`Refusing to pass unsafe argument to shell command: ${JSON.stringify(arg)}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
28
34
|
const subprocess = spawn(cmd, args, {
|
|
29
35
|
cwd: root,
|
|
30
36
|
shell: true,
|
|
@@ -59,6 +65,60 @@ function createChildProcessLogger({ logger, root }) {
|
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
// src/services/deps.ts
|
|
68
|
+
var PNPM_CONFIG_KEYS_TO_COPY = /* @__PURE__ */ new Set([
|
|
69
|
+
"allowBuilds",
|
|
70
|
+
"onlyBuiltDependencies",
|
|
71
|
+
"ignoredBuiltDependencies",
|
|
72
|
+
"neverBuiltDependencies",
|
|
73
|
+
"minimumReleaseAge",
|
|
74
|
+
"minimumReleaseAgeExclude",
|
|
75
|
+
"trustPolicy",
|
|
76
|
+
"trustPolicyExclude",
|
|
77
|
+
"trustPolicyIgnoreAfter",
|
|
78
|
+
"supportedArchitectures"
|
|
79
|
+
]);
|
|
80
|
+
function getTopLevelYamlKey(line) {
|
|
81
|
+
const match = /^(?!\s)([\w-]+):/.exec(line);
|
|
82
|
+
return match?.[1];
|
|
83
|
+
}
|
|
84
|
+
function copyPnpmWorkspaceSettings(source, options = {}) {
|
|
85
|
+
const hasArchitecture = Boolean(options.os?.length || options.cpu?.length || options.libc?.length);
|
|
86
|
+
const lines = source.split(/\r?\n/);
|
|
87
|
+
const blocks = [];
|
|
88
|
+
for (let index = 0; index < lines.length; ) {
|
|
89
|
+
const key = getTopLevelYamlKey(lines[index] ?? "");
|
|
90
|
+
if (!key) {
|
|
91
|
+
index += 1;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const start = index;
|
|
95
|
+
index += 1;
|
|
96
|
+
while (index < lines.length && !getTopLevelYamlKey(lines[index] ?? "")) {
|
|
97
|
+
index += 1;
|
|
98
|
+
}
|
|
99
|
+
if (!PNPM_CONFIG_KEYS_TO_COPY.has(key) || key === "supportedArchitectures" && hasArchitecture) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const block = lines.slice(start, index).join("\n").trimEnd();
|
|
103
|
+
if (block) {
|
|
104
|
+
blocks.push(block);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (hasArchitecture) {
|
|
108
|
+
const architectureBlock = ["supportedArchitectures:"];
|
|
109
|
+
if (options.os?.length) {
|
|
110
|
+
architectureBlock.push(` os: ${JSON.stringify(options.os)}`);
|
|
111
|
+
}
|
|
112
|
+
if (options.cpu?.length) {
|
|
113
|
+
architectureBlock.push(` cpu: ${JSON.stringify(options.cpu)}`);
|
|
114
|
+
}
|
|
115
|
+
if (options.libc?.length) {
|
|
116
|
+
architectureBlock.push(` libc: ${JSON.stringify(options.libc)}`);
|
|
117
|
+
}
|
|
118
|
+
blocks.push(architectureBlock.join("\n"));
|
|
119
|
+
}
|
|
120
|
+
return ["packages:\n - '.'", ...blocks].join("\n\n") + "\n";
|
|
121
|
+
}
|
|
62
122
|
var Deps = class extends MastraBase {
|
|
63
123
|
packageManager;
|
|
64
124
|
rootDir;
|
|
@@ -120,36 +180,25 @@ var Deps = class extends MastraBase {
|
|
|
120
180
|
}
|
|
121
181
|
});
|
|
122
182
|
}
|
|
123
|
-
|
|
183
|
+
findPnpmWorkspaceFile(dir) {
|
|
124
184
|
const workspaceYamlPath = path.join(dir, "pnpm-workspace.yaml");
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
" sharp: true",
|
|
132
|
-
" protobufjs: true",
|
|
133
|
-
" workerd: true",
|
|
134
|
-
" bufferutil: true",
|
|
135
|
-
" utf-8-validate: true",
|
|
136
|
-
"minimumReleaseAge: 0"
|
|
137
|
-
];
|
|
138
|
-
if (options.os?.length || options.cpu?.length || options.libc?.length) {
|
|
139
|
-
lines.push("");
|
|
140
|
-
lines.push("supportedArchitectures:");
|
|
141
|
-
if (options.os?.length) {
|
|
142
|
-
lines.push(` os: ${JSON.stringify(options.os)}`);
|
|
143
|
-
}
|
|
144
|
-
if (options.cpu?.length) {
|
|
145
|
-
lines.push(` cpu: ${JSON.stringify(options.cpu)}`);
|
|
146
|
-
}
|
|
147
|
-
if (options.libc?.length) {
|
|
148
|
-
lines.push(` libc: ${JSON.stringify(options.libc)}`);
|
|
149
|
-
}
|
|
185
|
+
if (fs3__default.existsSync(workspaceYamlPath)) {
|
|
186
|
+
return workspaceYamlPath;
|
|
187
|
+
}
|
|
188
|
+
const parentDir = path.resolve(dir, "..");
|
|
189
|
+
if (parentDir !== dir) {
|
|
190
|
+
return this.findPnpmWorkspaceFile(parentDir);
|
|
150
191
|
}
|
|
151
|
-
|
|
152
|
-
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
async writePnpmConfig(dir, options = {}) {
|
|
195
|
+
const sourceWorkspaceYamlPath = this.findPnpmWorkspaceFile(this.rootDir);
|
|
196
|
+
const sourceWorkspaceYaml = sourceWorkspaceYamlPath ? await fsPromises.readFile(sourceWorkspaceYamlPath, "utf-8") : "";
|
|
197
|
+
await fsPromises.writeFile(
|
|
198
|
+
path.join(dir, "pnpm-workspace.yaml"),
|
|
199
|
+
copyPnpmWorkspaceSettings(sourceWorkspaceYaml, options),
|
|
200
|
+
"utf-8"
|
|
201
|
+
);
|
|
153
202
|
}
|
|
154
203
|
async writeYarnConfig(dir, options) {
|
|
155
204
|
const yarnrcPath = path.join(dir, ".yarnrc.yml");
|
|
@@ -201,9 +250,7 @@ ${Object.entries(config.supportedArchitectures).map(([key, value]) => ` ${key}:
|
|
|
201
250
|
let args = [];
|
|
202
251
|
switch (pm) {
|
|
203
252
|
case "pnpm":
|
|
204
|
-
|
|
205
|
-
await this.writePnpmConfig(dir, architecture);
|
|
206
|
-
}
|
|
253
|
+
await this.writePnpmConfig(dir, architecture);
|
|
207
254
|
break;
|
|
208
255
|
case "yarn":
|
|
209
256
|
await ensureFile(path.join(dir, "yarn.lock"));
|
|
@@ -414,5 +461,5 @@ var FileService = class {
|
|
|
414
461
|
};
|
|
415
462
|
|
|
416
463
|
export { Deps, DepsService, EnvService, FileService, createChildProcessLogger, createPinoStream };
|
|
417
|
-
//# sourceMappingURL=chunk-
|
|
418
|
-
//# sourceMappingURL=chunk-
|
|
464
|
+
//# sourceMappingURL=chunk-ZL66GDLP.js.map
|
|
465
|
+
//# sourceMappingURL=chunk-ZL66GDLP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/deploy/log.ts","../src/services/deps.ts","../src/services/env.ts","../src/services/f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,MAAA,WAAA,GAAc,WAAA,CAAY,UAAA,CAAW,MAAA,EAAQ,OAAO,CAAA;AAAA,IACtD,CAAC,CAAA;AAED,IAAAA,YAAAA,CAAG,aAAA,CAAc,QAAA,EAAU,WAAW,CAAA;AAAA,EACxC;AACF","file":"chunk-ZL66GDLP.js","sourcesContent":["import { spawn } from 'node:child_process';\nimport { Writable } from 'node:stream';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport const createPinoStream = (logger: IMastraLogger) => {\n return new Writable({\n write(chunk, _encoding, callback) {\n // Convert Buffer/string to string and trim whitespace\n const line = chunk.toString().trim();\n\n if (line) {\n console.info(line);\n // Log each line through Pino\n logger.info(line);\n }\n\n callback();\n },\n });\n};\n\n/**\n * Args are joined into a shell command (`shell: true` is required for package\n * manager shims on Windows), so only allow characters that appear in package\n * specifiers and CLI flags — never shell metacharacters (CodeQL\n * js/shell-command-constructed-from-input).\n */\nconst SAFE_SHELL_ARG = /^[\\w@%+=:,./^~-]*$/;\n\nexport function createChildProcessLogger({ logger, root }: { logger: IMastraLogger; root: string }) {\n const pinoStream = createPinoStream(logger);\n return async ({ cmd, args, env }: { cmd: string; args: string[]; env: Record<string, string> }) => {\n try {\n for (const arg of args) {\n if (!SAFE_SHELL_ARG.test(arg)) {\n throw new Error(`Refusing to pass unsafe argument to shell command: ${JSON.stringify(arg)}`);\n }\n }\n const subprocess = spawn(cmd, args, {\n cwd: root,\n shell: true,\n env,\n // No stdin for the child process — it doesn't need interactive input\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n // Pipe stdout and stderr through the logging stream.\n // { end: false } prevents the first stream to close from ending pinoStream\n // while the other may still be writing.\n subprocess.stdout?.pipe(pinoStream, { end: false });\n subprocess.stderr?.pipe(pinoStream, { end: false });\n\n // Wait for the process to complete\n return new Promise((resolve, reject) => {\n subprocess.on('close', code => {\n pinoStream.end();\n if (code === 0) {\n resolve({ success: true });\n } else {\n reject(new Error(`Process exited with code ${code}`));\n }\n });\n\n subprocess.on('error', error => {\n pinoStream.end();\n logger.error('Process failed', { error });\n reject(error);\n });\n });\n } catch (error) {\n console.error(error);\n logger.error('Process failed', { error });\n pinoStream.end();\n return { success: false, error };\n }\n };\n}\n","import fs from 'node:fs';\nimport fsPromises from 'node:fs/promises';\nimport path, { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { MastraBase } from '@mastra/core/base';\nimport { readJSON, writeJSON, ensureFile } from 'fs-extra/esm';\nimport type { PackageJson } from 'type-fest';\n\nimport { createChildProcessLogger } from '../deploy/log.js';\n\ntype PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\ninterface ArchitectureOptions {\n os?: string[];\n cpu?: string[];\n libc?: string[];\n}\n\nconst PNPM_CONFIG_KEYS_TO_COPY = new Set([\n 'allowBuilds',\n 'onlyBuiltDependencies',\n 'ignoredBuiltDependencies',\n 'neverBuiltDependencies',\n 'minimumReleaseAge',\n 'minimumReleaseAgeExclude',\n 'trustPolicy',\n 'trustPolicyExclude',\n 'trustPolicyIgnoreAfter',\n 'supportedArchitectures',\n]);\n\nfunction getTopLevelYamlKey(line: string) {\n const match = /^(?!\\s)([\\w-]+):/.exec(line);\n return match?.[1];\n}\n\nexport function copyPnpmWorkspaceSettings(source: string, options: ArchitectureOptions = {}) {\n const hasArchitecture = Boolean(options.os?.length || options.cpu?.length || options.libc?.length);\n const lines = source.split(/\\r?\\n/);\n const blocks: string[] = [];\n\n for (let index = 0; index < lines.length; ) {\n const key = getTopLevelYamlKey(lines[index] ?? '');\n if (!key) {\n index += 1;\n continue;\n }\n\n const start = index;\n index += 1;\n while (index < lines.length && !getTopLevelYamlKey(lines[index] ?? '')) {\n index += 1;\n }\n\n if (!PNPM_CONFIG_KEYS_TO_COPY.has(key) || (key === 'supportedArchitectures' && hasArchitecture)) {\n continue;\n }\n\n const block = lines.slice(start, index).join('\\n').trimEnd();\n if (block) {\n blocks.push(block);\n }\n }\n\n if (hasArchitecture) {\n const architectureBlock = ['supportedArchitectures:'];\n if (options.os?.length) {\n architectureBlock.push(` os: ${JSON.stringify(options.os)}`);\n }\n if (options.cpu?.length) {\n architectureBlock.push(` cpu: ${JSON.stringify(options.cpu)}`);\n }\n if (options.libc?.length) {\n architectureBlock.push(` libc: ${JSON.stringify(options.libc)}`);\n }\n blocks.push(architectureBlock.join('\\n'));\n }\n\n return [\"packages:\\n - '.'\", ...blocks].join('\\n\\n') + '\\n';\n}\n\nexport class Deps extends MastraBase {\n private packageManager: PackageManager;\n private rootDir: string;\n\n constructor(rootDir = process.cwd()) {\n super({ component: 'DEPLOYER', name: 'DEPS' });\n\n this.rootDir = rootDir;\n this.packageManager = this.getPackageManager();\n }\n\n private findLockFile(dir: string): string | null {\n const lockFiles = ['pnpm-lock.yaml', 'package-lock.json', 'yarn.lock', 'bun.lock'];\n for (const file of lockFiles) {\n if (fs.existsSync(path.join(dir, file))) {\n return file;\n }\n }\n const parentDir = path.resolve(dir, '..');\n if (parentDir !== dir) {\n return this.findLockFile(parentDir);\n }\n return null;\n }\n\n private getPackageManager(): PackageManager {\n const lockFile = this.findLockFile(this.rootDir);\n switch (lockFile) {\n case 'pnpm-lock.yaml':\n return 'pnpm';\n case 'package-lock.json':\n return 'npm';\n case 'yarn.lock':\n return 'yarn';\n case 'bun.lock':\n return 'bun';\n default:\n return 'npm';\n }\n }\n\n public getWorkspaceDependencyPath({ pkgName, version }: { pkgName: string; version: string }) {\n return `file:./workspace-module/${pkgName}-${version}.tgz`;\n }\n\n public async pack({ dir, destination, sanitizedName }: { dir: string; destination: string; sanitizedName: string }) {\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: dir,\n });\n\n let packCmd = 'pack';\n let destinationFlag = `--pack-destination ${destination}`;\n if (this.packageManager === 'yarn') {\n // %s includes an '@' at the start of packages names with an '@'\n // so we need to use our sanitizedName instead.\n destinationFlag = `--out ${destination}/${sanitizedName}-%v.tgz`;\n }\n if (this.packageManager === 'bun') {\n // bun uses `pm pack` instead of `pack`\n packCmd = 'pm pack';\n // bun uses --destination instead of --pack-destination\n destinationFlag = `--destination ${destination}`;\n }\n\n return cpLogger({\n cmd: `${this.packageManager} ${packCmd} ${destinationFlag}`,\n args: [],\n env: {\n PATH: process.env.PATH!,\n },\n });\n }\n\n private findPnpmWorkspaceFile(dir: string): string | null {\n const workspaceYamlPath = path.join(dir, 'pnpm-workspace.yaml');\n if (fs.existsSync(workspaceYamlPath)) {\n return workspaceYamlPath;\n }\n\n const parentDir = path.resolve(dir, '..');\n if (parentDir !== dir) {\n return this.findPnpmWorkspaceFile(parentDir);\n }\n\n return null;\n }\n\n private async writePnpmConfig(dir: string, options: ArchitectureOptions = {}) {\n const sourceWorkspaceYamlPath = this.findPnpmWorkspaceFile(this.rootDir);\n const sourceWorkspaceYaml = sourceWorkspaceYamlPath\n ? await fsPromises.readFile(sourceWorkspaceYamlPath, 'utf-8')\n : '';\n\n await fsPromises.writeFile(\n path.join(dir, 'pnpm-workspace.yaml'),\n copyPnpmWorkspaceSettings(sourceWorkspaceYaml, options),\n 'utf-8',\n );\n }\n\n private async writeYarnConfig(dir: string, options: ArchitectureOptions) {\n const yarnrcPath = path.join(dir, '.yarnrc.yml');\n const config = {\n supportedArchitectures: {\n cpu: options.cpu || [],\n os: options.os || [],\n libc: options.libc || [],\n },\n };\n\n await fsPromises.writeFile(\n yarnrcPath,\n `supportedArchitectures:\\n${Object.entries(config.supportedArchitectures)\n .map(([key, value]) => ` ${key}: ${JSON.stringify(value)}`)\n .join('\\n')}`,\n );\n }\n\n private getNpmArgs(options: ArchitectureOptions): string[] {\n const args: string[] = [];\n if (options.cpu) args.push(`--cpu=${options.cpu.join(',')}`);\n if (options.os) args.push(`--os=${options.os.join(',')}`);\n if (options.libc) args.push(`--libc=${options.libc.join(',')}`);\n return args;\n }\n\n /**\n * Depending on whether we want to install or add a package, this function returns the appropriate commands.\n * All package managers support both commands (e.g. npm install has an alias on \"add\")\n */\n private getPackageManagerCommand(pm: PackageManager, type: 'install' | 'add'): string {\n const cmd = type === 'install' ? 'install' : 'add';\n\n switch (pm) {\n case 'npm':\n return `${cmd} --audit=false --fund=false --loglevel=error --progress=false --update-notifier=false`;\n case 'yarn':\n return `${cmd}`;\n case 'pnpm':\n return cmd === 'install' ? `${cmd} --loglevel=error` : `${cmd} --loglevel=error`;\n case 'bun':\n return cmd;\n default:\n return cmd;\n }\n }\n\n public async install({\n dir = this.rootDir,\n architecture,\n }: { dir?: string; architecture?: ArchitectureOptions } = {}) {\n const pm = this.packageManager;\n const installCommand = this.getPackageManagerCommand(pm, 'install');\n let args: string[] = [];\n\n switch (pm) {\n case 'pnpm':\n await this.writePnpmConfig(dir, architecture);\n break;\n case 'yarn':\n // similar to --ignore-workspace but for yarn\n await ensureFile(path.join(dir, 'yarn.lock'));\n if (architecture) {\n await this.writeYarnConfig(dir, architecture);\n }\n break;\n case 'npm':\n if (architecture) {\n args = this.getNpmArgs(architecture);\n }\n break;\n default:\n // Do nothing\n }\n\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: dir,\n });\n\n return cpLogger({\n cmd: `${pm} ${installCommand}`,\n args,\n env: process.env as Record<string, string>,\n });\n }\n\n public async installPackages(packages: string[]) {\n const pm = this.packageManager;\n const installCommand = this.getPackageManagerCommand(pm, 'add');\n\n const env: Record<string, string> = {\n PATH: process.env.PATH!,\n };\n\n if (process.env.npm_config_registry) {\n env.npm_config_registry = process.env.npm_config_registry;\n }\n\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: '',\n });\n\n return cpLogger({\n cmd: `${pm} ${installCommand}`,\n args: packages,\n env,\n });\n }\n\n public async checkDependencies(dependencies: string[]): Promise<string> {\n try {\n const packageJsonPath = path.join(this.rootDir, 'package.json');\n\n try {\n await fsPromises.access(packageJsonPath);\n } catch {\n return 'No package.json file found in the current directory';\n }\n\n const packageJson = await readJSON(packageJsonPath);\n for (const dependency of dependencies) {\n if (!packageJson.dependencies || !packageJson.dependencies[dependency]) {\n return `Please install ${dependency} before running this command (${this.packageManager} install ${dependency})`;\n }\n }\n\n return 'ok';\n } catch (err) {\n console.error(err);\n return 'Could not check dependencies';\n }\n }\n\n public async getProjectName() {\n try {\n const packageJsonPath = path.join(this.rootDir, 'package.json');\n const pkg = await readJSON(packageJsonPath);\n return pkg.name;\n } catch (err) {\n throw err;\n }\n }\n\n public async getPackageVersion() {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const pkgJsonPath = path.join(__dirname, '..', '..', 'package.json');\n\n const content = (await readJSON(pkgJsonPath)) as PackageJson;\n return content.version;\n }\n\n public async addScriptsToPackageJson(scripts: Record<string, string>) {\n const packageJson = await readJSON('package.json');\n packageJson.scripts = {\n ...packageJson.scripts,\n ...scripts,\n };\n await writeJSON('package.json', packageJson, { spaces: 2 });\n }\n}\n\nexport class DepsService extends Deps {}\n","import * as fs from 'node:fs';\n\nexport abstract class EnvService {\n abstract getEnvValue(key: string): Promise<string | null>;\n abstract setEnvValue(key: string, value: string): Promise<void>;\n}\n\nexport class FileEnvService extends EnvService {\n private filePath: string;\n\n constructor(filePath: string) {\n super();\n this.filePath = filePath;\n }\n\n private readFile(filePath: string): Promise<string> {\n return new Promise((resolve, reject) => {\n fs.readFile(filePath, 'utf8', (err: NodeJS.ErrnoException | null, data: string) => {\n if (err) reject(err);\n else resolve(data);\n });\n });\n }\n\n private writeFile({ filePath, data }: { filePath: string; data: string }): Promise<void> {\n return new Promise((resolve, reject) => {\n fs.writeFile(filePath, data, 'utf8', (err: NodeJS.ErrnoException | null) => {\n if (err) reject(err);\n else resolve();\n });\n });\n }\n\n private async updateEnvData({\n key,\n value,\n filePath = this.filePath,\n data,\n }: {\n key: string;\n value: string;\n filePath?: string;\n data: string;\n }): Promise<string> {\n const regex = new RegExp(`^${key}=.*$`, 'm');\n if (data.match(regex)) {\n // Use a replacement function so `$` sequences in the value (e.g. `$&`,\n // `$$`) are written literally instead of being interpreted as\n // String.prototype.replace special patterns.\n data = data.replace(regex, () => `${key}=${value}`);\n } else {\n data += `\\n${key}=${value}`;\n }\n await this.writeFile({ filePath, data });\n console.info(`${key} set to ${value} in ENV file.`);\n return data;\n }\n\n async getEnvValue(key: string): Promise<string | null> {\n try {\n const data = await this.readFile(this.filePath);\n const regex = new RegExp(`^${key}=(.*)$`, 'm');\n const match = data.match(regex);\n return match?.[1] || null;\n } catch (err) {\n console.error(`Error reading ENV value: ${err}`);\n return null;\n }\n }\n\n async setEnvValue(key: string, value: string): Promise<void> {\n try {\n const data = await this.readFile(this.filePath);\n await this.updateEnvData({ key, value, data });\n } catch (err) {\n console.error(`Error writing ENV value: ${err}`);\n }\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport fsExtra from 'fs-extra/esm';\n\nimport { FileEnvService } from './env.js';\n\nexport class FileService {\n /**\n *\n * @param inputFile the file in the starter files directory to copy\n * @param outputFilePath the destination path\n * @param replaceIfExists flag to replace if it exists\n * @returns\n */\n public async copyStarterFile(inputFile: string, outputFilePath: string, replaceIfExists?: boolean) {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n const filePath = path.resolve(__dirname, '..', 'starter-files', inputFile);\n const fileString = fs.readFileSync(filePath, 'utf8');\n\n if (fs.existsSync(outputFilePath) && !replaceIfExists) {\n console.info(`${outputFilePath} already exists`);\n return false;\n }\n\n await fsExtra.outputFile(outputFilePath, fileString);\n\n return true;\n }\n\n public async setupEnvFile({ dbUrl }: { dbUrl: string }) {\n const envPath = path.join(process.cwd(), '.env.development');\n\n await fsExtra.ensureFile(envPath);\n\n const fileEnvService = new FileEnvService(envPath);\n await fileEnvService.setEnvValue('DB_URL', dbUrl);\n }\n\n public getFirstExistingFile(files: string[]): string {\n for (const f of files) {\n if (fs.existsSync(f)) {\n return f;\n }\n }\n\n throw new Error('Missing required file, checked the following paths: ' + files.join(', '));\n }\n\n /**\n * Returns the first existing file from the provided array, or undefined if none exist\n * @param files array of file paths to check\n * @returns the first existing file path or undefined\n */\n public getFirstExistingFileOrUndefined(files: string[]): string | undefined {\n for (const f of files) {\n if (fs.existsSync(f)) {\n return f;\n }\n }\n\n return undefined;\n }\n\n public replaceValuesInFile({\n filePath,\n replacements,\n }: {\n filePath: string;\n replacements: { search: string; replace: string }[];\n }) {\n let fileContent = fs.readFileSync(filePath, 'utf8');\n replacements.forEach(({ search, replace }) => {\n fileContent = fileContent.replaceAll(search, replace);\n });\n\n fs.writeFileSync(filePath, fileContent);\n }\n}\n"]}
|
package/dist/deploy/log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/deploy/log.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAO,MAAM,gBAAgB,GAAI,QAAQ,aAAa,aAerD,CAAC;
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/deploy/log.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAO,MAAM,gBAAgB,GAAI,QAAQ,aAAa,aAerD,CAAC;AAUF,wBAAgB,wBAAwB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,IAElF,oBAAoB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,sBA6C/F"}
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-deployer
|
|
|
3
3
|
description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/deployer"
|
|
6
|
-
version: "1.49.0-alpha.
|
|
6
|
+
version: "1.49.0-alpha.4"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.49.0-alpha.
|
|
2
|
+
"version": "1.49.0-alpha.4",
|
|
3
3
|
"package": "@mastra/deployer",
|
|
4
4
|
"exports": {
|
|
5
5
|
"Deps": {
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"implementation": "dist/chunk-
|
|
8
|
-
"line":
|
|
7
|
+
"implementation": "dist/chunk-ZL66GDLP.js",
|
|
8
|
+
"line": 122
|
|
9
9
|
},
|
|
10
10
|
"FileService": {
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
|
-
"implementation": "dist/chunk-
|
|
13
|
-
"line":
|
|
12
|
+
"implementation": "dist/chunk-ZL66GDLP.js",
|
|
13
|
+
"line": 404
|
|
14
14
|
},
|
|
15
15
|
"createChildProcessLogger": {
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
|
-
"implementation": "dist/chunk-
|
|
18
|
-
"line":
|
|
17
|
+
"implementation": "dist/chunk-ZL66GDLP.js",
|
|
18
|
+
"line": 25
|
|
19
19
|
},
|
|
20
20
|
"createPinoStream": {
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
22
|
-
"implementation": "dist/chunk-
|
|
22
|
+
"implementation": "dist/chunk-ZL66GDLP.js",
|
|
23
23
|
"line": 12
|
|
24
24
|
}
|
|
25
25
|
},
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Deploy to cloud providers
|
|
2
4
|
|
|
3
5
|
Mastra applications can be deployed to cloud providers and serverless platforms. Mastra includes optional built-in deployers for Vercel, Netlify, and Cloudflare to automate the deployment process.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Deploy in a monorepo
|
|
2
4
|
|
|
3
5
|
Deploying Mastra in a monorepo follows the same process as a standalone application. This guide covers monorepo-specific considerations. For the core build and deployment steps, see [Deploy a Mastra Server](https://mastra.ai/docs/deployment/mastra-server).
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Deployment overview
|
|
2
4
|
|
|
3
5
|
Mastra applications can be deployed to any Node.js-compatible environment. You can deploy a Mastra server, integrate with an existing web framework, deploy to cloud providers, or use [Mastra platform](https://mastra.ai/docs/mastra-platform/overview) for observability, Studio, and server deployment.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Deploy with a web framework
|
|
2
4
|
|
|
3
5
|
When Mastra is integrated with a web framework, it deploys alongside your application using the framework's standard deployment process. Follow the instructions below to ensure your Mastra integration deploys correctly.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Workflow runners
|
|
2
4
|
|
|
3
5
|
Mastra [workflows](https://mastra.ai/docs/workflows/overview) can be executed using the built-in workflow runner or deployed to specialized workflow execution platforms that handle orchestration, monitoring, and reliability.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Deployer
|
|
2
4
|
|
|
3
5
|
The Deployer handles the deployment of standalone Mastra applications by packaging code, managing environment files, and serving applications using the Hono framework. Concrete implementations must define the deploy method for specific deployment targets.
|
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk3GTT2N4V_cjs = require('./chunk-3GTT2N4V.cjs');
|
|
4
|
+
var chunkVNJLLLQN_cjs = require('./chunk-VNJLLLQN.cjs');
|
|
5
|
+
var chunkVKAFARW6_cjs = require('./chunk-VKAFARW6.cjs');
|
|
6
6
|
|
|
7
7
|
// src/deploy/base.ts
|
|
8
|
-
var Deployer = class extends
|
|
9
|
-
deps = new
|
|
8
|
+
var Deployer = class extends chunk3GTT2N4V_cjs.Bundler {
|
|
9
|
+
deps = new chunkVKAFARW6_cjs.DepsService();
|
|
10
10
|
constructor(args) {
|
|
11
11
|
super(args.name, "DEPLOYER");
|
|
12
12
|
this.deps.__setLogger(this.logger);
|
|
@@ -14,7 +14,7 @@ var Deployer = class extends chunkHMT7QCMZ_cjs.Bundler {
|
|
|
14
14
|
getEnvFiles() {
|
|
15
15
|
const possibleFiles = [".env.production", ".env.local", ".env"];
|
|
16
16
|
try {
|
|
17
|
-
const fileService = new
|
|
17
|
+
const fileService = new chunkVKAFARW6_cjs.FileService();
|
|
18
18
|
const envFile = fileService.getFirstExistingFile(possibleFiles);
|
|
19
19
|
return Promise.resolve([envFile]);
|
|
20
20
|
} catch {
|
|
@@ -25,7 +25,7 @@ var Deployer = class extends chunkHMT7QCMZ_cjs.Bundler {
|
|
|
25
25
|
|
|
26
26
|
// src/build/deployer.ts
|
|
27
27
|
async function getDeployer(entryFile, outputDir, logger) {
|
|
28
|
-
const result = await
|
|
28
|
+
const result = await chunkVNJLLLQN_cjs.extractMastraOption("deployer", entryFile, outputDir, logger);
|
|
29
29
|
if (!result) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
@@ -34,19 +34,19 @@ async function getDeployer(entryFile, outputDir, logger) {
|
|
|
34
34
|
|
|
35
35
|
Object.defineProperty(exports, "Deps", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkVKAFARW6_cjs.Deps; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "FileService", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkVKAFARW6_cjs.FileService; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "createChildProcessLogger", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkVKAFARW6_cjs.createChildProcessLogger; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "createPinoStream", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkVKAFARW6_cjs.createPinoStream; }
|
|
50
50
|
});
|
|
51
51
|
exports.Deployer = Deployer;
|
|
52
52
|
exports.getDeployer = getDeployer;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Bundler } from './chunk-
|
|
2
|
-
import { extractMastraOption } from './chunk-
|
|
3
|
-
import { DepsService, FileService } from './chunk-
|
|
4
|
-
export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-
|
|
1
|
+
import { Bundler } from './chunk-ULWJZHTN.js';
|
|
2
|
+
import { extractMastraOption } from './chunk-CCBU3OII.js';
|
|
3
|
+
import { DepsService, FileService } from './chunk-ZL66GDLP.js';
|
|
4
|
+
export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-ZL66GDLP.js';
|
|
5
5
|
|
|
6
6
|
// src/deploy/base.ts
|
|
7
7
|
var Deployer = class extends Bundler {
|
package/dist/server/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7YI2AEFO_cjs = require('../chunk-7YI2AEFO.cjs');
|
|
4
4
|
var promises = require('fs/promises');
|
|
5
5
|
var https = require('https');
|
|
6
6
|
var path = require('path');
|
|
@@ -4329,7 +4329,7 @@ async function createHonoServer(mastra, options = {
|
|
|
4329
4329
|
);
|
|
4330
4330
|
}
|
|
4331
4331
|
const serverOptions = mastra.getServer();
|
|
4332
|
-
const studioBasePath =
|
|
4332
|
+
const studioBasePath = chunk7YI2AEFO_cjs.normalizeStudioBase(serverOptions?.studioBase ?? "/");
|
|
4333
4333
|
if (options?.studio) {
|
|
4334
4334
|
app.get(
|
|
4335
4335
|
`${studioBasePath}/refresh-events`,
|
|
@@ -4404,12 +4404,15 @@ async function createHonoServer(mastra, options = {
|
|
|
4404
4404
|
const templatesEnabled = process.env.MASTRA_TEMPLATES === "true" ? "true" : "false";
|
|
4405
4405
|
const agentSignals = process.env.MASTRA_AGENT_SIGNALS === "false" ? "false" : "true";
|
|
4406
4406
|
const signalsUI = process.env.MASTRA_SIGNALS_UI === "true" ? "true" : "false";
|
|
4407
|
+
const organizationId = process.env.MASTRA_ORGANIZATION_ID || "";
|
|
4408
|
+
const platformProjectId = process.env.MASTRA_PLATFORM_PROJECT_ID || "";
|
|
4409
|
+
const platformObservabilityEndpoint = process.env.MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT || "";
|
|
4407
4410
|
const requestContextPresets = process.env.MASTRA_REQUEST_CONTEXT_PRESETS || "";
|
|
4408
4411
|
const escapeForHtml = (json) => {
|
|
4409
4412
|
return json.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
4410
4413
|
};
|
|
4411
4414
|
const autoDetectUrl = process.env.MASTRA_AUTO_DETECT_URL === "true";
|
|
4412
|
-
indexHtml =
|
|
4415
|
+
indexHtml = chunk7YI2AEFO_cjs.injectStudioHtmlConfig(indexHtml, {
|
|
4413
4416
|
host: `'${studioHost}'`,
|
|
4414
4417
|
port: `'${studioPort}'`,
|
|
4415
4418
|
protocol: `'${studioProtocol}'`,
|
|
@@ -4424,6 +4427,9 @@ async function createHonoServer(mastra, options = {
|
|
|
4424
4427
|
experimentalUI: `'${experimentalUI}'`,
|
|
4425
4428
|
agentSignals: `'${agentSignals}'`,
|
|
4426
4429
|
signalsUI: `'${signalsUI}'`,
|
|
4430
|
+
organizationId: `'${escapeForHtml(organizationId)}'`,
|
|
4431
|
+
platformProjectId: `'${escapeForHtml(platformProjectId)}'`,
|
|
4432
|
+
platformObservabilityEndpoint: `'${escapeForHtml(platformObservabilityEndpoint)}'`,
|
|
4427
4433
|
autoDetectUrl: `'${autoDetectUrl}'`
|
|
4428
4434
|
});
|
|
4429
4435
|
return c.newResponse(indexHtml, 200, { "Content-Type": "text/html" });
|
|
@@ -4481,7 +4487,7 @@ async function createNodeServer(mastra, options = { tools: {} }) {
|
|
|
4481
4487
|
const logger2 = mastra.getLogger();
|
|
4482
4488
|
logger2.info("Mastra API running", { url: `${protocol}://${host}:${port}${apiPrefix}` });
|
|
4483
4489
|
if (options?.studio) {
|
|
4484
|
-
const studioBasePath =
|
|
4490
|
+
const studioBasePath = chunk7YI2AEFO_cjs.normalizeStudioBase(serverOptions?.studioBase ?? "/");
|
|
4485
4491
|
const studioUrl = `${studioProtocol}://${studioHost}:${studioPort}${studioBasePath}`;
|
|
4486
4492
|
logger2.info("Studio available", { url: studioUrl });
|
|
4487
4493
|
}
|