We are building a web UI and web-renderer system for AppWeaver. Current goal

Reusable local date/time display: timestamp elements accept timestampMs (epoch milliseconds) and an optional label prefix. The client formats them in the browser's locale/timezone, including the timezone abbreviation, with an ISO datetime/tooltip for the exact instant. Standard text size/tone/style props apply.

textField supports inputType: "datetime-local" for a native date/time picker. Supply a timezone-qualified ISO datetime in value to display that instant in the browser's timezone. On form submission, nonempty date/time fields are converted from browser-local time to UTC ISO strings before merging into action arguments/options. Date-only and time-only fields keep their existing string semantics. The picker supports second precision.

select supports choiceSource: "nostrAccounts" with formFieldName to submit a public key from the current browser Nostr account or a named saved bunker connection. Choices are resolved client-side from the shadow-root account context and authenticated bunker-connections API, using data.userPubkey (not the remote signer server key). Choices load automatically on mount with loading/error feedback; it does not invoke signing, switch the authenticated account, or send credentials through form submission. With no connected account it explains how to connect; plugins may offer a separate manual textField fallback. Static select behavior is unchanged when choiceSource is omitted.

Generic details and summary tags render native HTML disclosures, collapsed initially. Put a summary element first in a details element's children, followed by the expandable content. Native keyboard interaction applies; scoped stylesheets can style the heading and body without introducing custom actions.

The generic browser nostr.signEvent client action accepts signingMode: "immediate" for current-time signing with an onSuccessCommand handoff. Its default remains "scheduled", preserving the date/runAt requirements of scheduling flows. Immediate signing forwards the signed event but does not inject a scheduled runAt argument or publish it. It also accepts optional allowedPubkeys to restrict the standard signer picker to the intended account(s); a returned signature from another author is rejected before the onSuccessCommand handoff. Omit it to keep unrestricted signing.

Backend/web

Bot restart notifications

After /bot restart successfully requests a watch restart, the backend broadcasts process_restart to every authenticated, non-demo WebSocket connection. Each tab/PWA window shows the existing process-restart client view in its own active timeline and immediately treats connection loss as an expected restart. The initiating window's command result uses the same process instance and request timestamp, so it replaces the live notice rather than creating a second card. Timeline catch-up also deduplicates notices against persisted command results. Observer notices are local UI entries; they do not write restart commands into other sessions' stored history.

The existing authenticated process-instance handshake changes the cards to “Restarted” after reconnection to a new bot process. Real connection errors still appear when no restart is expected or the expected-restart window expires. This notification covers /bot restart from web, DM, and local command transports; unexpected process exits and externally written restart signals do not announce a restart through this command notification path.

Universal search and resource views

The authenticated header search uses the shared universal-search contracts and coordinator. Each source returns plain JSON, rendered by core into a tree with collapsible source treeItem branches and leaf treeItem results. Selecting a result invokes the addressed resource-view:v1.open provider through the existing capability modal; plugins retain ownership of the resulting WebNodeRoot.

run_capability accepts resultFormat: "json" for generic raw capability output (capability_result), or "web" (default) for contract-defined webResult rendering. The original fuzzy-file-search operation retains its raw-result compatibility. Authenticated core consumers use a reserved consumerAlias of core:<component>; other aliases resolve to installed plugins. These identify callers for registry routing/logging, not a plugin sandbox. Source discovery and search don't record timeline history. Encoded #/resource/v1/... links open after authentication.

Backend interfaces

On viewports narrower than 900px, header app icons occupy a native horizontally scrollable single-row strip. Swipe left/right to reach overflow icons; tapping still opens the app. The logo, layout control, and account menu remain outside the strip. Icon images disable native image dragging, and the strip contains horizontal overscroll while permitting pinch zoom. Desktop header placement is preserved via a display: contents wrapper.

  1. Inspect the todo plugin structure, especially:
    • plugins/todo/commands/list/*
    • existing handler/representation/text rendering
  2. Add a custom renderers/web.ts for todo list
  3. Keep the current web shell architecture, but teach it to recognize/render the todo list result specially
  4. Reuse existing command execution for actions when possible
    • for example, a click in the web renderer can call the existing /api/commands/... endpoint with the right command/subcommand/payload
  5. After an action succeeds, refresh the todo list web view by re-running list with the same filters/options
  6. Do not try to solve every renderer/dispatcher abstraction globally unless needed for this slice
  7. Prefer one focused working example over a generalized framework that is not yet exercised Suggested approach

Widget-wide tree controls

The card-header Collapse all and Expand all controls apply to every treeItem in that WebNodeRoot, including independent sibling trees and nested trees inside layout containers. Each top-level tree registers its toolbar with a stable component token; removing one registration does not clear the others. Tree-specific filter/actions remain attached to their registered toolbar.

Bulk controls record expansion state for all supplied item IDs, including descendants whose components are unmounted under collapsed parents. Existing item IDs retain their state through root refreshes and within the existing stateScopeId cache. New items use the widget's latest bulk preference while that widget is mounted. Individual reopening overrides the saved state, so refreshing does not repeatedly force manually reopened items closed. These controls do not fetch unloaded lazy branches or change archive selection. Inline tree toolbars remain tree-local, and text filtering retains its match-reveal behavior.

When a treeItem sets props.focused: true, its enclosing tree collapses all non-ancestor treeItems, expands the focused treeItem and its ancestor branches (and activates the enclosing tabPanel if inside tabs), scrolls the item's summary into view below any sticky timeline card header, and plays the focus flash animation.

Command-backed downloads

The generic web.downloadCommand client action downloads a text file generated by any command. Its payload contains command, subcommand, arguments, and options. It runs one authenticated JSON command with timeline recording disabled, without replacing the current root or opening a modal. The source widget is busy during generation; failures are shown as system messages rather than downloaded as files.

The target command must return a JSON-encoded string matching WebCommandDownloadSchema in src/web/ui-schema.ts:

{"filename":"report.txt","mimeType":"text/plain;charset=utf-8","content":"Report contents\n"}

The browser validates the envelope, creates a UTF-8 Blob and a temporary download anchor, then removes the anchor and revokes its object URL. No server-side temporary file or plugin-specific browser branch is needed. File content is generated only when clicked, not embedded in every rendered view. Implementations live in web/src/utils/download.ts and the generic client-action dispatcher.

Scoped styles (Shadow DOM)

Command web UIs (WebNodeRoot, kind: 'ui') render inside a Shadow DOM island on the web client. Shared primitives (.web-node, .web-button, tree, overflow menu, tone utilities, etc.) come from a base stylesheet injected automatically; optional stylesheets on the root payload add presentation-only CSS scoped to that render.

Plugin / handler guardrails:

Schema: WebStyleSheet in src/web/ui-schema.ts ({ id, cssText }); optional stylesheets array on WebRenderResultSchema / WebNodeRoot.

Opt-in live refresh

WebNodeRoot.autoRefreshMs (2,000–60,000 ms) opts a render into polling its own meta command. Use it only on read-only view commands, never a command that starts execution. The Shadow DOM host skips polling while hidden/unmounted, busy, or while an input/textarea/select/contenteditable is focused. Requests do not overlap, create timeline entries, or show a pending overlay. Responses use normal root reconciliation and stale-response handling; polling is disposed when the render changes or unmounts. Include a manual Refresh action for recovery after connection errors.

Shadow mount overflow: optional shadowMountOverflow on WebNodeRoot ('hidden' | 'scroll-y'). Omitted or 'scroll-y' lets the inner Solid mount scroll when content is taller than the host (typical timeline cards). Use 'hidden' when your tree defines its own scroll regions (for example a fixed chrome row plus an overflow: auto panel inside stylesheets). The file tree web renderer sets 'hidden' so only .web-file-tree-block scrolls in the modal.

Stable identity and pending UI

Refreshed WebNodeRoot payloads are authoritative complete trees. The client reconciles compatible element nodes so stateful components can keep local UI state while server-rendered props, children, metadata, and stylesheets update.

Command actions may choose pending presentation:

An explicit surface: 'timeline' action renders its result in the main timeline, even when the target command has widget/dock metadata. It does not replace the origin widget or modal root. Actions without a surface can update their origin in place via onReplaceRoot.

pendingUi: {
  presentation: 'entity',
  label: 'Updating...',
}