/** * affect.ts – the heuristic limbic regions and the directive compiler. * * The labelled (record-shaped) face of the limbic system every agent surface runs: * the on-prem runtime, the cloud engine in a Worker, and the VS Code agent. Where * the psychometric personality is *static* (a trait vector → behaviour), this layer * is *dynamic* (a live affective state → behaviour): personality sets the * homeostatic setpoints ({@link limbicSetpoints}), the regions push the live state * around them in response to experience. * * • Amygdala → fast salience/threat appraisal of an event → affect delta * • Hypothalamus → homeostasis: relax toward setpoints; effort fatigue * • Thalamus → attention gate (inverted-U of arousal — Yerkes–Dodson) * • Basal ganglia → action-selection bias (explore vs. exploit) * • Hippocampus → reused (the SSM memory) — supplies the experience embedding * the trainable {@link LimbicModel} learns from. * * Pure and deterministic (no GPU, no I/O, no imports beyond the schema), so it * runs anywhere and is the trainable model's heuristic teacher and always-available * fallback. Published alone as `@seanhogg/builderforce-memory-engine/limbic`. */ import { type LimbicDimName, type PersonalityTraits } from "./regions.js"; export { REGION, LIMBIC_DIM, LIMBIC_DIM_NAMES, LIMBIC_STATE_DIM, LIMBIC_BOUNDS, NEUTRAL_STATE, clampDim, clampState, neutralState, stateToRecord, recordToState, limbicSetpoints, personalitySetpoint, } from "./regions.js"; export type { Region, LimbicDimName, PersonalityTraits } from "./regions.js"; export type LimbicState = Record; export type LimbicSetpoints = LimbicState; export type LimbicDelta = Partial>; /** Clamp one named dim to its bounds (NaN → the lower bound). */ export declare function clampLimbicDim(name: LimbicDimName, v: number): number; /** A fresh labelled neutral state. */ export declare function neutralLimbicState(): LimbicState; /** * The resting setpoints of several personalities active at once (an agent's own * personality plus its assigned personas): the mean of each one's * {@link limbicSetpoints}. Neutral when there are none. */ export declare function meanLimbicSetpoints(traits: ReadonlyArray): LimbicSetpoints; export declare function applyLimbicDelta(state: LimbicState, delta: LimbicDelta): LimbicState; export interface LimbicEvent { kind: "success" | "progress" | "error" | "blocked" | "risk" | "feedback" | "idle"; intensity?: number; sign?: number; text?: string; } export declare function appraiseAmygdala(event: LimbicEvent): LimbicDelta; export declare function homeostasis(state: LimbicState, setpoints: LimbicSetpoints, opts?: { rate?: number; fatigue?: number; }): LimbicState; export declare function thalamusGate(state: LimbicState, optimalArousal?: number): number; export declare function basalGangliaExploreBias(state: LimbicState): number; export declare function basalGangliaSelect(state: LimbicState, options: T[]): { choice: T | null; exploreBias: number; }; /** * Execution nudges the limbic state asks for. Structurally a subset of an agent * host's exec params: the compiler only ever raises thinking to a floor of * "medium" or "high" and turns reasoning on — the host merges these onto its own * params with its own think-level ladder. */ export type LimbicExecParams = { thinkLevel?: "medium" | "high"; reasoningLevel?: "on"; /** Signed temperature delta in roughly [-0.3, 0.3]. */ temperatureDelta?: number; }; export type CompiledLimbic = { directives: string[]; params: LimbicExecParams; }; export declare function compileLimbicState(state: LimbicState): CompiledLimbic; /** Heading of the system-prompt block {@link buildLimbicBlock} renders. */ export declare const LIMBIC_BLOCK_HEADER = "Current affective state (execute accordingly):"; /** Render the limbic directives as a system-prompt sub-block. '' when at rest. */ export declare function buildLimbicBlock(state: LimbicState | undefined): string; /** * Appraise a task's text into an initial affective deviation from `base` * (defaults to neutral): risky/destructive work raises caution + arousal; * large/complex work raises effort engagement + curiosity. Deterministic. */ export declare function appraiseTask(text: string, base?: LimbicState): LimbicState; //# sourceMappingURL=affect.d.ts.map