my-durable 0.0.75 → 0.0.77
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/apps/dpi-backend/src/archived.ts +54 -9
- package/apps/dpi-backend/src/git.ts +144 -63
- package/apps/dpi-backend/src/routes.ts +22 -6
- package/apps/dpi-backend/src/store.ts +103 -14
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/{index-BmxTF5DB.js → index-CRSjEtI_.js} +28 -28
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/index.html +1 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/src/client/git-store.ts +71 -10
- package/apps/dpi-playground/apps/dpi-playground-hub/src/audit.ts +11 -3
- package/apps/dpi-playground/apps/dpi-playground-hub/src/main.ts +4 -1
- package/apps/dpi-playground/apps/dpi-playground-hub/src/monitor.ts +25 -2
- package/apps/dpi-sdk/src/api.ts +5 -1
- package/apps/dpi-sdk/src/models.ts +108 -15
- package/apps/dpi-sdk/src/node/registry.ts +5 -2
- package/apps/dpi-sdk/src/transcript.ts +1 -0
- package/apps/dpi-tui/src/app.ts +7 -6
- package/apps/dpi-tui/src/pickers.ts +11 -8
- package/apps/dpi-tui/src/sanitize.ts +5 -0
- package/apps/dpi-tui/src/views.ts +15 -15
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import type { SessionSummary } from "../../dpi-sdk/src/api.ts";
|
|
|
7
7
|
import type { GitStatus } from "../../dpi-sdk/src/client.ts";
|
|
8
8
|
import type { DeviceRow } from "../../dpi-sdk/src/node/registry.ts";
|
|
9
9
|
import { c, STATE_COLOR, STATE_GLYPH, type RowState } from "./theme.ts";
|
|
10
|
-
import { sanitizeTerminal } from "./sanitize.ts";
|
|
10
|
+
import { oneLine, sanitizeTerminal } from "./sanitize.ts";
|
|
11
11
|
|
|
12
12
|
export type View = "herd" | "network" | "agent" | "log";
|
|
13
13
|
|
|
@@ -68,7 +68,7 @@ export const sessionState = (s: SessionSummary): RowState =>
|
|
|
68
68
|
* web's GitPanel has carried a merge banner all along. Mirrors the FE text.
|
|
69
69
|
*/
|
|
70
70
|
export function gitStateSuffix(g: Pick<GitStatus, "merge" | "conflicts" | "detached">): string {
|
|
71
|
-
if (g.merge) return ` · merging (${g.conflicts
|
|
71
|
+
if (g.merge) return ` · merging (${Number(g.conflicts) || 0} conflicts)`;
|
|
72
72
|
if (g.detached) return " (detached)";
|
|
73
73
|
return "";
|
|
74
74
|
}
|
|
@@ -102,19 +102,19 @@ export function herdRows(sessions: SessionSummary[], filter = "", branchOf?: (cw
|
|
|
102
102
|
const out: HerdRow[] = [];
|
|
103
103
|
const groups = new Map<string, SessionSummary[]>();
|
|
104
104
|
for (const s of kept) {
|
|
105
|
-
const key = basename(s.cwd);
|
|
105
|
+
const key = basename(String(s.cwd ?? ""));
|
|
106
106
|
const list = groups.get(key) ?? [];
|
|
107
107
|
list.push(s);
|
|
108
108
|
groups.set(key, list);
|
|
109
109
|
}
|
|
110
110
|
for (const [dir, list] of groups) {
|
|
111
|
-
out.push({ kind: "group", label:
|
|
111
|
+
out.push({ kind: "group", label: oneLine(String(dir ?? "")) });
|
|
112
112
|
for (const s of list)
|
|
113
113
|
out.push({
|
|
114
114
|
kind: "session",
|
|
115
|
-
label:
|
|
115
|
+
label: oneLine(String(s.name ?? "")),
|
|
116
116
|
sessionId: s.id,
|
|
117
|
-
branch: branchOf ?
|
|
117
|
+
branch: branchOf ? oneLine(String(branchOf(String(s.cwd ?? "")) ?? "")) || undefined : undefined,
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
return out;
|
|
@@ -147,7 +147,7 @@ export function renderHerd(
|
|
|
147
147
|
const cursorRow = rows[opts.cursor ?? 0];
|
|
148
148
|
for (const row of rows) {
|
|
149
149
|
if (row.kind === "group") {
|
|
150
|
-
const group = sessions.filter((s) =>
|
|
150
|
+
const group = sessions.filter((s) => oneLine(String(basename(String(s.cwd ?? "")) ?? "")) === row.label);
|
|
151
151
|
const busy = group.filter((s) => s.busy).length;
|
|
152
152
|
const header = `${c.muted("~/")}${c.text(row.label)}${c.muted("/")} ${c.muted(`· ${group.length} agent${group.length === 1 ? "" : "s"} · ${busy} busy`)}`;
|
|
153
153
|
// The cursor is drawn on headers too: a keypress must always be visible,
|
|
@@ -167,7 +167,7 @@ export function renderHerd(
|
|
|
167
167
|
const branch = row.branch ? ` ${c.muted(`⎇ ${fit(row.branch, 10)}`)}` : "";
|
|
168
168
|
let line =
|
|
169
169
|
`${marker}${fit(selected ? c.bold(row.label) : row.label, cols.name - visibleWidth(branch))}${branch} ${fit(state, cols.state)}` +
|
|
170
|
-
(showModel ? ` ${fit(c.muted(
|
|
170
|
+
(showModel ? ` ${fit(c.muted(oneLine(String((basename(String(s.model ?? "")) || s.model) ?? ""))), cols.model)}` : "") +
|
|
171
171
|
` ${fit(c.muted(agents), cols.agents)}`;
|
|
172
172
|
if (showAge) line += ` ${fit(c.muted(ageOf(s.createdAt)), cols.age)}`;
|
|
173
173
|
lines.push(atCursor && !selected ? c.inverse(fit(line, w)) : fit(line, w));
|
|
@@ -208,12 +208,12 @@ export function networkRows(devices: DeviceRow[], currentDeviceId: string, filte
|
|
|
208
208
|
continue;
|
|
209
209
|
out.push({
|
|
210
210
|
kind: "device",
|
|
211
|
-
label:
|
|
211
|
+
label: oneLine(String(d.name || d.id)),
|
|
212
212
|
deviceId: d.id,
|
|
213
213
|
current: d.id === currentDeviceId,
|
|
214
214
|
});
|
|
215
|
-
for (const s of d.lastTree?.sessions
|
|
216
|
-
out.push({ kind: "session", label:
|
|
215
|
+
for (const s of (Array.isArray(d.lastTree?.sessions) ? d.lastTree!.sessions : []))
|
|
216
|
+
out.push({ kind: "session", label: oneLine(String(s.name ?? "")), deviceId: d.id, sessionId: s.id });
|
|
217
217
|
}
|
|
218
218
|
return out;
|
|
219
219
|
}
|
|
@@ -283,7 +283,7 @@ export function renderStatusbar(
|
|
|
283
283
|
: ["j/k move", "↵ open", "1-4 views", "⇥ tabs", "esc agent"];
|
|
284
284
|
// Catalog miss degrades to "?" (R5 finding 5): "—" read as "no usage yet",
|
|
285
285
|
// when it actually means the window is unknown — a different problem.
|
|
286
|
-
const right = `${c.muted("ctx")} ${opts.ctxLeft === undefined ? c.muted("?") : c.text(`${opts.ctxLeft}%`)}${opts.background ? c.muted(` · ${opts.background} bg`) : ""} ${c.muted("dev")} ${c.text(fit(
|
|
286
|
+
const right = `${c.muted("ctx")} ${opts.ctxLeft === undefined ? c.muted("?") : c.text(`${opts.ctxLeft}%`)}${opts.background ? c.muted(` · ${opts.background} bg`) : ""} ${c.muted("dev")} ${c.text(fit(oneLine(String(opts.device ?? "")), 18))}`;
|
|
287
287
|
const left = `${chip} ${keys.map((k) => c.muted(k)).join(c.muted(" • "))}`;
|
|
288
288
|
const gap = Math.max(1, w - visibleWidth(left) - visibleWidth(right));
|
|
289
289
|
return c.inverse(padTo(fit(`${left}${rep(" ", gap)}${right}`, w), w));
|
|
@@ -355,10 +355,10 @@ export function renderHerdPanel(
|
|
|
355
355
|
const onDefault = defaultModel !== undefined && s.model === defaultModel;
|
|
356
356
|
const lines = [
|
|
357
357
|
c.muted(" OVERVIEW"),
|
|
358
|
-
` ${c.bold(
|
|
359
|
-
` ${c.muted(
|
|
358
|
+
` ${c.bold(oneLine(String(s.name ?? "")))}`,
|
|
359
|
+
` ${c.muted(oneLine(String(basename(String(s.cwd ?? "")) ?? "")))} ${c.muted("·")} ${c.text(oneLine(String((basename(String(s.model ?? "")) || s.model) ?? "")))}${onDefault ? c.muted(" (default)") : ""}`,
|
|
360
360
|
git?.repo
|
|
361
|
-
? ` ${c.muted("⎇")} ${c.text(
|
|
361
|
+
? ` ${c.muted("⎇")} ${c.text(oneLine(String(git.branch ?? git.head ?? "?")))}${c.muted("±")}${c.text(String((Number(git.staged) || 0) + (Number(git.unstaged) || 0) + (Number(git.untracked) || 0)))}${Number(git.ahead) > 0 ? c.text(` ↑${Number(git.ahead)}`) : ""}${Number(git.behind) > 0 ? c.text(` ↓${Number(git.behind)}`) : ""}${git.worktreeOf ? c.muted(" · worktree") : ""}`
|
|
362
362
|
: "",
|
|
363
363
|
"",
|
|
364
364
|
` ${c.muted("state")} ${STATE_COLOR[sessionState(s)](sessionState(s))}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-durable",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77",
|
|
4
4
|
"description": "Durable Pi — the durable agent network: hub web UI, device backend daemon, TUI admin and the shared SDK, packaged as one runnable monorepo install",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|