my-durable 0.0.73 → 0.0.75
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 +49 -17
- package/apps/dpi-backend/src/notify-sinks.ts +104 -2
- package/apps/dpi-backend/src/store.ts +54 -8
- package/apps/dpi-backend/src/telegram.ts +89 -12
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/{index-C9TcDwN6.js → index-BmxTF5DB.js} +3 -3
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/{index-BE-fN78Y.css → index-h81haD43.css} +1 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/index.html +2 -2
- package/apps/dpi-playground/apps/dpi-playground-hub/src/audit.ts +95 -53
- package/apps/dpi-sdk/src/api.ts +1 -1
- package/apps/dpi-sdk/src/models.ts +165 -20
- package/apps/dpi-tui/src/app.ts +21 -15
- package/apps/dpi-tui/src/commands.ts +31 -15
- package/apps/dpi-tui/src/sanitize.ts +12 -0
- package/package.json +1 -1
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import type { SlashCommand } from "@earendil-works/pi-tui";
|
|
3
3
|
import { THINKING_LEVELS, type ThinkingLevel } from "../../dpi-sdk/src/api.ts";
|
|
4
4
|
import type { App } from "./app.ts";
|
|
5
|
-
import { sanitizeTerminal } from "./sanitize.ts";
|
|
5
|
+
import { sanitizeTerminal, oneLine } from "./sanitize.ts";
|
|
6
|
+
export { oneLine };
|
|
6
7
|
import { Panel, pickAgent, pickDevice, pickModel, pickSession, pickThinking } from "./pickers.ts";
|
|
7
8
|
import { parsePairArgs, runPairing } from "./pairing.ts";
|
|
8
9
|
import { gitStateSuffix } from "./views.ts";
|
|
@@ -117,6 +118,16 @@ const KEYS: [string, string][] = [
|
|
|
117
118
|
];
|
|
118
119
|
|
|
119
120
|
/** Returns false when `text` is not a command, so the caller sends it to the agent. */
|
|
121
|
+
/** R19 (run-5 h2): every field of a TranscriptSearchHit is relay-borne — the
|
|
122
|
+
* numeric `entry` included. The compose site used to interpolate it raw, so a
|
|
123
|
+
* hostile hub/device could ride an OSC/CSI payload in a string-typed `entry`
|
|
124
|
+
* straight into the terminal (pi-tui writes Panel lines verbatim). One
|
|
125
|
+
* chokepoint, one test.
|
|
126
|
+
*/
|
|
127
|
+
export function findHitLine(name: string, hit: { agent: string; entry: number; text: string }): string {
|
|
128
|
+
return ` ${oneLine(name)}:${oneLine(hit.agent)} #${oneLine(String(hit.entry))} — ${oneLine(hit.text.slice(0, 140))}`;
|
|
129
|
+
}
|
|
130
|
+
|
|
120
131
|
export async function runCommand(app: App, text: string): Promise<boolean> {
|
|
121
132
|
const match = text.match(/^\/(\S+)\s*([\s\S]*)$/);
|
|
122
133
|
const command = COMMANDS.find((c) => c.name === match?.[1]);
|
|
@@ -195,7 +206,8 @@ export async function runCommand(app: App, text: string): Promise<boolean> {
|
|
|
195
206
|
// not skip that gate (R4 finding 4: the palette entry used to wipe the
|
|
196
207
|
// context unconditionally). A typed handoff note carries its own intent.
|
|
197
208
|
if (!arg) {
|
|
198
|
-
|
|
209
|
+
// R20 cold-1 M4: same gate text as the x-key door — oneLine, not sanitize-only.
|
|
210
|
+
const ok = await app.prompt(`Reset ${oneLine(app.sessionSummary()?.name ?? "context")}? y/n`, "");
|
|
199
211
|
if (ok === undefined || !ok.trim().toLowerCase().startsWith("y"))
|
|
200
212
|
return app.flash("reset cancelled"), true;
|
|
201
213
|
}
|
|
@@ -210,7 +222,7 @@ export async function runCommand(app: App, text: string): Promise<boolean> {
|
|
|
210
222
|
// Agent names ride the wire from device/hub (model-choosable for forks
|
|
211
223
|
// and subagents) and pi-tui's Input renders its value verbatim — seed
|
|
212
224
|
// it sanitized (run-4 h4).
|
|
213
|
-
const typed = await app.prompt("Agent name", current && current !== "main" ?
|
|
225
|
+
const typed = await app.prompt("Agent name", current && current !== "main" ? oneLine(current) : ""); // R20 cold-2 minor: Input renders verbatim — one-line it
|
|
214
226
|
value = (typed ?? "").trim();
|
|
215
227
|
if (!value) return app.flash("rename cancelled"), true;
|
|
216
228
|
}
|
|
@@ -238,24 +250,22 @@ export async function runCommand(app: App, text: string): Promise<boolean> {
|
|
|
238
250
|
app.overlay(
|
|
239
251
|
new Panel(() => {
|
|
240
252
|
const lines = [
|
|
241
|
-
c.bold(c.accent(`"${sanitizeTerminal(arg)}" — ${result.matches.length} session${result.matches.length === 1 ? "" : "s"}`)),
|
|
253
|
+
c.bold(c.accent(`"${sanitizeTerminal(arg)}" — ${sanitizeTerminal(String(result.matches.length))} session${result.matches.length === 1 ? "" : "s"}`)),
|
|
242
254
|
"",
|
|
243
255
|
];
|
|
244
256
|
if (!result.matches.length) lines.push(c.muted("No matches (names, folders, models or transcripts)."));
|
|
245
257
|
for (const m of shown) {
|
|
246
258
|
lines.push(
|
|
247
|
-
|
|
259
|
+
// R20 h5: the match header is in the SAME panel as the fixed hit
|
|
260
|
+
// lines — a \n in a session name split the row above the hits.
|
|
261
|
+
`${c.secondary(oneLine(m.name))} ${c.muted(oneLine(m.cwd))}${m.where.includes("transcript") ? " " + c.warn("◍ transcript") : ""}`,
|
|
248
262
|
);
|
|
249
263
|
for (const hit of (m.hits ?? []).slice(0, 3))
|
|
250
|
-
lines.push(
|
|
251
|
-
c.muted(
|
|
252
|
-
` ${sanitizeTerminal(m.name)}:${sanitizeTerminal(hit.agent)} #${hit.entry} — ${sanitizeTerminal(hit.text.slice(0, 140))}`,
|
|
253
|
-
),
|
|
254
|
-
);
|
|
264
|
+
lines.push(c.muted(findHitLine(m.name, hit)));
|
|
255
265
|
}
|
|
256
|
-
if (result.matches.length > shown.length) lines.push(c.muted(`… ${result.matches.length - shown.length} more`));
|
|
266
|
+
if (result.matches.length > shown.length) lines.push(c.muted(`… ${sanitizeTerminal(String(result.matches.length - shown.length))} more`));
|
|
257
267
|
if (result.scanned?.truncated)
|
|
258
|
-
lines.push(c.muted(`scan budget reached (${result.scanned.entries} entries) — refine the query`));
|
|
268
|
+
lines.push(c.muted(`scan budget reached (${sanitizeTerminal(String(result.scanned.entries))} entries) — refine the query`));
|
|
259
269
|
lines.push("", c.muted("esc close"));
|
|
260
270
|
return lines;
|
|
261
271
|
}, () => app.closeOverlay()),
|
|
@@ -267,11 +277,17 @@ export async function runCommand(app: App, text: string): Promise<boolean> {
|
|
|
267
277
|
app.overlay(
|
|
268
278
|
new Panel(() => {
|
|
269
279
|
const tasks = app.session.state.tasks;
|
|
270
|
-
const lines = [c.bold(c.accent(`Live tasks in ${
|
|
280
|
+
const lines = [c.bold(c.accent(`Live tasks in ${oneLine(app.sessionSummary()?.name ?? "session")}`)), ""]; // R20 cold-2 minor
|
|
271
281
|
if (!tasks.length) lines.push(c.muted("No live tasks."));
|
|
272
282
|
for (const t of tasks)
|
|
273
283
|
lines.push(
|
|
274
|
-
|
|
284
|
+
// R19 cold-review MAJOR 4: task ids are wire-borne too — a hostile
|
|
285
|
+
// relay can type them as strings carrying escape sequences (the
|
|
286
|
+
// same class as the /find `entry` finding). Every scalar goes
|
|
287
|
+
// through the chokepoint.
|
|
288
|
+
// sanitizeTerminal keeps \n/\t, so a one-line row also collapses
|
|
289
|
+
// whitespace — a wire id must not split the row it belongs to.
|
|
290
|
+
`${t?.background === true ? c.secondary("◌ bg") : c.warn("● fg")} #${oneLine(String(t?.id ?? "?"))} ${oneLine(String(t?.kind ?? "?"))} ${c.muted(`agent #${oneLine(String(t?.conversationId ?? "?"))} │ ${oneLine(String(t.state?.status ?? ""))}${t.state?.phase ? `/${oneLine(String(t.state.phase))}` : ""}`)}`,
|
|
275
291
|
);
|
|
276
292
|
lines.push("", c.muted("esc close"));
|
|
277
293
|
return lines;
|
|
@@ -283,7 +299,7 @@ export async function runCommand(app: App, text: string): Promise<boolean> {
|
|
|
283
299
|
new Panel(
|
|
284
300
|
() => [
|
|
285
301
|
c.bold(c.accent("dpi-tui")),
|
|
286
|
-
c.muted(`${
|
|
302
|
+
c.muted(`${oneLine(app.device.id)} │ ${oneLine(app.device.url)}`), // R20 cold-1 M4
|
|
287
303
|
"",
|
|
288
304
|
...KEYS.map(([k, d]) => `${c.secondary(k.padEnd(11))} ${d}`),
|
|
289
305
|
"",
|
|
@@ -14,3 +14,15 @@ const C0 = /[\u0000-\u0008\u000B-\u001F\u007F\u0080-\u009F]/g;
|
|
|
14
14
|
export function sanitizeTerminal(s: string): string {
|
|
15
15
|
return s.replace(ESC_SEQ, "").replace(C0, "");
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* R20 (run-6 h5): single-line chrome compose chokepoint. sanitizeTerminal
|
|
20
|
+
* strips escape sequences but KEEPS \n/\t by design (multi-line content is
|
|
21
|
+
* legitimate elsewhere) — a wire string interpolated into a one-line frame row
|
|
22
|
+
* must also collapse whitespace, or it splits its own row and forges chrome
|
|
23
|
+
* below it. Hoisted here from commands.ts so every compose site shares one
|
|
24
|
+
* definition.
|
|
25
|
+
*/
|
|
26
|
+
export function oneLine(text: string): string {
|
|
27
|
+
return sanitizeTerminal(text).replace(/\s+/g, " ");
|
|
28
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-durable",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.75",
|
|
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": {
|