Bootstrap the browser coding-agent interface #110

Open
lost-rob0t wants to merge 80 commits from agent-bootstraping into main
lost-rob0t commented 2026-07-27 07:14:37 +00:00 (Migrated from github.com)

Goal

Turn Quasar’s floating agent entrypoint into a persistent browser coding-agent interface without replacing the existing supervisor, providers, actor runtime, graph operations, MCP support, budgets, recovery, or standalone management console.

Implemented

Persistent modal chat

  • Full conversation timeline inside the floating modal; opening the bubble no longer redirects to settings or requires the standalone Agents page.
  • Conversations, drafts, active selection, and partial provider streams share one versioned PouchDB state record; legacy local browser state migrates once and is removed after a confirmed write.
  • Conversation creation, searchable recency-sorted switching, deletion, active-conversation restoration, per-conversation draft persistence, edit/resubmit, retry, copy controls, run controls, contextual route/dataset/graph state, draggable desktop position, persisted mouse/touch/keyboard resizing, and full-screen/mobile layouts.
  • Inline assistant, user, system, permission, error, streaming, and tool execution rendering.
  • Supervisor phases map consistently to idle, thinking, running-tool, waiting-for-permission, paused, failed, cancelled, completed, and budget-exhausted UI states.
  • Tool inputs, outputs, failures, affected records, and run-history entries remain inspectable.

Unified prompts and commands

  • Normal prompts and slash commands use the same composer and agent execution entrypoint.
  • Registry-derived command palette with aliases, fuzzy search, persisted recent-command ranking, keyboard/touch selection, generated signatures, schema-aware argument hints, missing-argument diagnostics, generated help, quoted/escaped values, named and positional arguments, arrays, boolean flags, and trailing natural-language instructions.
  • Dynamic actor and configured MCP commands are discovered without hard-coding them into the chat component.

Runtime permissions

  • Adds explicit capability permissions for web search, URL fetch, JavaScript, database, graph, documents, actors, filesystem, shell, and MCP.
  • Splits legacy sources.external so it authorizes web search only and never implicitly authorizes URL fetching.
  • Supports action, chat, session, permanent allow, action deny, and permanent deny scopes.
  • Permission checks run immediately before model-selected and command-selected tool execution.
  • Permission requests open the active chat, render inline, redact secret-shaped arguments, and resume or reject the exact blocked in-memory tool call.
  • Stop and pause cancel pending permission requests.

Explicit unavailable capabilities

  • Adds typed /file-read, /file-write, and /shell commands to capability discovery.
  • Clearly marks filesystem and shell commands unavailable when no trusted adapter is configured.
  • Blocks unavailable commands before permission prompts or agent execution and explains the missing adapter inline.

Real provider streaming

  • Replaces the adapter streaming stub with real SSE parsing for OpenAI-compatible and Anthropic providers.
  • Streams text and tool-call arguments incrementally, records finish state and usage, supports AbortSignal, normalizes errors, and falls back to JSON for compatible endpoints that do not stream.
  • Partial responses are shown in the modal and restored after refresh.

Browser-local attachments

  • Ingests supported text, source, JSON, JSONL, CSV, YAML, and markup files directly in the modal.
  • Enforces 8-file, 1 MB per-file, and 4 MB total limits before persistence.
  • Persists pending attachments with the active conversation and restores them after reload.
  • Renders removable attachment chips and records consumed files on the submitted user message.
  • Appends file contents to provider prompts behind an explicit data-not-instructions boundary.
  • Rejects unsupported binary files with a visible error instead of silently dropping content.

Document capabilities

  • Registers model-selectable document_read, document_create, document_patch, and document_delete tools.
  • Document writes run through StarIntel validation, Quasar operation history, persistence confirmation, affected-ID reporting, and undo.
  • Browser tests cover create, read, patch, delete, and undo restoration.
  • Dedicated /doc-read, /doc-create, /doc-patch, and /doc-delete composer commands expose typed schemas, aliases, permission checks, and destructive-risk labeling.

Sandboxed JavaScript

  • Registers javascript_execute for natural-language agent selection and /js command use.
  • Runs code in a disposable Worker, never in the page, service worker, console, extension context, or unrestricted Node runtime.
  • Blocks direct DOM, storage, network, cache, service-worker, and Quasar-global access.
  • Exposes only bounded console, input, result, and typed tools.call primitives.
  • Nested calls return through the normal registry and permission runtime, persist as parent-linked child tool-call records, and render as independently inspectable chat cards.
  • Enforces wall-clock, input, output, console, message, nested-call, and depth limits; stop/pause terminates active Workers.
  • Results include status, returned value, console output, duration, usage, nested calls, sanitized errors, and termination reason.

Validation

Latest CI run: 30391940864 — green.

Passed:

  • npm run format:check
  • npm run lint
  • npm run typecheck
  • architecture boundary checks
  • static service-worker checks
  • unit and integration tests
  • production build
  • application artifact validation
  • Playwright browser tests

Browser coverage now includes durable text attachment ingestion, reload restoration, removal, unsupported binary rejection, durable dependency-aware task orchestration, task lifecycle persistence, header control pointer isolation, modal restoration, acknowledged PouchDB draft and partial-stream persistence, legacy-state migration, persisted desktop resizing, searchable conversation switching, recent-command ranking, complete execution-state mapping, unavailable filesystem/shell gating, command discovery, typed document commands, argument validation, draft restoration, partial-stream restoration, mobile viewport fit, document mutations plus undo, JavaScript DOM/storage/network isolation, nested capability bridging plus running/completed child-call lifecycle events, timeout termination, and capability-bridge startup readiness.

Acceptance audit: still incomplete

This remains a draft because the following parts of the full specification are not honestly complete yet:

  • Pending permission cards survive reload, but an in-memory suspended tool promise cannot resume across a full browser restart; the restored run pauses instead.
  • Markdown/code rendering is intentionally lightweight and does not yet provide a full parser and syntax-highlighting pipeline.
  • The Worker sandbox enforces wall-clock and serialization limits but cannot honestly guarantee hard memory or instruction limits like a QuickJS/WASM isolate.

Branch state

  • Head: agent-bootstraping
  • Base: main
  • GitHub reports the PR mergeable.
  • GitHub reports the branch mergeable; CI run 30391940864 passed on the current PR merge candidate.
## Goal Turn Quasar’s floating agent entrypoint into a persistent browser coding-agent interface without replacing the existing supervisor, providers, actor runtime, graph operations, MCP support, budgets, recovery, or standalone management console. ## Implemented ### Persistent modal chat - Full conversation timeline inside the floating modal; opening the bubble no longer redirects to settings or requires the standalone Agents page. - Conversations, drafts, active selection, and partial provider streams share one versioned PouchDB state record; legacy local browser state migrates once and is removed after a confirmed write. - Conversation creation, searchable recency-sorted switching, deletion, active-conversation restoration, per-conversation draft persistence, edit/resubmit, retry, copy controls, run controls, contextual route/dataset/graph state, draggable desktop position, persisted mouse/touch/keyboard resizing, and full-screen/mobile layouts. - Inline assistant, user, system, permission, error, streaming, and tool execution rendering. - Supervisor phases map consistently to idle, thinking, running-tool, waiting-for-permission, paused, failed, cancelled, completed, and budget-exhausted UI states. - Tool inputs, outputs, failures, affected records, and run-history entries remain inspectable. ### Unified prompts and commands - Normal prompts and slash commands use the same composer and agent execution entrypoint. - Registry-derived command palette with aliases, fuzzy search, persisted recent-command ranking, keyboard/touch selection, generated signatures, schema-aware argument hints, missing-argument diagnostics, generated help, quoted/escaped values, named and positional arguments, arrays, boolean flags, and trailing natural-language instructions. - Dynamic actor and configured MCP commands are discovered without hard-coding them into the chat component. ### Runtime permissions - Adds explicit capability permissions for web search, URL fetch, JavaScript, database, graph, documents, actors, filesystem, shell, and MCP. - Splits legacy `sources.external` so it authorizes web search only and never implicitly authorizes URL fetching. - Supports action, chat, session, permanent allow, action deny, and permanent deny scopes. - Permission checks run immediately before model-selected and command-selected tool execution. - Permission requests open the active chat, render inline, redact secret-shaped arguments, and resume or reject the exact blocked in-memory tool call. - Stop and pause cancel pending permission requests. ### Explicit unavailable capabilities - Adds typed `/file-read`, `/file-write`, and `/shell` commands to capability discovery. - Clearly marks filesystem and shell commands unavailable when no trusted adapter is configured. - Blocks unavailable commands before permission prompts or agent execution and explains the missing adapter inline. ### Real provider streaming - Replaces the adapter streaming stub with real SSE parsing for OpenAI-compatible and Anthropic providers. - Streams text and tool-call arguments incrementally, records finish state and usage, supports `AbortSignal`, normalizes errors, and falls back to JSON for compatible endpoints that do not stream. - Partial responses are shown in the modal and restored after refresh. ### Browser-local attachments - Ingests supported text, source, JSON, JSONL, CSV, YAML, and markup files directly in the modal. - Enforces 8-file, 1 MB per-file, and 4 MB total limits before persistence. - Persists pending attachments with the active conversation and restores them after reload. - Renders removable attachment chips and records consumed files on the submitted user message. - Appends file contents to provider prompts behind an explicit data-not-instructions boundary. - Rejects unsupported binary files with a visible error instead of silently dropping content. ### Document capabilities - Registers model-selectable `document_read`, `document_create`, `document_patch`, and `document_delete` tools. - Document writes run through StarIntel validation, Quasar operation history, persistence confirmation, affected-ID reporting, and undo. - Browser tests cover create, read, patch, delete, and undo restoration. - Dedicated `/doc-read`, `/doc-create`, `/doc-patch`, and `/doc-delete` composer commands expose typed schemas, aliases, permission checks, and destructive-risk labeling. ### Sandboxed JavaScript - Registers `javascript_execute` for natural-language agent selection and `/js` command use. - Runs code in a disposable Worker, never in the page, service worker, console, extension context, or unrestricted Node runtime. - Blocks direct DOM, storage, network, cache, service-worker, and Quasar-global access. - Exposes only bounded console, input, result, and typed `tools.call` primitives. - Nested calls return through the normal registry and permission runtime, persist as parent-linked child tool-call records, and render as independently inspectable chat cards. - Enforces wall-clock, input, output, console, message, nested-call, and depth limits; stop/pause terminates active Workers. - Results include status, returned value, console output, duration, usage, nested calls, sanitized errors, and termination reason. ## Validation Latest CI run: `30391940864` — **green**. Passed: - `npm run format:check` - `npm run lint` - `npm run typecheck` - architecture boundary checks - static service-worker checks - unit and integration tests - production build - application artifact validation - Playwright browser tests Browser coverage now includes durable text attachment ingestion, reload restoration, removal, unsupported binary rejection, durable dependency-aware task orchestration, task lifecycle persistence, header control pointer isolation, modal restoration, acknowledged PouchDB draft and partial-stream persistence, legacy-state migration, persisted desktop resizing, searchable conversation switching, recent-command ranking, complete execution-state mapping, unavailable filesystem/shell gating, command discovery, typed document commands, argument validation, draft restoration, partial-stream restoration, mobile viewport fit, document mutations plus undo, JavaScript DOM/storage/network isolation, nested capability bridging plus running/completed child-call lifecycle events, timeout termination, and capability-bridge startup readiness. ## Acceptance audit: still incomplete This remains a draft because the following parts of the full specification are not honestly complete yet: - Pending permission cards survive reload, but an in-memory suspended tool promise cannot resume across a full browser restart; the restored run pauses instead. - Markdown/code rendering is intentionally lightweight and does not yet provide a full parser and syntax-highlighting pipeline. - The Worker sandbox enforces wall-clock and serialization limits but cannot honestly guarantee hard memory or instruction limits like a QuickJS/WASM isolate. ## Branch state - Head: `agent-bootstraping` - Base: `main` - GitHub reports the PR mergeable. - GitHub reports the branch mergeable; CI run `30391940864` passed on the current PR merge candidate.
nsaspy changed title from WIP: Bootstrap the browser coding-agent interface to Bootstrap the browser coding-agent interface 2026-08-27 19:57:32 +00:00
This pull request has changes conflicting with the target branch.
  • src/App.jsx
  • src/app/main.tsx
  • src/lib/agent-supervisor.js
  • src/lib/provider-adapters.js
  • src/lib/provider-adapters.test.js
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin agent-bootstraping:agent-bootstraping
git switch agent-bootstraping

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff agent-bootstraping
git switch agent-bootstraping
git rebase main
git switch main
git merge --ff-only agent-bootstraping
git switch agent-bootstraping
git rebase main
git switch main
git merge --no-ff agent-bootstraping
git switch main
git merge --squash agent-bootstraping
git switch main
git merge --ff-only agent-bootstraping
git switch main
git merge agent-bootstraping
git push origin main
Sign in to join this conversation.
No description provided.