← Commit history

dev skill: record the caller-identity contract (caller_identity.py, ad_callback forwarding, the no-ADOM_AI_THREAD rule, the hwnd gap)

John Lauer ·a8460a60f4 ·2mo ago ·parent e661d5d
1 file changed +24
skills/kicad-bridge-dev/SKILL.md+24
@@ -161,6 +161,30 @@ Audit 2026-07-19 found **649 KB** of never-referenced weight (219 KB of hero *fo duplicated `skills/` trees, demo docs in the zip; 496 KB of PNGs in the pkg). Don't re-grow it โ€” full KEEP/EXCLUDE policy lives in `kicad-bridge-publish` ยง2/ยง4. +## ๐Ÿชช Caller provenance (AD 1.9.180 / 1.9.183) โ€” `caller_identity.py`++A user runs ~20 AI threads against one desktop. AD stamps `X-Adom-Caller-Thread`+/ `-Container` / `-Reason` on every relayed request. `do_POST` captures them via+`caller_identity.set_from_headers()` and clears them in `finally`; the per-verb+log line carries `caller="..."` (empty for loopback/anon callers).++**When you add a verb that calls an AD verb back** (`desktop_screenshot_window`,+`desktop_set_window_identity`, `notify_user`, `desktop_taskbar`), use+`caller_identity.ad_callback(command, args)` โ€” it forwards the three headers and+adds `X-Adom-Caller-Delegate: kicad`, so AD shows `chip-fetcher tab 3 (via kicad)`.+For a self-initiated call (poll/timer/cleanup) pass `on_behalf=False` so it sends+`caller: {aiThread: "kicad bridge (self)"}` instead of a stale forwarded thread.++**Rules:** identity is SELF-ASSERTED โ€” logging / UX / window labels / arbitration+hints ONLY, NEVER authorization (`if thread == "admin": allow()` is a hole). Do+not document or export `ADOM_AI_THREAD` โ€” it scopes to a shell env shared by ~20+threads (withdrawn in the 1.9.183 notice); the per-call mechanism is+`adom-desktop --ai-thread "<name>" <verb>`, precedence `caller` in args > flag > env.++**Open gap:** the `open_*` handlers don't surface `hwnd` in their result, so the+#12.3 window-labeling only fires for verbs that do (`place_footprint`). Thread+`hwnd` through the open handlers to light it up for every editor window.+ ## ๐ŸŽฌ The demo verb (`kicad_demo`) โ€” match the ecosystem contract  HD's installer demos BOTH bridges, so `kicad_demo` deliberately returns the SAME