notebook: Wire daemon kernel execution to frontend#259
Merged
Conversation
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)
c94d80d to
9727330
Compare
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)
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.
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 introducesdaemon_execution: boolsetting 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
PR submitted by @rgbkrk's agent, Quill