switchroom 0.14.7 → 0.14.8
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/dist/agent-scheduler/index.js +80 -80
- package/dist/auth-broker/index.js +80 -80
- package/dist/cli/drive-write-pretool.mjs +10 -10
- package/dist/cli/notion-write-pretool.mjs +82 -82
- package/dist/cli/skill-validate-pretool.mjs +72 -72
- package/dist/cli/switchroom.js +395 -357
- package/dist/host-control/main.js +148 -148
- package/dist/vault/approvals/kernel-server.js +82 -82
- package/dist/vault/broker/server.js +83 -83
- package/package.json +1 -1
- package/profiles/_base/start.sh.hbs +23 -0
- package/telegram-plugin/dist/bridge/bridge.js +112 -112
- package/telegram-plugin/dist/gateway/gateway.js +583 -284
- package/telegram-plugin/dist/server.js +160 -160
- package/telegram-plugin/gateway/config-approval-handler.ts +36 -0
- package/telegram-plugin/gateway/gateway.ts +296 -180
- package/telegram-plugin/gateway/hostd-dispatch.ts +2 -1
- package/telegram-plugin/permission-diff.ts +382 -0
- package/telegram-plugin/tests/always-allow-correlation.test.ts +147 -0
- package/telegram-plugin/tests/always-allow-grant.test.ts +84 -88
- package/telegram-plugin/tests/permission-diff.test.ts +336 -0
- package/telegram-plugin/tests/tool-activity-summary.test.ts +25 -13
- package/telegram-plugin/tool-activity-summary.ts +27 -15
|
@@ -338,19 +338,18 @@ export function describeToolUse(
|
|
|
338
338
|
|
|
339
339
|
// ─── Accumulating activity feed (draft-mirror Phase 2) ──────────────────────
|
|
340
340
|
//
|
|
341
|
-
//
|
|
342
|
-
//
|
|
343
|
-
//
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
// inside Telegram's compose-area draft.
|
|
341
|
+
// Accumulates the turn's actions into a running feed — like Claude Code's
|
|
342
|
+
// own UI — rendered into one Telegram message that edits in place and is
|
|
343
|
+
// cleared on reply. Chronological (oldest first, newest last), consecutive
|
|
344
|
+
// exact-duplicates collapsed, capped to the most recent MIRROR_MAX_LINES
|
|
345
|
+
// with a "+N earlier" header so a heavy turn stays readable.
|
|
347
346
|
|
|
348
347
|
export const MIRROR_MAX_LINES = 6;
|
|
349
348
|
|
|
350
349
|
/**
|
|
351
350
|
* Append a tool_use's friendly line to the running feed (mutates `lines`)
|
|
352
|
-
* and return the rendered
|
|
353
|
-
* tool / produced no line (caller skips the
|
|
351
|
+
* and return the rendered feed (ready Telegram HTML) — or null when the
|
|
352
|
+
* tool is a surface tool / produced no line (caller skips the update).
|
|
354
353
|
*
|
|
355
354
|
* Dedups only consecutive identical lines (e.g. a burst of parallel Reads of
|
|
356
355
|
* the same file) so distinct actions are all preserved.
|
|
@@ -368,19 +367,32 @@ export function appendActivityLine(
|
|
|
368
367
|
return renderActivityFeed(lines);
|
|
369
368
|
}
|
|
370
369
|
|
|
370
|
+
/** Minimal HTML escape for Telegram parse_mode=HTML (matches the gateway's). */
|
|
371
|
+
function escapeFeedHtml(s: string): string {
|
|
372
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
373
|
+
}
|
|
374
|
+
|
|
371
375
|
/**
|
|
372
|
-
* Render the accumulated feed as
|
|
373
|
-
* The
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
376
|
+
* Render the accumulated feed as ready Telegram HTML — one action per line,
|
|
377
|
+
* newest last. The current (newest) step is bold with a `→`; finished steps
|
|
378
|
+
* are italic with a `✓`. Capped to the last MIRROR_MAX_LINES with a dim
|
|
379
|
+
* `✓ +N earlier…` header when the turn ran longer. Returns null when empty.
|
|
380
|
+
* Callers send the result verbatim — do NOT re-escape or re-wrap it.
|
|
377
381
|
*/
|
|
378
382
|
export function renderActivityFeed(lines: string[]): string | null {
|
|
379
383
|
if (lines.length === 0) return null;
|
|
380
384
|
const shown = lines.slice(-MIRROR_MAX_LINES);
|
|
381
385
|
const hidden = lines.length - shown.length;
|
|
382
|
-
const
|
|
383
|
-
|
|
386
|
+
const out: string[] = [];
|
|
387
|
+
if (hidden > 0) out.push(`<i>✓ +${hidden} earlier…</i>`);
|
|
388
|
+
const lastIdx = shown.length - 1;
|
|
389
|
+
// Newest line = in-progress step (bold, →); earlier = done (italic, ✓).
|
|
390
|
+
// Returns ready Telegram HTML — callers must NOT re-escape or re-wrap it.
|
|
391
|
+
shown.forEach((l, i) => {
|
|
392
|
+
const esc = escapeFeedHtml(l);
|
|
393
|
+
out.push(i === lastIdx ? `<b>→ ${esc}</b>` : `<i>✓ ${esc}</i>`);
|
|
394
|
+
});
|
|
395
|
+
return out.join("\n");
|
|
384
396
|
}
|
|
385
397
|
|
|
386
398
|
/**
|