@leg3ndy/otto-bridge 1.0.10 → 1.0.12

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.12`, com composer TTY simplificado para um prompt multiline sem moldura, cursor alinhado ao placeholder e newline sem abrir caixas duplicadas, veja [`leg3ndy-ai-backend/docs/otto-bridge/releases/OTTO_BRIDGE_1_0_12_PATCH.md`](../leg3ndy-ai-backend/docs/otto-bridge/releases/OTTO_BRIDGE_1_0_12_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.12.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.12`, `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.12` 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.12` preserva esse fluxo, simplifica o prompt TTY para evitar artefatos de moldura em 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.12`:
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.12`:
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.12
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 = 2;
56
58
  class CliRuntimeSession {
57
59
  config;
58
60
  runtime = null;
@@ -672,28 +674,6 @@ function printConsoleScreen(runtimeSession, modelMode) {
672
674
  printSoft(`Comandos: ${CONSOLE_COMMAND_HINT}`);
673
675
  console.log("");
674
676
  }
675
- function renderPromptFrameLine(width, edgeLeft, edgeRight) {
676
- return style(`${edgeLeft}${"─".repeat(width)}${edgeRight}`, ANSI.brandBlue, supportsAnsi());
677
- }
678
- function renderConsolePromptContentLine(text, width, tone) {
679
- const enabled = supportsAnsi();
680
- const border = style("│", ANSI.brandBlue, enabled);
681
- if (tone === "input") {
682
- const prompt = `${style(">", `${ANSI.bold}${ANSI.white}`, enabled)} ${" ".repeat(Math.max(0, width - 2))}`;
683
- return `${border} ${prompt} ${border}`;
684
- }
685
- const clipped = padRight(truncate(text, width), width);
686
- const body = tone === "placeholder"
687
- ? style(clipped, `${ANSI.bold}${ANSI.white}`, enabled)
688
- : style(clipped, ANSI.slateItalic, enabled);
689
- return `${border} ${body} ${border}`;
690
- }
691
- function saveCursorPosition() {
692
- output.write("\u001b[s");
693
- }
694
- function restoreCursorPosition() {
695
- output.write("\u001b[u");
696
- }
697
677
  function enableTerminalEnhancedKeys() {
698
678
  output.write("\u001b[>4;2m");
699
679
  }
@@ -716,8 +696,7 @@ function sliceByWidth(text, width) {
716
696
  return parts.length ? parts : [""];
717
697
  }
718
698
  export function buildConsoleComposerLayout(value, innerWidth) {
719
- const promptWidth = 2;
720
- const lineContentWidth = Math.max(1, innerWidth - promptWidth);
699
+ const lineContentWidth = Math.max(1, innerWidth - CONSOLE_COMPOSER_PROMPT_WIDTH);
721
700
  if (!value) {
722
701
  return {
723
702
  lines: [CONSOLE_PLACEHOLDER],
@@ -736,7 +715,7 @@ export function buildConsoleComposerLayout(value, innerWidth) {
736
715
  const needsSoftWrapCursorRow = !trailingNewline
737
716
  && lastLogicalLine.length > 0
738
717
  && lastLogicalLine.length % lineContentWidth === 0;
739
- if (trailingNewline || needsSoftWrapCursorRow) {
718
+ if (needsSoftWrapCursorRow) {
740
719
  lines.push("");
741
720
  }
742
721
  const cursorLineIndex = trailingNewline
@@ -778,9 +757,10 @@ function renderConsoleComposerLines(value, innerWidth, enabled) {
778
757
  cursorColumn: layout.cursorColumn,
779
758
  };
780
759
  }
781
- function tryConsumeControlSequence(buffer) {
760
+ export function tryConsumeControlSequence(buffer) {
782
761
  const knownNewlineSequences = [
783
762
  "\u001b[13;2u",
763
+ "\u001b[13;2~",
784
764
  "\u001b[27;2;13~",
785
765
  "\u001b[1;2M",
786
766
  "\u001b\r",
@@ -834,6 +814,8 @@ async function askConsoleInput(rl) {
834
814
  const availableWidth = Number(output.columns || 96);
835
815
  const innerWidth = Math.max(42, Math.min(availableWidth - 8, 116));
836
816
  let renderedOnce = false;
817
+ let lastRenderedLineCount = 0;
818
+ let lastCursorLineIndex = 0;
837
819
  let value = "";
838
820
  let pendingControlBuffer = "";
839
821
  const cleanup = () => {
@@ -846,28 +828,28 @@ async function askConsoleInput(rl) {
846
828
  const render = () => {
847
829
  const composer = renderConsoleComposerLines(value, innerWidth, enabled);
848
830
  if (renderedOnce) {
849
- restoreCursorPosition();
831
+ moveCursor(output, 0, -lastCursorLineIndex);
832
+ cursorTo(output, 0);
850
833
  }
851
834
  else {
852
- saveCursorPosition();
853
835
  renderedOnce = true;
854
836
  }
855
- saveCursorPosition();
856
- const top = renderPromptFrameLine(innerWidth + 2, "┌", "┐");
857
- const border = style("│", ANSI.brandBlue, enabled);
858
- const bottom = renderPromptFrameLine(innerWidth + 2, "└", "┘");
859
- const content = composer.renderedLines.map((line) => `${border} ${line} ${border}`).join("\n");
860
837
  output.write("\u001b[J");
861
- output.write(`${top}\n${content}\n${bottom}`);
862
- restoreCursorPosition();
863
- moveCursor(output, 0, 1 + composer.cursorLineIndex);
864
- cursorTo(output, 4 + composer.cursorColumn);
838
+ output.write(composer.renderedLines.join("\n"));
839
+ moveCursor(output, 0, -Math.max(0, composer.renderedLines.length - 1 - composer.cursorLineIndex));
840
+ cursorTo(output, CONSOLE_COMPOSER_CURSOR_COLUMN + composer.cursorColumn);
841
+ lastRenderedLineCount = composer.renderedLines.length;
842
+ lastCursorLineIndex = composer.cursorLineIndex;
865
843
  };
866
844
  const insertNewline = () => {
867
845
  value = `${value}\n`;
868
846
  render();
869
847
  };
870
848
  const submitPrompt = () => {
849
+ if (renderedOnce) {
850
+ moveCursor(output, 0, Math.max(0, lastRenderedLineCount - 1 - lastCursorLineIndex));
851
+ cursorTo(output, 0);
852
+ }
871
853
  cleanup();
872
854
  output.write("\n");
873
855
  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.12";
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.12",
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.12");
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"], {