omnius 1.0.150 → 1.0.151

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -581489,23 +581489,57 @@ ${CONTENT_BG_SEQ}`);
581489
581489
  const w = termWidth ?? getTermWidth();
581490
581490
  return Math.max(1, w - this.promptWidth - 2);
581491
581491
  }
581492
+ wrapPlainInputText(text, availWidth) {
581493
+ const width = Math.max(1, availWidth);
581494
+ const rawLines = [];
581495
+ const charPositions = [];
581496
+ const pushWrappedSegment = (segment, segmentStart2) => {
581497
+ if (segment.length === 0) {
581498
+ charPositions.push(segmentStart2);
581499
+ rawLines.push("");
581500
+ return;
581501
+ }
581502
+ let offset = 0;
581503
+ while (offset < segment.length) {
581504
+ const remaining = segment.slice(offset);
581505
+ if (remaining.length <= width) {
581506
+ charPositions.push(segmentStart2 + offset);
581507
+ rawLines.push(remaining);
581508
+ break;
581509
+ }
581510
+ let breakAt = width;
581511
+ const lastSpace = remaining.lastIndexOf(" ", width);
581512
+ if (lastSpace > 0 && lastSpace >= width * 0.3) {
581513
+ breakAt = lastSpace + 1;
581514
+ }
581515
+ charPositions.push(segmentStart2 + offset);
581516
+ rawLines.push(remaining.slice(0, breakAt));
581517
+ offset += breakAt;
581518
+ }
581519
+ };
581520
+ if (text.length === 0) {
581521
+ pushWrappedSegment("", 0);
581522
+ return { rawLines, charPositions };
581523
+ }
581524
+ let segmentStart = 0;
581525
+ while (segmentStart <= text.length) {
581526
+ const newlineAt = text.indexOf("\n", segmentStart);
581527
+ const segmentEnd = newlineAt === -1 ? text.length : newlineAt;
581528
+ pushWrappedSegment(text.slice(segmentStart, segmentEnd), segmentStart);
581529
+ if (newlineAt === -1) break;
581530
+ segmentStart = newlineAt + 1;
581531
+ if (segmentStart === text.length) {
581532
+ pushWrappedSegment("", segmentStart);
581533
+ break;
581534
+ }
581535
+ }
581536
+ return { rawLines, charPositions };
581537
+ }
581492
581538
  computeInputLineCount(termWidth) {
581493
581539
  if (!this.inputStateProvider) return 1;
581494
581540
  const availWidth = this.inputTextWidth(termWidth);
581495
581541
  const { line } = this.inputStateProvider();
581496
- if (line.length <= availWidth) return 1;
581497
- let count = 0;
581498
- let remaining = line;
581499
- while (remaining.length > 0) {
581500
- count++;
581501
- if (remaining.length <= availWidth) break;
581502
- let breakAt = availWidth;
581503
- const lastSpace = remaining.lastIndexOf(" ", availWidth);
581504
- if (lastSpace > 0 && lastSpace >= availWidth * 0.3)
581505
- breakAt = lastSpace + 1;
581506
- remaining = remaining.slice(breakAt);
581507
- }
581508
- return Math.max(1, count);
581542
+ return Math.max(1, this.wrapPlainInputText(line, availWidth).rawLines.length);
581509
581543
  }
581510
581544
  /** Update _currentFooterHeight based on current input + suggestions. Returns true if height changed. */
581511
581545
  updateFooterHeight(termWidth) {
@@ -581565,8 +581599,9 @@ ${CONTENT_BG_SEQ}`);
581565
581599
  const inputState = this.inputStateProvider?.();
581566
581600
  const fullLine = inputState?.line ?? "";
581567
581601
  const cursorPos = inputState?.cursor ?? 0;
581602
+ const hasExplicitLineBreak = fullLine.includes("\n");
581568
581603
  const ghost = this.getGhostText(fullLine, cursorPos);
581569
- if (fullLine.length <= availWidth) {
581604
+ if (!hasExplicitLineBreak && fullLine.length <= availWidth) {
581570
581605
  let displayLine;
581571
581606
  if (ghost) {
581572
581607
  displayLine = fullLine + `\x1B[7m\x1B[38;5;${TEXT_DIM}m${ghost[0]}\x1B[0m${PANEL_BG_SEQ}\x1B[38;5;${TEXT_DIM}m${ghost.slice(1)}\x1B[0m${PANEL_BG_SEQ}`;
@@ -581581,28 +581616,7 @@ ${CONTENT_BG_SEQ}`);
581581
581616
  cursorCol: Math.min(Math.max(1, termWidth - 1), this.promptWidth + cursorPos + 2)
581582
581617
  };
581583
581618
  }
581584
- const rawLines = [];
581585
- let remaining = fullLine;
581586
- const charPositions = [];
581587
- while (remaining.length > 0) {
581588
- if (remaining.length <= availWidth) {
581589
- charPositions.push(fullLine.length - remaining.length);
581590
- rawLines.push(remaining);
581591
- break;
581592
- }
581593
- let breakAt = availWidth;
581594
- const lastSpace = remaining.lastIndexOf(" ", availWidth);
581595
- if (lastSpace > 0 && lastSpace >= availWidth * 0.3) {
581596
- breakAt = lastSpace + 1;
581597
- }
581598
- charPositions.push(fullLine.length - remaining.length);
581599
- rawLines.push(remaining.slice(0, breakAt));
581600
- remaining = remaining.slice(breakAt);
581601
- }
581602
- if (rawLines.length === 0) {
581603
- rawLines.push("");
581604
- charPositions.push(0);
581605
- }
581619
+ const { rawLines, charPositions } = this.wrapPlainInputText(fullLine, availWidth);
581606
581620
  let cursorLineIdx = rawLines.length - 1;
581607
581621
  let cursorColInLine = cursorPos;
581608
581622
  for (let i2 = 0; i2 < charPositions.length; i2++) {
@@ -633486,27 +633500,48 @@ var init_direct_input = __esm({
633486
633500
  * and rawLines (text of each line). Matches wrapInput logic in status-bar.ts.
633487
633501
  */
633488
633502
  _computeWrappedLines(availWidth) {
633503
+ const width = Math.max(1, availWidth);
633489
633504
  const rawLines = [];
633490
633505
  const charPositions = [];
633491
- let remaining = this.line;
633492
- while (remaining.length > 0) {
633493
- if (remaining.length <= availWidth) {
633494
- charPositions.push(this.line.length - remaining.length);
633495
- rawLines.push(remaining);
633496
- break;
633506
+ const pushWrappedSegment = (segment, segmentStart2) => {
633507
+ if (segment.length === 0) {
633508
+ charPositions.push(segmentStart2);
633509
+ rawLines.push("");
633510
+ return;
633497
633511
  }
633498
- let breakAt = availWidth;
633499
- const lastSpace = remaining.lastIndexOf(" ", availWidth);
633500
- if (lastSpace > 0 && lastSpace >= availWidth * 0.3) {
633501
- breakAt = lastSpace + 1;
633512
+ let offset = 0;
633513
+ while (offset < segment.length) {
633514
+ const remaining = segment.slice(offset);
633515
+ if (remaining.length <= width) {
633516
+ charPositions.push(segmentStart2 + offset);
633517
+ rawLines.push(remaining);
633518
+ break;
633519
+ }
633520
+ let breakAt = width;
633521
+ const lastSpace = remaining.lastIndexOf(" ", width);
633522
+ if (lastSpace > 0 && lastSpace >= width * 0.3) {
633523
+ breakAt = lastSpace + 1;
633524
+ }
633525
+ charPositions.push(segmentStart2 + offset);
633526
+ rawLines.push(remaining.slice(0, breakAt));
633527
+ offset += breakAt;
633528
+ }
633529
+ };
633530
+ if (this.line.length === 0) {
633531
+ pushWrappedSegment("", 0);
633532
+ return { charPositions, rawLines };
633533
+ }
633534
+ let segmentStart = 0;
633535
+ while (segmentStart <= this.line.length) {
633536
+ const newlineAt = this.line.indexOf("\n", segmentStart);
633537
+ const segmentEnd = newlineAt === -1 ? this.line.length : newlineAt;
633538
+ pushWrappedSegment(this.line.slice(segmentStart, segmentEnd), segmentStart);
633539
+ if (newlineAt === -1) break;
633540
+ segmentStart = newlineAt + 1;
633541
+ if (segmentStart === this.line.length) {
633542
+ pushWrappedSegment("", segmentStart);
633543
+ break;
633502
633544
  }
633503
- charPositions.push(this.line.length - remaining.length);
633504
- rawLines.push(remaining.slice(0, breakAt));
633505
- remaining = remaining.slice(breakAt);
633506
- }
633507
- if (rawLines.length === 0) {
633508
- rawLines.push("");
633509
- charPositions.push(0);
633510
633545
  }
633511
633546
  return { charPositions, rawLines };
633512
633547
  }
@@ -633692,6 +633727,10 @@ var init_direct_input = __esm({
633692
633727
  this.cursor = this.line.length;
633693
633728
  return;
633694
633729
  case "~":
633730
+ if (this._isShiftEnterCSI(params)) {
633731
+ this._insertText("\n");
633732
+ return;
633733
+ }
633695
633734
  if (params === "3") {
633696
633735
  if (this.cursor < this.line.length) {
633697
633736
  this.line = this.line.slice(0, this.cursor) + this.line.slice(this.cursor + 1);
@@ -633713,6 +633752,10 @@ var init_direct_input = __esm({
633713
633752
  const modifiers = parseInt(parts[1] ?? "1");
633714
633753
  const hasCtrl = modifiers - 1 & 4;
633715
633754
  const hasShift = modifiers - 1 & 1;
633755
+ if (hasShift && (codepoint === 10 || codepoint === 13)) {
633756
+ this._insertText("\n");
633757
+ return;
633758
+ }
633716
633759
  if (hasCtrl && hasShift) {
633717
633760
  if (codepoint === 67) {
633718
633761
  this.emit("ctrl-shift-c");
@@ -633731,6 +633774,22 @@ var init_direct_input = __esm({
633731
633774
  }
633732
633775
  }
633733
633776
  }
633777
+ _isShiftEnterCSI(params) {
633778
+ const parts = params.split(";").map((part) => parseInt(part, 10));
633779
+ if (parts.length === 2) {
633780
+ const [codepoint, modifiers] = parts;
633781
+ return (codepoint === 10 || codepoint === 13) && modifiers === 2;
633782
+ }
633783
+ if (parts.length === 3) {
633784
+ const [prefix, modifiers, codepoint] = parts;
633785
+ return prefix === 27 && modifiers === 2 && (codepoint === 10 || codepoint === 13);
633786
+ }
633787
+ return false;
633788
+ }
633789
+ _insertText(text) {
633790
+ this.line = this.line.slice(0, this.cursor) + text + this.line.slice(this.cursor);
633791
+ this.cursor += text.length;
633792
+ }
633734
633793
  /** Handle SS3 sequence: \x1BO {final} (some terminals use this for arrows/Home/End) */
633735
633794
  _handleSS3(final2) {
633736
633795
  switch (final2) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.150",
3
+ "version": "1.0.151",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.150",
9
+ "version": "1.0.151",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.150",
3
+ "version": "1.0.151",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",