Skip to content

notebook: Wire daemon kernel execution to frontend#259

Merged
rgbkrk merged 9 commits intomainfrom
wire-daemon-execution
Feb 25, 2026
Merged

notebook: Wire daemon kernel execution to frontend#259
rgbkrk merged 9 commits intomainfrom
wire-daemon-execution

Conversation

@rgbkrk
Copy link
Copy Markdown
Member

@rgbkrk rgbkrk commented Feb 24, 2026

Summary

Add frontend-side infrastructure to wire daemon-owned kernel execution (Phase 8) with feature flag. Exposes daemon kernel operations (launch, queue cell, clear outputs, interrupt, shutdown) as Tauri commands, adds corresponding React hook useDaemonKernel, and introduces daemon_execution: bool setting to toggle between local and daemon-owned execution modes. Includes typed frames protocol for request/response communication over the notebook sync connection. See design in .context/stabilization-notes.md for Phase 8 architecture.

Verification

  • Launch kernel via daemon and verify outputs appear in cell
  • Queue multiple cells and verify serial execution
  • Interrupt during execution
  • Open same notebook in two windows, execute in one, verify output broadcasts to both (with daemon_execution enabled)
  • Toggle daemon_execution setting and verify fallback to local kernel works
  • Verify regular notebook execution unaffected (daemon_execution: false by default)

PR submitted by @rgbkrk's agent, Quill

@rgbkrk rgbkrk marked this pull request as draft February 25, 2026 00:38
Extends the notebook sync client to support request/response patterns:
- Add NotebookBroadcastReceiver for kernel events from daemon
- Add send_request() method with typed frames
- Add recv_frame_any() for handling all frame types
- Forward broadcasts to frontend via daemon:broadcast event

New Tauri commands for daemon-owned execution:
- launch_kernel_via_daemon
- queue_cell_via_daemon
- clear_outputs_via_daemon
- interrupt_via_daemon
- shutdown_kernel_via_daemon
- get_daemon_kernel_info
- get_daemon_queue_state

This is Step 4 of the daemon-owned kernel execution plan.
Frontend hooks (Step 5) still need to be updated to use these.
New frontend components for daemon-owned kernel execution:

types.ts:
- DaemonBroadcast: Types for kernel status, outputs, queue changes, errors
- DaemonNotebookResponse: Types for daemon request responses

useDaemonKernel.ts:
- Hook for daemon kernel operations
- Listens for daemon:broadcast events
- Provides launchKernel, queueCell, clearOutputs, interruptKernel, shutdownKernel
- Tracks kernel status, queue state, and kernel info
- Parses output JSON from broadcasts and calls onOutput callback

This hook is separate from useKernel (local execution) to allow
gradual migration. Apps can choose which execution mode to use.
New setting to enable/disable daemon-owned kernel execution:

Backend (settings_doc.rs, sync_client.rs):
- Add daemon_execution: bool to SyncedSettings struct
- Add get_bool/put_bool methods to SettingsDoc
- Handle boolean values in put_value for Tauri commands

Frontend (useSyncedSettings.ts):
- Add daemonExecution state and setDaemonExecution callback
- Sync across windows via settings:changed event

The setting defaults to false. When enabled (in a future PR),
the app will use useDaemonKernel instead of useKernel.
…update_display_data

- Fix High #1: Normalize daemon output from JupyterMessageContent to nbformat shape
- Fix High #2: Add daemon_execution to save_setting_locally for local persistence
- Fix Medium #3: Add daemon_execution to from_json and apply_json_changes for migration
- Fix Medium #4: Add onUpdateDisplayData callback for update_display_data handling
- Fix Low #5: Remove verbose broadcast logging (keep only error logs)
@rgbkrk rgbkrk force-pushed the wire-daemon-execution branch from c94d80d to 9727330 Compare February 25, 2026 01:24
When daemon_execution setting is enabled:
- Use useDaemonKernel hook for kernel operations
- Launch kernel via daemon instead of local ensureKernelStarted
- Queue cells via daemon with cell source
- Route outputs through daemon broadcasts

The switch allows testing daemon-owned kernel execution while
keeping local execution as the stable default.
The daemon returns NoKernel when QueueCell is called without a running
kernel, dropping the request. Fix by ensuring kernel is launched first,
then queueing cells after it's ready.
- Bump version from 0.1.0-dev.2 to 0.1.0-dev.3
- cargo xtask build now uses debug mode for runtimed/runt-cli (~50s faster)
- cargo xtask build-dmg/build-app still use release mode for distribution
- cargo xtask install-daemon unchanged (always release for perf)
@rgbkrk rgbkrk marked this pull request as ready for review February 25, 2026 01:57
@rgbkrk rgbkrk enabled auto-merge (squash) February 25, 2026 02:22
@rgbkrk rgbkrk disabled auto-merge February 25, 2026 02:22
@rgbkrk rgbkrk merged commit 14dd283 into main Feb 25, 2026
4 of 5 checks passed
@rgbkrk rgbkrk deleted the wire-daemon-execution branch February 25, 2026 02:22
@rgbkrk rgbkrk added quill PR authored by Quill Agent 🦆 daemon runtimed daemon, kernel management, sync server frontend Webview, React, TypeScript UI labels Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

daemon runtimed daemon, kernel management, sync server frontend Webview, React, TypeScript UI quill PR authored by Quill Agent 🦆

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant