/** * Photon Maker - Create and manage photons * @description System photon for scaffolding and managing photons * @internal * * ## Method Types * * This photon demonstrates two patterns for organizing methods: * * ### Static Methods (Global Actions) * - Called on the class itself, no instance needed * - In Beam UI: Appear in the Marketplace dropdown menu * - In CLI: `photon cli maker ` * - In MCP: Available as tools without instance context * - Use for: Creating new photons, syncing marketplace, validating * * ### Instance Methods (Contextual Actions) * - Called on a specific photon instance * - In Beam UI: Appear in the per-photon gear menu * - In CLI: Require photon context (future: `photon cli maker rename --photon serum`) * - Use for: Renaming, describing, adding methods to a specific photon * * ### Generator Functions (Progress Streaming) * - Use `async *method()` syntax for step-by-step progress * - Yield `{ step, message }` objects for UI updates * - Final yield should include `{ step: 'done', result }` or `{ type: 'done', result }` * * ### Wizard Pattern (Multi-Step UI) * - Mark with `@wizard` JSDoc tag * - Yield step definitions, receive user input via `yield` * - Steps: input, select, multi-input, progress, done * * ## Decorators * * - `@internal` - Bundled with runtime, special UI treatment * - `@wizard` - Renders as multi-step wizard instead of form * - `@prompt` - Method-level: registers as MCP prompt template (legacy: @template) * - `@resource ` - Method-level: registers as MCP resource resolver (legacy: @Static) */ /** Wizard step types using standard ask/emit protocol */ type WizardStep = { ask: 'text'; id: string; message: string; label?: string; placeholder?: string; hint?: string; required?: boolean; } | { ask: 'select'; id: string; message: string; options: Array<{ value: string; label: string; }>; multi?: boolean; } | { emit: 'status'; message: string; } | { emit: 'result'; data: any; }; export default class Maker { private photonPath; /** * Instance is created with target photon context for per-photon operations */ constructor(photonPath?: string); /** * Create a new photon * @param name Name for the new photon (kebab-case recommended) * @param methods Tool method names to scaffold (optional) * @param prompts Prompt template names to scaffold (optional) * @param resources Resource method names to scaffold (optional) */ static new({ name, methods, prompts, resources, }: { /** Name for the new photon */ name: string; /** Tool method names (optional) */ methods?: string[]; /** Prompt template names (optional) */ prompts?: string[]; /** Resource method names (optional) */ resources?: string[]; }): AsyncGenerator<{ emit: string; message?: string; value?: any; path?: string; code?: string; }>; /** * Validate all photons in the current directory */ static validate(): AsyncGenerator<{ emit: string; value?: any; photon?: string; status?: 'valid' | 'error'; error?: string; summary?: { valid: number; errors: number; }; }>; /** * Guided wizard to create a new photon * @wizard * @param name Photon name in kebab-case (e.g., my-tools, api-wrapper) * @returns {@label Create} */ static wizard({ name }: { name: string; }): AsyncGenerator; /** * Rename this photon * @param name New name for the photon * @param photonPath Path to the photon file (optional, uses instance context if not provided) */ rename({ name, photonPath, }: { name: string; photonPath?: string; }): Promise<{ oldPath: string; newPath: string; }>; /** * Update photon description * @param description New description * @param photonPath Path to the photon file (optional, uses instance context if not provided) */ describe({ description, photonPath, }: { description: string; photonPath?: string; }): Promise<{ updated: boolean; }>; /** * Add a new method to this photon * @param name Method name * @param type Method type * @param photonPath Path to the photon file (optional, uses instance context if not provided) */ addmethod({ name, type, photonPath, }: { /** Method name */ name: string; /** Method type */ type?: 'tool' | 'prompt' | 'resource'; /** Path to the photon file */ photonPath?: string; }): Promise<{ added: string; type: string; }>; /** * Delete this photon * @param photonPath Path to the photon file (optional, uses instance context if not provided) */ delete({ photonPath }?: { photonPath?: string; }): Promise<{ deleted: string; }>; /** * View source code of this photon * @param photonPath Path to the photon file (optional, uses instance context if not provided) */ source({ photonPath }?: { photonPath?: string; }): Promise<{ path: string; code: string; }>; private static validateNpmPackage; private static importForPackage; private static paramNameForMethod; private static paramDescForMethod; private static generateMethodStub; } export {}; //# sourceMappingURL=maker.photon.d.ts.map