Repository navigation
Conversation
## What Audit and update all 7 prescriptive docs in `packages/bees/docs/` to match the current implementation, fixing stale references, missing features, and outdated API descriptions. ## Why The docs had accumulated drift: the `SchedulerHooks` callback bag was replaced by typed events months ago, function group tables were incomplete, and the `Bees` class — the actual public API — wasn't documented anywhere. This reconciliation ensures the docs are a reliable source of truth for contributors. ## Changes ### `SchedulerHooks` → typed events - **scheduler.md**: Replaced hooks table with `bees.on()` typed event API - **patterns.md**: Updated "SchedulerHooks (exploratory)" → "Typed Events" (settled) - **api.md**: Fixed `Bees.__init__` signature (removed stale `hooks`/`http`/`backend` params, added `runners`); fixed `on()` from string names to typed event classes - **architecture.md**: Replaced internal scheduler method list with `Bees` class API + usage example ### Function group tables - **architecture.md**, **session.md**: Added missing `files_list_dir`, added `live` group, marked `generate` as aspirational (provided by opal_backend, not bees) - **patterns.md**: Added `runner`, `voice`, `assignee` to template field table ### Scheduler.md high-level rewrite - Removed all internal variable/method names (`_context_queues`, `_running_tickets`, `promote_blocked_tickets`, `stamp_child_ticket`, `wrap_run`, etc.) - Kept conceptual descriptions of cycle mechanics, context delivery, and coordination routing ### flux.md holistic update - Added "Typed events" as **Solid** - Fixed session contract description (`SessionRunner.run()` not `run_session()`) - Promoted "Consumption API" from Fluid → **Settling** (the `Bees` class exists) ### Index - **README.md**: Added `api.md` and `mutations.md` to docs index ## Testing Documentation-only change — no code modified. Verify by reading the updated docs and cross-referencing with source files linked in the reconciliation report.
## What
Adds `PROJECT_EVAL.md` — a phased project plan for an eval framework
that runs
pre-configured bees hives to completion with a simulated LLM-driven
user.
## Why
Bees needs a way to batch-run agent swarms for evaluation. The framework
has all
the machinery (scheduler, runners, structured logging) but no CLI for
headless
batch execution and no way to automatically respond when agents ask for
user
input. This project plan lays out four phases to get there.
## Changes
### `packages/bees/`
- **[NEW] `PROJECT_EVAL.md`** — four-phase project plan:
- Phase 1: Eval CLI + batch runner (thin wrapper over existing `Bees` +
`Scheduler`)
- Phase 2: Simulated user (LLM with a persona prompt responds to
suspended
agents)
- Phase 3: Multi-task user dispatch (coherent responses across multiple
agents)
- Phase 4: Structured results collection (machine-readable summaries)
## Testing
Documentation-only change. No code to test.
## What Adds a batch evaluation framework to Bees: a CLI that copies pre-configured hives to working directories, runs them to completion (or suspension), and prints per-case results. ## Why Enables automated, offline evaluation of agent hives without the server or file watcher. This is Phase 1 of PROJECT_EVAL — proving the plumbing before adding the simulated user in Phase 2. ## Changes ### Core infrastructure - **`Bees.run()`** — new one-shot batch API (counterpart to `listen()`): startup → drain → shutdown in a single call - **`run_all_waves()` enrichment** — added post-completion coordination hooks (context delivery to parents, tag enrichment, TaskDone events) so swarm hives work in batch mode. Previously, children completing wouldn't wake a suspended parent — the loop would exit with the parent stuck ### Eval module (`bees/eval/`) - **`runner.py`** — copies a hive, creates runners, calls `Bees.run()`, produces a `CaseResult` - **`batch.py`** — discovers hives in an eval set directory (by `config/SYSTEM.yaml` marker), runs each sequentially, prints summary table - **`__main__.py`** — CLI with `run` (single hive) and `run-set` (batch) subcommands ### Eval as a hive concept - Eval config lives inside the hive as an `eval/` subdirectory (not wrapped around it) - An eval set is a directory of hives — each child with `config/SYSTEM.yaml` is a case ### Docs & wiring - `docs/eval.md` — full eval framework reference - `AGENTS.md`, `docs/README.md` — updated with eval references - `package.json` — `npm run eval` script - `.gitignore` — `results/` excluded - `PROJECT_EVAL.md` — Phase 1 items marked complete ## Testing ```bash # CLI help: npm run eval -w bees -- --help # Single hive: GEMINI_KEY=... npm run eval -w bees -- run path/to/hive # Batch (eval set): GEMINI_KEY=... npm run eval -w bees -- run-set ../../hives --output results/ # Unit tests: npm run test:python -w bees -- tests/test_eval.py ```
## What Extract the hivetool ticket detail view into a tabbed `Surface · Detail` layout, so the agent's curated surface gets a dedicated full-pane view. ## Why Phase 5a of Project Surface. The surface was previously embedded as a block inside the timeline. Giving it its own tab makes it the primary presentation and leaves the timeline as a secondary diagnostic view. ## Changes ### `hivetool/src/ui/` - **[NEW] `ticket-pane.ts`** — wrapper component owning the ticket header (title, status badge, identity chips, task controls) and a `Surface · Detail` tab bar. Probes for `surface.json` on ticket change; hides tabs when no surface exists. - **[NEW] `surface-pane.ts`** — full-pane "Surface" tab body. Owns surface loading and renders `<bees-surface-view>`. - **[MODIFIED] `ticket-detail.ts`** — stripped header, identity chips, surface loading, and task controls. Now a pure timeline renderer. - **[MODIFIED] `app.ts`** — swapped `<bees-ticket-detail>` for `<bees-ticket-pane>` in the tickets tab main area. ### `PROJECT_SURFACE.md` - Phase 5a items checked off. ## Testing 1. Run `npm run dev:hivetool -w packages/bees`. 2. Select a ticket **without** a `surface.json` — no tab bar, detail view renders directly. 3. Select a ticket **with** a `surface.json` (e.g. `37eea4e3`) — `Surface · Detail` tabs appear, Surface is auto-selected. 4. Switch between tabs — each gets the full main pane.
## What
Enables sandboxed React component rendering in HiveTool's surface pane.
Surface items with `render: "bundle"` now display as live iframes, with
full `window.opalSDK` messaging support.
## Why
Phase 5b+5c of PROJECT_SURFACE. Agent-generated UI bundles (JSX compiled
to CJS via esbuild) need to render inside HiveTool with the same
`opalSDK` contract used in the Opal web shell. This completes the
rendering pipeline and makes the SDK extensible for future methods.
## Changes
### New shared code (`packages/bees/common/`)
- `bundle-types.ts` — message protocol types
(`sdk.call`/`sdk.call.response`, `SdkHandlers`)
- `message-bridge.ts` — host-side typed postMessage bridge with ready
gating
- `iframe-runtime.ts` — `buildIframeHtml()` generates self-contained
sandbox HTML with inline React UMD, CJS require shim, error boundary,
and generic `opalSDK` Proxy
- `README.md` — developer docs for extending the SDK (one step: register
a handler)
### New HiveTool components (`packages/bees/hivetool/src/ui/`)
- `bundle-frame.ts` — `<bees-bundle-frame>` hosts a sandboxed iframe,
dispatches `sdk.call` to a handler registry
- `react-cache.ts` — fetches React 18 UMD from unpkg once per session,
caches the blob URL
### Modified
- `surface-pane.ts` — detects `render: "bundle"` items, reads JS/CSS
from ticket filesystem, renders each as a `<bees-bundle-frame>` with SDK
handlers (`readFile`, `navigateTo`, `emit`)
- `PROJECT_SURFACE.md` — marks phases 5b/5c complete, adds phase 5c (SDK
extensibility), renumbers subsequent phases
### Test fixture
- Updated `hive/tickets/.../surface.json` to reference the actual
`bundle.js` file
## Testing
1. Run `npm run dev:hivetool -w packages/bees`
2. Select ticket `37eea4e3...` → Surface tab
3. Verify the bundle renders in a sandboxed iframe
4. In the bundle component, call
`window.opalSDK.readFile("surface.json")` — should return the file
contents
## What Added markdown rendering and on-demand content preview to the hivetool surface pane. Surface items with file paths are now expandable — clicking toggles a preview area that renders `.md` files as formatted HTML and other files as preformatted text. ## Why Phase 5d of Project Surface. Agents produce markdown documents as surface items, but until now they rendered as plain text cards with just a file path. This makes the surface actually useful as a reading surface. ## Changes ### `common/` - **[NEW] `markdown.ts`** — Extracted the markdown Lit directive (markdown-it + secure link rules) from `web/` into a shared module. ### `web/` - `src/directives/markdown.ts` — Replaced inline implementation with a re-export from `common/markdown.ts`. No consumer changes needed. ### `hivetool/` - `package.json` — Added `markdown-it` and `@types/markdown-it` dependencies. - `surface-view.ts` — Items with a `path` are now expandable (click to toggle). Loads content on demand via a `contentLoader` callback prop. Markdown files render through the shared directive with full styling; other files render as `<pre>`. Content is cached after first load. - `surface-pane.ts` — Passes a `#contentLoader` that delegates to `TicketStore.readFileContent`. ## Testing - Open hivetool, select a ticket with a `surface.json` that references `.md` files. - Click on an item with a file path — content preview should expand with rendered markdown. - Click again to collapse. Verify content is cached (no re-load flicker on re-expand). - Non-markdown files should render as monospace preformatted text.
## What Adds a `root_override` parameter to `Bees` and `Scheduler` that lets callers override the root template from `SYSTEM.yaml`. Exposes it via `--root` in the eval CLI. Also fixes the `_boot_root_template` guard to only skip booting when a non-terminal instance of the template exists. ## Why Enables different eval runs against the same hive config with different root templates — useful for hives that define multiple templates but no default root. The boot guard fix is a bug: a completed task from a prior run was preventing new instances from being created, which also affects `box.py` restarts. ## Changes ### `packages/bees/bees/scheduler.py` - Accept `root_override` in `Scheduler.__init__`, use it in `_boot_root_template` - Fix `already_booted` check: only match tasks in non-terminal status (`completed`, `failed`, `cancelled` no longer block re-boot) ### `packages/bees/bees/bees.py` - Accept keyword-only `root_override` in `Bees.__init__`, forward to `Scheduler` ### `packages/bees/bees/eval/runner.py` - Accept `root_task` in `run_case`, pass as `root_override` to `Bees` ### `packages/bees/bees/eval/batch.py` - Thread `root_task` through `run_set` to each `run_case` call ### `packages/bees/bees/eval/__main__.py` - Add `--root` flag to both `run` and `run-set` subcommands ## Testing ``` npm run eval -w bees -- run ../../hives/chat-app --root chat-app-builder ``` Verified: hive with no `root` in SYSTEM.yaml boots the specified template and runs to completion. Also verified: re-running against a hive with a completed task correctly boots a fresh instance.
…#8470) ## What Adds `EventTarget`-based event subscription to `window.opalSDK` in sandboxed iframes, wires the first real event (`filechange`) that fires when workspace files change, and fixes a bundler resolution bug that broke multi-file React apps. ## Why Bundle components had no way to know when workspace files changed — they could only read data once at mount. The `filechange` event completes the reactive loop: write a file with `files_write_file`, and the running component updates automatically. The bundler bug was blocking any app that used sub-component imports. ## Changes ### Event infrastructure (`packages/bees/common/`) - `bundle-types.ts` — Added `sdk.event` host message type; `OpalSDK` now extends `EventTarget` - `iframe-runtime.ts` — Proxy wraps a real `EventTarget`; `sdk.event` messages dispatch as `CustomEvent` on the SDK - `message-bridge.ts` — Added `emit(event, detail?)` convenience method - `README.md` — Documented event subscription with `filechange` examples ### `filechange` event plumbing (`packages/bees/hivetool/`) - `ticket-store.ts` — New `filesystemChange` signal; observer now extracts workspace-relative paths from `filesystem/` subdirectories - `surface-pane.ts` — Reads `filesystemChange` signal, reloads surface on `surface.json` changes, forwards file changes to bundle iframes. Also fixes the import: side-effect + `import type` to prevent Vite tree-shaking the custom element registration - `bundle-frame.ts` — Exposed public `emit()` method ### Bundler fix (`hives/chat-app/skills/build-react-apps/`) - `bundler.mjs` — Fixed module resolution: CSS check matched `.jsx` files by exact path before the JSX resolver could run. Replaced separate CSS/JSX resolution blocks with a single lookup that assigns namespace by actual file extension. ### New skill + template update (`hives/chat-app/`) - `skills/use-opal-sdk/SKILL.md` — New skill teaching agents the `readFile` + `filechange` pattern - `TEMPLATES.yaml` — Updated `chat-app-builder` template to reference the new skill ## Testing - TypeScript compiles clean (only pre-existing `js-yaml` type errors) - Re-bundled a failing multi-file app (3425 → 6028 bytes) — component renders correctly in hivetool - Verified `filechange` event plumbing with live hivetool dev server
## What Extracts chat UI from the Detail tab into a standalone `<bees-chat-panel>` component and composes it as a built-in item in the Surface pane using a CSS grid bento box layout. Also fixes a bug where choice responses were never logged to `chat_log.json`. ## Why Chat and surface items are conceptually part of the same presentation — the agent's curated output. Unifying them in a single pane with a structured grid layout creates a more cohesive experience (chat on the left, surface content on the right) and sets up the infrastructure for richer bento-style layouts. ## Changes ### Hivetool UI - **[NEW] `chat-panel.ts`** — extracted `<bees-chat-panel>` combining chat log + input UI (text reply, choice cards). Renders markdown in chat messages and agent prompts. Deduplicates the last agent message when the input panel is showing. - **`surface-pane.ts`** — bento grid layout owner. Composes chat panel alongside bundles and surface-view. Chat takes left half when present; content fills right half or full width. - **`ticket-detail.ts`** — removed ~400 lines of chat UI code (log, reply/choice forms, related state and styles). Non-interactive suspend fallback preserved. - **`ticket-pane.ts`** — Surface tab now shown when surface OR chat content exists. Passes `mutationClient` to surface pane. Fixed `overflow: auto` on tab body for Detail scrolling. - **Exported `hasChatContent(ticket)`** utility for tab visibility probing. ### Backend - **`task_runner.py`** — `resume_task` now logs choice responses (`selectedIds`) to `chat_log.json`, not just text replies. ## Testing - Select a task with chat history but no surface → Surface tab appears, chat renders full-width - Select a task with surface + chat → two-column bento layout, chat left, items right - Select a task with surface only → items flow full-width - Reply to a suspended task (text and choice) → both logged to `chat_log.json` - Detail tab scrolls correctly
## What
Fixes three reactivity bugs in hivetool and switches the bundle iframe's
design tokens from a light theme to a dark Slate palette matching the
hivetool chrome.
## Why
- Creating a task from a template failed with "Ticket store not
activated" when the hive had no `tickets/` directory yet.
- The Surface tab didn't appear when a task first received chat content
(e.g., `chat_log.json` created for the first time) — required navigating
away and back.
- Updating a bundle's path in `surface.json` updated the title but not
the rendered iframe content, because the bridge only sent code once.
- The light-themed bundle iframe looked jarring inside hivetool's dark
UI.
## Changes
### `packages/bees/hivetool/src/data/ticket-store.ts`
- Pass `{ create: true }` to `getSubdirectory("tickets")` in
`activate()` so the directory is created if missing.
### `packages/bees/hivetool/src/ui/ticket-pane.ts`
- Check `hasChatContent(ticket)` reactively every render instead of only
during the one-time async probe.
- Auto-switch to Surface tab when chat content first appears.
- Rename `hasSurface` → `hasSurfaceManifest` to clarify it only tracks
the async `surface.json` probe.
### `packages/bees/hivetool/src/ui/bundle-frame.ts`
- Track last-sent code/CSS; re-send `render` message when props change
on an already-wired bridge.
- Update iframe container background from white to dark (`#0f1115`).
### `packages/bees/common/iframe-runtime.ts`
- Replace all light MD3 color tokens with dark Slate equivalents derived
from hivetool's palette.
### `packages/bees/hivetool/src/ui/log-detail.ts` +
`log-detail.styles.ts`
- Rename "ticket" chip label → "task".
- Push `.link-chip` to the right via `margin-left: auto` and add `gap:
8px` to `.header-top`.
## Testing
- Open a hive without a `tickets/` directory → click Run on a template →
task should be created without error.
- Start a task that triggers chat input for the first time → Surface tab
should appear immediately.
- Update a bundle path in `surface.json` while viewing the Surface tab →
iframe should re-render with the new code.
- Verify bundle iframes render with dark backgrounds and light text.
Adds OAuth 2.0 authentication for remote MCP servers, enabling Google Workspace MCP servers (Gmail, Drive, Calendar, Chat, People) to work with Bees. Users configure OAuth credentials in SYSTEM.yaml and complete the consent flow through hivetool's browser UI. Google Workspace MCP servers require OAuth 2.0 — static API keys won't work. This bridges the gap between the box (headless, consumes tokens) and hivetool (interactive, runs the consent flow), so users can authenticate once in the browser and have the box pick up tokens automatically. - `OAuthConfig` dataclass for the `oauth` block in SYSTEM.yaml - `HiveTokenStorage` — filesystem-backed token persistence at `hive/.mcp-tokens/<name>.json` - `_connect_http_oauth()` — new connection path using `OAuthClientProvider` with PKCE - `connect_all()` — validation (oauth+headers mutual exclusion, oauth requires URL) - Graceful skip when tokens are missing (logs warning, doesn't crash) - Loads `hive/.env` in addition to cwd `.env` so hive-specific credentials (OAuth client IDs) are available to the scheduler - `OAuthConfig` type in `system-store.ts` with YAML parse/serialize - Auth mode toggle (Headers / OAuth) in MCP edit cards - OAuth badge, scope chips, client ref in MCP view cards - "Authenticate" button with token status indicator (Connected / Not Authenticated / Pending) - `oauth-flow.ts` — browser-side OAuth orchestrator: reads `.env` for credential expansion, PKCE via Web Crypto, popup management, token exchange, file write - `oauth-callback.html` — static redirect page that `postMessage`s the auth code back to the opener - `create-hive.mjs` — new hives now include `.env` and `.mcp-tokens/` in `.gitignore` - `oauth-setup.md` — step-by-step setup guide (Cloud Console → .env → SYSTEM.yaml → authenticate → start box) - `system-config.md` — documents the `oauth` field and token storage - 39 Python tests passing (20 new) — token storage round-trips, config validation, graceful skip logic - TypeScript compiles clean (`tsc --noEmit`) - End-to-end verified: authenticated all 5 Google Workspace MCP servers via hivetool, box connected and discovered tools (Gmail: 10, Drive: 8, Calendar: 8, People: 3)
## What Rewrites MCP infrastructure from eager, startup-bound connections to lazy, on-demand connections with automatic retry, exponential backoff, and transport crash isolation. ## Why MCP servers are unreliable — they return errors, drop connections, and crash transports. The previous architecture (eager connect at startup, shared exit stack, no reconnect) meant a single HTTP 403 from one server would kill the transport's anyio TaskGroup, propagate cancellation into the box's main `awatch` loop, trigger a restart, and destroy all active agent conversation context. ## Changes ### `packages/bees/bees/functions/mcp_bridge.py` - **`MCPConnection`**: Promoted from a 4-field dataclass to a lifecycle owner. Each connection runs its transport in an isolated `asyncio.Task`, so crashes are fully contained. - `discover_tools()` — brief connect at startup for tool declaration caching, then disconnect. No long-lived transports at rest. - `call_tool()` — lazily connects on first use, retries with exponential backoff on transient failures, fails fast on permanent failures (HTTP 4xx). - `_race_call_vs_death()` — races `session.call_tool()` against a "transport died" event, preventing the hang that occurred when `asyncio.shield()` protected a call whose transport had already crashed. - `_is_permanent_failure()` — distinguishes retryable errors (network blips, 500s, 429s) from permanent ones (403 Forbidden, 400 Bad Request). - **`_make_proxy_handler`**: Now delegates to `conn.call_tool()` instead of calling `session.call_tool()` directly. Retry/reconnect handled transparently. - **`MCPRegistry`**: Simplified to a thin coordinator. `discover_all()` replaces `connect_all()` (backward-compat alias kept). No shared `AsyncExitStack`. `disconnect_all()` delegates to each connection. ### `packages/bees/tests/test_mcp_bridge.py` - Updated all tests for new `MCPConnection` API (constructor takes config dict, `_make_proxy_handler` takes conn). - Added `TestCallToolRetry` — tests retry-on-failure, retries-exhausted, and connect-failure paths. ### `hives/chat-app/config/SYSTEM.yaml` - Added `chat.messages.create` scope to gchat MCP server config. ## Testing ```bash cd packages/bees && python3 -m pytest tests/test_mcp_bridge.py -v --tb=short -k 'not HiveTokenStorage and not refreshable' ``` 33 tests pass (9 skipped — pre-existing `mcp` SDK not installed in test env). Manual verification with live MCP servers: - ✅ Box stays alive through Drive 400, People 401→refresh→200, GChat 403 - ✅ Agent receives actionable error messages on permanent failures - ✅ No more infinite hang on transport crashes
## What Adds a `delete-task` hot mutation that removes a task and all its descendants — including ticket directories, session logs, and in-flight work — from the Hivetool UI. ## Why Previously there was no way to clean up individual tasks. The only option was a full hive reset. This gives users surgical control over task lifecycle. ## Changes ### Backend (`bees/`) - **scheduler.py**: `_deleted_tasks` marker set prevents ghost post-completion events when in-flight LLM calls or tools complete after a task is deleted. `delete_task()` cascades recursively through children, cancelling asyncio tasks, removing ticket dirs, and cleaning session logs. - **bees.py / task_node.py**: Public `delete_task()` / `delete()` API surface. - **mutations.py**: `delete-task` hot mutation handler. When a `Bees` instance is running, delegates to the scheduler for proper asyncio cancellation. Falls back to filesystem-only delete at startup. ### Frontend (`hivetool/`) - **mutation-client.ts**: `deleteTask(taskId)` method. - **ticket-pane.ts**: 🗑 Delete button on every task (with confirm dialog). Visible whenever the box is active, regardless of task status. Deselects the ticket after deletion. - **ticket-store.ts**: Widened `selectTicket()` to accept `null`. ## Testing - TypeScript: `npx tsc --noEmit` passes - Python: 479 tests pass (`pytest tests/ -x -q`) - Manual: start box + hivetool, create a task, click Delete, confirm the task and its logs are removed. Also tested deleting a running task — in-flight work completes silently without writing ghost events.
…#8476) ## What A batch of Hivetool workbench improvements: maximize mode for focused work, section-based tab navigation for bundles, auto-scroll in chat, dark-theme link styling, and design-token cleanup. ## Why The workbench UI needed polish to support real usage patterns — maximizing content area, navigating between multiple bundle sections, and keeping up with live chat output. ## Changes ### Hivetool UI - **Maximize mode** (`ticket-pane.ts`, `app.ts`): Toggle button (⛶) in the tab bar hides sidebar/top-bar. Escape key exits. Active state styling on the toggle. - **Section tabs** (`surface-pane.ts`, `types.ts`): Bundles are grouped by `section` and rendered as selectable tabs. New `active` field on `SurfaceSection` controls the default tab. - **Flexible bundle height** (`bundle-frame.ts`, `surface-pane.ts`): Bundles fill available vertical space (`flex: 1` chain from cell → host → container → iframe). Replaced the fixed 400px iframe height with flex layout; `min-height: 300px` prevents excessive squishing. - **Chat auto-scroll** (`chat-panel.ts`): Chat log scrolls to bottom on new messages when the user is near the bottom; preserves position when scrolling through history. - **Dark-theme links** (`shared-styles.ts`): Global anchor styles for the dark palette. - **Surface view** (`surface-view.ts`): Removed primary/non-primary border differentiation. ### Design tokens - **Line-height removal** (`iframe-runtime.ts`): Stripped all `--cg-text-*-line-height` tokens and body line-height override to use browser defaults. ### Schema & docs - **`active` field** on `SurfaceSection` documented in `surface-schema.md` and both copies of the surface `SKILL.md`. - **Line-height tokens** removed from `build-react-apps/SKILL.md`. ### Config - **`chat-3` template** added to `TEMPLATES.yaml` with widget-building skills. ## Testing - Visual: run `npm run dev:hivetool` against a hive with multi-section bundles; verify tab switching, maximize toggle, chat scroll, and bundle height fill. - Build: `npm run build -w packages/bees` compiles without errors.
…8477) ## What Implements Phase 2 of Project Eval, introducing a stateful simulated user task that interacts autonomously and loops back-and-forth with the main agent under test to drive case execution past user input suspensions. ## Why Enables automated, side-effect-free evaluation runs to reach completion hermetically by roleplaying user personas without custom API text preambles or hardcoded boilerplate text utilities. ## Changes ### Eval Subsystem - **`packages/bees/bees/eval/runner.py`**: Implemented the multi-turn orchestration loop in `run_case()`. Added lazy `eval/config.yaml` loading, strict input schema checks, stateful task resumption, and `system.*`-driven autonomous conclusion tracking. ### Configuration & Test Cases - **`hives/hermetic-chat/`**: Created a clean, side-effect-free evaluation case template that leverages the unified template format configuration structure. ### Testing - **`packages/bees/tests/test_eval.py`**: Added a comprehensive mock unit test covering multi-turn handoffs and loop state transitions. ## Testing - Run the python unit tests: `npm run test:python -w bees` - Run the manual test case: `npm run eval -w bees -- run ../../hives/hermetic-chat/ --output results/hermetic-test/`
## What Enabled seamless, zero-prompt switching between multiple evaluation cases within a batch run. The existing remembered hives dropdown picker in Hivetool was refactored to display nested cases indented under a single Group Header representing the parent results directory. ## Why Exploring multiple cases from a batch evaluation was previously highly clunky, requiring users to open the OS directory picker and click through browser permission popups for every single case. By utilizing transitive browser permissions granted to the parent results directory, Hivetool can now programmatically resolve sub-case directory handles and switch between them instantly. ## Changes ### State Access Refactoring (`packages/bees/hivetool/src/data/state-access.ts`) * Added `isMultiHive`, `cases`, and `activeCaseId` reactive signals to `StateAccess`. * Implemented directory detection (`_detectAndLoadCases`) and recursive child hive discovery (`_discoverHives`). * Added programmatic case switching (`switchToCase`) under the authorized parent directory handle. * Fixed a reactivity bug by consolidating all directory activation pathways (picks, re-authorizations) through `#activate()`, ensuring sub-cases populate immediately without requiring a page refresh. ### UI Integration (`packages/bees/hivetool/src/ui/app.ts`) * Added `.sub-item` styles in `BeesApp.styles` to cleanly render indented cases. * Refactored `renderHivePicker()` to display multi-hive parents as Group Headers and nested cases as indented sub-items. * Wired Group Header `✕` remove button to cleanly delete the entire parent handle and its nested group in one action. * Connected sub-case selection to reactively trigger `resetStores()`, `switchToCase()`, and `activateStores()`. ### Unit Tests (`packages/bees/hivetool/tests/state-access.test.ts`) * Added comprehensive unit tests mocking directory structures to verify standalone Single-Hive detection, Multi-Hive parent detection, case discovery, and programmatic case switching. ## Testing * All 23 Hivetool unit tests are compiling and passing successfully with `npm run test` (0 failures). * Manually verified that selecting a results directory in Hivetool immediately populates the case list in the picker dropdown, allowing instant case navigation.
## What Adds `PROJECT_REWIND.md` — a four-phase project plan for implementing session rollback in bees via fork-based session lineage. ## Why Bees agents accumulate long, expensive conversation histories. When an agent goes off-track mid-session, the only option today is to delete the task and start over. This project designs a rollback capability that lets users rewind to any prior turn boundary and resume, without losing earlier context. ## Changes ### PROJECT_REWIND.md (new) - **Session Lineage Model**: Tasks own multiple sessions. Rollback = fork: creates a new session with truncated context + filesystem snapshot, marks the old session as "superseded" (never mutated). Re-activation is free. - **Phase 1 — FileBasedSessionStore**: Persistent `SessionStore` implementation replacing ephemeral in-memory stores. Implements both `SessionStore` and `InteractionStore` protocols. Filesystem snapshots captured in `InteractionState.file_system` at suspend points, eliminating the standalone `filesystem/` directory. - **Phase 2 — Hivetool Session Inspector**: Visual validation of the store — hivetool reads and displays session data directly from the file-backed store, including session lineage and `InteractionState` summaries. - **Phase 3 — Turn-Aware Session History**: Turn boundaries as checkpoints (context offset + lazy filesystem snapshot). Turn recording lives in bees (`drain_session`), not opal-backend's `_tee_events()`. - **Phase 4 — Rollback**: `rollback-to-turn` hot mutation that forks a session at a prior turn. Includes status guard, `seed_files=False` hazard mitigation, `SessionConfiguration.session_id` for pre-assigned UUIDs, and subtask workspace sharing rework. - **Context for New Sessions**: Quick-reference file tables and a live example for future conversation sessions. ## Testing Design document only — no code changes. Reviewed by a separate evaluation session that surfaced 10 design issues (duplicate JSON keys, pop semantics, session ID ownership, turn boundary ownership, fork semantics precision, etc.), all incorporated.
…8483) ## What Replaces legacy ephemeral session stores with a durable, unified `FileBasedSessionStore` that manages all task session events, interaction states, and filesystem snapshots under a session-specific directory (`tickets/{id}/sessions/{session-id}/`). ## Why Eliminates manual serialization and separate runtime workspace structures, establishing a pristine, non-destructive session lineage model needed to support session rollback and swap capabilities without context loss or state corruption. ## Changes ### opal-backend - **Unified File Store**: Implemented [FileBasedSessionStore](file:///Users/dglazkov/Documents/code/breadboard/packages/opal-backend/opal_backend/sessions/file_store.py) implementing both `SessionStore` and `InteractionStore` protocols. - **Pop Semantics Resolution**: Uses the `resume_id` file as an ephemeral single-use marker to preserve `interaction.json` durably on disk for offline inspection. - **Lifecycle State**: Added `SUPERSEDED` status to `SessionStatus` in [store.py](file:///Users/dglazkov/Documents/code/breadboard/packages/opal-backend/opal_backend/sessions/store.py). - **Durable Tests**: Added complete conformance tests in [test_file_session_store.py](file:///Users/dglazkov/Documents/code/breadboard/packages/opal-backend/tests/test_file_session_store.py). ### bees - **Session Workspaces**: Reworked `Ticket.fs_dir` in [ticket.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/ticket.py) to dynamically resolve active session workspace directories. - **Filesystem Hydration**: Added `hydrate_from_snapshot` in [disk_file_system.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/disk_file_system.py) to clean and restore workspaces to the exact snapshot on resume. - **Runner & Configuration Wiring**: Injected stores factories and session parameters into `GeminiRunner` and `SessionConfiguration`. - **Dynamic Migration**: Wired [task_runner.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/task_runner.py) to track active sessions, load states dynamically from disk, and dynamically migrate legacy tasks seamlessly on first resume. - **Cleanups**: Removed deprecated manual persistence helpers and resolved a silent network leakage in `test_mcp_bridge.py`. ## Testing - **Unit Tests**: All 488 unit tests across both packages pass successfully (474 in `bees` and 14 in `opal-backend`). - **End-to-End Verification**: Created and executed a mock-runner validation script (`verify_session_store.py`) confirming first-run directory initialization, correct suspend state recording, proper workspace hydration on resume, and complete lifecycle completion.
… 2) (#8484) ## What Implements **Phase 2 (Hivetool Session Inspector)** of the **Project Rewind** rollback capabilities, enabling visual task lineage tracing, live event timeline scans, and active interaction snapshotting in Hivetool. It also resolves core timing and durability issues inside `opal-backend` and `bees` to secure 100% robust task resumptions. ## Why Bees agents accumulate complex conversation trees. To enable turn-level session rewind (rollback), the devtools UI must be able to render active vs. superseded session lineages reactively from the durable store. Additionally, aligning backend session IDs and preventing eager deletion of marker files on history playback prevents tasks from failing on resume. ## Changes ### Hivetool Devtools (UI & Reactivity) - **Dynamic Workspace Resolution**: Updated [ticket-store.ts](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/hivetool/src/data/ticket-store.ts) to dynamically browse files directly from the active session directory (`sessions/{id}/workspace/`) with legacy fallback support. - **Recursive Observer Translation**: Updated `FileSystemObserver` inside Hivetool to capture and translate live session changes reactively. - **Session Lineage Cards Tree**: Built custom Lit element [session-lineage.ts](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/hivetool/src/ui/session-lineage.ts) visually laying out fork points, superseded logs, event counts, and status badges. - **Active Interaction Snapshot**: Added a live summary card at the top of the timeline displaying contents length, pending suspend functions, and workspace files. - **Reactive Hot-Reloading**: Wired [ticket-detail.ts](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/hivetool/src/ui/ticket-detail.ts) to register a reactive dependency on the `recentlyUpdatedTicket` signal to trigger background reloads automatically on file changes. - **Strict TS Lints**: Resolved all strict typescript compilation checks (casts, parameters, and accessor limits) across `hivetool`. ### Python Backend & Runner Stability - **Session ID Alignment**: Updated [run.py](file:///Users/dglazkov/Documents/code/breadboard/packages/opal-backend/opal_backend/run.py) to accept an optional `session_id` argument, preventing UUID mismatch errors between stores. - **Non-Destructive Stream Capture**: Updated `_capture_resume_state` in [gemini.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/runners/gemini.py) to pure-read `interaction.json` directly on disk when `FileBasedSessionStore` is active, durably preserving the `resume_id` marker. - **History Playback Safety**: Updated the fallback inside `_capture_resume_state` to pure-read `resume_id` without unlinking it during the playbacks of re-emitted history turns. - **Non-Destructive API Resumption**: Updated `resume_session` in [api.py](file:///Users/dglazkov/Documents/code/breadboard/packages/opal-backend/opal_backend/sessions/api.py) to perform a non-destructive lookup of `resume_id` to resolve the interaction ID, shielding the file from premature deletion before the agent loop loads it. - **Enum String Compatibility**: Made `set_status` inside [file_store.py](file:///Users/dglazkov/Documents/code/breadboard/packages/opal-backend/opal_backend/sessions/file_store.py) fully string-compatible. ## Testing - **Automated Tests**: All **1,054 unit tests** across both repositories (`bees` and `opal-backend`) pass cleanly: ```bash # opal-backend: 580 passed cd packages/opal-backend && .venv/bin/pytest # bees: 474 passed cd packages/bees && PYTHONPATH=. .venv/bin/pytest ``` - **Hivetool Devtools Build**: Compiles cleanly inside **431ms** with zero errors: ```bash cd packages/bees/hivetool && npm run build ``` - **End-to-End verification**: Verified that suspended tasks in `dev:box` resume successfully with correct durable logs and files listed reactively in Hivetool details.
## What This PR adds turn checkpoints (absolute turn indices, context offset lengths, token metadata, and lazy filesystem snapshots) to the `SessionStore` protocol and wires them into the `bees` session draining pipeline and `hivetool` UI. ## Why To provide structured, turn-aligned history records of both conversation context and the filesystem baseline. This allows precise offline turn inspection in the debugger UI and establishes the data model foundations required for the Rollback/Fork mutation (Phase 4). ## Changes ### 1. SessionStore Protocol & Core Implementations (`packages/opal-backend`) - Added `TurnCheckpoint` TypedDict definition to [store.py](file:///Users/dglazkov/Documents/code/breadboard/packages/opal-backend/opal_backend/sessions/store.py) and extended `SessionStore` with `record_turn_boundary` and `get_turn_boundaries`. - Implemented the protocol methods in `InMemorySessionStore` and `FileBasedSessionStore` (saving durably to `turns.json`). ### 2. Turn Draining & Lazy Filesystem Snapshotting (`packages/bees`) - Wired checkpoint recording into `drain_session` in [session.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/session.py) at `sendRequest` and `usageMetadata` boundaries. - Added `_fs_changed` to compare filesystem snapshots and only store snapshots when file mutations actually occurred (lazy checkpointing). - Always stores a baseline snapshot on turn 0 as a reliable recovery anchor. - Automatically handles resumed runs by discovering pre-existing turn indices. ### 3. Hivetool UI (`packages/bees/hivetool`) - Extended `SessionStoreReader` to parse `turns.json`. - Updated `log-detail.ts` UI to display turn numbers and display a `📂 X files` active badge when turn-specific file mutations occur. - Fixed strict TypeScript `any` linting issues in `log-detail.ts`. - Added `npm run lint` to `packages/bees` package configurations to run ESLint checks on `hivetool`. ## Testing - **Opal Backend pytest**: `pytest tests/ -v` -> All 582 tests passed. - **Bees pytest**: `npm run test:python` -> All 474 tests passed. - **Bees ESLint Check**: `npm run lint` -> All checks passed cleanly with 0 errors. - **Hivetool TS tests**: `npm run test` -> All 23 tests passed. - **Hivetool build**: `npm run build` -> Compiled cleanly.
…8486) ## What Replaced the manual hold-to-talk live audio streaming trigger with an automatic, amplitude-based voice activity detection (VAD) level gate, and duplicated connection state controls into the Chat View. ## Why Improves overall user experience by allowing users to simply toggle a live session connection on once (either from the task detail pane or the chat panel) and stream audio dynamically just by speaking, removing the clunky requirement to press and hold a mic button. ## Changes ### Core Audio & Streaming * **`packages/bees/hivetool/src/data/audio-handler.ts`**: * Implemented auto-gated amplitude checking (`threshold = 1500`) inside the real-time PCM capture loop. * Added hangover/silence timeout (`hangoverMs = 800`) to protect word clipping and naturally close transmission gates. * Simplified class API by removing manual `openGate`/`closeGate` triggers. * **`packages/bees/hivetool/src/data/live-session.ts`**: * Changed connection loop to auto-start microphone capturing once WebSocket setup is fully complete (`startAudio`). * Dynamically exposed auto-gated streaming states back to the reactive `talking` signal on chunk delivery and end-of-stream callbacks. ### Frontend UI * **`packages/bees/hivetool/src/ui/ticket-detail.ts`**: * Replaced hold-to-talk pointer triggers with a clean, single-click "Start Session" / "Stop Session" connection toggle button. * Added a micro-animated active audio transmission pulse that lights up whenever speech triggers the VAD loop. * **`packages/bees/hivetool/src/ui/chat-panel.ts`**: * Duplicated the visual Live Session connection panel, toggle button, and status indicators at the bottom of the Chat panel to keep the user informed of session status while reviewing logs or chatting. ## Testing 1. Toggle the Live Session connection state via "Start Session". 2. Ensure the mic icon stays green but shows "Quiet" when silent. 3. Speak naturally to observe immediate automatic transmission ("Streaming audio").
## What Implements conversation rollback (forking) in Hivetool, enabling users to rewind a conversation history to any prior turn boundary, clone and truncate session history, restore workspace filesystem snapshots, and continue execution on a new session lineage. ## Why Enables developers to experiment with alternative agent prompt paths, recover task progress after errors, and explore different conversation turns safely without losing task integrity. ## Changes ### bees backend - **Rollback Mutation Handler**: Added hot `"rollback-to-turn"` mutation inside [mutations.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/mutations.py) to handle session context slicing, turns.json copying, lineage tracking, and workspace snapshots restore. - **Durable Event Slicing**: Copies and slices parent event streams (`events.jsonl`) precisely at turn boundaries during forks, ensuring correct historical render. - **Fully Asynchronous mutations**: Refactored MutationManager and its processing loops inside [box.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/box.py) and [mutations.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/mutations.py) to be fully async, avoiding `asyncio.run()` event loop conflicts. - **Structured Resume parsing**: Updated [task_runner.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/task_runner.py) to natively parse structured `"input"` and `"selected"` reply schemas on task resumption. ### bees runner & backend - **Pre-hydration Support**: Updated `GeminiRunner.run()` in [gemini.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/bees/runners/gemini.py) to pre-hydrate disk workspace files directly from pre-seeded interaction snap states. - **Backend State Bugfix**: Fixed a latent NameError inside [run.py](file:///Users/dglazkov/Documents/code/breadboard/packages/opal-backend/opal_backend/run.py) on starting from loaded interaction states by strictly resolving `resolved_flags`. ### Hivetool UI - **Lineage Routing & highlights**: Unified log-detail session resolution to resolve parent ticket IDs correctly. Added `⏪ Rewind` button and confirmation prompts next to turns. - **Structured UI submissions**: Updated [chat-panel.ts](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/hivetool/src/ui/chat-panel.ts) to submit fully standardized structured payloads (`input.parts` / `selected.ids`) to align with Opal and prevent schema mismatches. - **Tab switching lock fix**: Fixed a tab auto-switching loop bug inside [ticket-pane.ts](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/hivetool/src/ui/ticket-pane.ts) using active task chat detection. ## Testing - Verified via **47 unit tests** in [test_mutations.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/tests/test_mutations.py) and [test_gemini_runner.py](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/tests/test_runners/test_gemini_runner.py). All tests are 100% green. - Manually verified linear fork chains and timeline re-generation inside Hivetool.
## What Eliminates the legacy session dual-identity in Hivetool. It refactors the data layer to scan task-level persistent session stores directly instead of legacy log directories, groups session runs cleanly by tasks, and updates the UI to display and route using actual session UUIDs. ## Why Aligns Hivetool's logs visualization with the persistent session store architecture introduced in Project Rewind, guaranteeing a unified, clean, and reliable developer inspection environment. ## Changes ### Hivetool Data Layer - **`LogStore` (log-store.ts)**: Transitioned directory scanning to `tickets/` task folders. Excluded `"coordination"` tasks from sidebar scans, grouped runs dynamically, and pruned legacy `.log.json` scanning. - **`Session Store Reader` (session-store-reader.ts)**: Updated `compileEventsToSegment()` to properly accumulate prompt, candidates, thoughts, and cached token metadata to restore calculation of the top-level `token-visual` bar. ### Hivetool UI Components - **`Sidebar` (log-list.ts)**: Redesigned task groups into standard borderless section headers with indented clickable session cards (`margin-left: 12px`) instead of boxed widgets. - **`Session Chip` (ticket-pane.ts)**: Updated task detail's `"session"` chip to use `ticket.active_session || ticket.id` for high-fidelity UUID display and deep-linking. - **`Task Chip` (log-detail.ts)**: Reworked parent `"task"` chip in session details to link and route utilizing the resolved `ticketId` instead of `sessionId`. - **`Interaction Panel` (log-detail.ts & log-detail.styles.ts)**: Substituted raw inline styles on the Active Interaction Snapshot block with structured CSS classes matching the dark-mode theme, with `flex-shrink: 0` to prevent vertical layout collapse. - **`File Tag` (log-detail.ts)**: Redesigned the `.turn-header-fs` tag as a borderless, subtle inline tag matching the TURN label's `#475569` gray, with proper pluralization logic. ## Testing - Verified build compilation succeeds with 157 modules compiled via `npm run build` in `packages/bees/hivetool`. - Verified ESLint standards are 100% met with **0 errors** via `npm run lint` in `packages/bees/hivetool`.
## What Polished and finalized the developer user experience for the session rollback (rewind) capability in Hivetool. Created a native HTML5 `<dialog>` overlay primitive, overhauled the session lineage tree view, highlighted cloned/inherited turn sequences, and added auto-navigation focus. ## Why Session rollbacks must feel visually outstanding, extremely fluid, and highly responsive. Native accessible modal overlays, chronological timeline tracks, and distinct styling of inherited turns prevent main-thread freezing, minimize confusion, and provide clear historical context. ## Changes ### `packages/bees/hivetool` - **`<bees-confirm-dialog>` Primitive [NEW]**: Created an accessible native HTML5 `<dialog>` component in `src/ui/primitives/confirm-dialog.ts` utilizing the `showModal()` / `close()` APIs to support native Escape-to-dismiss and backdrop-blur styling. - **Session Lineage [Modified]**: Refactored `src/ui/session-lineage.ts` to sort lineage chronologically, render vertical timeline tracks with circular node points, display curated status badges (HSL and inline SVGs), and highlight the selected session card with a sapphire glow. - **Log Timeline & Auto-Navigation [Modified]**: Updated `src/ui/log-detail.ts` and `src/ui/log-detail.styles.ts` to wire the confirm dialog modal, identify and badge inherited turns as `🧬 Cloned` with dashed cards, and implement Signal-backed auto-navigation to the new active session. ## Testing - Run `npm run test` across the monorepo to verify typescript compilations and unit tests. - Proved manual end-to-end rollback and timeline auto-focus under local execution (`npm run dev:box`).
## What Adds support for in-place, immutable session forking from any historical session (active or superseded) at any turn boundary in Hivetool. ## Why Allows users to explore alternative pathways from any point in the session lineage tree while perfectly preserving the historical trails of abandoned runs. ## Changes ### Backend Swarm Orchestration - **`packages/bees/bees/mutations.py`**: Extend the `rollback-to-turn` mutation handler to support an optional `session_id` payload field. Uses this target session as the source of clone files and checkpoints, while marking the currently running active session (if any) as `"superseded"`. - **`packages/bees/tests/test_mutations.py`**: Add `test_rollback_fork_superseded_session` to verify that forking a superseded session establishes correct lineage records, preserves the old status of parent/active sessions, and hydrates the disk workspace from the target checkpoint. ### Hivetool Front-end - **`packages/bees/hivetool/src/data/mutation-client.ts`**: Extend the client `rollbackToTurn` method to accept and transmit the target `sessionId`. - **`packages/bees/hivetool/src/ui/log-detail.ts`**: Rework `canRollback` to show the `⏪ Rewind` button next to any historical session's turns as long as the parent task is `"suspended"`. Update `executeRollback` to pass the inspected `activeSessionId` on click. ## Testing - **Backend**: Verified with Python pytest runner (`.venv/bin/python -m pytest tests/test_mutations.py`). All 34 tests pass. - **Frontend**: Verified compilation using the TypeScript compiler compiler (`npx tsc --noEmit`) inside `packages/bees/hivetool` with zero warnings or errors.
## What Transforms the Bees agent framework from a Closed World model to an Open World model by allowing agents to dynamically author and execute specialized, workspace-scoped sub-agent templates. Also includes an atomic turn-settlement context buffering and auto-resume architecture, dynamic OPFS scans, and visual streamlining in Hivetool. ## Why Enables the agent swarm to autonomously specialize and delegate work at runtime while maintaining strict security boundaries (gating parent-level bash tools) and eliminating timing race conditions under dynamic steering. ## Changes ### Python Backend - **provisioner.py**: Seeds legacy global templates as separate files under the ticket's workspace `templates/` directory on startup. - **playbook.py**: Implements merged template loading (`load_all_templates()`) prioritizing local workspace-scoped overrides over global definitions. - **functions/tasks.py**: Updates tasks listing/creation tools to distinguish and dynamically allow all workspace-scoped templates while securing global ones. - **disk_file_system.py**: Protects the `templates/` directory from being unlinked during turn resumption hydration wipes, ensuring dynamic definitions survive. - **scheduler.py**: Restricts mid-stream context updates to live streaming sessions, ensuring turn-based batch sessions buffer updates to preserve turn atomicity. - **task_runner.py**: Refactors `_handle_suspend` to immediately auto-resume suspended batch sessions if new context updates are buffered during turn execution. - **declarations/tasks.instruction.md**: Refines tasks instructions to teach agents that available task types are dynamic and must be listed before delegation. ### Hive Resources - **skills/create-task-type/SKILL.md**: Created a dynamic sub-agent authoring instructions skill for Gemini agents. ### Hivetool Lit Workbench - **template-store.ts**: Merges, writes, and deletes workspace-scoped templates reactively based on the active ticket ID. - **template-list.ts**: Streamlines the template selector card list layout by removing the workspace badge. - **template-detail.ts**: Adds a save-destination toggle to the creation form so templates can be isolatingly written to the active task workspace. - **chat-panel.ts**: Constrains the agent prompt panel to a scrollable `max-height: 300px` with thin scrollbars to prevent tall outputs from breaking input elements. ## Testing - Created `test_dynamic_templates.py` (covering seeding, overrides loading, allowed gating, child task creation). - Added a new test in `test_scheduler.py` verifying turn-level context buffering and auto-resumption. - Ran all 24 templates/scheduler pytest cases successfully (100% green). - Confirmed Lit workbench type safety (`tsc --noEmit`), ESLint clean checks (`npm run lint`), and successful production compilation (`npm run build`).
## What Repurposed the Hivetool timeline segment compiler to parse incoming user turns, tool execution responses, and background context updates directly from the stateless `sendRequest.body.contents` history array. ## Why In Hivetool, user turns, tool responses, and context updates were not rendering in the timeline. The frontend parser was expecting a legacy top-level `functionResponse` event which is no longer logged. Unsolicited background context updates are injected directly into the model's context history without distinct standalone trace events in `events.jsonl`. Extracting these turns from `sendRequest` history provides the absolute, high-fidelity reality of what resumed each turn with zero risk of timeline drift. ## Changes - **[session-store-reader.ts](file:///Users/dglazkov/Documents/code/breadboard/packages/bees/hivetool/src/data/session-store-reader.ts):** - Modified `compileEventsToSegment` to extract the incoming user turn (resume turn) from the last element of `sendRequest.body.contents`. - Correctly maps raw text and `functionResponse` parts into structured `LogPart` objects for rendering. - Removed dead top-level `"functionResponse"` event listener. - Imported `LogPart` and `LogTurn` types to restore compilation clean status. ## Testing - Verified TypeScript compilation builds cleanly with zero errors or warnings using `npx tsc` in `packages/bees/hivetool`. - Manual verification via visual timeline rendering in the browser Hivetool UI.
## What Refactored the agent workbench asset shelf to integrate NotebookLM and Webcam Video, restricted the `@` fast access menu to assets-only inside the prompt editor, unified icon resolution with a shared MIME-to-Symbol utility, and polished chiclet and modal backdrop aesthetics. ## Why Implements seamless addition and referencing of specialized assets (NotebookLM, Youtube, Webcam Video) with accurate metadata encoding at the source, preventing broken icon ligatures and visual overlaps in menus and prompt chiclets. ## Changes ### Agent Workbench & Prompt Editor * **Assets-Only @ Menu**: Added a `"browse-assets"` mode to [FastAccessController](file:///Users/paullewis/Projects/breadboard/packages/visual-editor/src/sca/controller/subcontrollers/editor/fast-access/fast-access-controller.ts) to restrict the prompt editor's `@` fast-access menu solely to assets. * **NotebookLM Integration**: Wired the "NotebookLM" add button directly to the NotebookLM picker action, allowing users to browse and pick notebooks, automatically adding them with `type: "content"` and `subType: "notebooklm"`. * **Backdrop Blur**: Enabled backdrop blur on the [NotebookLmPicker](file:///Users/paullewis/Projects/breadboard/packages/visual-editor/src/ui/elements/notebooklm-picker/notebooklm-picker.ts) modal. * **Alphabetical Shelf Sorting**: Cleaned up asset shelf rendering to sort all assets alphabetically. ### Icon and Metadata Hardening * **Shared Icon Utility**: Created a centralized `getAssetIcon` helper in [mime-type.ts](file:///Users/paullewis/Projects/breadboard/packages/visual-editor/src/utils/media/mime-type.ts) mapping MIME types to valid Material Symbols, including custom icon overrides. * **Clean Metadata Encoding**: Corrected YouTube and Webcam video assets to be created with clean, semantic metadata (`subType: "youtube"` and `"webcam-video"`) at the source inside [AddAssetModal](file:///Users/paullewis/Projects/breadboard/packages/visual-editor/src/ui/elements/input/add-asset/add-asset-modal.ts), rather than relying on brittle regex overrides. * **Icon Substitute Mappings**: Added `"notebooklm"` and `"webcam-video"` overrides to [icon-substitute.ts](file:///Users/paullewis/Projects/breadboard/packages/visual-editor/src/ui/utils/icon-substitute.ts). * **Render overlap prevention**: Blocked text ligature rendering in [fast-access-menu.ts](file:///Users/paullewis/Projects/breadboard/packages/visual-editor/src/ui/elements/fast-access-menu/fast-access-menu.ts) for `"notebooklm"` to let only the custom SVG logo render. ### Styling & Aesthetics * **Terracotta Theme**: Updated [chiclet.ts](file:///Users/paullewis/Projects/breadboard/packages/visual-editor/src/ui/styles/chiclet.ts) to render asset chiclets in the prompt editor with the premium, strong terracotta background (`var(--ui-asset)`). ## Testing * All `FastAccessController` unit tests have been updated and pass successfully. * Verified compilation with `npm run build:tsc`.
## What Robustly fixes cursor positioning, drag-and-drop, and selection bugs in TextEditorRemix by introducing a DOM-to-model segmentHint to resolve offset ambiguity at adjacent chiclet boundaries, implementing a structured chiclet move routine, and safeguarding cursor placement around trailing newlines and ZWNBSP zones. ## Why Adjacent chiclets stack at the same visible character offset, causing selection and cursor mapping to become highly ambiguous. Offset-based deletion and insertion suffered from zero-width end-drag failures, drag-target offset shifts, and incorrect chiclet collisions. Contenteditable trailing newlines were also swallowed by browsers. ## Changes - **Model (EditorModel):** - Threaded segmentHint through insertChicletAtOffset and deleteAtOffset to bypass offset-based scanning and perform mutations on the exact target text segment. - Implemented moveChicletToSegmentOffset to handle index shifts, merge text segments, adjust offsets for index-based mutations, and redirect drops that land inside a chiclet's DOM. - Enforced the alternating segments invariant (text-chiclet-text) in _mergeAdjacentText by inserting empty text segments between contiguous chiclets. - Added trailing newline sentinel rendering in toRenderSegments to prevent contenteditable from swallowing trailing blank lines. - Added shouldPlaceCursorAfterChiclet to precisely determine whether a cursor offset lands before or after a chiclet boundary based on its segment context. - **Selection (EditorSelection):** - Added domPositionToModelPosition to map DOM position ranges directly into model coordinates (segment index and local offset). - Exposed setCursorAt and modified setCursorAtCharOffset to clamp selection offsets to the character before a trailing ZWNBSP sentinel when afterChiclet is false. - **Editor (TextEditorRemix):** - Computed and threaded segmentHint through addition, deletion, and cursor sync pathways. - Rewrote the drag-and-drop pointer handler to use relative X coordinate comparison to chiclet center for left/right redirection when dragging over another chiclet, and utilized moveChicletToSegmentOffset for robust model mutation. ## Testing - Added unit tests in editor-model.test.ts covering: - Regression case for sequential backspacing on spaces adjacent to chiclets. - Penultimate chiclet movement to trailing text segments (resolving the zero-width end drag bug). - Target redirection when dropping directly onto a chiclet's DOM. - Offset adjustments for preceding/succeeding segment moves. - Added unit tests in editor-selection.test.ts verifying safe ZWNBSP-clamped cursor placement.
… State (#8711) ## What Centralized the action and sign-out event handling from the visual editor's main header to the root component so they can be driven seamlessly from both the classic header and the agent workbench. Additionally, customized the workbench menu options and introduced a clean, minimal horizontal empty state in the asset list. ## Why Previously, dropdown behaviors (three-dot menu, settings cog, user account switch) were attached to the main header component. When the agent workbench was active, the main header was hidden, making it impossible to perform these actions from the workbench's menus. Centralizing them ensures uniform behavior across both layouts, while the new empty state improves the workbench UX when no assets are present. ## Changes - **Visual Editor Core (`packages/visual-editor/src`)**: - Added `HeaderActionEvent` in `packages/visual-editor/src/ui/events/events.ts` to bubble selected dropdown action values. - In `packages/visual-editor/src/index.ts`, registered global listeners on the root container for `@bbheaderaction` and `@bbsignout`, and moved the action switch block to a centralized `handleHeaderAction` method. - Handled transition from active workbench to classic view when "history" is chosen. - Updated `packages/visual-editor/src/ui/elements/shell/header.ts` and `packages/visual-editor/src/ui/elements/agent-workbench/agent-config-column.ts` to dispatch the new `HeaderActionEvent` from their respective dropdowns, and removed the "show version history" option from the workbench's three-dot menu. - Added a clean, compact, horizontal empty state (`.empty-state`) with an `attach_file_off` icon in `packages/visual-editor/src/ui/elements/agent-workbench/asset-shelf/asset-shelf.ts` when there are no assets in the graph. - Added the `attach_file_off` symbol in `packages/visual-editor/index.html`. ## Testing - **Manual Verification**: Launch the visual editor, activate the agent workbench, and verify that the three-dot menu options, settings cog options, and logout action function identically to the classic header. - **Compilation**: Succeeded with `npm run build`.
## What
Added abort-signal awareness to the main agent execution loop, ensuring
it cleanly and immediately terminates when a run is stopped or reloaded.
## Why
When a run was stopped (e.g., via the "Reload" button), the underlying
streaming/fetching was aborted. Because the agent loop was unaware of
the abort signal and the aborted stream returned an empty response, the
loop continuously and instantly retried, resulting in a tight
synchronous busy loop consuming 100% CPU.
## Changes
### `visual-editor`
- **`packages/visual-editor/src/a2/agent/loop.ts`**:
- Updated the main agent `while` loop condition to check
`!moduleArgs.context.signal?.aborted`.
- Added clean termination checks in both the end of the `run` method and
the `catch` block to return `err("Run was stopped")` upon abort.
- **`packages/visual-editor/tests/a2/agent/loop.test.ts`**:
- Added a new suite of integration tests verifying that the agent `Loop`
cleanly aborts and returns the expected stop outcome when the runner's
`AbortSignal` is triggered.
## Testing
- Verified with the new unit test suite:
```bash
npm run test:file -w packages/visual-editor --
'./dist/tsc/tests/a2/agent/loop.test.js'
```
- Ran all existing `visual-editor` tests to ensure no regressions:
```bash
npm run test -w packages/visual-editor
```
- Ran package-level and root-level linters to ensure clean formatting
and style:
```bash
npm run lint
```
Updates generateOpalStream, editOpalStream, and rewritePromptOpalStream to conditionally use OpalBackendClient based on the value of ENABLE_BACKEND_CLIENT
## Functional Changes 1. Show a cookie consent bar that allow users to opt-in to using non-essential cookies (like Google Analytics) in regions that require manual opt-ins. 1. For these regions show a `Manage cookies` button to change the preference later. 1. Show informational consent bar in regions that require an informational bar to be shown without an ability to opt-out of non-essential cookies. 1. Don't show the cookie bar in regions that don't require any consent bar to be shown. 1. Appropriate translations for legal disclaimers. ## Changes 1. Using Glue notification bar library which handles all functional requirements. 1. Translations <img width="3456" height="502" alt="image" src="https://github.com/user-attachments/assets/0184d99e-8596-445b-add8-a642a7477297" /> 1. Cookie bar is placed in the host shell and `Manage cookies` button is placed in the landing page (for the unsigned in state) and the visual editor global settings dialog (for the signed in state). 1. Using comlink to progagate show/hide and onclick events for the `Manage cookies` buttons. 1. Handling race conditions stemming from how the notification bar library is loaded and the iframe interactions --------- Co-authored-by: Ramone Karodia <rkarodia@users.noreply.github.com>
Includes createCachedContent, singletonPrefixCache, and executeStep
## What When the agent workbench preview is open, the app-internal header (hamburger, progress bar, replay) is now suppressed entirely. The workbench header absorbs restart and close controls, eliminating redundant items. ## Why The preview previously rendered its own `bb-app-header` with hamburger menu, progress bar, and replay button — controls that are useful in the standalone consumer app view but redundant in the authoring preview where the workbench header already provides administrative actions. This change reduces visual noise and consolidates controls into a single, consistent header bar. ## Changes ### SCA layer - **`workbench-controller.ts`** — Add `showPreview` field (session-persisted) to track preview visibility. - **`workbench-actions.ts`** — Add `togglePreview` action that sets or toggles `showPreview`. - **`workbench-actions.test.ts`** — Tests for toggle and explicit-set behaviors. ### App template - **`app-templates/basic/index.ts`** — `#renderControls()` now returns `nothing` when all `headerConfig` controls are off (`!replay && !menu && !fullscreen`), hiding the app header entirely instead of rendering an empty bar. Lite mode is unaffected (always has `fullscreen` set). ### Workbench UI (`agent-config-column.ts`) - **Preview mode header** — When preview is open: - Left side: close button (dark circle, white ×) + "Restart app" pill (icon + label, no outline). - Right side: Publish, Share, overflow menu, settings cog, user avatar (unchanged). - Left-side experiment badge and save status are hidden. - Preview button is hidden (replaced by close). - **App header suppressed** — `bb-app-controller` receives an all-off `headerConfig` so the app template renders no header chrome. - **Theme-aware hover** — `bb-item-select` (overflow menu, settings cog) hover colors use a concrete resolved value from `themeStyles['--s-95']` to bypass `baseColors` shadowing the token inside `bb-item-select`'s shadow DOM. The restart button uses `var(--s-95)` directly (no shadow DOM boundary). - **Preview container** — Wraps `bb-app-controller` in a flex container that fills the remaining column height. ## Testing - `npm run test:file -- './dist/tsc/tests/sca/actions/workbench/*.js'` — new tests pass. - Visual: open an agent in the workbench → click Preview → verify the app header (hamburger, progress bar, replay) is gone, close (×) and "Restart app" appear on the left, and hovering the overflow/cog menus shows the themed tint (not gray).
…gle Drive (#8719) ## What Refactored the asset shelf, the details modal, and the chat panel's input shelf to present NotebookLM and Google Drive assets consistently, utilizing premium SVG iconography and preventing invalid file replacements. ## Why Improves visual and functional polish of the agent workbench by ensuring NotebookLM displays its logo everywhere rather than falling back to standard icons, and locks Google Drive assets to prevent users from attempting invalid file replacement workflows. ## Changes ### packages/visual-editor * **Asset Shelf Thumbnail** * Updated the asset thumbnail renderer to match the `"notebooklm"` subType alongside `NOTEBOOKLM_MIMETYPE` so that the custom NotebookLM logo displays in the workbench asset list. * **Asset Shelf Core** * Fixed `#getAssetType` to correctly identify NotebookLM assets as `"notebooklm"` instead of defaulting them to `"upload"`. * **Add Asset Modal** * Updated the add-asset modal to import and render the `notebookLmIcon` SVG inside the preview card. * Removed the file picker/replacement fields for Google Drive assets when editing them. * Added a custom CSS selector to scale the NotebookLM SVG logo to 36px in the details preview card. * Handled title-only saves in `#processAndEmit` for Google Drive and NotebookLM assets to bypass file input checks. * **Chat Panel Input Asset Shelf** * Aligned the chat panel's input asset shelf to map NotebookLM assets to `"notebooklm"` and render the premium NotebookLM logo instead of the generic book icon. ## Testing * Verified that TypeScript type-checks and Vite compilation passed without warnings. * Ran the visual-editor test suite and verified that all tests passed successfully.
This particular path is not controlled by the ENABLE_BACKEND_CLIENT flag because it is only enabled in dev and experimental environments, so the additional safety of flag-gated migration is not necessary
## What
Implements read-only graph visual and functional safeguards in the Agent
Workbench. When viewing a read-only Opal, users are prevented from
modifying configuration, name, assets, or tools, and the "Publish"
button is replaced by a "Remix" action. Also adds a pending state in the
asset shelf when adding new assets.
## Why
Allows users to view and interact (chat) with shared, read-only agents
without accidentally modifying their configuration, while providing a
premium, native "Remix" flow.
## Changes
### packages/visual-editor
#### SCA Actions
* **board-actions.ts**: Added a `readOnly` check in the `onRename`
action to prevent renaming of read-only graphs.
* **workbench-actions.ts**: Guarded `applyPromptToGraph`,
`applyObjective`, and `toggleTool` with `readOnly` checks to reject
mutations early.
#### UI Components
* **agent-config-column.ts**:
* Set `contenteditable="false"` on the agent title heading `<h1>` and
styled it appropriately when read-only.
* Passed the `readOnly` status to `<bb-text-editor-remix>` and disabled
its fast access utility.
* Swapped the `Publish` button for a `Remix` button that triggers the
standard clone-and-navigate remix flow.
* Unified the `Share` button style to always use the owner (black fill)
presentation.
* **asset-shelf.ts**:
* Added a `_pendingAssets` state array. Prepended pending items at the
top of the shelf list with a spinning loading indicator and reduced
opacity style.
* Integrated the pending state transition into the NotebookLM and normal
asset upload flows.
* Hidden the "Add asset" button, individual drag handles, and remove
buttons on read-only graphs. Show a custom "This agent has no assets."
message for empty states.
* **tool-shelf.ts**: Disabled toggle switches and added a visual
`.disabled` opacity styling when read-only.
### projects/workbench
* **PROJECT.md**: Checked off and completed Phase 5 ("Read-Only
Graphs").
## Testing
1. Open a shared or read-only graph in the Agent Workbench.
2. Verify that Opie remains interactive in the left column.
3. Verify that the agent name is static text, the instructions editor is
read-only, and the asset shelf has no controls or drag handles.
4. Verify that tool toggles are visually disabled and non-interactive.
5. Verify that the "Remix" button is visible instead of "Publish", and
clicking it clones the graph.
6. Trigger an asset addition (e.g. upload an image or select a
NotebookLM) and verify that a pending row appears instantly at the top
of the asset shelf with a spinning loader, before being replaced by the
loaded asset.
Adds a deprecation notice to the README ahead of the November 17, 2026 sunset. It points folks to the Opal FAQ for details.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )