@leanandmean/coding-agent 0.74.1-scramjet.15 → 0.74.1-scramjet.17

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 (38) hide show
  1. package/README.md +1 -1
  2. package/dist/core/extensions/runner.d.ts.map +1 -1
  3. package/dist/core/extensions/runner.js +1 -0
  4. package/dist/core/extensions/runner.js.map +1 -1
  5. package/dist/core/extensions/types.d.ts +2 -0
  6. package/dist/core/extensions/types.d.ts.map +1 -1
  7. package/dist/core/extensions/types.js.map +1 -1
  8. package/dist/core/settings-manager.d.ts.map +1 -1
  9. package/dist/core/settings-manager.js +8 -0
  10. package/dist/core/settings-manager.js.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  16. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  17. package/dist/modes/interactive/interactive-mode.js +65 -12
  18. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  19. package/dist/modes/interactive/theme/{dark.json → pi-dark.json} +1 -1
  20. package/dist/modes/interactive/theme/{light.json → pi-light.json} +1 -1
  21. package/dist/modes/interactive/theme/theme.d.ts +7 -2
  22. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  23. package/dist/modes/interactive/theme/theme.js +54 -15
  24. package/dist/modes/interactive/theme/theme.js.map +1 -1
  25. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  26. package/dist/modes/rpc/rpc-mode.js +4 -0
  27. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  28. package/docs/themes.md +23 -10
  29. package/examples/extensions/mac-system-theme.ts +3 -2
  30. package/package.json +1 -1
  31. package/dist/utils/pi-user-agent.d.ts +0 -2
  32. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  33. package/dist/utils/pi-user-agent.js +0 -5
  34. package/dist/utils/pi-user-agent.js.map +0 -1
  35. package/dist/utils/user-agent.d.ts +0 -2
  36. package/dist/utils/user-agent.d.ts.map +0 -1
  37. package/dist/utils/user-agent.js +0 -6
  38. package/dist/utils/user-agent.js.map +0 -1
@@ -58,7 +58,7 @@ import { TreeSelectorComponent } from "./components/tree-selector.js";
58
58
  import { UserMessageComponent } from "./components/user-message.js";
59
59
  import { UserMessageSelectorComponent } from "./components/user-message-selector.js";
60
60
  import { NspellProvider } from "./spellcheck.js";
61
- import { classifyBackgroundColor, detectThemeFromEnvironment, getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, initTheme, onThemeChange, setRegisteredThemes, setTheme, setThemeInstance, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
61
+ import { classifyBackgroundColor, detectThemeFromEnvironment, getAvailableThemes, getAvailableThemesWithPaths, getCurrentThemeName, getEditorTheme, getMarkdownTheme, getThemeByName, initTheme, onThemeChange, resolveThemeName, setRegisteredThemes, setTheme, setThemeInstance, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
62
62
  function isExpandable(obj) {
63
63
  return typeof obj === "object" && obj !== null && "setExpanded" in obj && typeof obj.setExpanded === "function";
64
64
  }
@@ -127,6 +127,11 @@ export class InteractiveMode {
127
127
  loadingAnimation = undefined;
128
128
  workingMessage = undefined;
129
129
  workingVisible = true;
130
+ // SCRAMJET-DIVERGENCE: title provider for extension-owned terminal titles.
131
+ titleProvider = undefined;
132
+ // SCRAMJET-DIVERGENCE: captured terminal classification (env-seeded in the constructor, updated
133
+ // by the OSC 11 query) used to re-resolve the default theme once extension themes register.
134
+ detectedClassification = undefined;
130
135
  workingIndicatorOptions = undefined;
131
136
  defaultWorkingMessage = "Working...";
132
137
  defaultHiddenThinkingLabel = "Thinking...";
@@ -238,8 +243,32 @@ export class InteractiveMode {
238
243
  this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();
239
244
  // Register themes from resource loader and initialize
240
245
  setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
246
+ // SCRAMJET-DIVERGENCE: capture the env classification so the post-extension-bind reapplication
247
+ // can honor COLORFGBG/Apple-Terminal-detected (never-OSC) terminals. Without this seed, those
248
+ // terminals would resolve the dark branch and clobber light terminals to scramjet-dark.
249
+ this.detectedClassification = detectThemeFromEnvironment()?.theme;
241
250
  initTheme(this.settingsManager.getTheme(), true);
242
251
  }
252
+ // SCRAMJET-DIVERGENCE: re-resolve the theme after extension themes register (or after a reload),
253
+ // so scramjet-dark can take effect once it becomes available. An explicit user setting still wins
254
+ // via the resolver; the captured classification (env-seeded + OSC-updated) drives auto-detection.
255
+ // Skips the apply when the resolved name already matches the active theme, unless `force` is set:
256
+ // the reload path forces a re-read from disk (registered extension themes have no file watcher, so
257
+ // /reload is their only refresh path even when the active theme's name is unchanged).
258
+ reapplyResolvedTheme(force = false) {
259
+ const name = resolveThemeName({
260
+ explicitSetting: this.settingsManager.getTheme(),
261
+ detectedClassification: this.detectedClassification,
262
+ hasScramjetDark: getAvailableThemes().includes("scramjet-dark"),
263
+ });
264
+ if (!force && name === getCurrentThemeName()) {
265
+ return;
266
+ }
267
+ const result = setTheme(name, true);
268
+ if (!result.success) {
269
+ this.showError(`Failed to load theme "${name}": ${result.error}\nFell back to pi-dark theme.`);
270
+ }
271
+ }
243
272
  getAutocompleteSourceTag(sourceInfo) {
244
273
  if (!sourceInfo) {
245
274
  return undefined;
@@ -425,10 +454,11 @@ export class InteractiveMode {
425
454
  if (!this.settingsManager.getTheme() && !detectThemeFromEnvironment()) {
426
455
  const rgb = await this.ui.queryTerminalBackgroundColor({ timeoutMs: 100 });
427
456
  if (rgb) {
428
- const detected = classifyBackgroundColor(rgb);
429
- if (detected !== "dark") {
430
- setTheme(detected);
431
- }
457
+ // SCRAMJET-DIVERGENCE: capture the OSC 11 classification and resolve through the shared
458
+ // resolver so a dark terminal maps to scramjet-dark (when available) and a light one to
459
+ // pi-light. Skips the apply when the resolved name is already active.
460
+ this.detectedClassification = classifyBackgroundColor(rgb);
461
+ this.reapplyResolvedTheme();
432
462
  }
433
463
  }
434
464
  // Build themed header content (after theme detection so colors are correct)
@@ -497,6 +527,20 @@ export class InteractiveMode {
497
527
  * Update terminal title with session name and cwd.
498
528
  */
499
529
  updateTerminalTitle() {
530
+ // SCRAMJET-DIVERGENCE: delegate to title provider when set.
531
+ if (this.titleProvider) {
532
+ let title;
533
+ try {
534
+ title = this.titleProvider();
535
+ }
536
+ catch {
537
+ // Provider failed; fall through to default title
538
+ }
539
+ if (title !== undefined) {
540
+ this.ui.terminal.setTitle(title);
541
+ return;
542
+ }
543
+ }
500
544
  const cwdBasename = path.basename(this.sessionManager.getCwd());
501
545
  const sessionName = this.sessionManager.getSessionName();
502
546
  if (sessionName) {
@@ -1151,6 +1195,9 @@ export class InteractiveMode {
1151
1195
  },
1152
1196
  });
1153
1197
  setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
1198
+ // SCRAMJET-DIVERGENCE: extension themes (e.g. scramjet-dark) register after the constructor's
1199
+ // initTheme, so re-resolve now that they are available.
1200
+ this.reapplyResolvedTheme();
1154
1201
  this.setupAutocompleteProvider();
1155
1202
  const extensionRunner = this.session.extensionRunner;
1156
1203
  this.setupExtensionShortcuts(extensionRunner);
@@ -1404,6 +1451,7 @@ export class InteractiveMode {
1404
1451
  this.setCustomEditorComponent(undefined);
1405
1452
  this.setupAutocompleteProvider();
1406
1453
  this.defaultEditor.onExtensionShortcut = undefined;
1454
+ this.titleProvider = undefined;
1407
1455
  this.updateTerminalTitle();
1408
1456
  this.workingMessage = undefined;
1409
1457
  this.workingVisible = true;
@@ -1546,6 +1594,10 @@ export class InteractiveMode {
1546
1594
  setFooter: (factory) => this.setExtensionFooter(factory),
1547
1595
  setHeader: (factory) => this.setExtensionHeader(factory),
1548
1596
  setTitle: (title) => this.ui.terminal.setTitle(title),
1597
+ setTitleProvider: (provider) => {
1598
+ this.titleProvider = provider;
1599
+ this.updateTerminalTitle();
1600
+ },
1549
1601
  custom: (factory, options) => this.showExtensionCustom(factory, options),
1550
1602
  pasteToEditor: (text) => this.editor.handleInput(`\x1b[200~${text}\x1b[201~`),
1551
1603
  setEditorText: (text) => this.editor.setText(text),
@@ -3168,7 +3220,8 @@ export class InteractiveMode {
3168
3220
  transport: this.settingsManager.getTransport(),
3169
3221
  thinkingLevel: this.session.thinkingLevel,
3170
3222
  availableThinkingLevels: this.session.getAvailableThinkingLevels(),
3171
- currentTheme: this.settingsManager.getTheme() || "dark",
3223
+ // SCRAMJET-DIVERGENCE: display fallback routed to the renamed builtin.
3224
+ currentTheme: this.settingsManager.getTheme() || "pi-dark",
3172
3225
  availableThemes: getAvailableThemes(),
3173
3226
  hideThinkingBlock: this.hideThinkingBlock,
3174
3227
  collapseChangelog: this.settingsManager.getCollapseChangelog(),
@@ -3233,7 +3286,8 @@ export class InteractiveMode {
3233
3286
  this.settingsManager.setTheme(themeName);
3234
3287
  this.ui.invalidate();
3235
3288
  if (!result.success) {
3236
- this.showError(`Failed to load theme "${themeName}": ${result.error}\nFell back to dark theme.`);
3289
+ // SCRAMJET-DIVERGENCE: fallback message names the renamed builtin.
3290
+ this.showError(`Failed to load theme "${themeName}": ${result.error}\nFell back to pi-dark theme.`);
3237
3291
  }
3238
3292
  },
3239
3293
  onThemePreview: (themeName) => {
@@ -4044,11 +4098,10 @@ export class InteractiveMode {
4044
4098
  }
4045
4099
  setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
4046
4100
  this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();
4047
- const themeName = this.settingsManager.getTheme();
4048
- const themeResult = themeName ? setTheme(themeName, true) : { success: true };
4049
- if (!themeResult.success) {
4050
- this.showError(`Failed to load theme "${themeName}": ${themeResult.error}\nFell back to dark theme.`);
4051
- }
4101
+ // SCRAMJET-DIVERGENCE: re-resolve through the resolver after reload so newly registered
4102
+ // themes (and the captured classification) are honored; force a re-read since reload's purpose
4103
+ // is to pick up on-disk theme edits even when the active theme's name is unchanged.
4104
+ this.reapplyResolvedTheme(true);
4052
4105
  const editorPaddingX = this.settingsManager.getEditorPaddingX();
4053
4106
  const autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();
4054
4107
  this.defaultEditor.setPaddingX(editorPaddingX);