omnius 1.0.971 → 1.0.972

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.
@@ -7434,6 +7434,11 @@ function normalizeCommandName(name) {
7434
7434
  return name.replace(/^\//, "").trim().toLowerCase();
7435
7435
  }
7436
7436
 
7437
+ // packages/cli/src/tui/shell-mode-input.ts
7438
+ function parseShellModeInput(text) {
7439
+ return text.startsWith("!") ? text.slice(1).trimStart() : null;
7440
+ }
7441
+
7437
7442
  // packages/cli/src/tui/native/components/vim-composer.ts
7438
7443
  var VimComposer = class {
7439
7444
  constructor(editor, changed) {
@@ -8615,7 +8620,7 @@ var NativeFrontend = class {
8615
8620
  keyBindings: [{ name: "return", action: "submit" }, { name: "return", shift: true, action: "newline" }],
8616
8621
  onContentChange: () => this.editorChanged(),
8617
8622
  onCursorChange: () => this.editorChanged(),
8618
- onSubmit: () => this.submit()
8623
+ onSubmit: () => this.submit(true)
8619
8624
  });
8620
8625
  this.vimMode = new TextRenderable11(renderer2, {
8621
8626
  id: "omnius-vim-mode",
@@ -8830,14 +8835,13 @@ var NativeFrontend = class {
8830
8835
  const index = state.suggestions.findIndex((item) => item.value === selected);
8831
8836
  if (index >= 0) this.suggestions.setSelectedIndex(index);
8832
8837
  }
8833
- this.suggestions.visible = this.historyIndex < 0 && state.suggestions.length > 0;
8834
8838
  this.suggestions.height = Math.min(4, state.suggestions.length || 1);
8835
- this.prompt.content = styledText(state.prompt.trimEnd() || "❯");
8836
8839
  if (!this.editorInitialized) {
8837
8840
  this.editor.setText(state.input.text);
8838
8841
  this.placeInputCursor(state.input.text, state.input.cursor);
8839
8842
  this.editorInitialized = true;
8840
8843
  }
8844
+ this.suggestions.visible = !this.shellMode && this.historyIndex < 0 && state.suggestions.length > 0;
8841
8845
  this.editor.focusable = state.input.enabled && !this.paused;
8842
8846
  if (state.input.enabled && !this.paused && !this.modals.active && (inputWasEnabled === false || !this.renderer.currentFocusedRenderable)) this.editor.focus();
8843
8847
  this.metrics.content = styledText(state.metrics);
@@ -8852,7 +8856,7 @@ var NativeFrontend = class {
8852
8856
  this.replaceActions(this.metricsStartActions, (state.metricsActions ?? []).filter((action) => action.id === "agents"), "metrics");
8853
8857
  this.replaceActions(this.metricsEndActions, (state.metricsActions ?? []).filter((action) => action.id !== "agents"), "metrics");
8854
8858
  }
8855
- this.renderEnhance();
8859
+ this.renderComposer();
8856
8860
  this.renderActivity();
8857
8861
  this.renderMedia();
8858
8862
  } finally {
@@ -8907,9 +8911,16 @@ var NativeFrontend = class {
8907
8911
  parent.add(button);
8908
8912
  }
8909
8913
  }
8910
- renderEnhance() {
8914
+ get shellMode() {
8915
+ return parseShellModeInput(this.editor.plainText) !== null;
8916
+ }
8917
+ renderComposer() {
8918
+ const shellMode = this.shellMode;
8919
+ this.prompt.content = styledText(shellMode ? "shell ❯" : this.state?.prompt.trimEnd() || "❯");
8920
+ this.prompt.fg = shellMode ? this.context.colors.warning : this.context.colors.accent;
8921
+ if (shellMode) this.suggestions.visible = false;
8911
8922
  const state = this.state?.enhance;
8912
- this.enhance.visible = Boolean(state && (state.state !== "idle" || this.editor.plainText.trim()));
8923
+ this.enhance.visible = !shellMode && Boolean(state && (state.state !== "idle" || this.editor.plainText.trim()));
8913
8924
  if (!state) return;
8914
8925
  const actions = state.state === "confirm" ? [{ id: "enhance-accept", label: "✓" }, { id: "enhance-reject", label: "×" }] : [{ id: "enhance", label: state.state === "busy" ? "WORK · ENHANCE" : state.label ?? "ENHANCE", disabled: state.state === "busy" }];
8915
8926
  this.replaceActions(this.enhance, actions, "enhance");
@@ -8955,7 +8966,7 @@ var NativeFrontend = class {
8955
8966
  this.identityMarker.fg = colors.foreground;
8956
8967
  this.headerPanel.fg = colors.foreground;
8957
8968
  this.routeWarning.fg = colors.warning;
8958
- this.prompt.fg = this.activity.fg = this.liveButton.fg = colors.accent;
8969
+ this.activity.fg = this.liveButton.fg = colors.accent;
8959
8970
  this.vimMode.fg = colors.foreground;
8960
8971
  this.micTrack.fg = colors.foreground;
8961
8972
  this.queue.fg = this.metrics.fg = colors.dim;
@@ -9151,12 +9162,14 @@ var NativeFrontend = class {
9151
9162
  if (this.historyIndex >= 0 && text !== this.history[this.historyIndex]) this.resetHistoryNavigation();
9152
9163
  this.lastInput = text;
9153
9164
  this.lastCursor = cursor;
9154
- this.renderEnhance();
9165
+ this.renderComposer();
9155
9166
  this.emit({ type: "input", text, cursor });
9156
9167
  }
9157
- submit() {
9168
+ submit(fromEditor) {
9158
9169
  if (this.paused || this.state?.input.enabled === false) return;
9159
9170
  const text = this.editor.plainText;
9171
+ const shellCommand = fromEditor ? parseShellModeInput(text) : null;
9172
+ if (shellCommand === "") return;
9160
9173
  const command2 = /^\/([^\s]+)/.exec(text.trimStart())?.[1];
9161
9174
  const suggestion = String(this.suggestions.getSelectedOption()?.value ?? "");
9162
9175
  if (this.suggestions.visible && command2 && !findCommand(command2) && suggestion.startsWith(text.trimEnd()) && this.acceptSuggestion()) return;
@@ -9167,7 +9180,7 @@ var NativeFrontend = class {
9167
9180
  }
9168
9181
  this.resetHistoryNavigation();
9169
9182
  this.editor.clear();
9170
- this.emit({ type: "submit", text });
9183
+ this.emit(shellCommand === null ? { type: "submit", text } : { type: "submit", text, localShell: true });
9171
9184
  this.editorChanged();
9172
9185
  }
9173
9186
  resetHistoryNavigation() {
@@ -9192,6 +9205,7 @@ var NativeFrontend = class {
9192
9205
  else this.setInput(this.history[this.historyIndex], void 0, true);
9193
9206
  }
9194
9207
  acceptSuggestion() {
9208
+ if (this.shellMode) return false;
9195
9209
  const selected = this.suggestions.getSelectedOption();
9196
9210
  if (!selected || selected.value === this.editor.plainText.trimEnd()) return false;
9197
9211
  const text = String(selected.value);
@@ -9305,6 +9319,12 @@ var NativeFrontend = class {
9305
9319
  this.shortcut("ctrl-u", key);
9306
9320
  return;
9307
9321
  }
9322
+ if (key.name === "escape" && this.renderer.currentFocusedRenderable === this.editor && !this.paused && this.state?.input.enabled !== false && this.shellMode) {
9323
+ this.setInput("");
9324
+ key.preventDefault();
9325
+ key.stopPropagation();
9326
+ return;
9327
+ }
9308
9328
  if (this.renderer.currentFocusedRenderable === this.editor && !this.paused && this.state?.input.enabled !== false && this.vimComposer.handle(key)) return;
9309
9329
  if (key.name === "escape") {
9310
9330
  if (this.renderer.currentFocusedRenderable !== this.editor) {
@@ -9318,14 +9338,16 @@ var NativeFrontend = class {
9318
9338
  return;
9319
9339
  }
9320
9340
  if (key.name === "tab") {
9321
- if (key.ctrl) this.shortcut("ctrl-tab", key);
9322
- else if (!key.shift && this.renderer.currentFocusedRenderable === this.editor && this.suggestions.visible) {
9323
- this.acceptSuggestion();
9324
- key.preventDefault();
9325
- } else if (!key.shift && this.renderer.currentFocusedRenderable === this.editor && this.editor.plainText) this.shortcut("tab", key);
9326
- else this.focusNext(key.shift ? -1 : 1);
9327
9341
  key.preventDefault();
9328
9342
  key.stopPropagation();
9343
+ if (key.ctrl) this.shortcut("ctrl-tab", key);
9344
+ else {
9345
+ const completing = !key.shift && this.renderer.currentFocusedRenderable === this.editor;
9346
+ if (completing && this.shellMode) return;
9347
+ if (completing && this.suggestions.visible) this.acceptSuggestion();
9348
+ else if (completing && this.editor.plainText) this.shortcut("tab", key);
9349
+ else this.focusNext(key.shift ? -1 : 1);
9350
+ }
9329
9351
  return;
9330
9352
  }
9331
9353
  if (this.renderer.currentFocusedRenderable !== this.editor && this.renderer.currentFocusedRenderable !== this.scroll && !key.ctrl) return;
@@ -9536,7 +9558,7 @@ var NativeFrontend = class {
9536
9558
  }
9537
9559
  } else if (action === "insert") this.editor.insertText(value ?? "");
9538
9560
  else if (action === "clear") this.editor.clear();
9539
- else if (action === "submit") this.submit();
9561
+ else if (action === "submit") this.submit(false);
9540
9562
  else if (action === "complete") this.acceptSuggestion();
9541
9563
  else if (action === "focus") this.restoreFocus();
9542
9564
  else if (action === "select-block") {