pi-daddy 0.49.5 → 0.51.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 +57 -1
- package/README.md +231 -27
- package/dist/governance/initiative-coordinator.d.ts +63 -0
- package/dist/governance/initiative-coordinator.d.ts.map +1 -0
- package/dist/governance/initiative-coordinator.js +364 -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 +50 -10
- 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 +72 -2
- 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-layout.d.ts +6 -0
- package/dist/products/dashboard-layout.d.ts.map +1 -0
- package/dist/products/dashboard-layout.js +45 -0
- package/dist/products/dashboard-layout.js.map +1 -0
- package/dist/products/dashboard-panels.d.ts +10 -0
- package/dist/products/dashboard-panels.d.ts.map +1 -0
- package/dist/products/dashboard-panels.js +319 -0
- package/dist/products/dashboard-panels.js.map +1 -0
- package/dist/products/dashboard-recap.d.ts +4 -0
- package/dist/products/dashboard-recap.d.ts.map +1 -0
- package/dist/products/dashboard-recap.js +47 -0
- package/dist/products/dashboard-recap.js.map +1 -0
- package/dist/products/dashboard-screen.d.ts +14 -1
- package/dist/products/dashboard-screen.d.ts.map +1 -1
- package/dist/products/dashboard-screen.js +217 -40
- 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 +133 -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-handoff.ts +59 -0
- package/extensions/initiative-runtime.ts +444 -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 +416 -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 +53 -10
- package/src/products/dashboard-display-controls.ts +63 -2
- package/src/products/dashboard-file-cache.ts +38 -0
- package/src/products/dashboard-layout.ts +50 -0
- package/src/products/dashboard-panels.ts +379 -0
- package/src/products/dashboard-recap.ts +48 -0
- package/src/products/dashboard-screen.ts +266 -43
- 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,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sessionDashboardItems,
|
|
3
|
+
sessionNextLines,
|
|
4
|
+
sessionPanelLines,
|
|
5
|
+
DASHBOARD_DESTINATIONS,
|
|
6
|
+
type DashboardDestination,
|
|
7
|
+
} from "./dashboard-panels.ts";
|
|
8
|
+
import { sessionRecapLines } from "./dashboard-recap.ts";
|
|
9
|
+
import { colorSessionLine, previewWidth, sectionHeading } from "./dashboard-layout.ts";
|
|
1
10
|
import { dashboardSettingsLines, type DashboardSettingKey } from "./dashboard-settings.ts";
|
|
2
11
|
/** Height-bounded, task-first view. Permission state is always supplied by the owner. */
|
|
3
12
|
import type { EcosystemVersionRow } from "./ecosystem-versions.ts";
|
|
@@ -12,6 +21,8 @@ export interface DashboardItem {
|
|
|
12
21
|
status: string;
|
|
13
22
|
elapsed: string;
|
|
14
23
|
details: string[];
|
|
24
|
+
briefDetails?: string[];
|
|
25
|
+
reviewSummary?: boolean;
|
|
15
26
|
observation?: string;
|
|
16
27
|
taskKey?: string;
|
|
17
28
|
timelinePath?: string;
|
|
@@ -20,7 +31,12 @@ export interface DashboardItem {
|
|
|
20
31
|
agent?: boolean;
|
|
21
32
|
}
|
|
22
33
|
export interface DashboardScreenState {
|
|
23
|
-
view: "main" | "details" | "models" | "help" | "versions" | "version-details" | "settings";
|
|
34
|
+
view: "main" | "details" | "models" | "help" | "versions" | "version-details" | "settings" | "recap";
|
|
35
|
+
destination?: DashboardDestination;
|
|
36
|
+
expanded?: boolean;
|
|
37
|
+
sourceDetails?: boolean;
|
|
38
|
+
manualScroll?: boolean;
|
|
39
|
+
selections?: Record<string, string>;
|
|
24
40
|
settingKey?: DashboardSettingKey;
|
|
25
41
|
versionId?: EcosystemVersionRow["id"];
|
|
26
42
|
versionRows?: EcosystemVersionRow[];
|
|
@@ -35,21 +51,32 @@ export const dashboardText = (value: string) =>
|
|
|
35
51
|
.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "")
|
|
36
52
|
.replace(/[\p{Cc}\p{Cf}]/gu, " ");
|
|
37
53
|
const clean = (value: string) => dashboardText(value).replace(/\s+/g, " ").trim();
|
|
38
|
-
function
|
|
54
|
+
export function wrapDashboardLines(lines: string[], width: number): string[] {
|
|
39
55
|
return lines.flatMap((line) => {
|
|
56
|
+
const safe = dashboardText(line);
|
|
57
|
+
if (cellWidth(safe) <= width) return [safe];
|
|
40
58
|
const result: string[] = [];
|
|
41
59
|
let row = "";
|
|
42
|
-
for (const
|
|
43
|
-
if (row && cellWidth(row +
|
|
60
|
+
for (const word of safe.split(/\s+/)) {
|
|
61
|
+
if (row && cellWidth(row + " " + word) > width) {
|
|
44
62
|
result.push(row);
|
|
45
63
|
row = "";
|
|
46
64
|
}
|
|
47
|
-
|
|
65
|
+
if (cellWidth(word) > width) {
|
|
66
|
+
for (const character of word) {
|
|
67
|
+
if (row && cellWidth(row + character) > width) {
|
|
68
|
+
result.push(row);
|
|
69
|
+
row = "";
|
|
70
|
+
}
|
|
71
|
+
row += character;
|
|
72
|
+
}
|
|
73
|
+
} else row += (row ? " " : "") + word;
|
|
48
74
|
}
|
|
49
75
|
result.push(row);
|
|
50
76
|
return result;
|
|
51
77
|
});
|
|
52
78
|
}
|
|
79
|
+
|
|
53
80
|
function elapsed(ms: number): string {
|
|
54
81
|
const seconds = Math.max(0, Math.floor(ms / 1000));
|
|
55
82
|
const minutes = Math.floor(seconds / 60);
|
|
@@ -57,13 +84,21 @@ function elapsed(ms: number): string {
|
|
|
57
84
|
? `${Math.floor(minutes / 60)}:${String(minutes % 60).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`
|
|
58
85
|
: `${minutes}:${String(seconds % 60).padStart(2, "0")}`;
|
|
59
86
|
}
|
|
60
|
-
const friendlyStatus = (status: string) =>
|
|
87
|
+
export const friendlyStatus = (status: string) =>
|
|
61
88
|
({
|
|
62
89
|
active: "Running",
|
|
63
90
|
running: "Running",
|
|
64
91
|
starting: "Starting",
|
|
65
|
-
authorised: "
|
|
92
|
+
authorised: "Authorized",
|
|
93
|
+
observed: "Reported",
|
|
94
|
+
"cancel-requested": "Cancel requested",
|
|
95
|
+
unknown: "Unknown",
|
|
96
|
+
unavailable: "Unavailable",
|
|
66
97
|
"needs-you": "Needs you",
|
|
98
|
+
"approval-wait": "Awaiting decision",
|
|
99
|
+
"dependency-wait": "Waiting on dependency",
|
|
100
|
+
"last-observed": "Last seen",
|
|
101
|
+
settled: "Finished",
|
|
67
102
|
completed: "Finished",
|
|
68
103
|
finished: "Finished",
|
|
69
104
|
failed: "Failed",
|
|
@@ -157,6 +192,45 @@ export interface DashboardScreenOptions {
|
|
|
157
192
|
color?: boolean;
|
|
158
193
|
content?: { title: string; text: string };
|
|
159
194
|
command?: string;
|
|
195
|
+
connected?: boolean;
|
|
196
|
+
acknowledgment?: string;
|
|
197
|
+
now?: Date;
|
|
198
|
+
}
|
|
199
|
+
function sessionLocation(screen: DashboardScreenState, width: number): string {
|
|
200
|
+
const destination = screen.destination ?? "now";
|
|
201
|
+
const overlays = {
|
|
202
|
+
details: "Details",
|
|
203
|
+
models: "Models",
|
|
204
|
+
help: "Help",
|
|
205
|
+
versions: "Versions",
|
|
206
|
+
"version-details": "Version details",
|
|
207
|
+
recap: "Session recap",
|
|
208
|
+
};
|
|
209
|
+
if (screen.view in overlays)
|
|
210
|
+
return `${destination.toUpperCase()} / ${overlays[screen.view as keyof typeof overlays]}`;
|
|
211
|
+
if (width < 74)
|
|
212
|
+
return width >= 37 && destination === "now"
|
|
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)}`,
|
|
217
|
+
).join(" ");
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function sessionKeys(screen: DashboardScreenState, selected: DashboardItem | undefined, width: number): string[] {
|
|
221
|
+
const view = screen.view;
|
|
222
|
+
const brief = width < 34;
|
|
223
|
+
if (view === "main") {
|
|
224
|
+
const keys = selected ? (brief ? "↑↓ · Enter details" : "↑↓ select · Enter details") : "1–6 views";
|
|
225
|
+
return [keys + (brief ? " · ?" : " · ? help"), "r recap · q close"];
|
|
226
|
+
}
|
|
227
|
+
if (view === "versions" || view === "settings")
|
|
228
|
+
return [view === "settings" ? "↑↓ select · Enter edit" : "↑↓ select · Enter details", "Esc back · ? help"];
|
|
229
|
+
return [
|
|
230
|
+
brief ? "↑↓ scroll · Esc back" : "↑↓ scroll · Esc back · q close",
|
|
231
|
+
...(view === "details" && selected?.taskKey ? ["p prompt · f final · ? help"] : []),
|
|
232
|
+
...(view === "details" && selected?.briefDetails ? [screen.sourceDetails ? "x hide source" : "x show source"] : []),
|
|
233
|
+
];
|
|
160
234
|
}
|
|
161
235
|
/** Selection follows stable identity through refresh, never an unrelated task at the old row index. */
|
|
162
236
|
export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
@@ -164,7 +238,7 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
164
238
|
height = Math.max(1, Math.floor(options.height));
|
|
165
239
|
const { screen, session } = options,
|
|
166
240
|
pending = session?.pendingApprovals ?? [];
|
|
167
|
-
const approvals: DashboardItem[] = pending.map((approval) => ({
|
|
241
|
+
const approvals: DashboardItem[] = (options.connected === false ? [] : pending).map((approval) => ({
|
|
168
242
|
key: `approval:${approval.id}`,
|
|
169
243
|
label: `${approval.subject} · ${approval.capability.replace(/^tool:/, "")}`,
|
|
170
244
|
status: "needs-you",
|
|
@@ -175,10 +249,14 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
175
249
|
`Subject: ${approval.subject}`,
|
|
176
250
|
`Capability: ${approval.capability}`,
|
|
177
251
|
"Waiting for Daddy permission in the owner session.",
|
|
178
|
-
"
|
|
252
|
+
"Respond to the permission request in the parent Pi session.",
|
|
179
253
|
],
|
|
180
254
|
}));
|
|
181
|
-
const
|
|
255
|
+
const modern = Boolean(session?.observation);
|
|
256
|
+
const allItems = [
|
|
257
|
+
...(!modern || ["now", "work"].includes(screen.destination ?? "now") ? approvals : []),
|
|
258
|
+
...(modern ? sessionDashboardItems(options) : options.items),
|
|
259
|
+
];
|
|
182
260
|
const items = allItems.filter((item) =>
|
|
183
261
|
options.filter === "agents"
|
|
184
262
|
? item.agent
|
|
@@ -191,44 +269,88 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
191
269
|
const live = items.filter((item) => active(item.status)),
|
|
192
270
|
needsAttention = items.filter((item) => attention(item.status)),
|
|
193
271
|
past = items.filter((item) => !active(item.status) && !attention(item.status)).reverse();
|
|
194
|
-
screen.items = [...live, ...needsAttention, ...(options.history ? past : [])];
|
|
272
|
+
screen.items = modern ? items : [...live, ...needsAttention, ...(options.history ? past : [])];
|
|
195
273
|
if (screen.view === "details" && !screen.items.some((item) => item.key === screen.selectedKey)) {
|
|
196
274
|
const detail = items.find((item) => item.key === screen.selectedKey);
|
|
197
275
|
if (detail) screen.items.push(detail);
|
|
198
276
|
}
|
|
199
|
-
if (
|
|
277
|
+
if (
|
|
278
|
+
!screen.items.some((item) => item.key === screen.selectedKey) &&
|
|
279
|
+
!(screen.view === "details" && screen.selectedKey)
|
|
280
|
+
)
|
|
281
|
+
screen.selectedKey = screen.items[0]?.key;
|
|
200
282
|
const selectedIndex = screen.items.findIndex((item) => item.key === screen.selectedKey),
|
|
201
283
|
selected = screen.items[selectedIndex];
|
|
202
284
|
screen.versionRows = session?.versions?.rows ?? [];
|
|
203
285
|
if (!screen.versionRows.some((row) => row.id === screen.versionId)) screen.versionId = screen.versionRows[0]?.id;
|
|
204
286
|
const selectedVersion = screen.versionRows.find((row) => row.id === screen.versionId);
|
|
205
|
-
const mode =
|
|
206
|
-
|
|
287
|
+
const mode =
|
|
288
|
+
session && options.connected !== false ? `Auto ${session.auto.enabled ? "ON" : "OFF"}` : "Auto unavailable";
|
|
289
|
+
const header = `PI DADDY | ${mode}${options.pending ? " …" : session && options.connected !== false ? " [a]" : ""}`;
|
|
207
290
|
const footer =
|
|
208
291
|
options.command !== undefined
|
|
209
292
|
? [`: ${clean(options.command)}`]
|
|
210
|
-
:
|
|
211
|
-
?
|
|
212
|
-
: screen.view === "
|
|
213
|
-
? ["↑↓ select · Enter
|
|
214
|
-
:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
293
|
+
: modern
|
|
294
|
+
? sessionKeys(screen, selected, width)
|
|
295
|
+
: screen.view === "settings"
|
|
296
|
+
? ["↑↓ select · Enter toggle/edit · Esc back", "0 default limit · PgUp/PgDn scroll · s settings"]
|
|
297
|
+
: screen.view === "main" || screen.view === "versions"
|
|
298
|
+
? ["↑↓ select · Enter details · a Auto", "m models · v versions · s settings · ?"]
|
|
299
|
+
: [
|
|
300
|
+
"↑↓ scroll · Esc back · a Auto",
|
|
301
|
+
screen.view === "details" ? "p prompt · f final · : command · ? help" : ": command · ? help",
|
|
302
|
+
];
|
|
218
303
|
const fixed = [
|
|
219
|
-
header,
|
|
220
|
-
|
|
221
|
-
?
|
|
222
|
-
|
|
304
|
+
modern && options.connected !== false ? `${header} · Connected` : header,
|
|
305
|
+
...(!modern
|
|
306
|
+
? [
|
|
307
|
+
session && options.connected !== false
|
|
308
|
+
? `Permissions connected${pending.length ? ` · ${pending.length} needs you` : ""}`
|
|
309
|
+
: "Permission controls disconnected",
|
|
310
|
+
]
|
|
311
|
+
: []),
|
|
312
|
+
...(modern ? [sessionLocation(screen, width)] : []),
|
|
223
313
|
];
|
|
224
314
|
if (options.notice || options.problem) fixed.push(`! ${clean(options.notice || options.problem || "")}`);
|
|
315
|
+
if (options.acknowledgment) fixed.push(clean(options.acknowledgment));
|
|
316
|
+
if (modern && options.filter && options.filter !== "everything" && screen.view === "main")
|
|
317
|
+
fixed.push(`Filter: ${options.filter} · Tab to change`);
|
|
318
|
+
if (modern && options.connected === false)
|
|
319
|
+
fixed.push(`LAST OBSERVED: ${session!.observation!.observedAt}; live state unknown`);
|
|
320
|
+
if (modern && screen.view === "main" && (screen.destination ?? "now") === "now") {
|
|
321
|
+
const [heading, action] = sessionNextLines(options);
|
|
322
|
+
const actionLines = wrapDashboardLines([action], width);
|
|
323
|
+
fixed.push(sectionHeading(heading.replace("NEXT", "SESSION PRIORITY"), width), actionLines[0]!);
|
|
324
|
+
if (actionLines.length > 1) fixed.push(truncate(actionLines.slice(1).join(" "), width));
|
|
325
|
+
}
|
|
225
326
|
const body: string[] = [];
|
|
226
|
-
if (screen.view === "
|
|
327
|
+
if (screen.view === "recap") {
|
|
328
|
+
const recap = sessionRecapLines(options);
|
|
329
|
+
const activity = recap.findIndex(
|
|
330
|
+
(line) => line === "Recent activity · newest first" || line === "No recent session events recorded.",
|
|
331
|
+
);
|
|
332
|
+
const summary = activity < 0 ? recap : recap.slice(0, activity);
|
|
333
|
+
if (summary.length) body.push(sectionHeading("SESSION STATUS", width), ...summary);
|
|
334
|
+
if (activity >= 0)
|
|
335
|
+
body.push(
|
|
336
|
+
sectionHeading("RECENT ACTIVITY", width),
|
|
337
|
+
...recap.slice(activity + Number(recap[activity] === "Recent activity · newest first")),
|
|
338
|
+
);
|
|
339
|
+
} else if (screen.view === "help")
|
|
227
340
|
body.push(
|
|
228
341
|
"DASHBOARD KEYS",
|
|
229
342
|
"↑/↓ or j/k: select; Enter/d: details",
|
|
230
343
|
"a: toggle Daddy permission Auto",
|
|
231
344
|
"m: session models; v: ecosystem versions; s: settings",
|
|
345
|
+
"1–6: Now / Work / Reviews / Activity / Evidence / Settings",
|
|
346
|
+
"r: recent session activity and review counts",
|
|
347
|
+
"Wide terminals preview the selected item. x shows more session information.",
|
|
348
|
+
"x in a review detail: show or hide its source and exact reference",
|
|
349
|
+
"No cancellation shortcut: request it in the owning Pi session.",
|
|
350
|
+
"Goals/next steps are owner recommendations, not execution authority.",
|
|
351
|
+
"Reviews apply only to their exact subject; completed is not accepted.",
|
|
352
|
+
"Evidence rows are references; content needs its authorized resolver.",
|
|
353
|
+
"Memory sample covers the parent only; host/child memory is unknown.",
|
|
232
354
|
"h: show/hide finished history",
|
|
233
355
|
"Tab: Everything / Agents / Skills / Needs-you",
|
|
234
356
|
"p/f: selected retained prompt/final",
|
|
@@ -240,9 +362,28 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
240
362
|
"Finished means observed completion, not acceptance.",
|
|
241
363
|
);
|
|
242
364
|
else if (screen.view === "settings") {
|
|
243
|
-
body.push(
|
|
365
|
+
body.push(
|
|
366
|
+
...dashboardSettingsLines(
|
|
367
|
+
options.connected === false && session?.settings ? { ...session.settings, editable: false } : session?.settings,
|
|
368
|
+
session?.auto.enabled,
|
|
369
|
+
screen.settingKey ?? "auto",
|
|
370
|
+
).map((line) => {
|
|
371
|
+
if (modern && (line === "SETTINGS" || line === "SETTINGS · current session"))
|
|
372
|
+
return sectionHeading("SESSION CONTROLS", width);
|
|
373
|
+
if (modern && line.startsWith("STARTUP LIMITS")) return sectionHeading(line, width);
|
|
374
|
+
return line;
|
|
375
|
+
}),
|
|
376
|
+
);
|
|
377
|
+
if (session?.observation)
|
|
378
|
+
body.push(
|
|
379
|
+
sectionHeading("CAPTURE · startup configuration", width),
|
|
380
|
+
`Transcripts: ${session.observation.capture.transcripts ? "configured" : "off"}`,
|
|
381
|
+
`Diagnostics: ${session.observation.capture.diagnostics ? "configured" : "off"}`,
|
|
382
|
+
"Capture changes require a new parent launch.",
|
|
383
|
+
"m models · v versions",
|
|
384
|
+
);
|
|
244
385
|
} else if (screen.view === "versions" || screen.view === "version-details") {
|
|
245
|
-
body.push("VERSIONS");
|
|
386
|
+
body.push(modern ? sectionHeading("VERSIONS", width) : "VERSIONS");
|
|
246
387
|
if (!session?.versions) body.push("Owner has not reported versions.");
|
|
247
388
|
else if (screen.view === "versions") {
|
|
248
389
|
body.push("Loaded -> on disk");
|
|
@@ -267,17 +408,41 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
267
408
|
if (session.versions.note) body.push(session.versions.note);
|
|
268
409
|
}
|
|
269
410
|
} else if (screen.view === "models") {
|
|
270
|
-
body.push("SESSION MODELS");
|
|
411
|
+
body.push(modern ? sectionHeading("SESSION MODELS", width) : "SESSION MODELS");
|
|
271
412
|
if (!session) body.push("Connect from /grants dashboard to edit models.");
|
|
272
413
|
for (const row of session?.rows ?? [])
|
|
273
414
|
body.push(`${row.definition}: ${row.model}`, ` ${row.thinking} · ${row.source}`);
|
|
274
415
|
body.push(": m <definition|all> <provider:model> <thinking>");
|
|
275
416
|
} else if (screen.view === "details") {
|
|
417
|
+
const title =
|
|
418
|
+
selected &&
|
|
419
|
+
(selected.status === "approval-wait" && /\bready for review\b/i.test(selected.label)
|
|
420
|
+
? selected.label
|
|
421
|
+
: selected.status === "last-observed"
|
|
422
|
+
? `Last seen · ${selected.label}`
|
|
423
|
+
: `${selected.label} · ${friendlyStatus(selected.status)}`);
|
|
276
424
|
body.push(
|
|
277
|
-
|
|
278
|
-
|
|
425
|
+
title ??
|
|
426
|
+
(screen.selectedKey ? "This item is no longer visible. Press Esc to return to the list." : "No selected task"),
|
|
427
|
+
...(modern && selected
|
|
428
|
+
? [
|
|
429
|
+
sectionHeading(
|
|
430
|
+
screen.sourceDetails
|
|
431
|
+
? "SOURCE RECORD"
|
|
432
|
+
: (selected.briefDetails && selected.status === "approval-wait") || selected.approval
|
|
433
|
+
? "NEXT ACTION"
|
|
434
|
+
: "DETAILS",
|
|
435
|
+
width,
|
|
436
|
+
),
|
|
437
|
+
]
|
|
438
|
+
: []),
|
|
439
|
+
...((screen.sourceDetails ? selected?.details : (selected?.briefDetails ?? selected?.details)) ?? []),
|
|
279
440
|
);
|
|
280
|
-
if (options.content) body.push("", options.content.title, ...options.content.text.split(/\r?\n/));
|
|
441
|
+
if (selected && options.content) body.push("", options.content.title, ...options.content.text.split(/\r?\n/));
|
|
442
|
+
} else if (modern) {
|
|
443
|
+
if (!screen.items.length && options.filter && options.filter !== "everything")
|
|
444
|
+
body.push("No items match this filter. Press Tab to change it.");
|
|
445
|
+
else body.push(...sessionPanelLines(options, screen.items, width));
|
|
281
446
|
} else {
|
|
282
447
|
const requestFinished = options.currentStatus && !active(options.currentStatus);
|
|
283
448
|
body.push(
|
|
@@ -323,35 +488,93 @@ export function renderDashboardScreen(options: DashboardScreenOptions): string {
|
|
|
323
488
|
if (history) body.push(history);
|
|
324
489
|
}
|
|
325
490
|
|
|
326
|
-
const
|
|
491
|
+
const left =
|
|
492
|
+
modern && screen.view === "main" && selected
|
|
493
|
+
? previewWidth(screen.destination ?? "now", Boolean(screen.expanded), width)
|
|
494
|
+
: undefined;
|
|
495
|
+
const detailBody =
|
|
496
|
+
(screen.view === "main" && !modern) || screen.view === "versions" ? body : wrapDashboardLines(body, left ?? width);
|
|
497
|
+
if (modern && height >= 16 && height - fixed.length - footer.length > detailBody.length)
|
|
498
|
+
footer.unshift("─".repeat(Math.min(width, 100)));
|
|
499
|
+
const bodyRoom = height - fixed.length - footer.length;
|
|
500
|
+
const clipped = modern && bodyRoom >= 2 && detailBody.length > bodyRoom;
|
|
501
|
+
if (clipped) footer.push("");
|
|
327
502
|
const room = Math.max(0, height - fixed.length - footer.length);
|
|
328
503
|
if (screen.view === "versions" && selectedVersion && room > 0) {
|
|
329
504
|
const row = 2 + screen.versionRows.findIndex((value) => value.id === screen.versionId) * 2;
|
|
330
505
|
if (row < screen.offset) screen.offset = row;
|
|
331
506
|
else if (row + 1 >= screen.offset + room) screen.offset = Math.max(0, row + 2 - room);
|
|
332
507
|
}
|
|
333
|
-
if (screen.view === "settings" && room > 0) {
|
|
508
|
+
if (screen.view === "settings" && room > 0 && !screen.manualScroll) {
|
|
334
509
|
const row = detailBody.findIndex((line) => line.startsWith(">"));
|
|
335
510
|
if (row < screen.offset) screen.offset = Math.max(0, row);
|
|
336
511
|
else if (row >= screen.offset + room) screen.offset = Math.max(0, row - room + 1);
|
|
337
512
|
}
|
|
513
|
+
if (modern && screen.view === "main" && room > 0 && !screen.manualScroll) {
|
|
514
|
+
const selectedRow = detailBody.findIndex((line) => line.startsWith(">"));
|
|
515
|
+
if (selectedRow >= screen.offset + room) screen.offset = selectedRow - room + 1;
|
|
516
|
+
else if (selectedRow >= 0 && selectedRow < screen.offset) screen.offset = selectedRow;
|
|
517
|
+
}
|
|
338
518
|
const offset =
|
|
339
|
-
screen.view === "main" ? 0 : Math.max(0, Math.min(screen.offset, Math.max(0, detailBody.length - room)));
|
|
519
|
+
screen.view === "main" && !modern ? 0 : Math.max(0, Math.min(screen.offset, Math.max(0, detailBody.length - room)));
|
|
340
520
|
screen.offset = offset;
|
|
341
|
-
|
|
521
|
+
if (clipped)
|
|
522
|
+
footer[footer.length - 1] =
|
|
523
|
+
`Rows ${offset + 1}–${Math.min(offset + room, detailBody.length)}/${detailBody.length} · PgUp/PgDn`;
|
|
524
|
+
const page = detailBody.slice(offset, offset + room);
|
|
525
|
+
if (left !== undefined && selected) {
|
|
526
|
+
const right = Math.min(width - left - 3, 72);
|
|
527
|
+
const preview = wrapDashboardLines(
|
|
528
|
+
[
|
|
529
|
+
sectionHeading("SELECTED ITEM", right),
|
|
530
|
+
clean(selected.label),
|
|
531
|
+
"",
|
|
532
|
+
...(selected.briefDetails ??
|
|
533
|
+
(screen.expanded ? selected.details : [friendlyStatus(selected.status), "Press Enter for details."])),
|
|
534
|
+
],
|
|
535
|
+
right,
|
|
536
|
+
);
|
|
537
|
+
const count = Math.min(room, Math.max(page.length, preview.length));
|
|
538
|
+
for (let i = 0; i < count; i++) {
|
|
539
|
+
const cell = page[i] ?? "";
|
|
540
|
+
page[i] = cell + " ".repeat(Math.max(0, left - cellWidth(cell))) + " │ " + (preview[i] ?? "");
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
const lines = [...fixed, ...page];
|
|
342
544
|
while (lines.length < height - footer.length) lines.push("");
|
|
343
|
-
const output =
|
|
344
|
-
height < fixed.length + footer.length
|
|
345
|
-
? fixed.slice(0, height)
|
|
346
|
-
: [...lines.slice(0, Math.max(0, height - footer.length)), ...footer].slice(0, height);
|
|
545
|
+
const output = [...lines, ...footer].slice(0, height);
|
|
347
546
|
return output
|
|
348
547
|
.map((line, index) => {
|
|
349
548
|
const safe = truncate(dashboardText(line), width);
|
|
350
549
|
if (!options.color) return safe;
|
|
351
|
-
|
|
352
|
-
|
|
550
|
+
if (modern)
|
|
551
|
+
return colorSessionLine(
|
|
353
552
|
safe,
|
|
553
|
+
index === 0 ? "header" : index === 1 ? "navigation" : index >= height - footer.length ? "footer" : "body",
|
|
354
554
|
);
|
|
555
|
+
const section = [
|
|
556
|
+
"NOW",
|
|
557
|
+
"WORK",
|
|
558
|
+
"REVIEWS",
|
|
559
|
+
"ACTIVITY",
|
|
560
|
+
"EVIDENCE",
|
|
561
|
+
"GOAL",
|
|
562
|
+
"NEXT",
|
|
563
|
+
"COMPONENTS",
|
|
564
|
+
"CURRENT REQUEST",
|
|
565
|
+
"LATEST REQUEST",
|
|
566
|
+
"CURRENT WORK",
|
|
567
|
+
"NEEDS YOU",
|
|
568
|
+
"NEEDS ATTENTION",
|
|
569
|
+
"WORK IN PROGRESS",
|
|
570
|
+
"HISTORY",
|
|
571
|
+
"VERSIONS",
|
|
572
|
+
"SETTINGS",
|
|
573
|
+
"STARTUP LIMITS",
|
|
574
|
+
"SESSION MODELS",
|
|
575
|
+
"DASHBOARD KEYS",
|
|
576
|
+
"MANAGE",
|
|
577
|
+
].some((label) => safe.startsWith(label));
|
|
355
578
|
const code =
|
|
356
579
|
index === 0
|
|
357
580
|
? "1;36"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DashboardOwnerObservation } from "../kernel/dashboard-observation.ts";
|
|
1
2
|
import type { DashboardSettingsSnapshot } from "./dashboard-settings.ts";
|
|
2
3
|
import type { EcosystemVersions } from "./ecosystem-versions.ts";
|
|
3
4
|
import { createConnection } from "node:net";
|
|
@@ -5,6 +6,7 @@ import { createConnection } from "node:net";
|
|
|
5
6
|
export interface DashboardSessionSnapshot {
|
|
6
7
|
rows: Array<{ definition: string; model: string; thinking: string; source: string }>;
|
|
7
8
|
cost: number | null;
|
|
9
|
+
observation?: DashboardOwnerObservation;
|
|
8
10
|
activity?: { rootId: string; path: string; taskId: string };
|
|
9
11
|
versions?: EcosystemVersions;
|
|
10
12
|
settings?: DashboardSettingsSnapshot;
|
|
@@ -12,12 +14,13 @@ export interface DashboardSessionSnapshot {
|
|
|
12
14
|
pendingApprovals: Array<{ id: string; subject: string; capability: string }>;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
export type DashboardSessionAction =
|
|
17
|
+
export type DashboardSessionAction = (
|
|
16
18
|
| { action: "get" }
|
|
17
19
|
| { action: "set"; edits: string }
|
|
18
20
|
| { action: "set-auto"; enabled: boolean }
|
|
19
21
|
| { action: "set-jev"; enabled: boolean }
|
|
20
|
-
| { action: "set-limit"; key: "wall" | "idle"; seconds: number }
|
|
22
|
+
| { action: "set-limit"; key: "wall" | "idle"; seconds: number }
|
|
23
|
+
) & { expectedOwner?: { sessionId: string; cwd: string; generation: string } };
|
|
21
24
|
|
|
22
25
|
export async function dashboardSessionRequest(
|
|
23
26
|
socketPath: string,
|
|
@@ -55,41 +58,102 @@ export async function dashboardSessionRequest(
|
|
|
55
58
|
});
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
/**
|
|
61
|
+
/** Controls use only a connected owner; last observations remain explicitly disconnected evidence. */
|
|
59
62
|
export function createDashboardConnection(
|
|
60
63
|
request?: (action: DashboardSessionAction) => Promise<DashboardSessionSnapshot>,
|
|
61
64
|
) {
|
|
62
|
-
const state: {
|
|
63
|
-
|
|
65
|
+
const state: {
|
|
66
|
+
snapshot?: DashboardSessionSnapshot;
|
|
67
|
+
lastObserved?: DashboardSessionSnapshot;
|
|
68
|
+
pending: boolean;
|
|
69
|
+
error?: string;
|
|
70
|
+
acknowledgment?: { action: string; state: "pending" | "applied" | "refused" | "unconfirmed"; effect: string };
|
|
71
|
+
} = { pending: false };
|
|
72
|
+
let generation = 0,
|
|
73
|
+
poll = 0,
|
|
74
|
+
requestedJev: boolean | undefined;
|
|
75
|
+
const retired = new Set<string>();
|
|
76
|
+
const accept = (snapshot: DashboardSessionSnapshot) => {
|
|
77
|
+
const previous = state.lastObserved?.observation,
|
|
78
|
+
next = snapshot.observation;
|
|
79
|
+
if (previous && !next) return false;
|
|
80
|
+
if (next && retired.has(next.generation)) return false;
|
|
81
|
+
if (previous && next && previous.generation === next.generation && next.sequence <= previous.sequence) return false;
|
|
82
|
+
if (previous && next && previous.generation !== next.generation) {
|
|
83
|
+
if (retired.size >= 16) throw Error("Dashboard owner changed repeatedly; reopen the panel");
|
|
84
|
+
retired.add(previous.generation);
|
|
85
|
+
}
|
|
86
|
+
state.snapshot = snapshot;
|
|
87
|
+
state.lastObserved = snapshot;
|
|
88
|
+
state.error = undefined;
|
|
89
|
+
if (
|
|
90
|
+
state.acknowledgment?.state === "pending" &&
|
|
91
|
+
requestedJev !== undefined &&
|
|
92
|
+
snapshot.settings?.jev &&
|
|
93
|
+
!snapshot.settings.jev.pending
|
|
94
|
+
)
|
|
95
|
+
state.acknowledgment.state = snapshot.settings.jev.enabled === requestedJev ? "applied" : "refused";
|
|
96
|
+
return true;
|
|
97
|
+
};
|
|
64
98
|
return {
|
|
65
99
|
state,
|
|
66
100
|
async refresh() {
|
|
67
101
|
if (!request || state.pending) return;
|
|
68
|
-
const observed = generation
|
|
102
|
+
const observed = generation,
|
|
103
|
+
order = ++poll;
|
|
69
104
|
try {
|
|
70
105
|
const snapshot = await request({ action: "get" });
|
|
71
|
-
if (generation === observed) {
|
|
72
|
-
state.snapshot =
|
|
73
|
-
state.error =
|
|
106
|
+
if (generation === observed && order === poll && !accept(snapshot)) {
|
|
107
|
+
state.snapshot = undefined;
|
|
108
|
+
state.error = "Owner observation is stale or unavailable; controls disabled until a fresh reply.";
|
|
74
109
|
}
|
|
75
110
|
} catch (error) {
|
|
76
|
-
if (generation === observed) {
|
|
111
|
+
if (generation === observed && order === poll) {
|
|
77
112
|
state.snapshot = undefined;
|
|
78
|
-
state.error = `Controls unavailable: ${error instanceof Error ? error.message : String(error)}`;
|
|
113
|
+
state.error = `Controls unavailable; showing last observation: ${error instanceof Error ? error.message : String(error)}`;
|
|
79
114
|
}
|
|
80
115
|
}
|
|
81
116
|
},
|
|
82
117
|
async change(action: Exclude<DashboardSessionAction, { action: "get" }>) {
|
|
83
118
|
if (!request || !state.snapshot || state.pending) return false;
|
|
119
|
+
const observedOwner = state.snapshot.observation;
|
|
84
120
|
generation++;
|
|
85
121
|
state.pending = true;
|
|
122
|
+
requestedJev = action.action === "set-jev" ? action.enabled : undefined;
|
|
123
|
+
const effect =
|
|
124
|
+
action.action === "set-auto"
|
|
125
|
+
? "current permission handling; admitted work unchanged"
|
|
126
|
+
: action.action === "set-jev"
|
|
127
|
+
? "current JEV session; separate paid-call and storage choices"
|
|
128
|
+
: "future children; running children unchanged";
|
|
129
|
+
state.acknowledgment = { action: action.action, state: "pending", effect };
|
|
86
130
|
try {
|
|
87
|
-
|
|
88
|
-
|
|
131
|
+
const snapshot = await request({
|
|
132
|
+
...action,
|
|
133
|
+
...(observedOwner
|
|
134
|
+
? {
|
|
135
|
+
expectedOwner: {
|
|
136
|
+
sessionId: observedOwner.sessionId,
|
|
137
|
+
cwd: observedOwner.cwd,
|
|
138
|
+
generation: observedOwner.generation,
|
|
139
|
+
},
|
|
140
|
+
}
|
|
141
|
+
: {}),
|
|
142
|
+
});
|
|
143
|
+
if (!accept(snapshot)) throw Error("owner acknowledgment is stale; reconcile before another action");
|
|
144
|
+
state.acknowledgment.state =
|
|
145
|
+
action.action === "set-jev"
|
|
146
|
+
? snapshot.settings?.jev.pending
|
|
147
|
+
? "pending"
|
|
148
|
+
: snapshot.settings?.jev.enabled === action.enabled
|
|
149
|
+
? "applied"
|
|
150
|
+
: "refused"
|
|
151
|
+
: "applied";
|
|
89
152
|
return true;
|
|
90
153
|
} catch (error) {
|
|
91
154
|
state.snapshot = undefined;
|
|
92
|
-
state.
|
|
155
|
+
state.acknowledgment.state = "unconfirmed";
|
|
156
|
+
state.error = `Control change not confirmed; inspect owner before retrying: ${error instanceof Error ? error.message : String(error)}`;
|
|
93
157
|
return false;
|
|
94
158
|
} finally {
|
|
95
159
|
state.pending = false;
|
|
@@ -71,12 +71,10 @@ export function dashboardSettingsLines(
|
|
|
71
71
|
...(jev.error ? [` ${jev.error}`] : []),
|
|
72
72
|
row("wall", `Child wall: ${settings.wallSeconds}s (${settings.wallSource})`),
|
|
73
73
|
row("idle", `Child idle: ${settings.idleSeconds}s (${settings.idleSource})`),
|
|
74
|
-
settings.editable
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
"JEV ON asks paid-call and LoRA-storage consent in Pi.",
|
|
79
|
-
"Auto never supplies that consent. No model token budget.",
|
|
74
|
+
settings.editable ? "Limits affect future children only." : "Read-only: change settings in the owning parent.",
|
|
75
|
+
"Running children keep their limits.",
|
|
76
|
+
"JEV needs separate call/storage consent in Pi.",
|
|
77
|
+
"Auto does not grant JEV consent. No token budget.",
|
|
80
78
|
"",
|
|
81
79
|
"STARTUP LIMITS · restart to change",
|
|
82
80
|
row("descendants", `Active descendants: ${settings.descendants} (${settings.reserved} reserved) · PI_DADDY_FANOUT`),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Operator version inventory. These observations do not qualify runtime compatibility. */
|
|
2
|
-
export type EcosystemPackageId =
|
|
2
|
+
export type EcosystemPackageId =
|
|
3
|
+
"pi" | "pi-daddy" | "principal-pi-skills" | "skill-harness" | "pi-scout-research" | "bookie-pi-skills";
|
|
3
4
|
export interface EcosystemVersionRow {
|
|
4
5
|
id: EcosystemPackageId;
|
|
5
6
|
label: string;
|