@fractaal/pi-goal-x 0.20.0 → 0.28.0
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 +38 -293
- 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 +582 -3644
- 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 +602 -3916
- package/extensions/legacy-migration.ts +340 -0
- package/package.json +46 -21
- 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
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
|
-
import { displayObjectiveTitle, formatDuration, formatTokenValue, truncateText, } from "../goal-core.js";
|
|
3
|
-
function fit(value, width) {
|
|
4
|
-
return visibleWidth(value) > width ? truncateToWidth(value, width, "…") : value;
|
|
5
|
-
}
|
|
6
|
-
function heading(theme, width, left, right = "") {
|
|
7
|
-
if (!right)
|
|
8
|
-
return fit(left, width);
|
|
9
|
-
const rightPart = ` ${right}`;
|
|
10
|
-
const fill = Math.max(1, width - visibleWidth(left) - visibleWidth(rightPart));
|
|
11
|
-
return fit(`${left}${theme.fg("dim", " ".repeat(fill))}${rightPart}`, width);
|
|
12
|
-
}
|
|
13
|
-
function branchLine(theme, width, isLast, content) {
|
|
14
|
-
const prefix = isLast ? "└─" : "├─";
|
|
15
|
-
return fit(`${theme.fg("dim", prefix)} ${content}`, width);
|
|
16
|
-
}
|
|
17
|
-
function progressBar(pct, barWidth, theme) {
|
|
18
|
-
const safeBar = Math.max(3, barWidth);
|
|
19
|
-
const filled = Math.min(safeBar, Math.max(0, Math.round((pct / 100) * safeBar)));
|
|
20
|
-
const empty = safeBar - filled;
|
|
21
|
-
return `[${theme.fg("accent", "█".repeat(filled))}${theme.fg("dim", "░".repeat(empty))}]`;
|
|
22
|
-
}
|
|
23
|
-
function displayIcon(goal) {
|
|
24
|
-
if (goal.status === "complete")
|
|
25
|
-
return { icon: "✓", color: "success", label: "complete" };
|
|
26
|
-
if (goal.status === "paused") {
|
|
27
|
-
return goal.stopReason === "agent"
|
|
28
|
-
? { icon: "⊘", color: "warning", label: "blocked" }
|
|
29
|
-
: { icon: "◐", color: "muted", label: "paused" };
|
|
30
|
-
}
|
|
31
|
-
if (goal.sisyphus)
|
|
32
|
-
return { icon: "◆", color: "accent", label: goal.autoContinue ? "sisyphus running" : "sisyphus idle" };
|
|
33
|
-
return goal.autoContinue ? { icon: "●", color: "accent", label: "goal running" } : { icon: "○", color: "muted", label: "goal idle" };
|
|
34
|
-
}
|
|
35
|
-
function countFlatTasks(tasks) {
|
|
36
|
-
let total = 0;
|
|
37
|
-
let done = 0;
|
|
38
|
-
for (const t of tasks) {
|
|
39
|
-
total++;
|
|
40
|
-
if (t.status === "complete" || t.status === "skipped")
|
|
41
|
-
done++;
|
|
42
|
-
if (t.subtasks && t.subtasks.length > 0) {
|
|
43
|
-
const child = countFlatTasks(t.subtasks);
|
|
44
|
-
total += child.total;
|
|
45
|
-
done += child.done;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return { total, done };
|
|
49
|
-
}
|
|
50
|
-
function findFirstPending(tasks) {
|
|
51
|
-
const queue = [...tasks];
|
|
52
|
-
while (queue.length > 0) {
|
|
53
|
-
const t = queue.shift();
|
|
54
|
-
if (t.status === "pending")
|
|
55
|
-
return t;
|
|
56
|
-
if (t.subtasks)
|
|
57
|
-
queue.push(...t.subtasks);
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
function headingMeta(goal, otherOpenGoalCount = 0, disableTasks = false) {
|
|
62
|
-
const bits = [];
|
|
63
|
-
if (goal.status === "active" && goal.autoContinue)
|
|
64
|
-
bits.push("auto");
|
|
65
|
-
if (goal.usage.activeSeconds > 0)
|
|
66
|
-
bits.push(formatDuration(goal.usage.activeSeconds));
|
|
67
|
-
if (goal.usage.tokensUsed > 0)
|
|
68
|
-
bits.push(formatTokenValue(goal.usage.tokensUsed));
|
|
69
|
-
if (!disableTasks && goal.taskList && goal.taskList.tasks.length > 0) {
|
|
70
|
-
const { total, done } = countFlatTasks(goal.taskList.tasks);
|
|
71
|
-
bits.push(`${done}/${total} tasks`);
|
|
72
|
-
}
|
|
73
|
-
if (otherOpenGoalCount > 0)
|
|
74
|
-
bits.push(`+${otherOpenGoalCount} open`);
|
|
75
|
-
return bits.join(" · ");
|
|
76
|
-
}
|
|
77
|
-
const SPINNER = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
78
|
-
function spinnerFrame() {
|
|
79
|
-
return SPINNER[Math.floor(Date.now() / 80) % SPINNER.length];
|
|
80
|
-
}
|
|
81
|
-
export function renderAuditorWidgetLines(progress, theme, width) {
|
|
82
|
-
const safeWidth = Math.max(1, width);
|
|
83
|
-
const isActive = progress.phase !== "done";
|
|
84
|
-
const isThinking = progress.phase === "thinking";
|
|
85
|
-
const icon = isActive
|
|
86
|
-
? isThinking
|
|
87
|
-
? theme.fg("muted", "⟡")
|
|
88
|
-
: theme.fg("accent", spinnerFrame())
|
|
89
|
-
: theme.fg("success", "✓");
|
|
90
|
-
const label = isActive
|
|
91
|
-
? isThinking
|
|
92
|
-
? "thinking..."
|
|
93
|
-
: "auditing"
|
|
94
|
-
: "audit complete";
|
|
95
|
-
// formatDuration expects seconds, progress.elapsedMs is in milliseconds
|
|
96
|
-
const duration = formatDuration(Math.floor(progress.elapsedMs / 1000));
|
|
97
|
-
const lines = [
|
|
98
|
-
heading(theme, safeWidth, `${icon} ${theme.fg("accent", theme.bold("Audit"))} ${theme.fg("muted", label)}`, theme.fg("muted", duration)),
|
|
99
|
-
];
|
|
100
|
-
// Show step label when available
|
|
101
|
-
if (progress.label) {
|
|
102
|
-
lines.push(branchLine(theme, safeWidth, false, `${theme.fg("text", truncateText(progress.label, Math.max(8, safeWidth - 6)))}`));
|
|
103
|
-
}
|
|
104
|
-
// Show progress bar when percentage is available
|
|
105
|
-
if (typeof progress.percentage === "number") {
|
|
106
|
-
const barWidth = Math.max(6, Math.min(safeWidth - 10, 30));
|
|
107
|
-
const bar = progressBar(progress.percentage, barWidth, theme);
|
|
108
|
-
const pct = `${theme.fg("muted", `${Math.round(progress.percentage)}%`)}`;
|
|
109
|
-
lines.push(branchLine(theme, safeWidth, isActive && !progress.currentTool && progress.recentOutput.length === 0 && !isThinking, `${bar} ${pct}`));
|
|
110
|
-
}
|
|
111
|
-
if (isActive && !isThinking && progress.currentTool) {
|
|
112
|
-
const argText = progress.currentToolArgs
|
|
113
|
-
? truncateText(progress.currentToolArgs, Math.max(10, safeWidth - 24))
|
|
114
|
-
: "";
|
|
115
|
-
const toolDuration = progress.currentToolStartedAt
|
|
116
|
-
? ` ${theme.fg("dim", formatDuration(Math.floor((Date.now() - progress.currentToolStartedAt) / 1000)))}`
|
|
117
|
-
: "";
|
|
118
|
-
lines.push(branchLine(theme, safeWidth, false, `${theme.fg("accent", "tool")} ${theme.fg("text", progress.currentTool)}${argText ? ` ${theme.fg("dim", argText)}` : ""}${toolDuration}`));
|
|
119
|
-
}
|
|
120
|
-
if (progress.recentOutput.length > 0) {
|
|
121
|
-
// Show separator
|
|
122
|
-
lines.push(branchLine(theme, safeWidth, !isActive, theme.fg("dim", "─".repeat(Math.max(4, safeWidth - 6)))));
|
|
123
|
-
for (const [index, line] of progress.recentOutput.entries()) {
|
|
124
|
-
const isLast = index === progress.recentOutput.length - 1 && !isActive;
|
|
125
|
-
lines.push(branchLine(theme, safeWidth, isLast, theme.fg("dim", truncateText(line, Math.max(8, safeWidth - 6)))));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// Show skip hint when audit is actively running
|
|
129
|
-
if (isActive && !isThinking) {
|
|
130
|
-
lines.push(branchLine(theme, safeWidth, true, theme.fg("warning", "Esc to skip") + theme.fg("dim", " — abort the audit and let the user decide")));
|
|
131
|
-
}
|
|
132
|
-
return lines;
|
|
133
|
-
}
|
|
134
|
-
export function renderGoalWidgetLines(goal, theme, width, options = {}) {
|
|
135
|
-
// When auditor progress is active, show auditor display instead of normal goal widget
|
|
136
|
-
if (options.auditorProgress) {
|
|
137
|
-
return renderAuditorWidgetLines(options.auditorProgress, theme, width);
|
|
138
|
-
}
|
|
139
|
-
if (!goal) {
|
|
140
|
-
const openGoalCount = options.openGoalCount ?? 0;
|
|
141
|
-
if (openGoalCount <= 0)
|
|
142
|
-
return [];
|
|
143
|
-
const safeWidth = Math.max(1, width);
|
|
144
|
-
return [
|
|
145
|
-
heading(theme, safeWidth, `${theme.fg("warning", "◇")} ${theme.fg("warning", theme.bold("Goal"))} ${theme.fg("muted", "unfocused")}`, theme.fg("muted", `${openGoalCount} open`)),
|
|
146
|
-
branchLine(theme, safeWidth, true, `${theme.fg("muted", "Run /goal-focus to choose this session's goal")}`),
|
|
147
|
-
];
|
|
148
|
-
}
|
|
149
|
-
const safeWidth = Math.max(1, width);
|
|
150
|
-
const { icon, color, label } = displayIcon(goal);
|
|
151
|
-
const mode = goal.sisyphus ? "Sisyphus" : "Goal";
|
|
152
|
-
const headingLeft = `${theme.fg(color, icon)} ${theme.fg(color, theme.bold(mode))} ${theme.fg("muted", label.replace(/^sisyphus |^goal /, ""))}`;
|
|
153
|
-
const otherOpenGoalCount = Math.max(0, (options.openGoalCount ?? (goal ? 1 : 0)) - 1);
|
|
154
|
-
const headingRight = theme.fg("muted", headingMeta(goal, otherOpenGoalCount, options.disableTasks));
|
|
155
|
-
const lines = [heading(theme, safeWidth, headingLeft, headingRight)];
|
|
156
|
-
const body = [];
|
|
157
|
-
const titleWidth = Math.max(12, safeWidth - 8);
|
|
158
|
-
const objective = truncateText(displayObjectiveTitle(goal.objective), titleWidth);
|
|
159
|
-
body.push(`${theme.fg("accent", "⟡")} ${theme.fg("text", objective)}`);
|
|
160
|
-
if (!options.disableTasks && goal.taskList && goal.taskList.tasks.length > 0) {
|
|
161
|
-
const { total, done } = countFlatTasks(goal.taskList.tasks);
|
|
162
|
-
if (done === total) {
|
|
163
|
-
body.push(`${theme.fg("success", "✓")} ${theme.fg("muted", "All tasks complete")}`);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
const firstPending = findFirstPending(goal.taskList.tasks);
|
|
167
|
-
if (firstPending) {
|
|
168
|
-
body.push(`${theme.fg("warning", "◻")} ${theme.fg("muted", `${firstPending.id}: ${truncateText(firstPending.title, Math.max(8, safeWidth - 20))} (next)`)}`);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (goal.status === "paused" && goal.stopReason === "agent" && goal.pauseReason) {
|
|
173
|
-
body.push(`${theme.fg("warning", "blocker")} ${theme.fg("warning", truncateText(goal.pauseReason, Math.max(12, safeWidth - 14)))}`);
|
|
174
|
-
if (goal.pauseSuggestedAction) {
|
|
175
|
-
body.push(`${theme.fg("dim", "next")} ${theme.fg("muted", truncateText(goal.pauseSuggestedAction, Math.max(12, safeWidth - 10)))}`);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
const path = goal.status === "complete" ? goal.archivedPath : goal.activePath;
|
|
179
|
-
if (path) {
|
|
180
|
-
body.push(theme.fg("dim", path));
|
|
181
|
-
}
|
|
182
|
-
for (const [index, content] of body.entries()) {
|
|
183
|
-
lines.push(branchLine(theme, safeWidth, index === body.length - 1, content));
|
|
184
|
-
}
|
|
185
|
-
return lines;
|
|
186
|
-
}
|
|
187
|
-
export class GoalWidgetComponent {
|
|
188
|
-
theme;
|
|
189
|
-
tui;
|
|
190
|
-
getGoal;
|
|
191
|
-
getOpenGoalCount;
|
|
192
|
-
getAuditorProgress;
|
|
193
|
-
getSettings;
|
|
194
|
-
getDebugMode;
|
|
195
|
-
constructor(options) {
|
|
196
|
-
this.theme = options.theme;
|
|
197
|
-
this.tui = options.tui;
|
|
198
|
-
this.getGoal = options.getGoal;
|
|
199
|
-
this.getOpenGoalCount = options.getOpenGoalCount ?? (() => (this.getGoal() ? 1 : 0));
|
|
200
|
-
this.getAuditorProgress = options.getAuditorProgress ?? (() => null);
|
|
201
|
-
this.getSettings = options.getSettings ?? (() => ({}));
|
|
202
|
-
this.getDebugMode = options.getDebugMode ?? (() => false);
|
|
203
|
-
}
|
|
204
|
-
update() {
|
|
205
|
-
this.tui.requestRender();
|
|
206
|
-
}
|
|
207
|
-
/** Render debug info panel when debug mode is active */
|
|
208
|
-
renderDebugPanel(width) {
|
|
209
|
-
const t = this.theme;
|
|
210
|
-
const lines = [];
|
|
211
|
-
const safeWidth = Math.max(20, width);
|
|
212
|
-
// Divider
|
|
213
|
-
lines.push(t.fg("dim", "─".repeat(safeWidth)));
|
|
214
|
-
lines.push(t.fg("warning", "⊙ [DEBUG MODE]"));
|
|
215
|
-
lines.push("");
|
|
216
|
-
const goal = this.getGoal();
|
|
217
|
-
if (goal) {
|
|
218
|
-
lines.push(t.fg("dim", ` id: ${goal.id}`));
|
|
219
|
-
lines.push(t.fg("dim", ` status: ${goal.status}`));
|
|
220
|
-
lines.push(t.fg("dim", ` objective: ${truncateText(goal.objective, 80)}`));
|
|
221
|
-
lines.push(t.fg("dim", ` sisyphus: ${goal.sisyphus}`));
|
|
222
|
-
lines.push(t.fg("dim", ` autoContinue: ${goal.autoContinue}`));
|
|
223
|
-
lines.push(t.fg("dim", ` tokens: ${goal.usage.tokensUsed}`));
|
|
224
|
-
lines.push(t.fg("dim", ` activeSeconds: ${goal.usage.activeSeconds}`));
|
|
225
|
-
lines.push(t.fg("dim", ` createdAt: ${goal.createdAt}`));
|
|
226
|
-
lines.push(t.fg("dim", ` updatedAt: ${goal.updatedAt}`));
|
|
227
|
-
if (goal.pauseReason)
|
|
228
|
-
lines.push(t.fg("dim", ` pauseReason: ${goal.pauseReason}`));
|
|
229
|
-
if (goal.pauseSuggestedAction)
|
|
230
|
-
lines.push(t.fg("dim", ` pauseSuggestedAction: ${goal.pauseSuggestedAction}`));
|
|
231
|
-
if (goal.stopReason)
|
|
232
|
-
lines.push(t.fg("dim", ` stopReason: ${goal.stopReason}`));
|
|
233
|
-
if (goal.activePath)
|
|
234
|
-
lines.push(t.fg("dim", ` activePath: ${goal.activePath}`));
|
|
235
|
-
if (goal.archivedPath)
|
|
236
|
-
lines.push(t.fg("dim", ` archivedPath: ${goal.archivedPath}`));
|
|
237
|
-
if (goal.verificationContract)
|
|
238
|
-
lines.push(t.fg("dim", ` vContract: ${truncateText(goal.verificationContract, 60)}`));
|
|
239
|
-
// Task tree summary
|
|
240
|
-
if (goal.taskList && goal.taskList.tasks.length > 0) {
|
|
241
|
-
const { total, done } = countFlatTasks(goal.taskList.tasks);
|
|
242
|
-
lines.push(t.fg("dim", ` tasks: ${done}/${total}`));
|
|
243
|
-
const firstPending = findFirstPending(goal.taskList.tasks);
|
|
244
|
-
if (firstPending)
|
|
245
|
-
lines.push(t.fg("dim", ` next: ${firstPending.id} (${truncateText(firstPending.title, 40)})`));
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
lines.push(t.fg("dim", " (no goal)"));
|
|
250
|
-
}
|
|
251
|
-
lines.push("");
|
|
252
|
-
lines.push(t.fg("dim", "── Debug keybindings ──"));
|
|
253
|
-
lines.push(t.fg("dim", " Ctrl+Shift+X Toggle debug mode"));
|
|
254
|
-
lines.push(t.fg("dim", " Ctrl+Shift+N Create test goal"));
|
|
255
|
-
lines.push(t.fg("dim", " Ctrl+Shift+T Inject sample tasks"));
|
|
256
|
-
lines.push(t.fg("dim", " Ctrl+Shift+R Mock audit animation"));
|
|
257
|
-
lines.push(t.fg("dim", " Ctrl+Shift+O Open proposal dialog"));
|
|
258
|
-
return lines;
|
|
259
|
-
}
|
|
260
|
-
render(width) {
|
|
261
|
-
const settings = this.getSettings();
|
|
262
|
-
let lines = renderGoalWidgetLines(this.getGoal(), this.theme, width, {
|
|
263
|
-
openGoalCount: this.getOpenGoalCount(),
|
|
264
|
-
auditorProgress: this.getAuditorProgress(),
|
|
265
|
-
disableTasks: settings.disableTasks,
|
|
266
|
-
});
|
|
267
|
-
if (this.getDebugMode()) {
|
|
268
|
-
lines.push(...this.renderDebugPanel(width));
|
|
269
|
-
}
|
|
270
|
-
// Safety net: ensure no returned line exceeds the terminal width
|
|
271
|
-
for (let i = 0; i < lines.length; i++) {
|
|
272
|
-
if (visibleWidth(lines[i]) > width) {
|
|
273
|
-
lines[i] = truncateToWidth(lines[i], width);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
return lines;
|
|
277
|
-
}
|
|
278
|
-
invalidate() {
|
|
279
|
-
this.tui.requestRender();
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
//# sourceMappingURL=goal-widget.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"goal-widget.js","sourceRoot":"","sources":["../../extensions/widgets/goal-widget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EACN,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,YAAY,GAEZ,MAAM,iBAAiB,CAAC;AAyCzB,SAAS,GAAG,CAAC,KAAa,EAAE,KAAa;IACxC,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACjF,CAAC;AAED,SAAS,OAAO,CAAC,KAAY,EAAE,KAAa,EAAE,IAAY,EAAE,KAAK,GAAG,EAAE;IACrE,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,IAAI,KAAK,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/E,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,EAAE,EAAE,KAAK,CAAC,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
|
-
import type { GoalRecord } from "../goal-record.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Show a scrollable modal overlay displaying the current goal's task list.
|
|
5
|
-
* Press 'a' to toggle between the current goal and all open goals.
|
|
6
|
-
* Triggered by Ctrl+Shift+T. Dismisses on Escape.
|
|
7
|
-
*/
|
|
8
|
-
export declare function showTaskListOverlay(ctx: ExtensionContext, goalsById: Map<string, GoalRecord>, focusedGoalId: string | null): Promise<void>;
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
2
|
-
import { displayObjectiveTitle, statusLabel } from "../goal-core.js";
|
|
3
|
-
import { openGoalsFromPool } from "../goal-pool.js";
|
|
4
|
-
// ── Public API ───────────────────────────────────────────────────────
|
|
5
|
-
/**
|
|
6
|
-
* Show a scrollable modal overlay displaying the current goal's task list.
|
|
7
|
-
* Press 'a' to toggle between the current goal and all open goals.
|
|
8
|
-
* Triggered by Ctrl+Shift+T. Dismisses on Escape.
|
|
9
|
-
*/
|
|
10
|
-
export async function showTaskListOverlay(ctx, goalsById, focusedGoalId) {
|
|
11
|
-
if (!ctx.hasUI)
|
|
12
|
-
return;
|
|
13
|
-
await ctx.ui.custom((tui, theme, _keybindings, done) => {
|
|
14
|
-
// ── Theme helpers ─────────────────────────────────────────────
|
|
15
|
-
const accent = (s) => theme.fg("accent", s);
|
|
16
|
-
const dim = (s) => theme.fg("dim", s);
|
|
17
|
-
const success = (s) => theme.fg("success", s);
|
|
18
|
-
const muted = (s) => theme.fg("muted", s);
|
|
19
|
-
const bold = (s) => theme.bold(s);
|
|
20
|
-
// ── State ─────────────────────────────────────────────────────
|
|
21
|
-
let showAllGoals = false;
|
|
22
|
-
let entries = [];
|
|
23
|
-
let totalOpenGoals = 0;
|
|
24
|
-
let totalTaskCount = 0;
|
|
25
|
-
function rebuildEntries() {
|
|
26
|
-
entries = [];
|
|
27
|
-
totalOpenGoals = 0;
|
|
28
|
-
totalTaskCount = 0;
|
|
29
|
-
const openGoals = openGoalsFromPool(goalsById);
|
|
30
|
-
const targetGoals = showAllGoals
|
|
31
|
-
? openGoals
|
|
32
|
-
: openGoals.filter((g) => g.id === focusedGoalId);
|
|
33
|
-
if (targetGoals.length === 0) {
|
|
34
|
-
entries.push({ type: "empty-message", text: "No open goals to display." });
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
for (const [gIdx, goal] of targetGoals.entries()) {
|
|
38
|
-
if (goal.taskList) {
|
|
39
|
-
totalTaskCount += countAllTasks(goal.taskList.tasks);
|
|
40
|
-
}
|
|
41
|
-
if (gIdx > 0) {
|
|
42
|
-
entries.push({ type: "separator" });
|
|
43
|
-
}
|
|
44
|
-
// Goal header
|
|
45
|
-
const icon = goal.status === "paused" ? "⏸"
|
|
46
|
-
: goal.sisyphus ? "◆" : "●";
|
|
47
|
-
const title = displayObjectiveTitle(goal.objective);
|
|
48
|
-
const label = statusLabel(goal);
|
|
49
|
-
entries.push({ type: "goal-header", icon, title, status: label });
|
|
50
|
-
// Task summary & task list
|
|
51
|
-
if (goal.taskList && goal.taskList.tasks.length > 0) {
|
|
52
|
-
const { total, complete, skipped } = countAllWithStatus(goal.taskList.tasks);
|
|
53
|
-
const summary = `${complete}/${total} done${skipped > 0 ? ` (${skipped} skipped)` : ""}`;
|
|
54
|
-
entries.push({ type: "task-summary", text: summary });
|
|
55
|
-
const tasks = goal.taskList.tasks;
|
|
56
|
-
for (let i = 0; i < tasks.length; i++) {
|
|
57
|
-
const isLast = i === tasks.length - 1;
|
|
58
|
-
collectTaskEntries(tasks[i], 1, isLast, entries);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
entries.push({ type: "empty-message", text: "(no tasks)" });
|
|
63
|
-
}
|
|
64
|
-
totalOpenGoals++;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Build initial entries
|
|
68
|
-
rebuildEntries();
|
|
69
|
-
// ── Render helpers ────────────────────────────────────────────
|
|
70
|
-
/** Render a single line entry into styled wrapped lines */
|
|
71
|
-
function renderEntry(entry, innerWidth) {
|
|
72
|
-
switch (entry.type) {
|
|
73
|
-
case "separator":
|
|
74
|
-
return [dim("·")];
|
|
75
|
-
case "goal-header": {
|
|
76
|
-
const icon = entry.icon === "⏸" ? muted("⏸") : entry.icon === "◆" ? accent("◆") : accent("●");
|
|
77
|
-
const status = dim(entry.status);
|
|
78
|
-
const prefix = `${icon} ${bold("")}`; // placeholder, we'll build below
|
|
79
|
-
const rawPrefix = `${entry.icon} `; // raw width: icon + 2 spaces
|
|
80
|
-
const prefixWidth = visibleWidth(rawPrefix);
|
|
81
|
-
const available = innerWidth - prefixWidth;
|
|
82
|
-
const wrappedTitle = wrapTextWithAnsi(bold(entry.title), Math.max(1, available));
|
|
83
|
-
const lines = [];
|
|
84
|
-
wrappedTitle.forEach((segment, i) => {
|
|
85
|
-
if (i === 0) {
|
|
86
|
-
lines.push(`${icon} ${segment} ${status}`);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
lines.push(` ${" ".repeat(rawPrefix.length - 3)}${segment}`);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
// If title alone fits, status needs to be on same line
|
|
93
|
-
// But we already handle it above for i=0. The status might overflow.
|
|
94
|
-
// If status doesn't fit on first line after title, put it on its own line
|
|
95
|
-
const firstLine = lines[0];
|
|
96
|
-
const allOnFirst = `${icon} ${entry.title} ${entry.status}`;
|
|
97
|
-
if (visibleWidth(firstLine) > innerWidth) {
|
|
98
|
-
// Status overflowed — put status on a separate dim line
|
|
99
|
-
lines[0] = `${icon} ${wrappedTitle[0]}`;
|
|
100
|
-
if (wrappedTitle.length === 1) {
|
|
101
|
-
lines.push(` ${dim(entry.status)}`);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
// insert status after last wrapped title segment
|
|
105
|
-
const lastLine = wrappedTitle[wrappedTitle.length - 1];
|
|
106
|
-
lines[lines.length - 1] = ` ${" ".repeat(rawPrefix.length - 3)}${lastLine}`;
|
|
107
|
-
lines.push(` ${dim(entry.status)}`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
// Re-truncate any over-long lines just in case
|
|
111
|
-
return lines.map((l) => visibleWidth(l) > innerWidth ? truncateToWidth(l, innerWidth, "…") : l);
|
|
112
|
-
}
|
|
113
|
-
case "task-summary": {
|
|
114
|
-
const content = dim(entry.text);
|
|
115
|
-
return [visibleWidth(content) > innerWidth ? truncateToWidth(content, innerWidth, "…") : content];
|
|
116
|
-
}
|
|
117
|
-
case "task": {
|
|
118
|
-
const prefixWidth = visibleWidth(entry.prefix);
|
|
119
|
-
const available = innerWidth - prefixWidth;
|
|
120
|
-
const wrappedTitle = wrapTextWithAnsi(entry.title, Math.max(1, available));
|
|
121
|
-
const lines = [];
|
|
122
|
-
wrappedTitle.forEach((segment, i) => {
|
|
123
|
-
if (i === 0) {
|
|
124
|
-
lines.push(`${dim(entry.prefix)} ${segment}`);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
lines.push(`${" ".repeat(prefixWidth + 1)}${segment}`);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
return lines.map((l) => visibleWidth(l) > innerWidth ? truncateToWidth(l, innerWidth, "…") : l);
|
|
131
|
-
}
|
|
132
|
-
case "empty-message": {
|
|
133
|
-
const content = dim(entry.text);
|
|
134
|
-
return [visibleWidth(content) > innerWidth ? truncateToWidth(content, innerWidth, "…") : content];
|
|
135
|
-
}
|
|
136
|
-
default:
|
|
137
|
-
return [];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// ── Scroll state ──────────────────────────────────────────────
|
|
141
|
-
let scrollOffset = 0;
|
|
142
|
-
let lastRenderWidth = 80;
|
|
143
|
-
// The "logical line count" is the number of entries (before wrapping).
|
|
144
|
-
// We store rendered line count too since wrapped entries expand.
|
|
145
|
-
let renderedLineCount = 0;
|
|
146
|
-
function computeVisibleHeight(innerWidth) {
|
|
147
|
-
return Math.max(8, Math.floor(innerWidth / 2.8));
|
|
148
|
-
}
|
|
149
|
-
const wasHardwareCursorShown = tui.getShowHardwareCursor();
|
|
150
|
-
tui.setShowHardwareCursor(false);
|
|
151
|
-
// ── Component ─────────────────────────────────────────────────
|
|
152
|
-
const component = {
|
|
153
|
-
dispose() {
|
|
154
|
-
tui.setShowHardwareCursor(wasHardwareCursorShown);
|
|
155
|
-
},
|
|
156
|
-
invalidate() { },
|
|
157
|
-
render(width) {
|
|
158
|
-
lastRenderWidth = width;
|
|
159
|
-
const termWidth = Math.min(width, 100);
|
|
160
|
-
const innerWidth = Math.min(termWidth, 90) - 2;
|
|
161
|
-
const p = " ";
|
|
162
|
-
function line(content) {
|
|
163
|
-
const vis = visibleWidth(content);
|
|
164
|
-
const fill = innerWidth - vis;
|
|
165
|
-
return accent("│") + content + (fill > 0 ? " ".repeat(fill) : "") + accent("│");
|
|
166
|
-
}
|
|
167
|
-
// ── Render all entries into flat text lines ────────────
|
|
168
|
-
const renderedLines = [];
|
|
169
|
-
for (const entry of entries) {
|
|
170
|
-
const wrapped = renderEntry(entry, innerWidth);
|
|
171
|
-
renderedLines.push(...wrapped);
|
|
172
|
-
}
|
|
173
|
-
renderedLineCount = renderedLines.length;
|
|
174
|
-
const horiz = "─".repeat(innerWidth);
|
|
175
|
-
const out = [];
|
|
176
|
-
out.push(accent(`┌${horiz}┐`));
|
|
177
|
-
// Header
|
|
178
|
-
const viewLabel = showAllGoals
|
|
179
|
-
? `${totalOpenGoals} ${totalOpenGoals === 1 ? "goal" : "goals"}`
|
|
180
|
-
: "current goal";
|
|
181
|
-
const taskWord = totalTaskCount === 1 ? "task" : "tasks";
|
|
182
|
-
const h = bold(` Tasks (${viewLabel}, ${totalTaskCount} ${taskWord})`);
|
|
183
|
-
out.push(line(p + h));
|
|
184
|
-
out.push(accent(`├${horiz}┤`));
|
|
185
|
-
// Content with scrolling
|
|
186
|
-
const visibleHeight = computeVisibleHeight(innerWidth);
|
|
187
|
-
const maxOffset = Math.max(0, renderedLineCount - visibleHeight);
|
|
188
|
-
if (scrollOffset > maxOffset)
|
|
189
|
-
scrollOffset = maxOffset;
|
|
190
|
-
const canScrollUp = scrollOffset > 0;
|
|
191
|
-
const canScrollDown = scrollOffset < maxOffset;
|
|
192
|
-
if (canScrollUp) {
|
|
193
|
-
out.push(line(p + dim(`▴ ${scrollOffset}/${renderedLineCount} lines`)));
|
|
194
|
-
}
|
|
195
|
-
const end = Math.min(scrollOffset + visibleHeight, renderedLineCount);
|
|
196
|
-
for (let i = scrollOffset; i < end; i++) {
|
|
197
|
-
const raw = renderedLines[i];
|
|
198
|
-
// Each rendered line from renderEntry already wraps/truncates,
|
|
199
|
-
// but double-check for safety
|
|
200
|
-
const safe = visibleWidth(raw) > innerWidth
|
|
201
|
-
? truncateToWidth(raw, innerWidth, "…")
|
|
202
|
-
: raw;
|
|
203
|
-
out.push(line(p + safe));
|
|
204
|
-
}
|
|
205
|
-
if (canScrollDown) {
|
|
206
|
-
out.push(line(p + dim(`▾ ${renderedLineCount - end} more lines`)));
|
|
207
|
-
}
|
|
208
|
-
if (renderedLineCount === 0) {
|
|
209
|
-
out.push(line(p + dim("No tasks to display.")));
|
|
210
|
-
}
|
|
211
|
-
out.push(accent(`├${horiz}┤`));
|
|
212
|
-
const toggleHint = showAllGoals ? "show current" : "show all";
|
|
213
|
-
const footer = dim(`↑↓/jk scroll · 'a' to ${toggleHint} · Esc close`);
|
|
214
|
-
out.push(line(p + footer));
|
|
215
|
-
out.push(accent(`└${horiz}┘`));
|
|
216
|
-
return out;
|
|
217
|
-
},
|
|
218
|
-
handleInput(data) {
|
|
219
|
-
const tw = Math.min(lastRenderWidth, 100);
|
|
220
|
-
const innerW = Math.min(tw, 90) - 2;
|
|
221
|
-
const visibleH = computeVisibleHeight(innerW);
|
|
222
|
-
const maxO = Math.max(0, renderedLineCount - visibleH);
|
|
223
|
-
if (matchesKey(data, "up") || matchesKey(data, "k")) {
|
|
224
|
-
scrollOffset = Math.max(0, scrollOffset - 1);
|
|
225
|
-
tui.requestRender();
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
if (matchesKey(data, "down") || matchesKey(data, "j")) {
|
|
229
|
-
scrollOffset = Math.min(maxO, scrollOffset + 1);
|
|
230
|
-
tui.requestRender();
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
if (matchesKey(data, "pageUp")) {
|
|
234
|
-
scrollOffset = Math.max(0, scrollOffset - visibleH);
|
|
235
|
-
tui.requestRender();
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
if (matchesKey(data, "pageDown")) {
|
|
239
|
-
scrollOffset = Math.min(maxO, scrollOffset + visibleH);
|
|
240
|
-
tui.requestRender();
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
if (matchesKey(data, "home")) {
|
|
244
|
-
scrollOffset = 0;
|
|
245
|
-
tui.requestRender();
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
if (matchesKey(data, "end")) {
|
|
249
|
-
scrollOffset = maxO;
|
|
250
|
-
tui.requestRender();
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
// Toggle view
|
|
254
|
-
if (matchesKey(data, "a")) {
|
|
255
|
-
showAllGoals = !showAllGoals;
|
|
256
|
-
rebuildEntries();
|
|
257
|
-
scrollOffset = 0;
|
|
258
|
-
tui.requestRender();
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
if (matchesKey(data, "escape") || matchesKey(data, "enter")) {
|
|
262
|
-
done();
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
};
|
|
267
|
-
return component;
|
|
268
|
-
}, {
|
|
269
|
-
overlay: true,
|
|
270
|
-
overlayOptions: {
|
|
271
|
-
anchor: "center",
|
|
272
|
-
width: "80%",
|
|
273
|
-
minWidth: 60,
|
|
274
|
-
maxHeight: "80%",
|
|
275
|
-
},
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
// ── Task counting ─────────────────────────────────────────────────────
|
|
279
|
-
function countAllTasks(tasks) {
|
|
280
|
-
let n = 0;
|
|
281
|
-
for (const t of tasks) {
|
|
282
|
-
n += 1 + countAllTasks(t.subtasks ?? []);
|
|
283
|
-
}
|
|
284
|
-
return n;
|
|
285
|
-
}
|
|
286
|
-
function countAllWithStatus(tasks) {
|
|
287
|
-
let total = 0;
|
|
288
|
-
let complete = 0;
|
|
289
|
-
let skipped = 0;
|
|
290
|
-
for (const t of tasks) {
|
|
291
|
-
total++;
|
|
292
|
-
if (t.status === "complete")
|
|
293
|
-
complete++;
|
|
294
|
-
else if (t.status === "skipped")
|
|
295
|
-
skipped++;
|
|
296
|
-
if (t.subtasks) {
|
|
297
|
-
const child = countAllWithStatus(t.subtasks);
|
|
298
|
-
total += child.total;
|
|
299
|
-
complete += child.complete;
|
|
300
|
-
skipped += child.skipped;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return { total, complete, skipped, pending: total - complete - skipped };
|
|
304
|
-
}
|
|
305
|
-
// ── Tree entry collection ─────────────────────────────────────────────
|
|
306
|
-
const STATUS_ICONS = { complete: "✓", skipped: "—", pending: "◌" };
|
|
307
|
-
const BRANCH = "├─";
|
|
308
|
-
const BRANCH_LAST = "└─";
|
|
309
|
-
function collectTaskEntries(task, depth, isLast, entries) {
|
|
310
|
-
const branch = isLast ? BRANCH_LAST : BRANCH;
|
|
311
|
-
const statusIcon = STATUS_ICONS[task.status] ?? STATUS_ICONS.pending;
|
|
312
|
-
const indent = " " + " ".repeat(depth - 1);
|
|
313
|
-
const prefix = `${indent} ${branch} ${statusIcon}`;
|
|
314
|
-
entries.push({ type: "task", prefix, title: task.title });
|
|
315
|
-
if (task.subtasks && task.subtasks.length > 0) {
|
|
316
|
-
for (let i = 0; i < task.subtasks.length; i++) {
|
|
317
|
-
collectTaskEntries(task.subtasks[i], depth + 1, i === task.subtasks.length - 1, entries);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
//# sourceMappingURL=task-list-overlay.js.map
|