Files
pftom 624820f192 fix(research): partition skill-hub cache, re-fetch on install, bound audit lines
Addresses four PR #617 review threads:

- listHubEntries cache key now partitions on a per-process HMAC fingerprint
  of the bearer token (or the literal "public" sentinel for tokenless
  requests). This stops a tokened request that surfaces private hub
  manifests from being served back to a later tokenless request with the
  same (repo, ref, namespace), where `entry.raw` is prompt material.
- installHubEntry no longer trusts caller-supplied `entry.raw`. After the
  SHA equality check it re-fetches the manifest from
  `/repos/.../<entry.source.path>?ref=<entry.source.commitSha>` and
  writes only the freshly fetched bytes; if those bytes drift from
  `entry.raw` the install is rejected. A new `installHubManifest` entry
  point takes a server-owned selector `{ namespace, name, repo,
  pinnedSha }` and is the recommended surface for any future
  `POST /api/skill-hub/install` route — HTTP bodies never carry
  manifest bytes through the writer.
- The audit-log redaction pass now caps array length, object key count,
  and the final serialized JSONL line. Items past the per-container caps
  are replaced with a single truncation marker; lines past the byte cap
  collapse `detail` to a `__truncated` marker carrying the original size,
  so a pathological `detail` cannot block the daemon on synchronous
  JSON.stringify / appendFileSync.
- The Skill Hub example in `docs/research/openwork-aionui-alaude-
  integration.md` now mirrors the safe install path the starter enforces:
  pinned-SHA listing, `installHubManifest` taking a selector + approval,
  re-fetch inside the install path, the quarantine/activation boundary,
  and SHA-pinned sibling-asset fetches.

Adds `apps/daemon/tests/research-audit-log-bounds.test.ts` covering the
new caps, and extends the install test with a re-fetch / drift case plus
selector-based install coverage.

Generated-By: looper 0.4.0 (runner=fixer, agent=claude-code)
2026-05-06 14:15:58 +08:00
..