@atolis-hq/wake 0.3.59 → 0.3.60

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.
@@ -108,4 +108,4 @@ export function resolveWakeVersion(options = {}) {
108
108
  return `g${headHash.slice(0, 7)}`;
109
109
  return '0.1.0-dev';
110
110
  }
111
- export const wakeVersion = "g58abde5";
111
+ export const wakeVersion = "gbbe428e";
@@ -128,11 +128,10 @@ async function applyIssueRetrySignal(input) {
128
128
  const workItemIds = (await resources.correlations(resourceIdValue))
129
129
  .filter((correlation) => correlation.role === ResourceCorrelationRole.Primary)
130
130
  .map((correlation) => correlation.workItemId);
131
- const workflows = await orchestration.listAll();
132
131
  for (const workItemId of workItemIds) {
133
132
  if (!(await isEligibleWorkItem(work, workItemId)))
134
133
  continue;
135
- const target = selectOperatorRetryTarget(workflows.filter((workflow) => workflow.workItemId === workItemId));
134
+ const target = selectOperatorRetryTarget(await orchestration.listForWorkItem(workItemId));
136
135
  if (target === undefined)
137
136
  continue;
138
137
  await ignoreIneligibleOperatorRetry(() => orchestration.retryBlockedFailedStage(target.workflowInstanceId, commandContext(event)));
@@ -3,6 +3,7 @@ import { AcceptSignal } from './accept-signal.js';
3
3
  import { AdvanceWorkflow } from './advance-workflow.js';
4
4
  import { CoordinationClaims } from './coordination-claims.js';
5
5
  import { GroupBudgetRecorder } from './group-budget-recorder.js';
6
+ import { workflowsByWorkItemProjection } from './orchestration-projection.js';
6
7
  import { OrchestrationRepository } from './orchestration-repository.js';
7
8
  import { RequestChild } from './request-child.js';
8
9
  import { StartWorkflow } from './start-workflow.js';
@@ -14,9 +15,11 @@ export class OrchestrationService {
14
15
  acceptWorkflowSignal;
15
16
  advanceWorkflow;
16
17
  childWorkflows;
18
+ projections;
17
19
  coordinateAcceptSignal = (operation) => operation();
18
20
  watchChildCancellation;
19
21
  constructor(journal, work, definitions, projections) {
22
+ this.projections = projections;
20
23
  const repository = new OrchestrationRepository(journal);
21
24
  const claims = new CoordinationClaims(journal);
22
25
  this.startWorkflow = new StartWorkflow(repository, claims, work, new WorkflowDefinitionRegistry(journal, projections, definitions));
@@ -85,6 +88,13 @@ export class OrchestrationService {
85
88
  listAll() {
86
89
  return this.advanceWorkflow.listAll();
87
90
  }
91
+ async listForWorkItem(workItemId) {
92
+ if (this.projections === undefined)
93
+ return (await this.advanceWorkflow.listAll()).filter((workflow) => workflow.workItemId === workItemId);
94
+ const stored = await this.projections.read(workflowsByWorkItemProjection.name, workItemId);
95
+ const workflows = await Promise.all((stored?.value ?? []).map((workflowInstanceId) => this.advanceWorkflow.get(workflowInstanceId)));
96
+ return workflows.filter((workflow) => workflow !== null);
97
+ }
88
98
  reconcileChildCompletions(context) {
89
99
  return this.transitionWatchChildren(context, () => this.childWorkflows.reconcileChildCompletions(context));
90
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/wake",
3
- "version": "0.3.59",
3
+ "version": "0.3.60",
4
4
  "description": "Local autonomous agent control plane for software development",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {