feat(chord,durable): PendingOps folds pending ops for slow consumers; Watch delivers one call per busy period

- chord/delta: PendingOps (push, size, take -> PendingTake): raw pending ops, r drops everything
  before it, a leaf index merges appends and primitive sets per path (cleared by any other op),
  past 10,000 ops only "replace with the current value"; one batch is kept by reference and
  received ops are never mutated
- chord: Watch queues frames in PendingOps while its listener is busy or not started and delivers
  one call with the newest value, the folded ops (or [["r", newest]] after an overflow) and the
  newest frame's context; replaces the 100-frame collapse. NativeWatch is unchanged and takes an
  optional replace()
- durable: watchEvents keeps every event batch in order (NativeWatch with a snapshot replace);
  document, view and task-graph watches fold; spec, README, example 04 and tests updated
- tests: fold fuzzers (tracker, appendText, splices/reorders, root arrays, diffRevisions) with
  codec round trips, adversarial cases, cap, ownership, cost and GC guards
This commit is contained in:
Mario Zechner 2026-10-24 09:37:12 +00:00
parent 1e42501bb3
commit d8d99950ac
20 changed files with 1434 additions and 240 deletions

View file

@ -66,8 +66,9 @@ const BUDGETS = {
// (index, noop, metrics, memory) for its NOOP telemetry default; harness/telemetry.ts is Durable's schema.
// The Harness's request identity reaches pi-ai's utils/identity.ts and its version constant. Partial commits
// parse streamed tool-call arguments with pi-ai's utils/streaming-json.ts (and its json-parse.ts) to append what
// argument strings grew by (harness/partial-changes.ts).
maxFiles: 76,
// argument strings grew by (harness/partial-changes.ts). Chord's watches fold pending ops with Delta's
// pending queue (delta/pending.ts).
maxFiles: 77,
forbid: [
"packages/ai/src/index.ts",
"packages/ai/src/utils/typebox-helpers.ts",