refactor(capture-kit): one provider app-log owner for polling, envelope, and reattach
Merged
TH
8d ago+986+986+012345678901234567890123456789-473-473-012345678901234567890123456789
Summary
This moves Limrun's app-log owner into @agent-device/capture-kit/provider-app-log so Doublespeed (#2112) can use it instead of copying about 600 lines. This is the first step the latest #2112 review asked for.
createProviderAppLogOperationsprovidesappLogStart, reattach/cleanup, doctor, inspect, and the app-log-backednetworkDump. Its inputs are a reader port (readLogs(appBundleId, lineLimit, signal)and dispose), a descriptor codec,describe,matchesDevice,reconnect, and the provider's own message and check key.- The poller, the durable envelope, and the tail de-duplication now exist once. Providers keep their codecs, reader acquisition, reconnect, and admission.
- Fix: the poller now advances
previousonly afteroutput.writesucceeds. Before, a failed write dropped that delta. The new test fails if the old order is restored. - Unchanged: interval, timeout, line limit, recovery states, and Limrun's user-visible messages. Limrun's reader ignores
signal, and the poller abandons a read that outlives its 5-second budget, as before.
Production lines: +297/−234 across 9 files, with one consumer. Doublespeed's copies are deleted when it adopts this module.
Validation
At b8068008bf:
pnpm check:affected --runpassed. It ran the full gate set, because thepackage.jsonchange makes the selector run everything.pnpm typecheckandlintpassed.- 71 app-log tests passed: the shared poller and operations tests, plus new Limrun iOS/Android adapter tests for the descriptor, backend, doctor key, and missing-instance error.
There was no live Limrun run, so provider integration evidence comes from CI.