pi-daddy 0.49.5 → 0.50.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/CHANGELOG.md +51 -1
- package/README.md +217 -27
- package/dist/governance/initiative-coordinator.d.ts +58 -0
- package/dist/governance/initiative-coordinator.d.ts.map +1 -0
- package/dist/governance/initiative-coordinator.js +348 -0
- package/dist/governance/initiative-coordinator.js.map +1 -0
- package/dist/governance/initiative-effects.d.ts +20 -0
- package/dist/governance/initiative-effects.d.ts.map +1 -0
- package/dist/governance/initiative-effects.js +108 -0
- package/dist/governance/initiative-effects.js.map +1 -0
- package/dist/governance/initiative-state.d.ts +13 -0
- package/dist/governance/initiative-state.d.ts.map +1 -0
- package/dist/governance/initiative-state.js +122 -0
- package/dist/governance/initiative-state.js.map +1 -0
- package/dist/governance/operation-artifact-io.d.ts +8 -0
- package/dist/governance/operation-artifact-io.d.ts.map +1 -0
- package/dist/governance/operation-artifact-io.js +95 -0
- package/dist/governance/operation-artifact-io.js.map +1 -0
- package/dist/governance/operation-artifact-scan.d.ts +13 -0
- package/dist/governance/operation-artifact-scan.d.ts.map +1 -0
- package/dist/governance/operation-artifact-scan.js +71 -0
- package/dist/governance/operation-artifact-scan.js.map +1 -0
- package/dist/governance/operation-artifacts.d.ts +53 -0
- package/dist/governance/operation-artifacts.d.ts.map +1 -0
- package/dist/governance/operation-artifacts.js +309 -0
- package/dist/governance/operation-artifacts.js.map +1 -0
- package/dist/governance/runtime-settlement.d.ts +2 -0
- package/dist/governance/runtime-settlement.d.ts.map +1 -1
- package/dist/governance/runtime-settlement.js +26 -0
- package/dist/governance/runtime-settlement.js.map +1 -1
- package/dist/governance/workspace-acceptance.d.ts +5 -0
- package/dist/governance/workspace-acceptance.d.ts.map +1 -1
- package/dist/governance/workspace-acceptance.js +16 -0
- package/dist/governance/workspace-acceptance.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/kernel/dashboard-observation.d.ts +76 -0
- package/dist/kernel/dashboard-observation.d.ts.map +1 -0
- package/dist/kernel/dashboard-observation.js +49 -0
- package/dist/kernel/dashboard-observation.js.map +1 -0
- package/dist/kernel/dispatch-operation.d.ts +2 -0
- package/dist/kernel/dispatch-operation.d.ts.map +1 -1
- package/dist/kernel/dispatch-operation.js.map +1 -1
- package/dist/kernel/initiative.d.ts +94 -0
- package/dist/kernel/initiative.d.ts.map +1 -0
- package/dist/kernel/initiative.js +38 -0
- package/dist/kernel/initiative.js.map +1 -0
- package/dist/kernel/operation-artifact.d.ts +49 -0
- package/dist/kernel/operation-artifact.d.ts.map +1 -0
- package/dist/kernel/operation-artifact.js +4 -0
- package/dist/kernel/operation-artifact.js.map +1 -0
- package/dist/kernel/principal-binding.d.ts +4 -0
- package/dist/kernel/principal-binding.d.ts.map +1 -0
- package/dist/kernel/principal-binding.js +94 -0
- package/dist/kernel/principal-binding.js.map +1 -0
- package/dist/kernel/project-paths.d.ts +6 -0
- package/dist/kernel/project-paths.d.ts.map +1 -1
- package/dist/kernel/project-paths.js +12 -0
- package/dist/kernel/project-paths.js.map +1 -1
- package/dist/kernel/selected-definitions.d.ts.map +1 -1
- package/dist/kernel/selected-definitions.js +5 -91
- package/dist/kernel/selected-definitions.js.map +1 -1
- package/dist/kernel/workspace-diagnostics.d.ts +24 -0
- package/dist/kernel/workspace-diagnostics.d.ts.map +1 -0
- package/dist/kernel/workspace-diagnostics.js +81 -0
- package/dist/kernel/workspace-diagnostics.js.map +1 -0
- package/dist/products/activity-storage.d.ts +2 -0
- package/dist/products/activity-storage.d.ts.map +1 -0
- package/dist/products/activity-storage.js +119 -0
- package/dist/products/activity-storage.js.map +1 -0
- package/dist/products/activity-timeline.d.ts +4 -0
- package/dist/products/activity-timeline.d.ts.map +1 -1
- package/dist/products/activity-timeline.js +12 -0
- package/dist/products/activity-timeline.js.map +1 -1
- package/dist/products/dashboard-cli.d.ts +2 -0
- package/dist/products/dashboard-cli.d.ts.map +1 -1
- package/dist/products/dashboard-cli.js +41 -9
- package/dist/products/dashboard-cli.js.map +1 -1
- package/dist/products/dashboard-display-controls.d.ts.map +1 -1
- package/dist/products/dashboard-display-controls.js +30 -0
- package/dist/products/dashboard-display-controls.js.map +1 -1
- package/dist/products/dashboard-file-cache.d.ts +10 -0
- package/dist/products/dashboard-file-cache.d.ts.map +1 -0
- package/dist/products/dashboard-file-cache.js +38 -0
- package/dist/products/dashboard-file-cache.js.map +1 -0
- package/dist/products/dashboard-panels.d.ts +6 -0
- package/dist/products/dashboard-panels.d.ts.map +1 -0
- package/dist/products/dashboard-panels.js +179 -0
- package/dist/products/dashboard-panels.js.map +1 -0
- package/dist/products/dashboard-screen.d.ts +8 -0
- package/dist/products/dashboard-screen.d.ts.map +1 -1
- package/dist/products/dashboard-screen.js +86 -15
- package/dist/products/dashboard-screen.js.map +1 -1
- package/dist/products/dashboard-session-client.d.ts +16 -2
- package/dist/products/dashboard-session-client.d.ts.map +1 -1
- package/dist/products/dashboard-session-client.js +64 -11
- package/dist/products/dashboard-session-client.js.map +1 -1
- package/dist/products/dashboard-settings.d.ts.map +1 -1
- package/dist/products/dashboard-settings.js +4 -6
- package/dist/products/dashboard-settings.js.map +1 -1
- package/dist/products/ecosystem-versions.d.ts +1 -1
- package/dist/products/ecosystem-versions.d.ts.map +1 -1
- package/extensions/activity-timeline.ts +3 -1
- package/extensions/artifact-bridge.ts +130 -0
- package/extensions/dashboard-live.ts +63 -0
- package/extensions/dashboard-observation.ts +39 -0
- package/extensions/dashboard-session-server.ts +45 -3
- package/extensions/dashboard-sources.ts +124 -0
- package/extensions/delegation-artifacts.ts +125 -0
- package/extensions/delegation-operations.ts +42 -13
- package/extensions/ecosystem-versions.ts +12 -5
- package/extensions/grants-command.ts +34 -6
- package/extensions/grants.ts +9 -20
- package/extensions/initiative-dashboard.ts +143 -0
- package/extensions/initiative-runtime.ts +406 -0
- package/extensions/runtime-snapshot.ts +118 -2
- package/extensions/session-environment.ts +13 -1
- package/extensions/session.ts +28 -10
- package/extensions/workspace-diagnostics.ts +90 -0
- package/package.json +1 -1
- package/src/governance/initiative-coordinator.ts +400 -0
- package/src/governance/initiative-effects.ts +146 -0
- package/src/governance/initiative-state.ts +144 -0
- package/src/governance/operation-artifact-io.ts +103 -0
- package/src/governance/operation-artifact-scan.ts +77 -0
- package/src/governance/operation-artifacts.ts +363 -0
- package/src/governance/runtime-settlement.ts +28 -0
- package/src/governance/workspace-acceptance.ts +18 -0
- package/src/index.ts +13 -0
- package/src/kernel/dashboard-observation.ts +109 -0
- package/src/kernel/dispatch-operation.ts +2 -0
- package/src/kernel/initiative.ts +126 -0
- package/src/kernel/operation-artifact.ts +46 -0
- package/src/kernel/principal-binding.ts +104 -0
- package/src/kernel/project-paths.ts +16 -0
- package/src/kernel/selected-definitions.ts +5 -100
- package/src/kernel/workspace-diagnostics.ts +110 -0
- package/src/products/activity-storage.ts +128 -0
- package/src/products/activity-timeline.ts +11 -0
- package/src/products/dashboard-cli.ts +44 -9
- package/src/products/dashboard-display-controls.ts +27 -0
- package/src/products/dashboard-file-cache.ts +38 -0
- package/src/products/dashboard-panels.ts +217 -0
- package/src/products/dashboard-screen.ts +107 -17
- package/src/products/dashboard-session-client.ts +78 -14
- package/src/products/dashboard-settings.ts +4 -6
- package/src/products/ecosystem-versions.ts +2 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { dashboardFile, dashboardTimeline, dashboardSelectedDetail } from "./dashboard-file-cache.ts";
|
|
2
3
|
/**
|
|
3
4
|
* `pi-daddy-dashboard` — the view of one ledger or activity timeline plus session model controls.
|
|
4
5
|
*
|
|
@@ -64,6 +65,8 @@ export interface DashboardFrameOptions {
|
|
|
64
65
|
screen?: DashboardScreenState;
|
|
65
66
|
notice?: string;
|
|
66
67
|
pending?: boolean;
|
|
68
|
+
connected?: boolean;
|
|
69
|
+
acknowledgment?: string;
|
|
67
70
|
command?: string;
|
|
68
71
|
}
|
|
69
72
|
|
|
@@ -147,9 +150,12 @@ async function compactFrame(options: DashboardFrameOptions): Promise<string> {
|
|
|
147
150
|
problem: "INCOMPATIBLE dashboard protocol; relink this package.",
|
|
148
151
|
});
|
|
149
152
|
try {
|
|
150
|
-
const text = await readFile(path, "utf8");
|
|
153
|
+
const text = options.session?.observation ? await dashboardFile(path) : await readFile(path, "utf8");
|
|
151
154
|
if (!options.ledgerPath || isActivityTimelineText(text)) {
|
|
152
|
-
const
|
|
155
|
+
const parsed = dashboardTimeline(path, text);
|
|
156
|
+
const timeline = options.session?.observation
|
|
157
|
+
? { ...parsed, tasks: parsed.tasks.filter((task) => task.rootId === options.session!.activity?.rootId) }
|
|
158
|
+
: parsed;
|
|
153
159
|
items = activityDashboardItems(timeline, aliases, options.now ?? new Date()).map((item) => ({
|
|
154
160
|
...item,
|
|
155
161
|
timelinePath: path,
|
|
@@ -157,6 +163,22 @@ async function compactFrame(options: DashboardFrameOptions): Promise<string> {
|
|
|
157
163
|
problem = timeline.refusals[0];
|
|
158
164
|
} else {
|
|
159
165
|
const projection = parseDashboardLedger(text, { now: options.now });
|
|
166
|
+
if (options.session?.observation) {
|
|
167
|
+
const owner = options.session.observation.logicalOwnerId;
|
|
168
|
+
const admitted = new Set(
|
|
169
|
+
projection.nodes.filter((node) => owner && node.logicalParentId === owner).map((node) => node.executionId),
|
|
170
|
+
);
|
|
171
|
+
for (let pass = 0; pass < projection.nodes.length; pass++) {
|
|
172
|
+
let changed = false;
|
|
173
|
+
for (const node of projection.nodes)
|
|
174
|
+
if (node.parentExecutionId && admitted.has(node.parentExecutionId) && !admitted.has(node.executionId)) {
|
|
175
|
+
admitted.add(node.executionId);
|
|
176
|
+
changed = true;
|
|
177
|
+
}
|
|
178
|
+
if (!changed) break;
|
|
179
|
+
}
|
|
180
|
+
projection.nodes = projection.nodes.filter((node) => admitted.has(node.executionId));
|
|
181
|
+
}
|
|
160
182
|
items = ledgerDashboardItems(projection);
|
|
161
183
|
if (projection.corrupt.length) problem = `Ledger unavailable: ${projection.corrupt.length} corrupt line(s)`;
|
|
162
184
|
}
|
|
@@ -172,15 +194,22 @@ async function compactFrame(options: DashboardFrameOptions): Promise<string> {
|
|
|
172
194
|
const key = activityTaskKey(activity.rootId, activity.taskId);
|
|
173
195
|
current = `Task ${activity.taskId}`;
|
|
174
196
|
try {
|
|
175
|
-
const
|
|
176
|
-
|
|
197
|
+
const text = options.session?.observation
|
|
198
|
+
? await dashboardFile(activity.path)
|
|
199
|
+
: await readFile(activity.path, "utf8");
|
|
200
|
+
const parsed = dashboardTimeline(activity.path, text);
|
|
201
|
+
const timeline = {
|
|
202
|
+
...parsed,
|
|
203
|
+
tasks: parsed.tasks.filter((task) => activityTaskKey(task.rootId, task.id) === key),
|
|
204
|
+
};
|
|
177
205
|
const item = activityDashboardItems(timeline, aliases, options.now ?? new Date())[0];
|
|
178
206
|
if (item) {
|
|
179
207
|
current = item.label;
|
|
180
208
|
currentStatus = item.status;
|
|
181
209
|
if (!items.some((existing) => existing.key === key)) items.unshift({ ...item, timelinePath: activity.path });
|
|
182
210
|
try {
|
|
183
|
-
|
|
211
|
+
if (!options.session?.observation)
|
|
212
|
+
current = (await detailForTimeline(activity.path, key, "prompt")).text.slice(0, 600);
|
|
184
213
|
} catch {
|
|
185
214
|
/* Metadata-only/off and unavailable retained content retain the exact task identity. */
|
|
186
215
|
}
|
|
@@ -198,8 +227,10 @@ async function compactFrame(options: DashboardFrameOptions): Promise<string> {
|
|
|
198
227
|
const source = items.find((value) => value.taskKey === key)?.timelinePath;
|
|
199
228
|
if (!source) throw Error("task has no retained activity source");
|
|
200
229
|
content = {
|
|
201
|
-
title: `PRIVATE ${options.activityDetail.field.toUpperCase()}`,
|
|
202
|
-
text:
|
|
230
|
+
title: `PRIVATE ${options.activityDetail.field.toUpperCase()} · selected snapshot`,
|
|
231
|
+
text: options.session?.observation
|
|
232
|
+
? (await dashboardSelectedDetail(options.activityDetail, source, key)).text
|
|
233
|
+
: (await detailForTimeline(source, key, options.activityDetail.field)).text,
|
|
203
234
|
};
|
|
204
235
|
} catch (error) {
|
|
205
236
|
problem = `Activity detail unavailable: ${error instanceof Error ? error.message : String(error)}`;
|
|
@@ -328,7 +359,11 @@ export async function runDashboard(argv = process.argv.slice(2), env: NodeJS.Pro
|
|
|
328
359
|
width: process.stdout.columns || 80,
|
|
329
360
|
...display.state,
|
|
330
361
|
activityAliases: display.aliases,
|
|
331
|
-
session: connection.state.snapshot,
|
|
362
|
+
session: connection.state.snapshot ?? connection.state.lastObserved,
|
|
363
|
+
connected: Boolean(connection.state.snapshot),
|
|
364
|
+
acknowledgment: connection.state.acknowledgment
|
|
365
|
+
? `${connection.state.acknowledgment.action}: ${connection.state.acknowledgment.state} · ${connection.state.acknowledgment.effect}`
|
|
366
|
+
: undefined,
|
|
332
367
|
...(interactive
|
|
333
368
|
? {
|
|
334
369
|
height: process.stdout.rows || 24,
|
|
@@ -414,7 +449,7 @@ export async function runDashboard(argv = process.argv.slice(2), env: NodeJS.Pro
|
|
|
414
449
|
let action = display.key(
|
|
415
450
|
key.name === "return"
|
|
416
451
|
? "return"
|
|
417
|
-
: ["up", "down", "escape", "tab"].includes(key.name || "")
|
|
452
|
+
: ["up", "down", "pageup", "pagedown", "escape", "tab"].includes(key.name || "")
|
|
418
453
|
? key.name!
|
|
419
454
|
: text || "",
|
|
420
455
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DASHBOARD_DESTINATIONS } from "./dashboard-panels.ts";
|
|
1
2
|
import { DASHBOARD_SETTING_KEYS } from "./dashboard-settings.ts";
|
|
2
3
|
/** Local display controls; these never dispatch actions to an owner or change ledger state. */
|
|
3
4
|
import { dashboardScreenState } from "./dashboard-screen.ts";
|
|
@@ -18,22 +19,44 @@ export function createDashboardDisplayControls(details: boolean, ledger: boolean
|
|
|
18
19
|
state,
|
|
19
20
|
screen,
|
|
20
21
|
key(key: string): "auto" | "quit" | "command" | "setting" | undefined {
|
|
22
|
+
if (/^[1-6]$/.test(key)) {
|
|
23
|
+
screen.selections ??= {};
|
|
24
|
+
if (screen.selectedKey) screen.selections[screen.destination ?? "now"] = screen.selectedKey;
|
|
25
|
+
screen.destination = DASHBOARD_DESTINATIONS[Number(key) - 1];
|
|
26
|
+
screen.selectedKey = screen.selections[screen.destination!];
|
|
27
|
+
screen.view = screen.destination === "settings" ? "settings" : "main";
|
|
28
|
+
screen.offset = 0;
|
|
29
|
+
state.activityDetail = undefined;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (key === "pageup" || key === "pagedown") {
|
|
33
|
+
screen.manualScroll = true;
|
|
34
|
+
screen.offset = Math.max(0, screen.offset + (key === "pageup" ? -8 : 8));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (key === "x") {
|
|
38
|
+
screen.expanded = !screen.expanded;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
21
41
|
if (key === "a") return "auto";
|
|
22
42
|
if (key === "q" || key === "ctrl-c") return "quit";
|
|
23
43
|
if (key === ":") return "command";
|
|
24
44
|
if (screen.view === "settings" && (key === "return" || key === "d")) return "setting";
|
|
25
45
|
if (key === "escape") {
|
|
26
46
|
screen.view = screen.view === "version-details" ? "versions" : "main";
|
|
47
|
+
if (screen.view === "main" && screen.destination === "settings") screen.destination = "now";
|
|
27
48
|
state.activityDetail = undefined;
|
|
28
49
|
screen.offset = 0;
|
|
29
50
|
} else if (key === "?" || key === "m" || key === "v" || key === "s") {
|
|
30
51
|
screen.view = key === "?" ? "help" : key === "v" ? "versions" : key === "s" ? "settings" : "models";
|
|
52
|
+
if (key === "s") screen.destination = "settings";
|
|
31
53
|
state.activityDetail = undefined;
|
|
32
54
|
screen.offset = 0;
|
|
33
55
|
} else if (key === "return" || key === "d") {
|
|
34
56
|
screen.view = screen.view === "versions" ? "version-details" : "details";
|
|
35
57
|
screen.offset = 0;
|
|
36
58
|
} else if (["up", "down", "j", "k"].includes(key)) {
|
|
59
|
+
screen.manualScroll = false;
|
|
37
60
|
const delta = key === "up" || key === "k" ? -1 : 1;
|
|
38
61
|
if (screen.view === "settings") {
|
|
39
62
|
const index = DASHBOARD_SETTING_KEYS.indexOf(screen.settingKey ?? "auto");
|
|
@@ -53,8 +76,12 @@ export function createDashboardDisplayControls(details: boolean, ledger: boolean
|
|
|
53
76
|
state.activityDetail = undefined;
|
|
54
77
|
}
|
|
55
78
|
} else if (key === "tab") {
|
|
79
|
+
screen.selections ??= {};
|
|
80
|
+
if (screen.selectedKey)
|
|
81
|
+
screen.selections[`${screen.destination ?? "now"}:${state.filter ?? "everything"}`] = screen.selectedKey;
|
|
56
82
|
const filters = ["everything", "agents", "skills", "needs-you"] as const;
|
|
57
83
|
state.filter = filters[(filters.indexOf(state.filter ?? "everything") + 1) % filters.length];
|
|
84
|
+
screen.selectedKey = screen.selections[`${screen.destination ?? "now"}:${state.filter}`];
|
|
58
85
|
screen.view = "main";
|
|
59
86
|
state.activityDetail = undefined;
|
|
60
87
|
} else if (key === "p" || key === "f") {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Small display cache: bounded metadata reads, no filesystem traversal or durable writes. */
|
|
2
|
+
import { stat } from "node:fs/promises";
|
|
3
|
+
import { readBoundedTextSync } from "../kernel/bounded-read-sync.ts";
|
|
4
|
+
import { parseActivityTimeline, detailForTimeline } from "./activity-timeline.ts";
|
|
5
|
+
const MAX_BYTES = 2 * 1024 * 1024;
|
|
6
|
+
const files = new Map<
|
|
7
|
+
string,
|
|
8
|
+
{ checked: number; identity: string; text: string; timeline?: ReturnType<typeof parseActivityTimeline> }
|
|
9
|
+
>();
|
|
10
|
+
export async function dashboardFile(path: string, now = Date.now()): Promise<string> {
|
|
11
|
+
const cached = files.get(path);
|
|
12
|
+
if (cached && now - cached.checked < 1000) return cached.text;
|
|
13
|
+
const s = await stat(path);
|
|
14
|
+
if (!s.isFile() || s.size > MAX_BYTES)
|
|
15
|
+
throw Error("Dashboard metadata file unavailable or exceeds 2 MiB; no full-history restore");
|
|
16
|
+
const identity = `${s.dev}:${s.ino}:${s.size}:${s.mtimeMs}:${s.ctimeMs}`;
|
|
17
|
+
if (cached?.identity === identity) {
|
|
18
|
+
cached.checked = now;
|
|
19
|
+
return cached.text;
|
|
20
|
+
}
|
|
21
|
+
const text = readBoundedTextSync(path, { maxBytes: MAX_BYTES }).text;
|
|
22
|
+
files.set(path, { checked: now, identity, text });
|
|
23
|
+
while (files.size > 4) files.delete(files.keys().next().value!);
|
|
24
|
+
return text;
|
|
25
|
+
}
|
|
26
|
+
export function dashboardTimeline(path: string, text: string) {
|
|
27
|
+
const cached = files.get(path);
|
|
28
|
+
if (cached?.text === text) return (cached.timeline ??= parseActivityTimeline(text));
|
|
29
|
+
return parseActivityTimeline(text);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// One explicit selection, read once. A fresh p/f selection obtains a new checked snapshot.
|
|
33
|
+
let detail: { selection: object; source: string; key: string; value: ReturnType<typeof detailForTimeline> } | undefined;
|
|
34
|
+
export function dashboardSelectedDetail(selection: { field: "prompt" | "final" }, source: string, key: string) {
|
|
35
|
+
if (detail?.selection !== selection || detail.source !== source || detail.key !== key)
|
|
36
|
+
detail = { selection, source, key, value: detailForTimeline(source, key, selection.field) };
|
|
37
|
+
return detail.value;
|
|
38
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/** Six current-session destinations share stable row identities; contributions are labels, never authority. */
|
|
2
|
+
import type { DashboardContribution } from "../kernel/dashboard-observation.ts";
|
|
3
|
+
import type { DashboardItem, DashboardScreenOptions } from "./dashboard-screen.ts";
|
|
4
|
+
import { dashboardText } from "./dashboard-screen.ts";
|
|
5
|
+
import { activityTaskKey } from "./activity-timeline.ts";
|
|
6
|
+
import { truncate, cellWidth } from "./dashboard-render.ts";
|
|
7
|
+
export type DashboardDestination = "now" | "work" | "reviews" | "activity" | "evidence" | "settings";
|
|
8
|
+
export const DASHBOARD_DESTINATIONS: DashboardDestination[] = [
|
|
9
|
+
"now",
|
|
10
|
+
"work",
|
|
11
|
+
"reviews",
|
|
12
|
+
"activity",
|
|
13
|
+
"evidence",
|
|
14
|
+
"settings",
|
|
15
|
+
];
|
|
16
|
+
const clean = (s: string) => dashboardText(s).replace(/\s+/g, " ").trim();
|
|
17
|
+
const row = (item: DashboardContribution, key: string, source: string, stale = false): DashboardItem => ({
|
|
18
|
+
key,
|
|
19
|
+
label: item.label,
|
|
20
|
+
status: stale ? "last-observed" : item.state,
|
|
21
|
+
elapsed: "",
|
|
22
|
+
agent: item.kind === "work",
|
|
23
|
+
details: [
|
|
24
|
+
`Source: ${source}`,
|
|
25
|
+
`Observed state: ${item.state}${stale ? " (stale/disconnected)" : ""}`,
|
|
26
|
+
...(item.details ?? []),
|
|
27
|
+
...(item.reference ? [`Reference: ${item.reference}`] : []),
|
|
28
|
+
...(item.kind === "review" ? ["A reported judgment is not execution authority or overall task acceptance."] : []),
|
|
29
|
+
"Reported observations do not grant execution authority or task approval.",
|
|
30
|
+
...(stale ? ["Current liveness/applicability unknown; no automatic retry."] : []),
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
export function sessionDashboardItems(options: DashboardScreenOptions): DashboardItem[] {
|
|
34
|
+
const observed = options.session!.observation!;
|
|
35
|
+
const destination = options.screen.destination ?? "now";
|
|
36
|
+
const staleOwner = options.connected === false;
|
|
37
|
+
const now = options.now?.getTime() ?? Date.now();
|
|
38
|
+
const wanted =
|
|
39
|
+
destination === "work"
|
|
40
|
+
? ["work"]
|
|
41
|
+
: destination === "reviews"
|
|
42
|
+
? ["review"]
|
|
43
|
+
: destination === "evidence"
|
|
44
|
+
? ["evidence"]
|
|
45
|
+
: destination === "activity"
|
|
46
|
+
? ["status"]
|
|
47
|
+
: ["work", "status"];
|
|
48
|
+
const published = observed.sources.flatMap((source) =>
|
|
49
|
+
source.items
|
|
50
|
+
.filter(
|
|
51
|
+
(item) =>
|
|
52
|
+
wanted.includes(item.kind) &&
|
|
53
|
+
!(source.producer === "daddy-initiative" && item.id === "scope" && ["now", "work"].includes(destination)),
|
|
54
|
+
)
|
|
55
|
+
.map((item) =>
|
|
56
|
+
row(
|
|
57
|
+
item,
|
|
58
|
+
`source:${source.producer}:${source.generation}:${item.id}`,
|
|
59
|
+
`${source.producer}@${source.producerVersion} · seq ${source.sequence} · ${source.observedAt}`,
|
|
60
|
+
staleOwner || source.availability === "closed" || now - Date.parse(source.observedAt) > source.staleAfterMs,
|
|
61
|
+
),
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
if (destination === "reviews") return published;
|
|
65
|
+
if (destination === "evidence")
|
|
66
|
+
return [
|
|
67
|
+
...(observed.artifacts ?? []).map((a) => ({
|
|
68
|
+
key: `artifact:${a.executionId}`,
|
|
69
|
+
label: a.operationId,
|
|
70
|
+
status: "retained",
|
|
71
|
+
elapsed: "",
|
|
72
|
+
details: [
|
|
73
|
+
`Producer: pi-daddy`,
|
|
74
|
+
`Execution: ${a.executionId}`,
|
|
75
|
+
`Manifest SHA-256: ${a.sha256}`,
|
|
76
|
+
"Producer reference observed in this session; payload not loaded by the dashboard.",
|
|
77
|
+
"Retained is not reviewed, applicable or approved. Use the authorized artifact resolver for content.",
|
|
78
|
+
],
|
|
79
|
+
})),
|
|
80
|
+
...published,
|
|
81
|
+
];
|
|
82
|
+
if (destination === "activity")
|
|
83
|
+
return [
|
|
84
|
+
...(observed.activity ?? [])
|
|
85
|
+
.slice()
|
|
86
|
+
.reverse()
|
|
87
|
+
.map((item) =>
|
|
88
|
+
row(item, `activity:${observed.generation}:${item.id}`, `Pi owner · ${observed.sessionId}`, staleOwner),
|
|
89
|
+
),
|
|
90
|
+
...published,
|
|
91
|
+
];
|
|
92
|
+
const native = options.items.map((item) =>
|
|
93
|
+
staleOwner
|
|
94
|
+
? {
|
|
95
|
+
...item,
|
|
96
|
+
status: "last-observed",
|
|
97
|
+
details: [...item.details, "Owner disconnected; current child liveness is unknown."],
|
|
98
|
+
}
|
|
99
|
+
: item,
|
|
100
|
+
);
|
|
101
|
+
const activity = options.session?.activity;
|
|
102
|
+
const parentShown =
|
|
103
|
+
activity && native.some((item) => item.taskKey === activityTaskKey(activity.rootId, activity.taskId));
|
|
104
|
+
return [
|
|
105
|
+
...(observed.turn && !parentShown
|
|
106
|
+
? [row(observed.turn, `owner:${observed.generation}:${observed.turn.id}`, "Pi owner", staleOwner)]
|
|
107
|
+
: []),
|
|
108
|
+
...native,
|
|
109
|
+
...published,
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
export function sessionPanelLines(options: DashboardScreenOptions, items: DashboardItem[], width: number): string[] {
|
|
113
|
+
const observation = options.session!.observation!,
|
|
114
|
+
screen = options.screen;
|
|
115
|
+
const destination = screen.destination ?? "now";
|
|
116
|
+
const sourceRows = observation.sources.flatMap((s) => s.items.map((item) => ({ source: s, item })));
|
|
117
|
+
const lines: string[] = [`${destination.toUpperCase()} · CURRENT SESSION`];
|
|
118
|
+
const staleSource = (source: (typeof observation.sources)[number]) =>
|
|
119
|
+
options.connected === false ||
|
|
120
|
+
source.availability === "closed" ||
|
|
121
|
+
(options.now?.getTime() ?? Date.now()) - Date.parse(source.observedAt) > source.staleAfterMs;
|
|
122
|
+
const initiative = observation.sources.find((source) => source.producer === "daddy-initiative");
|
|
123
|
+
const scope = initiative?.items.find((item) => item.id === "scope");
|
|
124
|
+
if (scope && (destination === "now" || destination === "work")) {
|
|
125
|
+
lines.push(`SELECTED ${scope.label}${staleSource(initiative!) ? " (last observed)" : ""}`);
|
|
126
|
+
if (destination === "work" && scope.details?.[1]) lines.push(scope.details[1]);
|
|
127
|
+
}
|
|
128
|
+
if (destination === "now") {
|
|
129
|
+
const goal = sourceRows.find((x) => x.item.kind === "goal");
|
|
130
|
+
lines.push(
|
|
131
|
+
"GOAL",
|
|
132
|
+
goal
|
|
133
|
+
? `${goal.item.label} (${goal.source.producer}${staleSource(goal.source) ? "; stale" : ""})`
|
|
134
|
+
: (options.current ?? "Goal not reported; no inference from a finished step."),
|
|
135
|
+
);
|
|
136
|
+
const next = sourceRows.find((x) => x.item.kind === "next");
|
|
137
|
+
const nextStale =
|
|
138
|
+
next &&
|
|
139
|
+
(options.connected === false ||
|
|
140
|
+
next.source.availability === "closed" ||
|
|
141
|
+
(options.now?.getTime() ?? Date.now()) - Date.parse(next.source.observedAt) > next.source.staleAfterMs);
|
|
142
|
+
lines.push(
|
|
143
|
+
"NEXT",
|
|
144
|
+
next
|
|
145
|
+
? `${next.item.label} (${next.source.producer}${nextStale ? "; stale" : ""})`
|
|
146
|
+
: "No coordinator recommendation reported.",
|
|
147
|
+
);
|
|
148
|
+
const attention = items.filter((x) =>
|
|
149
|
+
[
|
|
150
|
+
"failed",
|
|
151
|
+
"refused",
|
|
152
|
+
"incomplete",
|
|
153
|
+
"unknown",
|
|
154
|
+
"unavailable",
|
|
155
|
+
"needs-you",
|
|
156
|
+
"approval-wait",
|
|
157
|
+
"dependency-wait",
|
|
158
|
+
"cancel-requested",
|
|
159
|
+
].includes(x.status),
|
|
160
|
+
);
|
|
161
|
+
if (attention.length) {
|
|
162
|
+
lines.push(`ATTENTION · ${attention.length}`);
|
|
163
|
+
for (const item of attention.slice(0, 3)) lines.push(`${item.label} · ${item.status}`);
|
|
164
|
+
}
|
|
165
|
+
const result = [...items].reverse().find((x) => ["settled", "finished", "completed"].includes(x.status));
|
|
166
|
+
if (result) lines.push(`LATEST UPDATE · ${result.label} (${result.status})`);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (!items.length)
|
|
170
|
+
lines.push(
|
|
171
|
+
destination === "reviews"
|
|
172
|
+
? "No review producer observations available."
|
|
173
|
+
: destination === "evidence"
|
|
174
|
+
? "No current-session result references observed."
|
|
175
|
+
: "No observations for this view.",
|
|
176
|
+
);
|
|
177
|
+
const selected = items.find((x) => x.key === screen.selectedKey);
|
|
178
|
+
const rows = items.map(
|
|
179
|
+
(x) =>
|
|
180
|
+
`${x.key === screen.selectedKey ? ">" : " "} ${clean(x.label)} · ${clean(x.status)}${x.elapsed ? " " + x.elapsed : ""}`,
|
|
181
|
+
);
|
|
182
|
+
const expanded = screen.expanded && width >= 96;
|
|
183
|
+
if (expanded && rows.length) {
|
|
184
|
+
const left = Math.floor(width * 0.45),
|
|
185
|
+
right = width - left - 3;
|
|
186
|
+
const details = [selected ? `DETAIL · ${clean(selected.label)}` : "DETAIL", ...(selected?.details ?? [])];
|
|
187
|
+
const length = Math.max(rows.length, details.length);
|
|
188
|
+
for (let i = 0; i < length; i++) {
|
|
189
|
+
const a = truncate(clean(rows[i] ?? ""), left);
|
|
190
|
+
lines.push(a + " ".repeat(Math.max(0, left - cellWidth(a))) + " | " + truncate(clean(details[i] ?? ""), right));
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
lines.push(...rows);
|
|
194
|
+
if (screen.expanded) lines.push("Expanded layout needs 96 columns; same selection retained.");
|
|
195
|
+
}
|
|
196
|
+
if (destination === "now") {
|
|
197
|
+
lines.push("COMPONENTS");
|
|
198
|
+
for (const producer of ["principal", "bookie", "scout", "skill-harness"]) {
|
|
199
|
+
const streams = observation.sources.filter(
|
|
200
|
+
(x) => x.producer === producer || (producer === "scout" && x.producer.startsWith("scout-")),
|
|
201
|
+
);
|
|
202
|
+
const stale = streams.filter(
|
|
203
|
+
(s) =>
|
|
204
|
+
options.connected === false ||
|
|
205
|
+
s.availability === "closed" ||
|
|
206
|
+
(options.now?.getTime() ?? Date.now()) - Date.parse(s.observedAt) > s.staleAfterMs,
|
|
207
|
+
).length;
|
|
208
|
+
const status = !streams.length
|
|
209
|
+
? "status adapter unavailable"
|
|
210
|
+
: `${streams.length - stale} observed${stale ? `; ${stale} last observed / stale` : ""}`;
|
|
211
|
+
lines.push(`${producer}: ${status}`);
|
|
212
|
+
}
|
|
213
|
+
const resource = observation.resources;
|
|
214
|
+
lines.push(`Parent RSS: ${(resource.rssBytes / 1024 / 1024).toFixed(1)} MiB`, "Host and child memory: unknown");
|
|
215
|
+
}
|
|
216
|
+
return lines;
|
|
217
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sessionDashboardItems, sessionPanelLines, type DashboardDestination } from "./dashboard-panels.ts";
|
|
1
2
|
import { dashboardSettingsLines, type DashboardSettingKey } from "./dashboard-settings.ts";
|
|
2
3
|
/** Height-bounded, task-first view. Permission state is always supplied by the owner. */
|
|
3
4
|
import type { EcosystemVersionRow } from "./ecosystem-versions.ts";
|
|
@@ -21,6 +22,10 @@ export interface DashboardItem {
|
|
|
21
22
|
}
|
|
22
23
|
export interface DashboardScreenState {
|
|
23
24
|
view: "main" | "details" | "models" | "help" | "versions" | "version-details" | "settings";
|
|
25
|
+
destination?: DashboardDestination;
|
|
26
|
+
expanded?: boolean;
|
|
27
|
+
manualScroll?: boolean;
|
|
28
|
+
selections?: Record<string, string>;
|
|
24
29
|
settingKey?: DashboardSettingKey;
|
|
25
30
|
versionId?: EcosystemVersionRow["id"];
|
|
26
31
|
versionRows?: EcosystemVersionRow[];
|
|
@@ -39,17 +44,26 @@ function wrapped(lines: string[], width: number): string[] {
|
|
|
39
44
|
return lines.flatMap((line) => {
|
|
40
45
|
const result: string[] = [];
|
|
41
46
|
let row = "";
|
|
42
|
-
for (const
|
|
43
|
-
if (row && cellWidth(row +
|
|
47
|
+
for (const word of dashboardText(line).split(/\s+/)) {
|
|
48
|
+
if (row && cellWidth(row + " " + word) > width) {
|
|
44
49
|
result.push(row);
|
|
45
50
|
row = "";
|
|
46
51
|
}
|
|
47
|
-
|
|
52
|
+
if (cellWidth(word) > width) {
|
|
53
|
+
for (const character of word) {
|
|
54
|
+
if (row && cellWidth(row + character) > width) {
|
|
55
|
+
result.push(row);
|
|
56
|
+
row = "";
|
|
57
|
+
}
|
|
58
|
+
row += character;
|
|
59
|
+
}
|
|
60
|
+
} else row += (row ? " " : "") + word;
|
|
48
61
|
}
|
|
49
62
|
result.push(row);
|
|
50
63
|
return result;
|
|
51
64
|
});
|
|
52
65
|
}
|
|
66
|
+
|
|
53
67
|
function elapsed(ms: number): string {
|
|
54
68
|
const seconds = Math.max(0, Math.floor(ms / 1000));
|
|
55
69
|
const minutes = Math.floor(seconds / 60);
|
|
@@ -157,6 +171,9 @@ export interface DashboardScreenOptions {
|
|
|
157
171
|
color?: boolean;
|
|
158
172
|
content?: { title: string; text: string };
|
|
159
173
|
command?: string;
|
|
174
|
+
connected?: boolean;
|
|
175
|
+
acknowledgment?: string;
|
|
176
|
+
now?: Date;
|
|
160
177
|
}
|
|
161
178
|
/** Selection follows stable identity through refresh, never an unrelated task at the old row index. */
|
|
162
179
|
export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
@@ -178,7 +195,11 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
178
195
|
"Use the owner's prompt, or a to enable Auto.",
|
|
179
196
|
],
|
|
180
197
|
}));
|
|
181
|
-
const
|
|
198
|
+
const modern = Boolean(session?.observation);
|
|
199
|
+
const allItems = [
|
|
200
|
+
...(!modern || ["now", "work"].includes(screen.destination ?? "now") ? approvals : []),
|
|
201
|
+
...(modern ? sessionDashboardItems(options) : options.items),
|
|
202
|
+
];
|
|
182
203
|
const items = allItems.filter((item) =>
|
|
183
204
|
options.filter === "agents"
|
|
184
205
|
? item.agent
|
|
@@ -191,7 +212,7 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
191
212
|
const live = items.filter((item) => active(item.status)),
|
|
192
213
|
needsAttention = items.filter((item) => attention(item.status)),
|
|
193
214
|
past = items.filter((item) => !active(item.status) && !attention(item.status)).reverse();
|
|
194
|
-
screen.items = [...live, ...needsAttention, ...(options.history ? past : [])];
|
|
215
|
+
screen.items = modern ? items : [...live, ...needsAttention, ...(options.history ? past : [])];
|
|
195
216
|
if (screen.view === "details" && !screen.items.some((item) => item.key === screen.selectedKey)) {
|
|
196
217
|
const detail = items.find((item) => item.key === screen.selectedKey);
|
|
197
218
|
if (detail) screen.items.push(detail);
|
|
@@ -202,26 +223,40 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
202
223
|
screen.versionRows = session?.versions?.rows ?? [];
|
|
203
224
|
if (!screen.versionRows.some((row) => row.id === screen.versionId)) screen.versionId = screen.versionRows[0]?.id;
|
|
204
225
|
const selectedVersion = screen.versionRows.find((row) => row.id === screen.versionId);
|
|
205
|
-
const mode =
|
|
226
|
+
const mode =
|
|
227
|
+
session && options.connected !== false ? `Auto ${session.auto.enabled ? "ON" : "OFF"}` : "Auto unavailable";
|
|
206
228
|
const header = `PI DADDY | ${mode}${options.pending ? " …" : session ? " [a]" : ""}`;
|
|
207
229
|
const footer =
|
|
208
230
|
options.command !== undefined
|
|
209
231
|
? [`: ${clean(options.command)}`]
|
|
210
232
|
: screen.view === "settings"
|
|
211
|
-
? ["↑↓ select · Enter toggle/edit · Esc back", "0
|
|
233
|
+
? ["↑↓ select · Enter toggle/edit · Esc back", "0 default limit · PgUp/PgDn scroll · s settings"]
|
|
212
234
|
: screen.view === "main" || screen.view === "versions"
|
|
213
|
-
? [
|
|
235
|
+
? [
|
|
236
|
+
modern ? "↑↓ select · PgUp/PgDn scroll · Enter details" : "↑↓ select · Enter details · a Auto",
|
|
237
|
+
"m models · v versions · s settings · ?",
|
|
238
|
+
]
|
|
214
239
|
: [
|
|
215
240
|
"↑↓ scroll · Esc back · a Auto",
|
|
216
241
|
screen.view === "details" ? "p prompt · f final · : command · ? help" : ": command · ? help",
|
|
217
242
|
];
|
|
218
243
|
const fixed = [
|
|
219
244
|
header,
|
|
220
|
-
session
|
|
245
|
+
session && options.connected !== false
|
|
221
246
|
? `Permissions connected${pending.length ? ` · ${pending.length} needs you` : ""}`
|
|
222
247
|
: "Permission controls disconnected",
|
|
248
|
+
...(modern
|
|
249
|
+
? [
|
|
250
|
+
width >= 74
|
|
251
|
+
? "1 Now · 2 Work · 3 Reviews · 4 Activity · 5 Evidence · 6 Settings"
|
|
252
|
+
: `${(screen.destination ?? "now").toUpperCase()} · 1–6 views · x expand`,
|
|
253
|
+
]
|
|
254
|
+
: []),
|
|
223
255
|
];
|
|
224
256
|
if (options.notice || options.problem) fixed.push(`! ${clean(options.notice || options.problem || "")}`);
|
|
257
|
+
if (options.acknowledgment) fixed.push(clean(options.acknowledgment));
|
|
258
|
+
if (modern && options.connected === false)
|
|
259
|
+
fixed.push(`LAST OBSERVED: ${session!.observation!.observedAt}; live state unknown`);
|
|
225
260
|
const body: string[] = [];
|
|
226
261
|
if (screen.view === "help")
|
|
227
262
|
body.push(
|
|
@@ -229,6 +264,13 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
229
264
|
"↑/↓ or j/k: select; Enter/d: details",
|
|
230
265
|
"a: toggle Daddy permission Auto",
|
|
231
266
|
"m: session models; v: ecosystem versions; s: settings",
|
|
267
|
+
"1–6: Now / Work / Reviews / Activity / Evidence / Settings",
|
|
268
|
+
"x: compact/expanded (96 columns); selection is preserved",
|
|
269
|
+
"No cancellation shortcut: request it in the owning Pi session.",
|
|
270
|
+
"Goals/next steps are owner recommendations, not execution authority.",
|
|
271
|
+
"Reviews apply only to their exact subject; completed is not accepted.",
|
|
272
|
+
"Evidence rows are references; content needs its authorized resolver.",
|
|
273
|
+
"Memory sample covers the parent only; host/child memory is unknown.",
|
|
232
274
|
"h: show/hide finished history",
|
|
233
275
|
"Tab: Everything / Agents / Skills / Needs-you",
|
|
234
276
|
"p/f: selected retained prompt/final",
|
|
@@ -240,7 +282,21 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
240
282
|
"Finished means observed completion, not acceptance.",
|
|
241
283
|
);
|
|
242
284
|
else if (screen.view === "settings") {
|
|
243
|
-
body.push(
|
|
285
|
+
body.push(
|
|
286
|
+
...dashboardSettingsLines(
|
|
287
|
+
options.connected === false && session?.settings ? { ...session.settings, editable: false } : session?.settings,
|
|
288
|
+
session?.auto.enabled,
|
|
289
|
+
screen.settingKey ?? "auto",
|
|
290
|
+
),
|
|
291
|
+
);
|
|
292
|
+
if (session?.observation)
|
|
293
|
+
body.push(
|
|
294
|
+
"CAPTURE · startup configuration (not a retention receipt)",
|
|
295
|
+
`Transcripts: ${session.observation.capture.transcripts ? "configured" : "off"}`,
|
|
296
|
+
`Diagnostics: ${session.observation.capture.diagnostics ? "configured" : "off"}`,
|
|
297
|
+
"Capture changes require a new parent launch.",
|
|
298
|
+
"m models · v versions",
|
|
299
|
+
);
|
|
244
300
|
} else if (screen.view === "versions" || screen.view === "version-details") {
|
|
245
301
|
body.push("VERSIONS");
|
|
246
302
|
if (!session?.versions) body.push("Owner has not reported versions.");
|
|
@@ -278,6 +334,8 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
278
334
|
...(selected?.details ?? []),
|
|
279
335
|
);
|
|
280
336
|
if (options.content) body.push("", options.content.title, ...options.content.text.split(/\r?\n/));
|
|
337
|
+
} else if (modern) {
|
|
338
|
+
body.push(...sessionPanelLines(options, screen.items, width));
|
|
281
339
|
} else {
|
|
282
340
|
const requestFinished = options.currentStatus && !active(options.currentStatus);
|
|
283
341
|
body.push(
|
|
@@ -323,21 +381,34 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
323
381
|
if (history) body.push(history);
|
|
324
382
|
}
|
|
325
383
|
|
|
326
|
-
const detailBody =
|
|
384
|
+
const detailBody =
|
|
385
|
+
(screen.view === "main" && (!modern || (screen.expanded && width >= 96))) || screen.view === "versions"
|
|
386
|
+
? body
|
|
387
|
+
: wrapped(body, width);
|
|
388
|
+
const clipped = modern && detailBody.length > Math.max(0, height - fixed.length - footer.length);
|
|
389
|
+
if (clipped) footer.push("");
|
|
327
390
|
const room = Math.max(0, height - fixed.length - footer.length);
|
|
328
391
|
if (screen.view === "versions" && selectedVersion && room > 0) {
|
|
329
392
|
const row = 2 + screen.versionRows.findIndex((value) => value.id === screen.versionId) * 2;
|
|
330
393
|
if (row < screen.offset) screen.offset = row;
|
|
331
394
|
else if (row + 1 >= screen.offset + room) screen.offset = Math.max(0, row + 2 - room);
|
|
332
395
|
}
|
|
333
|
-
if (screen.view === "settings" && room > 0) {
|
|
396
|
+
if (screen.view === "settings" && room > 0 && !screen.manualScroll) {
|
|
334
397
|
const row = detailBody.findIndex((line) => line.startsWith(">"));
|
|
335
398
|
if (row < screen.offset) screen.offset = Math.max(0, row);
|
|
336
399
|
else if (row >= screen.offset + room) screen.offset = Math.max(0, row - room + 1);
|
|
337
400
|
}
|
|
401
|
+
if (modern && screen.view === "main" && room > 0 && !screen.manualScroll) {
|
|
402
|
+
const selectedRow = detailBody.findIndex((line) => line.startsWith(">"));
|
|
403
|
+
if (selectedRow >= screen.offset + room) screen.offset = selectedRow - room + 1;
|
|
404
|
+
else if (selectedRow >= 0 && selectedRow < screen.offset) screen.offset = selectedRow;
|
|
405
|
+
}
|
|
338
406
|
const offset =
|
|
339
|
-
screen.view === "main" ? 0 : Math.max(0, Math.min(screen.offset, Math.max(0, detailBody.length - room)));
|
|
407
|
+
screen.view === "main" && !modern ? 0 : Math.max(0, Math.min(screen.offset, Math.max(0, detailBody.length - room)));
|
|
340
408
|
screen.offset = offset;
|
|
409
|
+
if (clipped)
|
|
410
|
+
footer[footer.length - 1] =
|
|
411
|
+
`Rows ${offset + 1}–${Math.min(offset + room, detailBody.length)}/${detailBody.length} · PgUp/PgDn`;
|
|
341
412
|
const lines = [...fixed, ...detailBody.slice(offset, offset + room)];
|
|
342
413
|
while (lines.length < height - footer.length) lines.push("");
|
|
343
414
|
const output =
|
|
@@ -348,10 +419,29 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
348
419
|
.map((line, index) => {
|
|
349
420
|
const safe = truncate(dashboardText(line), width);
|
|
350
421
|
if (!options.color) return safe;
|
|
351
|
-
const section =
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
422
|
+
const section = [
|
|
423
|
+
"NOW",
|
|
424
|
+
"WORK",
|
|
425
|
+
"REVIEWS",
|
|
426
|
+
"ACTIVITY",
|
|
427
|
+
"EVIDENCE",
|
|
428
|
+
"GOAL",
|
|
429
|
+
"NEXT",
|
|
430
|
+
"COMPONENTS",
|
|
431
|
+
"CURRENT REQUEST",
|
|
432
|
+
"LATEST REQUEST",
|
|
433
|
+
"CURRENT WORK",
|
|
434
|
+
"NEEDS YOU",
|
|
435
|
+
"NEEDS ATTENTION",
|
|
436
|
+
"WORK IN PROGRESS",
|
|
437
|
+
"HISTORY",
|
|
438
|
+
"VERSIONS",
|
|
439
|
+
"SETTINGS",
|
|
440
|
+
"STARTUP LIMITS",
|
|
441
|
+
"SESSION MODELS",
|
|
442
|
+
"DASHBOARD KEYS",
|
|
443
|
+
"MANAGE",
|
|
444
|
+
].some((label) => safe.startsWith(label));
|
|
355
445
|
const code =
|
|
356
446
|
index === 0
|
|
357
447
|
? "1;36"
|