chatwire 0.2.0__tar.gz → 0.2.2__tar.gz

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.
Files changed (44) hide show
  1. {chatwire-0.2.0/chatwire.egg-info → chatwire-0.2.2}/PKG-INFO +5 -12
  2. {chatwire-0.2.0 → chatwire-0.2.2}/README.md +4 -11
  3. {chatwire-0.2.0 → chatwire-0.2.2}/_version.py +1 -1
  4. {chatwire-0.2.0 → chatwire-0.2.2/chatwire.egg-info}/PKG-INFO +5 -12
  5. {chatwire-0.2.0 → chatwire-0.2.2}/chatwire_cli.py +29 -4
  6. {chatwire-0.2.0 → chatwire-0.2.2}/config.py +14 -1
  7. {chatwire-0.2.0 → chatwire-0.2.2}/LICENSE +0 -0
  8. {chatwire-0.2.0 → chatwire-0.2.2}/bridge.py +0 -0
  9. {chatwire-0.2.0 → chatwire-0.2.2}/chat_db.py +0 -0
  10. {chatwire-0.2.0 → chatwire-0.2.2}/chat_send.py +0 -0
  11. {chatwire-0.2.0 → chatwire-0.2.2}/chatwire.egg-info/SOURCES.txt +0 -0
  12. {chatwire-0.2.0 → chatwire-0.2.2}/chatwire.egg-info/dependency_links.txt +0 -0
  13. {chatwire-0.2.0 → chatwire-0.2.2}/chatwire.egg-info/entry_points.txt +0 -0
  14. {chatwire-0.2.0 → chatwire-0.2.2}/chatwire.egg-info/requires.txt +0 -0
  15. {chatwire-0.2.0 → chatwire-0.2.2}/chatwire.egg-info/top_level.txt +0 -0
  16. {chatwire-0.2.0 → chatwire-0.2.2}/contacts.py +0 -0
  17. {chatwire-0.2.0 → chatwire-0.2.2}/echo_log.py +0 -0
  18. {chatwire-0.2.0 → chatwire-0.2.2}/integrations/__init__.py +0 -0
  19. {chatwire-0.2.0 → chatwire-0.2.2}/integrations/base.py +0 -0
  20. {chatwire-0.2.0 → chatwire-0.2.2}/integrations/telegram/__init__.py +0 -0
  21. {chatwire-0.2.0 → chatwire-0.2.2}/integrations/web/__init__.py +0 -0
  22. {chatwire-0.2.0 → chatwire-0.2.2}/integrations/webhook/__init__.py +0 -0
  23. {chatwire-0.2.0 → chatwire-0.2.2}/migrations/0001_initial.py +0 -0
  24. {chatwire-0.2.0 → chatwire-0.2.2}/migrations/0002_integration_split.py +0 -0
  25. {chatwire-0.2.0 → chatwire-0.2.2}/migrations/__init__.py +0 -0
  26. {chatwire-0.2.0 → chatwire-0.2.2}/prefix.py +0 -0
  27. {chatwire-0.2.0 → chatwire-0.2.2}/pyproject.toml +0 -0
  28. {chatwire-0.2.0 → chatwire-0.2.2}/setup.cfg +0 -0
  29. {chatwire-0.2.0 → chatwire-0.2.2}/templates/__init__.py +0 -0
  30. {chatwire-0.2.0 → chatwire-0.2.2}/templates/launchd/bridge.plist.template +0 -0
  31. {chatwire-0.2.0 → chatwire-0.2.2}/templates/launchd/keepawake.plist.template +0 -0
  32. {chatwire-0.2.0 → chatwire-0.2.2}/templates/launchd/web.plist.template +0 -0
  33. {chatwire-0.2.0 → chatwire-0.2.2}/web/main.py +0 -0
  34. {chatwire-0.2.0 → chatwire-0.2.2}/web/setup_wizard.py +0 -0
  35. {chatwire-0.2.0 → chatwire-0.2.2}/web/static/favicon.svg +0 -0
  36. {chatwire-0.2.0 → chatwire-0.2.2}/web/static/style.css +0 -0
  37. {chatwire-0.2.0 → chatwire-0.2.2}/web/static/sw.js +0 -0
  38. {chatwire-0.2.0 → chatwire-0.2.2}/web/static/update-check.js +0 -0
  39. {chatwire-0.2.0 → chatwire-0.2.2}/web/templates/_conversation.html +0 -0
  40. {chatwire-0.2.0 → chatwire-0.2.2}/web/templates/_conversations.html +0 -0
  41. {chatwire-0.2.0 → chatwire-0.2.2}/web/templates/_settings.html +0 -0
  42. {chatwire-0.2.0 → chatwire-0.2.2}/web/templates/_whitelist_rows.html +0 -0
  43. {chatwire-0.2.0 → chatwire-0.2.2}/web/templates/index.html +0 -0
  44. {chatwire-0.2.0 → chatwire-0.2.2}/whitelist.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chatwire
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: macOS chat-relay bridge: iMessage <-> Telegram, web UI, and pluggable integrations
5
5
  Author: Allen Bina
6
6
  License: MIT License
@@ -104,15 +104,10 @@ Recommended path: **pipx**, against python.org's Python.
104
104
  python3 -m pip install --user pipx
105
105
  python3 -m pipx ensurepath
106
106
 
107
- # Install chatwire (from PyPI, once v0.2.0 ships):
107
+ # Install chatwire from PyPI:
108
108
  pipx install --python /Library/Frameworks/Python.framework/Versions/Current/bin/python3 \
109
109
  chatwire
110
110
 
111
- # Or from the v0.1.0 git tag (still under the old chat-bridge repo URL —
112
- # the GitHub redirect to chatwire keeps this working):
113
- pipx install --python /Library/Frameworks/Python.framework/Versions/Current/bin/python3 \
114
- git+https://github.com/allenbina/chatwire.git@v0.1.0
115
-
116
111
  # Wire it up:
117
112
  chatwire install-agents
118
113
  chatwire setup
@@ -124,12 +119,10 @@ permission grants (Full Disk Access + Automation→Messages), and writes
124
119
 
125
120
  ### Alternate install methods
126
121
 
127
- **Homebrew tap.** Convenient if you already use brew. Note: the formula
128
- still ships under the old `chat-bridge` name in the tap; renaming the
129
- formula is tracked separately.
122
+ **Homebrew tap.** Convenient if you already use brew.
130
123
 
131
124
  ```bash
132
- brew install allenbina/tap/chat-bridge
125
+ brew install allenbina/tap/chatwire
133
126
  chatwire install-agents
134
127
  chatwire setup
135
128
  ```
@@ -142,7 +135,7 @@ Tap source: <https://github.com/allenbina/homebrew-tap>.
142
135
  curl -fsSL https://raw.githubusercontent.com/allenbina/chatwire/main/scripts/install.sh | bash
143
136
  ```
144
137
 
145
- Pin to a tag with `CHATWIRE_REF=v0.1.0`. The script refuses Xcode CLT's
138
+ Pin to a tag with `CHATWIRE_REF=v0.2.0`. The script refuses Xcode CLT's
146
139
  Python stub and warns on Homebrew Python (TCC identity protection). Same
147
140
  post-install steps (`chatwire install-agents` etc.).
148
141
 
@@ -48,15 +48,10 @@ Recommended path: **pipx**, against python.org's Python.
48
48
  python3 -m pip install --user pipx
49
49
  python3 -m pipx ensurepath
50
50
 
51
- # Install chatwire (from PyPI, once v0.2.0 ships):
51
+ # Install chatwire from PyPI:
52
52
  pipx install --python /Library/Frameworks/Python.framework/Versions/Current/bin/python3 \
53
53
  chatwire
54
54
 
55
- # Or from the v0.1.0 git tag (still under the old chat-bridge repo URL —
56
- # the GitHub redirect to chatwire keeps this working):
57
- pipx install --python /Library/Frameworks/Python.framework/Versions/Current/bin/python3 \
58
- git+https://github.com/allenbina/chatwire.git@v0.1.0
59
-
60
55
  # Wire it up:
61
56
  chatwire install-agents
62
57
  chatwire setup
@@ -68,12 +63,10 @@ permission grants (Full Disk Access + Automation→Messages), and writes
68
63
 
69
64
  ### Alternate install methods
70
65
 
71
- **Homebrew tap.** Convenient if you already use brew. Note: the formula
72
- still ships under the old `chat-bridge` name in the tap; renaming the
73
- formula is tracked separately.
66
+ **Homebrew tap.** Convenient if you already use brew.
74
67
 
75
68
  ```bash
76
- brew install allenbina/tap/chat-bridge
69
+ brew install allenbina/tap/chatwire
77
70
  chatwire install-agents
78
71
  chatwire setup
79
72
  ```
@@ -86,7 +79,7 @@ Tap source: <https://github.com/allenbina/homebrew-tap>.
86
79
  curl -fsSL https://raw.githubusercontent.com/allenbina/chatwire/main/scripts/install.sh | bash
87
80
  ```
88
81
 
89
- Pin to a tag with `CHATWIRE_REF=v0.1.0`. The script refuses Xcode CLT's
82
+ Pin to a tag with `CHATWIRE_REF=v0.2.0`. The script refuses Xcode CLT's
90
83
  Python stub and warns on Homebrew Python (TCC identity protection). Same
91
84
  post-install steps (`chatwire install-agents` etc.).
92
85
 
@@ -9,4 +9,4 @@ Format: PEP 440-flavored semver. Pre-1.0 dev builds carry a `-dev` suffix
9
9
  which the update-check JS treats as "skip the check" (no point pinging
10
10
  GitHub when you cloned from main).
11
11
  """
12
- __version__ = "0.2.0"
12
+ __version__ = "0.2.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chatwire
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: macOS chat-relay bridge: iMessage <-> Telegram, web UI, and pluggable integrations
5
5
  Author: Allen Bina
6
6
  License: MIT License
@@ -104,15 +104,10 @@ Recommended path: **pipx**, against python.org's Python.
104
104
  python3 -m pip install --user pipx
105
105
  python3 -m pipx ensurepath
106
106
 
107
- # Install chatwire (from PyPI, once v0.2.0 ships):
107
+ # Install chatwire from PyPI:
108
108
  pipx install --python /Library/Frameworks/Python.framework/Versions/Current/bin/python3 \
109
109
  chatwire
110
110
 
111
- # Or from the v0.1.0 git tag (still under the old chat-bridge repo URL —
112
- # the GitHub redirect to chatwire keeps this working):
113
- pipx install --python /Library/Frameworks/Python.framework/Versions/Current/bin/python3 \
114
- git+https://github.com/allenbina/chatwire.git@v0.1.0
115
-
116
111
  # Wire it up:
117
112
  chatwire install-agents
118
113
  chatwire setup
@@ -124,12 +119,10 @@ permission grants (Full Disk Access + Automation→Messages), and writes
124
119
 
125
120
  ### Alternate install methods
126
121
 
127
- **Homebrew tap.** Convenient if you already use brew. Note: the formula
128
- still ships under the old `chat-bridge` name in the tap; renaming the
129
- formula is tracked separately.
122
+ **Homebrew tap.** Convenient if you already use brew.
130
123
 
131
124
  ```bash
132
- brew install allenbina/tap/chat-bridge
125
+ brew install allenbina/tap/chatwire
133
126
  chatwire install-agents
134
127
  chatwire setup
135
128
  ```
@@ -142,7 +135,7 @@ Tap source: <https://github.com/allenbina/homebrew-tap>.
142
135
  curl -fsSL https://raw.githubusercontent.com/allenbina/chatwire/main/scripts/install.sh | bash
143
136
  ```
144
137
 
145
- Pin to a tag with `CHATWIRE_REF=v0.1.0`. The script refuses Xcode CLT's
138
+ Pin to a tag with `CHATWIRE_REF=v0.2.0`. The script refuses Xcode CLT's
146
139
  Python stub and warns on Homebrew Python (TCC identity protection). Same
147
140
  post-install steps (`chatwire install-agents` etc.).
148
141
 
@@ -88,9 +88,28 @@ def _default_install_dir() -> Path:
88
88
 
89
89
 
90
90
  def _default_venv_python() -> Path:
91
- """sys.executable when run from the venv is the venv's python — that's
92
- the right default. When run from a system python (e.g. during initial
93
- bootstrap), the user must pass --venv-python explicitly."""
91
+ """Return the venv's bin/python<major.minor> (the binary whose sys.path
92
+ includes the chatwire install).
93
+
94
+ NOT sys.executable: on macOS framework Python (python.org), the pipx
95
+ venv's bin/python3.X is a symlink/copy of the framework binary, and
96
+ sys.executable returns the *resolved* base path. Plists rendered with
97
+ sys.executable would invoke the base Python and miss the venv's
98
+ site-packages, so the web agent fails on `import fastapi` and the
99
+ bridge runs but sees no integrations (lazy imports mask the same root
100
+ cause).
101
+
102
+ Outside a venv, sys.prefix == sys.base_prefix and we just hand back
103
+ sys.executable.
104
+ """
105
+ if sys.prefix != sys.base_prefix:
106
+ venv_bin = Path(sys.prefix) / "bin"
107
+ for name in (f"python{sys.version_info.major}.{sys.version_info.minor}",
108
+ f"python{sys.version_info.major}",
109
+ "python"):
110
+ p = venv_bin / name
111
+ if p.exists():
112
+ return p
94
113
  return Path(sys.executable)
95
114
 
96
115
 
@@ -111,7 +130,13 @@ def _label(label_prefix: str, name: str) -> str:
111
130
  def cmd_install_agents(args: argparse.Namespace) -> int:
112
131
  _require_macos()
113
132
  install_dir = Path(args.install_dir).resolve()
114
- venv_python = Path(args.venv_python).resolve()
133
+ # NOT .resolve() — on macOS framework Python (python.org), the pipx
134
+ # venv's bin/python3.X is a symlink to the framework binary, and
135
+ # resolve() would dereference it. The plist needs the VENV-form path
136
+ # so that Python boots with sys.prefix pointing at the venv (and so
137
+ # finds the venv's site-packages); invoking the framework binary
138
+ # directly skips the venv and the import of fastapi etc. fails.
139
+ venv_python = Path(args.venv_python).absolute()
115
140
  log_dir = Path(args.log_dir).resolve()
116
141
  label_prefix = args.label_prefix
117
142
 
@@ -221,6 +221,13 @@ def migrate_legacy_env() -> bool:
221
221
  """If config.json is absent and a legacy .env exists, write config.json
222
222
  from it. Returns True if a migration ran. Idempotent: a no-op once
223
223
  config.json exists.
224
+
225
+ The legacy .env is v1-flat (TELEGRAM_BOT_TOKEN at the root, etc.). We
226
+ apply the schema migrations before saving so the on-disk file is the
227
+ current shape — otherwise save_config would stamp version=CURRENT_VERSION
228
+ over v1-flat content, the load-time `apply_pending` would skip (version
229
+ already current), and the bridge would see a v2 schema with empty
230
+ `integrations` and refuse to start.
224
231
  """
225
232
  if CONFIG_PATH.exists():
226
233
  return False
@@ -229,5 +236,11 @@ def migrate_legacy_env() -> bool:
229
236
  return False
230
237
  log.info("migrating %s → %s (%d keys)",
231
238
  LEGACY_ENV_PATH, CONFIG_PATH, len(legacy))
232
- save_config(legacy)
239
+ cfg = {"version": 1, **{k: v for k, v in legacy.items() if k != "version"}}
240
+ try:
241
+ import migrations
242
+ cfg, _ = migrations.apply_pending(cfg)
243
+ except ImportError:
244
+ log.warning("migrations module unavailable; saving as v1")
245
+ save_config(cfg)
233
246
  return True
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes