@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
@@ -69,10 +69,10 @@ class JournalPullRequestService {
69
69
  : reviewRejected(command.resourceId, rejection, context));
70
70
  }
71
71
  async authorizeMerge(workItemId, context) {
72
- const prior = await this.priorMergeDecision(context.commandId);
72
+ const input = await this.authorityInput(workItemId);
73
+ const prior = await this.priorMergeDecision(context.commandId, input, workItemId);
73
74
  if (prior !== null)
74
75
  return prior;
75
- const input = await this.authorityInput(workItemId);
76
76
  const decision = decidePullRequestAuthority(input);
77
77
  if (decision.allowed) {
78
78
  const stream = resourceStream(decision.resourceId);
@@ -108,13 +108,27 @@ class JournalPullRequestService {
108
108
  const events = Array.isArray(event) ? event : [event];
109
109
  await this.journal.appendToStream(stream, (await this.journal.readStream(stream)).length, events);
110
110
  }
111
- async priorMergeDecision(commandId) {
112
- const events = await this.journal.readAll(0);
113
- if (events.some((event) => event.event.eventId === `${commandId}:${ActivityEventType.PrMergeAuthorized}`))
114
- return true;
115
- return events.some((event) => event.event.eventId === `${commandId}:${ActivityEventType.PrMergeDenied}`)
116
- ? false
117
- : null;
111
+ // Decisions are appended to the Work item's PR-like resource stream, or the
112
+ // Work item stream when it has none, with an event id derived from the
113
+ // command, so a replay is found by reading just those streams.
114
+ async priorMergeDecision(commandId, input, workItemId) {
115
+ const streams = [
116
+ workItemStream(workItemId),
117
+ ...input.resources
118
+ .filter((entry) => isPullRequestLikeResource(entry.resource.capabilities))
119
+ .map((entry) => resourceStream(entry.resource.resourceId)),
120
+ ];
121
+ const authorized = `${commandId}:${ActivityEventType.PrMergeAuthorized}`;
122
+ const denied = `${commandId}:${ActivityEventType.PrMergeDenied}`;
123
+ let decision = null;
124
+ for (const stream of streams)
125
+ for (const event of await this.journal.readStream(stream)) {
126
+ if (event.event.eventId === authorized)
127
+ return true;
128
+ if (event.event.eventId === denied)
129
+ decision = false;
130
+ }
131
+ return decision;
118
132
  }
119
133
  async hasVerifiedPrimaryCorrelation(command) {
120
134
  const resource = await this.resources.get(command.resourceId);
@@ -50,7 +50,7 @@ async function createApplicationServices(wakeRoot, options = {}) {
50
50
  const operatorInstructions = new OperatorInstructionsService(journal, new FileArtifactStore(paths.artifactsRoot), config.artifacts);
51
51
  const artifactMcpSessions = new FileArtifactMcpSessionStore(paths.artifactsRoot, () => clock.now().toISOString());
52
52
  const conversations = createConversationService(journal);
53
- const lookup = createResourceLookup({ journal, projections });
53
+ const lookup = createResourceLookup({ journal, projections, checkpoints });
54
54
  const resources = createResourceService(journal, lookup);
55
55
  const pullRequests = createPullRequestService(journal, work, resources);
56
56
  const activities = options.activities ??
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
124
124
  return `g${headHash.slice(0, 7)}`;
125
125
  return '0.1.0-dev';
126
126
  }
127
- export const wakeVersion = "v0.4.106";
127
+ export const wakeVersion = "v0.4.107";
128
128
  /** The registry-installable version used by packaged sandbox images. */
129
129
  export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
@@ -1,4 +1,4 @@
1
- import type { EventJournal } from '@atolis-hq/eventing';
1
+ import { type EventJournal } from '@atolis-hq/eventing';
2
2
  import { type ConversationEvent, type ConversationEventData } from '../contracts/events.js';
3
3
  import type { ConversationId } from '../contracts/identifiers.js';
4
4
  import type { ConversationView } from '../contracts/views.js';
@@ -1,6 +1,8 @@
1
+ import { decodeOnce } from '@atolis-hq/eventing';
1
2
  import { decodeConversationEvent, selectConversationEvent, } from '../contracts/events.js';
2
3
  import { conversationStream } from '../contracts/streams.js';
3
4
  import { foldConversation } from '../domain/conversation.js';
5
+ const selectConversation = decodeOnce(selectConversationEvent);
4
6
  export class ConversationRepository {
5
7
  journal;
6
8
  constructor(journal) {
@@ -11,7 +13,7 @@ export class ConversationRepository {
11
13
  return {
12
14
  sequence: events.length,
13
15
  view: foldConversation(events
14
- .map(selectConversationEvent)
16
+ .map(selectConversation)
15
17
  .filter((event) => event !== null)),
16
18
  };
17
19
  }
@@ -1,18 +1,19 @@
1
- import { cachedJournalView } from '@atolis-hq/eventing';
1
+ import { decodeOnce, foldedJournalView, } from '@atolis-hq/eventing';
2
2
  import { decodeRunExecutionEvent, } from '../contracts/events.js';
3
3
  import { runId } from '../contracts/identifiers.js';
4
4
  import { isRunStream, runStream } from '../contracts/streams.js';
5
5
  import { foldRun } from '../domain/run.js';
6
+ const decodeRun = decodeOnce(decodeRunExecutionEvent);
6
7
  export class RunRepository {
7
8
  journal;
8
9
  runs;
9
10
  constructor(journal) {
10
11
  this.journal = journal;
11
- this.runs = cachedJournalView(journal, deriveRuns);
12
+ this.runs = foldedJournalView(journal, { initial: emptyRuns, extend: extendRuns });
12
13
  }
13
14
  async load(runId) {
14
15
  const events = await this.journal.readStream(runStream(runId));
15
- const decoded = events.map(decodeRunExecutionEvent);
16
+ const decoded = events.map(decodeRun);
16
17
  return { sequence: events.length, events: decoded, view: foldRun(decoded) };
17
18
  }
18
19
  async append(runId, sequence, drafts) {
@@ -20,21 +21,37 @@ export class RunRepository {
20
21
  return events.map(decodeRunExecutionEvent);
21
22
  }
22
23
  async list(activationId) {
23
- const runs = await this.runs.get();
24
+ const { views: runs } = await this.runs.get();
24
25
  return activationId === undefined
25
26
  ? runs
26
27
  : runs.filter((run) => run.activationId === activationId);
27
28
  }
28
29
  }
29
- function deriveRuns(events) {
30
- const grouped = new Map();
30
+ const emptyRuns = { events: new Map(), byRun: new Map(), views: [] };
31
+ // Decodes and folds only the runs the new events touch; untouched runs keep
32
+ // their decoded history and view, so a journal move costs the delta.
33
+ function extendRuns(state, events) {
34
+ const touched = new Map();
31
35
  for (const event of events) {
32
36
  if (!isRunStream(event.stream))
33
37
  continue;
34
38
  const id = runId(event.stream.id);
35
- const decoded = grouped.get(id) ?? [];
36
- decoded.push(decodeRunExecutionEvent(event));
37
- grouped.set(id, decoded);
39
+ const batch = touched.get(id) ?? [];
40
+ batch.push(decodeRun(event));
41
+ touched.set(id, batch);
38
42
  }
39
- return [...grouped.values()].map(foldRun).filter((run) => run !== null);
43
+ if (touched.size === 0)
44
+ return state;
45
+ const history = new Map(state.events);
46
+ const byRun = new Map(state.byRun);
47
+ for (const [id, batch] of touched) {
48
+ const all = [...(history.get(id) ?? []), ...batch];
49
+ history.set(id, all);
50
+ byRun.set(id, foldRun(all));
51
+ }
52
+ return {
53
+ events: history,
54
+ byRun,
55
+ views: [...byRun.values()].filter((run) => run !== null),
56
+ };
40
57
  }
@@ -1,18 +1,22 @@
1
- import { cachedJournalView, defineEventProcessor, EventActorKind, EventProcessorCategory, EventProcessorReplayPolicy, EventSourceKind, } from '@atolis-hq/eventing';
1
+ import { defineEventProcessor, EventActorKind, EventProcessorCategory, EventProcessorReplayPolicy, EventSourceKind, foldedJournalView, } from '@atolis-hq/eventing';
2
2
  import { reportedArtifactSchema } from '../../activities/index.js';
3
3
  import { OrchestrationEventType, selectWorkflowOrchestrationEvent, workflowInstanceStream, } from '../../orchestration/index.js';
4
4
  import { ResourceCorrelationProvenance, ResourceCorrelationRole, resourceId, resourceKind, ResourceStreamKind, } from '../../resources/index.js';
5
5
  import { createArtifactEventData } from '../contracts/artifact-event-factory.js';
6
- import { ArtifactEventType, decodeArtifactEvent, } from '../contracts/artifact-events.js';
6
+ import { ArtifactEventType } from '../contracts/artifact-events.js';
7
7
  import { ArtifactVerificationResult, ArtifactVerificationStatus, } from '../contracts/artifact-vocabulary.js';
8
8
  import { integrationStream } from '../contracts/streams.js';
9
+ import { extendLatestUnresolved } from './latest-unresolved-artifacts.js';
9
10
  export class ArtifactRegistrationReactor {
10
11
  dependencies;
11
12
  latestUnresolved;
12
13
  processor;
13
14
  constructor(dependencies) {
14
15
  this.dependencies = dependencies;
15
- this.latestUnresolved = cachedJournalView(dependencies.journal, deriveLatestUnresolved);
16
+ this.latestUnresolved = foldedJournalView(dependencies.journal, {
17
+ initial: new Map(),
18
+ extend: extendLatestUnresolved,
19
+ });
16
20
  this.processor = defineEventProcessor({
17
21
  consumer: 'reactor:artifact-registration',
18
22
  name: 'artifact-registration',
@@ -164,17 +168,6 @@ export class ArtifactRegistrationReactor {
164
168
  : null;
165
169
  }
166
170
  }
167
- function deriveLatestUnresolved(events) {
168
- const latest = new Map();
169
- for (const event of events) {
170
- if (event.event.eventType !== ArtifactEventType.VerificationUnresolved)
171
- continue;
172
- const decoded = decodeArtifactEvent(event);
173
- const key = `${decoded.event.causationId}:${decoded.event.payload.artifact.externalKey.adapter}:${decoded.event.payload.artifact.externalKey.key}`;
174
- latest.set(key, decoded);
175
- }
176
- return latest;
177
- }
178
171
  function reportedArtifacts(value) {
179
172
  if (typeof value !== 'object' || value === null || !('reportedArtifacts' in value))
180
173
  return [];
@@ -0,0 +1,3 @@
1
+ import type { EventEnvelope } from '@atolis-hq/eventing';
2
+ import { type ArtifactEvent } from '../contracts/artifact-events.js';
3
+ export declare function extendLatestUnresolved(previous: ReadonlyMap<string, ArtifactEvent>, events: readonly EventEnvelope[]): ReadonlyMap<string, ArtifactEvent>;
@@ -0,0 +1,16 @@
1
+ import { ArtifactEventType, decodeArtifactEvent, } from '../contracts/artifact-events.js';
2
+ // Folds only the new events; the previous map is returned untouched when none
3
+ // of them record an unresolved verification.
4
+ export function extendLatestUnresolved(previous, events) {
5
+ if (!events.some((event) => event.event.eventType === ArtifactEventType.VerificationUnresolved))
6
+ return previous;
7
+ const latest = new Map(previous);
8
+ for (const event of events) {
9
+ if (event.event.eventType !== ArtifactEventType.VerificationUnresolved)
10
+ continue;
11
+ const decoded = decodeArtifactEvent(event);
12
+ const key = `${decoded.event.causationId}:${decoded.event.payload.artifact.externalKey.adapter}:${decoded.event.payload.artifact.externalKey.key}`;
13
+ latest.set(key, decoded);
14
+ }
15
+ return latest;
16
+ }
@@ -1,4 +1,4 @@
1
- import type { EventJournal } from '@atolis-hq/eventing';
1
+ import { type EventJournal } from '@atolis-hq/eventing';
2
2
  import { type ResourceService } from '../../../resources/index.js';
3
3
  import type { WorkItemId } from '../../../work/index.js';
4
4
  export interface CommentHistoryEntry {
@@ -1,3 +1,4 @@
1
+ import { foldedJournalView } from '@atolis-hq/eventing';
1
2
  import { ResourceCorrelationRole } from '../../../resources/index.js';
2
3
  import { adapterId } from '../../contracts/identifiers.js';
3
4
  import { DeliveryEventType, selectDeliveryEvent } from '../../delivery/contracts/events.js';
@@ -16,6 +17,10 @@ export function deliveryIntentIdForComment(entry) {
16
17
  return deliveryIntentIds.get(entry);
17
18
  }
18
19
  export function createCommentHistoryReader(journal, resources, readerOptions = {}) {
20
+ const facts = foldedJournalView(journal, {
21
+ initial: emptyCommentFacts,
22
+ extend: extendCommentFacts,
23
+ });
19
24
  return {
20
25
  async forWorkItem(workItemId, options) {
21
26
  const resourcesById = new Map((await Promise.all((await resources.correlationsForWork(workItemId))
@@ -30,51 +35,64 @@ export function createCommentHistoryReader(journal, resources, readerOptions = {
30
35
  return [];
31
36
  const githubAdapters = new Set(readerOptions.githubAdapters ?? [GitHubAdapter]);
32
37
  const githubResourceIds = new Set([...resourcesById.entries()].flatMap(([resourceId, resource]) => githubAdapters.has(resource.externalKey.adapter) ? [resourceId] : []));
33
- return readCommentHistory(await journal.readAll(0), resourcesById, keys, githubResourceIds, options?.observedSince, readerOptions.publicUiUrl);
38
+ const known = await facts.get();
39
+ const intents = new Map([...known.intents].filter(([, intent]) => githubResourceIds.has(intent.event.payload.resourceId)));
40
+ const observed = new Map();
41
+ for (const key of keys)
42
+ for (const [messageId, comment] of known.observedByResource.get(key) ?? [])
43
+ observed.set(messageId, comment);
44
+ const confirmed = new Map();
45
+ for (const [intentEventId, event] of known.confirmations) {
46
+ const intent = intents.get(intentEventId);
47
+ if (intent !== undefined)
48
+ confirmed.set(intentEventId, { event, intent });
49
+ }
50
+ return reconcileCommentHistory(observed, confirmed, resourcesById, options?.observedSince, readerOptions.publicUiUrl);
34
51
  },
35
52
  };
36
53
  }
37
- function readCommentHistory(events, resourcesById, keys, githubResourceIds, observedSince, publicUiUrl) {
38
- const intents = commentIntents(events, githubResourceIds);
39
- const observed = providerComments(events, keys);
40
- const confirmed = confirmations(events, intents);
41
- return reconcileCommentHistory(observed, confirmed, resourcesById, observedSince, publicUiUrl);
42
- }
43
- function commentIntents(events, githubResourceIds) {
44
- const intents = new Map();
54
+ const emptyCommentFacts = {
55
+ intents: new Map(),
56
+ observedByResource: new Map(),
57
+ confirmations: new Map(),
58
+ };
59
+ function extendCommentFacts(state, events) {
60
+ let intents = state.intents;
61
+ let observedByResource = state.observedByResource;
62
+ let confirmations = state.confirmations;
45
63
  for (const event of events) {
46
64
  const intent = selectDeliveryIntentEvent(event);
47
- if (intent !== null &&
48
- isCommentIntent(intent) &&
49
- githubResourceIds.has(intent.event.payload.resourceId))
50
- intents.set(intent.event.eventId, intent);
51
- }
52
- return intents;
53
- }
54
- function providerComments(events, keys) {
55
- const observed = new Map();
56
- for (const event of events) {
57
- const comment = providerComment(event, keys);
58
- if (comment !== null)
59
- observed.set(comment.messageId, comment);
60
- }
61
- return observed;
62
- }
63
- function confirmations(events, intents) {
64
- const confirmed = new Map();
65
- for (const event of events) {
65
+ if (intent !== null) {
66
+ if (isCommentIntent(intent)) {
67
+ if (intents === state.intents)
68
+ intents = new Map(intents);
69
+ intents.set(intent.event.eventId, intent);
70
+ }
71
+ continue;
72
+ }
66
73
  const delivery = selectDeliveryEvent(event);
67
- if (delivery === null || !isConfirmed(delivery))
74
+ if (delivery !== null) {
75
+ if (!isConfirmed(delivery))
76
+ continue;
77
+ const key = delivery.event.payload.intentEventId;
78
+ const current = confirmations.get(key);
79
+ if (current === undefined || event.globalPosition < current.globalPosition) {
80
+ if (confirmations === state.confirmations)
81
+ confirmations = new Map(confirmations);
82
+ confirmations.set(key, event);
83
+ }
68
84
  continue;
69
- const intent = intents.get(delivery.event.payload.intentEventId);
70
- if (intent === undefined)
85
+ }
86
+ const comment = providerComment(event);
87
+ if (comment === null)
71
88
  continue;
72
- const candidate = { event, intent };
73
- const current = confirmed.get(delivery.event.payload.intentEventId);
74
- if (current === undefined || candidate.event.globalPosition < current.event.globalPosition)
75
- confirmed.set(delivery.event.payload.intentEventId, candidate);
89
+ if (observedByResource === state.observedByResource)
90
+ observedByResource = new Map(observedByResource);
91
+ const forResource = new Map(observedByResource.get(comment.resourceKey));
92
+ forResource.set(comment.messageId, comment);
93
+ observedByResource.set(comment.resourceKey, forResource);
76
94
  }
77
- return confirmed;
95
+ return { intents, observedByResource, confirmations };
78
96
  }
79
97
  function reconcileCommentHistory(observed, confirmed, resourcesById, observedSince, publicUiUrl) {
80
98
  const history = new Map();
@@ -114,10 +132,9 @@ function isConfirmed(value) {
114
132
  (value.event.eventType === DeliveryEventType.Reconciled &&
115
133
  value.event.payload.result === DeliveryResultKind.Confirmed));
116
134
  }
117
- function providerComment(event, keys) {
135
+ function providerComment(event) {
118
136
  const observed = selectGitHubAdapterEvent(event);
119
- if (!isCommentObserved(observed) ||
120
- !keys.has(`${observed.stream.id}:${observed.event.payload.externalKey}`))
137
+ if (!isCommentObserved(observed))
121
138
  return null;
122
139
  return {
123
140
  event,
@@ -7,7 +7,7 @@ export type { CausationId, CorrelationId, EventId } from './contracts/identifier
7
7
  export * from './contracts/processor-state-store.js';
8
8
  export * from './projections/projection-processor.js';
9
9
  export * from './projections/projection-store.js';
10
- export * from './runtime/cached-journal-view.js';
10
+ export * from './runtime/journal-view.js';
11
11
  export * from './runtime/clock.js';
12
12
  export * from './runtime/event-processor-host.js';
13
13
  export * from './runtime/processor-failure.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AAExC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEjF,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEtF,cAAc,sCAAsC,CAAC;AAErD,cAAc,uCAAuC,CAAC;AAEtD,cAAc,mCAAmC,CAAC;AAElD,cAAc,kCAAkC,CAAC;AAEjD,cAAc,oBAAoB,CAAC;AAEnC,cAAc,mCAAmC,CAAC;AAElD,cAAc,gCAAgC,CAAC;AAE/C,cAAc,+BAA+B,CAAC;AAE9C,cAAc,uCAAuC,CAAC;AAEtD,cAAc,6BAA6B,CAAC;AAE5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AAExC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEjF,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEtF,cAAc,sCAAsC,CAAC;AAErD,cAAc,uCAAuC,CAAC;AAEtD,cAAc,mCAAmC,CAAC;AAElD,cAAc,2BAA2B,CAAC;AAE1C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,mCAAmC,CAAC;AAElD,cAAc,gCAAgC,CAAC;AAE/C,cAAc,+BAA+B,CAAC;AAE9C,cAAc,uCAAuC,CAAC;AAEtD,cAAc,6BAA6B,CAAC;AAE5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,yBAAyB,CAAC"}
@@ -6,7 +6,7 @@ export { causationId, correlationId, eventId } from './contracts/identifiers.js'
6
6
  export * from './contracts/processor-state-store.js';
7
7
  export * from './projections/projection-processor.js';
8
8
  export * from './projections/projection-store.js';
9
- export * from './runtime/cached-journal-view.js';
9
+ export * from './runtime/journal-view.js';
10
10
  export * from './runtime/clock.js';
11
11
  export * from './runtime/event-processor-host.js';
12
12
  export * from './runtime/processor-failure.js';
@@ -7,6 +7,20 @@ import type { ProjectionDefinition, ProjectionStore } from './projection-store.j
7
7
  export declare function projectionConsumer<Value>(definition: ProjectionDefinition<Value>): string;
8
8
  export declare function createProjectionProcessor<Value>(definition: ProjectionDefinition<Value>, projections: ProjectionStore): EventProcessor;
9
9
  export declare function applyProjectionEvent<Value>(definition: ProjectionDefinition<Value>, projections: ProjectionStore, key: string, event: EventEnvelope): Promise<void>;
10
+ /**
11
+ * Reads one projected key with read-your-writes consistency: the stored value
12
+ * plus any events the projection processor has not applied yet. The tail starts
13
+ * at the processor's checkpoint, not the key's own last position: everything at
14
+ * or below the checkpoint is already applied for every key, whereas a quiet
15
+ * key's position can trail the head by the whole history. A rebuild resets the
16
+ * checkpoint before it clears the store, so the checkpoint is never ahead of
17
+ * the stored values it vouches for.
18
+ */
19
+ export declare function readCurrentProjection<Value>(dependencies: {
20
+ readonly journal: Pick<EventJournal, 'readAll'>;
21
+ readonly projections: ProjectionStore;
22
+ readonly checkpoints: Pick<CheckpointStore, 'load'>;
23
+ }, definition: ProjectionDefinition<Value>, key: string): Promise<Value>;
10
24
  export declare function applyProjectionBatch<Value>(definition: ProjectionDefinition<Value>, projections: ProjectionStore, events: readonly EventEnvelope[], signal?: AbortSignal): Promise<void>;
11
25
  export declare class ProjectionRebuilder {
12
26
  private readonly journal;
@@ -1 +1 @@
1
- {"version":3,"file":"projection-processor.d.ts","sourceRoot":"","sources":["../../src/projections/projection-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAInF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC,GAAG,MAAM,CAEzF;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAC7C,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACvC,WAAW,EAAE,eAAe,GAC3B,cAAc,CAWhB;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAC9C,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACvC,WAAW,EAAE,eAAe,EAC5B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,IAAI,CAAC,CASf;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAC9C,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACvC,WAAW,EAAE,eAAe,EAC5B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,MAAM,GAAE,WAA0C,GACjD,OAAO,CAAC,IAAI,CAAC,CASf;AAED,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAA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CAAC,KAAK,EAC/C,YAAY,EAAE;IACZ,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAChD,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;CACrD,EACD,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACvC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,KAAK,CAAC,CAgBhB;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAC9C,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACvC,WAAW,EAAE,eAAe,EAC5B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,MAAM,GAAE,WAA0C,GACjD,OAAO,CAAC,IAAI,CAAC,CASf;AAED,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAHZ,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,eAAe,EAC5B,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,sBAAsB;IAGvD,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;YAQhF,aAAa;CAyB5B"}
@@ -26,6 +26,35 @@ export async function applyProjectionEvent(definition, projections, key, event)
26
26
  value: definition.project(previous?.value ?? definition.initial(key), event),
27
27
  });
28
28
  }
29
+ const catchUpBatchSize = 500;
30
+ /**
31
+ * Reads one projected key with read-your-writes consistency: the stored value
32
+ * plus any events the projection processor has not applied yet. The tail starts
33
+ * at the processor's checkpoint, not the key's own last position: everything at
34
+ * or below the checkpoint is already applied for every key, whereas a quiet
35
+ * key's position can trail the head by the whole history. A rebuild resets the
36
+ * checkpoint before it clears the store, so the checkpoint is never ahead of
37
+ * the stored values it vouches for.
38
+ */
39
+ export async function readCurrentProjection(dependencies, definition, key) {
40
+ // Order matters. The processor writes a key and only then saves the batch
41
+ // checkpoint, so a checkpoint read first can only be older than the stored
42
+ // value read after it: every event at or below it is already in that value.
43
+ // Reading the value first would let events applied in between be skipped.
44
+ const checkpoint = await dependencies.checkpoints.load(projectionConsumer(definition));
45
+ const stored = await dependencies.projections.read(definition.name, key);
46
+ let value = stored?.value ?? definition.initial(key);
47
+ let position = Math.max(stored?.lastGlobalPosition ?? 0, checkpoint);
48
+ for (;;) {
49
+ const events = await dependencies.journal.readAll(position, catchUpBatchSize);
50
+ for (const event of events)
51
+ if (definition.select(event)?.key === key)
52
+ value = definition.project(value, event);
53
+ if (events.length < catchUpBatchSize)
54
+ return value;
55
+ position = events.at(-1).globalPosition;
56
+ }
57
+ }
29
58
  export async function applyProjectionBatch(definition, projections, events, signal = new AbortController().signal) {
30
59
  throwIfAborted(signal);
31
60
  const processor = createProjectionProcessor(definition, projections);
@@ -54,8 +83,9 @@ export class ProjectionRebuilder {
54
83
  }
55
84
  async rebuildLocked(definition, signal) {
56
85
  const consumer = projectionConsumer(definition);
57
- await this.projections.clear(definition.name);
86
+ // Checkpoint first: a concurrent reader that sees a cleared store must also see a reset checkpoint.
58
87
  await this.checkpoints.reset(consumer);
88
+ await this.projections.clear(definition.name);
59
89
  const processor = createProjectionProcessor(definition, this.projections);
60
90
  if (processor.mode === 'batch')
61
91
  throw new Error('Projection processors must handle each event');
@@ -0,0 +1,22 @@
1
+ import type { EventEnvelope } from '../contracts/events.js';
2
+ import type { EventJournal } from '../store/event-journal.js';
3
+ export declare const JOURNAL_CHANGE_FALLBACK_MS = 30000;
4
+ export interface JournalView<Value> {
5
+ get(): Promise<Value>;
6
+ }
7
+ type ViewJournal = Pick<EventJournal, 'readAll' | 'latestGlobalPosition'>;
8
+ export interface JournalFold<Value> {
9
+ readonly initial: Value;
10
+ /** Returns the value after `events`, which follow everything already folded. Must not mutate `value`: earlier callers may still hold it across awaits. */
11
+ extend(value: Value, events: readonly EventEnvelope[]): Value;
12
+ }
13
+ export declare function foldedJournalView<Value>(journal: ViewJournal, fold: JournalFold<Value>): JournalView<Value>;
14
+ /**
15
+ * Decodes each envelope object once. Journals hand out the same immutable
16
+ * envelope instances while their cache is valid, so repeated stream loads reuse
17
+ * the earlier decode instead of re-running schema validation on every call. A
18
+ * decoder that throws is not memoized and keeps throwing.
19
+ */
20
+ export declare function decodeOnce<Decoded extends object | null>(decode: (event: EventEnvelope) => Decoded): (event: EventEnvelope) => Decoded;
21
+ export {};
22
+ //# sourceMappingURL=journal-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal-view.d.ts","sourceRoot":"","sources":["../../src/runtime/journal-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,MAAM,WAAW,WAAW,CAAC,KAAK;IAChC,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;CACvB;AAED,KAAK,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,sBAAsB,CAAC,CAAC;AAE1E,MAAM,WAAW,WAAW,CAAC,KAAK;IAChC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,0JAA0J;IAC1J,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,KAAK,CAAC;CAC/D;AAWD,wBAAgB,iBAAiB,CAAC,KAAK,EACrC,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,GACvB,WAAW,CAAC,KAAK,CAAC,CA+BpB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,SAAS,MAAM,GAAG,IAAI,EACtD,MAAM,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,GACxC,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAQnC"}
@@ -0,0 +1,60 @@
1
+ export const JOURNAL_CHANGE_FALLBACK_MS = 30_000;
2
+ // The in-process read model for derivations that join across streams or must
3
+ // answer without a durable key (use a ProjectionStore projection for per-key
4
+ // state that must survive restarts). The first call folds history once; every
5
+ // later journal move folds only the events after the position already held, so
6
+ // cost per resident tick is proportional to what changed, never to history.
7
+ // There is deliberately no "re-derive everything when the journal moves" form.
8
+ // Folds are serialised, so every event is applied once and in order however
9
+ // many callers ask at the same time; the value is keyed by the last position
10
+ // actually read, never one sampled beforehand.
11
+ export function foldedJournalView(journal, fold) {
12
+ let state = {
13
+ position: 0,
14
+ value: fold.initial,
15
+ };
16
+ let running;
17
+ return {
18
+ async get() {
19
+ for (;;) {
20
+ const sampled = await journal.latestGlobalPosition();
21
+ if (state.position >= sampled)
22
+ return state.value;
23
+ if (running !== undefined) {
24
+ await running.catch(() => undefined);
25
+ continue;
26
+ }
27
+ const run = (async () => {
28
+ const events = await journal.readAll(state.position);
29
+ if (events.length > 0)
30
+ state = {
31
+ position: events.at(-1).globalPosition,
32
+ value: fold.extend(state.value, events),
33
+ };
34
+ return state.value;
35
+ })().finally(() => {
36
+ if (running === run)
37
+ running = undefined;
38
+ });
39
+ running = run;
40
+ return run;
41
+ }
42
+ },
43
+ };
44
+ }
45
+ /**
46
+ * Decodes each envelope object once. Journals hand out the same immutable
47
+ * envelope instances while their cache is valid, so repeated stream loads reuse
48
+ * the earlier decode instead of re-running schema validation on every call. A
49
+ * decoder that throws is not memoized and keeps throwing.
50
+ */
51
+ export function decodeOnce(decode) {
52
+ const decoded = new WeakMap();
53
+ return (event) => {
54
+ if (decoded.has(event))
55
+ return decoded.get(event);
56
+ const value = decode(event);
57
+ decoded.set(event, value);
58
+ return value;
59
+ };
60
+ }
@@ -25,6 +25,7 @@ export declare class FileEventJournal implements EventJournal {
25
25
  private runningListing;
26
26
  private queuedListing;
27
27
  private temporariesReclaimed;
28
+ private lastFullListingMs;
28
29
  appendToStream(stream: StreamRef, expectedSequence: number, drafts: readonly EventData[]): Promise<readonly EventEnvelope[]>;
29
30
  private nextSegmentFile;
30
31
  readStream(stream: StreamRef): Promise<readonly EventEnvelope<EventData<string, unknown>, StreamRef<string, string>>[]>;
@@ -46,6 +47,7 @@ export declare class FileEventJournal implements EventJournal {
46
47
  private scan;
47
48
  private currentEntries;
48
49
  private startListing;
50
+ private nothingNewerThanCache;
49
51
  private listSegments;
50
52
  private parseIndexedEntries;
51
53
  private decodeIndexedRecord;
@@ -1 +1 @@
1
- {"version":3,"file":"file-event-journal.d.ts","sourceRoot":"","sources":["../src/file-event-journal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAU7B,MAAM,WAAW,uBAAuB;IACtC,KAAK,IAAI,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;CACrD;AAED,MAAM,MAAM,8BAA8B,GAAG,CAC3C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,IAAI,KACf,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEtC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,8BAA8B,CAAC;CAC1D;AAWD,qBAAa,gBAAiB,YAAW,YAAY;IAEjD,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAFP,IAAI,EAAE,MAAM,EACZ,KAAK,EAA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