@adonis-agora/durable 0.54.1 → 0.54.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/dist/assets/spa/assets/index-9kO8tWjg.js +16 -0
  3. package/dist/assets/spa/assets/index-9kO8tWjg.js.map +1 -0
  4. package/dist/assets/spa/index.html +1 -1
  5. package/dist/src/codec-state-store.d.ts +12 -1
  6. package/dist/src/codec-state-store.d.ts.map +1 -1
  7. package/dist/src/codec-state-store.js +38 -0
  8. package/dist/src/codec-state-store.js.map +1 -1
  9. package/dist/src/dashboard/index.d.ts +1 -1
  10. package/dist/src/dashboard/index.js +1 -1
  11. package/dist/src/engine.d.ts +59 -3
  12. package/dist/src/engine.d.ts.map +1 -1
  13. package/dist/src/engine.js +232 -53
  14. package/dist/src/engine.js.map +1 -1
  15. package/dist/src/index.d.ts +1 -1
  16. package/dist/src/index.js +1 -1
  17. package/dist/src/interfaces.d.ts +60 -2
  18. package/dist/src/interfaces.d.ts.map +1 -1
  19. package/dist/src/interfaces.js.map +1 -1
  20. package/dist/src/stores/lucid-mappers.d.ts +6 -1
  21. package/dist/src/stores/lucid-mappers.d.ts.map +1 -1
  22. package/dist/src/stores/lucid-mappers.js +41 -0
  23. package/dist/src/stores/lucid-mappers.js.map +1 -1
  24. package/dist/src/stores/lucid.d.ts +6 -1
  25. package/dist/src/stores/lucid.d.ts.map +1 -1
  26. package/dist/src/stores/lucid.js +163 -37
  27. package/dist/src/stores/lucid.js.map +1 -1
  28. package/dist/src/testing/in-memory-state-store.d.ts +5 -1
  29. package/dist/src/testing/in-memory-state-store.d.ts.map +1 -1
  30. package/dist/src/testing/in-memory-state-store.js +39 -0
  31. package/dist/src/testing/in-memory-state-store.js.map +1 -1
  32. package/dist/src/testing-kit/run-dispatch-contract.d.ts.map +1 -1
  33. package/dist/src/testing-kit/run-dispatch-contract.js +12 -3
  34. package/dist/src/testing-kit/run-dispatch-contract.js.map +1 -1
  35. package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -1
  36. package/dist/src/testing-kit/state-store-conformance.js +220 -0
  37. package/dist/src/testing-kit/state-store-conformance.js.map +1 -1
  38. package/dist/src/transports/adaptive-concurrency.d.ts +2 -0
  39. package/dist/src/transports/adaptive-concurrency.d.ts.map +1 -1
  40. package/dist/src/transports/adaptive-concurrency.js +39 -9
  41. package/dist/src/transports/adaptive-concurrency.js.map +1 -1
  42. package/dist/src/transports/bullmq/bullmq-transport.d.ts.map +1 -1
  43. package/dist/src/transports/bullmq/bullmq-transport.js +8 -4
  44. package/dist/src/transports/bullmq/bullmq-transport.js.map +1 -1
  45. package/dist/src/transports/bullmq/deps.d.ts.map +1 -1
  46. package/dist/src/transports/bullmq/deps.js +18 -1
  47. package/dist/src/transports/bullmq/deps.js.map +1 -1
  48. package/dist/src/transports/db.js +4 -4
  49. package/dist/src/transports/db.js.map +1 -1
  50. package/dist/src/transports/queue.d.ts.map +1 -1
  51. package/dist/src/transports/queue.js +8 -4
  52. package/dist/src/transports/queue.js.map +1 -1
  53. package/package.json +2 -2
  54. package/skills/durable-reliability/SKILL.md +2 -1
  55. package/skills/durable-transports-stores/SKILL.md +22 -7
  56. package/dist/assets/spa/assets/index-BEk3-95l.js +0 -16
  57. package/dist/assets/spa/assets/index-BEk3-95l.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,93 @@
1
1
  # @adonis-agora/durable
2
2
 
3
+ ## 0.54.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#413](https://github.com/DavideCarvalho/adonis-agora-durable/pull/413) [`a3102a1`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/a3102a17b65dbaf3a02abf260b66ad8145e35b49) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - A step fan's join barrier asks whether any step is still pending instead of counting them. Every
8
+ batch of results asked for a `COUNT(*)` over the fan's whole seq range, about 40 ms on a
9
+ 40,000-step fan in MySQL, from every instance settling results. Stores get an optional
10
+ `hasCheckpoints` that reads from the top of the range down and stops at the first match (a fan's
11
+ highest seqs settle last): about 0.4 ms on the same fan. The Lucid and in-memory stores implement
12
+ it and `CodecStateStore` forwards it; a store without it is asked `countCheckpoints` as before.
13
+
14
+ ## 0.54.2
15
+
16
+ ### Patch Changes
17
+
18
+ - [#409](https://github.com/DavideCarvalho/adonis-agora-durable/pull/409) [`902f12e`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/902f12e9a6ca97d24e36e11e6ad819ef8137cfac) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - A `bullmq` connection given as options with a `url` (`{ url: 'redis://…' }`) now reaches that Redis
19
+ from every client. BullMQ read the URL for the queues, but ioredis ignores `url`, so the pub/sub and
20
+ heartbeat clients connected to 127.0.0.1:6379 instead: step heartbeats, run replies and tenant
21
+ events were lost, or went to another Redis. Keys set beside the `url` (a `tls` with a CA, a `db`) are kept over the ones the URL implies.
22
+
23
+ - [#409](https://github.com/DavideCarvalho/adonis-agora-durable/pull/409) [`6433ee6`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/6433ee6af00a052c46daf9fcbb93dcc059e54c25) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - The adaptive step concurrency no longer collapses to one on fast steps.
24
+
25
+ The controller read latency jitter as queuing: its baseline is the fastest completion of the
26
+ window, and for 1–5 ms steps p50 sits several times above it with nothing queued, so it shrank to
27
+ one or two at a time. p50 may now reach twice the baseline plus 5 ms before it counts as queuing.
28
+ Growth doubles the limit until the first back-off, then adds √limit a tick (it added one every 2 s);
29
+ until that first back-off, growth is re-decided after each limit's worth of settled steps instead of
30
+ waiting for the 2 s tick.
31
+ Step durations are timed with `performance.now()` instead of whole milliseconds. Same decisions as
32
+ the Aviary controller.
33
+
34
+ - [#409](https://github.com/DavideCarvalho/adonis-agora-durable/pull/409) [`ad5f847`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/ad5f847e9d60576ed35d108ad496ea20f5eaa3f3) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - The check a turn makes after suspending on a step, whether that step already settled, is a `COUNT`
35
+ where the store has `countCheckpoints`. It read the step's whole row, so every turn of a
36
+ conversation read back the input of the LLM step it had just sent.
37
+
38
+ - [#409](https://github.com/DavideCarvalho/adonis-agora-durable/pull/409) [`d9ec346`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/d9ec34637d03d95f9b1f62c825bad0501ebed671) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - A turn no longer reads the input of every step its run has completed.
39
+
40
+ Each turn of a run starts by reading the run's checkpoints, and read every column of every row,
41
+ including the `input` of every completed step, which replaying a completed step never uses. Stores
42
+ can now implement the optional `listCheckpointsForReplay(runId)`: `listCheckpoints`, except that a
43
+ `completed` row comes back without its `input`, left out of the query. A `pending`, `running` or
44
+ `failed` row keeps it, for a re-dispatch or a retry. The engine reads a turn (and a remote
45
+ workflow's history) through it, and falls back to `listCheckpoints` on a store without it; the run
46
+ detail, `durable:runs` and `engine.listCheckpoints` still read every input. The Lucid store, the
47
+ in-memory store and `CodecStateStore` implement it: the 20th turn of a run whose steps carry
48
+ 100 KB inputs read 2.2 MB on Postgres and MySQL, and now reads about 200 KB, the same as its first.
49
+
50
+ - [#409](https://github.com/DavideCarvalho/adonis-agora-durable/pull/409) [`7490c16`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/7490c16f73ead4cab7e1b34986d2d342db5bddde) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - A worker result's settle no longer reads the step's input. It reads the step's row through the new
51
+ optional `StateStore.getCheckpointsForSettle`, `getCheckpoints` without `input`, left out of the
52
+ query itself; the engine uses it only when the store also has `settleCheckpointsIfPending`. The Lucid
53
+ and in-memory stores implement it, `CodecStateStore` decodes what it returns, and the store contract
54
+ checks it when a store has it. With the re-check by count, a turn of a conversation over 100 KB-input
55
+ steps reads about 2 KB of checkpoints where it read about 200 KB.
56
+
57
+ - [#409](https://github.com/DavideCarvalho/adonis-agora-durable/pull/409) [`9104008`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/910400813e56ade2488de368e10a24fa64e9ec2c) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - A worker result settles its step without rewriting the step's `input`.
58
+
59
+ The engine wrote a settled step's whole checkpoint row again, so a step with a large input (an
60
+ agent's LLM step carries its whole prompt) had that input written twice: once when it was
61
+ dispatched, once when its result landed. Stores can now implement the optional
62
+ `settleCheckpointsIfPending(settlements)`, which writes only the columns a result changes
63
+ (`status`, `output`, `error`, `events`, `startedAt`, `finishedAt`) while the row is still `pending`,
64
+ with the same claim as `saveCheckpointsIfPending`. The engine settles every result through it, and
65
+ writes whole rows as before on a store without it. The Lucid store, the in-memory store and
66
+ `CodecStateStore` implement it: settling a step with a 100 KB input wrote about 100 KB of
67
+ checkpoint row on Postgres, MySQL and SQLite, and now writes about 40 bytes.
68
+
69
+ - [#409](https://github.com/DavideCarvalho/adonis-agora-durable/pull/409) [`2fb0651`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/2fb06516c80266a53535d312b259f87c0ff59dd5) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - A result that lands right after the turn that sent its step suspended resumes the run once. The
70
+ instance that settles a step and resumes its run now remembers it for a lease, and the suspended
71
+ turn's re-check of that step, which found it settled and resumed the run again, leaves it to that
72
+ resume. A remote workflow's re-check, whose decision may postdate that resume, and a re-check on any
73
+ other instance still re-drive the run.
74
+
75
+ - [#409](https://github.com/DavideCarvalho/adonis-agora-durable/pull/409) [`eaf342e`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/eaf342e979cb99faeb54d4e01d22de4c29d01a07) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - A wide step fan no longer slows down on its way out and while its steps run.
76
+
77
+ The `bullmq` and `queue` transports grouped a fan's tasks by queue by copying the group on every
78
+ task, so sending 150k steps took over a minute; it is linear now. The Lucid store's batched settle
79
+ grouped its rows the same way.
80
+
81
+ Every step's worker beats once when it picks the step up, and each beat was written to the step's
82
+ checkpoint at once: a 40k fan made 40k concurrent `UPDATE`s that took the store's connections from
83
+ the fan's results. Beats are now written one at a time, a newer beat of a step replaces its queued
84
+ one, and a step whose result arrives first never has its beat written. A 40k fan over BullMQ and
85
+ MySQL went from 46 s to 13 s.
86
+
87
+ With `remoteRedispatchMs` set, a fan's steps are written with their lease already stamped and the
88
+ run parks on it; a pickup beat on the instance that sent the fan no longer reads the step and
89
+ rewrites its lease. The same 40k fan went from 50 s to 14 s.
90
+
3
91
  ## 0.54.1
4
92
 
5
93
  ### Patch Changes