import type { GoalBlockReason, GoalPhase, GoalRef, GoalRoundAuthority, SessionGoal } from '../../types/goal/index.js'; import type { GoalId, SessionId, TenantId } from '../../types/ids/index.js'; import type { SessionStore } from '../../types/session/store.js'; /** Current source-backed limit for a human goal objective. */ export declare const MAX_GOAL_OBJECTIVE_CHARS = 4000; /** Source-aligned default; hosts may choose a smaller positive finite cap. */ export declare const DEFAULT_MAX_GOAL_ROUNDS = 256; export interface CreateSessionGoalParams { readonly sessionId: SessionId; readonly objective: string; readonly maxGoalRounds?: number; } export interface EditSessionGoalParams { readonly objective: string; } export interface SessionGoalStore { getGoal(sessionId: SessionId, tenantId: TenantId): Promise; createGoal(params: CreateSessionGoalParams, tenantId: TenantId): Promise; editGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef, changes: EditSessionGoalParams): Promise; pauseGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; resumeGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; /** Durably reserve one automatic round before any provider work begins. */ admitRound(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; completeGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; blockGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef, reason: GoalBlockReason): Promise; clearGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; } /** A mutation was based on a goal revision that is no longer current. */ export declare class StaleGoalError extends Error { readonly details: { readonly sessionId: SessionId; readonly expectedRevision: number; readonly actualRevision: number; }; constructor(details: StaleGoalError['details']); } /** A session already has a goal that has not completed or been cleared. */ export declare class GoalExistsError extends Error { readonly goal: SessionGoal; constructor(goal: SessionGoal); } /** A goal operation was requested for a session with no current goal. */ export declare class GoalNotFoundError extends Error { readonly sessionId: SessionId; constructor(sessionId: SessionId); } /** A goal transition is invalid from its current durable phase. */ export declare class GoalTransitionError extends Error { readonly phase: GoalPhase; readonly operation: string; constructor(phase: GoalPhase, operation: string); } /** Goal storage refuses ids that do not name a live tenant-owned Session. */ export declare class GoalSessionNotFoundError extends Error { readonly sessionId: SessionId; constructor(sessionId: SessionId); } /** Admission reached its finite cap after durably blocking the goal. */ export declare class GoalRoundLimitError extends Error { readonly goal: SessionGoal; constructor(goal: SessionGoal); } interface SessionGoalRecord { readonly sessionId: SessionId; readonly tenantId: TenantId; /** Storage sequence survives clear and fresh goal identities. */ readonly storageRevision: number; readonly goal: SessionGoal | null; readonly updatedAt: number; } declare abstract class SessionGoalStoreBase implements SessionGoalStore { protected readonly sessions: Pick; protected readonly now: () => number; protected readonly makeGoalId: () => GoalId; protected constructor(sessions: Pick, now: () => number, makeGoalId: () => GoalId); protected abstract put(record: SessionGoalRecord): Promise; private requireSession; getGoal(sessionId: SessionId, tenantId: TenantId): Promise; createGoal(params: CreateSessionGoalParams, tenantId: TenantId): Promise; editGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef, changes: EditSessionGoalParams): Promise; pauseGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; resumeGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; admitRound(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; completeGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; blockGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef, reason: GoalBlockReason): Promise; clearGoal(sessionId: SessionId, tenantId: TenantId, ref: GoalRef): Promise; private transition; private mutate; } export interface InMemorySessionGoalStoreConfig { readonly sessions: Pick; } export declare class InMemorySessionGoalStore extends SessionGoalStoreBase { private readonly records; constructor(config: InMemorySessionGoalStoreConfig, now?: () => number, makeGoalId?: () => GoalId); protected put(record: SessionGoalRecord): Promise; } export interface DiskSessionGoalStoreConfig { /** Session root; goals live under `/goals/`. */ readonly rootDir: string; /** Authority for session existence and tenant ownership. */ readonly sessions: Pick; } export declare class DiskSessionGoalStore extends SessionGoalStoreBase { private readonly config; constructor(config: DiskSessionGoalStoreConfig, now?: () => number, makeGoalId?: () => GoalId); private location; protected put(record: SessionGoalRecord): Promise; } export {}; //# sourceMappingURL=index.d.ts.map