@bitefoundry/retrieviewer 0.0.2 → 0.0.3
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.
- package/DESKTOP-PLATFORMS.md +70 -0
- package/INSTALLING.md +8 -5
- package/README.md +12 -9
- package/RELEASING.md +11 -9
- package/integrations/desktop/platform.mjs +27 -0
- package/integrations/linux-overlay/README.md +83 -0
- package/integrations/linux-overlay/overlay.py +1094 -0
- package/integrations/macos-overlay/README.md +83 -0
- package/integrations/macos-overlay/overlay.jxa +637 -0
- package/integrations/windows-overlay/desktop.mjs +40 -8
- package/integrations/windows-overlay/worker.mjs +13 -7
- package/package.json +9 -3
- package/retrieviewer-cli.mjs +10 -3
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# macOS transparent companion helper (JXA)
|
|
2
|
+
|
|
3
|
+
`overlay.jxa` is the macOS painter for the existing Node Braille pet engine. It is
|
|
4
|
+
the macOS counterpart of `integrations/windows-overlay/Overlay.cs` and speaks the
|
|
5
|
+
same NDJSON protocol (`integrations/windows-overlay/protocol.mjs`).
|
|
6
|
+
|
|
7
|
+
It runs with the interpreter that ships with macOS:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
/usr/bin/osascript -l JavaScript integrations/macos-overlay/overlay.jxa # companion
|
|
11
|
+
/usr/bin/osascript -l JavaScript integrations/macos-overlay/overlay.jxa --ipc-test # owned off-screen target
|
|
12
|
+
/usr/bin/osascript -l JavaScript integrations/macos-overlay/overlay.jxa --self-test [proof.tiff]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
No Xcode, Swift compiler, Homebrew, Python, Electron or downloaded binary is
|
|
16
|
+
needed. The helper uses JavaScript for Automation's ObjC bridge to AppKit,
|
|
17
|
+
Foundation and CoreGraphics only. The Node launcher (owned by the main package)
|
|
18
|
+
spawns it with an argv array (never a shell string). Setup is still two steps:
|
|
19
|
+
`npm install -g @bitefoundry/retrieviewer` and then `retrieviewer desktop`.
|
|
20
|
+
|
|
21
|
+
## What it does and does not touch
|
|
22
|
+
|
|
23
|
+
- **Reads only window metadata**: `CGWindowListCopyWindowInfo` (id, owner PID/name,
|
|
24
|
+
bounds, layer, on-screen flag and the title when macOS allows it) plus
|
|
25
|
+
`NSWorkspace.frontmostApplication`. It never captures screen pixels. It does not
|
|
26
|
+
use the Accessibility API, event taps, global monitors, AppleScript/System Events,
|
|
27
|
+
injection or terminal/chat content.
|
|
28
|
+
- **Never requests or changes privacy settings.** Without Screen Recording
|
|
29
|
+
permission macOS withholds other apps' window titles, so the picker shows
|
|
30
|
+
`App · 창 #<windowID>`. No permission prompt is triggered.
|
|
31
|
+
- **Pet**: a borderless `NSPanel` with the `nonactivatingPanel` style. It is clear,
|
|
32
|
+
shadowless and `ignoresMouseEvents = true` (click-through), and it can never become
|
|
33
|
+
key or main. Dots use the Overlay.cs geometry: Braille bit order, half-cell pitch
|
|
34
|
+
and a 0.48 diameter. They are rasterized in JS into one premultiplied RGBA TIFF per
|
|
35
|
+
frame (Retina 2x when it costs no more than ~2M pixels), so each frame needs only
|
|
36
|
+
a few bridge calls.
|
|
37
|
+
- **Controls**: a separate non-activating strip with 공 / 간식 / 창 / 쉼 / 종료
|
|
38
|
+
buttons. These buttons accept the first click, so using them does not take focus
|
|
39
|
+
from the terminal. A menu bar item, the counterpart of the Windows tray, offers
|
|
40
|
+
choose window / hide-show / quit.
|
|
41
|
+
- **Window scope**: it follows the whole selected window's bounds, including its
|
|
42
|
+
title bar, because the content rect of another app needs Accessibility. It does
|
|
43
|
+
not track tabs. It is shown only while the target app is frontmost **and** the
|
|
44
|
+
target is that app's front window. It hides when the window is minimized, the
|
|
45
|
+
app is hidden, the window is on another Space or the picker is open. It drops the
|
|
46
|
+
target when the window closes.
|
|
47
|
+
- **Grid**: 12pt cells, or 16pt when a 12pt grid would exceed 20000 cells.
|
|
48
|
+
`cellHeight = 2 × cellWidth` (0.5 aspect). Hard cap 125000 cells.
|
|
49
|
+
- **Coordinates**: CG global space (top-left of the primary display, y down) is
|
|
50
|
+
converted to Cocoa (bottom-left, y up) with `y' = H(primary) − (y + h)`. Both
|
|
51
|
+
spaces are in points, so Retina scale and secondary displays with negative
|
|
52
|
+
origins need no special case.
|
|
53
|
+
|
|
54
|
+
## Runloop and I/O
|
|
55
|
+
|
|
56
|
+
- stdin: `NSFileHandle readInBackgroundAndNotifyForModes:` reads on Foundation's
|
|
57
|
+
background thread. A registered `NSObject` subclass receives the completion
|
|
58
|
+
notification on the main runloop. Bytes are split on `\n` at the `NSData` level
|
|
59
|
+
before UTF-8 decoding, so multi-byte Braille characters never split. A line is
|
|
60
|
+
capped at 800000 bytes. EOF quits.
|
|
61
|
+
- A 50ms `NSTimer` in common modes tracks geometry and focus. Frames paint as soon
|
|
62
|
+
as they arrive. Every frame is acknowledged (`painted:false` when stale or
|
|
63
|
+
hidden).
|
|
64
|
+
- `NSApplication run` (accessory policy, no Dock icon) runs the real Cocoa event
|
|
65
|
+
loop. Quitting hides all windows, removes the menu bar item, emits `quit` and
|
|
66
|
+
calls `exit(0)`, so osascript never prints a script result on stdout.
|
|
67
|
+
- stdout carries only `JSON.stringify(...) + "\n"` written through
|
|
68
|
+
`NSFileHandle`. There is no `console.log`.
|
|
69
|
+
|
|
70
|
+
## Verification status
|
|
71
|
+
|
|
72
|
+
`macos-overlay-helper.test.mjs` runs under Node on any OS. It checks the source
|
|
73
|
+
contract: ASCII/ES5-only, no forbidden APIs, wiring of the runloop, stdin and timer,
|
|
74
|
+
and panel flags. It also checks the pure code paths, which run unmodified under
|
|
75
|
+
Node: grid choice against `protocol.mjs`, coordinate conversion, frame validation,
|
|
76
|
+
the rasterizer, the TIFF container, base64, the picker list and the protocol state
|
|
77
|
+
machine. These tests **do not** exercise the ObjC bridge or AppKit.
|
|
78
|
+
|
|
79
|
+
The two live tests (`--self-test`, `--ipc-test`) run only on macOS with
|
|
80
|
+
`/usr/bin/osascript`. They were **not** run during development, which happened on a
|
|
81
|
+
Windows host. Bridge behaviour is unverified until those tests pass on a Mac:
|
|
82
|
+
subclass registration, selector strings, CF array ownership, `isNil()`, first-click
|
|
83
|
+
on non-activating panels and TIFF decoding.
|