@atolis-hq/wake 0.4.106 → 0.4.108

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 (95) hide show
  1. package/dist/src/activities/agent/agent-activity.js +4 -0
  2. package/dist/src/activities/agent/agent-result.js +1 -0
  3. package/dist/src/activities/contracts/activity.d.ts +6 -0
  4. package/dist/src/activities/pr/application.js +23 -9
  5. package/dist/src/activities/pr/approve.js +1 -1
  6. package/dist/src/activities/pr/merge.js +1 -1
  7. package/dist/src/activities/pr/parent-scope.d.ts +8 -2
  8. package/dist/src/activities/pr/parent-scope.js +7 -1
  9. package/dist/src/activities/pr/parent-target.d.ts +2 -2
  10. package/dist/src/activities/pr/parent-target.js +1 -0
  11. package/dist/src/bootstrap/composition-root.js +1 -1
  12. package/dist/src/bootstrap/config/root-schema.d.ts +14 -0
  13. package/dist/src/bootstrap/delivery-integration.js +7 -4
  14. package/dist/src/bootstrap/version.js +1 -1
  15. package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +10 -0
  16. package/dist/src/control-plane/application/advance-once-dispatch.js +3 -5
  17. package/dist/src/control-plane/application/dispatch-resources.d.ts +10 -0
  18. package/dist/src/control-plane/application/dispatch-resources.js +9 -0
  19. package/dist/src/conversations/application/conversation-repository.d.ts +1 -1
  20. package/dist/src/conversations/application/conversation-repository.js +3 -1
  21. package/dist/src/execution/application/change-output-workspaces.d.ts +20 -0
  22. package/dist/src/execution/application/change-output-workspaces.js +123 -0
  23. package/dist/src/execution/application/execution-service.js +15 -2
  24. package/dist/src/execution/application/maintenance-workspaces.js +20 -12
  25. package/dist/src/execution/application/run-lifecycle.d.ts +2 -0
  26. package/dist/src/execution/application/run-lifecycle.js +2 -0
  27. package/dist/src/execution/application/run-repository.js +27 -10
  28. package/dist/src/execution/contracts/change-output.d.ts +15 -0
  29. package/dist/src/execution/contracts/change-output.js +12 -0
  30. package/dist/src/execution/contracts/commands.d.ts +5 -0
  31. package/dist/src/execution/contracts/events.d.ts +16 -0
  32. package/dist/src/execution/contracts/events.js +4 -0
  33. package/dist/src/execution/contracts/runner.d.ts +1 -0
  34. package/dist/src/execution/contracts/views.d.ts +3 -0
  35. package/dist/src/execution/contracts/workspace.d.ts +4 -0
  36. package/dist/src/execution/domain/run.js +3 -0
  37. package/dist/src/execution/index.d.ts +1 -0
  38. package/dist/src/execution/index.js +1 -0
  39. package/dist/src/execution/infrastructure/workspace/git-workspace.js +14 -3
  40. package/dist/src/integrations/application/artifact-registration-reactor.d.ts +2 -11
  41. package/dist/src/integrations/application/artifact-registration-reactor.js +16 -36
  42. package/dist/src/integrations/application/artifact-verification-source.d.ts +26 -0
  43. package/dist/src/integrations/application/artifact-verification-source.js +36 -0
  44. package/dist/src/integrations/application/delegation-outputs.js +56 -20
  45. package/dist/src/integrations/application/latest-unresolved-artifacts.d.ts +3 -0
  46. package/dist/src/integrations/application/latest-unresolved-artifacts.js +16 -0
  47. package/dist/src/integrations/contracts/artifact-events.d.ts +1 -0
  48. package/dist/src/integrations/contracts/artifact-events.js +1 -0
  49. package/dist/src/integrations/github/application/comment-history-reader.d.ts +1 -1
  50. package/dist/src/integrations/github/application/comment-history-reader.js +56 -39
  51. package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts +1 -1
  52. package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts.map +1 -1
  53. package/dist/src/node_modules/@atolis-hq/eventing/dist/index.js +1 -1
  54. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts +14 -0
  55. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts.map +1 -1
  56. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.js +31 -1
  57. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.d.ts +22 -0
  58. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.d.ts.map +1 -0
  59. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.js +60 -0
  60. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts +2 -0
  61. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts.map +1 -1
  62. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.js +82 -15
  63. package/dist/src/orchestration/application/advance-workflow.js +7 -2
  64. package/dist/src/orchestration/application/deferred-signals.js +2 -6
  65. package/dist/src/orchestration/application/delegated-work.d.ts +18 -0
  66. package/dist/src/orchestration/application/delegated-work.js +30 -3
  67. package/dist/src/orchestration/application/delegation-commands.d.ts +16 -0
  68. package/dist/src/orchestration/application/delegation-reservation.js +33 -5
  69. package/dist/src/orchestration/application/delivery-integration-service.js +5 -18
  70. package/dist/src/orchestration/application/orchestration-repository.d.ts +14 -9
  71. package/dist/src/orchestration/application/orchestration-repository.js +139 -64
  72. package/dist/src/orchestration/application/orchestration-service.d.ts +34 -0
  73. package/dist/src/orchestration/application/orchestration-service.js +6 -1
  74. package/dist/src/orchestration/contracts/config.d.ts +15 -0
  75. package/dist/src/orchestration/contracts/config.js +8 -1
  76. package/dist/src/orchestration/contracts/delegation.d.ts +33 -9
  77. package/dist/src/orchestration/contracts/delegation.js +11 -5
  78. package/dist/src/orchestration/contracts/vocabulary.d.ts +2 -0
  79. package/dist/src/orchestration/contracts/vocabulary.js +2 -0
  80. package/dist/src/orchestration/domain/assignment-output-requirements.d.ts +5 -0
  81. package/dist/src/orchestration/domain/assignment-output-requirements.js +23 -0
  82. package/dist/src/orchestration/domain/compiler.js +1 -0
  83. package/dist/src/orchestration/domain/delivery-facts.d.ts +9 -1
  84. package/dist/src/orchestration/domain/delivery-facts.js +4 -2
  85. package/dist/src/orchestration/domain/delivery-integration-target.d.ts +8 -0
  86. package/dist/src/orchestration/domain/delivery-integration-target.js +37 -0
  87. package/dist/src/orchestration/domain/delivery-replacement.js +11 -6
  88. package/dist/src/orchestration/domain/delivery-selection.js +2 -1
  89. package/dist/src/resources/application/resource-lookup.d.ts +2 -1
  90. package/dist/src/resources/application/resource-lookup.js +3 -11
  91. package/dist/src/resources/application/resource-repository.js +10 -10
  92. package/package.json +1 -1
  93. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts +0 -16
  94. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts.map +0 -1
  95. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.js +0 -79
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { decidePullRequestOutputAuthority, PullRequestState, reportedArtifactSchema, } from '../../activities/index.js';
2
+ import { ActivityOutcomeKind, decidePullRequestOutputAuthority, PullRequestState, reportedArtifactSchema, } from '../../activities/index.js';
3
3
  import { RunStatus, WorkspaceMode } from '../../execution/index.js';
4
4
  import { DelegationPrerequisiteCondition as Condition } from '../../orchestration/index.js';
5
5
  import { BuiltInResourceKind, ResourceCorrelationProvenance, ResourceCorrelationRole, resourceId, } from '../../resources/index.js';
@@ -19,15 +19,26 @@ export function createDelegationOutputs(input) {
19
19
  return qualifyingChange(input, child, output, condition);
20
20
  },
21
21
  async qualifyingOutputs(child, outputs) {
22
- const artifacts = outputs.filter((output) => 'path' in output);
23
- const references = artifacts.length === 0 ? [] : await input.artifacts.qualifyingOutputs(child, artifacts);
24
- if (references === null)
25
- return null;
22
+ const references = [];
26
23
  for (const output of outputs) {
27
- if (!('kind' in output))
24
+ if ('path' in output) {
25
+ const selected = await input.artifacts.qualifyingOutputs(child, [output]);
26
+ if (selected === null) {
27
+ if (output.required !== false)
28
+ return null;
29
+ }
30
+ else
31
+ references.push(...selected);
28
32
  continue;
33
+ }
29
34
  const change = await qualifyingChange(input, child, output);
30
- if (change === null)
35
+ if (change === null) {
36
+ if (output.required !== false)
37
+ return null;
38
+ continue;
39
+ }
40
+ if (references.some((entry) => 'resourceId' in entry.reference &&
41
+ entry.reference.resourceId === change.reference.resourceId))
31
42
  return null;
32
43
  references.push(change);
33
44
  }
@@ -35,17 +46,22 @@ export function createDelegationOutputs(input) {
35
46
  },
36
47
  };
37
48
  }
49
+ /** Latest run's claim for a name; identical repeats collapse, conflicting repeats yield no claim. */
38
50
  function reportedChange(runs, name) {
39
- return runs
40
- .flatMap((run) => {
51
+ const claims = runs.flatMap((run) => {
41
52
  const data = reportsSchema.safeParse(run.outcome?.data);
42
- return data.success
43
- ? data.data.reportedArtifacts
44
- .filter((entry) => entry.name === name && entry.kind === BuiltInResourceKind.PullRequest)
45
- .map((report) => ({ run, report }))
53
+ const reports = data.success
54
+ ? data.data.reportedArtifacts.filter((entry) => entry.name === name && entry.kind === BuiltInResourceKind.PullRequest)
46
55
  : [];
47
- })
48
- .at(-1);
56
+ return reports.length === 0 ? [] : [{ run, reports }];
57
+ });
58
+ const latest = claims.at(-1);
59
+ const report = latest?.reports[0];
60
+ if (latest === undefined || report === undefined)
61
+ return undefined;
62
+ const conflicting = latest.reports.some((entry) => entry.externalKey.adapter !== report.externalKey.adapter ||
63
+ entry.externalKey.key !== report.externalKey.key);
64
+ return conflicting ? undefined : { run: latest.run, report };
49
65
  }
50
66
  async function verifiedChange(input, report, source) {
51
67
  const { assignment, branch, revision } = source;
@@ -74,14 +90,18 @@ async function verifiedChange(input, report, source) {
74
90
  async function qualifyingChange(input, child, output, condition) {
75
91
  const runs = (await input.runs()).filter((run) => run.workflowInstanceId === child.workflowInstanceId &&
76
92
  run.status === RunStatus.Succeeded &&
93
+ hasSuccessfulOutcome(run) &&
77
94
  child.acceptedOutcomes.includes(run.activationId));
78
95
  const latest = reportedChange(runs, output.name);
79
96
  if (latest === undefined)
80
97
  return null;
81
- // Judge the PR against the latest implementation head so a revision run need not
82
- // repeat the report; the provider must confirm the PR now points there.
83
- const run = runs.filter((entry) => entry.workspace?.mode === WorkspaceMode.Branch).at(-1);
84
- const source = run === undefined ? undefined : runSource(run);
98
+ // A revision run may omit the report, but only this output's own branch may refresh it.
99
+ const run = runs
100
+ .filter((entry) => entry.workspace?.mode === WorkspaceMode.Branch &&
101
+ (latest.run.workspace?.changeOutputs === undefined ||
102
+ entry.changeOutputs?.some((source) => source.name === output.name) === true))
103
+ .at(-1);
104
+ const source = run === undefined ? undefined : runSource(run, output.name);
85
105
  if (run === undefined || source === undefined)
86
106
  return null;
87
107
  const { assignment, branch, revision } = source;
@@ -144,7 +164,17 @@ async function hasOutputAuthority(input, child, output, id, revision) {
144
164
  return false;
145
165
  return true;
146
166
  }
147
- function runSource(run) {
167
+ function runSource(run, name) {
168
+ if (run.workspace?.changeOutputs !== undefined) {
169
+ const output = run.changeOutputs?.find((entry) => entry.name === name);
170
+ return output === undefined
171
+ ? undefined
172
+ : {
173
+ assignment: output.repository,
174
+ branch: output.branch,
175
+ revision: output.revision,
176
+ };
177
+ }
148
178
  const assignment = run.repositoryAssignment;
149
179
  const branch = run.workspace?.branch;
150
180
  const revision = run.workspaceRevision;
@@ -152,3 +182,9 @@ function runSource(run) {
152
182
  return undefined;
153
183
  return { assignment, branch, revision };
154
184
  }
185
+ function hasSuccessfulOutcome(run) {
186
+ return (run.outcome !== undefined &&
187
+ run.outcome.kind !== ActivityOutcomeKind.Failed &&
188
+ run.outcome.kind !== ActivityOutcomeKind.Blocked &&
189
+ run.outcome.kind !== ActivityOutcomeKind.Rejected);
190
+ }
@@ -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
+ }
@@ -12,6 +12,7 @@ export interface ArtifactVerificationUnresolvedPayload {
12
12
  readonly workflowInstanceId: ReturnType<typeof workflowInstanceId>;
13
13
  readonly activationId: ReturnType<typeof activationId>;
14
14
  readonly artifact: {
15
+ readonly name?: string | undefined;
15
16
  readonly kind: ResourceKind;
16
17
  readonly externalKey: {
17
18
  readonly adapter: AdapterId;
@@ -20,6 +20,7 @@ const schema = eventEnvelopeSchema
20
20
  activationId: brandedStringSchema(activationId),
21
21
  artifact: z
22
22
  .object({
23
+ name: z.string().min(1).optional(),
23
24
  kind: brandedStringSchema(resourceKind),
24
25
  externalKey: z
25
26
  .object({ adapter: brandedStringSchema(adapterId), key: z.string().min(1) })
@@ -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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AAE,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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