import type { HivemindLifecycleManager } from "../task-management/lifecycle/index.js"; import type { OpenCodeClient } from "../shared/session-api.js"; import type { TaskStateManager } from "../shared/state.js"; import type { AutoLoopOptions, AutoLoopResult } from "../coordination/spawner/auto-loop.js"; import type { RalphLoopOptions, RalphLoopResult } from "../coordination/spawner/ralph-loop.js"; import type { IntakeResult } from "../routing/session-entry/intake-gate.js"; import type { HivemindConfigs } from "../schema-kernel/hivemind-configs.schema.js"; import type { ResolvedBehavioralProfile } from "../routing/behavioral-profile/types.js"; export interface AutoLoopConfig { maxIterations: number; completionSignal: string; backoffMs: number; } export interface ParentAutoLoopConfig { maxIterations: number; backoffMs: number; } /** * Shared dependency bundle injected into every hook factory. * Carries only what hooks need — tools receive their own narrower contexts. */ export interface HookDependencies { lifecycleManager: HivemindLifecycleManager; client: OpenCodeClient; stateManager: TaskStateManager; eventObservers?: Array<(input: { event?: unknown; }) => Promise | void>; autoLoopConfig?: Partial; parentAutoLoopConfig?: Partial; sleep?: (ms: number) => Promise; runAutoLoop?: (options: AutoLoopOptions) => Promise>; runRalphLoop?: (options: RalphLoopOptions) => Promise>; escalationMessage?: (result: RalphLoopResult) => string; getIntake?: (sessionId: string) => IntakeResult | undefined; /** Hivemind runtime config — loaded once at plugin init, cached for session lifetime. */ hivemindConfig?: HivemindConfigs; /** * Reads fresh Hivemind config from disk on every call. * * Used by system.transform to pick up language/config changes without * requiring a plugin restart. Falls back to `hivemindConfig` (cached) * when not provided in the dependency bundle. */ getFreshHivemindConfig?: () => HivemindConfigs; /** * Resolves the behavioral profile for a session. * Lazy — computes on first call, caches for session lifetime. * @see D-09, D-10 in CA-02-CONTEXT.md */ getBehavioralProfile?: (sessionId: string) => ResolvedBehavioralProfile; /** * Checks whether a session ID belongs to a main (level-0, non-delegated) session. * Populated by `createSessionIsMainObserver()` from `session.created` events. * Main sessions have no `parentID` in OpenCode's session records. * @see D-01, D-02, D-03 in BOOT-09-CONTEXT.md */ isMainSession?: (sessionId: string) => boolean; /** * Project root directory for resolving session-tracker files. * Passed to continuity-reader enrichment helpers. */ projectDirectory?: string; } //# sourceMappingURL=types.d.ts.map