@leg3ndy/otto-bridge 1.0.10 → 1.0.11

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/README.md CHANGED
@@ -15,7 +15,7 @@ Para o estado atual da arquitetura, capacidades entregues, limitacoes e roadmap
15
15
 
16
16
  Para o corte de arquitetura do `0.9.0`, veja [`leg3ndy-ai-backend/docs/otto-bridge/releases/OTTO_BRIDGE_0_9_0_RELEASE.md`](../leg3ndy-ai-backend/docs/otto-bridge/releases/OTTO_BRIDGE_0_9_0_RELEASE.md).
17
17
 
18
- Para a release atual `1.0.10`, com redraw/cursor do composer TTY estabilizados e multiline sem rasgar a moldura, veja [`leg3ndy-ai-backend/docs/otto-bridge/releases/OTTO_BRIDGE_1_0_10_PATCH.md`](../leg3ndy-ai-backend/docs/otto-bridge/releases/OTTO_BRIDGE_1_0_10_PATCH.md).
18
+ Para a release atual `1.0.11`, com redraw do composer TTY endurecido para terminais reais, cursor alinhado ao placeholder e multiline sem abrir caixas duplicadas, veja [`leg3ndy-ai-backend/docs/otto-bridge/releases/OTTO_BRIDGE_1_0_11_PATCH.md`](../leg3ndy-ai-backend/docs/otto-bridge/releases/OTTO_BRIDGE_1_0_11_PATCH.md).
19
19
 
20
20
  ## Distribuicao
21
21
 
@@ -38,14 +38,14 @@ Enquanto o pacote nao estiver publicado, voce pode gerar um tarball local:
38
38
 
39
39
  ```bash
40
40
  npm pack
41
- npm install -g ./leg3ndy-otto-bridge-1.0.10.tgz
41
+ npm install -g ./leg3ndy-otto-bridge-1.0.11.tgz
42
42
  ```
43
43
 
44
- Na linha `1.0.10`, `playwright` segue como dependencia obrigatoria no `otto-bridge`. O primeiro `npm install -g @leg3ndy/otto-bridge` pode demorar mais porque instala o browser persistente usado pelo WhatsApp Web e pelos fluxos web em background do bridge.
44
+ Na linha `1.0.11`, `playwright` segue como dependencia obrigatoria no `otto-bridge`. O primeiro `npm install -g @leg3ndy/otto-bridge` pode demorar mais porque instala o browser persistente usado pelo WhatsApp Web e pelos fluxos web em background do bridge.
45
45
 
46
- No macOS, a linha `1.0.10` usa o provider `macos-helper`, um helper `WKWebView` sem Dock para o WhatsApp Web. O helper sobe com user-agent de Chrome moderno para evitar o bloqueio do WhatsApp ao detectar Safari/WebKit. O runtime antigo com Chromium/Playwright fica disponivel apenas como override explicito via `OTTO_BRIDGE_WHATSAPP_RUNTIME_PROVIDER=embedded-playwright`.
46
+ No macOS, a linha `1.0.11` usa o provider `macos-helper`, um helper `WKWebView` sem Dock para o WhatsApp Web. O helper sobe com user-agent de Chrome moderno para evitar o bloqueio do WhatsApp ao detectar Safari/WebKit. O runtime antigo com Chromium/Playwright fica disponivel apenas como override explicito via `OTTO_BRIDGE_WHATSAPP_RUNTIME_PROVIDER=embedded-playwright`.
47
47
 
48
- No nivel arquitetural, o `0.9.0` marcou a mudanca de papel do bridge: ele publica tools e resultados estruturados para o Otto, em vez de injetar resposta pronta como caminho principal do chat. O `1.0.0` oficializou isso como runtime agentico; o `1.0.10` preserva esse fluxo, estabiliza redraw/cursor do input-box TTY, mantem o composer multiline e melhora as views de status/extensoes e o refresh ao sair do `Terminal`.
48
+ No nivel arquitetural, o `0.9.0` marcou a mudanca de papel do bridge: ele publica tools e resultados estruturados para o Otto, em vez de injetar resposta pronta como caminho principal do chat. O `1.0.0` oficializou isso como runtime agentico; o `1.0.11` preserva esse fluxo, endurece o redraw do input-box TTY para terminais mais temperamentais, mantem o composer multiline e melhora as views de status/extensoes e o refresh ao sair do `Terminal`.
49
49
 
50
50
  ## Publicacao
51
51
 
@@ -157,7 +157,7 @@ Esse comando abre um shell local interativo para instalar extensoes, rodar coman
157
157
 
158
158
  ### WhatsApp Web em background
159
159
 
160
- Fluxo recomendado na linha `1.0.10`:
160
+ Fluxo recomendado na linha `1.0.11`:
161
161
 
162
162
  ```bash
163
163
  otto-bridge extensions --install whatsappweb
@@ -167,13 +167,13 @@ otto-bridge extensions --status whatsappweb
167
167
 
168
168
  O setup agora abre o login do WhatsApp Web no helper/background browser do proprio bridge. Depois do QR code, o Otto usa a sessao local em background, sem depender de aba visivel no Safari.
169
169
 
170
- Contrato da linha `1.0.10`:
170
+ Contrato da linha `1.0.11`:
171
171
 
172
172
  - `otto-bridge extensions --setup whatsappweb`: autentica a sessao uma vez
173
173
  - `otto-bridge`: mantem o browser persistente do WhatsApp vivo em background enquanto o runtime do hub estiver ativo, sem depender de uma aba aberta no Safari
174
174
  - ao fechar o `otto-bridge`: o browser em background e desligado, mas a sessao local fica lembrada para o proximo boot
175
175
 
176
- ## Handoff rapido da linha 1.0.10
176
+ ## Handoff rapido da linha 1.0.11
177
177
 
178
178
  Ja fechado no codigo:
179
179
 
@@ -53,6 +53,8 @@ const MAX_RENDERED_FILE_CHARS = 6_000;
53
53
  const MAX_RENDERED_FILE_CHARS_COMPACT = 1_400;
54
54
  const CONSOLE_PLACEHOLDER = "Peça algo ao Otto";
55
55
  const CONSOLE_COMMAND_HINT = "/help, /model [fast|thinking], /status, /clear, /exit";
56
+ const CONSOLE_COMPOSER_PROMPT_WIDTH = 2;
57
+ const CONSOLE_COMPOSER_CURSOR_COLUMN = 4;
56
58
  class CliRuntimeSession {
57
59
  config;
58
60
  runtime = null;
@@ -688,12 +690,6 @@ function renderConsolePromptContentLine(text, width, tone) {
688
690
  : style(clipped, ANSI.slateItalic, enabled);
689
691
  return `${border} ${body} ${border}`;
690
692
  }
691
- function saveCursorPosition() {
692
- output.write("\u001b[s");
693
- }
694
- function restoreCursorPosition() {
695
- output.write("\u001b[u");
696
- }
697
693
  function enableTerminalEnhancedKeys() {
698
694
  output.write("\u001b[>4;2m");
699
695
  }
@@ -716,8 +712,7 @@ function sliceByWidth(text, width) {
716
712
  return parts.length ? parts : [""];
717
713
  }
718
714
  export function buildConsoleComposerLayout(value, innerWidth) {
719
- const promptWidth = 2;
720
- const lineContentWidth = Math.max(1, innerWidth - promptWidth);
715
+ const lineContentWidth = Math.max(1, innerWidth - CONSOLE_COMPOSER_PROMPT_WIDTH);
721
716
  if (!value) {
722
717
  return {
723
718
  lines: [CONSOLE_PLACEHOLDER],
@@ -736,7 +731,7 @@ export function buildConsoleComposerLayout(value, innerWidth) {
736
731
  const needsSoftWrapCursorRow = !trailingNewline
737
732
  && lastLogicalLine.length > 0
738
733
  && lastLogicalLine.length % lineContentWidth === 0;
739
- if (trailingNewline || needsSoftWrapCursorRow) {
734
+ if (needsSoftWrapCursorRow) {
740
735
  lines.push("");
741
736
  }
742
737
  const cursorLineIndex = trailingNewline
@@ -778,9 +773,10 @@ function renderConsoleComposerLines(value, innerWidth, enabled) {
778
773
  cursorColumn: layout.cursorColumn,
779
774
  };
780
775
  }
781
- function tryConsumeControlSequence(buffer) {
776
+ export function tryConsumeControlSequence(buffer) {
782
777
  const knownNewlineSequences = [
783
778
  "\u001b[13;2u",
779
+ "\u001b[13;2~",
784
780
  "\u001b[27;2;13~",
785
781
  "\u001b[1;2M",
786
782
  "\u001b\r",
@@ -834,6 +830,8 @@ async function askConsoleInput(rl) {
834
830
  const availableWidth = Number(output.columns || 96);
835
831
  const innerWidth = Math.max(42, Math.min(availableWidth - 8, 116));
836
832
  let renderedOnce = false;
833
+ let lastRenderedLineCount = 0;
834
+ let lastCursorLineIndex = 0;
837
835
  let value = "";
838
836
  let pendingControlBuffer = "";
839
837
  const cleanup = () => {
@@ -846,28 +844,32 @@ async function askConsoleInput(rl) {
846
844
  const render = () => {
847
845
  const composer = renderConsoleComposerLines(value, innerWidth, enabled);
848
846
  if (renderedOnce) {
849
- restoreCursorPosition();
847
+ moveCursor(output, 0, -(1 + lastCursorLineIndex));
848
+ cursorTo(output, 0);
850
849
  }
851
850
  else {
852
- saveCursorPosition();
853
851
  renderedOnce = true;
854
852
  }
855
- saveCursorPosition();
856
853
  const top = renderPromptFrameLine(innerWidth + 2, "┌", "┐");
857
854
  const border = style("│", ANSI.brandBlue, enabled);
858
855
  const bottom = renderPromptFrameLine(innerWidth + 2, "└", "┘");
859
856
  const content = composer.renderedLines.map((line) => `${border} ${line} ${border}`).join("\n");
860
857
  output.write("\u001b[J");
861
858
  output.write(`${top}\n${content}\n${bottom}`);
862
- restoreCursorPosition();
863
- moveCursor(output, 0, 1 + composer.cursorLineIndex);
864
- cursorTo(output, 4 + composer.cursorColumn);
859
+ moveCursor(output, 0, -(composer.renderedLines.length - composer.cursorLineIndex));
860
+ cursorTo(output, CONSOLE_COMPOSER_CURSOR_COLUMN + composer.cursorColumn);
861
+ lastRenderedLineCount = composer.renderedLines.length;
862
+ lastCursorLineIndex = composer.cursorLineIndex;
865
863
  };
866
864
  const insertNewline = () => {
867
865
  value = `${value}\n`;
868
866
  render();
869
867
  };
870
868
  const submitPrompt = () => {
869
+ if (renderedOnce) {
870
+ moveCursor(output, 0, lastRenderedLineCount - lastCursorLineIndex + 1);
871
+ cursorTo(output, 0);
872
+ }
871
873
  cleanup();
872
874
  output.write("\n");
873
875
  resolve(normalizeText(value));
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const BRIDGE_CONFIG_VERSION = 1;
2
- export const BRIDGE_VERSION = "1.0.10";
2
+ export const BRIDGE_VERSION = "1.0.11";
3
3
  export const BRIDGE_PACKAGE_NAME = "@leg3ndy/otto-bridge";
4
4
  export const DEFAULT_API_BASE_URL = "http://localhost:8000";
5
5
  export const DEFAULT_POLL_INTERVAL_MS = 3000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leg3ndy/otto-bridge",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Local companion for Otto Bridge device pairing and WebSocket runtime.",
@@ -24,7 +24,7 @@ if (!existsSync(mainPath)) {
24
24
  process.exit(0);
25
25
  }
26
26
 
27
- console.log("\n[otto-bridge] Welcome to OTTOAI 1.0.10");
27
+ console.log("\n[otto-bridge] Welcome to OTTOAI 1.0.11");
28
28
  console.log("[otto-bridge] Vamos iniciar o setup interativo do bridge.\n");
29
29
 
30
30
  const result = spawnSync(process.execPath, [mainPath, "setup", "--postinstall"], {