import type { AgentSchedulePromptDefinition } from '@mastra/core/schedules'; /** * A file-system routed agent directory discovered under `/agents/`. * All paths are absolute and slash-normalized so they can be embedded into * generated module source on any platform. */ export interface DiscoveredFsAgent { /** Agent directory name. Used as the default `id`/`name`. */ name: string; /** Absolute, slash-normalized path to the agent directory. */ dir: string; /** Absolute path to `config.ts`/`config.js`, if present. */ configPath?: string; /** Absolute path to `instructions.md`, if present. */ instructionsPath?: string; /** * Absolute path to `instructions.ts`/`instructions.js`, if present. Unlike * `instructions.md` (whose contents are inlined at build time), this module is * imported by the generated wrapper, so it can compute its prompt or export a * runtime-resolved function. */ instructionsModulePath?: string; /** Absolute path to `workspace.ts`/`workspace.js`, if present. */ workspacePath?: string; /** Absolute path to `memory.ts`/`memory.js`, if present. */ memoryPath?: string; /** * Absolute, slash-normalized path to an authored `workspace/` directory of * seed files, if present. These are mirrored into the deployed workspace at * build time (Eve parity) so the agent starts with them on disk. */ workspaceSeedDir?: string; /** Tools discovered under `tools/`, in stable (sorted) order. */ tools: { key: string; path: string; }[]; /** Input processors discovered under `processors/input/`, in stable (sorted) order. */ inputProcessors: { key: string; path: string; }[]; /** Output processors discovered under `processors/output/`, in stable (sorted) order. */ outputProcessors: { key: string; path: string; }[]; /** Scorers discovered under `scorers/`, in stable (sorted) order. */ scorers: { key: string; path: string; }[]; /** Skills discovered under `skills/`, in stable (sorted) order. */ skills: DiscoveredFsSkill[]; /** * Schedules discovered under `schedules/`, in stable (path-sorted) order. * Nested files keep their relative path in `key` (`billing/sweep.ts` → * `billing/sweep`) so a schedule's identity is stable across builds. */ schedules: DiscoveredFsSchedule[]; /** * Declared subagents discovered under `subagents/`, in stable (sorted) order. * Subagents may declare their own `subagents/`, up to `MAX_FS_SUBAGENT_DEPTH` * levels below the top-level agent; deeper `subagents/` directories are * ignored with a warning. */ subagents: DiscoveredFsAgent[]; } /** * A skill discovered under `agents//skills/`. * * - `kind: 'module'` — a `.ts`/`.js` file whose default export is a `createSkill(...)` * result. Codegen imports it directly; `name`/`description`/`instructions` are * unknown at discovery time and resolved at runtime from the module. * - `kind: 'packaged'` — a `SKILL.md` (optionally with a `references/` subdir) or a * flat `.md`. Codegen inlines it via `createSkill(...)` using the parsed * fields below so the deployed bundle carries no filesystem dependency. */ export type DiscoveredFsSkill = { kind: 'module'; /** Absolute, slash-normalized path to the `.ts`/`.js` skill module. */ path: string; } | { kind: 'packaged'; name: string; description: string; instructions: string; /** Reference file contents keyed by relative path (from `references/`). */ references: Record; }; /** * A schedule discovered under `agents//schedules/`. * * - `kind: 'module'` — a `.ts`/`.js` file whose default export is a * `defineSchedule(...)` result. Codegen imports it directly, which is what * makes handler mode possible: the handler is a live function, not data. * - `kind: 'markdown'` — a `.md` file with cron frontmatter and the document * body as the prompt. Codegen inlines it so the bundle carries no filesystem * dependency. */ export type DiscoveredFsSchedule = { kind: 'module'; /** Path-derived identity relative to `schedules/`, extension stripped. */ key: string; /** Absolute, slash-normalized path to the `.ts`/`.js` schedule module. */ path: string; } | { kind: 'markdown'; key: string; /** * Absolute, slash-normalized path to the `.md` file. Its contents are * inlined at build time, so the dev watcher has to watch this path * explicitly — nothing imports it. */ path: string; /** Parsed frontmatter fields plus the body as `prompt`. */ definition: MarkdownScheduleDefinition; }; /** * A markdown schedule is always prompt mode — the document body is the prompt * and handler mode needs a function, so it needs a `.ts`/`.js` module. Reuses core's * definition type so the two can't drift; core validates the parsed result * during agent assembly. */ export type MarkdownScheduleDefinition = AgentSchedulePromptDefinition; /** * Scan `/agents/*` for file-system routed agents. A directory is * treated as an agent only when it contains a `config.(ts|js)`, an * `instructions.md`, or an `instructions.(ts|js)`; other directories are * ignored. Each agent may declare `subagents/` up to `MAX_FS_SUBAGENT_DEPTH` * levels deep. Returns descriptors with absolute, slash-normalized paths ready * for codegen. Performs no module evaluation — only filesystem inspection. */ export declare function discoverFsAgents(mastraDir: string, onWarn?: (message: string) => void): Promise; /** * A file-system routed workflow file discovered under `/workflows/`. * All paths are absolute and slash-normalized so they can be embedded into * generated module source on any platform. */ export interface DiscoveredFsWorkflow { /** Workflow key derived from the filename (without extension). */ key: string; /** Absolute, slash-normalized path to the workflow module. */ path: string; } /** * Scan `/workflows/` for file-system routed workflow modules. Only * files whose source contains an `export default` are treated as fs-routed * workflows — this convention distinguishes them from workflow files that are * manually imported and registered programmatically. Returns descriptors with * absolute, slash-normalized paths ready for codegen. Performs no module * evaluation — only filesystem and source-text inspection. */ export declare function discoverFsWorkflows(mastraDir: string): Promise; /** * A discovered singleton config file under `/`. All paths are * absolute and slash-normalized so they can be embedded into generated module * source on any platform. */ export interface DiscoveredFsSingleton { /** Absolute, slash-normalized path to the singleton module. */ path: string; } /** * Check for a singleton config file (e.g. `storage.ts`, `storage.js`) directly * under ``. Returns the first matching file path or `undefined`. * Symlinks are rejected for security. * * Convention: only files with `export default` are fs-routed singletons. Files * using named exports are assumed to be manually imported into the user's * `index.ts`, so they are ignored to remain backward-compatible with existing * project structures. * * `name` must be a bare identifier — path separators and traversal sequences are * rejected so the lookup can never escape ``. */ export declare function discoverFsSingleton(mastraDir: string, name: string): Promise; //# sourceMappingURL=discover.d.ts.map