/** * Raw-SQL repository for the goals back-end. * * Owns all reads/writes against the goal tables (`life_goal_definitions`, * `life_goal_links`), carved out of `@elizaos/plugin-personal-assistant`'s * `app_lifeops` schema into this plugin's `app_goals` schema. PA's * reminder/scheduling subsystem still reads + writes goal links * (`upsertGoalLink` / `deleteGoalLinksForLinked`), but through PA's own * repository, whose SQL was repointed to `app_goals` in the same carve — so a * single owner backs every reader. PA's own tables are written only by PA: * it clears task references to a deleted goal and records goal audits through * the hooks it passes to `GoalsService`. * * SQL execution + value encoding go through the self-contained {@link ./sql.ts} * helpers, so this repository has no dependency on plugin-personal-assistant. */ import type { LifeOpsActor, LifeOpsAuditEventType, LifeOpsGoalDefinition, LifeOpsGoalLink, LifeOpsOwnerType } from "@elizaos/contracts"; import type { IAgentRuntime } from "@elizaos/core"; /** * Build a fully-formed goal definition (assigning id + timestamps). Standalone * successor to PA's `createLifeOpsGoalDefinition` factory. */ export declare function createGoalDefinition(params: Omit): LifeOpsGoalDefinition; export declare class GoalsRepository { private readonly runtime; constructor(runtime: IAgentRuntime); createGoal(goal: LifeOpsGoalDefinition): Promise; updateGoal(goal: LifeOpsGoalDefinition): Promise; /** Update only when the caller's source row is still current. */ updateGoalIfUnchanged(goal: LifeOpsGoalDefinition, expectedUpdatedAt: string): Promise; private writeGoal; /** * Record a computed review without rewriting the rest of the goal: only * `review_state`, `updated_at` and the given top-level metadata keys change, * merged into the stored metadata in SQL. A review computed from an earlier * read (it can span an LLM call) must not revert a concurrent edit, status * change or check-in written meanwhile. */ updateGoalReview(agentId: string, goalId: string, review: { reviewState: LifeOpsGoalDefinition["reviewState"]; metadataPatch: Record; updatedAt: string; }): Promise; getGoal(agentId: string, goalId: string): Promise; listGoals(agentId: string): Promise; /** * Record a check-in without rewriting the rest of the goal: only * `review_state`, `updated_at` and `metadata.checkinLog` change, merged into * the stored metadata in SQL, so an edit or review written while the * check-in's task completion ran is kept. */ updateGoalCheckin(agentId: string, goalId: string, checkin: { reviewState: LifeOpsGoalDefinition["reviewState"]; checkinLog: readonly unknown[]; updatedAt: string; }): Promise; deleteGoal(agentId: string, goalId: string): Promise; upsertGoalLink(link: LifeOpsGoalLink): Promise; deleteGoalLinksForLinked(agentId: string, linkedType: LifeOpsGoalLink["linkedType"], linkedId: string): Promise; listGoalLinksForGoal(agentId: string, goalId: string): Promise; /** * Append an audit event to this plugin's `app_goals.life_goal_audit_events`. * Used by the standalone goals service's default `recordAudit` hook. When PA * is present it injects its own `recordAudit` (into `app_lifeops`) instead. */ createAuditEvent(event: { id: string; agentId: string; eventType: LifeOpsAuditEventType; ownerType: LifeOpsOwnerType; ownerId: string; reason: string; inputs: Record; decision: Record; actor: LifeOpsActor; createdAt: string; }): Promise; } //# sourceMappingURL=goals-repository.d.ts.map