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.
Files changed (237) hide show
  1. package/README.md +65 -30
  2. package/lib/about/icons.d.ts +0 -5
  3. package/lib/about/icons.js +0 -5
  4. package/lib/about/index.d.ts +4 -8
  5. package/lib/about/index.js +6 -17
  6. package/lib/agentSessions.d.ts +9 -29
  7. package/lib/agentSessions.js +2 -7
  8. package/lib/askAgent/editorSelection.d.ts +20 -26
  9. package/lib/askAgent/editorSelection.js +11 -26
  10. package/lib/askAgent/icons.d.ts +2 -3
  11. package/lib/askAgent/icons.js +2 -3
  12. package/lib/askAgent/index.d.ts +4 -26
  13. package/lib/askAgent/index.js +54 -158
  14. package/lib/askAgent/popup.d.ts +12 -16
  15. package/lib/askAgent/popup.js +18 -37
  16. package/lib/askAgent/prompt.d.ts +3 -5
  17. package/lib/askAgent/prompt.js +6 -19
  18. package/lib/askAgent/queue.d.ts +11 -21
  19. package/lib/askAgent/queue.js +9 -19
  20. package/lib/askAgent/queuePanel.d.ts +13 -18
  21. package/lib/askAgent/queuePanel.js +15 -37
  22. package/lib/askAgent/targetPicker.d.ts +2 -9
  23. package/lib/askAgent/targetPicker.js +6 -11
  24. package/lib/askAgent/tokens.d.ts +32 -46
  25. package/lib/askAgent/tokens.js +4 -6
  26. package/lib/commandBar/index.d.ts +4 -13
  27. package/lib/commandBar/index.js +21 -39
  28. package/lib/customPanel/index.js +15 -0
  29. package/lib/editorBreadcrumbs/index.d.ts +3 -6
  30. package/lib/editorBreadcrumbs/index.js +10 -6
  31. package/lib/editorBreadcrumbs/widget.d.ts +17 -4
  32. package/lib/editorBreadcrumbs/widget.js +11 -17
  33. package/lib/editorIndent/index.d.ts +4 -12
  34. package/lib/editorIndent/index.js +8 -23
  35. package/lib/fileBrowser/commands.d.ts +29 -19
  36. package/lib/fileBrowser/commands.js +83 -97
  37. package/lib/fileBrowser/contents.d.ts +3 -0
  38. package/lib/fileBrowser/dragAndDrop.d.ts +17 -4
  39. package/lib/fileBrowser/dragAndDrop.js +2 -7
  40. package/lib/fileBrowser/fileBrowser.d.ts +19 -9
  41. package/lib/fileBrowser/fileBrowser.js +70 -222
  42. package/lib/fileBrowser/gitStatus.d.ts +16 -10
  43. package/lib/fileBrowser/gitStatus.js +31 -30
  44. package/lib/fileBrowser/gitignore.d.ts +4 -17
  45. package/lib/fileBrowser/gitignore.js +4 -25
  46. package/lib/fileBrowser/icons.d.ts +7 -17
  47. package/lib/fileBrowser/icons.js +25 -80
  48. package/lib/fileBrowser/index.js +2 -4
  49. package/lib/fileBrowser/widget.d.ts +141 -48
  50. package/lib/fileBrowser/widget.js +102 -4
  51. package/lib/fileTypeIcons/index.js +0 -10
  52. package/lib/git/api.d.ts +5 -13
  53. package/lib/git/api.js +10 -36
  54. package/lib/git/askRequest.d.ts +4 -8
  55. package/lib/git/askRequest.js +6 -20
  56. package/lib/git/commands.d.ts +45 -5
  57. package/lib/git/commands.js +20 -13
  58. package/lib/git/diffModel.js +4 -0
  59. package/lib/git/diffPreferences.d.ts +90 -0
  60. package/lib/git/diffPreferences.js +107 -0
  61. package/lib/git/diffProvider.js +10 -2
  62. package/lib/git/diffSurface.d.ts +64 -63
  63. package/lib/git/diffSurface.js +72 -213
  64. package/lib/git/diffTheme.d.ts +7 -0
  65. package/lib/git/diffTheme.js +23 -0
  66. package/lib/git/diffWidget.d.ts +70 -14
  67. package/lib/git/diffWidget.js +100 -94
  68. package/lib/git/imageDiff.d.ts +14 -6
  69. package/lib/git/imageDiff.js +19 -75
  70. package/lib/git/index.d.ts +0 -3
  71. package/lib/git/index.js +44 -10
  72. package/lib/git/notebookDiff.d.ts +110 -33
  73. package/lib/git/notebookDiff.js +55 -197
  74. package/lib/git/tokens.d.ts +73 -31
  75. package/lib/git/tokens.js +2 -3
  76. package/lib/highlight/index.d.ts +4 -10
  77. package/lib/highlight/index.js +10 -41
  78. package/lib/index.d.ts +0 -9
  79. package/lib/index.js +0 -9
  80. package/lib/launcher/agents.d.ts +55 -51
  81. package/lib/launcher/agents.js +15 -57
  82. package/lib/launcher/availability.d.ts +3 -9
  83. package/lib/launcher/availability.js +3 -9
  84. package/lib/launcher/commands.d.ts +7 -32
  85. package/lib/launcher/commands.js +14 -45
  86. package/lib/launcher/dashboard.d.ts +19 -24
  87. package/lib/launcher/dashboard.js +21 -67
  88. package/lib/launcher/editorRegistry.d.ts +10 -22
  89. package/lib/launcher/editorRegistry.js +14 -18
  90. package/lib/launcher/editors.d.ts +39 -45
  91. package/lib/launcher/editors.js +8 -34
  92. package/lib/launcher/icons.d.ts +0 -12
  93. package/lib/launcher/icons.js +5 -39
  94. package/lib/launcher/index.js +12 -55
  95. package/lib/launcher/invocation.d.ts +4 -10
  96. package/lib/launcher/invocation.js +7 -22
  97. package/lib/launcher/registry.d.ts +9 -7
  98. package/lib/launcher/registry.js +9 -7
  99. package/lib/launcher/tokens.d.ts +10 -22
  100. package/lib/launcher/tokens.js +5 -8
  101. package/lib/menuBar/index.d.ts +3 -10
  102. package/lib/menuBar/index.js +11 -28
  103. package/lib/menus/index.d.ts +3 -9
  104. package/lib/menus/index.js +14 -30
  105. package/lib/omnibox/files.d.ts +2 -4
  106. package/lib/omnibox/files.js +5 -11
  107. package/lib/omnibox/index.d.ts +4 -14
  108. package/lib/omnibox/index.js +9 -27
  109. package/lib/omnibox/model.d.ts +38 -10
  110. package/lib/omnibox/model.js +15 -33
  111. package/lib/omnibox/recents.d.ts +15 -17
  112. package/lib/omnibox/recents.js +12 -17
  113. package/lib/omnibox/tokens.d.ts +5 -10
  114. package/lib/omnibox/tokens.js +2 -6
  115. package/lib/omnibox/widget.d.ts +11 -7
  116. package/lib/omnibox/widget.js +8 -16
  117. package/lib/searchReplace/index.d.ts +4 -20
  118. package/lib/searchReplace/index.js +7 -27
  119. package/lib/showOutput/index.d.ts +3 -12
  120. package/lib/showOutput/index.js +6 -22
  121. package/lib/sidebar/index.d.ts +4 -7
  122. package/lib/sidebar/index.js +5 -12
  123. package/lib/terminalNotifications/index.d.ts +4 -10
  124. package/lib/terminalNotifications/index.js +6 -20
  125. package/lib/terminals/agentTerminals.d.ts +12 -5
  126. package/lib/terminals/agentTerminals.js +25 -44
  127. package/lib/terminals/detection.d.ts +4 -8
  128. package/lib/terminals/detection.js +4 -8
  129. package/lib/terminals/index.d.ts +0 -35
  130. package/lib/terminals/index.js +12 -101
  131. package/lib/terminals/model.d.ts +64 -139
  132. package/lib/terminals/model.js +80 -220
  133. package/lib/terminals/tokens.d.ts +11 -22
  134. package/lib/terminals/tokens.js +2 -2
  135. package/lib/terminals/widget.d.ts +43 -13
  136. package/lib/terminals/widget.js +33 -18
  137. package/lib/topBar/icons.d.ts +3 -8
  138. package/lib/topBar/icons.js +3 -8
  139. package/lib/topBar/index.d.ts +4 -11
  140. package/lib/topBar/index.js +10 -38
  141. package/lib/walkthrough/index.d.ts +4 -9
  142. package/lib/walkthrough/index.js +6 -20
  143. package/lib/walkthrough/panel.d.ts +40 -9
  144. package/lib/walkthrough/panel.js +4 -10
  145. package/package.json +5 -3
  146. package/schema/git-diff-preferences.json +42 -0
  147. package/src/about/icons.ts +0 -5
  148. package/src/about/index.tsx +6 -17
  149. package/src/agentSessions.ts +9 -29
  150. package/src/askAgent/editorSelection.ts +22 -29
  151. package/src/askAgent/icons.ts +2 -3
  152. package/src/askAgent/index.ts +54 -158
  153. package/src/askAgent/popup.tsx +23 -45
  154. package/src/askAgent/prompt.ts +6 -19
  155. package/src/askAgent/queue.ts +13 -24
  156. package/src/askAgent/queuePanel.tsx +21 -46
  157. package/src/askAgent/targetPicker.tsx +5 -15
  158. package/src/askAgent/tokens.ts +32 -46
  159. package/src/commandBar/index.ts +24 -39
  160. package/src/customPanel/index.ts +15 -0
  161. package/src/editorBreadcrumbs/index.ts +10 -6
  162. package/src/editorBreadcrumbs/widget.ts +23 -17
  163. package/src/editorIndent/index.ts +17 -23
  164. package/src/fileBrowser/commands.ts +119 -96
  165. package/src/fileBrowser/contents.ts +3 -0
  166. package/src/fileBrowser/dragAndDrop.ts +17 -7
  167. package/src/fileBrowser/fileBrowser.tsx +86 -230
  168. package/src/fileBrowser/gitStatus.ts +36 -33
  169. package/src/fileBrowser/gitignore.ts +4 -25
  170. package/src/fileBrowser/icons.ts +25 -80
  171. package/src/fileBrowser/index.ts +2 -4
  172. package/src/fileBrowser/widget.tsx +171 -50
  173. package/src/fileTypeIcons/index.ts +0 -10
  174. package/src/git/api.ts +10 -36
  175. package/src/git/askRequest.ts +6 -20
  176. package/src/git/commands.ts +83 -11
  177. package/src/git/diffModel.ts +25 -0
  178. package/src/git/diffPreferences.ts +192 -0
  179. package/src/git/diffProvider.tsx +11 -2
  180. package/src/git/diffSurface.tsx +165 -286
  181. package/src/git/diffTheme.ts +24 -0
  182. package/src/git/diffWidget.tsx +194 -134
  183. package/src/git/imageDiff.tsx +56 -84
  184. package/src/git/index.ts +54 -10
  185. package/src/git/notebookDiff.tsx +214 -240
  186. package/src/git/tokens.ts +73 -31
  187. package/src/highlight/index.ts +10 -41
  188. package/src/index.ts +0 -9
  189. package/src/launcher/agents.ts +64 -95
  190. package/src/launcher/availability.ts +3 -9
  191. package/src/launcher/commands.ts +14 -51
  192. package/src/launcher/dashboard.tsx +49 -88
  193. package/src/launcher/editorRegistry.ts +21 -29
  194. package/src/launcher/editors.ts +39 -58
  195. package/src/launcher/icons.ts +5 -39
  196. package/src/launcher/index.ts +12 -55
  197. package/src/launcher/invocation.ts +7 -22
  198. package/src/launcher/registry.ts +9 -7
  199. package/src/launcher/tokens.ts +10 -22
  200. package/src/menuBar/index.ts +11 -28
  201. package/src/menus/index.ts +14 -30
  202. package/src/omnibox/files.ts +10 -14
  203. package/src/omnibox/index.ts +9 -27
  204. package/src/omnibox/model.ts +50 -38
  205. package/src/omnibox/recents.ts +17 -22
  206. package/src/omnibox/tokens.ts +5 -10
  207. package/src/omnibox/widget.tsx +14 -19
  208. package/src/searchReplace/index.ts +7 -27
  209. package/src/showOutput/index.ts +6 -22
  210. package/src/sidebar/index.ts +20 -12
  211. package/src/terminalNotifications/index.ts +42 -25
  212. package/src/terminals/agentTerminals.ts +25 -49
  213. package/src/terminals/detection.ts +4 -8
  214. package/src/terminals/index.ts +12 -101
  215. package/src/terminals/model.ts +130 -246
  216. package/src/terminals/tokens.ts +11 -22
  217. package/src/terminals/widget.tsx +48 -31
  218. package/src/topBar/icons.ts +3 -8
  219. package/src/topBar/index.ts +21 -44
  220. package/src/walkthrough/index.ts +6 -20
  221. package/src/walkthrough/panel.ts +40 -10
  222. package/style/about.css +2 -7
  223. package/style/askAgent.css +8 -40
  224. package/style/base.css +9 -45
  225. package/style/chrome.css +108 -308
  226. package/style/commandBar.css +4 -20
  227. package/style/customPanel.css +1 -4
  228. package/style/git.css +26 -186
  229. package/style/highlight.css +1 -3
  230. package/style/launcher.css +6 -70
  231. package/style/omnibox.css +2 -14
  232. package/style/showOutput.css +0 -6
  233. package/style/sidebar.css +29 -9
  234. package/style/tabs.css +5 -13
  235. package/style/terminals.css +6 -53
  236. package/style/topBar.css +2 -22
  237. package/style/walkthrough.css +0 -8
@@ -1,32 +1,10 @@
1
1
  import { LabIcon } from '@jupyterlab/ui-components';
2
2
  /**
3
- * Brand icons for the agent launcher cards. Most marks are taken verbatim
4
- * from `jupyter-ai-contrib/jupyter-ai-acp-client`
5
- * (`jupyter_ai_acp_client/static/*.svg`, BSD-3-Clause); Antigravity post-dates
6
- * that set, so its mark is the official glyph from `@lobehub/icons-static-svg`
7
- * (MIT) — we ship the brand-colored `antigravity-color` variant so Antigravity
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
@@ -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. Replaces the stock JupyterLab launcher
19
- * (which is disabled via `package.json`'s `jupyterlab.disabledExtensions`)
20
- * with an agent-focused dashboard: an optional initial prompt, a row of
21
- * agent buttons (Claude, Codex, Antigravity, …), and a collapsible list of
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
- // When an agent command returns a Widget that ends up in the main
115
- // area, slot it where this launcher used to sit so opening an
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
- // Hide the close button when the launcher is the only thing in the
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
- // Layout has settled by the time `app.restored` resolves; if it's
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`, except entries that opt out via
192
- * `requireAvailable: false` (e.g. shell aliases the user wants surfaced
193
- * regardless). `available` is the resolved set from
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
- * Returns the next unique launcher widget id.
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
- * When `prompt` is empty (or whitespace-only), this is just `agent.command`.
5
- * When non-empty, the prompt is shell-quoted and spliced in using the
6
- * agent's `promptArgs` recipe — see `IAgent.promptArgs` for the encoding.
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 so it can be safely passed as a single argument on a
3
- * bash/zsh command line that is *typed into an interactive terminal* —
4
- * not the usual file-parsing context.
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
- * When `prompt` is empty (or whitespace-only), this is just `agent.command`.
26
- * When non-empty, the prompt is shell-quoted and spliced in using the
27
- * agent's `promptArgs` recipe — see `IAgent.promptArgs` for the encoding.
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
- * The concrete {@link IAgentRegistry} the launcher plugin provides on the
6
- * `IAgentRegistry` token. Holds the active agent list and re-emits `changed`
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. Called by the launcher
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;
@@ -1,25 +1,27 @@
1
1
  import { Signal } from '@lumino/signaling';
2
2
  /**
3
- * The concrete {@link IAgentRegistry} the launcher plugin provides on the
4
- * `IAgentRegistry` token. Holds the active agent list and re-emits `changed`
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. Called by the launcher
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;
@@ -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
- * The launcher plugin owns the agent list — xtralab's defaults merged with
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, already filtered by availability and sorted by
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 (e.g. the user edits the
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` and
30
- * consumed — optionally, so the panel still works when the launcher is
31
- * disabled — by `xtralab:terminals`.
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 JupyterLab command id that launches a given agent in a new terminal.
36
- * Defined here — in the shared contract module rather than the launcher's
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;
@@ -1,16 +1,13 @@
1
1
  import { Token } from '@lumino/coreutils';
2
2
  /**
3
- * DI token for {@link IAgentRegistry}. Provided by `xtralab:launcher` and
4
- * consumed — optionally, so the panel still works when the launcher is
5
- * disabled — by `xtralab:terminals`.
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 JupyterLab command id that launches a given agent in a new terminal.
10
- * Defined here — in the shared contract module rather than the launcher's
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}`;
@@ -1,15 +1,8 @@
1
1
  import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
2
  /**
3
- * Collapse the main menu bar into a compact menu button.
4
- *
5
- * The menu bar is hidden and a hamburger button in the top bar opens the same
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;
@@ -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
- * How long after the popup closes a button press still counts as "close
14
- * only". An open Lumino menu closes itself on any outside press from a
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 compact menu button.
22
- *
23
- * The menu bar is hidden and a hamburger button in the top bar opens the same
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
- // The classic bar is on screen; behave like keyboard menu
68
- // activation instead of opening a redundant popup that would
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
- // One popup instance, rebuilt from the bar's current menus on every
78
- // open so runtime menu changes stay reflected. It is a plain Lumino
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 (and the
157
- // button was never added) — reveal the stock bar rather than leave
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
  });
@@ -1,14 +1,8 @@
1
1
  import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
2
  /**
3
- * Hide the "Run" and "Kernel" top-level menus while no kernel-using widget
4
- * is open in the main area. The agent-first launcher does not use kernels,
5
- * so showing those menus on a fresh workspace surfaces commands the user
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;
@@ -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 "Run" and "Kernel" top-level menus while no kernel-using widget
6
- * is open in the main area. The agent-first launcher does not use kernels,
7
- * so showing those menus on a fresh workspace surfaces commands the user
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 (IRunMenu, IKernelMenu) extend IRankedMenu, but
23
- // the concrete instances are RankedMenu/Menu — cast so we can hand them
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
- // Capture the schema-assigned ranks so the menus reappear in their
29
- // original slots between View (rank 3) and Tabs (rank 500). Falling
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
- // Don't go through `mainMenu.addMenu`: it picks the insertion index
39
- // from a private `_items` array that `removeMenu` doesn't update,
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 widget in the main area exposes a `sessionContext` — the
67
- * shared marker for NotebookPanel, ConsolePanel, and kernel-attached file
68
- * editors. We don't import their concrete types because that would drag
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` into `menuBar` at the position dictated by `rank`, using
86
- * the existing menus' ranks to find the slot. Menus without a numeric
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;
@@ -1,7 +1,5 @@
1
1
  /**
2
- * The workspace file list, cached briefly so reopening the omnibox in quick
3
- * succession reuses one scan. A failed fetch (e.g. quickopen's server
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[]>;