Skip to content
Draft
3 changes: 2 additions & 1 deletion build/esbuild/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ const commonExternals = [
const webExternals = [
...commonExternals,
'canvas', // Native module used by vega for server-side rendering, not needed in browser
'mathjax-electron' // Uses Node.js path module, MathJax rendering handled differently in browser
'mathjax-electron', // Uses Node.js path module, MathJax rendering handled differently in browser
'@deepnote/runtime-core' // Uses tcp-port-used → net, only needed in desktop for agent block execution
];
const desktopExternals = [...commonExternals, ...deskTopNodeModulesToExternalize];
const bundleConfig = getBundleConfiguration();
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,16 @@
"title": "%deepnote.command.manageAccessToKernels%",
"category": "Jupyter"
},
{
"command": "deepnote.setOpenAiApiKey",
"title": "%deepnote.command.setOpenAiApiKey%",
"category": "Deepnote"
},
{
"command": "deepnote.clearOpenAiApiKey",
"title": "%deepnote.command.clearOpenAiApiKey%",
"category": "Deepnote"
},
{
"command": "dataScience.ClearUserProviderJupyterServerCache",
"title": "%deepnote.command.dataScience.clearUserProviderJupyterServerCache.title%",
Expand Down
2 changes: 2 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
"deepnote.command.deepnote.openOutlineView.title": "Show Table Of Contents (Outline View)",
"deepnote.command.deepnote.openOutlineView.shorttitle": "Outline",
"deepnote.command.manageAccessToKernels": "Manage Access To Jupyter Kernels",
"deepnote.command.setOpenAiApiKey": "Set OpenAI API Key",
"deepnote.command.clearOpenAiApiKey": "Clear OpenAI API Key",
"deepnote.commandPalette.deepnote.replayPylanceLog.title": "Replay Pylance Log",
"deepnote.notebookRenderer.IPyWidget.displayName": "Jupyter IPyWidget Renderer",
"deepnote.notebookRenderer.Error.displayName": "Jupyter Error Renderer",
Expand Down
26 changes: 20 additions & 6 deletions src/notebooks/controllers/vscodeNotebookController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import { RemoteKernelReconnectBusyIndicator } from './remoteKernelReconnectBusyI
import { IConnectionDisplayData, IConnectionDisplayDataProvider, IVSCodeNotebookController } from './types';
import { notebookPathToDeepnoteProjectFilePath } from '../../platform/deepnote/deepnoteProjectUtils';
import { DEEPNOTE_NOTEBOOK_TYPE, IDeepnoteKernelAutoSelector } from '../../kernels/deepnote/types';
import { executeAgentCell, isAgentCell } from '../deepnote/agentCellExecutionHandler';

/**
* Our implementation of the VSCode Notebook Controller. Called by VS code to execute cells in a notebook. Also displayed
Expand Down Expand Up @@ -626,16 +627,29 @@ export class VSCodeNotebookController implements Disposable, IVSCodeNotebookCont
// Start execution now (from the user's point of view)
// Creating these execution objects marks the cell as queued for execution (vscode will update cell UI).
type CellExec = { cell: NotebookCell; exec: NotebookCellExecution };
const cellExecs: CellExec[] = (this.cellQueue.get(doc) || []).map((cell) => {
const exec = this.createCellExecutionIfNecessary(cell, new KernelController(this.controller));
return { cell, exec };
});
const allCells = this.cellQueue.get(doc) || [];
this.cellQueue.delete(doc);
const firstCell = cellExecs.length ? cellExecs[0].cell : undefined;
if (!firstCell) {

const agentCells = allCells.filter((cell) => isAgentCell(cell));
const kernelCells = allCells.filter((cell) => !isAgentCell(cell));

// Execute agent cells directly without kernel involvement
if (agentCells.length > 0) {
logger.trace(`Executing ${agentCells.length} agent cell(s) for ${getDisplayPath(doc.uri)} without kernel`);
await Promise.all(agentCells.map((cell) => executeAgentCell(cell, this.controller))).catch(noop);
}

if (kernelCells.length === 0) {
return;
}

const cellExecs: CellExec[] = kernelCells.map((cell) => {
const exec = this.createCellExecutionIfNecessary(cell, new KernelController(this.controller));
return { cell, exec };
});

const firstCell = cellExecs[0].cell;

logger.trace(`Execute Notebook ${getDisplayPath(doc.uri)}. Step 1`);

// Connect to a matching kernel if possible (but user may pick a different one)
Expand Down
Loading