witbitz-code 1.15.5__tar.gz → 1.15.6__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 (123) hide show
  1. {witbitz_code-1.15.5/src/witbitz_code.egg-info → witbitz_code-1.15.6}/PKG-INFO +1 -1
  2. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/pyproject.toml +1 -1
  3. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/__init__.py +1 -1
  4. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/pair.py +20 -5
  5. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/ui.py +1 -1
  6. {witbitz_code-1.15.5 → witbitz_code-1.15.6/src/witbitz_code.egg-info}/PKG-INFO +1 -1
  7. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_device.py +42 -0
  8. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/LICENSE +0 -0
  9. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/README.md +0 -0
  10. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/setup.cfg +0 -0
  11. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/__main__.py +0 -0
  12. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/_js.py +0 -0
  13. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/account.py +0 -0
  14. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/app.py +0 -0
  15. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/asks.py +0 -0
  16. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/attachments.py +0 -0
  17. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/auto.py +0 -0
  18. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/auto_runner.py +0 -0
  19. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/browse.py +0 -0
  20. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/browsetree.py +0 -0
  21. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/cli.py +0 -0
  22. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/codekeys.py +0 -0
  23. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/codetools.py +0 -0
  24. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/compress.py +0 -0
  25. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/computers.py +0 -0
  26. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/confidential.py +0 -0
  27. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/confidential_models.json +0 -0
  28. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/connector.py +0 -0
  29. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/device.py +0 -0
  30. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/devicelink.py +0 -0
  31. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/dirs.py +0 -0
  32. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/files.py +0 -0
  33. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/folders.py +0 -0
  34. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/gateway.py +0 -0
  35. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/icons/witbitz-code-wsl.ico +0 -0
  36. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/icons/witbitz-code.ico +0 -0
  37. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/images.py +0 -0
  38. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/keys.py +0 -0
  39. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/link.py +0 -0
  40. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/mkdir.py +0 -0
  41. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/models.py +0 -0
  42. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/net.py +0 -0
  43. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/offered_models.json +0 -0
  44. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/opencode_plugins/notes-init.md +0 -0
  45. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/opencode_plugins/witbitz-browse-cdp.mjs +0 -0
  46. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/opencode_plugins/witbitz-browse-local.mjs +0 -0
  47. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/opencode_plugins/witbitz-browse-publisher.mjs +0 -0
  48. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/opencode_plugins/witbitz-browse-tree.mjs +0 -0
  49. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/opencode_plugins/witbitz-browser.js +0 -0
  50. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/opencode_plugins/witbitz-media-server.mjs +0 -0
  51. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/opencode_plugins/witbitz-notes.js +0 -0
  52. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/opencode_plugins/witbitz-progress.js +0 -0
  53. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/outputs.py +0 -0
  54. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/pairings.py +0 -0
  55. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/payers.py +0 -0
  56. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/plugins.py +0 -0
  57. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/policy.py +0 -0
  58. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/ports.py +0 -0
  59. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/qr.py +0 -0
  60. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/receipt.py +0 -0
  61. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/relay.py +0 -0
  62. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/remind.py +0 -0
  63. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/seccheck.py +0 -0
  64. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/seen.py +0 -0
  65. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/selfupdate.py +0 -0
  66. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/tinfoil_read.py +0 -0
  67. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/tools_catalog.json +0 -0
  68. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/tools_probe.py +0 -0
  69. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/toolsetup.py +0 -0
  70. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/ui_static/app.css +0 -0
  71. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/ui_static/app.js +0 -0
  72. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/ui_static/index.html +0 -0
  73. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/uitools.py +0 -0
  74. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/uninstall.py +0 -0
  75. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/winagent.py +0 -0
  76. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/winbg.py +0 -0
  77. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/winconsole.py +0 -0
  78. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/wizard.py +0 -0
  79. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code/wslstart.py +0 -0
  80. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code.egg-info/SOURCES.txt +0 -0
  81. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code.egg-info/dependency_links.txt +0 -0
  82. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code.egg-info/entry_points.txt +0 -0
  83. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code.egg-info/requires.txt +0 -0
  84. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/src/witbitz_code.egg-info/top_level.txt +0 -0
  85. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_asks.py +0 -0
  86. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_attachments.py +0 -0
  87. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_auto.py +0 -0
  88. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_browse.py +0 -0
  89. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_browsetree.py +0 -0
  90. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_cli.py +0 -0
  91. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_codekeys.py +0 -0
  92. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_codetools.py +0 -0
  93. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_confidential.py +0 -0
  94. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_connector_e2e.py +0 -0
  95. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_devicelink.py +0 -0
  96. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_dirs.py +0 -0
  97. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_files.py +0 -0
  98. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_files_and_compress.py +0 -0
  99. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_folders.py +0 -0
  100. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_images.py +0 -0
  101. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_outputs.py +0 -0
  102. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_pair_flows.py +0 -0
  103. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_plugins.py +0 -0
  104. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_policy.py +0 -0
  105. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_ports.py +0 -0
  106. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_ports_win.py +0 -0
  107. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_registry.py +0 -0
  108. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_relay_codec.py +0 -0
  109. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_remind.py +0 -0
  110. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_seccheck.py +0 -0
  111. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_selfupdate.py +0 -0
  112. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_setup.py +0 -0
  113. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_tools_probe.py +0 -0
  114. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_toolsetup.py +0 -0
  115. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_ui.py +0 -0
  116. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_ui_page.py +0 -0
  117. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_uitools.py +0 -0
  118. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_uninstall.py +0 -0
  119. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_winagent.py +0 -0
  120. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_winbg.py +0 -0
  121. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_winconsole.py +0 -0
  122. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_windows_files.py +0 -0
  123. {witbitz_code-1.15.5 → witbitz_code-1.15.6}/tests/test_wslstart.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: witbitz-code
3
- Version: 1.15.5
3
+ Version: 1.15.6
4
4
  Summary: Reach OpenCode on this computer from the Witbitz Spaces Code section, through an end-to-end sealed relay.
5
5
  Author: Witbitz
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "witbitz-code"
7
- version = "1.15.5"
7
+ version = "1.15.6"
8
8
  description = "Reach OpenCode on this computer from the Witbitz Spaces Code section, through an end-to-end sealed relay."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -4,4 +4,4 @@ The Python implementation of tools/witbitz-code.mjs (docs/opencode-relay.md phas
4
4
  vectors and cross-implementation tests.
5
5
  """
6
6
 
7
- __version__ = "1.15.5"
7
+ __version__ = "1.15.6"
@@ -11,6 +11,7 @@ so every paired account reaches the same sessions, files and shell; this tool sa
11
11
 
12
12
  from __future__ import annotations
13
13
 
14
+ import inspect
14
15
  import sys
15
16
  from collections.abc import Awaitable, Callable
16
17
  from dataclasses import dataclass
@@ -25,7 +26,7 @@ from . import pairings as pp
25
26
  from ._js import UNDEFINED, number_str, to_number, truthy
26
27
  from .connector import START_HINT
27
28
 
28
- LinkFn = Callable[[], Awaitable[Any]]
29
+ LinkFn = Callable[..., Awaitable[Any]] # () or (device=…) — _takes_device
29
30
 
30
31
 
31
32
  def _out(msg: str) -> None:
@@ -115,17 +116,31 @@ async def _publish_entry(call: net.ApiCall, e: dict, out: Callable, err: Callabl
115
116
  return True
116
117
 
117
118
 
119
+ def _takes_device(fn: Callable) -> bool:
120
+ """Does this link function take the device key (`device=`)? Older injected ones (tests) take nothing."""
121
+ try:
122
+ ps = inspect.signature(fn).parameters
123
+ except (TypeError, ValueError):
124
+ return False
125
+ return "device" in ps or any(p.kind is inspect.Parameter.VAR_KEYWORD for p in ps.values())
126
+
127
+
118
128
  async def _link_by_qr(link_fn: LinkFn | None, out: Callable, err: Callable, name: str = "") -> dict | None:
119
129
  """The QR ritual: show the Add-a-device QR and wait for a signed-in device to seal the account to this computer. The
120
130
  account stays in memory; an expired or failed scan changes nothing."""
121
131
  out("witbitz-code: on your phone open Spaces → Settings → Privacy & security → Add a device, and scan the QR below "
122
132
  "with the account to pair.\n")
133
+ # THIS COMPUTER'S DEVICE KEY (device.py): offered in the code's hello, so an account on the new service registers the
134
+ # computer before it sends anything — a sign-out then reaches it. Kept only if the giver registered it (_run).
135
+ # ★ THE PAGE'S PAIRING TOO (ui.py, the Windows page; the owner, 2026-11-16, iPhone: "This computer's Code connector is too
136
+ # old" for a 1.15.5 computer): it passes its own link_fn, which until now got no key — so its code carried no hello, and
137
+ # an account on the new service could not add the computer at all. A link_fn that takes `device` gets it.
138
+ dev = {**device_mod.new_device_key(), "label": device_mod.hello_label(name)}
123
139
  if link_fn:
124
- account = await link_fn()
140
+ account = await (link_fn(device=dev) if _takes_device(link_fn) else link_fn())
141
+ if isinstance(account, dict) and _takes_device(link_fn):
142
+ account.setdefault("_device", dev)
125
143
  else:
126
- # THIS COMPUTER'S DEVICE KEY (device.py): offered in the code's hello, so an account on the new service registers the
127
- # computer before it sends anything — a sign-out then reaches it. Kept only if the giver registered it (_run).
128
- dev = {**device_mod.new_device_key(), "label": device_mod.hello_label(name)}
129
144
  account = await link.link_node(device=dev)
130
145
  if account:
131
146
  account["_device"] = dev # never saved with the pairing: upsert_pairing takes named fields only
@@ -369,7 +369,7 @@ class Manager:
369
369
  self.log.append(line[:300])
370
370
 
371
371
  try:
372
- code = await self._pair(["--port", str(port)], link_fn=lambda: self._link(challenge=ch, out=note, err=note), out=note, err=note)
372
+ code = await self._pair(["--port", str(port)], link_fn=lambda device=None: self._link(challenge=ch, out=note, err=note, device=device), out=note, err=note)
373
373
  except asyncio.CancelledError:
374
374
  self.pair_state = {**self.pair_state, "state": "idle", "message": "cancelled"}
375
375
  raise
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: witbitz-code
3
- Version: 1.15.5
3
+ Version: 1.15.6
4
4
  Summary: Reach OpenCode on this computer from the Witbitz Spaces Code section, through an end-to-end sealed relay.
5
5
  Author: Witbitz
6
6
  License-Expression: MIT
@@ -319,5 +319,47 @@ def test_pair_keeps_the_device_key_only_when_the_account_service_registered_it()
319
319
  assert device.device_key_for(cid) is None
320
320
 
321
321
 
322
+ def test_the_pages_pairing_offers_the_device_key_and_keeps_it_once_registered():
323
+ """The owner, 2026-11-16: a computer paired from the Windows page (ui.py) carried no hello, so an account on the new
324
+ service could not add it. The page's link_fn now gets the key (pair._link_by_qr), and ui.py hands it to link_node."""
325
+ got = {}
326
+
327
+ async def page_link(device=None):
328
+ got["device"] = device
329
+ return {"email": "me@x", "idx": {"room": "sp-page", "mk": "MK"}, "master": "M" * 43,
330
+ "anchor": {"method": "email", "email": "me@x", "token": "head.payload.sig"},
331
+ "v2": {"acct": "a_9", "base": device_mod_services()[0]}, "origin": "https://witbitz-spaces.pages.dev"}
332
+
333
+ outs = []
334
+ assert run(pair.main(["--name", "desk3"], call=MockApi().call, link_fn=page_link, keys=FakeKeys(), out=outs.append, err=outs.append)) == 0, "\n".join(outs)
335
+ dev = got["device"]
336
+ assert dev and len(dev["spk"]) == 87 and dev["label"] == "Code on desk3"
337
+ cid = next(p["computerId"] for p in pp.read_pairings()["pairings"] if p["idx"]["room"] == "sp-page")
338
+ assert device.device_key_for(cid)["spk"] == dev["spk"], "registered by the giver → kept"
339
+
340
+ # ui.py: the page's link function forwards the key to link_node (the hello)
341
+ from witbitz_code import ui
342
+ seen = {}
343
+
344
+ async def fake_link(**kw):
345
+ seen.update(kw)
346
+ return None
347
+
348
+ async def fake_pair(argv, *, link_fn=None, out=print, err=print):
349
+ await link_fn(device={"spk": "S" * 87, "label": "Code on x"})
350
+ return 1
351
+
352
+ async def never(*_a, **_k):
353
+ return False
354
+
355
+ m = ui.Manager(serve=never, is_listening=never, pair=fake_pair, link_node=fake_link, load_pairings=lambda: [])
356
+ run(m._pair_run(object(), 4096))
357
+ assert seen.get("device") == {"spk": "S" * 87, "label": "Code on x"}
358
+
359
+
360
+ def device_mod_services():
361
+ return device.SERVICES
362
+
363
+
322
364
  if __name__ == "__main__":
323
365
  sys.exit(pytest.main([__file__]))
File without changes
File without changes
File without changes