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
77
88helper = str(Path(__file__).resolve().with_name("mac-agent-vm.py"))
99if 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:
1111 try:
1212 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"],
1414 stdin=clipboard.stdout,
1515 )
1616 finally:
tools/mac-agent-vm.md+17-4
......@@ -95,7 +95,8 @@ force-off, deletion, and preset creation are unavailable for this managed VM.
9595
9696## 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
100101```sh
101102code-vm # Interactive SSH shell
......@@ -192,9 +193,21 @@ deliberately between test runs, then recheck GUI permissions and boot.
192193
193194Initial provisioning installed Rust/Cargo 1.99.1, Node 24.22.0 LTS, npm 11.19.1,
194195pnpm 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 load
196their paths from `~/.zprofile` or `~/.profile`; use
197`exec /bin/zsh -lc ...` for development commands.
196Subsequent guest setup manages toolchain versions and paths in
197`~/config/users/clover/agents/vm` on the host. Its installed `env.zsh` is linked
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
199212## Provenance
200213
tools/mac-vm-bridge.py+2-1
......@@ -74,7 +74,8 @@ def main():
7474 value = request["text"]
7575 if not isinstance(value, str) or len(value.encode()) > 262144:
7676 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)
7879 respond({"value": None})
7980 elif action == "console" and set(request) == {"action"}:
8081 with vm.guest_screen() as upstream:
tools/mac-vm-test.py+1-1
......@@ -38,7 +38,7 @@ class MacVMTests(unittest.TestCase):
3838 with patch.object(sys, "stdin", io.TextIOWrapper(io.BytesIO(request))), \
3939 patch.object(bridge.vm, "tart") as tart, patch.object(bridge, "respond") as respond:
4040 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"))
4242 self.assertEqual(tart.call_args.kwargs["input"], value.encode())
4343 respond.assert_called_once_with({"value": None})
4444