/** * GoalsService — the goals back-end (goal CRUD + dedup + similarity scoring). * * Standalone successor to the goal CRUD half of PA's `withGoals` LifeOps * service mixin. It holds its own runtime + {@link GoalsRepository} and the * small identity helpers the methods need, so it has no dependency on * `@elizaos/plugin-personal-assistant`. Behavior and the data it returns are * preserved verbatim from the original mixin. * * Cross-domain goal logic is NOT here: goal review / overview / experience-loop * (`reviewGoal`, `getOverview`, `buildGoalExperienceLoop`, * `reviewGoalsForWeek`, `explainOccurrence`) aggregate PA's * definition / occurrence / reminder / calendar / activity-signal graph, so * they remain LifeOps mixin methods in PA. * * PA-owned concerns are taken as injected hooks rather than reimplemented: * - `recordAudit` — with PA, audit events persist into PA's shared * `app_lifeops` audit store; without PA, into `app_goals`. * - `releaseGoalReferences` — PA clears its task definitions' references to * a deleted goal; without PA there are none. * - `normalizeOwnership` — ownership normalization carries PA's domain / * subject rules and resolves the owner-entity / agent identity; it stays * PA-owned and is passed in. */ import { type CreateLifeOpsGoalRequest, type LifeOpsAuditEventType, type LifeOpsGoalDefinition, type LifeOpsGoalRecord, type LifeOpsOwnership, type LifeOpsOwnershipInput, type UpdateLifeOpsGoalRequest } from "@elizaos/contracts"; import type { IAgentRuntime } from "@elizaos/core"; import { GoalsRepository } from "./db/goals-repository.js"; /** * Compute a 0..1 similarity score between a reference goal and an existing * candidate. Used by {@link GoalsService.createGoal} for near-duplicate * short-circuiting and (in PA) by the goal experience-loop matcher. */ export declare function scoreGoalSimilarity(args: { reference: { title: string; description?: string | null; successCriteria?: Record | null; }; candidate: LifeOpsGoalDefinition; }): number; /** * Audit hook signature. Mirrors PA's `recordAudit` exactly; the goal back-end * always passes `ownerType: "goal"`. */ export type GoalsRecordAudit = (eventType: LifeOpsAuditEventType, ownerType: "goal", ownerId: string, reason: string, inputs: Record, decision: Record) => Promise; /** * Ownership-normalization hook signature. Mirrors PA's `normalizeOwnership`. * Stays PA-owned because it resolves owner-entity / agent identity and applies * PA's domain / subject invariants. */ export type GoalsNormalizeOwnership = (input: LifeOpsOwnershipInput | undefined, current?: LifeOpsOwnership) => LifeOpsOwnership; /** * Check-in engine hook. Implemented by `GoalsCheckinService` * (`./services/checkin.ts`); wired lazily by both construction sites so goal * writes keep per-goal check-in tasks on the scheduling spine in sync. A * `null` resolution means no check-in engine runs on this runtime (e.g. the * service is not registered) and goal writes proceed without scheduling. */ export interface GoalsCheckinSync { syncGoalCheckins(goal: LifeOpsGoalDefinition): Promise; removeGoalCheckins(goalId: string): Promise; } export interface GoalsServiceDependencies { recordAudit: GoalsRecordAudit; normalizeOwnership: GoalsNormalizeOwnership; checkinSync?: () => GoalsCheckinSync | null; /** Clear references to a goal that is being deleted from the host's tables. */ releaseGoalReferences?: (goalId: string) => Promise; } export declare class GoalsService { private readonly runtime; readonly repository: GoalsRepository; private readonly recordAudit; private readonly normalizeOwnership; private readonly resolveCheckinSync; private readonly releaseGoalReferences?; constructor(runtime: IAgentRuntime, deps: GoalsServiceDependencies); private agentId; private getGoalRecord; deleteGoal(goalId: string): Promise; listGoals(): Promise; getGoal(goalId: string): Promise; createGoal(request: CreateLifeOpsGoalRequest): Promise; updateGoal(goalId: string, request: UpdateLifeOpsGoalRequest): Promise; } //# sourceMappingURL=goals-service.d.ts.map