xtralab 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -30
- package/lib/about/icons.d.ts +0 -5
- package/lib/about/icons.js +0 -5
- package/lib/about/index.d.ts +4 -8
- package/lib/about/index.js +6 -17
- package/lib/agentSessions.d.ts +9 -29
- package/lib/agentSessions.js +2 -7
- package/lib/askAgent/editorSelection.d.ts +20 -26
- package/lib/askAgent/editorSelection.js +11 -26
- package/lib/askAgent/icons.d.ts +2 -3
- package/lib/askAgent/icons.js +2 -3
- package/lib/askAgent/index.d.ts +4 -26
- package/lib/askAgent/index.js +54 -158
- package/lib/askAgent/popup.d.ts +12 -16
- package/lib/askAgent/popup.js +18 -37
- package/lib/askAgent/prompt.d.ts +3 -5
- package/lib/askAgent/prompt.js +6 -19
- package/lib/askAgent/queue.d.ts +11 -21
- package/lib/askAgent/queue.js +9 -19
- package/lib/askAgent/queuePanel.d.ts +13 -18
- package/lib/askAgent/queuePanel.js +15 -37
- package/lib/askAgent/targetPicker.d.ts +2 -9
- package/lib/askAgent/targetPicker.js +6 -11
- package/lib/askAgent/tokens.d.ts +32 -46
- package/lib/askAgent/tokens.js +4 -6
- package/lib/commandBar/index.d.ts +4 -13
- package/lib/commandBar/index.js +21 -39
- package/lib/customPanel/index.js +15 -0
- package/lib/editorBreadcrumbs/index.d.ts +3 -6
- package/lib/editorBreadcrumbs/index.js +10 -6
- package/lib/editorBreadcrumbs/widget.d.ts +17 -4
- package/lib/editorBreadcrumbs/widget.js +11 -17
- package/lib/editorIndent/index.d.ts +4 -12
- package/lib/editorIndent/index.js +8 -23
- package/lib/fileBrowser/commands.d.ts +29 -19
- package/lib/fileBrowser/commands.js +83 -97
- package/lib/fileBrowser/contents.d.ts +3 -0
- package/lib/fileBrowser/dragAndDrop.d.ts +17 -4
- package/lib/fileBrowser/dragAndDrop.js +2 -7
- package/lib/fileBrowser/fileBrowser.d.ts +19 -9
- package/lib/fileBrowser/fileBrowser.js +70 -222
- package/lib/fileBrowser/gitStatus.d.ts +16 -10
- package/lib/fileBrowser/gitStatus.js +31 -30
- package/lib/fileBrowser/gitignore.d.ts +4 -17
- package/lib/fileBrowser/gitignore.js +4 -25
- package/lib/fileBrowser/icons.d.ts +7 -17
- package/lib/fileBrowser/icons.js +25 -80
- package/lib/fileBrowser/index.js +2 -4
- package/lib/fileBrowser/widget.d.ts +141 -48
- package/lib/fileBrowser/widget.js +102 -4
- package/lib/fileTypeIcons/index.js +0 -10
- package/lib/git/api.d.ts +5 -13
- package/lib/git/api.js +10 -36
- package/lib/git/askRequest.d.ts +4 -8
- package/lib/git/askRequest.js +6 -20
- package/lib/git/commands.d.ts +45 -5
- package/lib/git/commands.js +20 -13
- package/lib/git/diffModel.js +4 -0
- package/lib/git/diffPreferences.d.ts +90 -0
- package/lib/git/diffPreferences.js +107 -0
- package/lib/git/diffProvider.js +10 -2
- package/lib/git/diffSurface.d.ts +64 -63
- package/lib/git/diffSurface.js +72 -213
- package/lib/git/diffTheme.d.ts +7 -0
- package/lib/git/diffTheme.js +23 -0
- package/lib/git/diffWidget.d.ts +70 -14
- package/lib/git/diffWidget.js +100 -94
- package/lib/git/imageDiff.d.ts +14 -6
- package/lib/git/imageDiff.js +19 -75
- package/lib/git/index.d.ts +0 -3
- package/lib/git/index.js +44 -10
- package/lib/git/notebookDiff.d.ts +110 -33
- package/lib/git/notebookDiff.js +55 -197
- package/lib/git/tokens.d.ts +73 -31
- package/lib/git/tokens.js +2 -3
- package/lib/highlight/index.d.ts +4 -10
- package/lib/highlight/index.js +10 -41
- package/lib/index.d.ts +0 -9
- package/lib/index.js +0 -9
- package/lib/launcher/agents.d.ts +55 -51
- package/lib/launcher/agents.js +15 -57
- package/lib/launcher/availability.d.ts +3 -9
- package/lib/launcher/availability.js +3 -9
- package/lib/launcher/commands.d.ts +7 -32
- package/lib/launcher/commands.js +14 -45
- package/lib/launcher/dashboard.d.ts +19 -24
- package/lib/launcher/dashboard.js +21 -67
- package/lib/launcher/editorRegistry.d.ts +10 -22
- package/lib/launcher/editorRegistry.js +14 -18
- package/lib/launcher/editors.d.ts +39 -45
- package/lib/launcher/editors.js +8 -34
- package/lib/launcher/icons.d.ts +0 -12
- package/lib/launcher/icons.js +5 -39
- package/lib/launcher/index.js +12 -55
- package/lib/launcher/invocation.d.ts +4 -10
- package/lib/launcher/invocation.js +7 -22
- package/lib/launcher/registry.d.ts +9 -7
- package/lib/launcher/registry.js +9 -7
- package/lib/launcher/tokens.d.ts +10 -22
- package/lib/launcher/tokens.js +5 -8
- package/lib/menuBar/index.d.ts +3 -10
- package/lib/menuBar/index.js +11 -28
- package/lib/menus/index.d.ts +3 -9
- package/lib/menus/index.js +14 -30
- package/lib/omnibox/files.d.ts +2 -4
- package/lib/omnibox/files.js +5 -11
- package/lib/omnibox/index.d.ts +4 -14
- package/lib/omnibox/index.js +9 -27
- package/lib/omnibox/model.d.ts +38 -10
- package/lib/omnibox/model.js +15 -33
- package/lib/omnibox/recents.d.ts +15 -17
- package/lib/omnibox/recents.js +12 -17
- package/lib/omnibox/tokens.d.ts +5 -10
- package/lib/omnibox/tokens.js +2 -6
- package/lib/omnibox/widget.d.ts +11 -7
- package/lib/omnibox/widget.js +8 -16
- package/lib/searchReplace/index.d.ts +4 -20
- package/lib/searchReplace/index.js +7 -27
- package/lib/showOutput/index.d.ts +3 -12
- package/lib/showOutput/index.js +6 -22
- package/lib/sidebar/index.d.ts +4 -7
- package/lib/sidebar/index.js +5 -12
- package/lib/terminalNotifications/index.d.ts +4 -10
- package/lib/terminalNotifications/index.js +6 -20
- package/lib/terminals/agentTerminals.d.ts +12 -5
- package/lib/terminals/agentTerminals.js +25 -44
- package/lib/terminals/detection.d.ts +4 -8
- package/lib/terminals/detection.js +4 -8
- package/lib/terminals/index.d.ts +0 -35
- package/lib/terminals/index.js +12 -101
- package/lib/terminals/model.d.ts +64 -139
- package/lib/terminals/model.js +80 -220
- package/lib/terminals/tokens.d.ts +11 -22
- package/lib/terminals/tokens.js +2 -2
- package/lib/terminals/widget.d.ts +43 -13
- package/lib/terminals/widget.js +33 -18
- package/lib/topBar/icons.d.ts +3 -8
- package/lib/topBar/icons.js +3 -8
- package/lib/topBar/index.d.ts +4 -11
- package/lib/topBar/index.js +10 -38
- package/lib/walkthrough/index.d.ts +4 -9
- package/lib/walkthrough/index.js +6 -20
- package/lib/walkthrough/panel.d.ts +40 -9
- package/lib/walkthrough/panel.js +4 -10
- package/package.json +5 -3
- package/schema/git-diff-preferences.json +42 -0
- package/src/about/icons.ts +0 -5
- package/src/about/index.tsx +6 -17
- package/src/agentSessions.ts +9 -29
- package/src/askAgent/editorSelection.ts +22 -29
- package/src/askAgent/icons.ts +2 -3
- package/src/askAgent/index.ts +54 -158
- package/src/askAgent/popup.tsx +23 -45
- package/src/askAgent/prompt.ts +6 -19
- package/src/askAgent/queue.ts +13 -24
- package/src/askAgent/queuePanel.tsx +21 -46
- package/src/askAgent/targetPicker.tsx +5 -15
- package/src/askAgent/tokens.ts +32 -46
- package/src/commandBar/index.ts +24 -39
- package/src/customPanel/index.ts +15 -0
- package/src/editorBreadcrumbs/index.ts +10 -6
- package/src/editorBreadcrumbs/widget.ts +23 -17
- package/src/editorIndent/index.ts +17 -23
- package/src/fileBrowser/commands.ts +119 -96
- package/src/fileBrowser/contents.ts +3 -0
- package/src/fileBrowser/dragAndDrop.ts +17 -7
- package/src/fileBrowser/fileBrowser.tsx +86 -230
- package/src/fileBrowser/gitStatus.ts +36 -33
- package/src/fileBrowser/gitignore.ts +4 -25
- package/src/fileBrowser/icons.ts +25 -80
- package/src/fileBrowser/index.ts +2 -4
- package/src/fileBrowser/widget.tsx +171 -50
- package/src/fileTypeIcons/index.ts +0 -10
- package/src/git/api.ts +10 -36
- package/src/git/askRequest.ts +6 -20
- package/src/git/commands.ts +83 -11
- package/src/git/diffModel.ts +25 -0
- package/src/git/diffPreferences.ts +192 -0
- package/src/git/diffProvider.tsx +11 -2
- package/src/git/diffSurface.tsx +165 -286
- package/src/git/diffTheme.ts +24 -0
- package/src/git/diffWidget.tsx +194 -134
- package/src/git/imageDiff.tsx +56 -84
- package/src/git/index.ts +54 -10
- package/src/git/notebookDiff.tsx +214 -240
- package/src/git/tokens.ts +73 -31
- package/src/highlight/index.ts +10 -41
- package/src/index.ts +0 -9
- package/src/launcher/agents.ts +64 -95
- package/src/launcher/availability.ts +3 -9
- package/src/launcher/commands.ts +14 -51
- package/src/launcher/dashboard.tsx +49 -88
- package/src/launcher/editorRegistry.ts +21 -29
- package/src/launcher/editors.ts +39 -58
- package/src/launcher/icons.ts +5 -39
- package/src/launcher/index.ts +12 -55
- package/src/launcher/invocation.ts +7 -22
- package/src/launcher/registry.ts +9 -7
- package/src/launcher/tokens.ts +10 -22
- package/src/menuBar/index.ts +11 -28
- package/src/menus/index.ts +14 -30
- package/src/omnibox/files.ts +10 -14
- package/src/omnibox/index.ts +9 -27
- package/src/omnibox/model.ts +50 -38
- package/src/omnibox/recents.ts +17 -22
- package/src/omnibox/tokens.ts +5 -10
- package/src/omnibox/widget.tsx +14 -19
- package/src/searchReplace/index.ts +7 -27
- package/src/showOutput/index.ts +6 -22
- package/src/sidebar/index.ts +20 -12
- package/src/terminalNotifications/index.ts +42 -25
- package/src/terminals/agentTerminals.ts +25 -49
- package/src/terminals/detection.ts +4 -8
- package/src/terminals/index.ts +12 -101
- package/src/terminals/model.ts +130 -246
- package/src/terminals/tokens.ts +11 -22
- package/src/terminals/widget.tsx +48 -31
- package/src/topBar/icons.ts +3 -8
- package/src/topBar/index.ts +21 -44
- package/src/walkthrough/index.ts +6 -20
- package/src/walkthrough/panel.ts +40 -10
- package/style/about.css +2 -7
- package/style/askAgent.css +8 -40
- package/style/base.css +9 -45
- package/style/chrome.css +108 -308
- package/style/commandBar.css +4 -20
- package/style/customPanel.css +1 -4
- package/style/git.css +26 -186
- package/style/highlight.css +1 -3
- package/style/launcher.css +6 -70
- package/style/omnibox.css +2 -14
- package/style/showOutput.css +0 -6
- package/style/sidebar.css +29 -9
- package/style/tabs.css +5 -13
- package/style/terminals.css +6 -53
- package/style/topBar.css +2 -22
- package/style/walkthrough.css +0 -8
package/lib/launcher/icons.js
CHANGED
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
import { LabIcon } from '@jupyterlab/ui-components';
|
|
2
2
|
/**
|
|
3
|
-
* Brand icons for the
|
|
4
|
-
*
|
|
5
|
-
* (
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* reads as a multi-color Google mark. Pi's mark is the official `logo-auto.svg`
|
|
9
|
-
* from https://pi.dev (MIT, `earendil-works/pi`). Small adjustments are applied
|
|
10
|
-
* to play nicely with JupyterLab themes:
|
|
11
|
-
* - Monochrome marks (Codex, Copilot, Goose, Pi) use `currentColor` so they
|
|
12
|
-
* inherit the surrounding launcher card's text color rather than
|
|
13
|
-
* hard-coding black, which disappears on the dark theme. For Pi this
|
|
14
|
-
* replaces the upstream `prefers-color-scheme` style block, which follows
|
|
15
|
-
* the OS scheme rather than the active JupyterLab theme.
|
|
16
|
-
* - The Goose mark upstream is rendered on a white rounded rect; we drop
|
|
17
|
-
* the rect so the silhouette can sit on the launcher card directly.
|
|
18
|
-
* - SVG ids that would collide if two copies of the same artwork ended up
|
|
19
|
-
* on the page (gradient/mask/filter defs) are namespaced under
|
|
20
|
-
* `xtralab-…`.
|
|
21
|
-
*
|
|
22
|
-
* Brand-colored icons (Antigravity, Claude, Kiro, Mistral Vibe, OpenCode) keep
|
|
23
|
-
* their upstream colors; the dark/light contrast of the launcher card behind
|
|
24
|
-
* them is the same as on `jupyter-ai-acp-client`.
|
|
25
|
-
*
|
|
26
|
-
* The Vim and Neovim marks belong to the launcher's "Open" editor tile rather
|
|
27
|
-
* than the agent grid. They are the brand silhouettes from Simple Icons
|
|
28
|
-
* (https://simpleicons.org, CC0), each filled with its brand green so the mark
|
|
29
|
-
* reads on both the light and dark themes.
|
|
3
|
+
* Brand icons for the launcher cards: `jupyter-ai-contrib/jupyter-ai-acp-client`
|
|
4
|
+
* (BSD-3-Clause), except Antigravity (`@lobehub/icons-static-svg`, MIT),
|
|
5
|
+
* Pi (pi.dev, MIT) and Vim/Neovim (Simple Icons, CC0). Monochrome marks use
|
|
6
|
+
* `currentColor` to follow the active theme; svg ids are namespaced under
|
|
7
|
+
* `xtralab-…` so two copies of one mark on a page don't collide.
|
|
30
8
|
*/
|
|
31
9
|
const antigravityIcon = new LabIcon({
|
|
32
10
|
name: 'xtralab:agent-antigravity',
|
|
@@ -191,12 +169,6 @@ const vimIcon = new LabIcon({
|
|
|
191
169
|
<path d="M24 11.986h-.027l-4.318-4.318 4.303-4.414V1.461l-.649-.648h-8.198l-.66.605v1.045L12.015.027V0L12 .014 11.986 0v.027l-1.29 1.291-.538-.539H2.035l-.638.692v1.885l.616.616h.72v5.31L.027 11.987H0L.014 12 0 12.014h.027l2.706 2.706v6.467l.907.523h2.322l1.857-1.904 4.166 4.166V24l.015-.014.014.014v-.028l2.51-2.509h.485c.111 0 .211-.07.25-.179l.146-.426c.028-.084.012-.172-.037-.239l1.462-1.462-.612 1.962c-.043.141.036.289.177.332.025.008.052.012.078.012h1.824c.106-.001.201-.064.243-.163l.165-.394c.025-.065.024-.138-.004-.203-.027-.065-.08-.116-.146-.142-.029-.012-.062-.019-.097-.02h-.075l.84-2.644h1.232l-1.016 3.221c-.043.141.036.289.176.332.025.008.052.012.079.012h2.002c.11 0 .207-.066.248-.17l.164-.428c.051-.138-.021-.29-.158-.341-.029-.011-.06-.017-.091-.017h-.145l1.131-3.673c.027-.082.012-.173-.039-.24l-.375-.504-.003-.005c-.051-.064-.127-.102-.209-.102h-1.436c-.071 0-.141.03-.19.081l-.4.439h-.624l-.042-.046 4.445-4.445H24L23.986 12l.014-.014zM9.838 21.139l1.579-4.509h-.501l.297-.304h1.659l-1.563 4.555h.623l-.079.258H9.838zm3.695-7.516l.15.151-.269.922-.225.226h-.969l-.181-.181.311-.871.288-.247h.895zM5.59 20.829H3.877l-.262-.15V3.091H2.379l-.1-.1V1.815l.143-.154h7.371l.213.214v1.108l-.142.173H8.785v8.688l8.807-8.688h-2.086l-.175-.188V1.805l.121-.111h7.49l.132.133v1.07L12.979 13.25h-.373c-.015-.001-.028 0-.042.001l-.02.003c-.045.01-.086.03-.119.06l-.343.295-.004.003c-.033.031-.059.069-.073.111l-.296.83-6.119 6.276zm14.768-3.952l.474-.519h1.334l.309.415-1.265 4.107h.493l-.08.209H19.84l1.124-3.564h-2.015l-1.077 3.391h.424l-.073.174h-1.605l1.107-3.548h-2.096l-1.062 3.339h.436l-.072.209H13.27l1.514-4.46H14.198l.091-.271h1.65l.519.537h.906l.491-.554h1.061l.489.535h.953z"/>
|
|
192
170
|
</svg>`
|
|
193
171
|
});
|
|
194
|
-
/**
|
|
195
|
-
* Built-in icons keyed by the agent's id, used to resolve the icon for an
|
|
196
|
-
* agent declared without an inline `iconSvg` override (i.e. one of xtralab's
|
|
197
|
-
* defaults). Custom agents added via settings can either supply their own
|
|
198
|
-
* `iconSvg` or fall back to the generic terminal icon.
|
|
199
|
-
*/
|
|
200
172
|
export const BUILTIN_AGENT_ICONS = {
|
|
201
173
|
antigravity: antigravityIcon,
|
|
202
174
|
claude: claudeIcon,
|
|
@@ -208,12 +180,6 @@ export const BUILTIN_AGENT_ICONS = {
|
|
|
208
180
|
opencode: opencodeIcon,
|
|
209
181
|
pi: piIcon
|
|
210
182
|
};
|
|
211
|
-
/**
|
|
212
|
-
* Built-in icons keyed by the editor's id, used to resolve the icon for a
|
|
213
|
-
* built-in editor (Neovim, Vim) declared without an inline `iconSvg`. Custom
|
|
214
|
-
* editors added via settings can supply their own `iconSvg` or fall back to
|
|
215
|
-
* the generic text-editor icon.
|
|
216
|
-
*/
|
|
217
183
|
export const BUILTIN_EDITOR_ICONS = {
|
|
218
184
|
nvim: neovimIcon,
|
|
219
185
|
vim: vimIcon
|
package/lib/launcher/index.js
CHANGED
|
@@ -15,26 +15,10 @@ import { registerLauncherSchemaDefaults } from './schemaDefaults';
|
|
|
15
15
|
import { IAgentRegistry } from './tokens';
|
|
16
16
|
const PLUGIN_ID = 'xtralab:launcher';
|
|
17
17
|
/**
|
|
18
|
-
* The xtralab launcher plugin
|
|
19
|
-
* (
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* changed files (clickable into the diff viewer) below them. Clicking an
|
|
23
|
-
* agent opens a fresh terminal and pipes the agent's command into it; if
|
|
24
|
-
* the prompt textarea is non-empty, the prompt is shell-quoted and
|
|
25
|
-
* spliced into the launch line per the agent's `promptArgs` recipe.
|
|
26
|
-
*
|
|
27
|
-
* The agent list is the merge of xtralab's defaults with the user's
|
|
28
|
-
* `xtralab:launcher` settings, then filtered by a server-side `which`
|
|
29
|
-
* check so users only see agents that are actually installed. Agents with
|
|
30
|
-
* `requireAvailable: false` skip the filter, as does any built-in whose
|
|
31
|
-
* `command` the user has overridden (a user-chosen command — often a shell
|
|
32
|
-
* alias the server can't resolve — is trusted and always shown).
|
|
33
|
-
*
|
|
34
|
-
* The plugin deliberately does NOT provide the `ILauncher` token: other
|
|
35
|
-
* extensions register notebook/console/terminal cards on it as a side
|
|
36
|
-
* effect, which would defeat the point of the agent-only launcher. If an
|
|
37
|
-
* extension needs to surface itself, we'll add it here explicitly.
|
|
18
|
+
* The xtralab launcher plugin: replaces the stock JupyterLab launcher
|
|
19
|
+
* (disabled via `jupyterlab.disabledExtensions`) with an agent-focused
|
|
20
|
+
* dashboard. It deliberately does NOT provide `ILauncher` — other extensions
|
|
21
|
+
* would register their cards on it and defeat the agent-only design.
|
|
38
22
|
*/
|
|
39
23
|
const plugin = {
|
|
40
24
|
id: PLUGIN_ID,
|
|
@@ -52,20 +36,10 @@ const plugin = {
|
|
|
52
36
|
activate: async (app, labShell, palette, settingRegistry, translator, agentSessions, editorRegistry) => {
|
|
53
37
|
const { commands, shell } = app;
|
|
54
38
|
const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyterlab');
|
|
55
|
-
// The shared agent registry this plugin provides on `IAgentRegistry`.
|
|
56
|
-
// It holds the active agent list (updated whenever settings change), so
|
|
57
|
-
// every freshly-created launcher widget — and any other plugin that
|
|
58
|
-
// consumes the token, e.g. the terminals panel — renders the latest list.
|
|
59
39
|
const registry = new AgentRegistry();
|
|
60
|
-
// Track command registrations so a settings change can wipe them
|
|
61
|
-
// before re-registering — without this the command palette would
|
|
62
|
-
// accumulate stale entries when the agent list shrinks.
|
|
63
40
|
let registered = null;
|
|
64
41
|
const applyAgents = async (overrides) => {
|
|
65
42
|
const agents = mergeAgents(overrides);
|
|
66
|
-
// Probe the server's `$PATH` so we only surface agents that are actually
|
|
67
|
-
// installed. Agents with `requireAvailable: false` opt out (their command
|
|
68
|
-
// may be a shell alias that `which` can't see) and are kept regardless.
|
|
69
43
|
const probe = Array.from(new Set(agents
|
|
70
44
|
.filter(agent => agent.requireAvailable)
|
|
71
45
|
.map(agent => agent.command)));
|
|
@@ -97,8 +71,6 @@ const plugin = {
|
|
|
97
71
|
}
|
|
98
72
|
catch (reason) {
|
|
99
73
|
console.error('xtralab: failed to load launcher settings', reason);
|
|
100
|
-
// Settings load failed — fall back to defaults so the launcher
|
|
101
|
-
// still has cards instead of going silent.
|
|
102
74
|
await applyAgents([]);
|
|
103
75
|
}
|
|
104
76
|
}
|
|
@@ -111,11 +83,8 @@ const plugin = {
|
|
|
111
83
|
var _a;
|
|
112
84
|
const id = Private.nextId();
|
|
113
85
|
const onAgentLaunch = (item) => {
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
// agent feels like the launcher transformed into the terminal.
|
|
117
|
-
// Disposing the inner ReactWidget cascades to the MainAreaWidget
|
|
118
|
-
// host via its `content.disposed` connection.
|
|
86
|
+
// Slot the widget where this launcher sits; disposing the inner
|
|
87
|
+
// ReactWidget cascades to its MainAreaWidget host via `content.disposed`.
|
|
119
88
|
if (find(shell.widgets('main'), w => w === item)) {
|
|
120
89
|
shell.add(item, 'main', { ref: id });
|
|
121
90
|
launcher.dispose();
|
|
@@ -127,9 +96,6 @@ const plugin = {
|
|
|
127
96
|
editor: (_a = editorRegistry === null || editorRegistry === void 0 ? void 0 : editorRegistry.current) !== null && _a !== void 0 ? _a : null,
|
|
128
97
|
agentSessions,
|
|
129
98
|
onAgentLaunch,
|
|
130
|
-
// Empty repoPath/cwd matches the JupyterLab convention used by
|
|
131
|
-
// the git panel and the stock launcher: let the server resolve
|
|
132
|
-
// the working tree from its root directory.
|
|
133
99
|
repoPath: '',
|
|
134
100
|
cwd: '',
|
|
135
101
|
trans
|
|
@@ -137,9 +103,7 @@ const plugin = {
|
|
|
137
103
|
launcher.title.icon = launcherIcon;
|
|
138
104
|
launcher.title.label = trans.__('Launcher');
|
|
139
105
|
const main = new MainAreaWidget({ content: launcher });
|
|
140
|
-
//
|
|
141
|
-
// main area: closing it would leave the user staring at an empty
|
|
142
|
-
// shell with no way back.
|
|
106
|
+
// Closing the only main-area widget would leave an empty shell.
|
|
143
107
|
main.title.closable = !!Array.from(shell.widgets('main')).length;
|
|
144
108
|
main.id = id;
|
|
145
109
|
shell.add(main, 'main', {
|
|
@@ -171,9 +135,7 @@ const plugin = {
|
|
|
171
135
|
labShell.layoutModified.connect(() => {
|
|
172
136
|
maybeCreate();
|
|
173
137
|
});
|
|
174
|
-
//
|
|
175
|
-
// empty (fresh start, no restored widgets) the connect above won't
|
|
176
|
-
// fire on its own — kick it off here.
|
|
138
|
+
// If the restored layout is already empty the connect never fires.
|
|
177
139
|
maybeCreate();
|
|
178
140
|
});
|
|
179
141
|
labShell.addButtonEnabled = true;
|
|
@@ -188,14 +150,9 @@ const plugin = {
|
|
|
188
150
|
}
|
|
189
151
|
};
|
|
190
152
|
/**
|
|
191
|
-
* Drop agents whose command isn't on `$PATH`,
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* {@link fetchAvailableCommands}.
|
|
195
|
-
*
|
|
196
|
-
* When `available` is `null` (the endpoint couldn't be reached) we fail open
|
|
197
|
-
* and return the input unchanged — better to show an unreachable agent than
|
|
198
|
-
* to hide the entire launcher because the server extension didn't load.
|
|
153
|
+
* Drop agents whose command isn't on `$PATH`, keeping `requireAvailable:
|
|
154
|
+
* false` entries. When `available` is `null` (probe failed), fail open and
|
|
155
|
+
* return the input unchanged.
|
|
199
156
|
*/
|
|
200
157
|
function filterAgents(agents, available) {
|
|
201
158
|
if (!available) {
|
|
@@ -207,7 +164,7 @@ var Private;
|
|
|
207
164
|
(function (Private) {
|
|
208
165
|
let counter = 0;
|
|
209
166
|
/**
|
|
210
|
-
*
|
|
167
|
+
* Generate a unique id for a launcher widget.
|
|
211
168
|
*/
|
|
212
169
|
function nextId() {
|
|
213
170
|
return `launcher-${counter++}`;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { IAgent } from './agents';
|
|
2
2
|
/**
|
|
3
|
-
* Compose the literal command line typed into a fresh terminal for `agent
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Returns `agent.command` unchanged when the agent declares no prompt
|
|
9
|
-
* support (`promptArgs === undefined`), so a stray prompt typed into the
|
|
10
|
-
* launcher does not silently mutate the launch line for that agent. The
|
|
11
|
-
* launcher UI separately prevents the click in that case so the dropped
|
|
12
|
-
* prompt is never surprising to the user.
|
|
3
|
+
* Compose the literal command line typed into a fresh terminal for `agent`:
|
|
4
|
+
* the shell-quoted prompt is spliced in per the `promptArgs` recipe. Returns
|
|
5
|
+
* bare `agent.command` when the prompt is empty or the agent has no prompt
|
|
6
|
+
* support.
|
|
13
7
|
*/
|
|
14
8
|
export declare function buildAgentInvocation(agent: IAgent, prompt: string): string;
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Quote a string
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* The distinction matters: an actual newline byte (0x0A) sent into a PTY
|
|
7
|
-
* is interpreted by the line discipline as Enter regardless of whether
|
|
8
|
-
* it sits inside `'...'` quotes, so the shell never sees the closing
|
|
9
|
-
* quote. We therefore use ANSI-C `$'...'` quoting and emit `\n` (and
|
|
10
|
-
* `\r`) as their two-character escape sequences; the shell expands them
|
|
11
|
-
* to real newlines after the line is submitted, when readline is no
|
|
12
|
-
* longer involved. Backslashes and single quotes are escaped first so
|
|
13
|
-
* the source text round-trips unchanged.
|
|
2
|
+
* Quote a string for a command line typed into an interactive terminal. A raw
|
|
3
|
+
* newline sent to a PTY acts as Enter even inside '…' quotes, so ANSI-C
|
|
4
|
+
* `$'…'` quoting emits `\n`/`\r` as escapes the shell expands after submit.
|
|
14
5
|
*/
|
|
15
6
|
function shellQuote(value) {
|
|
16
7
|
const escaped = value
|
|
@@ -21,16 +12,10 @@ function shellQuote(value) {
|
|
|
21
12
|
return `$'${escaped}'`;
|
|
22
13
|
}
|
|
23
14
|
/**
|
|
24
|
-
* Compose the literal command line typed into a fresh terminal for `agent
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* Returns `agent.command` unchanged when the agent declares no prompt
|
|
30
|
-
* support (`promptArgs === undefined`), so a stray prompt typed into the
|
|
31
|
-
* launcher does not silently mutate the launch line for that agent. The
|
|
32
|
-
* launcher UI separately prevents the click in that case so the dropped
|
|
33
|
-
* prompt is never surprising to the user.
|
|
15
|
+
* Compose the literal command line typed into a fresh terminal for `agent`:
|
|
16
|
+
* the shell-quoted prompt is spliced in per the `promptArgs` recipe. Returns
|
|
17
|
+
* bare `agent.command` when the prompt is empty or the agent has no prompt
|
|
18
|
+
* support.
|
|
34
19
|
*/
|
|
35
20
|
export function buildAgentInvocation(agent, prompt) {
|
|
36
21
|
const trimmed = prompt.trim();
|
|
@@ -2,18 +2,20 @@ import { ISignal } from '@lumino/signaling';
|
|
|
2
2
|
import type { IAgent } from './agents';
|
|
3
3
|
import type { IAgentRegistry } from './tokens';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* whenever the launcher recomputes it (on a settings change). The launcher
|
|
8
|
-
* is the only writer, so the write side ({@link setAgents}) is kept off the
|
|
9
|
-
* shared token.
|
|
5
|
+
* Concrete {@link IAgentRegistry} the launcher plugin provides. The launcher
|
|
6
|
+
* is the only writer, so {@link setAgents} is kept off the shared token.
|
|
10
7
|
*/
|
|
11
8
|
export declare class AgentRegistry implements IAgentRegistry {
|
|
9
|
+
/**
|
|
10
|
+
* The current agents, filtered by availability and sorted by rank.
|
|
11
|
+
*/
|
|
12
12
|
get agents(): IAgent[];
|
|
13
|
+
/**
|
|
14
|
+
* Emitted whenever {@link agents} changes.
|
|
15
|
+
*/
|
|
13
16
|
get changed(): ISignal<IAgentRegistry, void>;
|
|
14
17
|
/**
|
|
15
|
-
* Replace the agent list and notify observers.
|
|
16
|
-
* after merging the user's settings and filtering by availability.
|
|
18
|
+
* Replace the agent list and notify observers.
|
|
17
19
|
*/
|
|
18
20
|
setAgents(agents: IAgent[]): void;
|
|
19
21
|
private _agents;
|
package/lib/launcher/registry.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { Signal } from '@lumino/signaling';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* whenever the launcher recomputes it (on a settings change). The launcher
|
|
6
|
-
* is the only writer, so the write side ({@link setAgents}) is kept off the
|
|
7
|
-
* shared token.
|
|
3
|
+
* Concrete {@link IAgentRegistry} the launcher plugin provides. The launcher
|
|
4
|
+
* is the only writer, so {@link setAgents} is kept off the shared token.
|
|
8
5
|
*/
|
|
9
6
|
export class AgentRegistry {
|
|
10
7
|
constructor() {
|
|
11
8
|
this._agents = [];
|
|
12
9
|
this._changed = new Signal(this);
|
|
13
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The current agents, filtered by availability and sorted by rank.
|
|
13
|
+
*/
|
|
14
14
|
get agents() {
|
|
15
15
|
return this._agents;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Emitted whenever {@link agents} changes.
|
|
19
|
+
*/
|
|
17
20
|
get changed() {
|
|
18
21
|
return this._changed;
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
|
-
* Replace the agent list and notify observers.
|
|
22
|
-
* after merging the user's settings and filtering by availability.
|
|
24
|
+
* Replace the agent list and notify observers.
|
|
23
25
|
*/
|
|
24
26
|
setAgents(agents) {
|
|
25
27
|
this._agents = agents;
|
package/lib/launcher/tokens.d.ts
CHANGED
|
@@ -2,40 +2,28 @@ import { Token } from '@lumino/coreutils';
|
|
|
2
2
|
import type { ISignal } from '@lumino/signaling';
|
|
3
3
|
import type { IAgent } from './agents';
|
|
4
4
|
/**
|
|
5
|
-
* A read-only, observable view of the launcher's available agents
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* the user's `xtralab:launcher` settings, then filtered by a server-side
|
|
9
|
-
* `which` check — and registers an `xtralab:start-agent:<id>` command for
|
|
10
|
-
* each entry. This token shares that list, and (via {@link agentCommandId})
|
|
11
|
-
* the command id that launches each agent, so other plugins can surface the
|
|
12
|
-
* same agents without re-deriving the list or duplicating the icons. The
|
|
13
|
-
* terminals panel uses it to build its "new terminal" dropdown.
|
|
5
|
+
* A read-only, observable view of the launcher's available agents — the
|
|
6
|
+
* merged, availability-filtered list the launcher renders — shared so other
|
|
7
|
+
* plugins (e.g. the terminals panel) can surface the same agents and icons.
|
|
14
8
|
*/
|
|
15
9
|
export interface IAgentRegistry {
|
|
16
10
|
/**
|
|
17
|
-
* The current agents,
|
|
18
|
-
* rank — the same array the launcher renders.
|
|
11
|
+
* The current agents, filtered by availability and sorted by rank.
|
|
19
12
|
*/
|
|
20
13
|
readonly agents: IAgent[];
|
|
21
14
|
/**
|
|
22
|
-
* Emitted whenever {@link agents} changes
|
|
23
|
-
* launcher settings). Consumers that cache the list should re-read it
|
|
24
|
-
* here; consumers that read it on demand can ignore the signal.
|
|
15
|
+
* Emitted whenever {@link agents} changes.
|
|
25
16
|
*/
|
|
26
17
|
readonly changed: ISignal<IAgentRegistry, void>;
|
|
27
18
|
}
|
|
28
19
|
/**
|
|
29
|
-
* DI token for {@link IAgentRegistry}. Provided by `xtralab:launcher
|
|
30
|
-
*
|
|
31
|
-
* disabled
|
|
20
|
+
* DI token for {@link IAgentRegistry}. Provided by `xtralab:launcher`;
|
|
21
|
+
* consumers depend on it optionally so they survive the launcher being
|
|
22
|
+
* disabled.
|
|
32
23
|
*/
|
|
33
24
|
export declare const IAgentRegistry: Token<IAgentRegistry>;
|
|
34
25
|
/**
|
|
35
|
-
* The
|
|
36
|
-
*
|
|
37
|
-
* command-registration internals — so the launcher (which registers the
|
|
38
|
-
* commands) and any consumer (which references them, e.g. in a menu) agree
|
|
39
|
-
* on the id.
|
|
26
|
+
* The command id that launches a given agent in a new terminal, defined in
|
|
27
|
+
* the shared contract module so the launcher and consumers agree on it.
|
|
40
28
|
*/
|
|
41
29
|
export declare function agentCommandId(agentId: string): string;
|
package/lib/launcher/tokens.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Token } from '@lumino/coreutils';
|
|
2
2
|
/**
|
|
3
|
-
* DI token for {@link IAgentRegistry}. Provided by `xtralab:launcher
|
|
4
|
-
*
|
|
5
|
-
* disabled
|
|
3
|
+
* DI token for {@link IAgentRegistry}. Provided by `xtralab:launcher`;
|
|
4
|
+
* consumers depend on it optionally so they survive the launcher being
|
|
5
|
+
* disabled.
|
|
6
6
|
*/
|
|
7
7
|
export const IAgentRegistry = new Token('xtralab:IAgentRegistry', 'A read-only, observable view of the launcher agents, shared so other plugins can offer the same agent list and icons.');
|
|
8
8
|
/**
|
|
9
|
-
* The
|
|
10
|
-
*
|
|
11
|
-
* command-registration internals — so the launcher (which registers the
|
|
12
|
-
* commands) and any consumer (which references them, e.g. in a menu) agree
|
|
13
|
-
* on the id.
|
|
9
|
+
* The command id that launches a given agent in a new terminal, defined in
|
|
10
|
+
* the shared contract module so the launcher and consumers agree on it.
|
|
14
11
|
*/
|
|
15
12
|
export function agentCommandId(agentId) {
|
|
16
13
|
return `xtralab:start-agent:${agentId}`;
|
package/lib/menuBar/index.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
|
|
2
2
|
/**
|
|
3
|
-
* Collapse the main menu bar into a
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* menus as a vertical popup. The popup reuses the live `RankedMenu` instances
|
|
7
|
-
* owned by the `MainMenu`, so menus added or removed at runtime are reflected
|
|
8
|
-
* without duplication.
|
|
9
|
-
*
|
|
10
|
-
* Hiding covers the `jp-menu-panel` container too, which has its own
|
|
11
|
-
* `min-height` and would otherwise leave an empty strip. The "Show Menu Bar"
|
|
12
|
-
* toggle restores the classic bar.
|
|
3
|
+
* Collapse the main menu bar into a hamburger button whose popup reuses the
|
|
4
|
+
* live `RankedMenu` instances owned by `MainMenu`. Hiding covers the
|
|
5
|
+
* `jp-menu-panel` container too — its `min-height` would leave an empty strip.
|
|
13
6
|
*/
|
|
14
7
|
declare const plugin: JupyterFrontEndPlugin<void>;
|
|
15
8
|
export default plugin;
|
package/lib/menuBar/index.js
CHANGED
|
@@ -10,24 +10,14 @@ const PLUGIN_ID = 'xtralab:menu-bar';
|
|
|
10
10
|
const OPEN_COMMAND = 'xtralab:open-main-menu';
|
|
11
11
|
const TOGGLE_COMMAND = 'xtralab:toggle-menu-bar';
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* document `pointerdown` listener in the capture phase, which runs before
|
|
16
|
-
* the button's own mousedown handler — so without this window, pressing the
|
|
17
|
-
* button while the popup is open would close it and instantly reopen it.
|
|
13
|
+
* Guard after the popup closes: Lumino menus close on a capture-phase document
|
|
14
|
+
* pointerdown, before the button's mousedown, which would instantly reopen.
|
|
18
15
|
*/
|
|
19
16
|
const REOPEN_GUARD_MS = 250;
|
|
20
17
|
/**
|
|
21
|
-
* Collapse the main menu bar into a
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* menus as a vertical popup. The popup reuses the live `RankedMenu` instances
|
|
25
|
-
* owned by the `MainMenu`, so menus added or removed at runtime are reflected
|
|
26
|
-
* without duplication.
|
|
27
|
-
*
|
|
28
|
-
* Hiding covers the `jp-menu-panel` container too, which has its own
|
|
29
|
-
* `min-height` and would otherwise leave an empty strip. The "Show Menu Bar"
|
|
30
|
-
* toggle restores the classic bar.
|
|
18
|
+
* Collapse the main menu bar into a hamburger button whose popup reuses the
|
|
19
|
+
* live `RankedMenu` instances owned by `MainMenu`. Hiding covers the
|
|
20
|
+
* `jp-menu-panel` container too — its `min-height` would leave an empty strip.
|
|
31
21
|
*/
|
|
32
22
|
const plugin = {
|
|
33
23
|
id: PLUGIN_ID,
|
|
@@ -64,9 +54,8 @@ const plugin = {
|
|
|
64
54
|
const openMenu = () => {
|
|
65
55
|
var _a, _b;
|
|
66
56
|
if (visible) {
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
// compete with the bar for the same Menu instances.
|
|
57
|
+
// With the classic bar on screen, act like keyboard menu activation —
|
|
58
|
+
// a popup would compete with the bar for the same Menu instances.
|
|
70
59
|
mainMenu.activeIndex = 0;
|
|
71
60
|
mainMenu.openActiveMenu();
|
|
72
61
|
return;
|
|
@@ -74,13 +63,8 @@ const plugin = {
|
|
|
74
63
|
if (Date.now() - popupClosedAt < REOPEN_GUARD_MS) {
|
|
75
64
|
return;
|
|
76
65
|
}
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
// Menu rather than a MenuSvg: MenuSvg.insertItem re-wraps each
|
|
80
|
-
// submenu's renderer and insertItem on every call, which would pile
|
|
81
|
-
// wrappers onto the shared menus across reopens. The svg renderer and
|
|
82
|
-
// themed-container class are applied directly instead, matching how
|
|
83
|
-
// the real menus are constructed in MainMenu.
|
|
66
|
+
// A plain Menu rebuilt on every open; MenuSvg.insertItem would re-wrap
|
|
67
|
+
// each submenu's renderer per reopen, piling wrappers onto the shared menus.
|
|
84
68
|
if (popup === null) {
|
|
85
69
|
popup = new Menu({ commands, renderer: MenuSvg.defaultRenderer });
|
|
86
70
|
popup.addClass('jp-ThemedContainer');
|
|
@@ -153,9 +137,8 @@ const plugin = {
|
|
|
153
137
|
loaded.changed.connect(update);
|
|
154
138
|
})
|
|
155
139
|
.catch(reason => {
|
|
156
|
-
// Without settings the collapsed state cannot be managed
|
|
157
|
-
//
|
|
158
|
-
// the app with no reachable menus.
|
|
140
|
+
// Without settings the collapsed state cannot be managed and the button
|
|
141
|
+
// was never added; reveal the stock bar so menus stay reachable.
|
|
159
142
|
applyVisibility(true);
|
|
160
143
|
console.error(`Failed to load settings for ${PLUGIN_ID}`, reason);
|
|
161
144
|
});
|
package/lib/menus/index.d.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
|
|
2
2
|
/**
|
|
3
|
-
* Hide the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* cannot meaningfully invoke; remove them until a notebook or console is
|
|
7
|
-
* opened, then restore them at their original ranks.
|
|
8
|
-
*
|
|
9
|
-
* Detection is duck-typed on `sessionContext`: NotebookPanel and ConsolePanel
|
|
10
|
-
* both expose it, which avoids pulling in `@jupyterlab/notebook` and
|
|
11
|
-
* `@jupyterlab/console` just to identify their widgets.
|
|
3
|
+
* Hide the Run and Kernel menus while no kernel-using widget is open in the
|
|
4
|
+
* main area, then restore them at their original ranks — the agent-first
|
|
5
|
+
* launcher does not use kernels, so a fresh workspace should not surface them.
|
|
12
6
|
*/
|
|
13
7
|
declare const plugin: JupyterFrontEndPlugin<void>;
|
|
14
8
|
export default plugin;
|
package/lib/menus/index.js
CHANGED
|
@@ -2,15 +2,9 @@ import { ILabShell } from '@jupyterlab/application';
|
|
|
2
2
|
import { IMainMenu } from '@jupyterlab/mainmenu';
|
|
3
3
|
const PLUGIN_ID = 'xtralab:menus';
|
|
4
4
|
/**
|
|
5
|
-
* Hide the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* cannot meaningfully invoke; remove them until a notebook or console is
|
|
9
|
-
* opened, then restore them at their original ranks.
|
|
10
|
-
*
|
|
11
|
-
* Detection is duck-typed on `sessionContext`: NotebookPanel and ConsolePanel
|
|
12
|
-
* both expose it, which avoids pulling in `@jupyterlab/notebook` and
|
|
13
|
-
* `@jupyterlab/console` just to identify their widgets.
|
|
5
|
+
* Hide the Run and Kernel menus while no kernel-using widget is open in the
|
|
6
|
+
* main area, then restore them at their original ranks — the agent-first
|
|
7
|
+
* launcher does not use kernels, so a fresh workspace should not surface them.
|
|
14
8
|
*/
|
|
15
9
|
const plugin = {
|
|
16
10
|
id: PLUGIN_ID,
|
|
@@ -19,27 +13,21 @@ const plugin = {
|
|
|
19
13
|
requires: [IMainMenu, ILabShell],
|
|
20
14
|
activate: (app, mainMenu, labShell) => {
|
|
21
15
|
var _a, _b;
|
|
22
|
-
// The interface types
|
|
23
|
-
//
|
|
24
|
-
// to MenuBar.removeMenu and IMainMenu.addMenu, which expect a `Menu`.
|
|
16
|
+
// The interface types extend IRankedMenu but the concrete instances are
|
|
17
|
+
// RankedMenu/Menu; cast for the MenuBar methods, which expect a `Menu`.
|
|
25
18
|
const menuBar = mainMenu;
|
|
26
19
|
const runMenu = mainMenu.runMenu;
|
|
27
20
|
const kernelMenu = mainMenu.kernelMenu;
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
// back to the hard-coded defaults from `MainMenu` keeps things sane
|
|
31
|
-
// if the schema ever omits the rank.
|
|
21
|
+
// Schema-assigned ranks so the menus reappear in their original slots;
|
|
22
|
+
// fall back to MainMenu's hard-coded defaults if the schema omits them.
|
|
32
23
|
const runRank = (_a = mainMenu.runMenu.rank) !== null && _a !== void 0 ? _a : 4;
|
|
33
24
|
const kernelRank = (_b = mainMenu.kernelMenu.rank) !== null && _b !== void 0 ? _b : 5;
|
|
34
25
|
const isPresent = (menu) => Array.from(menuBar.menus).indexOf(menu) > -1;
|
|
35
26
|
const update = () => {
|
|
36
27
|
const show = hasKernelWidget(labShell);
|
|
37
28
|
if (show) {
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// so re-adding lands the menu at the wrong position. Insert
|
|
41
|
-
// directly on the MenuBar by walking current menus and finding
|
|
42
|
-
// the first sibling with a higher rank.
|
|
29
|
+
// Not `mainMenu.addMenu`: its insertion index comes from a private
|
|
30
|
+
// `_items` array that `removeMenu` doesn't update, misplacing re-adds.
|
|
43
31
|
if (!isPresent(runMenu)) {
|
|
44
32
|
insertByRank(menuBar, runMenu, runRank);
|
|
45
33
|
}
|
|
@@ -63,11 +51,9 @@ const plugin = {
|
|
|
63
51
|
}
|
|
64
52
|
};
|
|
65
53
|
/**
|
|
66
|
-
* True iff any
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* `@jupyterlab/notebook` and `@jupyterlab/console` into xtralab's bundle
|
|
70
|
-
* just to do an `instanceof` check.
|
|
54
|
+
* True iff any main-area widget exposes a `sessionContext` (NotebookPanel,
|
|
55
|
+
* ConsolePanel, kernel-attached editors) — duck-typed to keep
|
|
56
|
+
* `@jupyterlab/notebook` and `@jupyterlab/console` out of the bundle.
|
|
71
57
|
*/
|
|
72
58
|
function hasKernelWidget(labShell) {
|
|
73
59
|
for (const widget of labShell.widgets('main')) {
|
|
@@ -82,10 +68,8 @@ function hasSessionContext(widget) {
|
|
|
82
68
|
return (candidate.sessionContext !== null && candidate.sessionContext !== undefined);
|
|
83
69
|
}
|
|
84
70
|
/**
|
|
85
|
-
* Insert `menu`
|
|
86
|
-
*
|
|
87
|
-
* rank are treated as +Infinity so they sink to the end (matching the
|
|
88
|
-
* convention in `MenuFactory.createMenus`).
|
|
71
|
+
* Insert `menu` at the slot dictated by `rank`; rank-less menus count as
|
|
72
|
+
* +Infinity and sink to the end, matching `MenuFactory.createMenus`.
|
|
89
73
|
*/
|
|
90
74
|
function insertByRank(menuBar, menu, rank) {
|
|
91
75
|
const menus = menuBar.menus;
|
package/lib/omnibox/files.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The workspace file list, cached briefly so reopening the omnibox
|
|
3
|
-
*
|
|
4
|
-
* extension is absent) resolves to an empty list so file search degrades to
|
|
5
|
-
* "no results" instead of surfacing an error.
|
|
2
|
+
* The workspace file list, cached briefly so reopening the omnibox reuses one
|
|
3
|
+
* scan. A failed fetch resolves to an empty list.
|
|
6
4
|
*/
|
|
7
5
|
export declare function loadWorkspaceFiles(): Promise<string[]>;
|