@maria_rcks/t1code 0.0.7 → 0.0.8

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 (2) hide show
  1. package/dist/index.mjs +256 -164
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -32430,7 +32430,7 @@ var WsTransport = class {
32430
32430
 
32431
32431
  //#endregion
32432
32432
  //#region package.json
32433
- var version = "0.0.7";
32433
+ var version = "0.0.8";
32434
32434
 
32435
32435
  //#endregion
32436
32436
  //#region src/composerAction.ts
@@ -32447,6 +32447,47 @@ function parseStandaloneComposerModeCommand(text) {
32447
32447
  return match[1]?.toLowerCase() === "plan" ? "plan" : "default";
32448
32448
  }
32449
32449
 
32450
+ //#endregion
32451
+ //#region src/composerControlLabels.ts
32452
+ function formatReasoningEffortLabel(effort) {
32453
+ if (effort === "none") return "No reasoning";
32454
+ if (effort === "xhigh") return "Extra High";
32455
+ if (effort === "max") return "Max";
32456
+ if (effort === "ultrathink") return "Ultrathink";
32457
+ return effort.slice(0, 1).toUpperCase() + effort.slice(1);
32458
+ }
32459
+ function truncateToolbarLabel(label, maxLength) {
32460
+ if (label.length <= maxLength) return label;
32461
+ if (maxLength <= 1) return "…";
32462
+ return `${label.slice(0, maxLength - 1).trimEnd()}…`;
32463
+ }
32464
+
32465
+ //#endregion
32466
+ //#region src/composerSync.ts
32467
+ function createDeferredComposerSyncState() {
32468
+ return {
32469
+ version: 0,
32470
+ timeoutId: null
32471
+ };
32472
+ }
32473
+ function invalidateDeferredComposerSync(state, clearTimeoutImpl = clearTimeout) {
32474
+ state.version += 1;
32475
+ if (state.timeoutId !== null) {
32476
+ clearTimeoutImpl(state.timeoutId);
32477
+ state.timeoutId = null;
32478
+ }
32479
+ }
32480
+ function scheduleDeferredComposerSync(input) {
32481
+ const { state, onSync, setTimeoutImpl = setTimeout, clearTimeoutImpl = clearTimeout } = input;
32482
+ const capturedVersion = state.version;
32483
+ if (state.timeoutId !== null) clearTimeoutImpl(state.timeoutId);
32484
+ state.timeoutId = setTimeoutImpl(() => {
32485
+ state.timeoutId = null;
32486
+ if (capturedVersion !== state.version) return;
32487
+ onSync();
32488
+ }, 0);
32489
+ }
32490
+
32450
32491
  //#endregion
32451
32492
  //#region src/composerSubmit.ts
32452
32493
  const SUPPORTED_INLINE_IMAGE_EXTENSIONS = new Set([
@@ -32647,6 +32688,114 @@ async function saveClipboardImageToFile(directory) {
32647
32688
  return filePath;
32648
32689
  }
32649
32690
 
32691
+ //#endregion
32692
+ //#region src/keyboardBehavior.ts
32693
+ const KEYBINDING_GUIDE_SECTIONS = [
32694
+ {
32695
+ title: "Global",
32696
+ items: [{
32697
+ shortcut: "Esc",
32698
+ action: "Close the active dialog, overlay, or image preview; otherwise open the quit prompt"
32699
+ }, {
32700
+ shortcut: "Esc / Enter",
32701
+ action: "Confirm quit from the exit prompt"
32702
+ }]
32703
+ },
32704
+ {
32705
+ title: "Projects and Threads",
32706
+ items: [
32707
+ {
32708
+ shortcut: "Ctrl+P",
32709
+ action: "Open the add-project prompt"
32710
+ },
32711
+ {
32712
+ shortcut: "Ctrl+N",
32713
+ action: "Create a new thread in the active project"
32714
+ },
32715
+ {
32716
+ shortcut: "Ctrl+B",
32717
+ action: "Toggle the sidebar when space is tight"
32718
+ },
32719
+ {
32720
+ shortcut: "↑ / ↓",
32721
+ action: "Move through projects or threads"
32722
+ },
32723
+ {
32724
+ shortcut: "← / →",
32725
+ action: "Collapse or expand projects, or move focus between panes"
32726
+ },
32727
+ {
32728
+ shortcut: "Enter",
32729
+ action: "Open the focused project or thread action"
32730
+ },
32731
+ {
32732
+ shortcut: "Shift+↑ / Shift+↓",
32733
+ action: "Extend thread selection"
32734
+ },
32735
+ {
32736
+ shortcut: "Delete / Backspace",
32737
+ action: "Delete the focused thread selection",
32738
+ note: "Only works while the thread list is focused."
32739
+ }
32740
+ ]
32741
+ },
32742
+ {
32743
+ title: "Composer",
32744
+ items: [
32745
+ {
32746
+ shortcut: "Enter",
32747
+ action: "Send the current message"
32748
+ },
32749
+ {
32750
+ shortcut: "Shift+Enter",
32751
+ action: "Insert a newline"
32752
+ },
32753
+ {
32754
+ shortcut: "Ctrl+C",
32755
+ action: "Clear the current draft"
32756
+ },
32757
+ {
32758
+ shortcut: "Delete twice",
32759
+ action: "Remove the last attached image from an empty draft"
32760
+ }
32761
+ ]
32762
+ },
32763
+ {
32764
+ title: "Timeline and Diff",
32765
+ items: [
32766
+ {
32767
+ shortcut: "↑ / ↓ / PageUp / PageDown / Home / End / j / k",
32768
+ action: "Scroll the timeline"
32769
+ },
32770
+ {
32771
+ shortcut: "Ctrl+D",
32772
+ action: "Toggle the full diff view"
32773
+ },
32774
+ {
32775
+ shortcut: "v",
32776
+ action: "Toggle unified and split diff view",
32777
+ note: "Only while the diff view is focused."
32778
+ }
32779
+ ]
32780
+ },
32781
+ {
32782
+ title: "Images",
32783
+ items: [{
32784
+ shortcut: "Click image chip",
32785
+ action: "Open the image preview overlay"
32786
+ }, {
32787
+ shortcut: "Esc or click outside",
32788
+ action: "Close the image preview overlay"
32789
+ }]
32790
+ }
32791
+ ];
32792
+ function shouldOpenQuitPromptOnEscape(input) {
32793
+ return input.keyName === "escape" && !input.hasDismissibleLayer;
32794
+ }
32795
+ function shouldClearComposerOnCtrlC(input) {
32796
+ return input.ctrl === true && input.keyName === "c";
32797
+ }
32798
+
32650
32799
  //#endregion
32651
32800
  //#region src/log.ts
32652
32801
  function serializeDetails(details) {
@@ -32674,8 +32823,8 @@ function resolveUserMessageBubbleWidth(_mainPanelColumns) {
32674
32823
  //#endregion
32675
32824
  //#region src/responsiveLayout.ts
32676
32825
  const TUI_SIDEBAR_WIDTH = 34;
32677
- const SIDEBAR_TOGGLE_MAX_MAIN_COLUMNS = 64;
32678
- const SIDEBAR_FORCE_COLLAPSE_MAX_MAIN_COLUMNS = 52;
32826
+ const SIDEBAR_TOGGLE_MAX_MAIN_COLUMNS = 56;
32827
+ const SIDEBAR_FORCE_COLLAPSE_MAX_MAIN_COLUMNS = 44;
32679
32828
  const COMPACT_HEADER_MAX_COLUMNS = 132;
32680
32829
  const COMPOSER_MODE_LABEL_MIN_MAIN_COLUMNS = 44;
32681
32830
  const COMPOSER_MODEL_LABEL_MIN_MAIN_COLUMNS = 62;
@@ -32697,7 +32846,7 @@ function resolveTuiResponsiveLayout(input) {
32697
32846
  showSidebar: !sidebarCollapsed,
32698
32847
  showWindowDots: input.viewportColumns >= COMPACT_HEADER_MAX_COLUMNS,
32699
32848
  showSidebarAlphaBadge: !sidebarCollapsed,
32700
- sidebarTitle: input.viewportColumns >= COMPACT_HEADER_MAX_COLUMNS ? "T1 Code" : "T1",
32849
+ sidebarTitle: !sidebarCollapsed ? "T1 Code" : "T1",
32701
32850
  showHeaderProjectBadge: input.viewportColumns >= 144,
32702
32851
  showComposerModeLabels,
32703
32852
  showComposerModelLabel,
@@ -33502,101 +33651,6 @@ const INSTALL_PROVIDER_SETTINGS = [{
33502
33651
  binaryPlaceholder: "Claude binary path",
33503
33652
  binaryDescription: "Leave blank to use claude from your PATH."
33504
33653
  }];
33505
- const KEYBINDING_GUIDE_SECTIONS = [
33506
- {
33507
- title: "Global",
33508
- items: [{
33509
- shortcut: "Ctrl+C",
33510
- action: "Quit T1 Code"
33511
- }, {
33512
- shortcut: "Esc",
33513
- action: "Close the active dialog, overlay, or image preview"
33514
- }]
33515
- },
33516
- {
33517
- title: "Projects and Threads",
33518
- items: [
33519
- {
33520
- shortcut: "Ctrl+P",
33521
- action: "Open the add-project prompt"
33522
- },
33523
- {
33524
- shortcut: "Ctrl+N",
33525
- action: "Create a new thread in the active project"
33526
- },
33527
- {
33528
- shortcut: "Ctrl+B",
33529
- action: "Toggle the sidebar when space is tight"
33530
- },
33531
- {
33532
- shortcut: "↑ / ↓",
33533
- action: "Move through projects or threads"
33534
- },
33535
- {
33536
- shortcut: "← / →",
33537
- action: "Collapse or expand projects, or move focus between panes"
33538
- },
33539
- {
33540
- shortcut: "Enter",
33541
- action: "Open the focused project or thread action"
33542
- },
33543
- {
33544
- shortcut: "Shift+↑ / Shift+↓",
33545
- action: "Extend thread selection"
33546
- },
33547
- {
33548
- shortcut: "Delete / Backspace",
33549
- action: "Delete the focused thread selection",
33550
- note: "Only works while the thread list is focused."
33551
- }
33552
- ]
33553
- },
33554
- {
33555
- title: "Composer",
33556
- items: [
33557
- {
33558
- shortcut: "Enter",
33559
- action: "Send the current message"
33560
- },
33561
- {
33562
- shortcut: "Shift+Enter",
33563
- action: "Insert a newline"
33564
- },
33565
- {
33566
- shortcut: "Delete twice",
33567
- action: "Remove the last attached image from an empty draft"
33568
- }
33569
- ]
33570
- },
33571
- {
33572
- title: "Timeline and Diff",
33573
- items: [
33574
- {
33575
- shortcut: "↑ / ↓ / PageUp / PageDown / Home / End / j / k",
33576
- action: "Scroll the timeline"
33577
- },
33578
- {
33579
- shortcut: "Ctrl+D",
33580
- action: "Toggle the full diff view"
33581
- },
33582
- {
33583
- shortcut: "v",
33584
- action: "Toggle unified and split diff view",
33585
- note: "Only while the diff view is focused."
33586
- }
33587
- ]
33588
- },
33589
- {
33590
- title: "Images",
33591
- items: [{
33592
- shortcut: "Click image chip",
33593
- action: "Open the image preview overlay"
33594
- }, {
33595
- shortcut: "Esc or click outside",
33596
- action: "Close the image preview overlay"
33597
- }]
33598
- }
33599
- ];
33600
33654
  function buildMessageMarkdownSyntax(palette) {
33601
33655
  return SyntaxStyle.fromStyles({
33602
33656
  keyword: {
@@ -33865,16 +33919,11 @@ function modelControlLabel(provider, model) {
33865
33919
  }
33866
33920
  return resolveModelName(provider, resolvedModel).replace(/^GPT-/i, "GPT ").replace(/-codex$/i, "").replace(/^Claude\s+/i, "").replace(/\s+Codex(?:\s+Spark)?$/i, "").trim();
33867
33921
  }
33868
- function formatReasoningEffortLabel(effort) {
33869
- if (effort === "xhigh") return "Extra High";
33870
- if (effort === "max") return "Max";
33871
- if (effort === "ultrathink") return "Ultrathink";
33872
- return effort.slice(0, 1).toUpperCase() + effort.slice(1);
33873
- }
33874
33922
  function getCodexTraits(modelOptions) {
33875
33923
  const defaultReasoningEffort = getDefaultReasoningEffort("codex");
33924
+ const rawReasoningEffort = typeof modelOptions?.codex?.reasoningEffort === "string" ? modelOptions.codex.reasoningEffort : null;
33876
33925
  return {
33877
- effort: resolveReasoningEffortForProvider("codex", modelOptions?.codex?.reasoningEffort) ?? defaultReasoningEffort,
33926
+ effort: resolveReasoningEffortForProvider("codex", rawReasoningEffort) ?? (rawReasoningEffort === "none" ? "none" : null) ?? defaultReasoningEffort,
33878
33927
  fastModeEnabled: modelOptions?.codex?.fastMode === true
33879
33928
  };
33880
33929
  }
@@ -34988,6 +35037,7 @@ function App({ renderer: _renderer, onRequestExit }) {
34988
35037
  const [composerAttachmentDeleteArmed, setComposerAttachmentDeleteArmed] = useState(false);
34989
35038
  const [composerResetKey, setComposerResetKey] = useState(0);
34990
35039
  const composerRef = useRef(null);
35040
+ const deferredComposerSyncRef = useRef(createDeferredComposerSyncState());
34991
35041
  const timelineScrollRef = useRef(null);
34992
35042
  const [imagePasteInFlight, setImagePasteInFlight] = useState(false);
34993
35043
  const sendInFlightRef = useRef(false);
@@ -35835,37 +35885,76 @@ function App({ renderer: _renderer, onRequestExit }) {
35835
35885
  });
35836
35886
  }, [diffFiles]);
35837
35887
  function syncComposerFromTextarea() {
35838
- setTimeout(() => {
35839
- const nextValue = composerRef.current?.plainText ?? "";
35840
- setComposer(nextValue);
35841
- if (activePendingProgress?.activeQuestion) {
35842
- const questionId = activePendingProgress.activeQuestion.id;
35843
- const requestId = activePendingUserInput?.requestId;
35844
- if (requestId) setPendingUserInputAnswersByRequestId((current) => ({
35845
- ...current,
35846
- [requestId]: {
35847
- ...current[requestId],
35848
- [questionId]: {
35849
- ...current[requestId]?.[questionId],
35850
- customAnswer: nextValue
35888
+ scheduleDeferredComposerSync({
35889
+ state: deferredComposerSyncRef.current,
35890
+ onSync: () => {
35891
+ const nextValue = composerRef.current?.plainText ?? "";
35892
+ setComposer(nextValue);
35893
+ if (activePendingProgress?.activeQuestion) {
35894
+ const questionId = activePendingProgress.activeQuestion.id;
35895
+ const requestId = activePendingUserInput?.requestId;
35896
+ if (requestId) setPendingUserInputAnswersByRequestId((current) => ({
35897
+ ...current,
35898
+ [requestId]: {
35899
+ ...current[requestId],
35900
+ [questionId]: {
35901
+ ...current[requestId]?.[questionId],
35902
+ customAnswer: nextValue
35903
+ }
35851
35904
  }
35852
- }
35853
- }));
35905
+ }));
35906
+ }
35854
35907
  }
35855
- }, 0);
35908
+ });
35856
35909
  }
35857
35910
  function readComposerValue() {
35858
35911
  return composerRef.current?.plainText ?? composer;
35859
35912
  }
35913
+ function resetComposerTextarea(nextValue) {
35914
+ invalidateDeferredComposerSync(deferredComposerSyncRef.current);
35915
+ setComposer(nextValue);
35916
+ setComposerResetKey((current) => current + 1);
35917
+ }
35918
+ function clearComposerDraft() {
35919
+ resetComposerTextarea("");
35920
+ setComposerAttachmentDeleteArmed(false);
35921
+ setPathSuggestionEntries([]);
35922
+ setPathSuggestionIndex(0);
35923
+ if (activePendingProgress?.activeQuestion && activePendingUserInput?.requestId) {
35924
+ const questionId = activePendingProgress.activeQuestion.id;
35925
+ const requestId = activePendingUserInput.requestId;
35926
+ setPendingUserInputAnswersByRequestId((current) => ({
35927
+ ...current,
35928
+ [requestId]: {
35929
+ ...current[requestId],
35930
+ [questionId]: {
35931
+ ...current[requestId]?.[questionId],
35932
+ customAnswer: ""
35933
+ }
35934
+ }
35935
+ }));
35936
+ }
35937
+ setStatus("Composer cleared");
35938
+ }
35939
+ function requestAppExit() {
35940
+ setConfirmDialog({
35941
+ title: "Quit T1 Code?",
35942
+ body: "Press Enter or Escape again to quit. Use Cancel to stay in the session.",
35943
+ confirmLabel: "Quit",
35944
+ escapeBehavior: "confirm",
35945
+ onConfirm: async () => {
35946
+ onRequestExit?.();
35947
+ }
35948
+ });
35949
+ }
35860
35950
  function applyComposerPathMention(entry) {
35861
35951
  const trigger = detectTrailingComposerPathTrigger(readComposerValue());
35862
35952
  if (!trigger) return;
35863
35953
  const nextComposer = replaceComposerTextRange(readComposerValue(), trigger.rangeStart, trigger.rangeEnd, "").replace(/[ \t]{2,}/g, " ");
35864
35954
  addComposerMention(entry);
35865
- setComposer(nextComposer);
35955
+ resetComposerTextarea(nextComposer);
35866
35956
  setPathSuggestionEntries([]);
35867
35957
  setPathSuggestionIndex(0);
35868
- setComposerResetKey((current) => current + 1);
35869
35958
  setFocusArea("composer");
35870
35959
  setStatus("File tagged");
35871
35960
  setTimeout(() => {
@@ -35949,6 +36038,12 @@ function App({ renderer: _renderer, onRequestExit }) {
35949
36038
  });
35950
36039
  setFocusArea("timeline");
35951
36040
  }
36041
+ useEffect(() => {
36042
+ const deferredComposerSync = deferredComposerSyncRef.current;
36043
+ return () => {
36044
+ invalidateDeferredComposerSync(deferredComposerSync);
36045
+ };
36046
+ }, []);
35952
36047
  useEffect(() => {
35953
36048
  setComposerAttachmentDeleteArmed(false);
35954
36049
  clearTerminalImagePreview(terminalRenderer);
@@ -35962,19 +36057,17 @@ function App({ renderer: _renderer, onRequestExit }) {
35962
36057
  useEffect(() => {
35963
36058
  if (!prefsReady) return;
35964
36059
  if (!activeThreadId) {
35965
- setComposer("");
36060
+ resetComposerTextarea("");
35966
36061
  setComposerMentions([]);
35967
36062
  setComposerAttachments([]);
35968
- setComposerResetKey((current) => current + 1);
35969
36063
  return;
35970
36064
  }
35971
36065
  const persistedDraft = composerDraftsByThreadIdRef.current[activeThreadId];
35972
36066
  const nextDraft = persistedDraft ? cloneComposerDraftState(persistedDraft) : null;
35973
- setComposer(nextDraft?.text ?? "");
36067
+ resetComposerTextarea(nextDraft?.text ?? "");
35974
36068
  setComposerMentions(nextDraft?.mentions ?? []);
35975
36069
  setComposerAttachments(nextDraft?.attachments ?? []);
35976
36070
  setComposerAttachmentDeleteArmed(false);
35977
- setComposerResetKey((current) => current + 1);
35978
36071
  }, [activeThreadId, prefsReady]);
35979
36072
  useEffect(() => {
35980
36073
  if (!prefsReady || !activeThreadId) return;
@@ -35992,8 +36085,7 @@ function App({ renderer: _renderer, onRequestExit }) {
35992
36085
  useEffect(() => {
35993
36086
  if (!activePendingUserInput) return;
35994
36087
  const activeQuestionId = activePendingProgress?.activeQuestion?.id;
35995
- setComposer(activeQuestionId && activePendingUserInputAnswers[activeQuestionId] ? activePendingUserInputAnswers[activeQuestionId]?.customAnswer ?? "" : "");
35996
- setComposerResetKey((current) => current + 1);
36088
+ resetComposerTextarea(activeQuestionId && activePendingUserInputAnswers[activeQuestionId] ? activePendingUserInputAnswers[activeQuestionId]?.customAnswer ?? "" : "");
35997
36089
  }, [
35998
36090
  activePendingProgress?.activeQuestion?.id,
35999
36091
  activePendingUserInput,
@@ -36485,6 +36577,7 @@ function App({ renderer: _renderer, onRequestExit }) {
36485
36577
  useKeyboard((key) => {
36486
36578
  const isNavUp = key.name === "up" || key.ctrl && key.name === "k";
36487
36579
  const isNavDown = key.name === "down" || key.ctrl && key.name === "j";
36580
+ const hasDismissibleLayer = Boolean(confirmDialog || renameThreadDialog || imagePreview || showSidebarOverlay || projectPathPromptOpen || overlayMenu || sidebarContextMenu);
36488
36581
  logger.log("ui.key", {
36489
36582
  name: key.name,
36490
36583
  ctrl: key.ctrl,
@@ -36494,11 +36587,13 @@ function App({ renderer: _renderer, onRequestExit }) {
36494
36587
  source: key.source,
36495
36588
  sequence: key.sequence
36496
36589
  });
36497
- if (key.ctrl && key.name === "c") {
36498
- onRequestExit?.();
36499
- return;
36500
- }
36501
36590
  if (confirmDialog && key.name === "escape") {
36591
+ if (confirmDialog.escapeBehavior === "confirm") {
36592
+ const action = confirmDialog.onConfirm;
36593
+ setConfirmDialog(null);
36594
+ action();
36595
+ return;
36596
+ }
36502
36597
  setConfirmDialog(null);
36503
36598
  return;
36504
36599
  }
@@ -36554,6 +36649,13 @@ function App({ renderer: _renderer, onRequestExit }) {
36554
36649
  closeSidebarContextMenu();
36555
36650
  return;
36556
36651
  }
36652
+ if (shouldOpenQuitPromptOnEscape({
36653
+ keyName: key.name,
36654
+ hasDismissibleLayer
36655
+ })) {
36656
+ requestAppExit();
36657
+ return;
36658
+ }
36557
36659
  if (sidebarContextMenu) {
36558
36660
  const menuItems = sidebarContextMenu.kind === "thread" ? buildThreadContextMenuItems() : sidebarContextMenu.kind === "multi-thread" ? buildMultiSelectContextMenuItems(sidebarContextMenu.threadIds.length) : buildProjectContextMenuItems();
36559
36661
  if (isNavUp) {
@@ -37137,8 +37239,7 @@ function App({ renderer: _renderer, onRequestExit }) {
37137
37239
  }
37138
37240
  }
37139
37241
  }));
37140
- setComposer("");
37141
- setComposerResetKey((current) => current + 1);
37242
+ resetComposerTextarea("");
37142
37243
  }
37143
37244
  async function advanceActivePendingUserInput() {
37144
37245
  if (!activePendingUserInput || !activePendingProgress) return;
@@ -37177,8 +37278,7 @@ function App({ renderer: _renderer, onRequestExit }) {
37177
37278
  return next;
37178
37279
  });
37179
37280
  const persistedDraft = composerDraftsByThreadIdRef.current[activeThreadId];
37180
- setComposer(persistedDraft?.text ?? "");
37181
- setComposerResetKey((current) => current + 1);
37281
+ resetComposerTextarea(persistedDraft?.text ?? "");
37182
37282
  } catch (error) {
37183
37283
  setStatus("Answer failed");
37184
37284
  logger.log("userInput.respondFailed", {
@@ -37258,9 +37358,8 @@ function App({ renderer: _renderer, onRequestExit }) {
37258
37358
  setStatus("No plan ready");
37259
37359
  return true;
37260
37360
  }
37261
- setComposer(buildPlanImplementationPrompt(latestProposedPlan.planMarkdown));
37361
+ resetComposerTextarea(buildPlanImplementationPrompt(latestProposedPlan.planMarkdown));
37262
37362
  setDraftInteractionMode("default");
37263
- setComposerResetKey((current) => current + 1);
37264
37363
  setFocusArea("composer");
37265
37364
  return true;
37266
37365
  case "approve": {
@@ -37315,8 +37414,7 @@ function App({ renderer: _renderer, onRequestExit }) {
37315
37414
  });
37316
37415
  setStatus("Answers sent");
37317
37416
  const persistedDraft = composerDraftsByThreadIdRef.current[activeThreadId];
37318
- setComposer(persistedDraft?.text ?? "");
37319
- setComposerResetKey((current) => current + 1);
37417
+ resetComposerTextarea(persistedDraft?.text ?? "");
37320
37418
  } catch (error) {
37321
37419
  setStatus("Answer failed");
37322
37420
  logger.log("userInput.respondFailed", {
@@ -37344,13 +37442,11 @@ function App({ renderer: _renderer, onRequestExit }) {
37344
37442
  try {
37345
37443
  if (composerAttachments.length === 0 && composerMentions.length === 0 && standaloneModeCommand) {
37346
37444
  applyDraftInteractionMode(standaloneModeCommand);
37347
- setComposer("");
37348
- setComposerResetKey((current) => current + 1);
37445
+ resetComposerTextarea("");
37349
37446
  return;
37350
37447
  }
37351
37448
  if (composerAttachments.length === 0 && composerMentions.length === 0 && await handleSlashCommand(trimmedComposerValue)) {
37352
- setComposer("");
37353
- setComposerResetKey((current) => current + 1);
37449
+ resetComposerTextarea("");
37354
37450
  return;
37355
37451
  }
37356
37452
  if (activePendingApproval) {
@@ -37439,7 +37535,7 @@ function App({ renderer: _renderer, onRequestExit }) {
37439
37535
  setSelectedProjectId(projectId);
37440
37536
  setSelectedThreadId(activeThread.id);
37441
37537
  setDraftInteractionMode(followUp.interactionMode);
37442
- setComposer("");
37538
+ resetComposerTextarea("");
37443
37539
  setComposerMentions([]);
37444
37540
  setComposerAttachments([]);
37445
37541
  setComposerDraftsByThreadId((current) => {
@@ -37448,7 +37544,6 @@ function App({ renderer: _renderer, onRequestExit }) {
37448
37544
  delete next[activeThread.id];
37449
37545
  return next;
37450
37546
  });
37451
- setComposerResetKey((current) => current + 1);
37452
37547
  setStatus(followUp.interactionMode === "default" ? "Implementing plan" : "Plan feedback sent");
37453
37548
  logger.log("composer.sent", {
37454
37549
  threadId: activeThread.id,
@@ -37521,7 +37616,7 @@ function App({ renderer: _renderer, onRequestExit }) {
37521
37616
  }
37522
37617
  setSelectedProjectId(projectId);
37523
37618
  setSelectedThreadId(threadId);
37524
- setComposer("");
37619
+ resetComposerTextarea("");
37525
37620
  setComposerMentions([]);
37526
37621
  setComposerAttachments([]);
37527
37622
  setComposerDraftsByThreadId((current) => {
@@ -37531,7 +37626,6 @@ function App({ renderer: _renderer, onRequestExit }) {
37531
37626
  delete next[activeDraftKey];
37532
37627
  return next;
37533
37628
  });
37534
- setComposerResetKey((current) => current + 1);
37535
37629
  setStatus("Prompt sent");
37536
37630
  logger.log("composer.sent", {
37537
37631
  threadId,
@@ -37969,8 +38063,7 @@ function App({ renderer: _renderer, onRequestExit }) {
37969
38063
  onSelect: () => {
37970
38064
  if (ultrathinkPromptControlled) return;
37971
38065
  if (option === "ultrathink") {
37972
- setComposer(composer.trim().length === 0 ? "Ultrathink:\n" : applyClaudePromptEffortPrefix(composer, "ultrathink"));
37973
- setComposerResetKey((current) => current + 1);
38066
+ resetComposerTextarea(composer.trim().length === 0 ? "Ultrathink:\n" : applyClaudePromptEffortPrefix(composer, "ultrathink"));
37974
38067
  setStatus("traits");
37975
38068
  return;
37976
38069
  }
@@ -38644,16 +38737,7 @@ function App({ renderer: _renderer, onRequestExit }) {
38644
38737
  compact: true,
38645
38738
  marginRight: 1,
38646
38739
  onPress: () => restoreDefaultSettings()
38647
- }) : mainView === "keybindings" ? /* @__PURE__ */ jsx(ToolbarButton, {
38648
- icon: "󰌌",
38649
- label: responsiveLayout.showComposerModeLabels ? isOpeningKeybindings ? "Opening..." : "Open file" : void 0,
38650
- compact: !responsiveLayout.showComposerModeLabels,
38651
- disabled: !serverConfig?.keybindingsConfigPath || isOpeningKeybindings,
38652
- marginRight: 1,
38653
- onPress: () => {
38654
- openKeybindingsFile();
38655
- }
38656
- }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ToolbarButton, {
38740
+ }) : mainView === "keybindings" ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ToolbarButton, {
38657
38741
  icon: gitActionBusy ? "󱦟" : "󰊢",
38658
38742
  active: overlayMenu === "git-actions",
38659
38743
  disabled: !gitCwd || !isGitRepo,
@@ -39691,6 +39775,14 @@ function App({ renderer: _renderer, onRequestExit }) {
39691
39775
  key.preventDefault();
39692
39776
  return;
39693
39777
  }
39778
+ if (shouldClearComposerOnCtrlC({
39779
+ keyName: key.name,
39780
+ ctrl: key.ctrl
39781
+ })) {
39782
+ key.preventDefault();
39783
+ clearComposerDraft();
39784
+ return;
39785
+ }
39694
39786
  if (!activePendingUserInput && (composerAttachments.length > 0 || composerMentions.length > 0) && (key.name === "backspace" || key.name === "delete") && readComposerValue().length === 0) {
39695
39787
  key.preventDefault();
39696
39788
  if (composerAttachmentDeleteArmed) if (composerMentions.length > 0) removeLastComposerMention();
@@ -39854,14 +39946,14 @@ function App({ renderer: _renderer, onRequestExit }) {
39854
39946
  /* @__PURE__ */ jsx(ToolbarButton, {
39855
39947
  icon: providerIcon(draftProvider),
39856
39948
  iconColor: providerColor(draftProvider),
39857
- label: responsiveLayout.showComposerModelLabel ? `${modelControlLabel(draftProvider, draftModel)} ▾` : void 0,
39949
+ label: responsiveLayout.showComposerModelLabel ? modelControlLabel(draftProvider, draftModel) : void 0,
39858
39950
  compact: !responsiveLayout.showComposerModelLabel,
39859
39951
  active: overlayMenu === "model",
39860
39952
  onPress: toggleModelMenu
39861
39953
  }),
39862
39954
  composerTraits ? /* @__PURE__ */ jsxs(Fragment, { children: [responsiveLayout.showComposerDividers ? /* @__PURE__ */ jsx(FooterDivider, {}) : null, /* @__PURE__ */ jsx(ToolbarButton, {
39863
39955
  icon: composerTraitsIcon(draftProvider),
39864
- label: responsiveLayout.showComposerTraitsLabel ? `${composerTraits} ▾` : void 0,
39956
+ label: responsiveLayout.showComposerTraitsLabel ? truncateToolbarLabel(composerTraits, 14) : void 0,
39865
39957
  compact: !responsiveLayout.showComposerTraitsLabel,
39866
39958
  active: overlayMenu === "traits",
39867
39959
  onPress: toggleTraitsMenu
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maria_rcks/t1code",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Terminal-first T3 Code fork with an OpenTUI client",
5
5
  "homepage": "https://github.com/maria-rcks/t1code#readme",
6
6
  "bugs": {