authoravatarclover caruso<git@paperclover.net>2026-10-20 13:49:53-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-21 02:52:29-07:00
logf8f091ba7269f62f2a325083a02ed25ef1de77f2
tree79e841b0d4c49c8c91dacd31ba406f06ecb7e01e
parent324d9364aab99a3828fd57085de6970258f52b0c
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Preserve Unicode in Mac VM clipboard transfers

Select UTF-8 explicitly on both host and guest clipboard tools, and document the installed access helper and verified GUI environment. Assisted-by: gpt-6-astra

4 files changed, 22 insertions(+), 8 deletions(-)

tools/code-vm+2-2
...@@ -7,10 +7,10 @@ import sys...@@ -7,10 +7,10 @@ import sys
77
8helper = str(Path(__file__).resolve().with_name("mac-agent-vm.py"))8helper = str(Path(__file__).resolve().with_name("mac-agent-vm.py"))
9if sys.argv[1:] == ["--clipboard"]:9if sys.argv[1:] == ["--clipboard"]:
10 with subprocess.Popen(["/usr/bin/pbpaste"], stdout=subprocess.PIPE) as clipboard:10 with subprocess.Popen(["/usr/bin/pbpaste"], env={**os.environ, "LC_CTYPE": "en_US.UTF-8"}, stdout=subprocess.PIPE) as clipboard:
11 try:11 try:
12 result = subprocess.run(12 result = subprocess.run(
13 [sys.executable, helper, "exec", "/usr/bin/pbcopy"],13 [sys.executable, helper, "exec", "/usr/bin/env", "LC_CTYPE=en_US.UTF-8", "/usr/bin/pbcopy"],
14 stdin=clipboard.stdout,14 stdin=clipboard.stdout,
15 )15 )
16 finally:16 finally:
tools/mac-agent-vm.md+17-4
...@@ -95,7 +95,8 @@ force-off, deletion, and preset creation are unavailable for this managed VM....@@ -95,7 +95,8 @@ force-off, deletion, and preset creation are unavailable for this managed VM.
9595
96## Guest access96## Guest access
9797
98`~/.local/bin/code-vm` links to `tools/code-vm`:98`~/.local/bin/code-vm` links to the installed `runtime/control/code-vm` under
99the VM home, alongside its helper:
99100
100```sh101```sh
101code-vm # Interactive SSH shell102code-vm # Interactive SSH shell
...@@ -192,9 +193,21 @@ deliberately between test runs, then recheck GUI permissions and boot....@@ -192,9 +193,21 @@ deliberately between test runs, then recheck GUI permissions and boot.
192193
193Initial provisioning installed Rust/Cargo 1.99.1, Node 24.22.0 LTS, npm 11.19.1,194Initial provisioning installed Rust/Cargo 1.99.1, Node 24.22.0 LTS, npm 11.19.1,
194pnpm 12.14.0, Jujutsu 0.42.0, and Apple's CLT with Clang 17 and the macOS SDK.195pnpm 12.14.0, Jujutsu 0.42.0, and Apple's CLT with Clang 17 and the macOS SDK.
195Subsequent guest setup manages toolchain versions and paths. Login shells load196Subsequent guest setup manages toolchain versions and paths in
196their paths from `~/.zprofile` or `~/.profile`; use197`~/config/users/clover/agents/vm` on the host. Its installed `env.zsh` is linked
197`exec /bin/zsh -lc ...` for development commands.198from the guest's `~/.zshenv`, including non-login shells. The development
199LaunchAgent publishes the same environment to newly launched GUI apps. Existing
200apps retain their inherited environment until relaunched. `/bin/zsh` has a
201separate guest Full Disk Access approval so launchd can read this configuration
202on Code. The Apple-tools LaunchAgent retries failed image attachment every
20330 seconds and recognizes already mounted images.
204
205On 2026-10-20, a fresh launchd process resolved Cargo, Node, pnpm, and Zig and
206reported the Code-backed cache paths. Existing Apple and kache mounts remained
207available. A Mac restart was explicitly deferred by Clover; these live checks
208do not establish cold-boot recovery. A dashboard clipboard round-trip preserved
209accented text, emoji, and Japanese text with UTF-8 selected explicitly for
210`pbcopy` and `pbpaste`.
198211
199## Provenance212## Provenance
200213
tools/mac-vm-bridge.py+2-1
...@@ -74,7 +74,8 @@ def main():...@@ -74,7 +74,8 @@ def main():
74 value = request["text"]74 value = request["text"]
75 if not isinstance(value, str) or len(value.encode()) > 262144:75 if not isinstance(value, str) or len(value.encode()) > 262144:
76 raise ValueError("Shorten the clipboard text, then send it again.")76 raise ValueError("Shorten the clipboard text, then send it again.")
77 vm.tart("exec", "-i", vm.NAME, "/usr/bin/pbcopy", input=value.encode(), capture_output=True, timeout=15)77 vm.tart("exec", "-i", vm.NAME, "/usr/bin/env", "LC_CTYPE=en_US.UTF-8", "/usr/bin/pbcopy",
78 input=value.encode(), capture_output=True, timeout=15)
78 respond({"value": None})79 respond({"value": None})
79 elif action == "console" and set(request) == {"action"}:80 elif action == "console" and set(request) == {"action"}:
80 with vm.guest_screen() as upstream:81 with vm.guest_screen() as upstream:
tools/mac-vm-test.py+1-1
...@@ -38,7 +38,7 @@ class MacVMTests(unittest.TestCase):...@@ -38,7 +38,7 @@ class MacVMTests(unittest.TestCase):
38 with patch.object(sys, "stdin", io.TextIOWrapper(io.BytesIO(request))), \38 with patch.object(sys, "stdin", io.TextIOWrapper(io.BytesIO(request))), \
39 patch.object(bridge.vm, "tart") as tart, patch.object(bridge, "respond") as respond:39 patch.object(bridge.vm, "tart") as tart, patch.object(bridge, "respond") as respond:
40 bridge.main()40 bridge.main()
41 self.assertEqual(tart.call_args.args, ("exec", "-i", "gui-agent", "/usr/bin/pbcopy"))41 self.assertEqual(tart.call_args.args, ("exec", "-i", "gui-agent", "/usr/bin/env", "LC_CTYPE=en_US.UTF-8", "/usr/bin/pbcopy"))
42 self.assertEqual(tart.call_args.kwargs["input"], value.encode())42 self.assertEqual(tart.call_args.kwargs["input"], value.encode())
43 respond.assert_called_once_with({"value": None})43 respond.assert_called_once_with({"value": None})
4444