UNPKG

mastra

Version:
129 lines • 5.4 kB
import type { ModelRouterModelId } from '@mastra/core/llm'; import type { Editor } from './mcp-docs-server-install.js'; export declare const LLMProvider: readonly ["openai", "anthropic", "groq", "google", "cerebras", "mistral"]; export declare const COMPONENTS: readonly ["agents", "workflows", "tools", "scorers"]; export type LLMProvider = (typeof LLMProvider)[number]; export type Component = (typeof COMPONENTS)[number]; export interface ObservabilityPromptResult { enabled?: boolean; token?: string; } interface ObservabilitySelectionEvent { command?: 'create' | 'init'; enabled: boolean; answer: 'yes' | 'no'; selection_method: 'interactive'; } export declare function promptForObservability(command?: 'create' | 'init', onObservabilitySelected?: (event: ObservabilitySelectionEvent) => void): Promise<ObservabilityPromptResult>; /** * Type-guard to check if a value is a valid LLMProvider */ export declare function isValidLLMProvider(value: string): value is LLMProvider; /** * Type-guard to check if a value contains only valid Components */ export declare function areValidComponents(values: string[]): values is Component[]; export declare const getModelIdentifier: (llmProvider: LLMProvider) => ModelRouterModelId; export declare function writeAgentSample(llmProvider: LLMProvider, destPath: string, addExampleTool: boolean, addScorers: boolean): Promise<void>; export declare function writeWorkflowSample(destPath: string): Promise<void>; export declare function writeToolSample(destPath: string): Promise<void>; export declare function writeScorersSample(llmProvider: LLMProvider, destPath: string): Promise<void>; export declare function writeCodeSampleForComponents(llmprovider: LLMProvider, component: Component, destPath: string, importComponents: Component[]): Promise<void | "">; export declare const createComponentsDir: (dirPath: string, component: string) => Promise<void>; export declare const writeIndexFile: ({ dirPath, addAgent, addExample, addWorkflow, addScorers, }: { dirPath: string; addExample: boolean; addWorkflow: boolean; addAgent: boolean; addScorers: boolean; }) => Promise<void>; export declare const checkInitialization: (dirPath: string) => Promise<boolean>; export declare const checkAndInstallCoreDeps: (addExample: boolean, versionTag?: string) => Promise<void>; export declare const getAPIKey: (provider: LLMProvider) => Promise<string>; export declare const writeAPIKey: ({ provider, apiKey }: { provider: LLMProvider; apiKey?: string; }) => Promise<void>; /** * Append Mastra Observability credentials to the project's `.env` file. * * The generated `src/mastra/index.ts` template already registers a * `MastraPlatformExporter` which no-ops unless `MASTRA_PLATFORM_ACCESS_TOKEN` * is set, so enabling Observability is a pure env-var concern from the * scaffolder's side. * * When called with no token, writes empty placeholders so the user can paste * a key minted manually from the dashboard. */ export declare const writeObservabilityEnv: ({ token, projectId, endpoint, }?: { token?: string; projectId?: string; endpoint?: string; }) => Promise<void>; export declare const createMastraDir: (directory: string) => Promise<{ ok: true; dirPath: string; } | { ok: false; }>; export declare const writeCodeSample: (dirPath: string, component: Component, llmProvider: LLMProvider, importComponents: Component[]) => Promise<void>; export declare const LLM_PROVIDERS: { value: LLMProvider; label: string; hint?: string; }[]; interface InteractivePromptArgs { options?: { command?: 'create' | 'init'; showBanner?: boolean; onObservabilitySelected?: (event: ObservabilitySelectionEvent) => void; }; skip?: { directory?: boolean; llmProvider?: boolean; llmApiKey?: boolean; gitInit?: boolean; skills?: boolean; mcpServer?: boolean; observability?: boolean; }; } export declare const interactivePrompt: (args?: InteractivePromptArgs) => Promise<{ observability: boolean | undefined; observabilityToken: string | undefined; skills: string[] | undefined; mcpServer: Editor | undefined; directory: string; llmProvider: "openai" | "anthropic" | "groq" | "google" | "cerebras" | "mistral"; llmApiKey: unknown; initGit: boolean; }>; /** * Check if the current directory has a package.json file. If not, we should alert the user to create one or run "mastra create" to create a new project. The package.json file is required to install dependencies in the next steps. */ export declare const checkForPkgJson: () => Promise<void>; /** * Read the `name` field from the project's `package.json`, returning `undefined` * if the file is missing or unparseable. */ export declare const readPackageName: () => Promise<string | undefined>; /** * Generate content for AGENTS.md file */ export declare function generateAgentsMarkdown({ skills, mcpServer }: { skills?: string[]; mcpServer?: Editor; }): string; /** * Write AGENTS.md file to project root */ export declare function writeAgentsMarkdown(options: { skills?: string[]; mcpServer?: Editor; }): Promise<void>; /** * Write CLAUDE.md file to project root */ export declare function writeClaudeMarkdown(): Promise<void>; export {}; //# sourceMappingURL=utils.d.ts.map