@atolis-hq/wake 0.4.104 → 0.4.106
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 +10 -0
- package/dist/src/activities/contracts/activity.d.ts +28 -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 +8 -1
- 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 +11 -2
- package/dist/src/bootstrap/config/root-schema.d.ts +22 -0
- package/dist/src/bootstrap/delegation-authority.js +17 -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 +52 -0
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +5 -1
- package/dist/src/control-plane/application/advance-once-dispatch.js +12 -6
- package/dist/src/execution/application/candidate-workspaces.d.ts +13 -0
- package/dist/src/execution/application/candidate-workspaces.js +75 -0
- package/dist/src/execution/application/execution-service.js +37 -11
- 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 +2 -0
- package/dist/src/execution/contracts/candidate.d.ts +31 -0
- package/dist/src/execution/contracts/candidate.js +40 -0
- package/dist/src/execution/contracts/commands.d.ts +4 -0
- package/dist/src/execution/contracts/events.d.ts +24 -0
- package/dist/src/execution/contracts/events.js +4 -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/repository-assignment.d.ts +5 -0
- package/dist/src/execution/contracts/repository-assignment.js +8 -0
- package/dist/src/execution/contracts/views.d.ts +4 -0
- package/dist/src/execution/contracts/vocabulary.d.ts +5 -0
- package/dist/src/execution/contracts/vocabulary.js +4 -0
- package/dist/src/execution/contracts/workspace.d.ts +8 -0
- package/dist/src/execution/index.d.ts +2 -0
- package/dist/src/execution/index.js +2 -0
- package/dist/src/execution/infrastructure/workspace/git-source.d.ts +2 -2
- package/dist/src/execution/infrastructure/workspace/git-source.js +18 -1
- package/dist/src/execution/infrastructure/workspace/git-workspace.d.ts +2 -4
- package/dist/src/execution/infrastructure/workspace/git-workspace.js +12 -1
- 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/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/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/orchestration/application/delegated-work.d.ts +5 -0
- package/dist/src/orchestration/application/delegated-work.js +10 -0
- package/dist/src/orchestration/application/delegation-commands.d.ts +16 -0
- package/dist/src/orchestration/application/delivery-coordinator.d.ts +348 -0
- package/dist/src/orchestration/application/delivery-coordinator.js +239 -0
- package/dist/src/orchestration/application/delivery-facts-reader.d.ts +9 -0
- package/dist/src/orchestration/application/delivery-facts-reader.js +47 -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 +16 -0
- package/dist/src/orchestration/application/delivery-preparation.js +105 -0
- package/dist/src/orchestration/application/delivery-sources.d.ts +10 -0
- package/dist/src/orchestration/application/delivery-sources.js +41 -0
- package/dist/src/orchestration/application/orchestration-repository.d.ts +3 -1
- package/dist/src/orchestration/application/orchestration-repository.js +10 -1
- package/dist/src/orchestration/application/orchestration-service.d.ts +341 -2
- package/dist/src/orchestration/application/orchestration-service.js +86 -4
- package/dist/src/orchestration/contracts/config.d.ts +22 -0
- package/dist/src/orchestration/contracts/config.js +13 -1
- package/dist/src/orchestration/contracts/delegation-ports.d.ts +4 -0
- package/dist/src/orchestration/contracts/delegation.d.ts +13 -1
- package/dist/src/orchestration/contracts/delegation.js +5 -0
- package/dist/src/orchestration/contracts/delivery-ports.d.ts +53 -0
- package/dist/src/orchestration/contracts/delivery-ports.js +1 -0
- package/dist/src/orchestration/contracts/delivery.d.ts +310 -0
- package/dist/src/orchestration/contracts/delivery.js +186 -0
- package/dist/src/orchestration/contracts/event-decoder.js +14 -1
- package/dist/src/orchestration/contracts/event-factory.js +8 -0
- package/dist/src/orchestration/contracts/events.d.ts +10 -0
- package/dist/src/orchestration/contracts/events.js +4 -0
- package/dist/src/orchestration/contracts/views.d.ts +3 -0
- package/dist/src/orchestration/contracts/vocabulary.d.ts +90 -0
- package/dist/src/orchestration/contracts/vocabulary.js +82 -0
- 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/compiler.js +2 -0
- package/dist/src/orchestration/domain/delivery-candidate.d.ts +9 -0
- package/dist/src/orchestration/domain/delivery-candidate.js +105 -0
- package/dist/src/orchestration/domain/delivery-facts.d.ts +89 -0
- package/dist/src/orchestration/domain/delivery-facts.js +66 -0
- 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 +33 -0
- package/dist/src/orchestration/domain/delivery-qa.js +97 -0
- package/dist/src/orchestration/domain/delivery-replacement.d.ts +9 -0
- package/dist/src/orchestration/domain/delivery-replacement.js +54 -0
- package/dist/src/orchestration/domain/delivery-selection.d.ts +17 -0
- package/dist/src/orchestration/domain/delivery-selection.js +132 -0
- package/dist/src/orchestration/domain/delivery-workflow-policy.d.ts +6 -0
- package/dist/src/orchestration/domain/delivery-workflow-policy.js +32 -0
- package/dist/src/orchestration/domain/operator-retry-policy.js +24 -13
- package/dist/src/orchestration/domain/workflow-instance-events.d.ts +1 -0
- package/dist/src/orchestration/domain/workflow-instance-events.js +12 -0
- package/dist/src/orchestration/index.d.ts +3 -0
- package/dist/src/orchestration/index.js +1 -0
- package/dist/src/surfaces/api/contracts/transport-values.js +1 -0
- package/dist/src/surfaces/api/contracts/work.d.ts +42 -0
- package/dist/src/surfaces/api/presenters/execution.js +1 -0
- package/dist/src/surfaces/mcp/delegation.js +36 -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/surfaces/web-assets/assets/index-C5R-aWzH.js +0 -1192
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { AdapterId } from '../../contracts/identifiers.js';
|
|
2
2
|
import type { ExternalEventSource } from '../application/poll-service.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type GitHubPullRequestPayload } from '../contracts/payloads.js';
|
|
4
4
|
import type { PollBatch } from './poll-watermark.js';
|
|
5
|
-
|
|
5
|
+
import { type PullRequestEvidenceClient } from './pr-evidence.js';
|
|
6
|
+
export interface GitHubPullRequestSourceClient extends PullRequestEvidenceClient {
|
|
6
7
|
listPullRequests(owner: string, repo: string, maxResults: number): Promise<readonly GitHubPullRequestPayload[]>;
|
|
7
|
-
listCheckRunsForRef(owner: string, repo: string, ref: string, maxResults?: number): Promise<readonly GitHubCheckRunPayload[]>;
|
|
8
|
-
getCombinedStatusForRef(owner: string, repo: string, ref: string, maxResults?: number): Promise<readonly GitHubCommitStatusPayload[]>;
|
|
9
|
-
listPullRequestFiles(owner: string, repo: string, pullNumber: number, maxResults?: number): Promise<readonly string[]>;
|
|
10
8
|
}
|
|
11
9
|
interface GitHubPullRequestSourceInput {
|
|
12
10
|
readonly client: GitHubPullRequestSourceClient;
|
|
@@ -8,7 +8,8 @@ import { formatGitHubResourceKey } from '../contracts/external-key.js';
|
|
|
8
8
|
import { gitHubAssigneeLogins, gitHubLabelNames, } from '../contracts/payloads.js';
|
|
9
9
|
import { GitHubAdapter, GitHubCheckRunStatus, UnknownGitHubIdentity, UnknownGitHubRevision, } from '../contracts/vocabulary.js';
|
|
10
10
|
import { withoutWakeMarkers } from './content-fingerprint.js';
|
|
11
|
-
import {
|
|
11
|
+
import { verifiedCheckSubject } from './pr-check-subject.js';
|
|
12
|
+
import { readPullRequestEvidence, } from './pr-evidence.js';
|
|
12
13
|
export function createGitHubPullRequestSource(input) {
|
|
13
14
|
return {
|
|
14
15
|
async poll(signal) {
|
|
@@ -24,12 +25,14 @@ export async function pullRequestEventsFor(input, signal) {
|
|
|
24
25
|
signal.throwIfAborted();
|
|
25
26
|
const headRevision = fallback(pullRequest.head?.sha, pullRequest.updated_at);
|
|
26
27
|
const [evidence, changedFiles] = await readPullRequestEvidence(input.client, owner, repo, headRevision, pullRequest.number, input.maxResults);
|
|
28
|
+
const checkSubject = await verifiedCheckSubject(input.client, owner, repo, pullRequest, evidence);
|
|
27
29
|
return {
|
|
28
30
|
complete: evidence.complete && changedFiles.complete,
|
|
29
31
|
draft: pullRequestObservation({
|
|
30
32
|
repository: input.repository,
|
|
31
33
|
pullRequest,
|
|
32
34
|
evidence,
|
|
35
|
+
checkSubject,
|
|
33
36
|
changedFiles: changedFiles.files,
|
|
34
37
|
...(input.adapter === undefined ? {} : { adapter: input.adapter }),
|
|
35
38
|
}),
|
|
@@ -57,6 +60,7 @@ function pullRequestObservation(input) {
|
|
|
57
60
|
title: pullRequest.title,
|
|
58
61
|
body: fallback(pullRequest.body, ''),
|
|
59
62
|
state: pullRequestState(pullRequest),
|
|
63
|
+
...mergedRevision(pullRequest),
|
|
60
64
|
mergeability: pullRequest.mergeable === false
|
|
61
65
|
? PullRequestMergeability.Conflicting
|
|
62
66
|
: pullRequest.mergeable === true
|
|
@@ -66,6 +70,7 @@ function pullRequestObservation(input) {
|
|
|
66
70
|
headRevision: revision,
|
|
67
71
|
baseRevision: fallback(pullRequest.base?.sha, UnknownGitHubRevision),
|
|
68
72
|
checks,
|
|
73
|
+
...input.checkSubject,
|
|
69
74
|
actor: {
|
|
70
75
|
id: fallback(pullRequest.user?.login, UnknownGitHubIdentity),
|
|
71
76
|
kind: actorKind(pullRequest.user?.type),
|
|
@@ -198,3 +203,8 @@ const GitHubCommitStatusState = {
|
|
|
198
203
|
Pending: PullRequestCheckState.Pending,
|
|
199
204
|
Success: 'success',
|
|
200
205
|
};
|
|
206
|
+
function mergedRevision(pullRequest) {
|
|
207
|
+
return pullRequestState(pullRequest) === PullRequestState.Merged && pullRequest.merge_commit_sha
|
|
208
|
+
? { mergeRevision: pullRequest.merge_commit_sha }
|
|
209
|
+
: {};
|
|
210
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Octokit } from '@octokit/rest';
|
|
2
|
+
import type { GitHubWorkflowRunPayload } from '../contracts/payloads.js';
|
|
3
|
+
import { type createEtagCache } from './etag-cache.js';
|
|
4
|
+
/** Revalidate mutable run attempts; conditional requests reuse unchanged responses. */
|
|
5
|
+
export declare function workflowRunsForSuite(octokit: Octokit, cache: ReturnType<typeof createEtagCache>, owner: string, repo: string, suiteId: number): Promise<readonly GitHubWorkflowRunPayload[]>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { fetchWithEtag } from './etag-cache.js';
|
|
2
|
+
/** Revalidate mutable run attempts; conditional requests reuse unchanged responses. */
|
|
3
|
+
export function workflowRunsForSuite(octokit, cache, owner, repo, suiteId) {
|
|
4
|
+
return fetchWithEtag({
|
|
5
|
+
cache,
|
|
6
|
+
key: `workflow-run-suite:${owner}/${repo}@${suiteId}`,
|
|
7
|
+
request: async (headers) => {
|
|
8
|
+
const response = await octokit.rest.actions.listWorkflowRunsForRepo({
|
|
9
|
+
owner,
|
|
10
|
+
repo,
|
|
11
|
+
check_suite_id: suiteId,
|
|
12
|
+
event: 'pull_request',
|
|
13
|
+
per_page: 100,
|
|
14
|
+
...(headers === undefined ? {} : { headers }),
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
data: response.data.total_count >= 100 ? [] : response.data.workflow_runs,
|
|
18
|
+
...(response.headers.etag === undefined ? {} : { etag: response.headers.etag }),
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -33,3 +33,4 @@ export * from './fake/external-source.js';
|
|
|
33
33
|
export * from './fake/provider.js';
|
|
34
34
|
export * from './application/conversation-command-feedback.js';
|
|
35
35
|
export { createDelegationOutputs } from './application/delegation-outputs.js';
|
|
36
|
+
export * from './application/delivery-integration-verification.js';
|
|
@@ -33,3 +33,4 @@ export * from './fake/external-source.js';
|
|
|
33
33
|
export * from './fake/provider.js';
|
|
34
34
|
export * from './application/conversation-command-feedback.js';
|
|
35
35
|
export { createDelegationOutputs } from './application/delegation-outputs.js';
|
|
36
|
+
export * from './application/delivery-integration-verification.js';
|
|
@@ -100,6 +100,10 @@ export declare class DelegatedWork {
|
|
|
100
100
|
cohortId?: string | undefined;
|
|
101
101
|
useAsBase?: boolean | undefined;
|
|
102
102
|
}[] | undefined;
|
|
103
|
+
replaces?: {
|
|
104
|
+
cohortId: string;
|
|
105
|
+
assignmentId: string;
|
|
106
|
+
} | undefined;
|
|
103
107
|
repository?: {
|
|
104
108
|
resourceId: string;
|
|
105
109
|
sourceRef: string;
|
|
@@ -131,6 +135,7 @@ export declare class DelegatedWork {
|
|
|
131
135
|
contextWorkItems(parent: WorkflowInstanceView): Promise<ReadonlySet<string>>;
|
|
132
136
|
results(id: WorkflowInstanceId, cohortId: string): Promise<readonly DelegationResult[]>;
|
|
133
137
|
reserve(caller: DelegationCaller, cohortId: string, assignments: readonly DelegatedAssignment[], context: CommandContext, limits?: DelegationLimits, expectedPlanRevision?: number): Promise<DelegationReservation>;
|
|
138
|
+
private assertPinnedReplacements;
|
|
134
139
|
private pinAssignments;
|
|
135
140
|
reconcile(context: CommandContext): Promise<void>;
|
|
136
141
|
private capacityReservations;
|
|
@@ -8,12 +8,14 @@ import { OrchestrationEventType } from '../contracts/events.js';
|
|
|
8
8
|
import { orchestrationGroupId, workflowInstanceId, } from '../contracts/identifiers.js';
|
|
9
9
|
import { DelegationConflictCode, DelegationPrerequisiteCondition, WorkflowStatus, } from '../contracts/vocabulary.js';
|
|
10
10
|
import { nextOrdinal } from '../domain/decision-events.js';
|
|
11
|
+
import { assertCriteriaPreserving, originalOf } from '../domain/delivery-replacement.js';
|
|
11
12
|
import { isSuccessfulWorkflowCompletion } from '../domain/workflow-completion.js';
|
|
12
13
|
import { DelegationAttention, } from './delegation-attention.js';
|
|
13
14
|
import { delegationDraft, delegationEventId, DelegationLedger, isJoined, isSettled, reservationsOf, reservedEvent, selectedResults, unsettledReservations, } from './delegation-ledger.js';
|
|
14
15
|
import { DelegationPrerequisites } from './delegation-prerequisites.js';
|
|
15
16
|
import { assertWithinRootLimits, buildReservation, matchesAssignments, } from './delegation-reservation.js';
|
|
16
17
|
import { resolvePrerequisites } from './delegation-wait-graph.js';
|
|
18
|
+
import { readDeliveryFacts } from './delivery-facts-reader.js';
|
|
17
19
|
const defaultLimits = { maxDepth: 1, maxDescendants: 8 };
|
|
18
20
|
/**
|
|
19
21
|
* Durable delegation of independent child WorkItems. Reservation is the single commit point;
|
|
@@ -135,6 +137,7 @@ export class DelegatedWork {
|
|
|
135
137
|
return prior;
|
|
136
138
|
}
|
|
137
139
|
const pinned = await this.pinAssignments(parent, assignments);
|
|
140
|
+
await this.assertPinnedReplacements(parent, pinned);
|
|
138
141
|
let reservation = buildReservation(identity.parent, caller, cohortId, pinned, limits);
|
|
139
142
|
for (let attempt = 0; attempt < 8; attempt++) {
|
|
140
143
|
const { events: rootFacts, sequence } = await this.repository.history(identity.root);
|
|
@@ -171,6 +174,13 @@ export class DelegatedWork {
|
|
|
171
174
|
}
|
|
172
175
|
throw new Error('Delegation reservation contention exceeded retry limit');
|
|
173
176
|
}
|
|
177
|
+
async assertPinnedReplacements(parent, pinned) {
|
|
178
|
+
const replacementFacts = await readDeliveryFacts(this.repository, parent, (await this.repository.history(parent.workflowInstanceId)).events);
|
|
179
|
+
for (const assignment of pinned) {
|
|
180
|
+
if (assignment.replaces !== undefined)
|
|
181
|
+
assertCriteriaPreserving(replacementFacts, originalOf(replacementFacts, assignment.replaces), assignment);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
174
184
|
async pinAssignments(parent, assignments) {
|
|
175
185
|
return Promise.all(assignments.map(async (assignment) => {
|
|
176
186
|
if (assignment.repository === undefined)
|
|
@@ -56,6 +56,10 @@ export declare class DelegationCommands {
|
|
|
56
56
|
cohortId?: string | undefined;
|
|
57
57
|
useAsBase?: boolean | undefined;
|
|
58
58
|
}[] | undefined;
|
|
59
|
+
replaces?: {
|
|
60
|
+
cohortId: string;
|
|
61
|
+
assignmentId: string;
|
|
62
|
+
} | undefined;
|
|
59
63
|
repository?: {
|
|
60
64
|
resourceId: string;
|
|
61
65
|
sourceRef: string;
|
|
@@ -77,6 +81,14 @@ export declare class DelegationCommands {
|
|
|
77
81
|
maxDescendants: number;
|
|
78
82
|
maxConcurrentRuns: number;
|
|
79
83
|
repositories?: string[] | undefined;
|
|
84
|
+
completion?: "qa-approved" | "merge-required" | undefined;
|
|
85
|
+
qa?: {
|
|
86
|
+
stage: string;
|
|
87
|
+
recipe?: string | undefined;
|
|
88
|
+
} | undefined;
|
|
89
|
+
maintenance?: {
|
|
90
|
+
stage: string;
|
|
91
|
+
} | undefined;
|
|
80
92
|
} | null;
|
|
81
93
|
repositories: string[];
|
|
82
94
|
planRevision: number;
|
|
@@ -143,6 +155,10 @@ export declare class DelegationCommands {
|
|
|
143
155
|
cohortId?: string | undefined;
|
|
144
156
|
useAsBase?: boolean | undefined;
|
|
145
157
|
}[] | undefined;
|
|
158
|
+
replaces?: {
|
|
159
|
+
cohortId: string;
|
|
160
|
+
assignmentId: string;
|
|
161
|
+
} | undefined;
|
|
146
162
|
repository?: {
|
|
147
163
|
resourceId: string;
|
|
148
164
|
sourceRef: string;
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { type CommandContext } from '@atolis-hq/eventing';
|
|
2
|
+
import type { ParentActionRequest } from '../../activities/index.js';
|
|
3
|
+
import { type DelegationCaller } from '../contracts/delegation.js';
|
|
4
|
+
import type { DeliveryDependencies } from '../contracts/delivery-ports.js';
|
|
5
|
+
import { type DeliveryCandidate, type DeliveryCandidateCommand, type DeliveryMaintenanceCommand, type DeliveryQa, type DeliveryQaCommand, type DeliverySelectionCommand } from '../contracts/delivery.js';
|
|
6
|
+
import type { OrchestrationRepository } from './orchestration-repository.js';
|
|
7
|
+
/**
|
|
8
|
+
* Agent-led parent QA over the delegated delivery. The parent agent chooses what to select,
|
|
9
|
+
* assemble, test and repair; Wake only records those choices against exact outputs and revisions,
|
|
10
|
+
* rejects anything that would waive a requirement or vouch for different code, and reports what
|
|
11
|
+
* is stale, blocked or exhausted. Every fact lives in the parent's journal stream.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DeliveryCoordinator {
|
|
14
|
+
private readonly repository;
|
|
15
|
+
private readonly dependencies;
|
|
16
|
+
private readonly preparation;
|
|
17
|
+
private readonly integration;
|
|
18
|
+
constructor(repository: OrchestrationRepository, dependencies: DeliveryDependencies);
|
|
19
|
+
authorizeParentAction(request: ParentActionRequest): Promise<import("../../activities/index.js").ParentActionDecision>;
|
|
20
|
+
/** The targets the configured maintenance stage will lease, or undefined for other stages. */
|
|
21
|
+
maintenanceTargets(id: string): Promise<import("../domain/delivery-integration.js").IntegrationTarget[] | undefined>;
|
|
22
|
+
/** Records what the maintaining agent actually produced as a new immutable subject. */
|
|
23
|
+
recordMaintenance(caller: DelegationCaller, input: DeliveryMaintenanceCommand, context: CommandContext): Promise<{
|
|
24
|
+
readonly maintenance: import("../contracts/delivery.js").DeliveryMaintenance;
|
|
25
|
+
readonly replay: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
select(caller: DelegationCaller, input: DeliverySelectionCommand, context: CommandContext): Promise<{
|
|
28
|
+
selection: {
|
|
29
|
+
requestId: string;
|
|
30
|
+
revision: number;
|
|
31
|
+
entries: {
|
|
32
|
+
cohortId: string;
|
|
33
|
+
assignmentId: string;
|
|
34
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
35
|
+
output: {
|
|
36
|
+
name: string;
|
|
37
|
+
reference: {
|
|
38
|
+
workItemId: import("../../work/index.js").WorkItemId;
|
|
39
|
+
revisionId: string;
|
|
40
|
+
} | {
|
|
41
|
+
workItemId: import("../../work/index.js").WorkItemId;
|
|
42
|
+
resourceId: string;
|
|
43
|
+
repositoryResourceId: string;
|
|
44
|
+
revision: string;
|
|
45
|
+
branch: string;
|
|
46
|
+
pullRequestBase: string;
|
|
47
|
+
runId: string;
|
|
48
|
+
baseRevision?: string | undefined;
|
|
49
|
+
merged?: true | undefined;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
replaces?: {
|
|
53
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
54
|
+
outputName: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
}[];
|
|
57
|
+
};
|
|
58
|
+
replay: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
recordCandidate(caller: DelegationCaller, input: DeliveryCandidateCommand, context: CommandContext): Promise<{
|
|
61
|
+
candidate: {
|
|
62
|
+
candidateId: string;
|
|
63
|
+
selectionRevision: number;
|
|
64
|
+
repositories: {
|
|
65
|
+
resourceId: string;
|
|
66
|
+
revision: string;
|
|
67
|
+
pullRequestBase: string;
|
|
68
|
+
source: {
|
|
69
|
+
kind: "output";
|
|
70
|
+
tip: {
|
|
71
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
72
|
+
outputName: string;
|
|
73
|
+
};
|
|
74
|
+
} | {
|
|
75
|
+
kind: "retained-ref";
|
|
76
|
+
ref: string;
|
|
77
|
+
};
|
|
78
|
+
contributions: {
|
|
79
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
80
|
+
outputName: string;
|
|
81
|
+
}[];
|
|
82
|
+
}[];
|
|
83
|
+
context: {
|
|
84
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
85
|
+
outputName: string;
|
|
86
|
+
}[];
|
|
87
|
+
criteria: string[];
|
|
88
|
+
subjects?: {
|
|
89
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
90
|
+
outputName: string;
|
|
91
|
+
revision: string;
|
|
92
|
+
pullRequestBase: string;
|
|
93
|
+
baseRevision?: string | undefined;
|
|
94
|
+
}[] | undefined;
|
|
95
|
+
recipe?: string | undefined;
|
|
96
|
+
};
|
|
97
|
+
replay: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
recordQa(caller: DelegationCaller, input: DeliveryQaCommand, context: CommandContext): Promise<{
|
|
100
|
+
qa: {
|
|
101
|
+
qaId: string;
|
|
102
|
+
candidateId: string;
|
|
103
|
+
verdict: "blocked" | "pass" | "fail";
|
|
104
|
+
revisions: {
|
|
105
|
+
resourceId: string;
|
|
106
|
+
revision: string;
|
|
107
|
+
}[];
|
|
108
|
+
environment: {
|
|
109
|
+
available: boolean;
|
|
110
|
+
recipe?: string | undefined;
|
|
111
|
+
};
|
|
112
|
+
findings: string[];
|
|
113
|
+
evidence?: {
|
|
114
|
+
workItemId: import("../../work/index.js").WorkItemId;
|
|
115
|
+
revisionId: string;
|
|
116
|
+
}[] | undefined;
|
|
117
|
+
exhausted?: boolean | undefined;
|
|
118
|
+
runId?: string | undefined;
|
|
119
|
+
activationId?: string | undefined;
|
|
120
|
+
};
|
|
121
|
+
replay: boolean;
|
|
122
|
+
}>;
|
|
123
|
+
/** The inspectable delivery state: selection, staleness, candidate, QA, repair and completion. */
|
|
124
|
+
inspectFor(caller: DelegationCaller): Promise<{
|
|
125
|
+
integration: import("../domain/delivery-integration.js").IntegrationAssessment | null;
|
|
126
|
+
maintenance: readonly {
|
|
127
|
+
maintenanceId: string;
|
|
128
|
+
target: {
|
|
129
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
130
|
+
outputName: string;
|
|
131
|
+
};
|
|
132
|
+
kind: "rebase" | "retarget" | "resolve-conflicts";
|
|
133
|
+
resourceId: string;
|
|
134
|
+
repositoryResourceId: string;
|
|
135
|
+
previous: {
|
|
136
|
+
revision: string;
|
|
137
|
+
pullRequestBase: string;
|
|
138
|
+
baseRevision?: string | undefined;
|
|
139
|
+
};
|
|
140
|
+
current: {
|
|
141
|
+
revision: string;
|
|
142
|
+
pullRequestBase: string;
|
|
143
|
+
baseRevision?: string | undefined;
|
|
144
|
+
};
|
|
145
|
+
producer: {
|
|
146
|
+
runId: string;
|
|
147
|
+
activationId: string;
|
|
148
|
+
};
|
|
149
|
+
recordedAt?: string | undefined;
|
|
150
|
+
}[];
|
|
151
|
+
required: {
|
|
152
|
+
cohortId: string;
|
|
153
|
+
assignmentId: string;
|
|
154
|
+
outputName: string;
|
|
155
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
156
|
+
}[];
|
|
157
|
+
selection: {
|
|
158
|
+
requestId: string;
|
|
159
|
+
revision: number;
|
|
160
|
+
entries: {
|
|
161
|
+
cohortId: string;
|
|
162
|
+
assignmentId: string;
|
|
163
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
164
|
+
output: {
|
|
165
|
+
name: string;
|
|
166
|
+
reference: {
|
|
167
|
+
workItemId: import("../../work/index.js").WorkItemId;
|
|
168
|
+
revisionId: string;
|
|
169
|
+
} | {
|
|
170
|
+
workItemId: import("../../work/index.js").WorkItemId;
|
|
171
|
+
resourceId: string;
|
|
172
|
+
repositoryResourceId: string;
|
|
173
|
+
revision: string;
|
|
174
|
+
branch: string;
|
|
175
|
+
pullRequestBase: string;
|
|
176
|
+
runId: string;
|
|
177
|
+
baseRevision?: string | undefined;
|
|
178
|
+
merged?: true | undefined;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
replaces?: {
|
|
182
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
183
|
+
outputName: string;
|
|
184
|
+
} | undefined;
|
|
185
|
+
}[];
|
|
186
|
+
} | null;
|
|
187
|
+
history: readonly {
|
|
188
|
+
qaId: string;
|
|
189
|
+
candidateId: string;
|
|
190
|
+
verdict: "blocked" | "pass" | "fail";
|
|
191
|
+
revisions: {
|
|
192
|
+
resourceId: string;
|
|
193
|
+
revision: string;
|
|
194
|
+
}[];
|
|
195
|
+
environment: {
|
|
196
|
+
available: boolean;
|
|
197
|
+
recipe?: string | undefined;
|
|
198
|
+
};
|
|
199
|
+
findings: string[];
|
|
200
|
+
evidence?: {
|
|
201
|
+
workItemId: import("../../work/index.js").WorkItemId;
|
|
202
|
+
revisionId: string;
|
|
203
|
+
}[] | undefined;
|
|
204
|
+
exhausted?: boolean | undefined;
|
|
205
|
+
runId?: string | undefined;
|
|
206
|
+
activationId?: string | undefined;
|
|
207
|
+
}[];
|
|
208
|
+
completion: import("../domain/delivery-qa.js").CompletionDecision;
|
|
209
|
+
selectionRevision: number;
|
|
210
|
+
stale: readonly string[];
|
|
211
|
+
candidate: DeliveryCandidate | null;
|
|
212
|
+
candidateCurrent: boolean;
|
|
213
|
+
qa: DeliveryQa | null;
|
|
214
|
+
qaEffective: boolean;
|
|
215
|
+
repair: {
|
|
216
|
+
readonly failedRounds: number;
|
|
217
|
+
readonly exhausted: boolean;
|
|
218
|
+
readonly unresolvedFindings: readonly string[];
|
|
219
|
+
};
|
|
220
|
+
}>;
|
|
221
|
+
inspect(id: string): Promise<{
|
|
222
|
+
integration: import("../domain/delivery-integration.js").IntegrationAssessment | null;
|
|
223
|
+
maintenance: readonly {
|
|
224
|
+
maintenanceId: string;
|
|
225
|
+
target: {
|
|
226
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
227
|
+
outputName: string;
|
|
228
|
+
};
|
|
229
|
+
kind: "rebase" | "retarget" | "resolve-conflicts";
|
|
230
|
+
resourceId: string;
|
|
231
|
+
repositoryResourceId: string;
|
|
232
|
+
previous: {
|
|
233
|
+
revision: string;
|
|
234
|
+
pullRequestBase: string;
|
|
235
|
+
baseRevision?: string | undefined;
|
|
236
|
+
};
|
|
237
|
+
current: {
|
|
238
|
+
revision: string;
|
|
239
|
+
pullRequestBase: string;
|
|
240
|
+
baseRevision?: string | undefined;
|
|
241
|
+
};
|
|
242
|
+
producer: {
|
|
243
|
+
runId: string;
|
|
244
|
+
activationId: string;
|
|
245
|
+
};
|
|
246
|
+
recordedAt?: string | undefined;
|
|
247
|
+
}[];
|
|
248
|
+
required: {
|
|
249
|
+
cohortId: string;
|
|
250
|
+
assignmentId: string;
|
|
251
|
+
outputName: string;
|
|
252
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
253
|
+
}[];
|
|
254
|
+
selection: {
|
|
255
|
+
requestId: string;
|
|
256
|
+
revision: number;
|
|
257
|
+
entries: {
|
|
258
|
+
cohortId: string;
|
|
259
|
+
assignmentId: string;
|
|
260
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
261
|
+
output: {
|
|
262
|
+
name: string;
|
|
263
|
+
reference: {
|
|
264
|
+
workItemId: import("../../work/index.js").WorkItemId;
|
|
265
|
+
revisionId: string;
|
|
266
|
+
} | {
|
|
267
|
+
workItemId: import("../../work/index.js").WorkItemId;
|
|
268
|
+
resourceId: string;
|
|
269
|
+
repositoryResourceId: string;
|
|
270
|
+
revision: string;
|
|
271
|
+
branch: string;
|
|
272
|
+
pullRequestBase: string;
|
|
273
|
+
runId: string;
|
|
274
|
+
baseRevision?: string | undefined;
|
|
275
|
+
merged?: true | undefined;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
replaces?: {
|
|
279
|
+
childWorkItemId: import("../../work/index.js").WorkItemId;
|
|
280
|
+
outputName: string;
|
|
281
|
+
} | undefined;
|
|
282
|
+
}[];
|
|
283
|
+
} | null;
|
|
284
|
+
history: readonly {
|
|
285
|
+
qaId: string;
|
|
286
|
+
candidateId: string;
|
|
287
|
+
verdict: "blocked" | "pass" | "fail";
|
|
288
|
+
revisions: {
|
|
289
|
+
resourceId: string;
|
|
290
|
+
revision: string;
|
|
291
|
+
}[];
|
|
292
|
+
environment: {
|
|
293
|
+
available: boolean;
|
|
294
|
+
recipe?: string | undefined;
|
|
295
|
+
};
|
|
296
|
+
findings: string[];
|
|
297
|
+
evidence?: {
|
|
298
|
+
workItemId: import("../../work/index.js").WorkItemId;
|
|
299
|
+
revisionId: string;
|
|
300
|
+
}[] | undefined;
|
|
301
|
+
exhausted?: boolean | undefined;
|
|
302
|
+
runId?: string | undefined;
|
|
303
|
+
activationId?: string | undefined;
|
|
304
|
+
}[];
|
|
305
|
+
completion: import("../domain/delivery-qa.js").CompletionDecision;
|
|
306
|
+
selectionRevision: number;
|
|
307
|
+
stale: readonly string[];
|
|
308
|
+
candidate: DeliveryCandidate | null;
|
|
309
|
+
candidateCurrent: boolean;
|
|
310
|
+
qa: DeliveryQa | null;
|
|
311
|
+
qaEffective: boolean;
|
|
312
|
+
repair: {
|
|
313
|
+
readonly failedRounds: number;
|
|
314
|
+
readonly exhausted: boolean;
|
|
315
|
+
readonly unresolvedFindings: readonly string[];
|
|
316
|
+
};
|
|
317
|
+
}>;
|
|
318
|
+
/**
|
|
319
|
+
* Replacement children keep the original acceptance criteria and repository; a terminal original
|
|
320
|
+
* is replaced by a new child, while correcting a still-running one is not supported.
|
|
321
|
+
*/
|
|
322
|
+
assertReplacements(caller: DelegationCaller, input: unknown): Promise<void>;
|
|
323
|
+
completionBlock(id: string): Promise<import("../contracts/delivery.js").DeliveryCompletionBlock | undefined>;
|
|
324
|
+
prepare(id: string): Promise<{
|
|
325
|
+
candidateId: string;
|
|
326
|
+
selectionRevision: number;
|
|
327
|
+
criteria: string[];
|
|
328
|
+
inputs: {
|
|
329
|
+
workItemId: string;
|
|
330
|
+
outputName: string;
|
|
331
|
+
revision: string;
|
|
332
|
+
}[];
|
|
333
|
+
repositories: {
|
|
334
|
+
resourceId: string;
|
|
335
|
+
sourceRef: string;
|
|
336
|
+
sourceRevision: string;
|
|
337
|
+
pullRequestBase: string;
|
|
338
|
+
requiredSourceRef?: string | undefined;
|
|
339
|
+
}[];
|
|
340
|
+
recipe?: string | undefined;
|
|
341
|
+
} | undefined>;
|
|
342
|
+
private assertQaActor;
|
|
343
|
+
private assertCoordinatorStage;
|
|
344
|
+
private parent;
|
|
345
|
+
private facts;
|
|
346
|
+
/** Re-derives facts from fresh history on every optimistic-concurrency retry. */
|
|
347
|
+
private commit;
|
|
348
|
+
}
|