@fractaal/pi-goal-x 0.20.1 → 0.28.2
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/README.md +42 -290
- package/dist/goal-auditor.d.ts +7 -61
- package/dist/goal-auditor.js +98 -300
- package/dist/goal-auditor.js.map +1 -1
- package/dist/goal-contract.d.ts +205 -0
- package/dist/goal-contract.js +135 -0
- package/dist/goal-contract.js.map +1 -0
- package/dist/goal-transcript-events.d.ts +54 -0
- package/dist/goal-transcript-events.js +177 -0
- package/dist/goal-transcript-events.js.map +1 -0
- package/dist/goal-widget.d.ts +13 -0
- package/dist/goal-widget.js +45 -0
- package/dist/goal-widget.js.map +1 -0
- package/dist/goal.d.ts +8 -49
- package/dist/goal.js +519 -3643
- package/dist/goal.js.map +1 -1
- package/dist/legacy-migration.d.ts +61 -0
- package/dist/legacy-migration.js +306 -0
- package/dist/legacy-migration.js.map +1 -0
- package/docs/architecture.md +14 -232
- package/extensions/goal-auditor.ts +108 -363
- package/extensions/goal-contract.ts +149 -0
- package/extensions/goal-transcript-events.ts +194 -0
- package/extensions/goal-widget.ts +50 -0
- package/extensions/goal.ts +557 -3927
- package/extensions/legacy-migration.ts +340 -0
- package/package.json +46 -19
- package/dist/goal-compaction.d.ts +0 -10
- package/dist/goal-compaction.js +0 -104
- package/dist/goal-compaction.js.map +0 -1
- package/dist/goal-core.d.ts +0 -19
- package/dist/goal-core.js +0 -66
- package/dist/goal-core.js.map +0 -1
- package/dist/goal-draft.d.ts +0 -71
- package/dist/goal-draft.js +0 -201
- package/dist/goal-draft.js.map +0 -1
- package/dist/goal-ledger.d.ts +0 -139
- package/dist/goal-ledger.js +0 -306
- package/dist/goal-ledger.js.map +0 -1
- package/dist/goal-policy.d.ts +0 -127
- package/dist/goal-policy.js +0 -359
- package/dist/goal-policy.js.map +0 -1
- package/dist/goal-pool.d.ts +0 -17
- package/dist/goal-pool.js +0 -85
- package/dist/goal-pool.js.map +0 -1
- package/dist/goal-questionnaire.d.ts +0 -56
- package/dist/goal-questionnaire.js +0 -733
- package/dist/goal-questionnaire.js.map +0 -1
- package/dist/goal-record.d.ts +0 -94
- package/dist/goal-record.js +0 -155
- package/dist/goal-record.js.map +0 -1
- package/dist/goal-settings.d.ts +0 -56
- package/dist/goal-settings.js +0 -184
- package/dist/goal-settings.js.map +0 -1
- package/dist/goal-tool-names.d.ts +0 -20
- package/dist/goal-tool-names.js +0 -69
- package/dist/goal-tool-names.js.map +0 -1
- package/dist/prompts/goal-prompts.d.ts +0 -17
- package/dist/prompts/goal-prompts.js +0 -304
- package/dist/prompts/goal-prompts.js.map +0 -1
- package/dist/storage/goal-files.d.ts +0 -40
- package/dist/storage/goal-files.js +0 -320
- package/dist/storage/goal-files.js.map +0 -1
- package/dist/widgets/goal-escape-dialog.d.ts +0 -15
- package/dist/widgets/goal-escape-dialog.js +0 -118
- package/dist/widgets/goal-escape-dialog.js.map +0 -1
- package/dist/widgets/goal-notifications.d.ts +0 -5
- package/dist/widgets/goal-notifications.js +0 -9
- package/dist/widgets/goal-notifications.js.map +0 -1
- package/dist/widgets/goal-widget.d.ts +0 -58
- package/dist/widgets/goal-widget.js +0 -282
- package/dist/widgets/goal-widget.js.map +0 -1
- package/dist/widgets/task-list-overlay.d.ts +0 -8
- package/dist/widgets/task-list-overlay.js +0 -321
- package/dist/widgets/task-list-overlay.js.map +0 -1
- package/docs/agent-flow-design.md +0 -432
- package/docs/agentic-runtime-prd.md +0 -764
- package/docs/goal-ts-refactor-test-strategy.md +0 -82
- package/docs/pi-autoresearch-survey.md +0 -45
- package/extensions/goal-compaction.ts +0 -133
- package/extensions/goal-core.ts +0 -77
- package/extensions/goal-draft.ts +0 -263
- package/extensions/goal-ledger.ts +0 -354
- package/extensions/goal-policy.ts +0 -389
- package/extensions/goal-pool.ts +0 -98
- package/extensions/goal-questionnaire.ts +0 -779
- package/extensions/goal-record.ts +0 -256
- package/extensions/goal-settings.ts +0 -181
- package/extensions/goal-tool-names.ts +0 -76
- package/extensions/prompts/goal-prompts.ts +0 -308
- package/extensions/storage/goal-files.ts +0 -352
- package/extensions/widgets/goal-escape-dialog.ts +0 -146
- package/extensions/widgets/goal-notifications.ts +0 -9
- package/extensions/widgets/goal-widget.ts +0 -378
- package/extensions/widgets/task-list-overlay.ts +0 -389
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { GOAL_SCHEMA_VERSION, GOAL_STATE_ENTRY, isGoalState, } from "./goal-contract.js";
|
|
4
|
+
export const LEGACY_MIGRATION_ENTRY = "pi-goal-todo-migration-v1";
|
|
5
|
+
export const LEGACY_MIGRATION_EVENT = "pi-goal-todo:migrated";
|
|
6
|
+
export const TODO_STATE_ENTRY = "pi-todo-state-v1";
|
|
7
|
+
// The migration package remains installable without Todo, so its one-time
|
|
8
|
+
// adapter mirrors the exported Todo producer bounds and is covered by parity tests.
|
|
9
|
+
const TODO_MAX_TASKS = 200;
|
|
10
|
+
const TODO_TASK_KEY_MAX_LENGTH = 256;
|
|
11
|
+
const TODO_TASK_SUBJECT_MAX_LENGTH = 2_048;
|
|
12
|
+
const TODO_TASK_DESCRIPTION_MAX_LENGTH = 16_384;
|
|
13
|
+
const TODO_TASK_MAX_DEPENDENCIES = 100;
|
|
14
|
+
const TODO_PLAN_MAX_BYTES = 16 * 1024;
|
|
15
|
+
const utf8Encoder = new TextEncoder();
|
|
16
|
+
function record(value) {
|
|
17
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
18
|
+
? value
|
|
19
|
+
: null;
|
|
20
|
+
}
|
|
21
|
+
function text(value) {
|
|
22
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
23
|
+
}
|
|
24
|
+
function legacyTask(value) {
|
|
25
|
+
const raw = record(value);
|
|
26
|
+
const id = text(raw?.id);
|
|
27
|
+
const title = text(raw?.title);
|
|
28
|
+
if (!raw || !id || !title)
|
|
29
|
+
return null;
|
|
30
|
+
const subtasks = Array.isArray(raw.subtasks)
|
|
31
|
+
? raw.subtasks.map(legacyTask).filter((task) => task !== null)
|
|
32
|
+
: undefined;
|
|
33
|
+
return {
|
|
34
|
+
id,
|
|
35
|
+
title,
|
|
36
|
+
status: raw.status === "complete" ? "complete" : raw.status === "skipped" ? "skipped" : "pending",
|
|
37
|
+
...(text(raw.verificationContract) ? { verificationContract: text(raw.verificationContract) } : {}),
|
|
38
|
+
...(subtasks?.length ? { subtasks } : {}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function candidate(value, source) {
|
|
42
|
+
const raw = record(value);
|
|
43
|
+
const id = text(raw?.id);
|
|
44
|
+
const objective = text(raw?.objective);
|
|
45
|
+
if (!raw || !id || !objective)
|
|
46
|
+
return null;
|
|
47
|
+
const taskList = record(raw.taskList);
|
|
48
|
+
const tasks = Array.isArray(taskList?.tasks)
|
|
49
|
+
? taskList.tasks.map(legacyTask).filter((task) => task !== null)
|
|
50
|
+
: [];
|
|
51
|
+
return {
|
|
52
|
+
id,
|
|
53
|
+
objective,
|
|
54
|
+
status: raw.status === "complete" ? "complete" : raw.status === "paused" || raw.status === "blocked" || raw.status === "budget_limited" ? "paused" : "active",
|
|
55
|
+
autoContinue: raw.autoContinue !== false,
|
|
56
|
+
createdAt: text(raw.createdAt) ?? new Date().toISOString(),
|
|
57
|
+
updatedAt: text(raw.updatedAt) ?? text(raw.createdAt) ?? new Date().toISOString(),
|
|
58
|
+
...(text(raw.pauseReason) ? { pauseReason: text(raw.pauseReason) } : {}),
|
|
59
|
+
...(text(raw.pauseSuggestedAction) ? { pauseSuggestedAction: text(raw.pauseSuggestedAction) } : {}),
|
|
60
|
+
tasks,
|
|
61
|
+
source,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function jsonObjectEnd(content) {
|
|
65
|
+
let depth = 0;
|
|
66
|
+
let quoted = false;
|
|
67
|
+
let escaped = false;
|
|
68
|
+
for (let index = 0; index < content.length; index += 1) {
|
|
69
|
+
const character = content[index];
|
|
70
|
+
if (quoted) {
|
|
71
|
+
if (escaped)
|
|
72
|
+
escaped = false;
|
|
73
|
+
else if (character === "\\")
|
|
74
|
+
escaped = true;
|
|
75
|
+
else if (character === "\"")
|
|
76
|
+
quoted = false;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (character === "\"")
|
|
80
|
+
quoted = true;
|
|
81
|
+
else if (character === "{")
|
|
82
|
+
depth += 1;
|
|
83
|
+
else if (character === "}" && --depth === 0)
|
|
84
|
+
return index;
|
|
85
|
+
}
|
|
86
|
+
return -1;
|
|
87
|
+
}
|
|
88
|
+
function readLegacyGoalFile(file) {
|
|
89
|
+
try {
|
|
90
|
+
if (fs.lstatSync(file).isSymbolicLink())
|
|
91
|
+
return null;
|
|
92
|
+
const content = fs.readFileSync(file, "utf8");
|
|
93
|
+
const end = jsonObjectEnd(content);
|
|
94
|
+
if (end < 0)
|
|
95
|
+
return null;
|
|
96
|
+
return candidate(JSON.parse(content.slice(0, end + 1)), "file");
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function readLegacyGoalDirectories(ctx) {
|
|
103
|
+
const sessionId = ctx.sessionManager.getSessionId();
|
|
104
|
+
const directories = [
|
|
105
|
+
path.join(ctx.cwd, ".pi", "goals", "sessions", sessionId),
|
|
106
|
+
path.join(ctx.cwd, ".pi", "goals"),
|
|
107
|
+
];
|
|
108
|
+
const candidates = [];
|
|
109
|
+
for (const directory of directories) {
|
|
110
|
+
try {
|
|
111
|
+
if (fs.lstatSync(directory).isSymbolicLink())
|
|
112
|
+
continue;
|
|
113
|
+
for (const name of fs.readdirSync(directory).sort()) {
|
|
114
|
+
if (!/^active_goal_.*\.md$/.test(name))
|
|
115
|
+
continue;
|
|
116
|
+
const parsed = readLegacyGoalFile(path.join(directory, name));
|
|
117
|
+
if (parsed && parsed.status !== "complete")
|
|
118
|
+
candidates.push(parsed);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// Missing legacy directories are normal.
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return candidates;
|
|
126
|
+
}
|
|
127
|
+
export function findLegacyGoalCandidates(ctx) {
|
|
128
|
+
const branch = ctx.sessionManager.getBranch();
|
|
129
|
+
let focusedId = null;
|
|
130
|
+
let sessionCandidate = null;
|
|
131
|
+
let sawFocusEntry = false;
|
|
132
|
+
let sawStateEntry = false;
|
|
133
|
+
for (let index = branch.length - 1; index >= 0; index -= 1) {
|
|
134
|
+
const entry = branch[index];
|
|
135
|
+
if (entry.type !== "custom")
|
|
136
|
+
continue;
|
|
137
|
+
if (!sawFocusEntry && entry.customType === "pi-goal-focus") {
|
|
138
|
+
sawFocusEntry = true;
|
|
139
|
+
focusedId = text(record(entry.data)?.focusedGoalId) ?? null;
|
|
140
|
+
}
|
|
141
|
+
if (!sawStateEntry && entry.customType === "pi-goal-state") {
|
|
142
|
+
sawStateEntry = true;
|
|
143
|
+
sessionCandidate = candidate(record(entry.data)?.goal, "session");
|
|
144
|
+
if (sessionCandidate?.status === "complete")
|
|
145
|
+
sessionCandidate = null;
|
|
146
|
+
}
|
|
147
|
+
if (sawFocusEntry && sawStateEntry)
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
if (!sawFocusEntry && sessionCandidate)
|
|
151
|
+
focusedId = sessionCandidate.id;
|
|
152
|
+
const byId = new Map();
|
|
153
|
+
for (const item of readLegacyGoalDirectories(ctx))
|
|
154
|
+
byId.set(item.id, item);
|
|
155
|
+
if (sessionCandidate)
|
|
156
|
+
byId.set(sessionCandidate.id, sessionCandidate);
|
|
157
|
+
return { focusedId, candidates: [...byId.values()] };
|
|
158
|
+
}
|
|
159
|
+
function uniqueKey(raw, used) {
|
|
160
|
+
const base = raw.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "task";
|
|
161
|
+
let key = base;
|
|
162
|
+
let suffix = 2;
|
|
163
|
+
while (used.has(key))
|
|
164
|
+
key = `${base}-${suffix++}`;
|
|
165
|
+
used.add(key);
|
|
166
|
+
return key;
|
|
167
|
+
}
|
|
168
|
+
function validLegacyTodoState(state) {
|
|
169
|
+
return state.tasks.length <= TODO_MAX_TASKS
|
|
170
|
+
&& state.tasks.every((task) => task.key.trim().length > 0 && task.key.length <= TODO_TASK_KEY_MAX_LENGTH
|
|
171
|
+
&& task.subject.trim().length > 0 && task.subject.length <= TODO_TASK_SUBJECT_MAX_LENGTH
|
|
172
|
+
&& (task.description === undefined || (task.description.trim().length > 0 && task.description.length <= TODO_TASK_DESCRIPTION_MAX_LENGTH))
|
|
173
|
+
&& (task.status === "pending" || task.status === "completed")
|
|
174
|
+
&& (task.dependsOn === undefined || (task.dependsOn.length <= TODO_TASK_MAX_DEPENDENCIES
|
|
175
|
+
&& task.dependsOn.every((dependency) => dependency.trim().length > 0 && dependency.length <= TODO_TASK_KEY_MAX_LENGTH))))
|
|
176
|
+
&& utf8Encoder.encode(JSON.stringify(state)).byteLength <= TODO_PLAN_MAX_BYTES;
|
|
177
|
+
}
|
|
178
|
+
export function migrateLegacyTasks(tasks) {
|
|
179
|
+
const migrated = [];
|
|
180
|
+
const used = new Set();
|
|
181
|
+
function addSiblings(items, parentPath) {
|
|
182
|
+
let previous = null;
|
|
183
|
+
for (const item of items) {
|
|
184
|
+
if (item.status === "skipped")
|
|
185
|
+
continue;
|
|
186
|
+
const key = uniqueKey(item.id, used);
|
|
187
|
+
const status = item.status === "complete" ? "completed" : "pending";
|
|
188
|
+
const safeDependency = previous && (status === "pending" || previous.status === "completed") ? [previous.key] : undefined;
|
|
189
|
+
const descriptionParts = [
|
|
190
|
+
parentPath.length ? `Legacy path: ${[...parentPath, item.title].join(" > ")}.` : undefined,
|
|
191
|
+
item.verificationContract ? `Verification guidance: ${item.verificationContract}` : undefined,
|
|
192
|
+
].filter((part) => !!part);
|
|
193
|
+
const migratedTask = {
|
|
194
|
+
key,
|
|
195
|
+
subject: item.title,
|
|
196
|
+
status,
|
|
197
|
+
...(descriptionParts.length ? { description: descriptionParts.join(" ") } : {}),
|
|
198
|
+
...(safeDependency ? { dependsOn: safeDependency } : {}),
|
|
199
|
+
};
|
|
200
|
+
migrated.push(migratedTask);
|
|
201
|
+
previous = migratedTask;
|
|
202
|
+
if (item.subtasks?.length)
|
|
203
|
+
addSiblings(item.subtasks, [...parentPath, item.title]);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
addSiblings(tasks, []);
|
|
207
|
+
if (migrated.length === 0)
|
|
208
|
+
return null;
|
|
209
|
+
const state = { schemaVersion: 1, revision: 1, tasks: migrated };
|
|
210
|
+
if (utf8Encoder.encode(JSON.stringify(state)).byteLength > TODO_PLAN_MAX_BYTES) {
|
|
211
|
+
throw new Error(`Migrated Todo plan exceeds the ${TODO_PLAN_MAX_BYTES}-byte serialized UTF-8 byte budget; migration refused without writing new state.`);
|
|
212
|
+
}
|
|
213
|
+
if (!validLegacyTodoState(state)) {
|
|
214
|
+
throw new Error("Migrated Todo plan exceeds the exported producer state bounds; migration refused without writing new state.");
|
|
215
|
+
}
|
|
216
|
+
return state;
|
|
217
|
+
}
|
|
218
|
+
function branchHasGoalState(ctx) {
|
|
219
|
+
return ctx.sessionManager.getBranch().some((item) => {
|
|
220
|
+
const entry = item;
|
|
221
|
+
const data = record(entry.data);
|
|
222
|
+
return entry.type === "custom"
|
|
223
|
+
&& entry.customType === GOAL_STATE_ENTRY
|
|
224
|
+
&& data?.schemaVersion === GOAL_SCHEMA_VERSION
|
|
225
|
+
&& typeof data.revision === "number"
|
|
226
|
+
&& Object.hasOwn(data, "goal");
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function branchHasTodoState(ctx) {
|
|
230
|
+
return ctx.sessionManager.getBranch().some((item) => {
|
|
231
|
+
const entry = item;
|
|
232
|
+
const data = record(entry.data);
|
|
233
|
+
return entry.type === "custom"
|
|
234
|
+
&& entry.customType === TODO_STATE_ENTRY
|
|
235
|
+
&& data?.schemaVersion === 1
|
|
236
|
+
&& Array.isArray(data.tasks);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
export function planLegacyMigration(ctx, selectedGoalId) {
|
|
240
|
+
if (branchHasGoalState(ctx))
|
|
241
|
+
return { kind: "none" };
|
|
242
|
+
const { focusedId, candidates } = findLegacyGoalCandidates(ctx);
|
|
243
|
+
if (candidates.length === 0)
|
|
244
|
+
return { kind: "none" };
|
|
245
|
+
let selected = selectedGoalId ? candidates.find((item) => item.id === selectedGoalId) : undefined;
|
|
246
|
+
if (!selected && !selectedGoalId && focusedId)
|
|
247
|
+
selected = candidates.find((item) => item.id === focusedId);
|
|
248
|
+
if (!selected && !selectedGoalId && candidates.length === 1)
|
|
249
|
+
selected = candidates[0];
|
|
250
|
+
if (!selected)
|
|
251
|
+
return { kind: "ambiguous", candidates };
|
|
252
|
+
const migratePaused = selected.status === "paused" || !selected.autoContinue;
|
|
253
|
+
const common = {
|
|
254
|
+
id: selected.id,
|
|
255
|
+
objective: selected.objective,
|
|
256
|
+
usage: { tokensUsed: 0, activeSeconds: 0 },
|
|
257
|
+
createdAt: selected.createdAt,
|
|
258
|
+
updatedAt: selected.updatedAt,
|
|
259
|
+
};
|
|
260
|
+
const goal = migratePaused
|
|
261
|
+
? {
|
|
262
|
+
...common,
|
|
263
|
+
status: "paused",
|
|
264
|
+
autoContinue: false,
|
|
265
|
+
pause: {
|
|
266
|
+
reason: selected.status === "paused"
|
|
267
|
+
? selected.pauseReason ?? "Paused in the legacy Goal runtime."
|
|
268
|
+
: "Legacy autonomous continuation was disabled; migrated paused to avoid surprising work.",
|
|
269
|
+
...(selected.pauseSuggestedAction ? { suggestedAction: selected.pauseSuggestedAction } : {}),
|
|
270
|
+
},
|
|
271
|
+
}
|
|
272
|
+
: { ...common, status: "active", autoContinue: true };
|
|
273
|
+
const goalState = { schemaVersion: GOAL_SCHEMA_VERSION, revision: 1, goal };
|
|
274
|
+
if (!isGoalState(goalState)) {
|
|
275
|
+
throw new Error("Migrated Goal exceeds the exported producer state bounds; migration refused without writing new state.");
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
kind: "migrate",
|
|
279
|
+
candidate: selected,
|
|
280
|
+
goal: goalState,
|
|
281
|
+
todo: branchHasTodoState(ctx) ? null : migrateLegacyTasks(selected.tasks),
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
export function writeLegacyMigration(pi, plan) {
|
|
285
|
+
if (!isGoalState(plan.goal)) {
|
|
286
|
+
throw new Error("Migrated Goal exceeds the exported producer state bounds; migration refused without writing new state.");
|
|
287
|
+
}
|
|
288
|
+
if (plan.todo && utf8Encoder.encode(JSON.stringify(plan.todo)).byteLength > TODO_PLAN_MAX_BYTES) {
|
|
289
|
+
throw new Error(`Migrated Todo plan exceeds the ${TODO_PLAN_MAX_BYTES}-byte serialized UTF-8 byte budget; migration refused without writing new state.`);
|
|
290
|
+
}
|
|
291
|
+
if (plan.todo && !validLegacyTodoState(plan.todo)) {
|
|
292
|
+
throw new Error("Migrated Todo plan exceeds the exported producer state bounds; migration refused without writing new state.");
|
|
293
|
+
}
|
|
294
|
+
pi.appendEntry(GOAL_STATE_ENTRY, plan.goal);
|
|
295
|
+
if (plan.todo)
|
|
296
|
+
pi.appendEntry(TODO_STATE_ENTRY, plan.todo);
|
|
297
|
+
pi.appendEntry(LEGACY_MIGRATION_ENTRY, {
|
|
298
|
+
schemaVersion: 1,
|
|
299
|
+
status: "complete",
|
|
300
|
+
selectedLegacyGoalId: plan.candidate.id,
|
|
301
|
+
migratedAt: new Date().toISOString(),
|
|
302
|
+
sourcePreserved: true,
|
|
303
|
+
});
|
|
304
|
+
pi.events.emit(LEGACY_MIGRATION_EVENT, { goal: plan.goal, todo: plan.todo });
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=legacy-migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legac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C,mBAAmB,kFAAkF,CAAC,CAAC;IAC1J,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,6GAA6G,CAAC,CAAC;IAChI,CAAC;IACD,EAAE,CAAC,WAAW,CAAC,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,IAAI,CAAC,IAAI;QAAE,EAAE,CAAC,WAAW,CAAC,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,EAAE,CAAC,WAAW,CAAC,sBAAsB,EAAE;QACtC,aAAa,EAAE,CAAC;QAChB,MAAM,EAAE,UAAU;QAClB,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE;QACvC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,eAAe,EAAE,IAAI;KACrB,CAAC,CAAC;IACH,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
package/docs/architecture.md
CHANGED
|
@@ -1,240 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Architecture
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Runtime shape
|
|
6
|
-
|
|
7
|
-
`extensions/goal.ts` is the orchestration layer. It owns pi integration points:
|
|
8
|
-
|
|
9
|
-
- slash commands;
|
|
10
|
-
- tool registration;
|
|
11
|
-
- session events;
|
|
12
|
-
- auto-continue timers;
|
|
13
|
-
- usage accounting;
|
|
14
|
-
- coordination with extracted prompt, storage, policy, questionnaire, goal-pool, and widget modules.
|
|
15
|
-
|
|
16
|
-
The runtime is a focused-goal view over the current session's goal pool:
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
let goalsById: Map<string, GoalRecord>;
|
|
20
|
-
let focusedGoalId: string | null;
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
`goalsById` is reconstructed from `.pi/goals/sessions/<session-id>/active_goal_*.md` plus compatible legacy session entries. Legacy cwd-scoped `.pi/goals/active_goal_*.md` files remain readable and are migrated into the session namespace when an old session resumes. `focusedGoalId` is reconstructed from branch-local `pi-goal-focus` session entries. The focused id is not serialized into goal markdown.
|
|
24
|
-
|
|
25
|
-
Reusable logic is split into smaller modules:
|
|
26
|
-
|
|
27
|
-
| Module | Responsibility |
|
|
28
|
-
|---|---|
|
|
29
|
-
| `goal-record.ts` | Goal record types, creation, cloning, usage normalization, persisted-record migration |
|
|
30
|
-
| `goal-pool.ts` | Open-goal pool helpers, focus resolution, list output, selector labels, unfocused summaries |
|
|
31
|
-
| `goal-core.ts` | Compact display formatting, status labels, objective title cleanup |
|
|
32
|
-
| `goal-draft.ts` | Lightweight confirmation prompt, plain-text draft confirmation report, proposal validation, drafting-stage tool gate |
|
|
33
|
-
| `goal-policy.ts` | Lifecycle policy, abort/pause/resume/complete validation, compaction policy, full result reports |
|
|
34
|
-
| `goal-auditor.ts` | Independent pi auditor agent prompt/config/decision parsing and completion audit execution |
|
|
35
|
-
| `goal-questionnaire.ts` | Built-in questionnaire types, normalization, answer formatting, TUI question runner, proposal confirmation dialog, question-tool registration |
|
|
36
|
-
| `goal-tool-names.ts` | Published tool-name constants, active-tool lists, post-stop allowlist, goal work-tool list, question-like tool detection |
|
|
37
|
-
| `prompts/goal-prompts.ts` | Active-goal, continuation, tweak-drafting, and stale-checkpoint prompt builders |
|
|
38
|
-
| `storage/goal-files.ts` | Goal path safety, serialization/parsing, active-file scanning, active-file writes, archive writes, prompt-body merge from disk |
|
|
39
|
-
| `widgets/goal-widget.ts` | Above-editor Goal Beacon component, blocker/status rendering, `+N open` and unfocused rendering |
|
|
40
|
-
| `widgets/goal-notifications.ts` | Widget-style notification text for goal lifecycle toasts |
|
|
41
|
-
|
|
42
|
-
## Lifecycle
|
|
43
|
-
|
|
44
|
-
```text
|
|
45
|
-
/user command
|
|
46
|
-
├─ /goals or /sisyphus
|
|
47
|
-
│ └─ confirmationIntent = {focus, originalTopic, startedAt}
|
|
48
|
-
│ ├─ agent clarifies, researches, or grills only when needed
|
|
49
|
-
│ ├─ targeted reconnaissance is prompt-guided, not hard-blocked
|
|
50
|
-
│ └─ propose_goal_draft validates focus/objective and asks user to confirm
|
|
51
|
-
│ ├─ Continue Chatting: keep clarifying without creating a goal
|
|
52
|
-
│ └─ Confirm: create active goal, write session-scoped .pi/goals file, focus it, print full objective
|
|
53
|
-
│
|
|
54
|
-
├─ /goals-set or /sisyphus-set
|
|
55
|
-
│ └─ direct user command creates active goal, writes session-scoped .pi/goals file, focuses it, and starts execution
|
|
56
|
-
│
|
|
57
|
-
├─ focused active goal
|
|
58
|
-
│ ├─ autoContinue queues checkpoint turns
|
|
59
|
-
│ ├─ pause_goal pauses on real blockers
|
|
60
|
-
│ ├─ abort_goal aborts/archives obsolete or impossible goals
|
|
61
|
-
│ └─ update_goal starts independent auditor; <approved/> archives and prints full completion report
|
|
62
|
-
│
|
|
63
|
-
├─ paused goal
|
|
64
|
-
│ ├─ /goal-resume restarts autoContinue
|
|
65
|
-
│ ├─ update_goal can complete from existing evidence
|
|
66
|
-
│ └─ abort_goal can archive without resuming
|
|
67
|
-
│
|
|
68
|
-
├─ multiple open goals
|
|
69
|
-
│ ├─ /goal-list shows this session's goal pool
|
|
70
|
-
│ ├─ /goal-focus chooses the session focus
|
|
71
|
-
│ └─ unfocused sessions guide the user to choose instead of letting the agent decide
|
|
72
|
-
│
|
|
73
|
-
└─ /goal-clear or /goal-abort archives the focused goal or cancels drafting
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Goal pool and session focus
|
|
77
|
-
|
|
78
|
-
The disk layout supports multiple active files per Pi session. The extension treats the current session directory as the durable open goal pool:
|
|
3
|
+
Goal and Todo are separate Pi-native producers. Each owns one full, versioned snapshot persisted as Pi session custom entries and replays that snapshot from the active session branch.
|
|
79
4
|
|
|
80
5
|
```text
|
|
81
|
-
|
|
6
|
+
@fractaal/pi-goal-x @fractaal/pi-todo
|
|
7
|
+
pi-goal:state pi-todo:state
|
|
8
|
+
pi-goal:proposal revisioned full plan
|
|
9
|
+
pi-goal:transcript-event
|
|
10
|
+
\ /
|
|
11
|
+
Pi event bus
|
|
12
|
+
|
|
|
13
|
+
optional adapters
|
|
82
14
|
```
|
|
83
15
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Session focus is separate. Focus changes append a custom session entry:
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
{
|
|
90
|
-
version: 1,
|
|
91
|
-
focusedGoalId: string | null,
|
|
92
|
-
reason: "created" | "selected" | "resumed" | "completed" | "cleared" | "aborted" | "migrated"
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Because this is stored with `pi.appendEntry("pi-goal-focus", ...)`, it is session/branch-local and is not sent to the LLM. On `session_start` and `session_tree`, `loadState(ctx)` scans `ctx.sessionManager.getBranch()` for the latest focus entry, scans active goal files, and resolves focus as follows:
|
|
97
|
-
|
|
98
|
-
1. Use a valid focused id from the latest focus entry.
|
|
99
|
-
2. If the latest focus entry explicitly has `focusedGoalId: null`, or points at a missing/stale goal, remain unfocused.
|
|
100
|
-
3. If no focus entry exists, merge a compatible legacy `pi-goal-state { version: 3, goal }` goal and focus it. If disk already has the same id, the disk record wins and the legacy session record only supplies focus.
|
|
101
|
-
4. If no focus entry exists and exactly one open goal exists, auto-focus it for compatibility.
|
|
102
|
-
5. If multiple open goals exist and no valid focus exists, remain unfocused until `/goal-focus`, `/goal-resume`, `/goal-clear`, `/goal-abort`, `/goal-pause`, or `/goal-tweak` asks the user to choose.
|
|
103
|
-
|
|
104
|
-
Focus is human-owned. No agent tool can switch focus. Lifecycle tools operate only on the focused goal.
|
|
105
|
-
|
|
106
|
-
## Goal styles
|
|
107
|
-
|
|
108
|
-
### Regular goal
|
|
109
|
-
|
|
110
|
-
Regular goals are open-ended objectives. The agent decides the next concrete action each checkpoint turn, then completes only after the objective is actually satisfied.
|
|
111
|
-
|
|
112
|
-
### Sisyphus goal
|
|
113
|
-
|
|
114
|
-
Sisyphus is a light variant of the same goal lifecycle. It does not have a separate execution state machine or step counter. The only differences are prompt/criteria level:
|
|
115
|
-
|
|
116
|
-
- drafting asks for a patient ordered-execution style when relevant;
|
|
117
|
-
- continuations remind the agent not to rush, skip, or invent preflight steps;
|
|
118
|
-
- completion still uses `update_goal(status="complete")`, with the stricter expectation that the whole ordered objective is actually satisfied.
|
|
119
|
-
|
|
120
|
-
The legacy `step_complete` tool remains registered as a hidden compatibility no-op for old transcripts, but it is not exposed as an active work tool and is not required for completion.
|
|
121
|
-
|
|
122
|
-
## Drafting and confirmation
|
|
123
|
-
|
|
124
|
-
Drafting is now a lightweight user-intent confirmation conversation. For `/goals` and `/sisyphus`, the runtime stores only a thin session-local `confirmationIntent` with the requested focus, original topic, and start time. The agent may ask a focused question when the topic is vague, perform targeted read-only research when it improves the goal contract, grill assumptions or ordered steps, or proceed directly to `propose_goal_draft` when the request is already concrete.
|
|
125
|
-
|
|
126
|
-
`propose_goal_draft` enforces:
|
|
127
|
-
|
|
128
|
-
- a confirmation intent must be active;
|
|
129
|
-
- objective must be non-empty;
|
|
130
|
-
- `sisyphus` must match the command the user invoked.
|
|
131
|
-
|
|
132
|
-
A deprecated optional `draftId` parameter is accepted for compatibility but ignored; normal goal confirmation no longer depends on hidden prompt identity. Confirming a draft creates a new active goal and focuses it, leaving other active files untouched. Confirmation UI errors fail closed: the goal is not created and confirmation remains active. After confirmation, normal work tools are available for execution immediately.
|
|
133
|
-
|
|
134
|
-
## Command focus behavior
|
|
135
|
-
|
|
136
|
-
- `/goals` and `/sisyphus` start discussion-based confirmation before creating a new focused goal.
|
|
137
|
-
- `/goals-set` and `/sisyphus-set` directly create and focus a new open goal from the supplied objective.
|
|
138
|
-
- `/goal-list` prints all open goals with id, status, mode, usage, objective title, path, and a focus marker.
|
|
139
|
-
- `/goal-focus` uses `ctx.ui.select` when multiple goals are open and updates only session focus.
|
|
140
|
-
- `/goal-status` and `/goal` show the focused goal plus an `other open goals` hint.
|
|
141
|
-
- `/goal-resume` resumes the focused paused goal; when unfocused with multiple open goals, it asks the user to choose. Choosing an already active goal only focuses it.
|
|
142
|
-
- `/goal-clear` and `/goal-abort` archive only the focused/selected goal and never clear the whole pool at once.
|
|
143
|
-
- During goal confirmation, `/goal-clear` and `/goal-abort` only cancel the confirmation flow; they do not archive an unrelated focused goal unless the user invokes a lifecycle command after confirmation is cancelled.
|
|
144
|
-
- `/goal-tweak` revises only the focused active or paused goal; when unfocused with open goals, it asks the user to choose one.
|
|
145
|
-
- `/goal-pause` also asks the user to choose when the session is unfocused and open goals exist.
|
|
146
|
-
- `/goal-settings` opens extension settings. The current settings screen contains `auditor`, where provider/model/thinking_level are edited via free-text inputs.
|
|
147
|
-
|
|
148
|
-
When `propose_goal_draft` asks for confirmation, the UI shows a full plain-text draft report rather than a Markdown preview. On confirmation, the result prints the full finalized objective in the conversation. The same objective is also written to the active goal file.
|
|
149
|
-
|
|
150
|
-
## Tool visibility
|
|
151
|
-
|
|
152
|
-
Tool visibility is recomputed whenever state changes. Built-in work tools remain registered in the base prompt so they can be used after a confirmed draft; lifecycle-specific gates decide whether a call is allowed.
|
|
153
|
-
|
|
154
|
-
- Goal confirmation keeps `propose_goal_draft` stable and exposes `goal_question`, `goal_questionnaire`, and `get_goal` when structured clarification helps; workhorse tools are prompt-guided rather than hidden by a hard whitelist.
|
|
155
|
-
- Tweak drafting exposes question tools, `get_goal`, and `apply_goal_tweak`.
|
|
156
|
-
- Active goals expose `get_goal`, `update_goal`, `pause_goal`, and `abort_goal`.
|
|
157
|
-
- Paused goals expose `get_goal`, `update_goal`, and `abort_goal`, so the agent can complete or abandon a paused goal without resuming substantive work.
|
|
158
|
-
- Unfocused sessions with open goals expose no lifecycle mutation tools; prompts and status guide the user to `/goal-focus`.
|
|
159
|
-
- `step_complete` is hidden legacy compatibility.
|
|
160
|
-
- `create_goal` remains hidden and direct calls are rejected; normal creation goes through `propose_goal_draft`.
|
|
161
|
-
|
|
162
|
-
The `tool_call` interceptor blocks:
|
|
163
|
-
|
|
164
|
-
- non-`get_goal` tools after a stop tool has fired in the same turn.
|
|
165
|
-
|
|
166
|
-
## Disk format
|
|
167
|
-
|
|
168
|
-
Active and archived goal files live under the current session's `.pi/goals/sessions/<session-id>/` directory. Multiple active files may exist simultaneously within that session.
|
|
169
|
-
|
|
170
|
-
```text
|
|
171
|
-
.pi/goals/sessions/<session-id>/active_goal_<timestamp>_<id>.md
|
|
172
|
-
.pi/goals/sessions/<session-id>/archived/goal_<timestamp>_<id>.md
|
|
173
|
-
.pi/goals/sessions/<session-id>/goal_events.jsonl
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Each file has extension-owned metadata and a user-editable `# Goal Prompt` section. Before focused commands, tools, and lifecycle hooks act, the runtime re-reads the focused active file and reconciles lifecycle state from disk. External pause/archive/delete/status changes therefore win over stale memory and deleted active files are not resurrected. Prompt-body edits are still picked up from `# Goal Prompt`; session focus is never written to these files.
|
|
177
|
-
|
|
178
|
-
Path safety checks reject absolute paths, traversal, NUL bytes, symlinks, and paths outside the goal directories.
|
|
179
|
-
|
|
180
|
-
## Auto-continue and stop conditions
|
|
181
|
-
|
|
182
|
-
When `autoContinue` is on, the extension queues continuation prompts after agent turns for the focused goal only. The loop stops or pauses when:
|
|
183
|
-
|
|
184
|
-
- the agent calls `update_goal(status="complete")`;
|
|
185
|
-
- the agent calls `pause_goal`;
|
|
186
|
-
- the agent calls `abort_goal`;
|
|
187
|
-
- the user invokes `/goal-pause`, `/goal-clear`, or `/goal-abort`;
|
|
188
|
-
- the user aborts the turn;
|
|
189
|
-
- a turn ends without meaningful goal-work tool activity.
|
|
190
|
-
|
|
191
|
-
Continuation prompts include a goal id so stale prompts can be detected and neutralized. If focus changes or the goal is archived before a queued checkpoint runs, the checkpoint becomes stale and cannot drive task work.
|
|
192
|
-
|
|
193
|
-
`get_goal`, question tools, and draft proposal tools are not meaningful progress for the empty-turn gate. Only lifecycle mutations and actual workhorse tools mark a turn as goal work for continuation purposes.
|
|
194
|
-
|
|
195
|
-
## Completion output
|
|
196
|
-
|
|
197
|
-
Completion is intentionally verbose in the tool result and guarded by an independent auditor agent. `complete_goal(status="complete")` is valid for active and paused goals; paused goals do not need to be resumed just to record completion when existing evidence is sufficient.
|
|
198
|
-
|
|
199
|
-
Before archiving, the tool starts a separate in-memory pi session with a focused auditor prompt. The auditor receives the objective, executor completion summary, and goal metadata, can inspect the workspace with `read`, `grep`, `find`, `ls`, and `bash`, and must end with exactly one marker:
|
|
200
|
-
|
|
201
|
-
- `<approved/>` allows archiving;
|
|
202
|
-
- `<disapproved/>`, no marker, an error, or abort rejects completion and leaves the goal open.
|
|
203
|
-
|
|
204
|
-
The auditor uses the current/default model unless `.pi/pi-goal-x-settings.json` overrides `provider`, `model`, or `thinkingLevel`. `/goal-settings` opens a TUI showing all settings (disabled, provider, model, thinking_level, subtaskDepth, disableTasks, disableContracts); each editable field opens a free-text input and saves back to `.pi/pi-goal-x-settings.json`.
|
|
205
|
-
|
|
206
|
-
The user sees:
|
|
207
|
-
|
|
208
|
-
- a `Goal complete.` header;
|
|
209
|
-
- the executor's optional completion summary/evidence;
|
|
210
|
-
- the auditor's approval report;
|
|
211
|
-
- the full current goal details.
|
|
212
|
-
|
|
213
|
-
This mirrors creation: the finalized goal is visible when created, and the final report is visible when completed. The gate is intentionally semantic rather than paperwork-based: scaffold-only, alpha, generated-template, proxy-metric, build-only, or weakly verified completions should be disapproved by the auditor.
|
|
214
|
-
|
|
215
|
-
## Tests
|
|
216
|
-
|
|
217
|
-
Fast local tests live in `tests/` and run with:
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
npm test
|
|
221
|
-
npm run check
|
|
222
|
-
```
|
|
16
|
+
The event bus is non-replaying, so each producer also exposes a request-state event. A late consumer subscribes first, emits that request, and receives the complete current snapshot.
|
|
223
17
|
|
|
224
|
-
|
|
18
|
+
Goal uses Pi's own follow-up queue for autonomous continuation. Every continuation is the same durable custom message, `Continue the Goal.`, while the current Goal is injected ephemerally when Pi builds provider context. Durable history is replayed unchanged. Goal registers one stable `ctx.onIdle` callback; Pi owns the full run boundary, including retries, compaction, and queued messages, so Goal never polls or reconstructs lifecycle state. The callback rechecks the current Goal before sending, making stale registrations harmless. Normal agent ends register it; terminal `error` and `aborted` outcomes cancel any pending registration instead. Goal does not own provider retry, compaction, a scheduler, or a database. Completion runs an isolated auditor; shell access exists only behind a Bubblewrap read-only filesystem/network/process boundary and is omitted when that OS capability is unavailable. Approval permits one normal final response, and archival occurs only at `agent_settled`.
|
|
225
19
|
|
|
226
|
-
-
|
|
227
|
-
- lightweight confirmation prompt and proposal gates;
|
|
228
|
-
- questionnaire normalization and answer formatting;
|
|
229
|
-
- tool-name constants and question-like detection;
|
|
230
|
-
- lifecycle policy, including abort and paused-goal completion;
|
|
231
|
-
- auditor config/prompt/marker parsing, including disapproval winning over approval;
|
|
232
|
-
- goal-pool and focus resolution helpers;
|
|
233
|
-
- active goal file scanning;
|
|
234
|
-
- unfocused prompt guidance;
|
|
235
|
-
- focused/unfocused widget rendering;
|
|
236
|
-
- Sisyphus prompt-style behavior;
|
|
237
|
-
- auto-continue empty-turn guard behavior;
|
|
238
|
-
- full creation/completion report formatting.
|
|
20
|
+
Todo accepts one full replacement plan. Validation happens before the single state mutation: stale revision, unexplained omission of unfinished work, normalized dependency collision, missing dependency, cycle, premature dependent progress, or the 16 KiB serialized UTF-8 plan budget rejects the mutation without changing state. Transient context renders unfinished work fully, collapses completed work to keys, and is absent for a complete-only plan.
|
|
239
21
|
|
|
240
|
-
|
|
22
|
+
A migration-only Goal module may read legacy embedded tasks and write both new entry schemas once. Explicit legacy focus—including explicit null—wins over session-state fallback, ambiguous open Goals require selection, and manual-active Goals migrate paused rather than unexpectedly continuing. The adapter rechecks the Todo byte budget before either new snapshot is appended. Neither ongoing core imports the other package, and legacy source files remain unchanged.
|