my-durable 0.0.47 → 0.0.48

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.
@@ -0,0 +1,197 @@
1
+ <script setup lang="ts">
2
+ // Old sessions (policy #3): the archive is a feature surface, not a graveyard.
3
+ // Everything the device ever archived, browsable — name, turns, size, last
4
+ // message — with a read-only transcript and a one-click restore back to live.
5
+ // Nothing here deletes: deletion stays `dpi gc`, operator-only by decision.
6
+ import { computed, ref, watch } from "vue";
7
+ import { Archive, RefreshCw, RotateCcw, Download } from "lucide-vue-next";
8
+ import type { ArchivedView } from "@sdk/api";
9
+ import { deviceClient, message } from "../client/hub";
10
+ import { notify, selected, ui } from "../client/store";
11
+
12
+ const sessions = ref<ArchivedView[] | null>(null);
13
+ const loading = ref(false);
14
+ const error = ref("");
15
+ const deviceId = computed(() => selected.value?.deviceId);
16
+ const client = () => deviceClient(deviceId.value ?? "");
17
+
18
+ async function load() {
19
+ if (!deviceId.value) return void (sessions.value = null);
20
+ loading.value = true;
21
+ error.value = "";
22
+ try {
23
+ sessions.value = (await client().archived()).sessions;
24
+ } catch (e) {
25
+ const text = message(e);
26
+ error.value =
27
+ (e as { code?: string }).code === "not_found" || /allowlist/i.test(text)
28
+ ? "This device runs an older build: update it (`dpi update`) to browse old sessions."
29
+ : text.slice(0, 160);
30
+ } finally {
31
+ loading.value = false;
32
+ }
33
+ }
34
+ watch(deviceId, load, { immediate: true });
35
+
36
+ const kib = (bytes: number) => {
37
+ if (bytes <= 0) return "0";
38
+ const units = ["B", "KiB", "MiB", "GiB"];
39
+ let v = bytes;
40
+ let u = 0;
41
+ while (v >= 1024 && u < units.length - 1) {
42
+ v /= 1024;
43
+ u += 1;
44
+ }
45
+ return `${v >= 100 || u === 0 ? Math.round(v) : v.toFixed(1)} ${units[u]}`;
46
+ };
47
+ const ago = (ms: number) => {
48
+ const s = Math.max(0, (Date.now() - ms) / 1000);
49
+ if (s < 3600) return `${Math.floor(s / 60)}m ago`;
50
+ if (s < 86400) return `${Math.floor(s / 3600)}h ago`;
51
+ return `${Math.floor(s / 86400)}d ago`;
52
+ };
53
+
54
+ function restore(s: ArchivedView) {
55
+ ui.dialog = {
56
+ kind: "prompt",
57
+ title: `Restore “${s.name}”?`,
58
+ hint: "The session returns to the live list with its transcript and jobs intact. Nothing is copied — the bundle simply moves back.",
59
+ submit: "Restore",
60
+ run: async () => {
61
+ await client().restoreArchived(s.sessionId);
62
+ await load();
63
+ notify(`${s.name} restored to the live list.`);
64
+ },
65
+ };
66
+ }
67
+
68
+ async function download(s: ArchivedView) {
69
+ try {
70
+ const r = await client().archivedTranscript(s.sessionId, "markdown");
71
+ const blob = new Blob([r.text ?? ""], { type: "text/markdown" });
72
+ const a = document.createElement("a");
73
+ a.href = URL.createObjectURL(blob);
74
+ a.download = `${s.name.replace(/[^\w.-]+/g, "_") || s.sessionId}.md`;
75
+ a.click();
76
+ URL.revokeObjectURL(a.href);
77
+ } catch (e) {
78
+ notify(message(e).slice(0, 160));
79
+ }
80
+ }
81
+ </script>
82
+
83
+ <template>
84
+ <section class="archive-panel" aria-label="Old sessions">
85
+ <header class="panel-heading">
86
+ <span><Archive :size="16" />ARCHIVE</span>
87
+ <button
88
+ class="icon-button"
89
+ :disabled="loading || !deviceId"
90
+ aria-label="Refresh archive"
91
+ title="Refresh archive"
92
+ @click="load"
93
+ >
94
+ <RefreshCw :size="15" :class="{ spin: loading }" />
95
+ </button>
96
+ </header>
97
+
98
+ <p class="hint">
99
+ Every session this device ever archived — read-only. Restore brings one back to the live list;
100
+ nothing here deletes.
101
+ </p>
102
+ <p v-if="!deviceId" class="hint">Select a session to see its device.</p>
103
+ <p v-else-if="error" class="message-error">{{ error }}</p>
104
+ <p v-else-if="sessions && !sessions.length" class="hint">Nothing archived on this device yet.</p>
105
+
106
+ <ul v-if="sessions?.length" class="old-list">
107
+ <li v-for="s in sessions" :key="`${s.sessionId}-${s.archivedAt}`" class="old">
108
+ <div class="head">
109
+ <b>{{ s.name }}</b>
110
+ <span class="tag" :title="s.hasManifest ? 'bundled with full identity' : 'old bundle — name unknown'">
111
+ {{ s.hasManifest ? "manifest" : "legacy" }}
112
+ </span>
113
+ <span class="meta">archived {{ ago(s.archivedAt) }}</span>
114
+ <span class="spacer" />
115
+ <button
116
+ class="icon-button"
117
+ :aria-label="`Download transcript of ${s.name}`"
118
+ title="Download transcript (markdown)"
119
+ @click="download(s)"
120
+ >
121
+ <Download :size="13" />
122
+ </button>
123
+ <button
124
+ class="icon-button"
125
+ :aria-label="`Restore ${s.name}`"
126
+ title="Restore to the live list"
127
+ @click="restore(s)"
128
+ >
129
+ <RotateCcw :size="13" />
130
+ </button>
131
+ </div>
132
+ <div class="facts">
133
+ <span v-if="s.cwd" class="cwd">{{ s.cwd }}</span>
134
+ <span v-if="s.model" class="tag">{{ s.model }}</span>
135
+ <span class="meta">{{ s.turns >= 0 ? `${s.turns} turns` : "turns unknown" }}</span>
136
+ <span class="meta">{{ kib(s.bytes) }}</span>
137
+ <span v-if="s.lastMessageAt" class="meta">last message {{ ago(s.lastMessageAt) }}</span>
138
+ </div>
139
+ </li>
140
+ </ul>
141
+ </section>
142
+ </template>
143
+
144
+ <style scoped>
145
+ .archive-panel {
146
+ display: flex;
147
+ flex-direction: column;
148
+ gap: 10px;
149
+ padding: 4px 2px 12px;
150
+ font-size: 16px;
151
+ }
152
+ .old-list {
153
+ display: flex;
154
+ flex-direction: column;
155
+ gap: 6px;
156
+ margin: 0;
157
+ padding: 0;
158
+ list-style: none;
159
+ }
160
+ .old {
161
+ display: flex;
162
+ flex-direction: column;
163
+ gap: 3px;
164
+ padding: 7px 10px;
165
+ border: 1px solid var(--line);
166
+ border-radius: 10px;
167
+ }
168
+ .old .head {
169
+ display: flex;
170
+ align-items: center;
171
+ gap: 6px;
172
+ flex-wrap: wrap;
173
+ }
174
+ .old .spacer {
175
+ margin-left: auto;
176
+ }
177
+ .old .facts {
178
+ display: flex;
179
+ gap: 8px;
180
+ flex-wrap: wrap;
181
+ font-size: 13px;
182
+ opacity: 0.75;
183
+ }
184
+ .old .cwd {
185
+ font-family: inherit;
186
+ opacity: 0.8;
187
+ word-break: break-all;
188
+ }
189
+ .spin {
190
+ animation: spin 1s linear infinite;
191
+ }
192
+ @keyframes spin {
193
+ to {
194
+ transform: rotate(360deg);
195
+ }
196
+ }
197
+ </style>
@@ -6,6 +6,7 @@ import {
6
6
  Download,
7
7
  PackageOpen,
8
8
  PiggyBank,
9
+ Archive,
9
10
  CalendarClock,
10
11
  Waypoints,
11
12
  Bell,
@@ -31,6 +32,7 @@ import GitPanel from "./GitPanel.vue";
31
32
  import HostPanel from "./HostPanel.vue";
32
33
  import UsagePanel from "./UsagePanel.vue";
33
34
  import SchedulesPanel from "./SchedulesPanel.vue";
35
+ import ArchivePanel from "./ArchivePanel.vue";
34
36
  import GraphPanel from "./GraphPanel.vue";
35
37
  import NotifyPanel from "./NotifyPanel.vue";
36
38
  import EnvPanel from "./EnvPanel.vue";
@@ -76,6 +78,7 @@ const tabs = [
76
78
  { id: "host", label: "Host", icon: Activity },
77
79
  { id: "usage", label: "Usage", icon: PiggyBank },
78
80
  { id: "auto", label: "Auto", icon: CalendarClock },
81
+ { id: "archive", label: "Archive", icon: Archive },
79
82
  { id: "dag", label: "DAG", icon: Waypoints },
80
83
  { id: "notify", label: "Notify", icon: Bell },
81
84
  { id: "env", label: "Env", icon: FileCog },
@@ -498,6 +501,7 @@ const offeredTools = computed(() => detail.value?.tools.filter((t) => t.offered)
498
501
  <HostPanel v-if="ui.tab === 'host'" />
499
502
  <UsagePanel v-if="ui.tab === 'usage'" />
500
503
  <SchedulesPanel v-if="ui.tab === 'auto'" />
504
+ <ArchivePanel v-if="ui.tab === 'archive'" />
501
505
  <GraphPanel v-if="ui.tab === 'dag'" />
502
506
  <NotifyPanel v-if="ui.tab === 'notify'" />
503
507
  <EnvPanel v-if="ui.tab === 'env'" />
@@ -233,6 +233,19 @@ export interface EnvVarView {
233
233
  managed: boolean;
234
234
  }
235
235
 
236
+ /** One archived session bundle — the old-session surface (policy #3). */
237
+ export interface ArchivedView {
238
+ sessionId: string;
239
+ archivedAt: number;
240
+ name: string;
241
+ cwd: string;
242
+ model: string;
243
+ turns: number;
244
+ lastMessageAt: number | null;
245
+ bytes: number;
246
+ hasManifest: boolean;
247
+ }
248
+
236
249
  /** One provider credential in pi's auth.json — masked tail only, never the value. */
237
250
  export interface PiAuthEntry {
238
251
  providerId: string;
@@ -4,6 +4,7 @@ import type {
4
4
  AgentExtensions,
5
5
  AgentSummary,
6
6
  CompactionSettings,
7
+ ArchivedView,
7
8
  EnvFileView,
8
9
  PiAuthView,
9
10
  PiAuthWriteResult,
@@ -383,6 +384,19 @@ export class DpiClient {
383
384
  sessions() {
384
385
  return this.request<SessionSummary[]>("GET", "/v1/sessions");
385
386
  }
387
+ /** Old sessions (policy #3): archived bundles, their transcripts, restore. */
388
+ archived() {
389
+ return this.request<{ sessions: ArchivedView[] }>("GET", "/v1/archive");
390
+ }
391
+ archivedTranscript(sessionId: string, format: "markdown" | "json" = "markdown") {
392
+ return this.request<{ format: string; text?: string; items?: unknown[] }>(
393
+ "GET",
394
+ `/v1/archive/${enc(sessionId)}/transcript?format=${format}`,
395
+ );
396
+ }
397
+ restoreArchived(sessionId: string) {
398
+ return this.request<SessionSummary>("POST", `/v1/archive/${enc(sessionId)}/restore`, {});
399
+ }
386
400
  createSession(body: CreateSessionBody, idempotencyKey = newId()) {
387
401
  return this.request<SessionSummary>("POST", "/v1/sessions", body, { idempotencyKey });
388
402
  }
@@ -15,6 +15,9 @@ const ROUTES: readonly (readonly [method: string, pattern: string])[] = [
15
15
  ["GET", "/device/env"],
16
16
  ["POST", "/device/env"],
17
17
  ["DELETE", "/device/env/:key"],
18
+ ["GET", "/archive"],
19
+ ["GET", "/archive/:id/transcript"],
20
+ ["POST", "/archive/:id/restore"],
18
21
  ["GET", "/device/pi-auth"],
19
22
  ["PUT", "/device/pi-auth/:provider"],
20
23
  ["DELETE", "/device/pi-auth/:provider"],
@@ -1,7 +1,7 @@
1
1
  # Host / Project / Device / Session Management Feature Checklist — orca / paseo / zcode / herdr / piggery → durable-pi
2
2
 
3
3
  Run: `team_20261024143910_47d06fe8b77400d4` · Steps: 01_explore (inventory) → 02_analyze (verify/correct) → 03_write (this file)
4
- Status: **ALL WAVES ADOPTED (0.0.45 — 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).** Wave 2 complete (0.0.42); Wave 3 complete: diagnostics + keep-awake (0.0.43), telegram bridge + conversation share (0.0.44), task-graph DAG (0.0.45); ssh-interactivity and bulk-resume closed by design. NOTHING left on the feature list. Policy ledger: **ALL FOUR DECIDED** — #1 crash reporting local-only ✅ (0.0.46) · #2 pi credentials write-only ✅ (0.0.46) · #3 retention manual-only PERMANENTLY ✅ (user 2026-10-25: old sessions are future feature surface — nothing ever auto-deletes) · #4 remote updates hint-only badge ✅ (hub never pushes code). 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)).
4
+ Status: **ALL WAVES ADOPTED (0.0.45 — 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).** Wave 2 complete (0.0.42); Wave 3 complete: diagnostics + keep-awake (0.0.43), telegram bridge + conversation share (0.0.44), task-graph DAG (0.0.45); ssh-interactivity and bulk-resume closed by design. NOTHING left on the feature list. Post-checklist follow-up (user direction from #3): **old sessions as a feature surface** — `0.0.48` adds the Archive tab (list every archived bundle with name/turns/size, download transcript, one-click restore; new archives carry a `session.json` manifest so identity survives; the web can never delete — `dpi gc` stays the only deleter). Policy ledger: **ALL FOUR DECIDED** — #1 crash reporting local-only ✅ (0.0.46) · #2 pi credentials write-only ✅ (0.0.46) · #3 retention manual-only PERMANENTLY ✅ (user 2026-10-25: old sessions are future feature surface — nothing ever auto-deletes) · #4 remote updates hint-only badge ✅ (hub never pushes code). 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
5
 
6
6
  ## Why this doc exists
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-durable",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
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": {