refactor(capture-kit): one provider app-log owner for polling, envelope, and reattach

Merged
TH
8d ago
+986-473

Summary

Refs #2616. Supersedes #2624.

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.

  • createProviderAppLogOperations provides appLogStart, reattach/cleanup, doctor, inspect, and the app-log-backed networkDump. 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 previous only after output.write succeeds. 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 --run passed. It ran the full gate set, because the package.json change makes the selector run everything.
  • pnpm typecheck and lint passed.
  • 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.