/** * Type definitions for prompt assembly. * * Extracted from hooks/prompt.ts per PRI-444 to enable independent testing * of pure-logic helpers without importing the full hook module. * * ERR checklist: * EP-01: All unknown inputs use typeof/Object.hasOwn guards, never `as` * EP-03: Pure functions never swallow errors silently * EP-09: Pure functions are independently unit-testable without mocks */ import type { PluginLogger, OpenClawPluginApi } from '../openclaw-sdk.js'; /** Cached file entry for TTL-based file reading. */ export interface CachedFile { content: string; mtime: number; loadedAt: number; } /** Per-workspace empathy session state. */ export interface EmpathySessionState { turnCounter: number; keywordCache: { store: unknown; lang: string; } | null; } /** API surface exposed to the prompt hook by the plugin runtime. */ export interface PromptHookApi { config?: { empathy_engine?: { enabled?: boolean; }; }; runtime: OpenClawPluginApi['runtime']; logger: PluginLogger; } /** Result of extracting the user message from the raw prompt text. */ export interface ExtractedUserMessage { /** Cleaned user message (empty string for boot checks). */ message: string; /** True if the message appears to be from another agent (skip user-interaction-only injections). */ isAgentToAgent: boolean; } /** Input for formatting core principles into prompt text. */ export interface CorePrincipleEntry { id: string; text: string; } /** Input for formatting evolution principles (active + probation). */ export interface EvolutionPrincipleEntry extends CorePrincipleEntry { } /** Parts assembled into appendSystemContext. Order = priority (low → high). */ export interface AppendSystemContextParts { behavioralConstraints?: string; projectContext?: string; /** * PRI-467: Intent Engineering friction block. Bounded + escaped INTENT.md * reference. Positioned after projectContext (stable reference data, lower * priority than principles) and before workingMemory (volatile per-session * state). Only populated when intent_engineering flag is on and INTENT.md * is valid. */ intentBlock?: string; workingMemory?: string; thinkingOs?: string; evolutionPrinciples?: string; corePrinciples?: string; } /** Input for the heartbeat checklist wrapper. */ export interface HeartbeatChecklistInput { content: string; }