@ngandu/ulicode 0.1.0 → 0.1.1

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.
@@ -1,7 +1,7 @@
1
1
  import { loadSettingsCached, lspManager, loadAgentDefinitionsCached, getAvailableModePacks, resolveThreadActiveModelPackId, saveSettings, getModePackOptions, getAvailableOmPacks, ONBOARDING_VERSION, getSubagentModeMap, THREAD_ACTIVE_MODEL_PACK_ID_KEY, ThreadLockError, logRuntimeProfile, formatAgentDefinitionDiagnostics, getCustomProviderId, getAllowedSubagentIdsForMode, getSubagentOwnerModes, toCustomProviderModelId } from './chunk-ZYL5HA65.js';
2
2
  import { getOAuthProviders, detectProject, getUserId, getCurrentGitBranch, PROVIDER_DEFAULT_MODELS, getAppDataDir } from './chunk-3YYDXNUH.js';
3
3
  import { MC_TOOLS, getToolCategory, TOOL_CATEGORIES } from './chunk-MS5RYNRK.js';
4
- import { Box, Text, Spacer, Input, Container, fuzzyFilter, getEditorKeybindings, Markdown, ProcessTerminal, TUI, Editor, matchesKey, CombinedAutocompleteProvider, SelectList, visibleWidth, SettingsList, isKeyRelease } from '@mariozechner/pi-tui';
4
+ import { Box, Text, Spacer, Input, Container, fuzzyFilter, getEditorKeybindings, Markdown, ProcessTerminal, TUI, isKeyRelease, Editor, matchesKey, CombinedAutocompleteProvider, SelectList, visibleWidth, SettingsList } from '@mariozechner/pi-tui';
5
5
  import * as path5 from 'path';
6
6
  import path5__default, { resolve, extname, join, relative, sep } from 'path';
7
7
  import chalk from 'chalk';
@@ -21,6 +21,37 @@ import { fileURLToPath } from 'url';
21
21
  // src/auth/claude-max-warning.ts
22
22
  var ANTHROPIC_OAUTH_PROVIDER_ID = "anthropic";
23
23
  var CLAUDE_MAX_OAUTH_WARNING_MESSAGE = "OAuth with a Claude Max plan is a grey area. Anthropic has reportedly banned users for using Claude max credentials outside of Claude Code, and it may violate Anthropic Terms of Service. Proceed at your own risk.";
24
+ var KITTY_CSI_U_REGEX = new RegExp("^\\x1b\\[(\\d+)(?::(\\d*))?(?::(\\d+))?(?:;(\\d+))?(?::(\\d+))?u$");
25
+ var KITTY_MOD_SHIFT = 1;
26
+ var KITTY_MOD_ALT = 2;
27
+ var KITTY_MOD_CTRL = 4;
28
+ function decodeKittyPrintableInput(data) {
29
+ const match = data.match(KITTY_CSI_U_REGEX);
30
+ if (!match) return void 0;
31
+ const codepoint = Number.parseInt(match[1] ?? "", 10);
32
+ if (!Number.isFinite(codepoint)) return void 0;
33
+ const shiftedKey = match[2] && match[2].length > 0 ? Number.parseInt(match[2], 10) : void 0;
34
+ const modValue = match[4] ? Number.parseInt(match[4], 10) : 1;
35
+ const modifier = Number.isFinite(modValue) ? modValue - 1 : 0;
36
+ if ((modifier & -194) !== 0) return void 0;
37
+ if (modifier & (KITTY_MOD_ALT | KITTY_MOD_CTRL)) return void 0;
38
+ let effectiveCodepoint = codepoint;
39
+ if (modifier & KITTY_MOD_SHIFT && typeof shiftedKey === "number") {
40
+ effectiveCodepoint = shiftedKey;
41
+ }
42
+ if (!Number.isFinite(effectiveCodepoint) || effectiveCodepoint < 32) return void 0;
43
+ try {
44
+ return String.fromCodePoint(effectiveCodepoint);
45
+ } catch {
46
+ return void 0;
47
+ }
48
+ }
49
+ function normalizeTerminalTextInput(data) {
50
+ if (isKeyRelease(data)) {
51
+ return void 0;
52
+ }
53
+ return decodeKittyPrintableInput(data) ?? data;
54
+ }
24
55
  var currentThemeMode = "dark";
25
56
  function getThemeMode() {
26
57
  return currentThemeMode;
@@ -389,15 +420,17 @@ var AskQuestionInlineComponent = class extends Container {
389
420
  }
390
421
  handleInput(data) {
391
422
  if (this.answered) return;
423
+ const normalized = normalizeTerminalTextInput(data);
424
+ if (normalized === void 0) return;
392
425
  if (this.selectList) {
393
- this.selectList.handleInput(data);
426
+ this.selectList.handleInput(normalized);
394
427
  } else if (this.input) {
395
428
  const kb = getEditorKeybindings();
396
429
  if (kb.matches(data, "selectCancel")) {
397
430
  this.handleCancel();
398
431
  return;
399
432
  }
400
- this.input.handleInput(data);
433
+ this.input.handleInput(normalized);
401
434
  }
402
435
  }
403
436
  };
@@ -926,7 +959,7 @@ var OnboardingInlineComponent = class extends Container {
926
959
 
927
960
  // package.json
928
961
  var package_default = {
929
- version: "0.1.0"};
962
+ version: "0.1.1"};
930
963
 
931
964
  // src/version.ts
932
965
  var APP_VERSION = package_default.version;
@@ -2322,6 +2355,10 @@ var ThreadSelectorComponent = class extends Box {
2322
2355
  }
2323
2356
  handleInput(keyData) {
2324
2357
  const kb = getEditorKeybindings();
2358
+ const normalized = normalizeTerminalTextInput(keyData);
2359
+ if (normalized === void 0) {
2360
+ return;
2361
+ }
2325
2362
  if (kb.matches(keyData, "selectUp")) {
2326
2363
  if (this.filteredThreads.length === 0) return;
2327
2364
  this.selectedIndex = this.selectedIndex === 0 ? this.filteredThreads.length - 1 : this.selectedIndex - 1;
@@ -2339,13 +2376,13 @@ var ThreadSelectorComponent = class extends Box {
2339
2376
  }
2340
2377
  } else if (kb.matches(keyData, "selectCancel")) {
2341
2378
  this.onCancelCallback();
2342
- } else if (keyData === "c" && this.onCloneCallback && !this.searchInput.getValue()) {
2379
+ } else if (normalized === "c" && this.onCloneCallback && !this.searchInput.getValue()) {
2343
2380
  const selected = this.filteredThreads[this.selectedIndex];
2344
2381
  if (selected) {
2345
2382
  this.onCloneCallback(selected);
2346
2383
  }
2347
2384
  } else {
2348
- this.searchInput.handleInput(keyData);
2385
+ this.searchInput.handleInput(normalized);
2349
2386
  this.filterThreads(this.searchInput.getValue());
2350
2387
  this.tui.requestRender();
2351
2388
  }
@@ -2792,6 +2829,10 @@ var ModelSelectorComponent = class extends Box {
2792
2829
  }
2793
2830
  handleInput(keyData) {
2794
2831
  const kb = getEditorKeybindings();
2832
+ const normalized = normalizeTerminalTextInput(keyData);
2833
+ if (normalized === void 0) {
2834
+ return;
2835
+ }
2795
2836
  const totalItems = this.filteredModels.length + (this.hasCustomItem ? 1 : 0);
2796
2837
  if (kb.matches(keyData, "selectUp")) {
2797
2838
  if (totalItems === 0) return;
@@ -2815,7 +2856,7 @@ var ModelSelectorComponent = class extends Box {
2815
2856
  } else if (kb.matches(keyData, "selectCancel")) {
2816
2857
  this.onCancelCallback();
2817
2858
  } else {
2818
- this.searchInput.handleInput(keyData);
2859
+ this.searchInput.handleInput(normalized);
2819
2860
  this.filterModels(this.searchInput.getValue());
2820
2861
  this.tui.requestRender();
2821
2862
  }
@@ -4341,34 +4382,8 @@ function parseTokenInput(input) {
4341
4382
  }
4342
4383
  return num;
4343
4384
  }
4344
- var KITTY_CSI_U_REGEX = new RegExp("^\\x1b\\[(\\d+)(?::(\\d*))?(?::(\\d+))?(?:;(\\d+))?(?::(\\d+))?u$");
4345
- var KITTY_MOD_SHIFT = 1;
4346
- var KITTY_MOD_ALT = 2;
4347
- var KITTY_MOD_CTRL = 4;
4348
- function decodeKittyPrintable(data) {
4349
- const match = data.match(KITTY_CSI_U_REGEX);
4350
- if (!match) return void 0;
4351
- const codepoint = Number.parseInt(match[1] ?? "", 10);
4352
- if (!Number.isFinite(codepoint)) return void 0;
4353
- const shiftedKey = match[2] && match[2].length > 0 ? Number.parseInt(match[2], 10) : void 0;
4354
- const modValue = match[4] ? Number.parseInt(match[4], 10) : 1;
4355
- const modifier = Number.isFinite(modValue) ? modValue - 1 : 0;
4356
- if ((modifier & -194) !== 0) return void 0;
4357
- if (modifier & (KITTY_MOD_ALT | KITTY_MOD_CTRL)) return void 0;
4358
- let effectiveCodepoint = codepoint;
4359
- if (modifier & KITTY_MOD_SHIFT && typeof shiftedKey === "number") {
4360
- effectiveCodepoint = shiftedKey;
4361
- }
4362
- if (!Number.isFinite(effectiveCodepoint) || effectiveCodepoint < 32) return void 0;
4363
- try {
4364
- return String.fromCodePoint(effectiveCodepoint);
4365
- } catch {
4366
- return void 0;
4367
- }
4368
- }
4369
4385
  function normalizeSearchInput(data) {
4370
- const kittyPrintable = decodeKittyPrintable(data);
4371
- return kittyPrintable ?? data;
4386
+ return normalizeTerminalTextInput(data) ?? data;
4372
4387
  }
4373
4388
  var ThresholdSubmenu = class extends Container {
4374
4389
  input;
@@ -5129,12 +5144,14 @@ var LoginDialogComponent = class extends Box {
5129
5144
  this.tui.requestRender();
5130
5145
  }
5131
5146
  handleInput(data) {
5147
+ const normalized = normalizeTerminalTextInput(data);
5148
+ if (normalized === void 0) return;
5132
5149
  const kb = getEditorKeybindings();
5133
5150
  if (kb.matches(data, "selectCancel")) {
5134
5151
  this.cancel();
5135
5152
  return;
5136
5153
  }
5137
- this.input.handleInput(data);
5154
+ this.input.handleInput(normalized);
5138
5155
  }
5139
5156
  };
5140
5157
 
@@ -6114,6 +6131,10 @@ var ProjectFileSelectorComponent = class extends Box {
6114
6131
  }
6115
6132
  handleInput(keyData) {
6116
6133
  const kb = getEditorKeybindings();
6134
+ const normalized = normalizeTerminalTextInput(keyData);
6135
+ if (normalized === void 0) {
6136
+ return;
6137
+ }
6117
6138
  if (kb.matches(keyData, "selectUp")) {
6118
6139
  if (this.filteredFiles.length === 0) return;
6119
6140
  this.selectedIndex = this.selectedIndex === 0 ? this.filteredFiles.length - 1 : this.selectedIndex - 1;
@@ -6139,7 +6160,7 @@ var ProjectFileSelectorComponent = class extends Box {
6139
6160
  this.onCancelCallback();
6140
6161
  return;
6141
6162
  }
6142
- this.searchInput.handleInput(keyData);
6163
+ this.searchInput.handleInput(normalized);
6143
6164
  this.filterFiles(this.searchInput.getValue());
6144
6165
  this.tui.requestRender();
6145
6166
  }
@@ -8455,15 +8476,17 @@ var AskQuestionDialogComponent = class extends Box {
8455
8476
  this.addChild(new Text(theme.fg("dim", " Enter to submit \xB7 Esc to skip"), 0, 0));
8456
8477
  }
8457
8478
  handleInput(data) {
8479
+ const normalized = normalizeTerminalTextInput(data);
8480
+ if (normalized === void 0) return;
8458
8481
  if (this.selectList) {
8459
- this.selectList.handleInput(data);
8482
+ this.selectList.handleInput(normalized);
8460
8483
  } else if (this.input) {
8461
8484
  const kb = getEditorKeybindings();
8462
8485
  if (kb.matches(data, "selectCancel")) {
8463
8486
  this.onCancel();
8464
8487
  return;
8465
8488
  }
8466
- this.input.handleInput(data);
8489
+ this.input.handleInput(normalized);
8467
8490
  }
8468
8491
  }
8469
8492
  };
@@ -8596,15 +8619,17 @@ var PlanApprovalInlineComponent = class extends Container {
8596
8619
  }
8597
8620
  handleInput(data) {
8598
8621
  if (this.resolved) return;
8622
+ const normalized = normalizeTerminalTextInput(data);
8623
+ if (normalized === void 0) return;
8599
8624
  if (this.mode === "feedback" && this.feedbackInput) {
8600
8625
  const kb = getEditorKeybindings();
8601
8626
  if (kb.matches(data, "selectCancel")) {
8602
8627
  this.handleReject();
8603
8628
  return;
8604
8629
  }
8605
- this.feedbackInput.handleInput(data);
8630
+ this.feedbackInput.handleInput(normalized);
8606
8631
  } else if (this.selectList) {
8607
- this.selectList.handleInput(data);
8632
+ this.selectList.handleInput(normalized);
8608
8633
  }
8609
8634
  }
8610
8635
  };
@@ -10891,7 +10916,11 @@ var CustomEditor = class extends Editor {
10891
10916
  if (this.maybeHandleBracketedPaste(data)) {
10892
10917
  return;
10893
10918
  }
10894
- if (data === "#") {
10919
+ const normalized = normalizeTerminalTextInput(data);
10920
+ if (normalized === void 0) {
10921
+ return;
10922
+ }
10923
+ if (normalized === "#") {
10895
10924
  this.onOpenFileSelector?.();
10896
10925
  return;
10897
10926
  }
@@ -10977,7 +11006,7 @@ var CustomEditor = class extends Editor {
10977
11006
  return;
10978
11007
  }
10979
11008
  }
10980
- super.handleInput(data);
11009
+ super.handleInput(normalized);
10981
11010
  }
10982
11011
  };
10983
11012
 
@@ -11942,5 +11971,5 @@ var LoginSelectorComponent = class extends Box {
11942
11971
  };
11943
11972
 
11944
11973
  export { AssistantMessageComponent, LoginDialogComponent, LoginSelectorComponent, MastraTUI, ModelSelectorComponent, OMProgressComponent, ToolExecutionComponentEnhanced, UserMessageComponent, applyThemeMode, createTUIState, detectTerminalTheme, formatOMStatus, getCurrentVersion, getEditorTheme, getMarkdownTheme, getThemeMode, mastra, mastraBrand, theme };
11945
- //# sourceMappingURL=chunk-UOC6NARF.js.map
11946
- //# sourceMappingURL=chunk-UOC6NARF.js.map
11974
+ //# sourceMappingURL=chunk-LLL4SZZO.js.map
11975
+ //# sourceMappingURL=chunk-LLL4SZZO.js.map