@elizaos/plugin-goals 2.0.3-beta.6 → 2.0.3-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/goals.d.ts +16 -0
- package/dist/actions/goals.d.ts.map +1 -0
- package/dist/actions/goals.js +150 -0
- package/dist/actions/goals.js.map +1 -0
- package/dist/components/goals/GoalsSpatialView.d.ts +42 -0
- package/dist/components/goals/GoalsSpatialView.d.ts.map +1 -0
- package/dist/components/goals/GoalsSpatialView.js +149 -0
- package/dist/components/goals/GoalsSpatialView.js.map +1 -0
- package/dist/components/goals/GoalsView.d.ts +60 -0
- package/dist/components/goals/GoalsView.d.ts.map +1 -0
- package/dist/components/goals/GoalsView.js +150 -0
- package/dist/components/goals/GoalsView.js.map +1 -0
- package/dist/components/goals/goals-view-bundle.d.ts +2 -0
- package/dist/components/goals/goals-view-bundle.d.ts.map +1 -0
- package/dist/components/goals/goals-view-bundle.js +5 -0
- package/dist/components/goals/goals-view-bundle.js.map +1 -0
- package/dist/db/goals-repository.d.ts +54 -0
- package/dist/db/goals-repository.d.ts.map +1 -0
- package/dist/db/goals-repository.js +239 -0
- package/dist/db/goals-repository.js.map +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +2 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema.d.ts +826 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +61 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/sql.d.ts +32 -0
- package/dist/db/sql.d.ts.map +1 -0
- package/dist/db/sql.js +130 -0
- package/dist/db/sql.js.map +1 -0
- package/dist/goal-grounding.d.ts +54 -0
- package/dist/goal-grounding.d.ts.map +1 -0
- package/dist/goal-grounding.js +148 -0
- package/dist/goal-grounding.js.map +1 -0
- package/dist/goal-normalize.d.ts +30 -0
- package/dist/goal-normalize.d.ts.map +1 -0
- package/dist/goal-normalize.js +99 -0
- package/dist/goal-normalize.js.map +1 -0
- package/dist/goal-semantic-evaluator.d.ts +12 -0
- package/dist/goal-semantic-evaluator.d.ts.map +1 -0
- package/dist/goal-semantic-evaluator.js +208 -0
- package/dist/goal-semantic-evaluator.js.map +1 -0
- package/dist/goals-runtime.d.ts +34 -0
- package/dist/goals-runtime.d.ts.map +1 -0
- package/dist/goals-runtime.js +44 -0
- package/dist/goals-runtime.js.map +1 -0
- package/dist/goals-service.d.ts +68 -0
- package/dist/goals-service.d.ts.map +1 -0
- package/dist/goals-service.js +293 -0
- package/dist/goals-service.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +13 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +47 -0
- package/dist/plugin.js.map +1 -0
- package/dist/register-terminal-view.d.ts +15 -0
- package/dist/register-terminal-view.d.ts.map +1 -0
- package/dist/register-terminal-view.js +25 -0
- package/dist/register-terminal-view.js.map +1 -0
- package/dist/register.d.ts +9 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +5 -0
- package/dist/register.js.map +1 -0
- package/dist/services/checkin.d.ts +23 -0
- package/dist/services/checkin.d.ts.map +1 -0
- package/dist/services/checkin.js +27 -0
- package/dist/services/checkin.js.map +1 -0
- package/dist/services/migration.d.ts +49 -0
- package/dist/services/migration.d.ts.map +1 -0
- package/dist/services/migration.js +113 -0
- package/dist/services/migration.js.map +1 -0
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +53 -0
- package/dist/types.js.map +1 -0
- package/dist/views/bundle.js +304 -0
- package/dist/views/bundle.js.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LIFEOPS_GOAL_STATUSES,
|
|
3
|
+
LIFEOPS_REVIEW_STATES
|
|
4
|
+
} from "@elizaos/shared";
|
|
5
|
+
import {
|
|
6
|
+
createGoalDefinition,
|
|
7
|
+
GoalsRepository
|
|
8
|
+
} from "./db/goals-repository.js";
|
|
9
|
+
import {
|
|
10
|
+
fail,
|
|
11
|
+
mergeMetadata,
|
|
12
|
+
normalizeEnumValue,
|
|
13
|
+
normalizeNullableRecord,
|
|
14
|
+
normalizeOptionalRecord,
|
|
15
|
+
normalizeOptionalString,
|
|
16
|
+
requireAgentId,
|
|
17
|
+
requireNonEmptyString,
|
|
18
|
+
requireRecord
|
|
19
|
+
} from "./goal-normalize.js";
|
|
20
|
+
const GOAL_SIMILARITY_STOP_WORDS = /* @__PURE__ */ new Set([
|
|
21
|
+
"and",
|
|
22
|
+
"the",
|
|
23
|
+
"for",
|
|
24
|
+
"with",
|
|
25
|
+
"that",
|
|
26
|
+
"this",
|
|
27
|
+
"from",
|
|
28
|
+
"before",
|
|
29
|
+
"after",
|
|
30
|
+
"goal",
|
|
31
|
+
"goals"
|
|
32
|
+
]);
|
|
33
|
+
function tokenizeGoalText(text) {
|
|
34
|
+
const raw = typeof text === "string" ? text : "";
|
|
35
|
+
return raw.toLowerCase().split(/[^a-z0-9]+/u).filter(
|
|
36
|
+
(token) => token.length >= 3 && !GOAL_SIMILARITY_STOP_WORDS.has(token)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function buildGoalSimilarityTokens(args) {
|
|
40
|
+
const tokens = [
|
|
41
|
+
...tokenizeGoalText(args.title),
|
|
42
|
+
...tokenizeGoalText(args.description),
|
|
43
|
+
...tokenizeGoalText(
|
|
44
|
+
args.successCriteria ? JSON.stringify(args.successCriteria) : ""
|
|
45
|
+
)
|
|
46
|
+
];
|
|
47
|
+
return [...new Set(tokens)];
|
|
48
|
+
}
|
|
49
|
+
function scoreGoalSimilarity(args) {
|
|
50
|
+
const referenceTokens = buildGoalSimilarityTokens({
|
|
51
|
+
title: args.reference.title,
|
|
52
|
+
description: args.reference.description,
|
|
53
|
+
successCriteria: args.reference.successCriteria
|
|
54
|
+
});
|
|
55
|
+
if (referenceTokens.length === 0) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
const candidateTokens = new Set(
|
|
59
|
+
buildGoalSimilarityTokens({
|
|
60
|
+
title: args.candidate.title,
|
|
61
|
+
description: args.candidate.description,
|
|
62
|
+
successCriteria: normalizeOptionalRecord(
|
|
63
|
+
args.candidate.successCriteria,
|
|
64
|
+
"successCriteria"
|
|
65
|
+
)
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
const overlap = referenceTokens.filter(
|
|
69
|
+
(token) => candidateTokens.has(token)
|
|
70
|
+
).length;
|
|
71
|
+
if (overlap === 0) {
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
const referenceTitleTokens = tokenizeGoalText(args.reference.title);
|
|
75
|
+
const candidateTitleTokens = new Set(tokenizeGoalText(args.candidate.title));
|
|
76
|
+
const titleOverlap = referenceTitleTokens.filter(
|
|
77
|
+
(token) => candidateTitleTokens.has(token)
|
|
78
|
+
).length;
|
|
79
|
+
const baseScore = overlap / referenceTokens.length;
|
|
80
|
+
const titleBonus = referenceTitleTokens.length > 0 ? titleOverlap / referenceTitleTokens.length * 0.35 : 0;
|
|
81
|
+
return Math.max(0, Math.min(1, baseScore * 0.75 + titleBonus));
|
|
82
|
+
}
|
|
83
|
+
class GoalsService {
|
|
84
|
+
constructor(runtime, deps) {
|
|
85
|
+
this.runtime = runtime;
|
|
86
|
+
this.repository = new GoalsRepository(runtime);
|
|
87
|
+
this.recordAudit = deps.recordAudit;
|
|
88
|
+
this.normalizeOwnership = deps.normalizeOwnership;
|
|
89
|
+
}
|
|
90
|
+
runtime;
|
|
91
|
+
repository;
|
|
92
|
+
recordAudit;
|
|
93
|
+
normalizeOwnership;
|
|
94
|
+
agentId() {
|
|
95
|
+
return requireAgentId(this.runtime);
|
|
96
|
+
}
|
|
97
|
+
async getGoalRecord(goalId) {
|
|
98
|
+
const goal = await this.repository.getGoal(this.agentId(), goalId);
|
|
99
|
+
if (!goal) {
|
|
100
|
+
fail(404, "life-ops goal not found");
|
|
101
|
+
}
|
|
102
|
+
const links = await this.repository.listGoalLinksForGoal(
|
|
103
|
+
this.agentId(),
|
|
104
|
+
goalId
|
|
105
|
+
);
|
|
106
|
+
return { goal, links };
|
|
107
|
+
}
|
|
108
|
+
async deleteGoal(goalId) {
|
|
109
|
+
const goal = await this.repository.getGoal(this.agentId(), goalId);
|
|
110
|
+
if (!goal) {
|
|
111
|
+
fail(404, "life-ops goal not found");
|
|
112
|
+
}
|
|
113
|
+
await this.repository.deleteGoal(this.agentId(), goalId);
|
|
114
|
+
await this.recordAudit(
|
|
115
|
+
"goal_deleted",
|
|
116
|
+
"goal",
|
|
117
|
+
goalId,
|
|
118
|
+
"goal deleted",
|
|
119
|
+
{ title: goal.title },
|
|
120
|
+
{}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
async listGoals() {
|
|
124
|
+
const goals = await this.repository.listGoals(this.agentId());
|
|
125
|
+
const records = [];
|
|
126
|
+
for (const goal of goals) {
|
|
127
|
+
const links = await this.repository.listGoalLinksForGoal(
|
|
128
|
+
this.agentId(),
|
|
129
|
+
goal.id
|
|
130
|
+
);
|
|
131
|
+
records.push({ goal, links });
|
|
132
|
+
}
|
|
133
|
+
return records;
|
|
134
|
+
}
|
|
135
|
+
async getGoal(goalId) {
|
|
136
|
+
return this.getGoalRecord(goalId);
|
|
137
|
+
}
|
|
138
|
+
async createGoal(request) {
|
|
139
|
+
const ownership = this.normalizeOwnership(request.ownership);
|
|
140
|
+
const requestTitle = requireNonEmptyString(request.title, "title");
|
|
141
|
+
const requestDescription = normalizeOptionalString(request.description) ?? "";
|
|
142
|
+
const requestSuccessCriteria = (() => {
|
|
143
|
+
const criteria = normalizeOptionalRecord(request.successCriteria, "successCriteria") ?? {};
|
|
144
|
+
if (Array.isArray(criteria)) {
|
|
145
|
+
fail(400, "successCriteria must be an object, not an array");
|
|
146
|
+
}
|
|
147
|
+
return criteria;
|
|
148
|
+
})();
|
|
149
|
+
const existingGoals = await this.repository.listGoals(this.agentId());
|
|
150
|
+
const dedupCandidate = (() => {
|
|
151
|
+
let best = null;
|
|
152
|
+
for (const candidate of existingGoals) {
|
|
153
|
+
if (candidate.status !== "active") continue;
|
|
154
|
+
if (candidate.subjectType !== ownership.subjectType) continue;
|
|
155
|
+
if (candidate.subjectId !== ownership.subjectId) continue;
|
|
156
|
+
const score = scoreGoalSimilarity({
|
|
157
|
+
reference: {
|
|
158
|
+
title: requestTitle,
|
|
159
|
+
description: requestDescription,
|
|
160
|
+
successCriteria: requestSuccessCriteria
|
|
161
|
+
},
|
|
162
|
+
candidate
|
|
163
|
+
});
|
|
164
|
+
if (score >= 0.85 && (best === null || score > best.score)) {
|
|
165
|
+
best = { record: candidate, score };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return best;
|
|
169
|
+
})();
|
|
170
|
+
if (dedupCandidate !== null) {
|
|
171
|
+
const links = await this.repository.listGoalLinksForGoal(
|
|
172
|
+
this.agentId(),
|
|
173
|
+
dedupCandidate.record.id
|
|
174
|
+
);
|
|
175
|
+
await this.recordAudit(
|
|
176
|
+
"goal_created",
|
|
177
|
+
"goal",
|
|
178
|
+
dedupCandidate.record.id,
|
|
179
|
+
"goal create short-circuited by dedup",
|
|
180
|
+
{
|
|
181
|
+
request
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
dedup: true,
|
|
185
|
+
similarityScore: Number(dedupCandidate.score.toFixed(3)),
|
|
186
|
+
existingGoalId: dedupCandidate.record.id,
|
|
187
|
+
status: dedupCandidate.record.status,
|
|
188
|
+
reviewState: dedupCandidate.record.reviewState
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
return {
|
|
192
|
+
goal: dedupCandidate.record,
|
|
193
|
+
links
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
const goal = createGoalDefinition({
|
|
197
|
+
agentId: this.agentId(),
|
|
198
|
+
...ownership,
|
|
199
|
+
title: requestTitle,
|
|
200
|
+
description: requestDescription,
|
|
201
|
+
cadence: (() => {
|
|
202
|
+
const cadence = normalizeNullableRecord(request.cadence, "cadence");
|
|
203
|
+
if (cadence && typeof cadence.kind !== "string") {
|
|
204
|
+
fail(400, "goal cadence must include a 'kind' field when provided");
|
|
205
|
+
}
|
|
206
|
+
return cadence ?? null;
|
|
207
|
+
})(),
|
|
208
|
+
supportStrategy: (() => {
|
|
209
|
+
const strategy = normalizeOptionalRecord(request.supportStrategy, "supportStrategy") ?? {};
|
|
210
|
+
if (Array.isArray(strategy)) {
|
|
211
|
+
fail(400, "supportStrategy must be an object, not an array");
|
|
212
|
+
}
|
|
213
|
+
return strategy;
|
|
214
|
+
})(),
|
|
215
|
+
successCriteria: requestSuccessCriteria,
|
|
216
|
+
status: request.status === void 0 ? "active" : normalizeEnumValue(request.status, "status", LIFEOPS_GOAL_STATUSES),
|
|
217
|
+
reviewState: request.reviewState === void 0 ? "idle" : normalizeEnumValue(
|
|
218
|
+
request.reviewState,
|
|
219
|
+
"reviewState",
|
|
220
|
+
LIFEOPS_REVIEW_STATES
|
|
221
|
+
),
|
|
222
|
+
metadata: mergeMetadata(
|
|
223
|
+
{},
|
|
224
|
+
normalizeOptionalRecord(request.metadata, "metadata")
|
|
225
|
+
)
|
|
226
|
+
});
|
|
227
|
+
await this.repository.createGoal(goal);
|
|
228
|
+
await this.recordAudit(
|
|
229
|
+
"goal_created",
|
|
230
|
+
"goal",
|
|
231
|
+
goal.id,
|
|
232
|
+
"goal created",
|
|
233
|
+
{
|
|
234
|
+
request
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
status: goal.status,
|
|
238
|
+
reviewState: goal.reviewState
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
return {
|
|
242
|
+
goal,
|
|
243
|
+
links: []
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
async updateGoal(goalId, request) {
|
|
247
|
+
const current = await this.getGoalRecord(goalId);
|
|
248
|
+
const ownership = this.normalizeOwnership(request.ownership, current.goal);
|
|
249
|
+
const nextGoal = {
|
|
250
|
+
...current.goal,
|
|
251
|
+
...ownership,
|
|
252
|
+
title: request.title !== void 0 ? requireNonEmptyString(request.title, "title") : current.goal.title,
|
|
253
|
+
description: request.description !== void 0 ? normalizeOptionalString(request.description) ?? "" : current.goal.description,
|
|
254
|
+
cadence: request.cadence !== void 0 ? normalizeNullableRecord(request.cadence, "cadence") ?? null : current.goal.cadence,
|
|
255
|
+
supportStrategy: request.supportStrategy !== void 0 ? requireRecord(request.supportStrategy, "supportStrategy") : current.goal.supportStrategy,
|
|
256
|
+
successCriteria: request.successCriteria !== void 0 ? requireRecord(request.successCriteria, "successCriteria") : current.goal.successCriteria,
|
|
257
|
+
status: request.status !== void 0 ? normalizeEnumValue(request.status, "status", LIFEOPS_GOAL_STATUSES) : current.goal.status,
|
|
258
|
+
reviewState: request.reviewState !== void 0 ? normalizeEnumValue(
|
|
259
|
+
request.reviewState,
|
|
260
|
+
"reviewState",
|
|
261
|
+
LIFEOPS_REVIEW_STATES
|
|
262
|
+
) : current.goal.reviewState,
|
|
263
|
+
metadata: request.metadata !== void 0 ? mergeMetadata(
|
|
264
|
+
current.goal.metadata,
|
|
265
|
+
normalizeOptionalRecord(request.metadata, "metadata")
|
|
266
|
+
) : current.goal.metadata,
|
|
267
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
268
|
+
};
|
|
269
|
+
await this.repository.updateGoal(nextGoal);
|
|
270
|
+
await this.recordAudit(
|
|
271
|
+
"goal_updated",
|
|
272
|
+
"goal",
|
|
273
|
+
nextGoal.id,
|
|
274
|
+
"goal updated",
|
|
275
|
+
{
|
|
276
|
+
request
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
status: nextGoal.status,
|
|
280
|
+
reviewState: nextGoal.reviewState
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
return {
|
|
284
|
+
goal: nextGoal,
|
|
285
|
+
links: current.links
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
export {
|
|
290
|
+
GoalsService,
|
|
291
|
+
scoreGoalSimilarity
|
|
292
|
+
};
|
|
293
|
+
//# sourceMappingURL=goals-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/goals-service.ts"],"sourcesContent":["/**\n * GoalsService — the goals back-end (goal CRUD + dedup + similarity scoring).\n *\n * Standalone successor to the goal CRUD half of PA's `withGoals` LifeOps\n * service mixin. It holds its own runtime + {@link GoalsRepository} and the\n * small identity helpers the methods need, so it has no dependency on\n * `@elizaos/plugin-personal-assistant`. Behavior and the data it returns are\n * preserved verbatim from the original mixin.\n *\n * Cross-domain goal logic is NOT here: goal review / overview / experience-loop\n * (`reviewGoal`, `getOverview`, `buildGoalExperienceLoop`,\n * `reviewGoalsForWeek`, `explainOccurrence`) aggregate PA's\n * definition / occurrence / reminder / calendar / activity-signal graph, so\n * they remain LifeOps mixin methods in PA.\n *\n * Two PA-owned concerns are taken as injected hooks rather than reimplemented:\n * - `recordAudit` — audit events persist into PA's shared `app_lifeops` audit\n * store; goal creates/updates/deletes record there exactly as before.\n * - `normalizeOwnership` — ownership normalization carries PA's domain /\n * subject rules and resolves the owner-entity / agent identity; it stays\n * PA-owned and is passed in.\n */\n\nimport type { IAgentRuntime } from \"@elizaos/core\";\nimport {\n type CreateLifeOpsGoalRequest,\n LIFEOPS_GOAL_STATUSES,\n LIFEOPS_REVIEW_STATES,\n type LifeOpsAuditEventType,\n type LifeOpsGoalDefinition,\n type LifeOpsGoalRecord,\n type LifeOpsOwnership,\n type LifeOpsOwnershipInput,\n type UpdateLifeOpsGoalRequest,\n} from \"@elizaos/shared\";\nimport {\n createGoalDefinition,\n GoalsRepository,\n} from \"./db/goals-repository.js\";\nimport {\n fail,\n mergeMetadata,\n normalizeEnumValue,\n normalizeNullableRecord,\n normalizeOptionalRecord,\n normalizeOptionalString,\n requireAgentId,\n requireNonEmptyString,\n requireRecord,\n} from \"./goal-normalize.js\";\n\nconst GOAL_SIMILARITY_STOP_WORDS = new Set([\n \"and\",\n \"the\",\n \"for\",\n \"with\",\n \"that\",\n \"this\",\n \"from\",\n \"before\",\n \"after\",\n \"goal\",\n \"goals\",\n]);\n\nfunction tokenizeGoalText(text: string | null | undefined): string[] {\n const raw = typeof text === \"string\" ? text : \"\";\n return raw\n .toLowerCase()\n .split(/[^a-z0-9]+/u)\n .filter(\n (token) => token.length >= 3 && !GOAL_SIMILARITY_STOP_WORDS.has(token),\n );\n}\n\nfunction buildGoalSimilarityTokens(args: {\n title: string;\n description?: string | null;\n successCriteria?: Record<string, unknown> | null;\n}): string[] {\n const tokens = [\n ...tokenizeGoalText(args.title),\n ...tokenizeGoalText(args.description),\n ...tokenizeGoalText(\n args.successCriteria ? JSON.stringify(args.successCriteria) : \"\",\n ),\n ];\n return [...new Set(tokens)];\n}\n\n/**\n * Compute a 0..1 similarity score between a reference goal and an existing\n * candidate. Used by {@link GoalsService.createGoal} for near-duplicate\n * short-circuiting and (in PA) by the goal experience-loop matcher.\n */\nexport function scoreGoalSimilarity(args: {\n reference: {\n title: string;\n description?: string | null;\n successCriteria?: Record<string, unknown> | null;\n };\n candidate: LifeOpsGoalDefinition;\n}): number {\n const referenceTokens = buildGoalSimilarityTokens({\n title: args.reference.title,\n description: args.reference.description,\n successCriteria: args.reference.successCriteria,\n });\n if (referenceTokens.length === 0) {\n return 0;\n }\n const candidateTokens = new Set(\n buildGoalSimilarityTokens({\n title: args.candidate.title,\n description: args.candidate.description,\n successCriteria: normalizeOptionalRecord(\n args.candidate.successCriteria,\n \"successCriteria\",\n ),\n }),\n );\n const overlap = referenceTokens.filter((token) =>\n candidateTokens.has(token),\n ).length;\n if (overlap === 0) {\n return 0;\n }\n const referenceTitleTokens = tokenizeGoalText(args.reference.title);\n const candidateTitleTokens = new Set(tokenizeGoalText(args.candidate.title));\n const titleOverlap = referenceTitleTokens.filter((token) =>\n candidateTitleTokens.has(token),\n ).length;\n const baseScore = overlap / referenceTokens.length;\n const titleBonus =\n referenceTitleTokens.length > 0\n ? (titleOverlap / referenceTitleTokens.length) * 0.35\n : 0;\n return Math.max(0, Math.min(1, baseScore * 0.75 + titleBonus));\n}\n\n/**\n * Audit hook signature. Mirrors PA's `recordAudit` exactly; the goal back-end\n * always passes `ownerType: \"goal\"`.\n */\nexport type GoalsRecordAudit = (\n eventType: LifeOpsAuditEventType,\n ownerType: \"goal\",\n ownerId: string,\n reason: string,\n inputs: Record<string, unknown>,\n decision: Record<string, unknown>,\n) => Promise<void>;\n\n/**\n * Ownership-normalization hook signature. Mirrors PA's `normalizeOwnership`.\n * Stays PA-owned because it resolves owner-entity / agent identity and applies\n * PA's domain / subject invariants.\n */\nexport type GoalsNormalizeOwnership = (\n input: LifeOpsOwnershipInput | undefined,\n current?: LifeOpsOwnership,\n) => LifeOpsOwnership;\n\nexport interface GoalsServiceDependencies {\n recordAudit: GoalsRecordAudit;\n normalizeOwnership: GoalsNormalizeOwnership;\n}\n\nexport class GoalsService {\n readonly repository: GoalsRepository;\n private readonly recordAudit: GoalsRecordAudit;\n private readonly normalizeOwnership: GoalsNormalizeOwnership;\n\n constructor(\n private readonly runtime: IAgentRuntime,\n deps: GoalsServiceDependencies,\n ) {\n this.repository = new GoalsRepository(runtime);\n this.recordAudit = deps.recordAudit;\n this.normalizeOwnership = deps.normalizeOwnership;\n }\n\n private agentId(): string {\n return requireAgentId(this.runtime);\n }\n\n private async getGoalRecord(goalId: string): Promise<LifeOpsGoalRecord> {\n const goal = await this.repository.getGoal(this.agentId(), goalId);\n if (!goal) {\n fail(404, \"life-ops goal not found\");\n }\n const links = await this.repository.listGoalLinksForGoal(\n this.agentId(),\n goalId,\n );\n return { goal, links };\n }\n\n async deleteGoal(goalId: string): Promise<void> {\n const goal = await this.repository.getGoal(this.agentId(), goalId);\n if (!goal) {\n fail(404, \"life-ops goal not found\");\n }\n await this.repository.deleteGoal(this.agentId(), goalId);\n await this.recordAudit(\n \"goal_deleted\",\n \"goal\",\n goalId,\n \"goal deleted\",\n { title: goal.title },\n {},\n );\n }\n\n async listGoals(): Promise<LifeOpsGoalRecord[]> {\n const goals = await this.repository.listGoals(this.agentId());\n const records: LifeOpsGoalRecord[] = [];\n for (const goal of goals) {\n const links = await this.repository.listGoalLinksForGoal(\n this.agentId(),\n goal.id,\n );\n records.push({ goal, links });\n }\n return records;\n }\n\n async getGoal(goalId: string): Promise<LifeOpsGoalRecord> {\n return this.getGoalRecord(goalId);\n }\n\n async createGoal(\n request: CreateLifeOpsGoalRequest,\n ): Promise<LifeOpsGoalRecord> {\n const ownership = this.normalizeOwnership(request.ownership);\n const requestTitle = requireNonEmptyString(request.title, \"title\");\n const requestDescription =\n normalizeOptionalString(request.description) ?? \"\";\n const requestSuccessCriteria = (() => {\n const criteria =\n normalizeOptionalRecord(request.successCriteria, \"successCriteria\") ??\n {};\n if (Array.isArray(criteria)) {\n fail(400, \"successCriteria must be an object, not an array\");\n }\n return criteria;\n })();\n\n // Dedup: short-circuit if a near-duplicate active goal already exists in\n // the same ownership scope. Avoids spamming duplicate rows when the user\n // re-issues the same chat phrase. Threshold 0.85 is conservative; see\n // scoreGoalSimilarity for the scoring algorithm.\n const existingGoals = await this.repository.listGoals(this.agentId());\n const dedupCandidate = (() => {\n let best: { record: LifeOpsGoalDefinition; score: number } | null = null;\n for (const candidate of existingGoals) {\n if (candidate.status !== \"active\") continue;\n if (candidate.subjectType !== ownership.subjectType) continue;\n if (candidate.subjectId !== ownership.subjectId) continue;\n const score = scoreGoalSimilarity({\n reference: {\n title: requestTitle,\n description: requestDescription,\n successCriteria: requestSuccessCriteria,\n },\n candidate,\n });\n if (score >= 0.85 && (best === null || score > best.score)) {\n best = { record: candidate, score };\n }\n }\n return best;\n })();\n\n if (dedupCandidate !== null) {\n const links = await this.repository.listGoalLinksForGoal(\n this.agentId(),\n dedupCandidate.record.id,\n );\n await this.recordAudit(\n \"goal_created\",\n \"goal\",\n dedupCandidate.record.id,\n \"goal create short-circuited by dedup\",\n {\n request,\n },\n {\n dedup: true,\n similarityScore: Number(dedupCandidate.score.toFixed(3)),\n existingGoalId: dedupCandidate.record.id,\n status: dedupCandidate.record.status,\n reviewState: dedupCandidate.record.reviewState,\n },\n );\n return {\n goal: dedupCandidate.record,\n links,\n };\n }\n\n const goal = createGoalDefinition({\n agentId: this.agentId(),\n ...ownership,\n title: requestTitle,\n description: requestDescription,\n cadence: (() => {\n const cadence = normalizeNullableRecord(request.cadence, \"cadence\");\n if (cadence && typeof cadence.kind !== \"string\") {\n fail(400, \"goal cadence must include a 'kind' field when provided\");\n }\n return cadence ?? null;\n })(),\n supportStrategy: (() => {\n const strategy =\n normalizeOptionalRecord(request.supportStrategy, \"supportStrategy\") ??\n {};\n if (Array.isArray(strategy)) {\n fail(400, \"supportStrategy must be an object, not an array\");\n }\n return strategy;\n })(),\n successCriteria: requestSuccessCriteria,\n status:\n request.status === undefined\n ? \"active\"\n : normalizeEnumValue(request.status, \"status\", LIFEOPS_GOAL_STATUSES),\n reviewState:\n request.reviewState === undefined\n ? \"idle\"\n : normalizeEnumValue(\n request.reviewState,\n \"reviewState\",\n LIFEOPS_REVIEW_STATES,\n ),\n metadata: mergeMetadata(\n {},\n normalizeOptionalRecord(request.metadata, \"metadata\"),\n ),\n });\n await this.repository.createGoal(goal);\n await this.recordAudit(\n \"goal_created\",\n \"goal\",\n goal.id,\n \"goal created\",\n {\n request,\n },\n {\n status: goal.status,\n reviewState: goal.reviewState,\n },\n );\n return {\n goal,\n links: [],\n };\n }\n\n async updateGoal(\n goalId: string,\n request: UpdateLifeOpsGoalRequest,\n ): Promise<LifeOpsGoalRecord> {\n const current = await this.getGoalRecord(goalId);\n const ownership = this.normalizeOwnership(request.ownership, current.goal);\n const nextGoal: LifeOpsGoalDefinition = {\n ...current.goal,\n ...ownership,\n title:\n request.title !== undefined\n ? requireNonEmptyString(request.title, \"title\")\n : current.goal.title,\n description:\n request.description !== undefined\n ? (normalizeOptionalString(request.description) ?? \"\")\n : current.goal.description,\n cadence:\n request.cadence !== undefined\n ? (normalizeNullableRecord(request.cadence, \"cadence\") ?? null)\n : current.goal.cadence,\n supportStrategy:\n request.supportStrategy !== undefined\n ? requireRecord(request.supportStrategy, \"supportStrategy\")\n : current.goal.supportStrategy,\n successCriteria:\n request.successCriteria !== undefined\n ? requireRecord(request.successCriteria, \"successCriteria\")\n : current.goal.successCriteria,\n status:\n request.status !== undefined\n ? normalizeEnumValue(request.status, \"status\", LIFEOPS_GOAL_STATUSES)\n : current.goal.status,\n reviewState:\n request.reviewState !== undefined\n ? normalizeEnumValue(\n request.reviewState,\n \"reviewState\",\n LIFEOPS_REVIEW_STATES,\n )\n : current.goal.reviewState,\n metadata:\n request.metadata !== undefined\n ? mergeMetadata(\n current.goal.metadata,\n normalizeOptionalRecord(request.metadata, \"metadata\"),\n )\n : current.goal.metadata,\n updatedAt: new Date().toISOString(),\n };\n await this.repository.updateGoal(nextGoal);\n await this.recordAudit(\n \"goal_updated\",\n \"goal\",\n nextGoal.id,\n \"goal updated\",\n {\n request,\n },\n {\n status: nextGoal.status,\n reviewState: nextGoal.reviewState,\n },\n );\n return {\n goal: nextGoal,\n links: current.links,\n };\n }\n}\n"],"mappings":"AAwBA;AAAA,EAEE;AAAA,EACA;AAAA,OAOK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,6BAA6B,oBAAI,IAAI;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,iBAAiB,MAA2C;AACnE,QAAM,MAAM,OAAO,SAAS,WAAW,OAAO;AAC9C,SAAO,IACJ,YAAY,EACZ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;AAAA,MACT;AAAA,MACA;AAAA,QACE;AAAA,MACF;AAAA,MACA;AAAA,QACE,QAAQ,SAAS;AAAA,QACjB,aAAa,SAAS;AAAA,MACxB;AAAA,IACF;AACA,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO,QAAQ;AAAA,IACjB;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./register.js";
|
|
2
|
+
export { ownerGoalsAction } from "./actions/goals.js";
|
|
3
|
+
export { GoalsView } from "./components/goals/GoalsView.js";
|
|
4
|
+
export { createGoalDefinition, GoalsRepository, } from "./db/goals-repository.js";
|
|
5
|
+
export { type GoalDefinitionRow, type GoalLinkRow, goalsDbSchema, goalsSchema, lifeGoalDefinitions, lifeGoalLinks, } from "./db/schema.js";
|
|
6
|
+
export * from "./goal-grounding.js";
|
|
7
|
+
export { GoalsServiceError, goalsErrorMessage, } from "./goal-normalize.js";
|
|
8
|
+
export { evaluateGoalProgressWithLlm, type GoalSemanticEvaluationResult, } from "./goal-semantic-evaluator.js";
|
|
9
|
+
export { buildOwnerOwnership, createOwnerGoalsService, ownerEntityIdFor, } from "./goals-runtime.js";
|
|
10
|
+
export { type GoalsNormalizeOwnership, type GoalsRecordAudit, GoalsService, type GoalsServiceDependencies, scoreGoalSimilarity, } from "./goals-service.js";
|
|
11
|
+
export { default, goalsPlugin } from "./plugin.js";
|
|
12
|
+
export { GoalsCheckinService, getGoalsCheckinService, } from "./services/checkin.js";
|
|
13
|
+
export * from "./types.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,YAAY,EACZ,KAAK,wBAAwB,EAC7B,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "./register.js";
|
|
2
|
+
import { ownerGoalsAction } from "./actions/goals.js";
|
|
3
|
+
import { GoalsView } from "./components/goals/GoalsView.js";
|
|
4
|
+
import {
|
|
5
|
+
createGoalDefinition,
|
|
6
|
+
GoalsRepository
|
|
7
|
+
} from "./db/goals-repository.js";
|
|
8
|
+
import {
|
|
9
|
+
goalsDbSchema,
|
|
10
|
+
goalsSchema,
|
|
11
|
+
lifeGoalDefinitions,
|
|
12
|
+
lifeGoalLinks
|
|
13
|
+
} from "./db/schema.js";
|
|
14
|
+
export * from "./goal-grounding.js";
|
|
15
|
+
import {
|
|
16
|
+
GoalsServiceError,
|
|
17
|
+
goalsErrorMessage
|
|
18
|
+
} from "./goal-normalize.js";
|
|
19
|
+
import {
|
|
20
|
+
evaluateGoalProgressWithLlm
|
|
21
|
+
} from "./goal-semantic-evaluator.js";
|
|
22
|
+
import {
|
|
23
|
+
buildOwnerOwnership,
|
|
24
|
+
createOwnerGoalsService,
|
|
25
|
+
ownerEntityIdFor
|
|
26
|
+
} from "./goals-runtime.js";
|
|
27
|
+
import {
|
|
28
|
+
GoalsService,
|
|
29
|
+
scoreGoalSimilarity
|
|
30
|
+
} from "./goals-service.js";
|
|
31
|
+
import { default as default2, goalsPlugin } from "./plugin.js";
|
|
32
|
+
import {
|
|
33
|
+
GoalsCheckinService,
|
|
34
|
+
getGoalsCheckinService
|
|
35
|
+
} from "./services/checkin.js";
|
|
36
|
+
export * from "./types.js";
|
|
37
|
+
export {
|
|
38
|
+
GoalsCheckinService,
|
|
39
|
+
GoalsRepository,
|
|
40
|
+
GoalsService,
|
|
41
|
+
GoalsServiceError,
|
|
42
|
+
GoalsView,
|
|
43
|
+
buildOwnerOwnership,
|
|
44
|
+
createGoalDefinition,
|
|
45
|
+
createOwnerGoalsService,
|
|
46
|
+
default2 as default,
|
|
47
|
+
evaluateGoalProgressWithLlm,
|
|
48
|
+
getGoalsCheckinService,
|
|
49
|
+
goalsDbSchema,
|
|
50
|
+
goalsErrorMessage,
|
|
51
|
+
goalsPlugin,
|
|
52
|
+
goalsSchema,
|
|
53
|
+
lifeGoalDefinitions,
|
|
54
|
+
lifeGoalLinks,
|
|
55
|
+
ownerEntityIdFor,
|
|
56
|
+
ownerGoalsAction,
|
|
57
|
+
scoreGoalSimilarity
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Side-effect: register the unified goals view for terminal rendering in a\n// Node agent host (DOM-guarded; no-op in browser/mobile).\nimport \"./register.js\";\n\nexport { ownerGoalsAction } from \"./actions/goals.js\";\n// View export — re-exported so host applications can pre-render the view\n// without going through the dynamic bundle loader.\nexport { GoalsView } from \"./components/goals/GoalsView.js\";\nexport {\n createGoalDefinition,\n GoalsRepository,\n} from \"./db/goals-repository.js\";\nexport {\n type GoalDefinitionRow,\n type GoalLinkRow,\n goalsDbSchema,\n goalsSchema,\n lifeGoalDefinitions,\n lifeGoalLinks,\n} from \"./db/schema.js\";\nexport * from \"./goal-grounding.js\";\nexport {\n GoalsServiceError,\n goalsErrorMessage,\n} from \"./goal-normalize.js\";\nexport {\n evaluateGoalProgressWithLlm,\n type GoalSemanticEvaluationResult,\n} from \"./goal-semantic-evaluator.js\";\nexport {\n buildOwnerOwnership,\n createOwnerGoalsService,\n ownerEntityIdFor,\n} from \"./goals-runtime.js\";\nexport {\n type GoalsNormalizeOwnership,\n type GoalsRecordAudit,\n GoalsService,\n type GoalsServiceDependencies,\n scoreGoalSimilarity,\n} from \"./goals-service.js\";\nexport { default, goalsPlugin } from \"./plugin.js\";\nexport {\n GoalsCheckinService,\n getGoalsCheckinService,\n} from \"./services/checkin.js\";\nexport * from \"./types.js\";\n"],"mappings":"AAEA,OAAO;AAEP,SAAS,wBAAwB;AAGjC,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;AACd;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EAGE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,WAAAA,UAAS,mBAAmB;AACrC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,cAAc;","names":["default"]}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @elizaos/plugin-goals — life direction plugin.
|
|
3
|
+
*
|
|
4
|
+
* Decomposed out of @elizaos/plugin-personal-assistant. Owns owner-set long-horizon
|
|
5
|
+
* goals plus the goals/routines/reminders view and schema. Routines,
|
|
6
|
+
* reminders, alarms, and daily check-in handlers still run through
|
|
7
|
+
* @elizaos/plugin-personal-assistant during the migration and are referenced
|
|
8
|
+
* by TODO(migrate) comments in their scaffold files.
|
|
9
|
+
*/
|
|
10
|
+
import type { Plugin } from "@elizaos/core";
|
|
11
|
+
export declare const goalsPlugin: Plugin;
|
|
12
|
+
export default goalsPlugin;
|
|
13
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAS5C,eAAO,MAAM,WAAW,EAAE,MAqCzB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ownerGoalsAction } from "./actions/goals.js";
|
|
2
|
+
import * as dbSchema from "./db/index.js";
|
|
3
|
+
import { GoalsCheckinService } from "./services/checkin.js";
|
|
4
|
+
import { GoalsMigrationService } from "./services/migration.js";
|
|
5
|
+
const GOALS_PLUGIN_NAME = "@elizaos/plugin-goals";
|
|
6
|
+
const goalsPlugin = {
|
|
7
|
+
name: GOALS_PLUGIN_NAME,
|
|
8
|
+
description: "Life direction: owner-set long-horizon goals, goals/routines/reminders schema, and a self-care / mood / journal panel. Routines, reminders, alarms, and daily check-in handlers are still host-adapted by @elizaos/plugin-personal-assistant during migration.",
|
|
9
|
+
dependencies: ["@elizaos/plugin-sql"],
|
|
10
|
+
// Only OWNER_GOALS has been fully migrated into this standalone package.
|
|
11
|
+
// Routines/reminders/alarms remain host-adapted PA actions for now; do not
|
|
12
|
+
// register their scaffold handlers here.
|
|
13
|
+
actions: [ownerGoalsAction],
|
|
14
|
+
services: [GoalsCheckinService, GoalsMigrationService],
|
|
15
|
+
schema: dbSchema,
|
|
16
|
+
views: [
|
|
17
|
+
// ONE declaration → GUI + XR + TUI, all drawn from the single GoalsView
|
|
18
|
+
// spatial source. `modalities` is a plain literal here (plugin.ts is not in
|
|
19
|
+
// the view bundle), so no brand-new `@elizaos/core` runtime export reaches
|
|
20
|
+
// the bundle build.
|
|
21
|
+
{
|
|
22
|
+
id: "goals",
|
|
23
|
+
label: "Goals",
|
|
24
|
+
description: "Life goals, routines, today's reminders and alarms, self-care check-in.",
|
|
25
|
+
icon: "Target",
|
|
26
|
+
path: "/goals",
|
|
27
|
+
modalities: ["gui", "xr", "tui"],
|
|
28
|
+
bundlePath: "dist/views/bundle.js",
|
|
29
|
+
componentExport: "GoalsView",
|
|
30
|
+
tags: ["goals", "routines", "reminders", "self-care", "owner"],
|
|
31
|
+
visibleInManager: true,
|
|
32
|
+
desktopTabEnabled: true
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
async dispose(runtime) {
|
|
36
|
+
const svc = runtime.getService(
|
|
37
|
+
GoalsCheckinService.serviceType
|
|
38
|
+
);
|
|
39
|
+
await svc?.stop();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var plugin_default = goalsPlugin;
|
|
43
|
+
export {
|
|
44
|
+
plugin_default as default,
|
|
45
|
+
goalsPlugin
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["/**\n * @elizaos/plugin-goals — life direction plugin.\n *\n * Decomposed out of @elizaos/plugin-personal-assistant. Owns owner-set long-horizon\n * goals plus the goals/routines/reminders view and schema. Routines,\n * reminders, alarms, and daily check-in handlers still run through\n * @elizaos/plugin-personal-assistant during the migration and are referenced\n * by TODO(migrate) comments in their scaffold files.\n */\n\nimport type { Plugin } from \"@elizaos/core\";\n\nimport { ownerGoalsAction } from \"./actions/goals.js\";\nimport * as dbSchema from \"./db/index.js\";\nimport { GoalsCheckinService } from \"./services/checkin.js\";\nimport { GoalsMigrationService } from \"./services/migration.js\";\n\nconst GOALS_PLUGIN_NAME = \"@elizaos/plugin-goals\";\n\nexport const goalsPlugin: Plugin = {\n name: GOALS_PLUGIN_NAME,\n description:\n \"Life direction: owner-set long-horizon goals, goals/routines/reminders schema, and a self-care / mood / journal panel. Routines, reminders, alarms, and daily check-in handlers are still host-adapted by @elizaos/plugin-personal-assistant during migration.\",\n dependencies: [\"@elizaos/plugin-sql\"],\n // Only OWNER_GOALS has been fully migrated into this standalone package.\n // Routines/reminders/alarms remain host-adapted PA actions for now; do not\n // register their scaffold handlers here.\n actions: [ownerGoalsAction],\n services: [GoalsCheckinService, GoalsMigrationService],\n schema: dbSchema,\n views: [\n // ONE declaration → GUI + XR + TUI, all drawn from the single GoalsView\n // spatial source. `modalities` is a plain literal here (plugin.ts is not in\n // the view bundle), so no brand-new `@elizaos/core` runtime export reaches\n // the bundle build.\n {\n id: \"goals\",\n label: \"Goals\",\n description:\n \"Life goals, routines, today's reminders and alarms, self-care check-in.\",\n icon: \"Target\",\n path: \"/goals\",\n modalities: [\"gui\", \"xr\", \"tui\"],\n bundlePath: \"dist/views/bundle.js\",\n componentExport: \"GoalsView\",\n tags: [\"goals\", \"routines\", \"reminders\", \"self-care\", \"owner\"],\n visibleInManager: true,\n desktopTabEnabled: true,\n },\n ],\n async dispose(runtime) {\n const svc = runtime.getService<GoalsCheckinService>(\n GoalsCheckinService.serviceType,\n );\n await svc?.stop();\n },\n};\n\nexport default goalsPlugin;\n"],"mappings":"AAYA,SAAS,wBAAwB;AACjC,YAAY,cAAc;AAC1B,SAAS,2BAA2B;AACpC,SAAS,6BAA6B;AAEtC,MAAM,oBAAoB;AAEnB,MAAM,cAAsB;AAAA,EACjC,MAAM;AAAA,EACN,aACE;AAAA,EACF,cAAc,CAAC,qBAAqB;AAAA;AAAA;AAAA;AAAA,EAIpC,SAAS,CAAC,gBAAgB;AAAA,EAC1B,UAAU,CAAC,qBAAqB,qBAAqB;AAAA,EACrD,QAAQ;AAAA,EACR,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,aACE;AAAA,MACF,MAAM;AAAA,MACN,MAAM;AAAA,MACN,YAAY,CAAC,OAAO,MAAM,KAAK;AAAA,MAC/B,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,MAAM,CAAC,SAAS,YAAY,aAAa,aAAa,OAAO;AAAA,MAC7D,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,IACrB;AAAA,EACF;AAAA,EACA,MAAM,QAAQ,SAAS;AACrB,UAAM,MAAM,QAAQ;AAAA,MAClB,oBAAoB;AAAA,IACtB;AACA,UAAM,KAAK,KAAK;AAAA,EAClB;AACF;AAEA,IAAO,iBAAQ;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register the goals view for terminal rendering.
|
|
3
|
+
*
|
|
4
|
+
* The agent terminal mounts plugin views by id from the `@elizaos/tui` terminal
|
|
5
|
+
* registry. This makes the goals view render for real in the terminal (the
|
|
6
|
+
* unified {@link GoalsSpatialView}) rather than only navigating a GUI shell. A
|
|
7
|
+
* module-level snapshot lets a host push live goals data; with no host push it
|
|
8
|
+
* defaults to an empty, ready list.
|
|
9
|
+
*/
|
|
10
|
+
import { type GoalsSnapshot } from "./components/goals/GoalsSpatialView.js";
|
|
11
|
+
/** Update the snapshot the registered terminal view renders from. */
|
|
12
|
+
export declare function setGoalsTerminalSnapshot(next: GoalsSnapshot): void;
|
|
13
|
+
/** Register the goals terminal view; returns an unregister function. */
|
|
14
|
+
export declare function registerGoalsTerminalView(): () => void;
|
|
15
|
+
//# sourceMappingURL=register-terminal-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-terminal-view.d.ts","sourceRoot":"","sources":["../src/register-terminal-view.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,yCAAyC,CAAC;AASjD,qEAAqE;AACrE,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAElE;AAED,wEAAwE;AACxE,wBAAgB,yBAAyB,IAAI,MAAM,IAAI,CAItD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { registerSpatialTerminalView } from "@elizaos/ui/spatial/tui";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import {
|
|
4
|
+
GoalsSpatialView
|
|
5
|
+
} from "./components/goals/GoalsSpatialView.js";
|
|
6
|
+
const EMPTY = {
|
|
7
|
+
status: "ready",
|
|
8
|
+
goals: [],
|
|
9
|
+
activeStatuses: []
|
|
10
|
+
};
|
|
11
|
+
let current = EMPTY;
|
|
12
|
+
function setGoalsTerminalSnapshot(next) {
|
|
13
|
+
current = next;
|
|
14
|
+
}
|
|
15
|
+
function registerGoalsTerminalView() {
|
|
16
|
+
return registerSpatialTerminalView(
|
|
17
|
+
"goals",
|
|
18
|
+
() => createElement(GoalsSpatialView, { snapshot: current })
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
registerGoalsTerminalView,
|
|
23
|
+
setGoalsTerminalSnapshot
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=register-terminal-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register-terminal-view.tsx"],"sourcesContent":["/**\n * Register the goals view for terminal rendering.\n *\n * The agent terminal mounts plugin views by id from the `@elizaos/tui` terminal\n * registry. This makes the goals view render for real in the terminal (the\n * unified {@link GoalsSpatialView}) rather than only navigating a GUI shell. A\n * module-level snapshot lets a host push live goals data; with no host push it\n * defaults to an empty, ready list.\n */\n\nimport { registerSpatialTerminalView } from \"@elizaos/ui/spatial/tui\";\nimport { createElement } from \"react\";\nimport {\n type GoalsSnapshot,\n GoalsSpatialView,\n} from \"./components/goals/GoalsSpatialView.js\";\n\nconst EMPTY: GoalsSnapshot = {\n status: \"ready\",\n goals: [],\n activeStatuses: [],\n};\nlet current: GoalsSnapshot = EMPTY;\n\n/** Update the snapshot the registered terminal view renders from. */\nexport function setGoalsTerminalSnapshot(next: GoalsSnapshot): void {\n current = next;\n}\n\n/** Register the goals terminal view; returns an unregister function. */\nexport function registerGoalsTerminalView(): () => void {\n return registerSpatialTerminalView(\"goals\", () =>\n createElement(GoalsSpatialView, { snapshot: current }),\n );\n}\n"],"mappings":"AAUA,SAAS,mCAAmC;AAC5C,SAAS,qBAAqB;AAC9B;AAAA,EAEE;AAAA,OACK;AAEP,MAAM,QAAuB;AAAA,EAC3B,QAAQ;AAAA,EACR,OAAO,CAAC;AAAA,EACR,gBAAgB,CAAC;AACnB;AACA,IAAI,UAAyB;AAGtB,SAAS,yBAAyB,MAA2B;AAClE,YAAU;AACZ;AAGO,SAAS,4BAAwC;AACtD,SAAO;AAAA,IAA4B;AAAA,IAAS,MAC1C,cAAc,kBAAkB,EAAE,UAAU,QAAQ,CAAC;AAAA,EACvD;AACF;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-effect entry point — registers the goals view for terminal rendering.
|
|
3
|
+
*
|
|
4
|
+
* In a terminal host (the Node agent, no DOM) this registers the unified goals
|
|
5
|
+
* view so it renders inline in the terminal. Lazy + DOM-guarded so the terminal
|
|
6
|
+
* engine stays out of browser/mobile bundles. Load this module once during app
|
|
7
|
+
* startup; in a browser/mobile host it is a no-op.
|
|
8
|
+
*/
|
|
9
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/dist/register.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register.ts"],"sourcesContent":["/**\n * Side-effect entry point — registers the goals view for terminal rendering.\n *\n * In a terminal host (the Node agent, no DOM) this registers the unified goals\n * view so it renders inline in the terminal. Lazy + DOM-guarded so the terminal\n * engine stays out of browser/mobile bundles. Load this module once during app\n * startup; in a browser/mobile host it is a no-op.\n */\n\nif (typeof window === \"undefined\") {\n void import(\"./register-terminal-view.js\")\n .then((m) => m.registerGoalsTerminalView())\n .catch(() => {\n // Terminal rendering is best-effort; never block plugin load.\n });\n}\n"],"mappings":"AASA,IAAI,OAAO,WAAW,aAAa;AACjC,OAAK,OAAO,6BAA6B,EACtC,KAAK,CAAC,MAAM,EAAE,0BAA0B,CAAC,EACzC,MAAM,MAAM;AAAA,EAEb,CAAC;AACL;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GoalsCheckinService — daily check-in engine for plugin-goals.
|
|
3
|
+
*
|
|
4
|
+
* STUB. The full implementation will be migrated from:
|
|
5
|
+
* plugins/plugin-personal-assistant/src/lifeops/checkin/checkin-service.ts
|
|
6
|
+
* plugins/plugin-personal-assistant/src/lifeops/checkin/schedule-resolver.ts
|
|
7
|
+
* plugins/plugin-personal-assistant/src/lifeops/checkin/types.ts
|
|
8
|
+
*
|
|
9
|
+
* For the scaffold phase the service exists as a registered Service so the
|
|
10
|
+
* plugin manifest is self-contained. Once foundations (core scheduler,
|
|
11
|
+
* owner-state, registries) land, the PA CheckinService body — collectors,
|
|
12
|
+
* acknowledgement window, escalation ladder, briefing assembly — moves into
|
|
13
|
+
* this file.
|
|
14
|
+
*/
|
|
15
|
+
import { type IAgentRuntime, Service } from "@elizaos/core";
|
|
16
|
+
export declare class GoalsCheckinService extends Service {
|
|
17
|
+
static readonly serviceType: "goals_checkin";
|
|
18
|
+
capabilityDescription: string;
|
|
19
|
+
static start(runtime: IAgentRuntime): Promise<GoalsCheckinService>;
|
|
20
|
+
stop(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare function getGoalsCheckinService(runtime: IAgentRuntime): GoalsCheckinService | null;
|
|
23
|
+
//# sourceMappingURL=checkin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkin.d.ts","sourceRoot":"","sources":["../../src/services/checkin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAU,OAAO,EAAE,MAAM,eAAe,CAAC;AAIpE,qBAAa,mBAAoB,SAAQ,OAAO;IAC9C,gBAAyB,WAAW,kBAA8B;IAEzD,qBAAqB,SACkF;WAE1F,KAAK,CACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,mBAAmB,CAAC;IAKhB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAUrC;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,aAAa,GACrB,mBAAmB,GAAG,IAAI,CAK5B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { logger, Service } from "@elizaos/core";
|
|
2
|
+
import { GOALS_CHECKIN_SERVICE_TYPE, GOALS_LOG_PREFIX } from "../types.js";
|
|
3
|
+
class GoalsCheckinService extends Service {
|
|
4
|
+
static serviceType = GOALS_CHECKIN_SERVICE_TYPE;
|
|
5
|
+
capabilityDescription = "Daily check-in engine: morning/night reports, mood/journal capture, acknowledgement-driven tone escalation.";
|
|
6
|
+
static async start(runtime) {
|
|
7
|
+
logger.info(`${GOALS_LOG_PREFIX} starting GoalsCheckinService`);
|
|
8
|
+
return new GoalsCheckinService(runtime);
|
|
9
|
+
}
|
|
10
|
+
async stop() {
|
|
11
|
+
logger.info(`${GOALS_LOG_PREFIX} stopping GoalsCheckinService`);
|
|
12
|
+
}
|
|
13
|
+
// TODO(migrate from plugin-personal-assistant/src/lifeops/checkin/checkin-service.ts):
|
|
14
|
+
// - runCheckin(request: RunCheckinRequest): Promise<CheckinReport>
|
|
15
|
+
// - recordAcknowledgement(request: RecordAcknowledgementRequest): Promise<void>
|
|
16
|
+
// - briefing assembly: getCheckinBriefing(kind, scope) -> sections
|
|
17
|
+
// - escalation ladder + acknowledgement window
|
|
18
|
+
// - collectors for habits / overdue todos / recent wins / sleep recap
|
|
19
|
+
}
|
|
20
|
+
function getGoalsCheckinService(runtime) {
|
|
21
|
+
return runtime.getService(GoalsCheckinService.serviceType) ?? null;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
GoalsCheckinService,
|
|
25
|
+
getGoalsCheckinService
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=checkin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/checkin.ts"],"sourcesContent":["/**\n * GoalsCheckinService — daily check-in engine for plugin-goals.\n *\n * STUB. The full implementation will be migrated from:\n * plugins/plugin-personal-assistant/src/lifeops/checkin/checkin-service.ts\n * plugins/plugin-personal-assistant/src/lifeops/checkin/schedule-resolver.ts\n * plugins/plugin-personal-assistant/src/lifeops/checkin/types.ts\n *\n * For the scaffold phase the service exists as a registered Service so the\n * plugin manifest is self-contained. Once foundations (core scheduler,\n * owner-state, registries) land, the PA CheckinService body — collectors,\n * acknowledgement window, escalation ladder, briefing assembly — moves into\n * this file.\n */\n\nimport { type IAgentRuntime, logger, Service } from \"@elizaos/core\";\n\nimport { GOALS_CHECKIN_SERVICE_TYPE, GOALS_LOG_PREFIX } from \"../types.js\";\n\nexport class GoalsCheckinService extends Service {\n static override readonly serviceType = GOALS_CHECKIN_SERVICE_TYPE;\n\n override capabilityDescription =\n \"Daily check-in engine: morning/night reports, mood/journal capture, acknowledgement-driven tone escalation.\";\n\n static override async start(\n runtime: IAgentRuntime,\n ): Promise<GoalsCheckinService> {\n logger.info(`${GOALS_LOG_PREFIX} starting GoalsCheckinService`);\n return new GoalsCheckinService(runtime);\n }\n\n override async stop(): Promise<void> {\n logger.info(`${GOALS_LOG_PREFIX} stopping GoalsCheckinService`);\n }\n\n // TODO(migrate from plugin-personal-assistant/src/lifeops/checkin/checkin-service.ts):\n // - runCheckin(request: RunCheckinRequest): Promise<CheckinReport>\n // - recordAcknowledgement(request: RecordAcknowledgementRequest): Promise<void>\n // - briefing assembly: getCheckinBriefing(kind, scope) -> sections\n // - escalation ladder + acknowledgement window\n // - collectors for habits / overdue todos / recent wins / sleep recap\n}\n\nexport function getGoalsCheckinService(\n runtime: IAgentRuntime,\n): GoalsCheckinService | null {\n return (\n runtime.getService<GoalsCheckinService>(GoalsCheckinService.serviceType) ??\n null\n );\n}\n"],"mappings":"AAeA,SAA6B,QAAQ,eAAe;AAEpD,SAAS,4BAA4B,wBAAwB;AAEtD,MAAM,4BAA4B,QAAQ;AAAA,EAC/C,OAAyB,cAAc;AAAA,EAE9B,wBACP;AAAA,EAEF,aAAsB,MACpB,SAC8B;AAC9B,WAAO,KAAK,GAAG,gBAAgB,+BAA+B;AAC9D,WAAO,IAAI,oBAAoB,OAAO;AAAA,EACxC;AAAA,EAEA,MAAe,OAAsB;AACnC,WAAO,KAAK,GAAG,gBAAgB,+BAA+B;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQF;AAEO,SAAS,uBACd,SAC4B;AAC5B,SACE,QAAQ,WAAgC,oBAAoB,WAAW,KACvE;AAEJ;","names":[]}
|