@atolis-hq/wake 0.4.106 → 0.4.107

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 (34) hide show
  1. package/dist/src/activities/pr/application.js +23 -9
  2. package/dist/src/bootstrap/composition-root.js +1 -1
  3. package/dist/src/bootstrap/version.js +1 -1
  4. package/dist/src/conversations/application/conversation-repository.d.ts +1 -1
  5. package/dist/src/conversations/application/conversation-repository.js +3 -1
  6. package/dist/src/execution/application/run-repository.js +27 -10
  7. package/dist/src/integrations/application/artifact-registration-reactor.js +7 -14
  8. package/dist/src/integrations/application/latest-unresolved-artifacts.d.ts +3 -0
  9. package/dist/src/integrations/application/latest-unresolved-artifacts.js +16 -0
  10. package/dist/src/integrations/github/application/comment-history-reader.d.ts +1 -1
  11. package/dist/src/integrations/github/application/comment-history-reader.js +56 -39
  12. package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts +1 -1
  13. package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts.map +1 -1
  14. package/dist/src/node_modules/@atolis-hq/eventing/dist/index.js +1 -1
  15. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts +14 -0
  16. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts.map +1 -1
  17. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.js +31 -1
  18. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.d.ts +22 -0
  19. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.d.ts.map +1 -0
  20. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.js +60 -0
  21. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts +2 -0
  22. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts.map +1 -1
  23. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.js +82 -15
  24. package/dist/src/orchestration/application/advance-workflow.js +7 -2
  25. package/dist/src/orchestration/application/deferred-signals.js +2 -6
  26. package/dist/src/orchestration/application/orchestration-repository.d.ts +14 -9
  27. package/dist/src/orchestration/application/orchestration-repository.js +139 -64
  28. package/dist/src/resources/application/resource-lookup.d.ts +2 -1
  29. package/dist/src/resources/application/resource-lookup.js +3 -11
  30. package/dist/src/resources/application/resource-repository.js +10 -10
  31. package/package.json +1 -1
  32. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts +0 -16
  33. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts.map +0 -1
  34. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.js +0 -79
@@ -1,79 +0,0 @@
1
- export const JOURNAL_CHANGE_FALLBACK_MS = 30_000;
2
- // Memoizes a full-journal derivation — a fold, decode, or index built from
3
- // every event in history — so a resident loop calling it every tick only
4
- // pays that cost when the journal has actually moved since the last call.
5
- // Same durable position boundary used by projection subscriptions,
6
- // generalized for callers that want a materialized view rather than an
7
- // incremental batch. Depends only on the EventJournal port, not on any
8
- // concrete persistence implementation, so it lives in Eventing rather than
9
- // Persistence; domain and adapter modules may call it directly.
10
- //
11
- // The cached value is keyed by the last position actually read, never by the
12
- // position sampled beforehand, so a value can never be held under a position
13
- // newer than the events it was derived from. Callers that find the journal
14
- // unchanged since a derivation already running share it.
15
- export function cachedJournalView(journal, derive, _now = Date.now) {
16
- let cache;
17
- let inFlight;
18
- return {
19
- async get() {
20
- const sampled = await journal.latestGlobalPosition();
21
- if (cache !== undefined && cache.position >= sampled)
22
- return cache.value;
23
- if (inFlight?.sampled === sampled)
24
- return inFlight.run;
25
- const run = (async () => {
26
- const events = await journal.readAll(0);
27
- const value = await derive(events);
28
- const position = events.at(-1)?.globalPosition ?? 0;
29
- // An older derivation finishing late must not replace a newer one.
30
- if (cache === undefined || position >= cache.position)
31
- cache = { position, value };
32
- return value;
33
- })().finally(() => {
34
- if (inFlight?.run === run)
35
- inFlight = undefined;
36
- });
37
- inFlight = { sampled, run };
38
- return run;
39
- },
40
- };
41
- }
42
- // An incremental counterpart of cachedJournalView for views that can be
43
- // extended event by event: each journal move folds only the new events instead
44
- // of re-deriving history. Folds are serialised, so every event is applied once
45
- // and in order however many callers ask at the same time.
46
- export function foldedJournalView(journal, fold) {
47
- let state = {
48
- position: 0,
49
- value: fold.initial,
50
- };
51
- let running;
52
- return {
53
- async get() {
54
- for (;;) {
55
- const sampled = await journal.latestGlobalPosition();
56
- if (state.position >= sampled)
57
- return state.value;
58
- if (running !== undefined) {
59
- await running.catch(() => undefined);
60
- continue;
61
- }
62
- const run = (async () => {
63
- const events = await journal.readAll(state.position);
64
- if (events.length > 0)
65
- state = {
66
- position: events.at(-1).globalPosition,
67
- value: fold.extend(state.value, events),
68
- };
69
- return state.value;
70
- })().finally(() => {
71
- if (running === run)
72
- running = undefined;
73
- });
74
- running = run;
75
- return run;
76
- }
77
- },
78
- };
79
- }