refactor: Centralize Admin authenticated JSON transport

SI
4d ago
+337-112

Summary

Share HTTP/Bearer/JSON error policy across 11 resource adapters while preserving each response shape, query and historical error precedence. Move sandbox fetcher into the owning recoup domain.

Verification

25 original parity checks pass against old/new adapters; the expanded 27-test suite passes after review; typecheck and production build pass. Test harness requires Node 24; application behavior unchanged. Independent review completed.

Scope and review

Part of the user-requested Recoup monorepo untangle-codebase workflow. Audit and decision log preceded implementation. Changes stay in this owning repository; no production deployment or main-branch merge requested. No broad comment/test-pruning sweep. Existing local work and retired checkouts preserved.

Each repository PR is independently reviewable; the Mono report will collect the coordinated audit, retained cases and check limitations.

Review follow-up

Error JSON is now typed as unknown and narrowed before field access. Malformed top-level null/primitive/array responses get the HTTP fallback. Tests preserve error/message ordering and coercion of zero, false and empty strings. This is the only intentional malformed-response behavior correction; typecheck and focused lint pass.