/** * Drizzle schema for the `tasks_goal` table — CLEO's DB-persisted, per-agent * goal store (Layer 4 of SG-COGNITIVE-SUBSTRATE). * * Pattern A (ADR-068 / the SQLite-consolidation decision): one file per scope * (this table lives INSIDE the project `cleo.db`, opened via * `openCleoDb('project', cwd)` / `getTasksDb`), domain-prefixed table name * (`tasks_goal`), and an idempotency * key as the natural primary key so a re-issued `create` coalesces via * `onConflictDoNothing` rather than duplicating a row. * * Per-agent isolation: every row carries `session_id` + `agent_id` resolved * from E0 (`resolveSessionIdFromEnv` / `resolveAgentIdFromEnv`). The * `idx_tasks_goal_owner_active` index serves the dominant lookup — * "the active goal for THIS agent" — so two concurrent agents never collide on * one global row (the session-bleed class this saga exists to kill). * * `criteria` is a JSONB column (binary, queryable in-SQL) via the reusable * {@link jsonb} customType. The load-bearing read rule applies: whole-value * reads MUST project `json(col)` (see {@link jsonbText}) — never `JSON.parse` * the raw BLOB bytes. `last_verdict` is whole-value-read-only structured state, * so it uses JSONB too and is always read back through `json(col)`. * * @epic T11290 EP-CLEO-GOAL-SYSTEM * @task T11377 * @saga T11283 SG-COGNITIVE-SUBSTRATE * @adr ADR-068 */ import type { GoalJudgeVerdict, GoalKind } from '@cleocode/contracts'; /** * Per-agent goal record, persisted in `tasks.db`. * * Survives process restart (the whole point — Claude-Code forgets the goal on a * fresh process; CLEO does not). Keyed by `idempotency_key` so the create path * is safe to retry. `goal_kind` is the serialized {@link GoalKind} discriminated * union (whole-value JSONB read) that routes the judge: evidence path for * `task-completion`, LLM fallback for `fuzzy`. * * @task T11377 */ export declare const tasksGoal: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{ name: "tasks_goal"; schema: undefined; columns: { idempotencyKey: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "string"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: true; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}>; sessionId: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "string"; data: string; driverParam: string; notNull: false; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}>; agentId: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "string"; data: string; driverParam: string; notNull: false; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}>; parentGoalId: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "string"; data: string; driverParam: string; notNull: false; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}>; goalKind: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "custom"; data: GoalKind; driverParam: Buffer | Uint8Array; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}>; intent: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "string"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}>; criteria: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "custom"; data: string[]; driverParam: Buffer | Uint8Array; notNull: true; hasDefault: true; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}>; status: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "string"; data: string; driverParam: string; notNull: true; hasDefault: true; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}>; turnBudget: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "number int53"; data: number; driverParam: number; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}>; turnsUsed: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "number int53"; data: number; driverParam: number; notNull: true; hasDefault: true; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}>; pausedReason: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "string"; data: string; driverParam: string; notNull: false; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}>; lastVerdict: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "custom"; data: GoalJudgeVerdict; driverParam: Buffer | Uint8Array; notNull: false; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}>; createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "string"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}>; updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{ name: string; tableName: "tasks_goal"; dataType: "string"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}>; }; dialect: "sqlite"; }>; /** Row type for `tasks_goal` SELECT queries (T11377). */ export type TasksGoalRow = typeof tasksGoal.$inferSelect; /** Row type for `tasks_goal` INSERT operations (T11377). */ export type NewTasksGoalRow = typeof tasksGoal.$inferInsert; //# sourceMappingURL=goal.d.ts.map