import { PromptModule, ModuleConfig, ModuleBuildResult, AssemblyReport, TruncatedModuleInfo } from './prompt-module.interface.js'; /** * Modules omitted under the `lite` prompt profile. Each of these only earns * its tokens during planning or onboarding — expert thinking frameworks, * domain procedures, how-to-record-learnings guidance, SOP-vs-norm doc * classification, and the anti-pattern self-check list — none of which a * routine wake-up (event fired, follow-up due) needs to re-read. Operational * modules (identity, communication, lifecycle, recovery, project/memory * references, skills, team, decision rights, request contract, working * memory) are never listed here. */ export declare const LITE_PROFILE_DROPPED_MODULES: ReadonlySet; /** * Modules collapsed to their heading plus first content line under the * `lite` profile. The mission card is useful as a one-line reminder of the * current objective; its full OKR / sub-OKR / status breakdown is planning * context. */ export declare const LITE_PROFILE_SUMMARISED_MODULES: ReadonlySet; /** * Modules that must survive every profile. Used by tests and by the * registration-time comparison log to assert the lite tier never drops an * operational module. */ export declare const PROFILE_REQUIRED_MODULES: ReadonlyArray; /** * Service that orchestrates the assembly of prompt modules into a complete agent prompt. * * Responsibilities: * - Registers and manages prompt modules * - Assembles modules in priority order * - Enforces per-module and total token budgets with 2-stage truncation: * 1. First pass: build all Trusted Zone (non-compactable) + Flexible Zone modules * 2. If over budget: trim lowest-priority compactable modules to 50% of maxTokens * 3. If still over budget: remove lowest-priority compactable modules entirely * - Returns AssemblyReport with token breakdown and truncation details * * @example * ```typescript * const assembler = new PromptAssemblyService(); * const { prompt, report } = await assembler.assemble({ * sessionName: 'crewly-dev-001', * memberId: 'uuid-123', * role: 'developer', * projectPath: '/path/to/project', * agentSkillsPath: '/path/to/skills/agent', * tlSkillsPath: '/path/to/skills/team-leader', * projectRoot: '/path/to/project', * }); * ``` */ export declare class PromptAssemblyService { private logger; private modules; private totalTokenBudget; constructor(tokenBudget?: number); /** * Register the default set of prompt modules. * Called automatically in constructor. Additional modules * can be added via addModule(). */ private registerDefaultModules; /** * Add a custom prompt module to the assembly pipeline. * * @param module - Module to add */ addModule(module: PromptModule): void; /** * Remove a module by name. * * @param name - Name of the module to remove */ removeModule(name: string): void; /** * Get all registered modules (for inspection/testing). * * @returns Array of registered prompt modules */ getModules(): PromptModule[]; /** * Get or set the total token budget. * * @param budget - Optional new budget to set * @returns Current token budget */ tokenBudget(budget?: number): number; /** * Assemble all applicable prompt modules into a single prompt string. * * Uses 2-stage truncation for compactable modules when over budget: * 1. Trim lowest-priority compactable modules to 50% of their content * 2. Remove lowest-priority compactable modules entirely * * Trusted Zone (non-compactable) modules are never truncated or removed. * * @param config - Configuration with all context needed by modules * @returns Object with assembled prompt string and budget report */ assemble(config: ModuleConfig): Promise<{ prompt: string; report: AssemblyReport; }>; /** * Assemble modules and return detailed results with per-module metadata. * Convenience wrapper that returns just the report (same as assemble().report). * * @param config - Configuration with all context needed by modules * @returns Assembly details with prompt, modules, and total tokens */ assembleWithDetails(config: ModuleConfig): Promise<{ prompt: string; modules: ModuleBuildResult[]; totalTokens: number; truncated: TruncatedModuleInfo[]; }>; /** * Collapse a module's markdown to its heading plus the first content * line (used by the `lite` profile for modules that are worth a one-line * reminder but not their full body). Section labels ending in ':' are * skipped so the surviving line is an actual data line. * * @param content - Full module markdown * @returns Heading + first content line, or the trimmed input when it is * already that short */ private summariseToOneLine; /** * Trim content to a target fraction of its original length. * Trims at line boundaries to avoid cutting mid-sentence. * * @param content - Original content string * @param fraction - Target fraction (e.g., 0.5 for 50%) * @returns Trimmed content */ private trimContent; } //# sourceMappingURL=prompt-assembly.service.d.ts.map