From ce3da867324e37d8f0e691ecfd0ca2d9d2ed3fc6 Mon Sep 17 00:00:00 2001 From: ashwin pc Date: Sat, 1 Aug 2026 08:37:47 +0000 Subject: [PATCH 01/10] feat: extension-contributed settings and session lineage surfaces Adds the generic pi-web vocabulary that multi-agent workflows need, without teaching core anything about orchestration. Extension settings platform: - ctx.ui.web.registerSettings/getSettings, backed by a process-global active-schema registry so validation and rendering are independent of which session the browser happens to be viewing. - Values persist under settings.extensions[id] as { schemaVersion, revision, values, backup? } and are carried through verbatim, so an unloaded extension never loses its configuration. This also fixes normalizeSettings silently dropping unknown top-level keys. - Validated writes with an optimistic revision guard, bounded payloads, schemaVersion migration with a one-slot backup, and per-owner reset. - A generic settings renderer: toggle/text/textarea/number/select/list, with accordion rows for repeaters, live model options (optionsSource: "models"), cross-field references (optionsFromField) rendered as a per-row default star, stable row ids, and inline accessible validation. Session lineage and derived state: - Session origin tracking, so sessions spawned by another session are indented under their parent in the drawer with a lineage glyph. - A derived "waiting on spawned sessions" indicator (drawer, tab, status bar) with a single precedence rule: running > waiting > unread. - Custom (extension-injected) messages render as notification cards, and cards link to referenced sessions from structured details. Tool result cards can surface the same session links. Tests cover the store (verbatim preservation across unrelated patches, revision conflicts, bounds, backup placement, reset, on-disk round trip) and the descriptor validator (canonical schema identity, stable row ids, option and cross-field reference checks, uniqueness, bounds). --- index.html | 1 + server.ts | 58 ++++- server/extensionSettings.ts | 265 ++++++++++++++++++++ server/extensions/webUi.ts | 137 ++++++++++- server/session/projection.ts | 1 + server/session/service.ts | 12 + server/sessionUiState.ts | 46 +++- server/settings.ts | 193 ++++++++++++++- src/app/elements.ts | 2 + src/app/icons.ts | 4 +- src/app/types.ts | 61 +++++ src/extensions.ts | 68 +++++ src/main.ts | 2 + src/messages/messageList.ts | 104 +++++++- src/realtime/realtime.ts | 8 + src/sessions/sessionDrawer.ts | 206 +++++++++++++++- src/settings/extensionSettings.ts | 396 ++++++++++++++++++++++++++++++ src/settings/settings.ts | 30 ++- src/status/statusBar.ts | 35 +++ src/styles/base.css | 64 +++++ src/styles/composer.css | 7 + src/styles/messages.css | 75 ++++++ src/styles/sessions.css | 54 ++++ src/styles/settings.css | 166 +++++++++++++ src/tools/toolCards.ts | 54 ++++ tests/extension-settings.test.ts | 97 ++++++++ tests/settings.test.ts | 87 ++++++- 27 files changed, 2207 insertions(+), 26 deletions(-) create mode 100644 server/extensionSettings.ts create mode 100644 src/settings/extensionSettings.ts create mode 100644 tests/extension-settings.test.ts diff --git a/index.html b/index.html index 65bb76d..198650f 100644 --- a/index.html +++ b/index.html @@ -326,6 +326,7 @@

Extensions

+