@atolis-hq/wake 0.4.105 → 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.
- package/dist/src/activities/agent/agent-activity.js +7 -0
- package/dist/src/activities/contracts/activity.d.ts +12 -0
- package/dist/src/activities/contracts/event-schema.d.ts +314 -8
- package/dist/src/activities/contracts/event-schema.js +20 -2
- package/dist/src/activities/contracts/events.d.ts +10 -0
- package/dist/src/activities/contracts/vocabulary.d.ts +2 -0
- package/dist/src/activities/contracts/vocabulary.js +2 -0
- package/dist/src/activities/index.d.ts +2 -0
- package/dist/src/activities/index.js +2 -0
- package/dist/src/activities/pr/activity-support.d.ts +1 -1
- package/dist/src/activities/pr/activity-support.js +10 -0
- package/dist/src/activities/pr/application.js +31 -10
- package/dist/src/activities/pr/approve.d.ts +2 -1
- package/dist/src/activities/pr/approve.js +33 -11
- package/dist/src/activities/pr/check-evidence.d.ts +10 -0
- package/dist/src/activities/pr/check-evidence.js +16 -0
- package/dist/src/activities/pr/contracts.d.ts +14 -0
- package/dist/src/activities/pr/event-data.js +5 -1
- package/dist/src/activities/pr/merge.d.ts +2 -1
- package/dist/src/activities/pr/merge.js +54 -38
- package/dist/src/activities/pr/parent-scope.d.ts +65 -0
- package/dist/src/activities/pr/parent-scope.js +24 -0
- package/dist/src/activities/pr/parent-target.d.ts +45 -0
- package/dist/src/activities/pr/parent-target.js +59 -0
- package/dist/src/activities/pr/projection.js +10 -2
- package/dist/src/activities/pr/vocabulary.d.ts +8 -0
- package/dist/src/activities/pr/vocabulary.js +8 -0
- package/dist/src/bootstrap/activity-registry.d.ts +2 -2
- package/dist/src/bootstrap/activity-registry.js +3 -3
- package/dist/src/bootstrap/composition-root.js +12 -3
- package/dist/src/bootstrap/config/root-schema.d.ts +6 -0
- package/dist/src/bootstrap/delivery-integration.d.ts +9 -0
- package/dist/src/bootstrap/delivery-integration.js +46 -0
- package/dist/src/bootstrap/surface-api-delivery.js +27 -0
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +3 -1
- package/dist/src/control-plane/application/advance-once-dispatch.js +10 -6
- package/dist/src/conversations/application/conversation-repository.d.ts +1 -1
- package/dist/src/conversations/application/conversation-repository.js +3 -1
- package/dist/src/execution/application/execution-service.js +10 -0
- package/dist/src/execution/application/maintenance-workspaces.d.ts +17 -0
- package/dist/src/execution/application/maintenance-workspaces.js +84 -0
- package/dist/src/execution/application/run-lifecycle.js +1 -0
- package/dist/src/execution/application/run-repository.js +27 -10
- package/dist/src/execution/contracts/commands.d.ts +2 -0
- package/dist/src/execution/contracts/events.d.ts +13 -0
- package/dist/src/execution/contracts/events.js +2 -0
- package/dist/src/execution/contracts/maintenance.d.ts +36 -0
- package/dist/src/execution/contracts/maintenance.js +44 -0
- package/dist/src/execution/contracts/views.d.ts +2 -0
- package/dist/src/execution/contracts/workspace.d.ts +2 -0
- package/dist/src/execution/index.d.ts +1 -0
- package/dist/src/execution/index.js +1 -0
- package/dist/src/integrations/application/artifact-registration-reactor.js +7 -14
- package/dist/src/integrations/application/delegation-outputs.js +1 -1
- package/dist/src/integrations/application/delivery-integration-verification.d.ts +13 -0
- package/dist/src/integrations/application/delivery-integration-verification.js +68 -0
- package/dist/src/integrations/application/latest-unresolved-artifacts.d.ts +3 -0
- package/dist/src/integrations/application/latest-unresolved-artifacts.js +16 -0
- package/dist/src/integrations/delivery/application/delivery-projector.js +3 -0
- package/dist/src/integrations/delivery/application/merged-delivery-evidence.js +9 -1
- package/dist/src/integrations/delivery/contracts/views.d.ts +2 -0
- package/dist/src/integrations/fake/external-source.d.ts +5 -2
- package/dist/src/integrations/fake/external-source.js +12 -2
- package/dist/src/integrations/fake/inbound-translator.js +7 -2
- package/dist/src/integrations/fake/provider.d.ts +17 -0
- package/dist/src/integrations/fake/provider.js +18 -2
- package/dist/src/integrations/github/application/comment-history-reader.d.ts +1 -1
- package/dist/src/integrations/github/application/comment-history-reader.js +56 -39
- package/dist/src/integrations/github/application/pull-request-translation.js +2 -0
- package/dist/src/integrations/github/contracts/events.d.ts +3 -1
- package/dist/src/integrations/github/contracts/events.js +3 -1
- package/dist/src/integrations/github/contracts/payloads.d.ts +23 -0
- package/dist/src/integrations/github/infrastructure/check-execution.d.ts +9 -0
- package/dist/src/integrations/github/infrastructure/check-execution.js +68 -0
- package/dist/src/integrations/github/infrastructure/checkout-revision.d.ts +2 -0
- package/dist/src/integrations/github/infrastructure/checkout-revision.js +23 -0
- package/dist/src/integrations/github/infrastructure/client.d.ts +2 -0
- package/dist/src/integrations/github/infrastructure/client.js +4 -0
- package/dist/src/integrations/github/infrastructure/pr-check-subject.d.ts +7 -0
- package/dist/src/integrations/github/infrastructure/pr-check-subject.js +77 -0
- package/dist/src/integrations/github/infrastructure/pr-evidence.d.ts +6 -3
- package/dist/src/integrations/github/infrastructure/pr-evidence.js +1 -1
- package/dist/src/integrations/github/infrastructure/pr-source.d.ts +3 -5
- package/dist/src/integrations/github/infrastructure/pr-source.js +11 -1
- package/dist/src/integrations/github/infrastructure/workflow-run-evidence.d.ts +5 -0
- package/dist/src/integrations/github/infrastructure/workflow-run-evidence.js +22 -0
- package/dist/src/integrations/index.d.ts +1 -0
- package/dist/src/integrations/index.js +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts.map +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/index.js +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts +14 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts.map +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.js +31 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.d.ts +22 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/journal-view.js +60 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts +2 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts.map +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.js +82 -15
- package/dist/src/orchestration/application/advance-workflow.js +7 -2
- package/dist/src/orchestration/application/deferred-signals.js +2 -6
- package/dist/src/orchestration/application/delegation-commands.d.ts +3 -0
- package/dist/src/orchestration/application/delivery-coordinator.d.ts +70 -1
- package/dist/src/orchestration/application/delivery-coordinator.js +31 -5
- package/dist/src/orchestration/application/delivery-facts-reader.js +1 -0
- package/dist/src/orchestration/application/delivery-integration-reader.d.ts +9 -0
- package/dist/src/orchestration/application/delivery-integration-reader.js +23 -0
- package/dist/src/orchestration/application/delivery-integration-service.d.ts +50 -0
- package/dist/src/orchestration/application/delivery-integration-service.js +228 -0
- package/dist/src/orchestration/application/delivery-preparation.d.ts +1 -0
- package/dist/src/orchestration/application/delivery-preparation.js +7 -2
- package/dist/src/orchestration/application/orchestration-repository.d.ts +14 -9
- package/dist/src/orchestration/application/orchestration-repository.js +139 -64
- package/dist/src/orchestration/application/orchestration-service.d.ts +74 -3
- package/dist/src/orchestration/application/orchestration-service.js +55 -2
- package/dist/src/orchestration/contracts/config.d.ts +6 -0
- package/dist/src/orchestration/contracts/config.js +6 -0
- package/dist/src/orchestration/contracts/delivery-ports.d.ts +44 -0
- package/dist/src/orchestration/contracts/delivery.d.ts +58 -0
- package/dist/src/orchestration/contracts/delivery.js +53 -1
- package/dist/src/orchestration/contracts/event-decoder.js +2 -1
- package/dist/src/orchestration/contracts/event-factory.js +2 -0
- package/dist/src/orchestration/contracts/events.d.ts +3 -1
- package/dist/src/orchestration/contracts/events.js +1 -0
- package/dist/src/orchestration/contracts/vocabulary.d.ts +44 -1
- package/dist/src/orchestration/contracts/vocabulary.js +40 -1
- package/dist/src/orchestration/domain/compile-diagnostics.d.ts +1 -1
- package/dist/src/orchestration/domain/compile-diagnostics.js +5 -0
- package/dist/src/orchestration/domain/delivery-candidate.js +13 -0
- package/dist/src/orchestration/domain/delivery-facts.d.ts +7 -1
- package/dist/src/orchestration/domain/delivery-facts.js +33 -1
- package/dist/src/orchestration/domain/delivery-integration-policy.d.ts +7 -0
- package/dist/src/orchestration/domain/delivery-integration-policy.js +15 -0
- package/dist/src/orchestration/domain/delivery-integration.d.ts +54 -0
- package/dist/src/orchestration/domain/delivery-integration.js +144 -0
- package/dist/src/orchestration/domain/delivery-qa.d.ts +2 -1
- package/dist/src/orchestration/domain/delivery-qa.js +24 -4
- package/dist/src/orchestration/domain/delivery-workflow-policy.d.ts +3 -1
- package/dist/src/orchestration/domain/delivery-workflow-policy.js +19 -0
- package/dist/src/orchestration/domain/workflow-instance-events.js +1 -0
- package/dist/src/orchestration/index.d.ts +3 -2
- package/dist/src/orchestration/index.js +1 -1
- package/dist/src/resources/application/resource-lookup.d.ts +2 -1
- package/dist/src/resources/application/resource-lookup.js +3 -11
- package/dist/src/resources/application/resource-repository.js +10 -10
- package/dist/src/surfaces/api/contracts/transport-values.js +1 -0
- package/dist/src/surfaces/api/contracts/work.d.ts +26 -0
- package/dist/src/surfaces/api/presenters/execution.js +1 -0
- package/dist/src/surfaces/mcp/delegation.js +5 -1
- package/dist/src/surfaces/web-assets/assets/index-ih1h3dxC.js +1192 -0
- package/dist/src/surfaces/web-assets/index.html +1 -1
- package/package.json +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts +0 -16
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts.map +0 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.js +0 -79
- package/dist/src/surfaces/web-assets/assets/index-BfhxlN_h.js +0 -1192
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isDeepStrictEqual } from 'node:util';
|
|
2
2
|
import { DeliveryCompletion, DeliveryRejection, QaVerdict } from '../contracts/vocabulary.js';
|
|
3
|
-
import { currentSelection, entryKey, reject, requirements, } from './delivery-facts.js';
|
|
3
|
+
import { currentSelection, entryKey, isChange, outputKey, reject, requirements, } from './delivery-facts.js';
|
|
4
4
|
import { staleEntries } from './delivery-selection.js';
|
|
5
5
|
/** The exact repository and revision set QA must have checked. */
|
|
6
6
|
export const revisionSet = (items) => items.map((item) => `${item.resourceId}@${item.revision.toLowerCase()}`).sort();
|
|
@@ -49,7 +49,7 @@ export function deliveryState(facts) {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
/** DC-24 handoff boundary: QA approval finishes a QA-approved parent but never a merge-required one. */
|
|
52
|
-
export function completionDecision(state, mode) {
|
|
52
|
+
export function completionDecision(state, mode, integration) {
|
|
53
53
|
if (state.stale.length > 0)
|
|
54
54
|
return {
|
|
55
55
|
complete: false,
|
|
@@ -61,17 +61,37 @@ export function completionDecision(state, mode) {
|
|
|
61
61
|
return { complete: false, reason: 'The current candidate has no QA result' };
|
|
62
62
|
if (state.qa.verdict !== QaVerdict.Pass)
|
|
63
63
|
return { complete: false, reason: `QA verdict is ${state.qa.verdict}` };
|
|
64
|
-
if (mode === DeliveryCompletion.MergeRequired)
|
|
64
|
+
if (mode === DeliveryCompletion.MergeRequired && integration?.complete !== true)
|
|
65
65
|
return {
|
|
66
66
|
complete: false,
|
|
67
|
-
reason:
|
|
67
|
+
reason: `Governed integration is required and its gates are not satisfied: ${integration?.summary ?? 'integration state is unavailable'}`,
|
|
68
68
|
};
|
|
69
69
|
return { complete: true };
|
|
70
70
|
}
|
|
71
|
+
/** A maintained or replaced change makes any candidate built from its earlier subject historical. */
|
|
72
|
+
function subjectsCurrent(current, candidate) {
|
|
73
|
+
return (candidate.subjects ?? []).every((subject) => {
|
|
74
|
+
const entry = current.entries.find((item) => item.childWorkItemId === subject.childWorkItemId && item.output.name === subject.outputName);
|
|
75
|
+
return (entry !== undefined &&
|
|
76
|
+
isChange(entry.output) &&
|
|
77
|
+
entry.output.reference.revision.toLowerCase() === subject.revision.toLowerCase() &&
|
|
78
|
+
entry.output.reference.pullRequestBase === subject.pullRequestBase &&
|
|
79
|
+
(entry.output.reference.baseRevision ?? '').toLowerCase() ===
|
|
80
|
+
(subject.baseRevision ?? '').toLowerCase());
|
|
81
|
+
});
|
|
82
|
+
}
|
|
71
83
|
function isCandidateCurrent(facts, current, candidate, stale) {
|
|
72
84
|
return (candidate !== null &&
|
|
73
85
|
current !== undefined &&
|
|
74
86
|
candidate.selectionRevision === current?.revision &&
|
|
75
87
|
stale.length === 0 &&
|
|
88
|
+
subjectsCurrent(current, candidate) &&
|
|
89
|
+
legacySubjectsCurrent(facts, candidate) &&
|
|
76
90
|
requirements(facts.reservations).every((requirement) => current.entries.some((entry) => entryKey(entry, entry.output.name) === entryKey(requirement, requirement.outputName))));
|
|
77
91
|
}
|
|
92
|
+
function legacySubjectsCurrent(facts, candidate) {
|
|
93
|
+
if (candidate.subjects !== undefined)
|
|
94
|
+
return true;
|
|
95
|
+
const contributions = new Set(candidate.repositories.flatMap((repository) => repository.contributions.map(outputKey)));
|
|
96
|
+
return !facts.maintenance.some((item) => contributions.has(outputKey(item.target)));
|
|
97
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type ActivityRegistry } from '../../activities/index.js';
|
|
2
2
|
import type { CompiledStage, WorkflowDefinitionConfig } from '../contracts/config.js';
|
|
3
3
|
import { type StageName } from '../contracts/identifiers.js';
|
|
4
|
-
|
|
4
|
+
type Stages = Readonly<Record<StageName, CompiledStage>>;
|
|
5
|
+
export declare function assertDeliveryQa(config: WorkflowDefinitionConfig, stages: Stages, activities: ActivityRegistry): void;
|
|
6
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ActivityExecutionKind } from '../../activities/index.js';
|
|
2
2
|
import { WorkspaceMode } from '../../execution/index.js';
|
|
3
3
|
import { stageName } from '../contracts/identifiers.js';
|
|
4
|
+
import { DeliveryCompletion } from '../contracts/vocabulary.js';
|
|
4
5
|
export function assertDeliveryQa(config, stages, activities) {
|
|
5
6
|
const qa = config.delegation?.qa;
|
|
6
7
|
if (qa !== undefined) {
|
|
@@ -10,4 +11,22 @@ export function assertDeliveryQa(config, stages, activities) {
|
|
|
10
11
|
activities.describe(stage.activity).executionKind !== ActivityExecutionKind.Agent)
|
|
11
12
|
throw new Error('Delegation QA must name a configured read-only agent stage');
|
|
12
13
|
}
|
|
14
|
+
assertDeliveryMaintenance(config, stages, activities);
|
|
15
|
+
}
|
|
16
|
+
/** Maintenance writes through branch leases Wake prepares, so its stage brings no workspace. */
|
|
17
|
+
function assertDeliveryMaintenance(config, stages, activities) {
|
|
18
|
+
const maintenance = config.delegation?.maintenance;
|
|
19
|
+
if (maintenance === undefined)
|
|
20
|
+
return;
|
|
21
|
+
const stage = stages[stageName(maintenance.stage)];
|
|
22
|
+
if (config.delegation?.completion !== DeliveryCompletion.MergeRequired ||
|
|
23
|
+
!isLeaseOnlyAgentStage(stage, activities))
|
|
24
|
+
throw new Error('Delegation maintenance must name an agent stage without a workspace of its own in a merge-required delivery; Wake leases the target branches');
|
|
25
|
+
if (maintenance.stage === config.delegation?.qa?.stage)
|
|
26
|
+
throw new Error('Delegation maintenance cannot reuse the QA stage');
|
|
27
|
+
}
|
|
28
|
+
function isLeaseOnlyAgentStage(stage, activities) {
|
|
29
|
+
return (stage !== undefined &&
|
|
30
|
+
(stage.execution?.workspace ?? WorkspaceMode.None) === WorkspaceMode.None &&
|
|
31
|
+
activities.describe(stage.activity).executionKind === ActivityExecutionKind.Agent);
|
|
13
32
|
}
|
|
@@ -216,6 +216,7 @@ function applyCoordinationFact(state, event) {
|
|
|
216
216
|
case OrchestrationEventType.DeliverySelectionRevised:
|
|
217
217
|
case OrchestrationEventType.DeliveryCandidateRecorded:
|
|
218
218
|
case OrchestrationEventType.DeliveryQaRecorded:
|
|
219
|
+
case OrchestrationEventType.DeliveryMaintenanceRecorded:
|
|
219
220
|
return;
|
|
220
221
|
case OrchestrationEventType.DelegationWaitStarted:
|
|
221
222
|
case OrchestrationEventType.DelegationJoined:
|
|
@@ -35,7 +35,8 @@ export type { WorkflowCompileDiagnostic } from './domain/compile-diagnostics.js'
|
|
|
35
35
|
export type { DelegationArtifacts, DelegationRepositories } from './contracts/delegation-ports.js';
|
|
36
36
|
export { DelegationAttentionError, DelegationConflictError, DelegationPendingError, } from './contracts/delegation.js';
|
|
37
37
|
export type { DelegationAuthority } from './contracts/delegation-ports.js';
|
|
38
|
-
export {
|
|
39
|
-
export
|
|
38
|
+
export type { DeliveryIntegration, DeliveryPullRequest } from './contracts/delivery-ports.js';
|
|
39
|
+
export { DeliveryRejectionError, deliveryCandidateCommandSchema, deliveryMaintenanceCommandSchema, deliveryQaCommandSchema, deliverySelectionCommandSchema, } from './contracts/delivery.js';
|
|
40
|
+
export type { DeliveryCandidate, DeliveryCandidateCommand, DeliveryMaintenance, DeliveryMaintenanceCommand, DeliveryQa, DeliveryQaCommand, DeliverySelection, DeliverySelectionCommand, } from './contracts/delivery.js';
|
|
40
41
|
export { delegationAttentionReplySchema, delegationSubmissionSchema, } from './contracts/delegation.js';
|
|
41
42
|
export type { DelegationAttentionBlocker, DelegationAttentionReply, DelegationAttentionRequest, DelegationCaller, DelegationInputs, DelegationPrerequisite, DelegationReservation, DelegationResult, DelegationSubmission, } from './contracts/delegation.js';
|
|
@@ -32,5 +32,5 @@ export * from './domain/workflow-instance.js';
|
|
|
32
32
|
export * from './domain/workflow-selector.js';
|
|
33
33
|
export * from './application/work-completion-summary.js';
|
|
34
34
|
export { DelegationAttentionError, DelegationConflictError, DelegationPendingError, } from './contracts/delegation.js';
|
|
35
|
-
export { DeliveryRejectionError, deliveryCandidateCommandSchema, deliveryQaCommandSchema, deliverySelectionCommandSchema, } from './contracts/delivery.js';
|
|
35
|
+
export { DeliveryRejectionError, deliveryCandidateCommandSchema, deliveryMaintenanceCommandSchema, deliveryQaCommandSchema, deliverySelectionCommandSchema, } from './contracts/delivery.js';
|
|
36
36
|
export { delegationAttentionReplySchema, delegationSubmissionSchema, } from './contracts/delegation.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CheckpointStore, type EventJournal, type ProjectionStore } from '@atolis-hq/eventing';
|
|
2
2
|
import type { WorkItemId } from '../../work/index.js';
|
|
3
3
|
import type { ResourceId } from '../contracts/identifiers.js';
|
|
4
4
|
import type { ExternalResourceKey, ResourceCorrelationView } from '../contracts/views.js';
|
|
@@ -14,4 +14,5 @@ export interface ResourceLookup {
|
|
|
14
14
|
export declare function createResourceLookup(dependencies: {
|
|
15
15
|
readonly journal: EventJournal;
|
|
16
16
|
readonly projections: ProjectionStore;
|
|
17
|
+
readonly checkpoints: Pick<CheckpointStore, 'load'>;
|
|
17
18
|
}): ResourceLookup;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
+
import { readCurrentProjection, } from '@atolis-hq/eventing';
|
|
1
2
|
import { ResourceEventType, selectResourceEvent } from '../contracts/events.js';
|
|
2
3
|
import { resourceStream } from '../contracts/streams.js';
|
|
3
4
|
import { ResourceCorrelationRole } from '../contracts/vocabulary.js';
|
|
4
5
|
import { externalKeyProjectionKey, resourcesByExternalKeyProjection, workCorrelationsProjection, } from './lookup-projections.js';
|
|
5
6
|
export function createResourceLookup(dependencies) {
|
|
6
|
-
const seeded = async (definition, key) => {
|
|
7
|
-
const stored = await dependencies.projections.read(definition.name, key);
|
|
8
|
-
let value = stored?.value ?? definition.initial(key);
|
|
9
|
-
for (const event of await dependencies.journal.readAll(stored?.lastGlobalPosition ?? 0)) {
|
|
10
|
-
if (definition.select(event)?.key === key)
|
|
11
|
-
value = definition.project(value, event);
|
|
12
|
-
}
|
|
13
|
-
return value;
|
|
14
|
-
};
|
|
15
7
|
return {
|
|
16
|
-
resourceIdForExternalKey: (externalKey) =>
|
|
17
|
-
correlationsForWork: (workItemId) =>
|
|
8
|
+
resourceIdForExternalKey: (externalKey) => readCurrentProjection(dependencies, resourcesByExternalKeyProjection, externalKeyProjectionKey(externalKey)),
|
|
9
|
+
correlationsForWork: (workItemId) => readCurrentProjection(dependencies, workCorrelationsProjection, workItemId),
|
|
18
10
|
async primaryCorrelation(resourceId) {
|
|
19
11
|
const active = new Map();
|
|
20
12
|
const retracted = [];
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { decodeOnce, foldedJournalView, } from '@atolis-hq/eventing';
|
|
2
2
|
import { ResourceEventType, decodeResourceEvent, selectResourceEvent, } from '../contracts/events.js';
|
|
3
3
|
import { resourceStream } from '../contracts/streams.js';
|
|
4
4
|
import { foldResource } from '../domain/resource.js';
|
|
5
|
+
const selectResource = decodeOnce(selectResourceEvent);
|
|
5
6
|
export class ResourceRepository {
|
|
6
7
|
journal;
|
|
7
8
|
resourceIds;
|
|
8
9
|
constructor(journal) {
|
|
9
10
|
this.journal = journal;
|
|
10
|
-
this.resourceIds =
|
|
11
|
+
this.resourceIds = foldedJournalView(journal, { initial: [], extend: extendResourceIds });
|
|
11
12
|
}
|
|
12
13
|
async load(resourceId) {
|
|
13
14
|
const events = await this.journal.readStream(resourceStream(resourceId));
|
|
14
|
-
const owned = events.map(
|
|
15
|
+
const owned = events.map(selectResource).filter((event) => event !== null);
|
|
15
16
|
return { sequence: events.length, resource: foldResource(owned) };
|
|
16
17
|
}
|
|
17
18
|
async append(resourceId, expectedSequence, drafts) {
|
|
@@ -22,11 +23,10 @@ export class ResourceRepository {
|
|
|
22
23
|
return this.resourceIds.get();
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
];
|
|
26
|
+
function extendResourceIds(known, events) {
|
|
27
|
+
const discovered = events
|
|
28
|
+
.map(selectResourceEvent)
|
|
29
|
+
.filter((event) => event?.event.eventType === ResourceEventType.ResourceDiscovered)
|
|
30
|
+
.map((event) => event.stream.id);
|
|
31
|
+
return [...new Set([...known, ...discovered])];
|
|
32
32
|
}
|
|
@@ -18,7 +18,33 @@ export interface WorkItemResponse {
|
|
|
18
18
|
/** Raw outcome emitted by the latest agent run, when one is available. */
|
|
19
19
|
readonly lastRunOutcome?: string;
|
|
20
20
|
}
|
|
21
|
+
/** Governed integration progress, derived from provider-observed state; never a separate record. */
|
|
22
|
+
export interface DeliveryIntegrationResponse {
|
|
23
|
+
readonly complete: boolean;
|
|
24
|
+
readonly summary: string;
|
|
25
|
+
readonly targets: readonly {
|
|
26
|
+
/** The child that owns the pull request; integration never transfers ownership. */
|
|
27
|
+
readonly workItemKey: WorkItemKey;
|
|
28
|
+
readonly outputName: string;
|
|
29
|
+
readonly state: string;
|
|
30
|
+
readonly layer: number;
|
|
31
|
+
readonly baseMovement: string;
|
|
32
|
+
readonly evidenceAffected: boolean;
|
|
33
|
+
readonly maintenance?: string;
|
|
34
|
+
readonly detail?: string;
|
|
35
|
+
}[];
|
|
36
|
+
readonly maintenance: readonly {
|
|
37
|
+
readonly maintenanceId: string;
|
|
38
|
+
readonly workItemKey: WorkItemKey;
|
|
39
|
+
readonly outputName: string;
|
|
40
|
+
readonly kind: string;
|
|
41
|
+
readonly previousRevision: string;
|
|
42
|
+
readonly currentRevision: string;
|
|
43
|
+
readonly producerRunId: string;
|
|
44
|
+
}[];
|
|
45
|
+
}
|
|
21
46
|
export interface DeliveryQaResponse {
|
|
47
|
+
readonly integration?: DeliveryIntegrationResponse;
|
|
22
48
|
readonly selectionRevision: number;
|
|
23
49
|
readonly candidateId?: string;
|
|
24
50
|
readonly repositories: readonly {
|
|
@@ -6,6 +6,7 @@ const outcomeSentinels = {
|
|
|
6
6
|
[ActivityOutcomeKind.Blocked]: 'BLOCKED',
|
|
7
7
|
[ActivityOutcomeKind.Failed]: 'FAILED',
|
|
8
8
|
[ActivityOutcomeKind.Waiting]: 'WAITING',
|
|
9
|
+
[ActivityOutcomeKind.Integrated]: 'INTEGRATED',
|
|
9
10
|
};
|
|
10
11
|
// The response preserves optional run facts without introducing a second view model.
|
|
11
12
|
// eslint-disable-next-line complexity
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DelegationAttentionError, DelegationConflictError, DeliveryRejectionError, delegationAttentionReplySchema, delegationSubmissionSchema, deliveryCandidateCommandSchema, deliveryQaCommandSchema, deliverySelectionCommandSchema, } from '../../orchestration/index.js';
|
|
1
|
+
import { DelegationAttentionError, DelegationConflictError, DeliveryRejectionError, delegationAttentionReplySchema, delegationSubmissionSchema, deliveryCandidateCommandSchema, deliveryMaintenanceCommandSchema, deliveryQaCommandSchema, deliverySelectionCommandSchema, } from '../../orchestration/index.js';
|
|
2
2
|
/** The bound caller is never accepted as a tool argument. */
|
|
3
3
|
export function registerDelegationTools(server, input) {
|
|
4
4
|
server.registerTool('wake_delegation_submit', {
|
|
@@ -70,6 +70,10 @@ export function registerDelegationTools(server, input) {
|
|
|
70
70
|
description: 'Record the QA verdict for a recorded candidate. Name the exact repository revisions checked; they must equal the candidate set. Use verdict blocked when the environment or a source is unavailable, fail with findings when defects remain, and pass only after the configured recipe ran.',
|
|
71
71
|
inputSchema: deliveryQaCommandSchema,
|
|
72
72
|
}, async (command) => guarded(async () => input.orchestration.recordDeliveryQa(await input.caller(), command, input.commandContext())));
|
|
73
|
+
server.registerTool('wake_delivery_maintenance', {
|
|
74
|
+
description: 'Record what you actually did to one selected pull request during integration maintenance (retarget, rebase or resolve) in the branch workspace Wake leased for it. Name the head you started from (expectedRevision) and the resulting pushed head and pull request base. Wake verifies the provider head and records a new subject: earlier reviews, checks and QA stay historical, and fresh review, checks and a new candidate with QA are required before the next merge.',
|
|
75
|
+
inputSchema: deliveryMaintenanceCommandSchema,
|
|
76
|
+
}, async (command) => guarded(async () => input.orchestration.recordDeliveryMaintenance(await input.caller(), command, input.commandContext())));
|
|
73
77
|
server.registerTool('wake_delegation_inspect', {
|
|
74
78
|
description: 'Inspect this delivery tree, child workflows, results and blockers, and the Repository Resource IDs an explicit repository selection may name.',
|
|
75
79
|
}, async () => ({
|