my-durable 0.0.46 → 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.
- package/apps/dpi-backend/src/archived.ts +332 -0
- package/apps/dpi-backend/src/routes.ts +11 -0
- package/apps/dpi-backend/src/store.ts +71 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/{index-CAtBlkjt.js → index-BIp-RW7b.js} +14 -14
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/{index-B5d1JP_j.css → index-D5VNUqjm.css} +1 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/index.html +2 -2
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/ArchivePanel.vue +197 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/Inspector.vue +4 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/SchedulesPanel.vue +18 -5
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/StateEditor.vue +5 -2
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TreeRow.vue +10 -3
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/UsagePanel.vue +5 -1
- package/apps/dpi-sdk/src/api.ts +13 -0
- package/apps/dpi-sdk/src/client.ts +14 -0
- package/apps/dpi-sdk/src/protocol/rest-routes.ts +3 -0
- package/docs/host-project-checklist.md +16 -9
- package/package.json +1 -1
|
@@ -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'" />
|
|
@@ -78,15 +78,22 @@ const remove = (s: ScheduleView) =>
|
|
|
78
78
|
|
|
79
79
|
/** The model is picked from the device's own catalog, not typed from memory. */
|
|
80
80
|
const models = ref<{ key: string }[]>([]);
|
|
81
|
+
/** While the device's model catalog loads the form must say so — a silent
|
|
82
|
+
* dead Create button is how live-driving caught this (tunnel first-hit lag). */
|
|
83
|
+
const modelsLoading = ref(false);
|
|
81
84
|
async function openAdd() {
|
|
82
85
|
adding.value = true;
|
|
83
|
-
draft.value = { name: "", cwd:
|
|
86
|
+
draft.value = { name: "", cwd: "", prompt: "", model: "" };
|
|
87
|
+
models.value = [];
|
|
88
|
+
modelsLoading.value = true;
|
|
84
89
|
try {
|
|
85
90
|
const device = await client().device();
|
|
86
91
|
models.value = device.models.map((m) => ({ key: `${m.provider}/${m.id}` }));
|
|
87
92
|
draft.value.model = device.defaultModel;
|
|
88
93
|
} catch {
|
|
89
94
|
models.value = [];
|
|
95
|
+
} finally {
|
|
96
|
+
modelsLoading.value = false;
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
99
|
|
|
@@ -94,7 +101,11 @@ async function save() {
|
|
|
94
101
|
const d = draft.value;
|
|
95
102
|
const [provider, ...rest] = d.model.split("/");
|
|
96
103
|
const modelId = rest.join("/");
|
|
97
|
-
if (!d.name.trim() || !d.cwd.trim() || !d.prompt.trim()
|
|
104
|
+
if (!d.name.trim() || !d.cwd.trim() || !d.prompt.trim()) return;
|
|
105
|
+
if (!provider || !modelId) {
|
|
106
|
+
notify(modelsLoading.value ? "Still loading the model list — one moment." : "Pick a model first.");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
98
109
|
busy.value = "new";
|
|
99
110
|
try {
|
|
100
111
|
await client().createSchedule({
|
|
@@ -138,7 +149,9 @@ async function save() {
|
|
|
138
149
|
<label>Prompt<textarea v-model="draft.prompt" rows="3" placeholder="Run the tests and summarise failures" required /></label>
|
|
139
150
|
<label
|
|
140
151
|
>Model
|
|
141
|
-
<select v-model="draft.model">
|
|
152
|
+
<select v-model="draft.model" :disabled="modelsLoading">
|
|
153
|
+
<option v-if="modelsLoading" value="">loading…</option>
|
|
154
|
+
<option v-else-if="!models.length" value="">(no models — check the device)</option>
|
|
142
155
|
<option v-for="m in models" :key="m.key" :value="m.key">{{ m.key }}</option>
|
|
143
156
|
</select>
|
|
144
157
|
</label>
|
|
@@ -148,8 +161,8 @@ async function save() {
|
|
|
148
161
|
<label class="inline">daily at <input v-model="daily" class="num time" placeholder="03:00" :disabled="!!every" /></label>
|
|
149
162
|
</div>
|
|
150
163
|
<div class="row">
|
|
151
|
-
<button class="primary small" type="submit" :disabled="busy === 'new'">
|
|
152
|
-
{{ busy === "new" ? "creating…" : "Create schedule" }}
|
|
164
|
+
<button class="primary small" type="submit" :disabled="busy === 'new' || modelsLoading || !draft.model">
|
|
165
|
+
{{ busy === "new" ? "creating…" : modelsLoading ? "loading models…" : "Create schedule" }}
|
|
153
166
|
</button>
|
|
154
167
|
<button class="small" type="button" @click="adding = false">Cancel</button>
|
|
155
168
|
</div>
|
|
@@ -93,7 +93,10 @@ function add() {
|
|
|
93
93
|
:disabled="disabled"
|
|
94
94
|
@change="emit('change', $event)"
|
|
95
95
|
/>
|
|
96
|
-
|
|
96
|
+
<!-- The add-form/button must exist for BOTH objects and arrays: live-
|
|
97
|
+
driving caught that the `kind === "array"` guards made object
|
|
98
|
+
containers (including the ROOT) unable to gain fields at all. -->
|
|
99
|
+
<form v-if="adding" class="state-add" @submit.prevent="add">
|
|
97
100
|
<input
|
|
98
101
|
v-if="kind !== 'array'"
|
|
99
102
|
v-model="key"
|
|
@@ -115,7 +118,7 @@ function add() {
|
|
|
115
118
|
<button type="button" class="text-button" @click="adding = false">Cancel</button>
|
|
116
119
|
</form>
|
|
117
120
|
<button
|
|
118
|
-
v-else
|
|
121
|
+
v-else
|
|
119
122
|
class="text-button state-add-button"
|
|
120
123
|
:disabled="disabled"
|
|
121
124
|
:aria-label="`Add ${kind === 'array' ? 'item' : 'field'} to ${path || '/'}`"
|
|
@@ -42,12 +42,19 @@ const background = computed(() =>
|
|
|
42
42
|
: (agent.value?.background ?? 0),
|
|
43
43
|
);
|
|
44
44
|
const busy = computed(() => session.value?.busy || agent.value?.busy);
|
|
45
|
-
/** Behind the hub's build: devices self-update, this is only a hint.
|
|
45
|
+
/** Behind the hub's build: devices self-update, this is only a hint. The
|
|
46
|
+
* oldest devices predate the rename and report `durableVersion` instead of
|
|
47
|
+
* `packageVersion` — they are exactly the ones the badge exists for. */
|
|
46
48
|
const behind = computed(() => {
|
|
47
|
-
const
|
|
49
|
+
const info = device.value?.info as { packageVersion?: string; durableVersion?: string } | undefined;
|
|
50
|
+
const theirs = info?.packageVersion ?? info?.durableVersion;
|
|
48
51
|
const ours = hubVersion.value;
|
|
49
52
|
return Boolean(theirs && ours && ours !== "unknown" && theirs !== ours);
|
|
50
53
|
});
|
|
54
|
+
const theirVersion = computed(() => {
|
|
55
|
+
const info = device.value?.info as { packageVersion?: string; durableVersion?: string } | undefined;
|
|
56
|
+
return info?.packageVersion ?? info?.durableVersion ?? "?";
|
|
57
|
+
});
|
|
51
58
|
const statusText = computed(() => {
|
|
52
59
|
const d = device.value;
|
|
53
60
|
if (!d) return "";
|
|
@@ -122,7 +129,7 @@ const title = computed(() => {
|
|
|
122
129
|
<span
|
|
123
130
|
v-if="behind"
|
|
124
131
|
class="tag update"
|
|
125
|
-
:title="`device runs ${
|
|
132
|
+
:title="`device runs ${theirVersion}; hub runs ${hubVersion}. Devices self-update: dpi update`"
|
|
126
133
|
>update</span
|
|
127
134
|
>
|
|
128
135
|
<span class="meta" :class="{ err: dot === 'err' }">{{ statusText }}</span>
|
|
@@ -54,7 +54,11 @@ async function load() {
|
|
|
54
54
|
try {
|
|
55
55
|
usage.value = await deviceClient(id).deviceUsage();
|
|
56
56
|
} catch (e) {
|
|
57
|
-
|
|
57
|
+
const text = message(e);
|
|
58
|
+
error.value =
|
|
59
|
+
(e as { code?: string }).code === "not_found" || /allowlist|not found/i.test(text)
|
|
60
|
+
? "This device runs an older build: update it (`dpi update`) to see usage."
|
|
61
|
+
: text.slice(0, 160);
|
|
58
62
|
} finally {
|
|
59
63
|
busy.value = false;
|
|
60
64
|
}
|
package/apps/dpi-sdk/src/api.ts
CHANGED
|
@@ -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:
|
|
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
|
|
|
@@ -101,13 +101,20 @@ The analyst corrected the explorer's first draft; the writer re-verified each co
|
|
|
101
101
|
Four rows below cannot default; they need the leader's decision before their wave enters the roadmap.
|
|
102
102
|
None of them blocks Wave 1.
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
All four are DECIDED (0.0.46, user-approved):
|
|
105
|
+
|
|
106
|
+
1. **Crash reporting — DECIDED: local-only.** One short redacted markdown file per crash under
|
|
107
|
+
`<home>/backend/crashes/`; no telemetry, no upload, no opt-in question — *we cannot leak what we
|
|
108
|
+
never send*. Human- and agent-readable fixed template; `dpi doctor` surfaces reports as a warn.
|
|
109
|
+
2. **Writable provider credentials — DECIDED: write-only.** pi keeps owning `~/.pi/agent/auth.json`;
|
|
110
|
+
the device may set/remove exactly one `api_key` entry. Values never leave the file (masked tails
|
|
111
|
+
only), oauth logins and corrupt files are refused, writes atomic 0600 + `.bak`.
|
|
112
|
+
3. **Retention / auto-archive — DECIDED: manual-only, permanently.** `dpi gc --closed-before 30d`
|
|
113
|
+
(dry-run default, `--yes` to act) stays the ONLY deletion path; nothing ever schedules itself.
|
|
114
|
+
Rationale (user, 2026-10-25): old sessions are a likely FEATURE surface later (search/resume/
|
|
115
|
+
history mining), so the device must never silently destroy them — the operator is the only deleter.
|
|
116
|
+
4. **Hub-driven remote updates — DECIDED: hint-only badge.** The hub informs, the device self-updates;
|
|
117
|
+
the hub never pushes code to devices. If more is ever needed, that is a new decision, not a default.
|
|
111
118
|
|
|
112
119
|
## Wave 1a — FE-only, no BE change (start here)
|
|
113
120
|
|
|
@@ -138,7 +145,7 @@ None of them blocks Wave 1.
|
|
|
138
145
|
| MUST | Usage dashboard | orca `usage/agent-token-usage.ts` + `usage-calendar-range.ts` (46-file suite incl. per-provider parsers) | ✅ (`0.0.39`) | GET `/device/usage` sums each harness's usage per session/model/project; Inspector **Usage** tab. Live: 4,307 tok → `opencode-go/claude-haiku-5-5`, attributed to its project. No calendar/persistence yet (archived sessions are closed stores) |
|
|
139
146
|
| 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`) | ✅ (`0.0.41`) | `notify-sinks.ts`: webhook + ntfy sinks, per-(sink,event-kind) 10 s cooldown, SSRF guard with `DPI_NOTIFY_ALLOW_PRIVATE=1` for LAN. Events: `session.failed`, `schedule.ok`, `schedule.failed`, `test`. `dpi notify list/add/enable/disable/remove/test/events`; Inspector **Notify** tab. Live: ntfy.sh received the test sent from the panel |
|
|
140
147
|
| SHOULD | Env-var management UI | orca `settings/HostAgentEnvironmentEditor.tsx` + `agent-default-env-draft.ts` | ✅ (`0.0.42`) | `env-vars.ts`: the DEVICE's env file, not the laptop's yaml — managed keys (DPI_TOKEN/port/…) refused, secret-NAMED values return masked (`••••••••t123`), process-only vars listed read-only (`loadEnvFile` never overrides them). `GET/POST/DELETE /v1/device/env`; Inspector **Env** tab with a restart-required banner (nothing pretends to hot-apply). Caught live: the hub caches the tunnel allowlist in memory, so new device routes also need a hub restart |
|
|
141
|
-
| MUST | Retention / auto-GC — **policy #3** | orca `terminal-history-gc.ts`; piggery `gc --closed-before DURATION [--dry-run]` (`docs/reference.md:31`) | ✅ manual-only (`0.0.40`) | `gc.ts` + `dpi gc --closed-before 30d [--yes]`: **dry-run is the default and nothing schedules itself** —
|
|
148
|
+
| MUST | Retention / auto-GC — **policy #3** | orca `terminal-history-gc.ts`; piggery `gc --closed-before DURATION [--dry-run]` (`docs/reference.md:31`) | ✅ manual-only (`0.0.40`) | `gc.ts` + `dpi gc --closed-before 30d [--yes]`: **dry-run is the default and nothing schedules itself** — and per the user's decision (2026-10-25) this is PERMANENT: no auto-archive will ever ship, because old sessions are a likely future feature surface (search/resume/history mining). The operator is the only deleter |
|
|
142
149
|
| SHOULD | Remote update badge — **policy #4** | orca `ssh/managed-server-update-check.ts` + `orcad-update-plan.ts` | ✅ (`0.0.40`) | `GET /api/version` (hub walks up to the `my-durable` package.json) + device `packageVersion` in `/v1/device` → tree badge "update". Hint only: devices self-update, the hub never pushes code. Verified 0 badges when versions match, and the 1.3.0-vs-0.0.39 trap (pi-durable's version) is fixed by reporting both |
|
|
143
150
|
| SHOULD | Backup/restore of session data | orca `rolling-file-backup.ts`; paseo `migrations/` (schema side) | ✅ (`0.0.42`) | `dpi backup create|list|restore` (executor module + 16 tests): whole-home zip (binary-capable writer reusing zip.ts's crc32) into a SIBLING `<home>-backups/` dir so a backup never contains itself; restore is plan-first (`--yes`), refuses while the daemon answers healthz, and never deletes — the old home becomes `home.bak-<ts>`. Live: 73 files / 5.4 MiB from the real device home, `unzip`/`zipfile`-clean, restore refused with exit 1 while running |
|
|
144
151
|
| SHOULD | Rate-limit surfacing | orca `rate-limits/` | ✅ device-side (`0.0.41`) | `classifyProviderError`: 429/quota → `rate_limited` (+`retryAfterMs` from Retry-After), 401/403 → `auth`, 404 → `missing`; `probeModel` returns the provider's own words, `dpi doctor` prints "rate limited — retry in 30s" / "provider key rejected". **Not** in the web picker: `probe-model` is deliberately local-only (never tunnelled), so the FE cannot probe |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-durable",
|
|
3
|
-
"version": "0.0.
|
|
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": {
|