my-durable 0.0.36 → 0.0.38

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.
Files changed (24) hide show
  1. package/README.md +1 -0
  2. package/apps/dpi-backend/src/doctor.ts +426 -0
  3. package/apps/dpi-backend/src/routes.ts +7 -0
  4. package/apps/dpi-backend/src/store.ts +121 -0
  5. package/apps/dpi-backend/src/vitals.ts +94 -0
  6. package/apps/dpi-backend/src/zip.ts +117 -0
  7. package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-D4M8tCcs.js +81 -0
  8. package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/{index-BxJGBCW9.css → index-xOvj8ub1.css} +1 -1
  9. package/apps/dpi-playground/apps/dpi-playground-fe/dist/index.html +2 -2
  10. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/store.ts +12 -0
  11. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/Composer.vue +74 -1
  12. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/HostPanel.vue +224 -0
  13. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/Inspector.vue +74 -1
  14. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/NetworkSidebar.vue +184 -4
  15. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/NewSessionDialog.vue +41 -0
  16. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TopBar.vue +68 -1
  17. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TreeRow.vue +17 -1
  18. package/apps/dpi-sdk/src/api.ts +41 -0
  19. package/apps/dpi-sdk/src/client.ts +17 -0
  20. package/apps/dpi-sdk/src/protocol/rest-routes.ts +3 -0
  21. package/bin/dpi.mjs +11 -0
  22. package/docs/host-project-checklist.md +214 -0
  23. package/package.json +2 -2
  24. package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-DKJspajj.js +0 -81
@@ -3,21 +3,45 @@
3
3
  // stream state, and the panel/new-session actions. Presentation only; all data comes
4
4
  // from client/store.ts.
5
5
  import { computed, ref } from "vue";
6
- import { CircleHelp, Network, PanelLeft, PanelRight, Plus } from "lucide-vue-next";
6
+ import { CircleHelp, Network, PanelLeft, PanelRight, Plus, Bell } from "lucide-vue-next";
7
7
  import {
8
8
  attempt,
9
+ markNotificationsRead,
9
10
  network,
10
11
  notify,
12
+ notifications,
11
13
  online,
12
14
  select,
13
15
  selected,
14
16
  sessionHandle,
15
17
  streamState,
16
18
  ui,
19
+ usage,
17
20
  showInspector,
18
21
  hideInspector,
19
22
  } from "../client/store";
20
23
 
24
+ const bellOpen = ref(false);
25
+ const unread = computed(() => notifications.filter((n) => !n.read).length);
26
+ const openBell = () => {
27
+ bellOpen.value = !bellOpen.value;
28
+ if (bellOpen.value) markNotificationsRead();
29
+ };
30
+ const when = (at: number) => {
31
+ const sec = Math.round((Date.now() - at) / 1000);
32
+ return sec < 60 ? `${sec}s` : sec < 3600 ? `${Math.floor(sec / 60)}m` : `${Math.floor(sec / 3600)}h`;
33
+ };
34
+ const sessionTokens = computed(
35
+ () => usage.value.input + usage.value.output + usage.value.cacheRead + usage.value.cacheWrite,
36
+ );
37
+ const sessionCost = computed(
38
+ () =>
39
+ (usage.value.inputCost ?? 0) +
40
+ (usage.value.outputCost ?? 0) +
41
+ (usage.value.cacheReadCost ?? 0) +
42
+ (usage.value.cacheWriteCost ?? 0),
43
+ );
44
+
21
45
  const onlineCount = computed(
22
46
  () => network.devices.value.filter((d) => d.status === "online").length,
23
47
  );
@@ -82,7 +106,31 @@ const emit = defineEmits<{ newSession: [] }>();
82
106
  ><span class="dot" :class="{ off: streamState !== 'live' }" aria-hidden="true" />{{
83
107
  streamState === "live" ? "Connected" : "Reconnecting"
84
108
  }}</span
109
+ ><span v-if="sessionTokens" class="usage-chip" title="This session's token usage and cost">{{
110
+ sessionTokens.toLocaleString()
111
+ }}
112
+ tok · ${{ sessionCost.toFixed(3) }}</span
85
113
  ><button
114
+ class="icon-button"
115
+ :aria-label="`Notifications${unread ? ` (${unread} unread)` : ''}`"
116
+ :title="`Notification center${unread ? ` — ${unread} unread` : ''}`"
117
+ @click="openBell"
118
+ >
119
+ <Bell :size="18" /><i v-if="unread" class="bell-dot">{{ unread > 9 ? "9+" : unread }}</i>
120
+ </button>
121
+ <div v-if="bellOpen" class="notif-panel" @click.stop>
122
+ <header>
123
+ <b>Notifications</b>
124
+ <button class="icon-button" aria-label="Close notifications" @click="bellOpen = false">✕</button>
125
+ </header>
126
+ <p v-if="!notifications.length" class="hint">Nothing yet — events land here as they happen.</p>
127
+ <ul>
128
+ <li v-for="n in notifications" :key="n.id" :class="{ unread: !n.read }">
129
+ <span class="when">{{ when(n.at) }}</span><span>{{ n.text }}</span>
130
+ </li>
131
+ </ul>
132
+ </div>
133
+ <button
86
134
  class="icon-button"
87
135
  title="How this works"
88
136
  aria-label="How this works"
@@ -112,3 +160,22 @@ const emit = defineEmits<{ newSession: [] }>();
112
160
  </div>
113
161
  </header>
114
162
  </template>
163
+
164
+ <style scoped>
165
+ .usage-chip { font-size: 12px; opacity: 0.8; margin-right: 6px; white-space: nowrap; }
166
+ .bell-host, .icon-button:has(.bell-dot) { position: relative; }
167
+ .bell-dot {
168
+ position: absolute; top: -4px; right: -4px; font-size: 9px; font-style: normal;
169
+ background: var(--warn, #e5a50a); color: #000; border-radius: 8px; padding: 0 4px;
170
+ }
171
+ .notif-panel {
172
+ position: absolute; top: calc(100% + 6px); right: 8px; z-index: 80; width: 320px; max-height: 340px;
173
+ overflow: auto; background: var(--bg-2, #221a1c); border: 1px solid var(--line); border-radius: 10px;
174
+ padding: 10px 12px; box-shadow: 0 10px 30px rgb(0 0 0 / 50%);
175
+ }
176
+ .notif-panel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
177
+ .notif-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
178
+ .notif-panel li { display: flex; gap: 8px; font-size: 14px; opacity: 0.85; }
179
+ .notif-panel li.unread { opacity: 1; font-weight: 550; }
180
+ .notif-panel .when { opacity: 0.6; font-size: 12px; min-width: 3ch; text-align: right; }
181
+ </style>
@@ -25,8 +25,12 @@ const props = defineProps<{
25
25
  selected: boolean;
26
26
  focused: boolean;
27
27
  online: boolean;
28
+ /** Bulk-manage mode (orca ManageSessions): when set, session rows show a
29
+ * checkbox instead of the action menu. */
30
+ checkbox?: boolean;
31
+ checked?: boolean;
28
32
  }>();
29
- const emit = defineEmits<{ toggle: []; activate: []; action: [name: string] }>();
33
+ const emit = defineEmits<{ toggle: []; activate: []; action: [name: string]; check: [] }>();
30
34
 
31
35
  const hasChildren = computed(() => props.node.children.length > 0);
32
36
  const device = computed(() => (props.node.type === "device" ? props.node.device : undefined));
@@ -139,6 +143,16 @@ const title = computed(() => {
139
143
  </span>
140
144
  </template>
141
145
  <template v-else-if="session">
146
+ <input
147
+ v-if="checkbox"
148
+ type="checkbox"
149
+ class="bulk-check"
150
+ :checked="checked"
151
+ :aria-label="`Select ${label}`"
152
+ tabindex="-1"
153
+ @click.stop
154
+ @change="emit('check')"
155
+ />
142
156
  <FolderOpen class="ico" :size="16" />
143
157
  <b class="name">{{ label }}</b>
144
158
  <span class="path">…/{{ session.cwd.split("/").filter(Boolean).at(-1) }}</span>
@@ -201,3 +215,5 @@ const title = computed(() => {
201
215
  </template>
202
216
  </div>
203
217
  </template>
218
+
219
+ <style scoped>.bulk-check { margin-left: 2px; flex-shrink: 0; }</style>
@@ -189,6 +189,47 @@ export function compactionThresholds(window: number, s: CompactionSettings) {
189
189
  return { wait, auto: s.backgroundTokens > 0 ? Math.max(0, wait - s.backgroundTokens) : undefined };
190
190
  }
191
191
 
192
+ /** One device's live host health — asked for on demand, never polled. */
193
+ export interface DeviceVitals {
194
+ /** Seconds the host has been up. */
195
+ uptime: number;
196
+ /** Seconds the device process has been running (the daemon's own age). */
197
+ processUptime: number;
198
+ /** 1/5/15-minute load averages; zeros on Windows, which has no equivalent. */
199
+ loadavg: [number, number, number];
200
+ cpuCount: number;
201
+ memory: {
202
+ totalBytes: number;
203
+ freeBytes: number;
204
+ usedBytes: number;
205
+ processRssBytes: number;
206
+ heapUsedBytes: number;
207
+ };
208
+ /** Free/total bytes for the volume holding the device's data dir. */
209
+ disk: { path: string; totalBytes: number; freeBytes: number; known: boolean };
210
+ pid: number;
211
+ at: number;
212
+ /** Sessions this device knows about; `archived` counts the archive directories. */
213
+ counts?: { sessions: number; archived: number };
214
+ }
215
+
216
+ /** One session-search hit: the summary fields plus which of them matched. */
217
+ export interface SessionSearchMatch {
218
+ id: string;
219
+ name: string;
220
+ cwd: string;
221
+ model: string;
222
+ createdAt: number;
223
+ dbPath: string;
224
+ compaction?: CompactionSettings;
225
+ where: Array<"name" | "cwd" | "model">;
226
+ }
227
+
228
+ export interface SessionSearchResult {
229
+ query: string;
230
+ matches: SessionSearchMatch[];
231
+ }
232
+
192
233
  export interface DeviceTree {
193
234
  uid: string;
194
235
  name: string;
@@ -8,12 +8,14 @@ import type {
8
8
  CreateSessionBody,
9
9
  DeviceInfo,
10
10
  DeviceTree,
11
+ DeviceVitals,
11
12
  DirListing,
12
13
  ErrorCode,
13
14
  ForkBody,
14
15
  Frame,
15
16
  Page,
16
17
  SendResult,
18
+ SessionSearchResult,
17
19
  SessionSummary,
18
20
  TaskOutcome,
19
21
  WhenBusy,
@@ -195,9 +197,17 @@ export class DpiClient {
195
197
  device(options?: RequestOptions) {
196
198
  return this.request<DeviceInfo>("GET", "/v1/device", undefined, options);
197
199
  }
200
+ /** Host health of this device (uptime, load, memory, disk) — on demand. */
201
+ vitals() {
202
+ return this.request<DeviceVitals>("GET", "/v1/device/vitals");
203
+ }
198
204
  tree() {
199
205
  return this.request<DeviceTree>("GET", "/v1/tree");
200
206
  }
207
+ /** Session search over names/cwds/models (transcripts are not scanned). */
208
+ searchSessions(query: string) {
209
+ return this.request<SessionSearchResult>("GET", `/v1/sessions/search?q=${enc(query)}`);
210
+ }
201
211
  dirs(path = "") {
202
212
  return this.request<DirListing>("GET", `/v1/fs/dirs?path=${enc(path)}`);
203
213
  }
@@ -239,6 +249,13 @@ export class DpiClient {
239
249
  return this.request<GitOpResult>("POST", "/v1/git", { path, op, ...opts });
240
250
  }
241
251
  /** Paths this session's agents wrote/edited — the session-changelist. */
252
+ /** One zipped bundle of a session (manifest + record + agent transcripts/configs). */
253
+ exportSession(sessionId: string) {
254
+ return this.request<{ filename: string; mime: string; bytes: number; base64: string }>(
255
+ "GET",
256
+ `/v1/sessions/${enc(sessionId)}/export`,
257
+ );
258
+ }
242
259
  sessionGitFiles(sessionId: string) {
243
260
  return this.request<{ files: string[] }>("GET", `/v1/sessions/${enc(sessionId)}/git-files`);
244
261
  }
@@ -11,6 +11,7 @@
11
11
 
12
12
  const ROUTES: readonly (readonly [method: string, pattern: string])[] = [
13
13
  ["GET", "/device"],
14
+ ["GET", "/device/vitals"],
14
15
  ["GET", "/tree"],
15
16
  ["GET", "/fs/dirs"],
16
17
  ["GET", "/git/status"],
@@ -20,7 +21,9 @@ const ROUTES: readonly (readonly [method: string, pattern: string])[] = [
20
21
 
21
22
  ["GET", "/sessions"],
22
23
  ["POST", "/sessions"],
24
+ ["GET", "/sessions/search"],
23
25
  ["GET", "/sessions/:s"],
26
+ ["GET", "/sessions/:s/export"],
24
27
  ["PATCH", "/sessions/:s"],
25
28
  ["DELETE", "/sessions/:s"],
26
29
  ["GET", "/sessions/:s/compaction"],
package/bin/dpi.mjs CHANGED
@@ -3,6 +3,7 @@
3
3
  // dpi hub [--port N] [--host H] [--public-host H] web UI + device tunnel server
4
4
  // dpi device [start|stop|status|install|uninstall] device-side daemon
5
5
  // dpi tui terminal admin client
6
+ // dpi doctor [--json] [--quiet] one-shot device health check
6
7
  // Every subcommand runs the TypeScript entry through tsx, so no build step is needed.
7
8
  import { access } from "node:fs/promises";
8
9
  import { fileURLToPath } from "node:url";
@@ -29,6 +30,9 @@ Usage:
29
30
  dpi devices [--watch] [--hub <origin>] paired machines + live status (CLI, no web)
30
31
  dpi tui
31
32
  Terminal admin client.
33
+ dpi doctor [--json] [--quiet]
34
+ One-shot health check: node >= 22.19.0, healthz, start-dir writability,
35
+ the default-model probe and the hub. Exit 1 when a check fails.
32
36
  dpi help | dpi --help | dpi -h
33
37
  dpi version | dpi --version | dpi -v
34
38
  dpi update [--check]
@@ -134,6 +138,13 @@ if (command === "update" || command === "upgrade") {
134
138
  register();
135
139
  const { runPairCommand } = await import("../apps/dpi-backend/src/pair-cli.ts");
136
140
  process.exit(await runPairCommand(commandRest));
141
+ } else if (command === "doctor") {
142
+ // One-shot health check. The logic lives in the backend as TS (testable with
143
+ // injected fakes); this is only the tsx loader + the exit code.
144
+ const { register } = await loadTsx();
145
+ register();
146
+ const { doctorCli } = await import("../apps/dpi-backend/src/doctor.ts");
147
+ process.exit(await doctorCli(commandRest));
137
148
  } else if (!Object.hasOwn(COMMANDS, command)) {
138
149
  process.stderr.write(`dpi: unknown command '${command}'\n\n${HELP}`);
139
150
  process.exit(2);
@@ -0,0 +1,214 @@
1
+ # Host / Project / Device / Session Management Feature Checklist — orca / paseo / zcode / herdr / piggery → durable-pi
2
+
3
+ Run: `team_20261024143910_47d06fe8b77400d4` · Steps: 01_explore (inventory) → 02_analyze (verify/correct) → 03_write (this file)
4
+ Status: **Waves 1a+1b ADOPTED (0.0.38 — live-verified in production Chrome: bell+panel, usage chip+total row, transcript download, prompt library, bulk select bar, recent-cwds chips; Host vitals with real uptime/load/memory/disk, tunnel-routed session search, and a bundle zip that real `unzip` opens).** Waves 2+ remain planning input. Companion to `docs/git-ui-checklist.md` (CLOSED): that file covered the git panel; this one covers everything **around** the agent runtime — projects/workspaces, host/device management, session lifecycle, config/credentials, diagnostics, maintenance. Git-panel features are deliberately absent here. Every load-bearing citation below was re-read in the actual files during this run (see [Verification log](#verification-log)).
5
+
6
+ ## Why this doc exists
7
+
8
+ Our device/hub/session stack is real and durable, but five local reference repos have shipped
9
+ years of operational UX we have not: orca (Electron desktop app) treats a fleet of local+remote
10
+ machines as a first-class managed surface; paseo and zcode have project/workspace registries with
11
+ labels, archiving and scheduling; herdr is our TUI template and models device vitals; piggery has
12
+ CLI ops discipline (check/doctor/gc/update). This checklist inventories those features, marks what
13
+ we already cover, and sequences the remainder into adoption waves sized for PR-sized work. It is a
14
+ planning input, not a commitment: the leader picks the sequencing, and four policy decisions gate
15
+ the later waves.
16
+
17
+ **How to read it**
18
+
19
+ - Coverage vs our baseline: ✅ covered · 🟡 partial (name the delta) · ❌ missing.
20
+ - Tier: **MUST-LEARN** = orca main flows (primary reference — desktop app, richest ops UX) ·
21
+ **SHOULD** = paseo/zcode/herdr/piggery niceties · **SKIP** = infra-specific, do not adopt.
22
+ - Waves sequence by effort/dependency: 1a FE-only → 1b small BE → 2 medium → 3 differentiators.
23
+ - Reference roots: orca `/tmp/research/orca`, paseo `/tmp/research/paseo`, zcode `/tmp/research/zcode`,
24
+ herdr `/tmp/research/herdr/herdr-0.4.0`, piggery `/tmp/research/piggery`. Citations are repo-relative.
25
+ - Our side: `routes.ts` = `durable-pi/apps/dpi-backend/src/routes.ts`; `store.ts` = same dir;
26
+ hub sources under `durable-pi/apps/dpi-playground/apps/dpi-playground-hub/src/`; FE components under
27
+ `durable-pi/apps/dpi-playground/apps/dpi-playground-fe/src/`.
28
+
29
+ ## Our baseline (verified today)
30
+
31
+ All line numbers re-pinned by direct read in this run.
32
+
33
+ **Devices & hub:**
34
+
35
+ - `monitor.ts:1-2,39` — one loop per registry device: probe `/v1/device`, classify
36
+ (online/offline/unauthorized/mismatch/incompatible), then follow `/v1/events`; backoff offline
37
+ 1s→30s, human-fixable states 30s. WSS tunnel with credential auth/revocation in `tunnel.ts`;
38
+ per-address token budgets are charged **before** a credential resolves, hub-wide bucket after
39
+ (`tunnel.ts:369-372`, anti-starvation comment).
40
+ - Device API: GET `/device` (`routes.ts:114` — info, model catalog, `defaultModel`), POST
41
+ `/device/probe-model` (`routes.ts:117` — one provider, one throwaway session; comment `:115-116`:
42
+ "Local control plane only — deliberately NOT tunnelled"), GET `/fs/dirs` (`routes.ts:130`).
43
+ - Pairing: QR ceremony (`PairDeviceWizard.vue` + device `pairing.ts`); operator side in FE
44
+ `client/pair.ts:116-123` — rotate `:116-118` (202, async via tunnel), durable revoke `:119-123`.
45
+ **`DeviceCredentialsDialog.vue` + `TokenManager.vue` manage tunnel *pairing* credentials**
46
+ (fingerprint, generation, rotate, revoke) — not pi provider keys (see corrections register #1).
47
+ - Offline: `OfflinePanel.vue` + the monitor's status machine/backoff. This is a strength —
48
+ do not rebuild it.
49
+
50
+ **Sessions & agents** (`routes.ts:171-295`):
51
+
52
+ - CRUD: list/create `:172-173`, read/rename `:174-175`, archive DELETE `:178`, events SSE `:179`,
53
+ tasks + abort `:185-199`, inspect `:200`, submissions `:201-214`.
54
+ - Agent surface: rename, fork, compact, reset, abort (incl. background), config PATCH, extensions
55
+ PATCH, subagents, inbox withdraw — and **transcript export** GET `…/transcript?format=json|markdown`
56
+ (`routes.ts:241` → `store.ts:1237-1239`). No FE download button, no full-bundle export.
57
+ - Session-scoped git: `/sessions/:s/git-files` `:182` and `/git-turns` `:184` (closed git checklist).
58
+
59
+ **Projects & workspaces — none.** `DPI_START_DIRS` env is the only project-adjacent surface
60
+ (`dpi-network.example.yaml:23-30` documents how `backend.env` is generated from `start_dirs` +
61
+ `env`/`env_keys`); sessions are keyed by cwd; the TUI herd view already groups sessions by cwd
62
+ (`dpi-tui/src/views.ts:72-73`). No project entity, recents, templates, or per-project settings.
63
+
64
+ **Ops:**
65
+
66
+ - `bin/dpi.mjs:23-36` — device start/stop/status (background daemon), install/uninstall
67
+ (systemd/launchd), `devices --watch`, `update --check`.
68
+ - `bin/update.mjs:1-12` — self-update handling the two Windows hazards explicitly (EBUSY: stop the
69
+ daemon around the update; EBADENGINE: refuse Node < 22.19.0 up front). Dependency-injected, tested.
70
+ - `hub/src/audit.ts:172-181` — disk-free guard refuses audited work when the registry volume is
71
+ nearly full; `volumeFreeBytes()` uses `statfs` (`:183-196`). Internal only — no user-facing
72
+ health surface. `device.log`, `/healthz` exist on the device.
73
+
74
+ **Usage:** per-agent rows in `Inspector.vue:67-72` (input/output/cacheRead/cacheWrite tokens+cost);
75
+ last-message total in `ContextBar.vue:42`. No aggregation, calendar, or provider rollup.
76
+
77
+ **TUI:** herdr-template views herd/network/agent/log (`dpi-tui/src/views.ts:10-17`), multi-host feed.
78
+
79
+ **Verified absent (grep/read this run):** no session/project search route, no recents or templates in
80
+ `NewSessionDialog.vue` (draft is exactly `{ name, cwd, model }`, `:43`), no notifications/webhook/cron
81
+ features anywhere in FE/backend/hub, no CPU/RAM/uptime surface, no env-var UI, no backup/restore,
82
+ no doctor.
83
+
84
+ ## Corrections register
85
+
86
+ The analyst corrected the explorer's first draft; the writer re-verified each correction (and re-pinned a few of the analyst's own line numbers). Do not resurrect the originals.
87
+
88
+ | # | Claim | Correction | Evidence (all re-read) |
89
+ |---|---|---|---|
90
+ | 1 | "`DeviceCredentialsDialog.vue` = pi credential store, read-only" | **Wrong attribution.** That dialog + `TokenManager.vue` manage *tunnel pairing* credentials (rotate/revoke). The read-only view over pi's files lives in the backend: `dpi-backend/src/pi-config.ts:1-12` ("The device never WRITES pi's files… so a headless daemon cannot corrupt an interactive login") and `:77-89` (writes refused by returning current value). Writable provider creds remain ❌ — but the evidence points at the right place. | both files read |
91
+ | 2 | "no session export/download" | **🟡, not ❌.** Transcript export API exists (`routes.ts:241`, `store.ts:1237-1239`, json or markdown). Missing: FE download button, full-bundle export/import. | both read |
92
+ | 3 | "NO project entity, DPI_START_DIRS only" | Stays ❌, but the adjacent rail is real: `dpi-network.example.yaml:23-30` already generates per-device `backend.env` from `start_dirs` + `env`/`env_keys`, and the TUI already groups by cwd (`views.ts:72-73`) — the natural seed for a project layer. | both read |
93
+ | 4 | "no cron/scheduled" | Stays ❌, evidence sharpened: `dpi-sdk/tests/config.test.ts:25` **actively rejects** `service: cron` (launchd/systemd only). Scheduling must be a new, explicit surface — not smuggled in as a service kind. | test read; block `:21-29` |
94
+ | 5 | "route pins drift ±4" | **No drift.** The analyst reported :114/:117/:130 had drifted; writer re-read with a narrow window — GET `/device` is exactly `:114`, `probe-model` `:117`, `/fs/dirs` `:130`. Originals stand. | narrow-window read |
95
+ | 6* | (writer-time re-pins) | `config.test.ts:25` (analyst said :26); `Inspector.vue:67-72` (was :67-71); FE credential ops pinned to `client/pair.ts:116-123` (was "pair.ts:116", dir ambiguous). | all read |
96
+
97
+ \* Row 6 was pinned during the write step's final verification pass, not by the analyst.
98
+
99
+ ## Policy decisions that gate later waves
100
+
101
+ Four rows below cannot default; they need the leader's decision before their wave enters the roadmap.
102
+ None of them blocks Wave 1.
103
+
104
+ 1. **Crash reporting** (Wave 3) — privacy posture: what is collected, opt-in vs opt-out.
105
+ 2. **Writable provider credentials** (Wave 3) — pi owns `~/.pi/agent/auth.json`; our read-only view is
106
+ deliberate (`pi-config.ts:10-11`). A write path means deciding who owns that file.
107
+ 3. **Retention / auto-archive defaults** (Wave 2) — deletes user data; needs explicit defaults and a
108
+ dry-run story before any automatic deletion.
109
+ 4. **Hub-driven remote updates** (Wave 2) — trust boundary: the hub must never push code to devices.
110
+ Badge-only (device self-updates, hub informs) is the safe shape; anything more needs a decision.
111
+
112
+ ## Wave 1a — FE-only, no BE change (start here)
113
+
114
+ | Tier | Feature | Source (path:line) | Ours | Adoption suggestion |
115
+ |---|---|---|---|---|
116
+ | MUST | Recent cwds in NewSessionDialog | orca `components/new-workspace/` composer (set-location/start-from) | ❌ | persist last N cwds per device in localStorage; chips under `DirBrowser` |
117
+ | MUST | Transcript download button | ours already (API `routes.ts:241` + `store.ts:1237-1239`); FE shape from orca export flows | 🟡 | button on Inspector → `GET …/transcript?format=markdown` → Blob download |
118
+ | MUST | Prompt library (quick commands) | orca `settings/QuickCommandsPane.tsx` (+List/ScopeFilter) | ❌ | localStorage snippets; insert-on-click into the composer |
119
+ | MUST | Bulk session manage (multi-select) | orca `settings/ManageSessionsSection.tsx` + `ManageSessionKillDialog.tsx` | 🟡 (archive `:178`, abort `:195` exist) | checkbox column in NetworkSidebar; client-side loop + per-row result chips |
120
+ | SHOULD | In-app notification center | orca `notifications/notification-delivery-service.ts:15-49`; piggery `docs/reference.md:15` | ❌ | toast feed derived from the existing `/events` stream (task done, attention needed); no webhook yet |
121
+ | SHOULD | Usage rollup header | orca `usage/usage-calendar-range.ts` | 🟡 (per-agent only, `Inspector.vue:67-72`) | sum the per-agent rows → device-level chip in NetworkSidebar |
122
+
123
+ ## Wave 1b — small BE, PR-sized endpoints
124
+
125
+ | Tier | Feature | Source (path:line) | Ours | Adoption suggestion |
126
+ |---|---|---|---|---|
127
+ | MUST | Device vitals endpoint + card | herdr `shared/types.ts:19` (`Device.uptime`, `since`); piggery `top` (`docs/reference.md:22`) | ✅ (`0.0.38`) | GET `/device/vitals` (`vitals.ts`: uptime, loadavg, memory, statfs free, counts) + Inspector **Host** tab (`HostPanel.vue`). On demand only — verified 0 requests until the tab opens |
128
+ | MUST | `dpi doctor` | piggery `check`/`doctor` (`docs/reference.md:33-34`) | ✅ (`0.0.38`) | `dpi doctor [--json] [--quiet]` (`doctor.ts`): node ≥ 22.19, healthz, start-dir writability, default-model probe, hub reachability; exit 1 only on FAIL, probe/hub are WARN |
129
+ | SHOULD | Session search (device-side first) | paseo `packages/server/src/server/agent-history-search.ts` | ✅ (`0.0.38`) | GET `/sessions/search?q=` matches names/cwd/models (never transcripts — FTS first). FE: instant local filter + debounced device call merged as "more on device" |
130
+ | SHOULD | Session export bundle | paseo `packages/server/src/server/exports.ts` | ✅ (`0.0.38`) | GET `/sessions/:s/export` → base64 zip (`zip.ts`, zero-dep writer): manifest + session record + per-agent transcript.json/.md + config.json. Import still later |
131
+
132
+ ## Wave 2 — medium
133
+
134
+ | Tier | Feature | Source (path:line) | Ours | Adoption suggestion |
135
+ |---|---|---|---|---|
136
+ | MUST | Project entity + labels + archive | paseo `workspace-registry.ts:22-40` (`PersistedProjectRecord`: projectId/rootPath/kind/displayName/projectKey with COMPAT migration, customName; atomic writes via `atomic-file.ts`); zcode `packages/services/src/project/CONTRACT.md` + `autoArchiveScheduler.ts` | ❌ | registry keyed on cwd; promote the TUI's group-by-cwd (`views.ts:72-73`) into an entity; copy paseo's schema-migration discipline |
137
+ | MUST | Scheduled sessions (device-side) | orca `automations/service.ts:186-211` (scheduled trigger, precheck, completion watcher; separate drift report) | ❌ | systemd timer / launchd job through the existing service layer; the **device** owns execution, the hub only displays. New surface — `config.test.ts:25` rejects `service: cron` by design |
138
+ | MUST | Usage dashboard | orca `usage/agent-token-usage.ts` + `usage-calendar-range.ts` (46-file suite incl. per-provider parsers) | 🟡 | persist the Inspector-shaped rows → per-device/per-provider/calendar views; entries already carry usage |
139
+ | SHOULD | Notification delivery fan-out | orca `notification-delivery-service.ts:15-49` (tray→mobile→desktop, burst cooldown); piggery notify hooks desktop/herdr/ntfy (`docs/reference.md:15`) | ❌ | webhook + ntfy targets driven from existing events; per-device cooldown like orca's |
140
+ | SHOULD | Env-var management UI | orca `settings/HostAgentEnvironmentEditor.tsx` + `agent-default-env-draft.ts` | ❌ | edit the `env`/`env_keys` blocks of `dpi-network.yaml` (the file that generates `backend.env`, `dpi-network.example.yaml:23-30`) |
141
+ | MUST | Retention / auto-GC — **policy #3** | orca `terminal-history-gc.ts`; piggery `gc --closed-before DURATION [--dry-run]` (`docs/reference.md:31`) | 🟡 (archive exists, no deletion policy) | archive → verify → delete, `--dry-run` first (piggery pattern); defaults need leader sign-off |
142
+ | SHOULD | Remote update badge — **policy #4** | orca `ssh/managed-server-update-check.ts` + `orcad-update-plan.ts` | 🟡 (`dpi update --check` exists, `dpi.mjs:36`) | hub compares `/device` version vs registry → badge. Device always self-updates; hub never pushes code |
143
+ | SHOULD | Backup/restore of session data | orca `rolling-file-backup.ts`; paseo `migrations/` (schema side) | ❌ | rolling copies of registry + device store ahead of schema migrations |
144
+ | SHOULD | Rate-limit surfacing | orca `rate-limits/` | ❌ | parse provider 429/limit info at probe/send time → hint in model picker |
145
+ | SHOULD | Per-project settings/instructions | orca `settings/RepositoryPane.tsx` | ❌ | after the project entity: per-project model/env defaults |
146
+
147
+ ## Wave 3 — differentiators / later
148
+
149
+ | Tier | Feature | Source (path:line) | Ours | Adoption suggestion |
150
+ |---|---|---|---|---|
151
+ | MUST | Interactive SSH suite | orca `src/main/ssh/` (connection, `port-forwarding/`, `remote-exec/`, `sftp-upload.ts`; the orcad-* provisioning suite is 100+ files) | 🟡 (ssh exists as a device *kind* for transport) | smallest slice first: sftp browse with the `/fs/dirs` shape over ssh; shell/port-forward later |
152
+ | SHOULD | Keep-awake during runs | orca `agent-awake-service.ts:53-97` (powerSaveBlocker, LinuxLidSleepAssertion, MacosSystemSleepAssertion, powerMonitor resume) | ❌ | device asserts no-sleep while any session is busy; electron-free needs a per-OS helper — cost it before committing |
153
+ | SHOULD | Bulk resume-after-restart UX | orca `NativeChatResumeOnRestartModal.tsx` (+ bulk-progress test) | 🟡 (durability exists — sessions survive daemon restarts) | post-restart modal listing interrupted sessions + one-click reopen, per-session progress |
154
+ | SHOULD | Telegram channel bridge | zcode `packages/services/src/bots/telegramChannelRuntime.ts` | ❌ | channel message → existing session inbox submission surface |
155
+ | SHOULD | Conversation share | zcode `packages/services/src/conversation-share/` | ❌ | builds on the 1b export bundle; decide retention first |
156
+ | SHOULD | Task-graph orchestration | paseo `packages/server/src/server/tasks/task-graph.ts` (+execution-order); zcode `task-groups/` | ❌ | multi-session DAG on top of durable jobs (run/check/approval already exist) |
157
+ | SHOULD | Diagnostic bundle | orca `settings/PrivacyDiagnosticBundleControls.tsx` | ❌ | redacted zip: versions, healthz, tunnel diagnostics, recent audit denies |
158
+ | SHOULD | Crash reporting — **policy #1** | orca `crash-reporting/` | ❌ | opt-in only if adopted at all; leader decides privacy posture |
159
+ | — (policy) | Writable provider credential store | orca `credentials/encrypted-api-key-file-store.ts` | ❌ (read-only by design, `pi-config.ts:10-11`) | **policy #2** — any write path needs an ownership decision over `~/.pi/agent/auth.json`; do not default |
160
+ | — | Remote daemon deploy (orcad-style) | orca `ssh/orcad-ssh-provisioning.ts` + migration/cutover suite | 🟡 (`dpi device install` covers local) | only if the SSH suite lands and manual deploy still hurts; orcad is an entire subsystem |
161
+
162
+ ## SKIP — infra-specific, do not adopt
163
+
164
+ - **Worktree management** — already adopted; closed in `docs/git-ui-checklist.md`.
165
+ - **OS keychain / vault** (orca `macos-keychain/`, `ai-vault/`) — pi owns credential storage; our
166
+ device is deliberately read-only over pi's files (`pi-config.ts:10-11`).
167
+ - **zcode settings-sync / skill-sync / plugin-sync** — the pi ecosystem syncs its own settings and skills.
168
+ - **zcode feishu/weixin channels** — CN-specific infra; telegram is the only channel worth costing.
169
+ - **orca ephemeral VM runtimes** (`ephemeral-vm/`) — the exe-dev device kind plus the
170
+ agent-sandboxes cookbook already cover the pattern.
171
+ - **orca updater internals** (`updater-prerelease-feed.ts`, `linux-package-update-recovery.ts`) —
172
+ Electron-distribution-specific; ours is npm + `bin/update.mjs` with EBUSY/EBADENGINE handled (`:1-12`).
173
+ - **piggery implementation internals** (Go, `internal/server/`) — behavior reference only; any port
174
+ is a re-implementation.
175
+
176
+ ## UX shape by repo
177
+
178
+ - **orca** — a desktop ops center: one settings pane per concern, host-scoped setting scopes,
179
+ notifications with delivery policy and burst cooldown, and a 100+-file remote-daemon subsystem
180
+ (fencing, migrations, cutover journals). Copy the *flows*, not the subsystem size.
181
+ - **paseo** — server-side registry discipline: zod-validated records with dated COMPAT migrations,
182
+ atomic writes, archive policies driven by merge events.
183
+ - **zcode** — contracts first: `project/CONTRACT.md` defines the entity, the scheduler is a service
184
+ beside it, channels and share are pluggable runtimes.
185
+ - **herdr** — one `shared/types.ts` feeds both clients; `Device.uptime`/`since` render inline in the
186
+ tree — the cheapest vitals UX of the five.
187
+ - **piggery** — CLI ops discipline: `check` validates config without side effects, `doctor` reports
188
+ state findings, `gc` defaults to dry-run, every destructive op asks once.
189
+ - **durable-pi today** — strong device/session durability and offline story; thin ops surface
190
+ (no vitals, no notifications, no project entity, no doctor).
191
+
192
+ ## Verification log
193
+
194
+ - **Writer (03_write, this run) — re-read and re-pinned:** `routes.ts` (:114/:117/:130 narrow-window;
195
+ session block :171-214; agents :216-295; transcript :241), `store.ts:1230-1241`, `pi-config.ts`
196
+ (read-only design :1-12, :77-89), `views.ts` (:10-17, herd group-by-cwd :72-73), `Inspector.vue:62-75`,
197
+ `ContextBar.vue:38-47`, `tunnel.ts:362-375`, `dpi-sdk/tests/config.test.ts:18-31`,
198
+ `dpi-network.example.yaml:20-35`, `NewSessionDialog.vue:1-75` (draft shape :43),
199
+ FE `client/pair.ts:108-123`, `monitor.ts:1-45`, `audit.ts:155-196`, `bin/dpi.mjs:22-39`,
200
+ `bin/update.mjs:1-12`; reference side: orca `automations/service.ts:183-212`,
201
+ `agent-awake-service.ts:53-97`, `notifications/notification-delivery-service.ts:15-49`,
202
+ plus directory confirmations of `ssh/`, `usage/`, `credentials/`, `project-groups/`;
203
+ paseo `workspace-registry.ts:1-40`, `project-directory-service.ts:7-36`, server dir listing
204
+ (`agent-history-search.ts`, `connected-hosts/`, `schedule/`, `push/`, `exports.ts`, `migrations/`);
205
+ zcode `project/` listing (CONTRACT.md, contract.ts, autoArchiveScheduler.ts), `bots/`,
206
+ `conversation-share/`, `credential/`; herdr `shared/types.ts:1-40`; piggery `docs/reference.md:9-36`.
207
+ - **Analyst (02_analyze)** — additionally read: `DeviceCredentialsDialog.vue` and `TokenManager.vue`
208
+ (full), `pairing.ts`, `dpi-backend/README.md`, `drivers.ts:118`, `dpi-sdk/src/node/config.ts:63`,
209
+ FE greps (credential/usage/transcript/notification/cron — no feature matches beyond those listed).
210
+ - **Explorer (01_explore)** — original inventory with citations; baseline component list; first-draft
211
+ coverage marks (5 corrected above).
212
+
213
+ *Planning input, not a commitment.* Wave 1a can start immediately (FE-only, touches no policy);
214
+ Waves 2–3 are gated by the four policy decisions above.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-durable",
3
- "version": "0.0.36",
4
- "description": "Durable Pi \u2014 the durable agent network: hub web UI, device backend daemon, TUI admin and the shared SDK, packaged as one runnable monorepo install",
3
+ "version": "0.0.38",
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": {
7
7
  "type": "git",