@danhachuel/thunderbolt 0.5.16 → 0.5.17

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.
@@ -130,6 +130,7 @@ def run_direct_canva_thumbnail(
130
130
  get_name = "get-design-content" if "get-design-content" in available else "get_design_content"
131
131
  content = _payload(client.call(get_name, {
132
132
  "design_id": design_id,
133
+ "content_types": ["richtexts"],
133
134
  "user_intent": "Inspect the selected Canva design before applying the thumbnail edit.",
134
135
  }))
135
136
  start_name = "start-editing-transaction" if "start-editing-transaction" in available else "start_editing_transaction"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.5.16",
3
+ "version": "0.5.17",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",
@@ -25,7 +25,6 @@
25
25
  "seed/references/*.md",
26
26
  "seed/references/*.sql",
27
27
  "README.md",
28
- "CHANGELOG.md",
29
28
  "MANUAL-INSTALACAO.md",
30
29
  "THIRD-PARTY-NOTICES.md",
31
30
  "requirements.txt",
@@ -1,9 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import io
3
4
  import os
4
- import signal
5
5
  import sys
6
- from windows_encoding_compat import install as install_windows_encoding, wrap_stream
7
6
 
8
7
  # Este ficheiro é o primeiro módulo Python executado pelo launcher. As
9
8
  # variáveis e os streams precisam de ser corrigidos antes de qualquer import
@@ -12,7 +11,6 @@ os.environ["PYTHONIOENCODING"] = "utf-8"
12
11
  os.environ["PYTHONUTF8"] = "1"
13
12
  os.environ["PYTHONLEGACYWINDOWSSTDIO"] = "1"
14
13
  os.environ["CLICK_NO_WIN_CONSOLE"] = "1"
15
- install_windows_encoding()
16
14
 
17
15
 
18
16
  def _utf8_stream(stream: object) -> object:
@@ -22,7 +20,7 @@ def _utf8_stream(stream: object) -> object:
22
20
  if buffer is None:
23
21
  return stream
24
22
  try:
25
- return wrap_stream(stream)
23
+ return io.TextIOWrapper(buffer, encoding="utf-8", errors="replace", line_buffering=True)
26
24
  except (AttributeError, OSError, ValueError):
27
25
  return stream
28
26
 
@@ -32,13 +30,5 @@ sys.stderr = _utf8_stream(sys.stderr)
32
30
 
33
31
  from streamlit.web.cli import main # noqa: E402
34
32
 
35
-
36
- def custom_sigint_handler(signum: int, frame: object) -> None:
37
- """Exit before Streamlit's Click shutdown handler writes to Win32 console."""
38
- print("\nEncerrando servidor...", file=sys.stderr)
39
- raise SystemExit(0)
40
-
41
-
42
33
  if __name__ == "__main__":
43
- signal.signal(signal.SIGINT, custom_sigint_handler)
44
34
  main()
package/CHANGELOG.md DELETED
@@ -1,17 +0,0 @@
1
- # Changelog
2
-
3
- ## 0.5.16
4
-
5
- Adicionado um handler SIGINT no entry point do Streamlit que encerra o processo de forma controlada antes do handler de shutdown do Streamlit chamar `click.secho`, eliminando o caminho que provocava `LookupError: unknown encoding: utf-16-le` ao pressionar Ctrl+C no Windows.
6
-
7
- ## 0.5.15 (normalizado pelo npm para 0.5.15)
8
-
9
- Aplicada a correcção definitiva do caminho de saída do Click no Windows, com shim UTF-8 carregado antes do Streamlit e teste de regressão para stdout com encoding `utf-16-le`.
10
-
11
- ## 0.5.09 (normalizado pelo npm para 0.5.9)
12
-
13
- Adicionado um shim de compatibilidade que intercepta a escrita de saída do Click antes do carregamento do Streamlit e grava directamente em UTF-8, evitando o caminho nativo que volta a procurar `utf-16-le` durante o shutdown do Windows. Incluídos testes com um console simulado em `utf-16-le`.
14
-
15
- ## 0.5.08 (normalizado pelo npm para 0.5.8)
16
-
17
- Corrigido o erro `LookupError: unknown encoding: utf-16-le` que podia ocorrer durante o shutdown do Streamlit no Windows. O launcher Node agora materializa as variáveis de encoding e `CLICK_NO_WIN_CONSOLE` no processo pai antes de iniciar Python; os workers de automação e pipeline também aplicam as mesmas definições antes dos imports restantes.
@@ -1,67 +0,0 @@
1
- """Windows console compatibility for Click/Streamlit shutdown output."""
2
- from __future__ import annotations
3
-
4
- import io
5
- import os
6
- import sys
7
- from typing import Any, Callable
8
-
9
-
10
- _UTF8_ENV = {
11
- "CLICK_NO_WIN_CONSOLE": "1",
12
- "PYTHONIOENCODING": "utf-8",
13
- "PYTHONUTF8": "1",
14
- }
15
-
16
-
17
- def _safe_click_echo(original: Callable[..., Any]) -> Callable[..., Any]:
18
- def echo(message: Any = None, file: Any = None, nl: bool = True, err: bool = False, color: Any = None) -> Any:
19
- target = file if file is not None else (sys.stderr if err else sys.stdout)
20
- if message is None:
21
- message = ""
22
- text = str(message) + ("\n" if nl else "")
23
- buffer = getattr(target, "buffer", None)
24
- try:
25
- if buffer is not None and hasattr(buffer, "write"):
26
- buffer.write(text.encode("utf-8", "replace"))
27
- if hasattr(buffer, "flush"):
28
- buffer.flush()
29
- else:
30
- target.write(text)
31
- if hasattr(target, "flush"):
32
- target.flush()
33
- return None
34
- except (AttributeError, OSError, UnicodeError, ValueError, LookupError):
35
- # Fall back to Click for non-console streams (files, testing runners).
36
- return original(message, file=file, nl=nl, err=err, color=color)
37
-
38
- echo.__name__ = getattr(original, "__name__", "echo")
39
- echo.__doc__ = getattr(original, "__doc__", None)
40
- return echo
41
-
42
-
43
- def install(*, force: bool = False) -> None:
44
- """Install the Windows-safe Click output path before Streamlit imports Click."""
45
- os.environ.update(_UTF8_ENV)
46
- if not force and os.name != "nt":
47
- return
48
- try:
49
- import click
50
- except ImportError:
51
- return
52
- if getattr(click, "_thunderbolt_utf8_echo", False):
53
- return
54
- click.echo = _safe_click_echo(click.echo)
55
- click._thunderbolt_utf8_echo = True
56
-
57
-
58
- def wrap_stream(stream: Any) -> Any:
59
- """Wrap a text stream as UTF-8 without closing its inherited buffer twice."""
60
- if stream is None or getattr(stream, "buffer", None) is None:
61
- return stream
62
- try:
63
- wrapper = io.TextIOWrapper(stream.buffer, encoding="utf-8", errors="replace", line_buffering=True)
64
- setattr(wrapper, "_thunderbolt_utf8", True)
65
- return wrapper
66
- except (AttributeError, OSError, ValueError):
67
- return stream