pi-daddy 0.51.0 → 0.53.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 +11 -0
- package/README.md +33 -42
- package/dist/governance/approval-prompt.d.ts +4 -0
- package/dist/governance/approval-prompt.d.ts.map +1 -1
- package/dist/governance/approval-prompt.js +4 -5
- package/dist/governance/approval-prompt.js.map +1 -1
- package/dist/governance/permission-question.d.ts +4 -0
- package/dist/governance/permission-question.d.ts.map +1 -0
- package/dist/governance/permission-question.js +102 -0
- package/dist/governance/permission-question.js.map +1 -0
- package/dist/kernel/chain.d.ts +1 -0
- package/dist/kernel/chain.d.ts.map +1 -1
- package/dist/kernel/chain.js.map +1 -1
- package/dist/kernel/dashboard-observation.d.ts +15 -5
- package/dist/kernel/dashboard-observation.d.ts.map +1 -1
- package/dist/kernel/dashboard-observation.js.map +1 -1
- package/dist/products/activity-summary.d.ts +8 -0
- package/dist/products/activity-summary.d.ts.map +1 -0
- package/dist/products/activity-summary.js +101 -0
- package/dist/products/activity-summary.js.map +1 -0
- package/dist/products/activity-timeline.d.ts +4 -1
- package/dist/products/activity-timeline.d.ts.map +1 -1
- package/dist/products/activity-timeline.js +9 -1
- package/dist/products/activity-timeline.js.map +1 -1
- package/dist/products/dashboard-activity.d.ts +9 -0
- package/dist/products/dashboard-activity.d.ts.map +1 -0
- package/dist/products/dashboard-activity.js +119 -0
- package/dist/products/dashboard-activity.js.map +1 -0
- package/dist/products/dashboard-cli.d.ts +2 -1
- package/dist/products/dashboard-cli.d.ts.map +1 -1
- package/dist/products/dashboard-cli.js +28 -6
- package/dist/products/dashboard-cli.js.map +1 -1
- package/dist/products/dashboard-components.d.ts +10 -0
- package/dist/products/dashboard-components.d.ts.map +1 -0
- package/dist/products/dashboard-components.js +196 -0
- package/dist/products/dashboard-components.js.map +1 -0
- package/dist/products/dashboard-display-controls.js +3 -3
- package/dist/products/dashboard-display-controls.js.map +1 -1
- package/dist/products/dashboard-handshake.d.ts +2 -0
- package/dist/products/dashboard-handshake.d.ts.map +1 -1
- package/dist/products/dashboard-handshake.js +39 -43
- package/dist/products/dashboard-handshake.js.map +1 -1
- package/dist/products/dashboard-herdr.d.ts.map +1 -1
- package/dist/products/dashboard-herdr.js +7 -1
- package/dist/products/dashboard-herdr.js.map +1 -1
- package/dist/products/dashboard-layout.js +20 -4
- package/dist/products/dashboard-layout.js.map +1 -1
- package/dist/products/dashboard-panels.d.ts.map +1 -1
- package/dist/products/dashboard-panels.js +128 -67
- package/dist/products/dashboard-panels.js.map +1 -1
- package/dist/products/dashboard-recap.d.ts +1 -1
- package/dist/products/dashboard-recap.d.ts.map +1 -1
- package/dist/products/dashboard-recap.js +12 -16
- package/dist/products/dashboard-recap.js.map +1 -1
- package/dist/products/dashboard-screen.d.ts +6 -2
- package/dist/products/dashboard-screen.d.ts.map +1 -1
- package/dist/products/dashboard-screen.js +104 -37
- package/dist/products/dashboard-screen.js.map +1 -1
- package/dist/products/dashboard-session-client.d.ts +10 -6
- package/dist/products/dashboard-session-client.d.ts.map +1 -1
- package/dist/products/dashboard-session-client.js +14 -10
- package/dist/products/dashboard-session-client.js.map +1 -1
- package/dist/products/dashboard-settings.d.ts +10 -1
- package/dist/products/dashboard-settings.d.ts.map +1 -1
- package/dist/products/dashboard-settings.js +26 -1
- package/dist/products/dashboard-settings.js.map +1 -1
- package/dist/products/ecosystem-versions.d.ts +2 -0
- package/dist/products/ecosystem-versions.d.ts.map +1 -1
- package/extensions/activity-timeline.ts +7 -1
- package/extensions/approvals.ts +7 -0
- package/extensions/dashboard-live.ts +45 -5
- package/extensions/dashboard-observation.ts +1 -3
- package/extensions/dashboard-session-server.ts +6 -1
- package/extensions/dashboard-settings.ts +15 -1
- package/extensions/delegate-chain.ts +2 -0
- package/extensions/delegation-artifacts.ts +26 -4
- package/extensions/delegation-operations.ts +12 -4
- package/extensions/delegation.ts +4 -0
- package/extensions/ecosystem-versions.ts +25 -3
- package/extensions/execute-child.ts +4 -0
- package/extensions/grants.ts +10 -4
- package/extensions/run-delegation.ts +2 -0
- package/extensions/runtime-snapshot.ts +8 -4
- package/extensions/session-report.ts +4 -0
- package/extensions/session.ts +4 -3
- package/package.json +2 -2
- package/src/governance/approval-prompt.ts +7 -6
- package/src/governance/permission-question.ts +108 -0
- package/src/kernel/chain.ts +1 -0
- package/src/kernel/dashboard-observation.ts +15 -1
- package/src/products/activity-summary.ts +101 -0
- package/src/products/activity-timeline.ts +11 -0
- package/src/products/dashboard-activity.ts +136 -0
- package/src/products/dashboard-cli.ts +37 -8
- package/src/products/dashboard-components.ts +219 -0
- package/src/products/dashboard-display-controls.ts +3 -3
- package/src/products/dashboard-handshake.ts +45 -49
- package/src/products/dashboard-herdr.ts +9 -1
- package/src/products/dashboard-layout.ts +27 -6
- package/src/products/dashboard-panels.ts +128 -76
- package/src/products/dashboard-recap.ts +15 -15
- package/src/products/dashboard-screen.ts +115 -39
- package/src/products/dashboard-session-client.ts +23 -12
- package/src/products/dashboard-settings.ts +36 -2
- package/src/products/ecosystem-versions.ts +2 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DashboardAcknowledgment } from "./dashboard-session-client.ts";
|
|
1
2
|
import {
|
|
2
3
|
sessionDashboardItems,
|
|
3
4
|
sessionNextLines,
|
|
@@ -5,9 +6,11 @@ import {
|
|
|
5
6
|
DASHBOARD_DESTINATIONS,
|
|
6
7
|
type DashboardDestination,
|
|
7
8
|
} from "./dashboard-panels.ts";
|
|
9
|
+
import { activityTaskTitle } from "./dashboard-activity.ts";
|
|
10
|
+
import { versionLines } from "./dashboard-components.ts";
|
|
8
11
|
import { sessionRecapLines } from "./dashboard-recap.ts";
|
|
9
12
|
import { colorSessionLine, previewWidth, sectionHeading } from "./dashboard-layout.ts";
|
|
10
|
-
import { dashboardSettingsLines, type DashboardSettingKey } from "./dashboard-settings.ts";
|
|
13
|
+
import { visibleSettingKeys, dashboardSettingsLines, type DashboardSettingKey } from "./dashboard-settings.ts";
|
|
11
14
|
/** Height-bounded, task-first view. Permission state is always supplied by the owner. */
|
|
12
15
|
import type { EcosystemVersionRow } from "./ecosystem-versions.ts";
|
|
13
16
|
import type { DashboardProjection } from "./dashboard-projection.ts";
|
|
@@ -20,9 +23,11 @@ export interface DashboardItem {
|
|
|
20
23
|
label: string;
|
|
21
24
|
status: string;
|
|
22
25
|
elapsed: string;
|
|
26
|
+
updatedAt?: string;
|
|
23
27
|
details: string[];
|
|
24
28
|
briefDetails?: string[];
|
|
25
29
|
reviewSummary?: boolean;
|
|
30
|
+
relatedReviewKey?: string;
|
|
26
31
|
observation?: string;
|
|
27
32
|
taskKey?: string;
|
|
28
33
|
timelinePath?: string;
|
|
@@ -38,6 +43,7 @@ export interface DashboardScreenState {
|
|
|
38
43
|
manualScroll?: boolean;
|
|
39
44
|
selections?: Record<string, string>;
|
|
40
45
|
settingKey?: DashboardSettingKey;
|
|
46
|
+
settingKeys?: DashboardSettingKey[];
|
|
41
47
|
versionId?: EcosystemVersionRow["id"];
|
|
42
48
|
versionRows?: EcosystemVersionRow[];
|
|
43
49
|
selectedKey?: string;
|
|
@@ -55,16 +61,18 @@ export function wrapDashboardLines(lines: string[], width: number): string[] {
|
|
|
55
61
|
return lines.flatMap((line) => {
|
|
56
62
|
const safe = dashboardText(line);
|
|
57
63
|
if (cellWidth(safe) <= width) return [safe];
|
|
64
|
+
const indent = width >= 12 && (safe.startsWith("> ") || safe.startsWith(" ")) ? safe.slice(0, 2) : "";
|
|
65
|
+
const available = width - indent.length;
|
|
58
66
|
const result: string[] = [];
|
|
59
67
|
let row = "";
|
|
60
|
-
for (const word of safe.split(/\s+/)) {
|
|
61
|
-
if (row && cellWidth(row + " " + word) >
|
|
68
|
+
for (const word of safe.slice(indent.length).split(/\s+/)) {
|
|
69
|
+
if (row && cellWidth(row + " " + word) > available) {
|
|
62
70
|
result.push(row);
|
|
63
71
|
row = "";
|
|
64
72
|
}
|
|
65
|
-
if (cellWidth(word) >
|
|
73
|
+
if (cellWidth(word) > available) {
|
|
66
74
|
for (const character of word) {
|
|
67
|
-
if (row && cellWidth(row + character) >
|
|
75
|
+
if (row && cellWidth(row + character) > available) {
|
|
68
76
|
result.push(row);
|
|
69
77
|
row = "";
|
|
70
78
|
}
|
|
@@ -73,7 +81,7 @@ export function wrapDashboardLines(lines: string[], width: number): string[] {
|
|
|
73
81
|
} else row += (row ? " " : "") + word;
|
|
74
82
|
}
|
|
75
83
|
result.push(row);
|
|
76
|
-
return result;
|
|
84
|
+
return result.map((part, i) => (i === 0 ? indent : " ".repeat(indent.length)) + part);
|
|
77
85
|
});
|
|
78
86
|
}
|
|
79
87
|
|
|
@@ -123,6 +131,7 @@ export function ledgerDashboardItems(projection: DashboardProjection): Dashboard
|
|
|
123
131
|
label: node.agentName || "Governed execution",
|
|
124
132
|
status: node.state,
|
|
125
133
|
elapsed: elapsed(node.durationMs),
|
|
134
|
+
updatedAt: node.updatedAt,
|
|
126
135
|
agent: true,
|
|
127
136
|
details: [
|
|
128
137
|
`Execution: ${node.executionId}`,
|
|
@@ -142,12 +151,16 @@ export function activityDashboardItems(
|
|
|
142
151
|
timeline: ActivityTimeline,
|
|
143
152
|
aliases: ActivityTimelineAliases,
|
|
144
153
|
now: Date,
|
|
154
|
+
human = false,
|
|
145
155
|
): DashboardItem[] {
|
|
146
156
|
return timeline.tasks.map((task) => ({
|
|
147
157
|
key: activityTaskKey(task.rootId, task.id),
|
|
148
158
|
taskKey: activityTaskKey(task.rootId, task.id),
|
|
149
|
-
label:
|
|
159
|
+
label: human
|
|
160
|
+
? activityTaskTitle(task)
|
|
161
|
+
: `${task.agent || (task.trigger?.type === "custom" ? "Extension turn" : "User turn")} [${aliases.selector(task)}]`,
|
|
150
162
|
status: task.status,
|
|
163
|
+
updatedAt: task.endedAt ?? task.lastEvent?.at ?? task.startedAt,
|
|
151
164
|
elapsed: elapsed(Date.parse(task.endedAt ?? now.toISOString()) - Date.parse(task.startedAt)),
|
|
152
165
|
observation: task.lastEvent
|
|
153
166
|
? `${task.lastEvent.tool ? `${task.lastEvent.tool} ` : ""}${task.lastEvent.kind.replaceAll("_", " ")} · ${elapsed(Date.parse(now.toISOString()) - Date.parse(task.lastEvent.at))} ago`
|
|
@@ -193,9 +206,17 @@ export interface DashboardScreenOptions {
|
|
|
193
206
|
content?: { title: string; text: string };
|
|
194
207
|
command?: string;
|
|
195
208
|
connected?: boolean;
|
|
196
|
-
acknowledgment?:
|
|
209
|
+
acknowledgment?: DashboardAcknowledgment;
|
|
197
210
|
now?: Date;
|
|
198
211
|
}
|
|
212
|
+
const destinationNames: Record<DashboardDestination, string> = {
|
|
213
|
+
now: "Overview",
|
|
214
|
+
work: "Tasks",
|
|
215
|
+
reviews: "Reviews",
|
|
216
|
+
activity: "Activity",
|
|
217
|
+
evidence: "Evidence",
|
|
218
|
+
settings: "Settings",
|
|
219
|
+
};
|
|
199
220
|
function sessionLocation(screen: DashboardScreenState, width: number): string {
|
|
200
221
|
const destination = screen.destination ?? "now";
|
|
201
222
|
const overlays = {
|
|
@@ -206,15 +227,14 @@ function sessionLocation(screen: DashboardScreenState, width: number): string {
|
|
|
206
227
|
"version-details": "Version details",
|
|
207
228
|
recap: "Session recap",
|
|
208
229
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
? "NOW · 2 Work · 3 Reviews"
|
|
214
|
-
: `${destination.toUpperCase()} · 1–6 views`;
|
|
215
|
-
return DASHBOARD_DESTINATIONS.map((view, i) =>
|
|
216
|
-
view === destination ? `[${i + 1} ${view.toUpperCase()}]` : `${i + 1} ${view[0]!.toUpperCase()}${view.slice(1)}`,
|
|
230
|
+
const name = destinationNames[destination];
|
|
231
|
+
if (screen.view in overlays) return `${name} / ${overlays[screen.view as keyof typeof overlays]}`;
|
|
232
|
+
const nav = DASHBOARD_DESTINATIONS.map((view, i) =>
|
|
233
|
+
view === destination ? `[${i + 1} ${name}]` : `${i + 1} ${destinationNames[view]}`,
|
|
217
234
|
).join(" ");
|
|
235
|
+
return cellWidth(nav) <= width
|
|
236
|
+
? nav
|
|
237
|
+
: `[${DASHBOARD_DESTINATIONS.indexOf(destination) + 1} ${name}] · 1–6 views · ? help`;
|
|
218
238
|
}
|
|
219
239
|
|
|
220
240
|
function sessionKeys(screen: DashboardScreenState, selected: DashboardItem | undefined, width: number): string[] {
|
|
@@ -232,15 +252,31 @@ function sessionKeys(screen: DashboardScreenState, selected: DashboardItem | und
|
|
|
232
252
|
...(view === "details" && selected?.briefDetails ? [screen.sourceDetails ? "x hide source" : "x show source"] : []),
|
|
233
253
|
];
|
|
234
254
|
}
|
|
255
|
+
const permissionDescriptions: Record<string, string> = {
|
|
256
|
+
"tool:bash": "shell access",
|
|
257
|
+
"tool:write": "permission to write files",
|
|
258
|
+
"tool:edit": "permission to edit files",
|
|
259
|
+
};
|
|
235
260
|
/** Selection follows stable identity through refresh, never an unrelated task at the old row index. */
|
|
236
261
|
export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
237
262
|
const width = Math.max(1, Math.floor(options.width)),
|
|
238
263
|
height = Math.max(1, Math.floor(options.height));
|
|
239
264
|
const { screen, session } = options,
|
|
240
265
|
pending = session?.pendingApprovals ?? [];
|
|
266
|
+
const modern = Boolean(session?.observation);
|
|
241
267
|
const approvals: DashboardItem[] = (options.connected === false ? [] : pending).map((approval) => ({
|
|
242
268
|
key: `approval:${approval.id}`,
|
|
243
|
-
label:
|
|
269
|
+
label: modern
|
|
270
|
+
? `${clean(approval.subject)} needs ${permissionDescriptions[approval.capability] ?? approval.capability}`
|
|
271
|
+
: `${approval.subject} · ${approval.capability.replace(/^tool:/, "")}`,
|
|
272
|
+
...(modern
|
|
273
|
+
? {
|
|
274
|
+
briefDetails: [
|
|
275
|
+
"Open the permission request in your main Pi chat.",
|
|
276
|
+
"Choose whether to grant this access for the task.",
|
|
277
|
+
],
|
|
278
|
+
}
|
|
279
|
+
: {}),
|
|
244
280
|
status: "needs-you",
|
|
245
281
|
elapsed: "",
|
|
246
282
|
approval: true,
|
|
@@ -252,7 +288,6 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
252
288
|
"Respond to the permission request in the parent Pi session.",
|
|
253
289
|
],
|
|
254
290
|
}));
|
|
255
|
-
const modern = Boolean(session?.observation);
|
|
256
291
|
const allItems = [
|
|
257
292
|
...(!modern || ["now", "work"].includes(screen.destination ?? "now") ? approvals : []),
|
|
258
293
|
...(modern ? sessionDashboardItems(options) : options.items),
|
|
@@ -263,7 +298,7 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
263
298
|
: options.filter === "skills"
|
|
264
299
|
? item.skills
|
|
265
300
|
: options.filter === "needs-you"
|
|
266
|
-
?
|
|
301
|
+
? ["needs-you", "approval-wait"].includes(item.status)
|
|
267
302
|
: true,
|
|
268
303
|
);
|
|
269
304
|
const live = items.filter((item) => active(item.status)),
|
|
@@ -311,17 +346,44 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
311
346
|
: []),
|
|
312
347
|
...(modern ? [sessionLocation(screen, width)] : []),
|
|
313
348
|
];
|
|
314
|
-
|
|
315
|
-
if (
|
|
349
|
+
const disconnected = modern && options.connected === false;
|
|
350
|
+
if (disconnected) fixed.push("Disconnected · showing last known status");
|
|
351
|
+
else if (options.notice || options.problem) fixed.push(`! ${clean(options.notice || options.problem || "")}`);
|
|
352
|
+
const ack = options.acknowledgment;
|
|
353
|
+
if (ack?.state === "unconfirmed") {
|
|
354
|
+
const setting =
|
|
355
|
+
(
|
|
356
|
+
{
|
|
357
|
+
"set-auto": "Auto",
|
|
358
|
+
"set-jev": "JEV",
|
|
359
|
+
"edit-jev": "JEV settings",
|
|
360
|
+
set: "model",
|
|
361
|
+
"set-limit": "limit",
|
|
362
|
+
} as Record<string, string>
|
|
363
|
+
)[ack.action] ?? "setting";
|
|
364
|
+
fixed.push(
|
|
365
|
+
...wrapDashboardLines([`Unconfirmed ${setting} change. Check the main Pi chat before trying again.`], width),
|
|
366
|
+
);
|
|
367
|
+
} else if (ack && (!disconnected || !modern) && (!modern || screen.view === "settings" || ack.state === "refused")) {
|
|
368
|
+
fixed.push(
|
|
369
|
+
ack.action === "edit-jev" && ack.state === "opened"
|
|
370
|
+
? "JEV settings · current values below"
|
|
371
|
+
: clean(`${ack.action}: ${ack.state} · ${ack.effect}`),
|
|
372
|
+
);
|
|
373
|
+
}
|
|
316
374
|
if (modern && options.filter && options.filter !== "everything" && screen.view === "main")
|
|
317
375
|
fixed.push(`Filter: ${options.filter} · Tab to change`);
|
|
318
|
-
if (modern && options.
|
|
319
|
-
|
|
320
|
-
if (modern && screen.view === "main" && (screen.destination ?? "now") === "now") {
|
|
376
|
+
if (modern && options.height >= 22) fixed.push("");
|
|
377
|
+
if (modern && screen.view === "main" && (screen.destination ?? "now") === "now" && !disconnected) {
|
|
321
378
|
const [heading, action] = sessionNextLines(options);
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
379
|
+
const recommendation = action !== "No current next step reported.";
|
|
380
|
+
if (recommendation) {
|
|
381
|
+
const title = heading.includes("[3]") ? "Next step · [3] Reviews" : "Next step";
|
|
382
|
+
fixed.push(sectionHeading(title, width), ...wrapDashboardLines([action], width).slice(0, 2));
|
|
383
|
+
} else if (!allItems.some((i) => i.approval || ["needs-you", "approval-wait"].includes(i.status))) {
|
|
384
|
+
fixed.push("No decision requested from you.");
|
|
385
|
+
}
|
|
386
|
+
if (options.height >= 22) fixed.push("");
|
|
325
387
|
}
|
|
326
388
|
const body: string[] = [];
|
|
327
389
|
if (screen.view === "recap") {
|
|
@@ -342,7 +404,9 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
342
404
|
"↑/↓ or j/k: select; Enter/d: details",
|
|
343
405
|
"a: toggle Daddy permission Auto",
|
|
344
406
|
"m: session models; v: ecosystem versions; s: settings",
|
|
345
|
-
"1
|
|
407
|
+
"1 Overview · what needs you and what Pi is doing",
|
|
408
|
+
"2 Tasks · full session task list, including finished work",
|
|
409
|
+
"3 Reviews · 4 Activity · 5 Evidence · 6 Settings",
|
|
346
410
|
"r: recent session activity and review counts",
|
|
347
411
|
"Wide terminals preview the selected item. x shows more session information.",
|
|
348
412
|
"x in a review detail: show or hide its source and exact reference",
|
|
@@ -362,7 +426,17 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
362
426
|
"Finished means observed completion, not acceptance.",
|
|
363
427
|
);
|
|
364
428
|
else if (screen.view === "settings") {
|
|
429
|
+
screen.settingKeys = visibleSettingKeys(session?.settings?.jev);
|
|
430
|
+
if (screen.settingKey && !screen.settingKeys.includes(screen.settingKey)) screen.settingKey = "jev";
|
|
365
431
|
body.push(
|
|
432
|
+
...(disconnected
|
|
433
|
+
? [
|
|
434
|
+
sectionHeading("Connection details", width),
|
|
435
|
+
`Last contact: ${session!.observation!.observedAt}`,
|
|
436
|
+
...(options.notice || options.problem ? [clean(options.notice || options.problem || "")] : []),
|
|
437
|
+
"",
|
|
438
|
+
]
|
|
439
|
+
: []),
|
|
366
440
|
...dashboardSettingsLines(
|
|
367
441
|
options.connected === false && session?.settings ? { ...session.settings, editable: false } : session?.settings,
|
|
368
442
|
session?.auto.enabled,
|
|
@@ -386,12 +460,14 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
386
460
|
body.push(modern ? sectionHeading("VERSIONS", width) : "VERSIONS");
|
|
387
461
|
if (!session?.versions) body.push("Owner has not reported versions.");
|
|
388
462
|
else if (screen.view === "versions") {
|
|
389
|
-
body.push("Loaded -> on disk");
|
|
463
|
+
body.push(modern ? "Packages in this Pi session" : "Loaded -> on disk");
|
|
390
464
|
for (const row of screen.versionRows)
|
|
391
|
-
body.push(
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
465
|
+
if (modern) body.push(...versionLines(row, row.id === screen.versionId, options));
|
|
466
|
+
else
|
|
467
|
+
body.push(
|
|
468
|
+
`${row.id === screen.versionId ? ">" : " "} ${row.label}: ${row.loadedVersion ?? "?"} -> ${row.installedVersion ?? "?"}`,
|
|
469
|
+
` ${versionStatus(row)}`,
|
|
470
|
+
);
|
|
395
471
|
if (session.versions.note) body.push(session.versions.note);
|
|
396
472
|
} else if (selectedVersion) {
|
|
397
473
|
body.push(
|
|
@@ -416,7 +492,8 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
416
492
|
} else if (screen.view === "details") {
|
|
417
493
|
const title =
|
|
418
494
|
selected &&
|
|
419
|
-
(selected.
|
|
495
|
+
(selected.key.startsWith("component:") ||
|
|
496
|
+
(selected.status === "approval-wait" && /\bready for review\b/i.test(selected.label))
|
|
420
497
|
? selected.label
|
|
421
498
|
: selected.status === "last-observed"
|
|
422
499
|
? `Last seen · ${selected.label}`
|
|
@@ -493,7 +570,7 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
493
570
|
? previewWidth(screen.destination ?? "now", Boolean(screen.expanded), width)
|
|
494
571
|
: undefined;
|
|
495
572
|
const detailBody =
|
|
496
|
-
(screen.view === "main"
|
|
573
|
+
!modern && (screen.view === "main" || screen.view === "versions") ? body : wrapDashboardLines(body, left ?? width);
|
|
497
574
|
if (modern && height >= 16 && height - fixed.length - footer.length > detailBody.length)
|
|
498
575
|
footer.unshift("─".repeat(Math.min(width, 100)));
|
|
499
576
|
const bodyRoom = height - fixed.length - footer.length;
|
|
@@ -501,7 +578,7 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
501
578
|
if (clipped) footer.push("");
|
|
502
579
|
const room = Math.max(0, height - fixed.length - footer.length);
|
|
503
580
|
if (screen.view === "versions" && selectedVersion && room > 0) {
|
|
504
|
-
const row =
|
|
581
|
+
const row = detailBody.findIndex((line) => line.startsWith(">"));
|
|
505
582
|
if (row < screen.offset) screen.offset = row;
|
|
506
583
|
else if (row + 1 >= screen.offset + room) screen.offset = Math.max(0, row + 2 - room);
|
|
507
584
|
}
|
|
@@ -526,11 +603,10 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
526
603
|
const right = Math.min(width - left - 3, 72);
|
|
527
604
|
const preview = wrapDashboardLines(
|
|
528
605
|
[
|
|
529
|
-
sectionHeading("
|
|
606
|
+
sectionHeading("Selected item", right),
|
|
530
607
|
clean(selected.label),
|
|
531
608
|
"",
|
|
532
|
-
...(selected.briefDetails ??
|
|
533
|
-
(screen.expanded ? selected.details : [friendlyStatus(selected.status), "Press Enter for details."])),
|
|
609
|
+
...(selected.briefDetails ?? [friendlyStatus(selected.status), "Press Enter for details."]),
|
|
534
610
|
],
|
|
535
611
|
right,
|
|
536
612
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DashboardOwnerObservation } from "../kernel/dashboard-observation.ts";
|
|
2
|
-
import type { DashboardSettingsSnapshot } from "./dashboard-settings.ts";
|
|
2
|
+
import type { DashboardSettingsSnapshot, JevEditAction } from "./dashboard-settings.ts";
|
|
3
3
|
import type { EcosystemVersions } from "./ecosystem-versions.ts";
|
|
4
4
|
import { createConnection } from "node:net";
|
|
5
5
|
|
|
@@ -19,6 +19,7 @@ export type DashboardSessionAction = (
|
|
|
19
19
|
| { action: "set"; edits: string }
|
|
20
20
|
| { action: "set-auto"; enabled: boolean }
|
|
21
21
|
| { action: "set-jev"; enabled: boolean }
|
|
22
|
+
| { action: "edit-jev"; option: JevEditAction }
|
|
22
23
|
| { action: "set-limit"; key: "wall" | "idle"; seconds: number }
|
|
23
24
|
) & { expectedOwner?: { sessionId: string; cwd: string; generation: string } };
|
|
24
25
|
|
|
@@ -58,6 +59,12 @@ export async function dashboardSessionRequest(
|
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
export type DashboardAcknowledgment = {
|
|
63
|
+
action: string;
|
|
64
|
+
state: "opened" | "pending" | "applied" | "refused" | "unconfirmed";
|
|
65
|
+
effect: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
61
68
|
/** Controls use only a connected owner; last observations remain explicitly disconnected evidence. */
|
|
62
69
|
export function createDashboardConnection(
|
|
63
70
|
request?: (action: DashboardSessionAction) => Promise<DashboardSessionSnapshot>,
|
|
@@ -67,7 +74,7 @@ export function createDashboardConnection(
|
|
|
67
74
|
lastObserved?: DashboardSessionSnapshot;
|
|
68
75
|
pending: boolean;
|
|
69
76
|
error?: string;
|
|
70
|
-
acknowledgment?:
|
|
77
|
+
acknowledgment?: DashboardAcknowledgment;
|
|
71
78
|
} = { pending: false };
|
|
72
79
|
let generation = 0,
|
|
73
80
|
poll = 0,
|
|
@@ -123,9 +130,11 @@ export function createDashboardConnection(
|
|
|
123
130
|
const effect =
|
|
124
131
|
action.action === "set-auto"
|
|
125
132
|
? "current permission handling; admitted work unchanged"
|
|
126
|
-
: action.action === "
|
|
127
|
-
? "
|
|
128
|
-
:
|
|
133
|
+
: action.action === "edit-jev"
|
|
134
|
+
? "use the main Pi session; current values shown below"
|
|
135
|
+
: action.action === "set-jev"
|
|
136
|
+
? "current JEV session; separate paid-call and storage choices"
|
|
137
|
+
: "future children; running children unchanged";
|
|
129
138
|
state.acknowledgment = { action: action.action, state: "pending", effect };
|
|
130
139
|
try {
|
|
131
140
|
const snapshot = await request({
|
|
@@ -142,13 +151,15 @@ export function createDashboardConnection(
|
|
|
142
151
|
});
|
|
143
152
|
if (!accept(snapshot)) throw Error("owner acknowledgment is stale; reconcile before another action");
|
|
144
153
|
state.acknowledgment.state =
|
|
145
|
-
action.action === "
|
|
146
|
-
?
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
? "
|
|
150
|
-
:
|
|
151
|
-
|
|
154
|
+
action.action === "edit-jev"
|
|
155
|
+
? "opened"
|
|
156
|
+
: action.action === "set-jev"
|
|
157
|
+
? snapshot.settings?.jev.pending
|
|
158
|
+
? "pending"
|
|
159
|
+
: snapshot.settings?.jev.enabled === action.enabled
|
|
160
|
+
? "applied"
|
|
161
|
+
: "refused"
|
|
162
|
+
: "applied";
|
|
152
163
|
return true;
|
|
153
164
|
} catch (error) {
|
|
154
165
|
state.snapshot = undefined;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/** Settings are owner observations; rendering never grants consent or changes execution. */
|
|
2
|
-
export
|
|
2
|
+
export const JEV_EDIT_ACTIONS = ["limit", "configure", "hints"] as const;
|
|
3
|
+
export type JevEditAction = (typeof JEV_EDIT_ACTIONS)[number];
|
|
4
|
+
export const isJevEditAction = (value: unknown): value is JevEditAction =>
|
|
5
|
+
JEV_EDIT_ACTIONS.some((key) => value === key);
|
|
6
|
+
export type DashboardSettingKey =
|
|
7
|
+
JevEditAction | "auto" | "jev" | "wall" | "idle" | "descendants" | "depth" | "perCall";
|
|
3
8
|
export const DASHBOARD_SETTING_KEYS: DashboardSettingKey[] = [
|
|
4
9
|
"auto",
|
|
5
10
|
"jev",
|
|
@@ -16,6 +21,10 @@ export interface DashboardJevState {
|
|
|
16
21
|
mode?: string;
|
|
17
22
|
storage?: string | null;
|
|
18
23
|
remaining?: number;
|
|
24
|
+
limit?: number;
|
|
25
|
+
used?: number;
|
|
26
|
+
hintsEnabled?: boolean;
|
|
27
|
+
controls?: JevEditAction[];
|
|
19
28
|
availability?: string;
|
|
20
29
|
providerReadiness?: string;
|
|
21
30
|
selectedProvider?: string;
|
|
@@ -24,6 +33,10 @@ export interface DashboardJevState {
|
|
|
24
33
|
storageRoot?: string;
|
|
25
34
|
error?: string;
|
|
26
35
|
}
|
|
36
|
+
export function visibleSettingKeys(jev?: DashboardJevState): DashboardSettingKey[] {
|
|
37
|
+
const extra = JEV_EDIT_ACTIONS.filter((key) => jev?.available && jev.controls?.includes(key));
|
|
38
|
+
return ["auto", "jev", ...extra, ...DASHBOARD_SETTING_KEYS.slice(2)];
|
|
39
|
+
}
|
|
27
40
|
export interface DashboardSettingsSnapshot {
|
|
28
41
|
editable: boolean;
|
|
29
42
|
wallSeconds: number;
|
|
@@ -36,6 +49,7 @@ export interface DashboardSettingsSnapshot {
|
|
|
36
49
|
perCall: number;
|
|
37
50
|
jev: DashboardJevState;
|
|
38
51
|
}
|
|
52
|
+
export const JEV_EDITOR_NOTICE = "Finish editing in the main Pi session.";
|
|
39
53
|
export const JEV_CONSENT_NOTICE = "Complete JEV paid-call and LoRA-storage choices in the parent Pi session";
|
|
40
54
|
export function dashboardJevNotice(jev: DashboardJevState): string {
|
|
41
55
|
if (jev.pending) return JEV_CONSENT_NOTICE;
|
|
@@ -57,9 +71,29 @@ export function dashboardSettingsLines(
|
|
|
57
71
|
"jev",
|
|
58
72
|
`JEV: ${jev.pending ? "waiting for consent" : !jev.available ? "unavailable" : jev.enabled ? "ON" : "OFF"}`,
|
|
59
73
|
),
|
|
74
|
+
...(jev.available && jev.controls?.includes("limit")
|
|
75
|
+
? [
|
|
76
|
+
row("limit", `Call limit: ${jev.limit ?? "unknown"} per session`),
|
|
77
|
+
` ${jev.used ?? "?"} used · ${jev.remaining ?? "?"} available now`,
|
|
78
|
+
]
|
|
79
|
+
: []),
|
|
80
|
+
...(jev.available && jev.controls?.includes("configure")
|
|
81
|
+
? [row("configure", "Choose JEV model and storage…")]
|
|
82
|
+
: []),
|
|
83
|
+
...(jev.available && jev.controls?.includes("hints")
|
|
84
|
+
? [
|
|
85
|
+
row(
|
|
86
|
+
"hints",
|
|
87
|
+
`Tool hints: ${jev.hintsEnabled === true ? "ON" : jev.hintsEnabled === false ? "OFF" : "unknown"}`,
|
|
88
|
+
),
|
|
89
|
+
" Suggestions only · above 90% confidence",
|
|
90
|
+
]
|
|
91
|
+
: []),
|
|
60
92
|
...(jev.available
|
|
61
93
|
? [
|
|
62
|
-
|
|
94
|
+
...(jev.controls?.includes("limit")
|
|
95
|
+
? [` Provider status: ${jev.availability ?? "unknown"}`]
|
|
96
|
+
: [` ${jev.availability ?? "unknown"} · ${jev.remaining ?? 0} paid calls left`]),
|
|
63
97
|
` Key: ${jev.providerReadiness ?? "unknown"}; storage: ${jev.storage ?? "not granted"}`,
|
|
64
98
|
...(jev.selectedProvider || jev.selectedModel
|
|
65
99
|
? [` Model: ${jev.selectedProvider ?? "unknown"}/${jev.selectedModel ?? "not reported"}`]
|
|
@@ -11,6 +11,8 @@ export interface EcosystemVersionRow {
|
|
|
11
11
|
state: "current" | "reload-required" | "not-reported" | "unavailable" | "multiple";
|
|
12
12
|
commands: string[];
|
|
13
13
|
note?: string;
|
|
14
|
+
/** Pi reports the Bookie command from this installed package in the current session. */
|
|
15
|
+
commandAvailable?: boolean;
|
|
14
16
|
}
|
|
15
17
|
export interface EcosystemVersions {
|
|
16
18
|
rows: EcosystemVersionRow[];
|