@atolis-hq/wake 0.4.109 → 0.4.111
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/bootstrap/analytics-reports.d.ts +2 -0
- package/dist/src/bootstrap/analytics-reports.js +14 -4
- package/dist/src/bootstrap/board-projection.d.ts +4 -0
- package/dist/src/bootstrap/board-projection.js +33 -19
- package/dist/src/bootstrap/composition-root.d.ts +3 -1
- package/dist/src/bootstrap/composition-root.js +21 -6
- package/dist/src/bootstrap/delegated-artifact-context.d.ts +15 -0
- package/dist/src/bootstrap/delegated-artifact-context.js +17 -0
- package/dist/src/bootstrap/initialise.js +20 -2
- package/dist/src/bootstrap/integration-runtime.js +1 -0
- package/dist/src/bootstrap/objective-title-context.d.ts +7 -0
- package/dist/src/bootstrap/objective-title-context.js +15 -0
- package/dist/src/bootstrap/surface-api-delivery.js +148 -56
- package/dist/src/bootstrap/surface-api-work-applications.js +39 -5
- package/dist/src/bootstrap/surface-api-workflow-diagrams.js +8 -4
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/conversations/application/control-plane-entry.d.ts +14 -0
- package/dist/src/conversations/application/control-plane-entry.js +16 -0
- package/dist/src/conversations/index.d.ts +1 -0
- package/dist/src/conversations/index.js +1 -0
- package/dist/src/integrations/application/agent-run-publication-reactor.d.ts +2 -1
- package/dist/src/integrations/application/agent-run-publication-reactor.js +6 -17
- package/dist/src/integrations/application/agent-run-publication-target.d.ts +12 -0
- package/dist/src/integrations/application/agent-run-publication-target.js +31 -0
- package/dist/src/integrations/application/artifact-registration-reactor.js +4 -2
- package/dist/src/integrations/contracts/provider.d.ts +5 -0
- package/dist/src/integrations/github/application/inbound-translator.d.ts +7 -0
- package/dist/src/integrations/github/application/inbound-translator.js +46 -0
- package/dist/src/integrations/github/provider.js +1 -0
- package/dist/src/orchestration/application/conversation-command-reactor.js +6 -25
- package/dist/src/orchestration/application/delegated-work.d.ts +12 -2
- package/dist/src/orchestration/application/delegated-work.js +30 -3
- package/dist/src/orchestration/application/delegation-attention-state.d.ts +2 -0
- package/dist/src/orchestration/application/delegation-attention-state.js +11 -1
- package/dist/src/orchestration/application/delegation-attention.d.ts +9 -11
- package/dist/src/orchestration/application/delegation-attention.js +42 -23
- package/dist/src/orchestration/application/delivery-activity-report.d.ts +13 -0
- package/dist/src/orchestration/application/delivery-activity-report.js +127 -0
- package/dist/src/orchestration/application/orchestration-service.d.ts +11 -4
- package/dist/src/orchestration/application/orchestration-service.js +22 -16
- package/dist/src/orchestration/application/prerequisite-readiness.d.ts +8 -0
- package/dist/src/orchestration/application/prerequisite-readiness.js +35 -0
- package/dist/src/orchestration/application/work-completion-summary.d.ts +10 -1
- package/dist/src/orchestration/application/work-completion-summary.js +8 -4
- package/dist/src/orchestration/contracts/delegation-ports.d.ts +16 -0
- package/dist/src/orchestration/contracts/delegation.d.ts +6 -4
- package/dist/src/orchestration/contracts/delegation.js +13 -3
- package/dist/src/orchestration/contracts/vocabulary.d.ts +1 -0
- package/dist/src/orchestration/contracts/vocabulary.js +1 -0
- package/dist/src/orchestration/domain/delegated-brief.d.ts +8 -0
- package/dist/src/orchestration/domain/delegated-brief.js +35 -0
- package/dist/src/orchestration/index.d.ts +2 -1
- package/dist/src/orchestration/index.js +1 -0
- package/dist/src/resources/contracts/events.js +1 -0
- package/dist/src/resources/contracts/vocabulary.d.ts +2 -0
- package/dist/src/resources/contracts/vocabulary.js +2 -0
- package/dist/src/surfaces/api/contracts/board.d.ts +4 -0
- package/dist/src/surfaces/api/contracts/observability.d.ts +2 -0
- package/dist/src/surfaces/api/contracts/work.d.ts +59 -0
- package/dist/src/surfaces/mcp/delegation.js +2 -2
- package/dist/src/surfaces/web-assets/assets/index-CHhBIiQQ.js +1192 -0
- package/dist/src/surfaces/web-assets/assets/index-DKNzCDQl.css +1 -0
- package/dist/src/surfaces/web-assets/index.html +2 -2
- package/docker/Dockerfile.runtime +10 -1
- package/docker/Dockerfile.runtime.packaged +10 -1
- package/package.json +1 -1
- package/dist/src/orchestration/application/delegation-attention-escalations.d.ts +0 -11
- package/dist/src/orchestration/application/delegation-attention-escalations.js +0 -36
- package/dist/src/surfaces/web-assets/assets/index-EVgZ9q9N.css +0 -1
- package/dist/src/surfaces/web-assets/assets/index-ih1h3dxC.js +0 -1192
|
@@ -12,6 +12,8 @@ export declare function createAnalyticsReports(journal: EventJournal, now: () =>
|
|
|
12
12
|
}>;
|
|
13
13
|
summary(windowId: ReportWindowId, signal?: AbortSignal): Promise<{
|
|
14
14
|
data: {
|
|
15
|
+
acceptedChildResults: number;
|
|
16
|
+
correctiveActivations: number;
|
|
15
17
|
workItemsDone: number;
|
|
16
18
|
medianEndToEndDurationMs: number | null;
|
|
17
19
|
runs: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRunBreakdownReport, createRunDurationReport, createRunOutcomesReport, createRunUsageReport, queryRunAnalytics, } from '../execution/index.js';
|
|
2
2
|
import { reportWindow } from '../kernel/index.js';
|
|
3
|
-
import { createWorkThroughputReport, queryWorkCompletionSummary } from '../orchestration/index.js';
|
|
3
|
+
import { DeliveryActivityMeasure, createDeliveryActivityReport, createWorkThroughputReport, queryDeliveryActivity, queryWorkCompletionSummary, readCompletionFacts, } from '../orchestration/index.js';
|
|
4
4
|
import { createRunRepositoryLookup } from './run-repository-lookup.js';
|
|
5
5
|
import { sampledMeta } from './surface-api-metadata.js';
|
|
6
6
|
export function createAnalyticsReports(journal, now, resolveIdentity) {
|
|
@@ -9,6 +9,7 @@ export function createAnalyticsReports(journal, now, resolveIdentity) {
|
|
|
9
9
|
createRunBreakdownReport(journal, createRunRepositoryLookup(journal, resolveIdentity)),
|
|
10
10
|
createRunUsageReport(journal),
|
|
11
11
|
createWorkThroughputReport(journal),
|
|
12
|
+
createDeliveryActivityReport(journal),
|
|
12
13
|
createRunDurationReport(journal),
|
|
13
14
|
];
|
|
14
15
|
return {
|
|
@@ -32,12 +33,21 @@ export function createAnalyticsReports(journal, now, resolveIdentity) {
|
|
|
32
33
|
window: reportWindow(windowId, collectedAt),
|
|
33
34
|
...(signal === undefined ? {} : { signal }),
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
+
// Root completion facts are read once and shared by both work-derived summaries.
|
|
37
|
+
const completion = await readCompletionFacts(journal, query);
|
|
38
|
+
const [runs, work, delivery] = await Promise.all([
|
|
36
39
|
queryRunAnalytics(journal, query),
|
|
37
|
-
queryWorkCompletionSummary(journal, query),
|
|
40
|
+
queryWorkCompletionSummary(journal, query, completion),
|
|
41
|
+
queryDeliveryActivity(journal, query, completion),
|
|
38
42
|
]);
|
|
39
43
|
return {
|
|
40
|
-
data: {
|
|
44
|
+
data: {
|
|
45
|
+
window: query.window,
|
|
46
|
+
...runs.summary,
|
|
47
|
+
...work,
|
|
48
|
+
acceptedChildResults: delivery.totals[DeliveryActivityMeasure.AcceptedChildResults] ?? 0,
|
|
49
|
+
correctiveActivations: delivery.totals[DeliveryActivityMeasure.CorrectiveActivations] ?? 0,
|
|
50
|
+
},
|
|
41
51
|
meta: sampledMeta(collectedAt),
|
|
42
52
|
};
|
|
43
53
|
},
|
|
@@ -34,6 +34,10 @@ interface StoredCard {
|
|
|
34
34
|
readonly blockReason?: string;
|
|
35
35
|
readonly dwellSince: string;
|
|
36
36
|
readonly runCount: number;
|
|
37
|
+
/** Set on delegated children; present only for work created after delegation existed. */
|
|
38
|
+
readonly parentWorkItemKey?: string;
|
|
39
|
+
/** Delegated children created under this card's work item. */
|
|
40
|
+
readonly childCount?: number;
|
|
37
41
|
readonly activeRuns: Readonly<Record<string, StoredActiveRun>>;
|
|
38
42
|
readonly activeRun?: StoredActiveRun;
|
|
39
43
|
readonly lastRunAt?: string;
|
|
@@ -51,28 +51,42 @@ export function boardConditionCounts(view) {
|
|
|
51
51
|
return counts;
|
|
52
52
|
}, {});
|
|
53
53
|
}
|
|
54
|
+
function projectItemCreated(view, id, payload, occurredAt) {
|
|
55
|
+
const parentId = payload.delegation?.parentWorkItemId;
|
|
56
|
+
const parent = parentId === undefined ? undefined : view.cards[parentId];
|
|
57
|
+
const card = {
|
|
58
|
+
workItemKey: toWorkItemKey(id),
|
|
59
|
+
workItemId: id,
|
|
60
|
+
objective: payload.objective,
|
|
61
|
+
condition: BoardCondition.Ready,
|
|
62
|
+
dwellSince: occurredAt,
|
|
63
|
+
runCount: 0,
|
|
64
|
+
activeRuns: {},
|
|
65
|
+
totalTokens: 0,
|
|
66
|
+
inputTokens: 0,
|
|
67
|
+
outputTokens: 0,
|
|
68
|
+
cacheReadTokens: 0,
|
|
69
|
+
cacheWriteTokens: 0,
|
|
70
|
+
totalCostUsd: 0,
|
|
71
|
+
totalDurationMs: 0,
|
|
72
|
+
...(parentId === undefined ? {} : { parentWorkItemKey: toWorkItemKey(parentId) }),
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
...view,
|
|
76
|
+
cards: {
|
|
77
|
+
...view.cards,
|
|
78
|
+
[id]: card,
|
|
79
|
+
...(parent === undefined
|
|
80
|
+
? {}
|
|
81
|
+
: { [parent.workItemId]: { ...parent, childCount: (parent.childCount ?? 0) + 1 } }),
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
}
|
|
54
85
|
function projectWork(view, event, occurredAt) {
|
|
55
86
|
const id = event.stream.id;
|
|
56
87
|
const data = event.event;
|
|
57
|
-
if (data.eventType === WorkEventType.ItemCreated)
|
|
58
|
-
|
|
59
|
-
workItemKey: toWorkItemKey(id),
|
|
60
|
-
workItemId: id,
|
|
61
|
-
objective: data.payload.objective,
|
|
62
|
-
condition: BoardCondition.Ready,
|
|
63
|
-
dwellSince: occurredAt,
|
|
64
|
-
runCount: 0,
|
|
65
|
-
activeRuns: {},
|
|
66
|
-
totalTokens: 0,
|
|
67
|
-
inputTokens: 0,
|
|
68
|
-
outputTokens: 0,
|
|
69
|
-
cacheReadTokens: 0,
|
|
70
|
-
cacheWriteTokens: 0,
|
|
71
|
-
totalCostUsd: 0,
|
|
72
|
-
totalDurationMs: 0,
|
|
73
|
-
};
|
|
74
|
-
return { ...view, cards: { ...view.cards, [id]: card } };
|
|
75
|
-
}
|
|
88
|
+
if (data.eventType === WorkEventType.ItemCreated)
|
|
89
|
+
return projectItemCreated(view, id, data.payload, occurredAt);
|
|
76
90
|
const current = view.cards[id];
|
|
77
91
|
if (current === undefined)
|
|
78
92
|
return view;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CheckpointStore, type EventJournal, type ProcessorRunSerialiser, type ProcessorStateStore, type ProjectionStore } from '@atolis-hq/eventing';
|
|
2
2
|
import { createPullRequestService, type ActivityRegistry } from '../activities/index.js';
|
|
3
|
-
import { OperatorInstructionsService, createArtifactService } from '../artifacts/index.js';
|
|
3
|
+
import { ArtifactContextService, OperatorInstructionsService, createArtifactService } from '../artifacts/index.js';
|
|
4
4
|
import { createControlPlaneService, createRunnerControlService, type ActivationScheduler, type ActivationSchedulerSubscriber, type IntakePipeline, type RunnerPipeline, type TriggerCheckpointStore, type TriggerConfig, type TriggerService } from '../control-plane/index.js';
|
|
5
5
|
import { createConversationService } from '../conversations/index.js';
|
|
6
6
|
import { GitWorkspaceProvider, RecoveryService, TranscriptStore, createExecutionService, type FakeScenarioResolver, type RepositoryCloneResolver, type Runner } from '../execution/index.js';
|
|
@@ -55,6 +55,7 @@ export interface CompositionRoot {
|
|
|
55
55
|
readonly activities: ActivityRegistry;
|
|
56
56
|
readonly work: ReturnType<typeof createWorkService>;
|
|
57
57
|
readonly artifacts: ReturnType<typeof createArtifactService>;
|
|
58
|
+
readonly artifactContexts: ArtifactContextService;
|
|
58
59
|
readonly operatorInstructions: OperatorInstructionsService;
|
|
59
60
|
readonly conversations: ReturnType<typeof createConversationService>;
|
|
60
61
|
readonly resources: ReturnType<typeof createResourceService>;
|
|
@@ -105,6 +106,7 @@ export declare function createDiagnosticRoot(wakeRoot: string): Promise<{
|
|
|
105
106
|
subscriptionRunSerialiser: ProcessorRunSerialiser;
|
|
106
107
|
work: import("../work/index.js").WorkService;
|
|
107
108
|
artifacts: import("../artifacts/index.js").ArtifactService;
|
|
109
|
+
artifactContexts: ArtifactContextService;
|
|
108
110
|
operatorInstructions: OperatorInstructionsService;
|
|
109
111
|
conversations: import("../conversations/index.js").ConversationService;
|
|
110
112
|
resources: import("../resources/index.js").ResourceService;
|
|
@@ -2,24 +2,26 @@ import { acquireFileLock } from '@atolis-hq/eventing-filesystem';
|
|
|
2
2
|
import { createPullRequestService } from '../activities/index.js';
|
|
3
3
|
import { ArtifactContextService, FileArtifactMcpSessionStore, FileArtifactStore, OperatorInstructionsService, createArtifactService, createDelegationArtifacts, } from '../artifacts/index.js';
|
|
4
4
|
import { DispatchPolicy, createActivationScheduler, createActivationSchedulerSubscriber, createControlPlaneService, createDurableRunnerIneligibility, createRunnerControlService, } from '../control-plane/index.js';
|
|
5
|
-
import { createConversationService } from '../conversations/index.js';
|
|
5
|
+
import { createConversationService, postControlPlaneEntry } from '../conversations/index.js';
|
|
6
6
|
import { ExecutionCancellationReason, GitWorkspaceProvider, RecoveryService, RunStatus, TranscriptStore, createExecutionService, createLocalProcessInspector, createRepositoryAssignments, createRunnerMemoryProfileDecorator, isActiveRunStatus, resolveGitSource, } from '../execution/index.js';
|
|
7
7
|
import { createGitHubAgentContextReader, gitHubProviderDefinition, gitHubRepositoryIdentity, resolveGitHubResourceUrl, } from '../integrations/github/index.js';
|
|
8
8
|
import { createDelegationOutputs, createDeliveryIntegrationVerification, } from '../integrations/index.js';
|
|
9
9
|
import { SystemClock, UlidIdGenerator } from '../kernel/index.js';
|
|
10
10
|
import { compileWorkflow, createAgentActivityClassifier, createOrchestrationService, } from '../orchestration/index.js';
|
|
11
|
-
import { createResourceLookup, createResourceService, resourceId, } from '../resources/index.js';
|
|
11
|
+
import { ResourceCorrelationProvenance, ResourceCorrelationRole, createResourceLookup, createResourceService, resourceId, } from '../resources/index.js';
|
|
12
12
|
import { createWorkService } from '../work/index.js';
|
|
13
13
|
import { createFileActivationSchedulerSerialiser } from './activation-scheduler-serialiser.js';
|
|
14
14
|
import { createBuiltInActivityRegistry } from './activity-registry.js';
|
|
15
15
|
import { createArtifactMcpProvisioner } from './artifact-mcp.js';
|
|
16
16
|
import { createArtifactTriggerContext } from './artifact-trigger-context.js';
|
|
17
17
|
import { loadConfig } from './config/load-config.js';
|
|
18
|
+
import { delegatedGrantReferences, withDelegatedGrants } from './delegated-artifact-context.js';
|
|
18
19
|
import { createDelegationAuthority } from './delegation-authority.js';
|
|
19
20
|
import { createDeliveryIntegration } from './delivery-integration.js';
|
|
20
21
|
import { EventProcessorRuntime } from './event-processor-runtime.js';
|
|
21
22
|
import { loadFakeScenarios } from './fake-scenarios.js';
|
|
22
23
|
import { composeIntegrationRuntime, composeProviders } from './integration-runtime.js';
|
|
24
|
+
import { withObjectiveTitle } from './objective-title-context.js';
|
|
23
25
|
import { resolveWakePaths } from './paths.js';
|
|
24
26
|
import { composePersistence } from './persistence-composition.js';
|
|
25
27
|
import { createRunnerQuotaReporter } from './runner-quota-reporter.js';
|
|
@@ -54,10 +56,10 @@ async function createApplicationServices(wakeRoot, options = {}) {
|
|
|
54
56
|
const resources = createResourceService(journal, lookup);
|
|
55
57
|
const pullRequests = createPullRequestService(journal, work, resources);
|
|
56
58
|
const activities = options.activities ??
|
|
57
|
-
createBuiltInActivityRegistry(journal, pullRequests, resources, wakeRoot, createGitHubAgentContextReader(journal, resources, {
|
|
59
|
+
createBuiltInActivityRegistry(journal, pullRequests, resources, wakeRoot, withObjectiveTitle(createGitHubAgentContextReader(journal, resources, {
|
|
58
60
|
publicUiUrl: config.surfaces.web.publicUrl,
|
|
59
61
|
githubAdapters: githubAdapters(config),
|
|
60
|
-
}, conversations),
|
|
62
|
+
}, conversations), work),
|
|
61
63
|
// Resolved lazily: Orchestration is composed after the registry it compiles against.
|
|
62
64
|
{ authorize: (request) => orchestration.authorizeParentAction(request) });
|
|
63
65
|
const workflowNotices = [];
|
|
@@ -93,6 +95,17 @@ async function createApplicationServices(wakeRoot, options = {}) {
|
|
|
93
95
|
pullRequests,
|
|
94
96
|
providers: () => providerInstances.promise,
|
|
95
97
|
})),
|
|
98
|
+
messages: {
|
|
99
|
+
post: (input, context) => postControlPlaneEntry(conversations, input, context),
|
|
100
|
+
},
|
|
101
|
+
resources: {
|
|
102
|
+
async relateChild({ childWorkItemId, parentWorkItemId }, context) {
|
|
103
|
+
const primary = (await resources.correlationsForWork(parentWorkItemId)).find((correlation) => correlation.role === ResourceCorrelationRole.Primary);
|
|
104
|
+
if (primary === undefined)
|
|
105
|
+
return;
|
|
106
|
+
await resources.correlate(primary.resourceId, childWorkItemId, ResourceCorrelationRole.Secondary, context, ResourceCorrelationProvenance.Delegated);
|
|
107
|
+
},
|
|
108
|
+
},
|
|
96
109
|
runHasEnded: async (runId) => {
|
|
97
110
|
const run = (await execution.list()).find((entry) => entry.runId === runId);
|
|
98
111
|
return (run !== undefined &&
|
|
@@ -142,7 +155,7 @@ async function createApplicationServices(wakeRoot, options = {}) {
|
|
|
142
155
|
wakeRoot: paths.wakeRoot,
|
|
143
156
|
now: () => clock.now().toISOString(),
|
|
144
157
|
nextId: () => ids.next('artifact'),
|
|
145
|
-
sharedContext: artifactTriggerContext.provision,
|
|
158
|
+
sharedContext: withDelegatedGrants(artifactTriggerContext.provision, delegatedGrantReferences({ work, contexts: artifactContexts })),
|
|
146
159
|
operatorInstructions,
|
|
147
160
|
journal,
|
|
148
161
|
}),
|
|
@@ -185,6 +198,7 @@ async function createApplicationServices(wakeRoot, options = {}) {
|
|
|
185
198
|
subscriptionRunSerialiser,
|
|
186
199
|
work,
|
|
187
200
|
artifacts,
|
|
201
|
+
artifactContexts,
|
|
188
202
|
operatorInstructions,
|
|
189
203
|
conversations,
|
|
190
204
|
resources,
|
|
@@ -214,7 +228,7 @@ export async function createDiagnosticRoot(wakeRoot) {
|
|
|
214
228
|
return { ...base, providers: instances, providerFailures: failures };
|
|
215
229
|
}
|
|
216
230
|
export async function createCompositionRoot(wakeRoot, options = {}) {
|
|
217
|
-
const { providerInstances, config, fakeScenarios, workflowNotices, paths, maintenance, clock, ids, journal, projections, checkpoints, processorState, subscriptionRunSerialiser, work, artifacts, operatorInstructions, conversations, resources, pullRequests, lookup, orchestration, execution, recovery, transcriptStore, runnerControls, controlPlane, isRuntimePaused, activities, runners, artifactTriggerContext, workspaces, } = await createApplicationServices(wakeRoot, options);
|
|
231
|
+
const { providerInstances, config, fakeScenarios, workflowNotices, paths, maintenance, clock, ids, journal, projections, checkpoints, processorState, subscriptionRunSerialiser, work, artifacts, artifactContexts, operatorInstructions, conversations, resources, pullRequests, lookup, orchestration, execution, recovery, transcriptStore, runnerControls, controlPlane, isRuntimePaused, activities, runners, artifactTriggerContext, workspaces, } = await createApplicationServices(wakeRoot, options);
|
|
218
232
|
const processorRuntime = new EventProcessorRuntime(journal, checkpoints, subscriptionRunSerialiser, clock);
|
|
219
233
|
const activationScheduler = createActivationScheduler(orchestration, {
|
|
220
234
|
...execution,
|
|
@@ -290,6 +304,7 @@ export async function createCompositionRoot(wakeRoot, options = {}) {
|
|
|
290
304
|
activities,
|
|
291
305
|
work,
|
|
292
306
|
artifacts,
|
|
307
|
+
artifactContexts,
|
|
293
308
|
operatorInstructions,
|
|
294
309
|
conversations,
|
|
295
310
|
resources,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ArtifactContextService, ArtifactRevisionReference } from '../artifacts/index.js';
|
|
2
|
+
import type { WorkService } from '../work/index.js';
|
|
3
|
+
/** Accepted artifact revisions a parent granted to one of its delegated children. */
|
|
4
|
+
export declare function delegatedGrantReferences(input: {
|
|
5
|
+
readonly work: Pick<WorkService, 'get'>;
|
|
6
|
+
readonly contexts: Pick<ArtifactContextService, 'childReferences'>;
|
|
7
|
+
}): (workItemId: string) => Promise<readonly ArtifactRevisionReference[]>;
|
|
8
|
+
type SharedContext = (workItemId: string) => Promise<{
|
|
9
|
+
readonly sharedReferences?: readonly ArtifactRevisionReference[];
|
|
10
|
+
readonly currentMemory?: ArtifactRevisionReference | null;
|
|
11
|
+
readonly contextScope?: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** Makes a child's granted references readable by its activations, beside trigger-shared context. */
|
|
14
|
+
export declare function withDelegatedGrants(shared: SharedContext, grants: (workItemId: string) => Promise<readonly ArtifactRevisionReference[]>): SharedContext;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Accepted artifact revisions a parent granted to one of its delegated children. */
|
|
2
|
+
export function delegatedGrantReferences(input) {
|
|
3
|
+
return async (workItemId) => {
|
|
4
|
+
const parent = (await input.work.get(workItemId))?.delegation?.parentWorkItemId;
|
|
5
|
+
return parent === undefined ? [] : input.contexts.childReferences(parent, workItemId);
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
/** Makes a child's granted references readable by its activations, beside trigger-shared context. */
|
|
9
|
+
export function withDelegatedGrants(shared, grants) {
|
|
10
|
+
return async (workItemId) => {
|
|
11
|
+
const base = await shared(workItemId);
|
|
12
|
+
const granted = await grants(workItemId);
|
|
13
|
+
return granted.length === 0
|
|
14
|
+
? base
|
|
15
|
+
: { ...base, sharedReferences: [...(base.sharedReferences ?? []), ...granted] };
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -411,6 +411,15 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \\
|
|
|
411
411
|
&& apt-get update \\
|
|
412
412
|
&& apt-get install -y --no-install-recommends gh
|
|
413
413
|
|
|
414
|
+
# gh extensions resolve from the data dir under the container home, which is bind-mounted at
|
|
415
|
+
# runtime and would hide anything installed there. Install the latest release system-wide here; the
|
|
416
|
+
# entrypoint links it into the home at startup. Agents link PRs with: gh stack link.
|
|
417
|
+
# Bump this date to force a fresh install instead of an indefinitely cached layer.
|
|
418
|
+
ARG GH_STACK_CACHE_BUST=2026-10-23
|
|
419
|
+
RUN echo "gh-stack cache bust: \${GH_STACK_CACHE_BUST}" \\
|
|
420
|
+
&& XDG_DATA_HOME=/usr/local/lib/wake-gh gh extension install github/gh-stack \\
|
|
421
|
+
&& chmod -R a+rX /usr/local/lib/wake-gh
|
|
422
|
+
|
|
414
423
|
RUN --mount=type=cache,target=/root/.npm \\
|
|
415
424
|
npm install -g @anthropic-ai/claude-code @openai/codex
|
|
416
425
|
|
|
@@ -476,7 +485,7 @@ ENV WAKE_MAIN_JS=/app/dist/src/main.js
|
|
|
476
485
|
# Startup ownership repair is best effort because bind-mounted paths or host
|
|
477
486
|
# permissions may prevent chown. The bounded direct-child pass avoids traversing
|
|
478
487
|
# accumulated runtime data.
|
|
479
|
-
ENTRYPOINT ["sh", "-c", "set -eu; mkdir -p /wake/.wake /wake/workspaces /wake/.wake/auth; chown wake:wake /wake/.wake /wake/workspaces /wake/.wake/auth || true; find /wake/.wake -mindepth 1 -maxdepth 1 -type d -exec chown wake:wake {} + || true; find /wake/.wake/auth -mindepth 1 -maxdepth 1 -type f -exec chown wake:wake {} + || true; if [ -n \\"\${WAKE_HOME_INIT_DIRS:-}\\" ]; then printf '%s\\n' \\"$WAKE_HOME_INIT_DIRS\\" | while IFS= read -r directory; do case \\"$directory\\" in \\"\${WAKE_HOME_INIT_ROOT:-}\\"/*) mkdir -p \\"$directory\\"; chown wake:wake \\"$directory\\" ;; *) exit 1 ;; esac; done; fi; exec su wake -s /bin/sh -c 'HOME=/home/wake exec node \\"$WAKE_MAIN_JS\\" sandbox-entrypoint --wake-root /wake'"]
|
|
488
|
+
ENTRYPOINT ["sh", "-c", "set -eu; mkdir -p /wake/.wake /wake/workspaces /wake/.wake/auth; chown wake:wake /wake/.wake /wake/workspaces /wake/.wake/auth || true; find /wake/.wake -mindepth 1 -maxdepth 1 -type d -exec chown wake:wake {} + || true; find /wake/.wake/auth -mindepth 1 -maxdepth 1 -type f -exec chown wake:wake {} + || true; { mkdir -p /home/wake/.local/share/gh/extensions && ln -sfn /usr/local/lib/wake-gh/gh/extensions/gh-stack /home/wake/.local/share/gh/extensions/gh-stack && chown wake:wake /home/wake/.local /home/wake/.local/share /home/wake/.local/share/gh /home/wake/.local/share/gh/extensions; } || true; if [ -n \\"\${WAKE_HOME_INIT_DIRS:-}\\" ]; then printf '%s\\n' \\"$WAKE_HOME_INIT_DIRS\\" | while IFS= read -r directory; do case \\"$directory\\" in \\"\${WAKE_HOME_INIT_ROOT:-}\\"/*) mkdir -p \\"$directory\\"; chown wake:wake \\"$directory\\" ;; *) exit 1 ;; esac; done; fi; exec su wake -s /bin/sh -c 'HOME=/home/wake exec node \\"$WAKE_MAIN_JS\\" sandbox-entrypoint --wake-root /wake'"]
|
|
480
489
|
`;
|
|
481
490
|
const packagedDockerfile = `# syntax=docker/dockerfile:1
|
|
482
491
|
FROM node:24-bookworm-slim
|
|
@@ -494,6 +503,15 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \\
|
|
|
494
503
|
&& apt-get update \\
|
|
495
504
|
&& apt-get install -y --no-install-recommends gh
|
|
496
505
|
|
|
506
|
+
# gh extensions resolve from the data dir under the container home, which is bind-mounted at
|
|
507
|
+
# runtime and would hide anything installed there. Install the latest release system-wide here; the
|
|
508
|
+
# entrypoint links it into the home at startup. Agents link PRs with: gh stack link.
|
|
509
|
+
# Bump this date to force a fresh install instead of an indefinitely cached layer.
|
|
510
|
+
ARG GH_STACK_CACHE_BUST=2026-10-23
|
|
511
|
+
RUN echo "gh-stack cache bust: \${GH_STACK_CACHE_BUST}" \\
|
|
512
|
+
&& XDG_DATA_HOME=/usr/local/lib/wake-gh gh extension install github/gh-stack \\
|
|
513
|
+
&& chmod -R a+rX /usr/local/lib/wake-gh
|
|
514
|
+
|
|
497
515
|
ARG WAKE_VERSION=0.1.0
|
|
498
516
|
RUN --mount=type=cache,target=/root/.npm \\
|
|
499
517
|
npm install -g @anthropic-ai/claude-code @openai/codex "@atolis-hq/wake@\${WAKE_VERSION}"
|
|
@@ -543,7 +561,7 @@ EXPOSE 4317
|
|
|
543
561
|
# Startup ownership repair is best effort because bind-mounted paths or host
|
|
544
562
|
# permissions may prevent chown. The bounded direct-child pass avoids traversing
|
|
545
563
|
# accumulated runtime data.
|
|
546
|
-
ENTRYPOINT ["sh", "-c", "set -eu; mkdir -p /wake/.wake /wake/workspaces /wake/.wake/auth; chown wake:wake /wake/.wake /wake/workspaces /wake/.wake/auth || true; find /wake/.wake -mindepth 1 -maxdepth 1 -type d -exec chown wake:wake {} + || true; find /wake/.wake/auth -mindepth 1 -maxdepth 1 -type f -exec chown wake:wake {} + || true; if [ -n \\"\${WAKE_HOME_INIT_DIRS:-}\\" ]; then printf '%s\\n' \\"$WAKE_HOME_INIT_DIRS\\" | while IFS= read -r directory; do case \\"$directory\\" in \\"\${WAKE_HOME_INIT_ROOT:-}\\"/*) mkdir -p \\"$directory\\"; chown wake:wake \\"$directory\\" ;; *) exit 1 ;; esac; done; fi; exec su wake -s /bin/sh -c 'HOME=/home/wake exec wake sandbox-entrypoint'"]
|
|
564
|
+
ENTRYPOINT ["sh", "-c", "set -eu; mkdir -p /wake/.wake /wake/workspaces /wake/.wake/auth; chown wake:wake /wake/.wake /wake/workspaces /wake/.wake/auth || true; find /wake/.wake -mindepth 1 -maxdepth 1 -type d -exec chown wake:wake {} + || true; find /wake/.wake/auth -mindepth 1 -maxdepth 1 -type f -exec chown wake:wake {} + || true; { mkdir -p /home/wake/.local/share/gh/extensions && ln -sfn /usr/local/lib/wake-gh/gh/extensions/gh-stack /home/wake/.local/share/gh/extensions/gh-stack && chown wake:wake /home/wake/.local /home/wake/.local/share /home/wake/.local/share/gh /home/wake/.local/share/gh/extensions; } || true; if [ -n \\"\${WAKE_HOME_INIT_DIRS:-}\\" ]; then printf '%s\\n' \\"$WAKE_HOME_INIT_DIRS\\" | while IFS= read -r directory; do case \\"$directory\\" in \\"\${WAKE_HOME_INIT_ROOT:-}\\"/*) mkdir -p \\"$directory\\"; chown wake:wake \\"$directory\\" ;; *) exit 1 ;; esac; done; fi; exec su wake -s /bin/sh -c 'HOME=/home/wake exec wake sandbox-entrypoint'"]
|
|
547
565
|
`;
|
|
548
566
|
const triagePrompt = `---
|
|
549
567
|
maxTurns: 40
|
|
@@ -171,6 +171,7 @@ export async function composeIntegrationRuntime(input) {
|
|
|
171
171
|
runs,
|
|
172
172
|
resources: input.resources,
|
|
173
173
|
orchestration: input.orchestration,
|
|
174
|
+
work: input.work,
|
|
174
175
|
conversations: input.conversations,
|
|
175
176
|
...(replies === undefined ? {} : { replies }),
|
|
176
177
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentContextReader } from '../activities/index.js';
|
|
2
|
+
import type { WorkService } from '../work/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Work with no provider ticket, such as a delegated child, has no title to read. Its
|
|
5
|
+
* objective is its title, so fall back to that; ticket text stays authoritative when present.
|
|
6
|
+
*/
|
|
7
|
+
export declare function withObjectiveTitle(reader: AgentContextReader, work: Pick<WorkService, 'get'>): AgentContextReader;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Work with no provider ticket, such as a delegated child, has no title to read. Its
|
|
3
|
+
* objective is its title, so fall back to that; ticket text stays authoritative when present.
|
|
4
|
+
*/
|
|
5
|
+
export function withObjectiveTitle(reader, work) {
|
|
6
|
+
return {
|
|
7
|
+
async forWorkItem(workItemId, options) {
|
|
8
|
+
const context = await reader.forWorkItem(workItemId, options);
|
|
9
|
+
if (context.title !== '')
|
|
10
|
+
return context;
|
|
11
|
+
const objective = (await work.get(workItemId))?.objective;
|
|
12
|
+
return objective === undefined ? context : { ...context, title: objective };
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DelegationOutputKind, WorkflowArtifactOutputKind } from '../orchestration/index.js';
|
|
2
|
+
import { presentResource, toWorkItemKey, } from '../surfaces/index.js';
|
|
3
|
+
import { primaryExternalRef } from './external-ref.js';
|
|
2
4
|
export async function presentDelivery(root, work) {
|
|
3
5
|
if (root.orchestration?.deliveryTree === undefined)
|
|
4
6
|
return {};
|
|
@@ -6,24 +8,36 @@ export async function presentDelivery(root, work) {
|
|
|
6
8
|
if (cohorts.length === 0 && work.delegation === undefined)
|
|
7
9
|
return {};
|
|
8
10
|
const delivery = await root.work.deliverySnapshot();
|
|
9
|
-
const
|
|
11
|
+
const parent = await primaryWorkflowFor(root, work);
|
|
12
|
+
const state = parent === undefined
|
|
13
|
+
? undefined
|
|
14
|
+
: await root.orchestration.deliveryStateFor(parent.workflowInstanceId);
|
|
15
|
+
const attention = await presentAttention(root, parent);
|
|
16
|
+
const qa = state === undefined ? undefined : presentQa(state);
|
|
17
|
+
const selected = new Set(state?.selection?.entries.map((entry) => `${entry.childWorkItemId}/${entry.output.name}`));
|
|
18
|
+
const stale = staleOutputs(state, cohorts);
|
|
19
|
+
const staleKeys = new Set(stale.map((entry) => `${entry.workItemKey}/${entry.outputName}`));
|
|
10
20
|
return {
|
|
11
21
|
delegation: {
|
|
12
|
-
...(qa === undefined ?
|
|
13
|
-
rootWorkItemKey: toWorkItemKey(work.delegation?.rootWorkItemId ?? work.workItemId),
|
|
14
|
-
...(work.delegation === undefined
|
|
15
|
-
? {}
|
|
16
|
-
: { parentWorkItemKey: toWorkItemKey(work.delegation.parentWorkItemId) }),
|
|
22
|
+
...presentHeader(work, cohorts, attention, qa === undefined ? undefined : { ...qa, staleOutputs: stale }),
|
|
17
23
|
children: await Promise.all(cohorts.flatMap((cohort) => cohort.children.map(async (child) => {
|
|
18
24
|
const availability = delivery.availability(child.workItemId);
|
|
19
|
-
const
|
|
25
|
+
const correlations = await root.resources.correlationsForWork(child.workItemId);
|
|
26
|
+
const resources = await Promise.all(correlations.map((entry) => root.resources.get(entry.resourceId)));
|
|
27
|
+
const externalRef = await primaryExternalRef(root, child.workItemId, correlations, resources.filter((entry) => entry !== null));
|
|
20
28
|
return {
|
|
21
29
|
workItemKey: toWorkItemKey(child.workItemId),
|
|
30
|
+
workItemId: child.workItemId,
|
|
31
|
+
...(externalRef === undefined ? {} : { externalRef }),
|
|
22
32
|
parentWorkItemKey: toWorkItemKey(cohort.parentWorkItemId),
|
|
23
33
|
objective: child.objective,
|
|
24
34
|
workflowName: child.workflowName,
|
|
25
35
|
status: child.workflow?.status ?? 'registration-pending',
|
|
26
36
|
cohortId: cohort.cohortId,
|
|
37
|
+
...(child.prerequisiteBlocker === undefined
|
|
38
|
+
? {}
|
|
39
|
+
: { prerequisiteBlocker: child.prerequisiteBlocker }),
|
|
40
|
+
...presentPlacement(child, selected, staleKeys),
|
|
27
41
|
...((availability.reason ?? child.prerequisiteBlocker ?? child.workflow?.blockReason)
|
|
28
42
|
? {
|
|
29
43
|
blockReason: (availability.reason ??
|
|
@@ -39,53 +53,131 @@ export async function presentDelivery(root, work) {
|
|
|
39
53
|
},
|
|
40
54
|
};
|
|
41
55
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
?
|
|
46
|
-
:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
56
|
+
function presentHeader(work, cohorts, attention, qa) {
|
|
57
|
+
return {
|
|
58
|
+
...(qa === undefined ? {} : { qa }),
|
|
59
|
+
...(attention === undefined ? {} : { attention }),
|
|
60
|
+
cohorts: cohorts.map((cohort) => ({
|
|
61
|
+
cohortId: cohort.cohortId,
|
|
62
|
+
settled: cohort.settled,
|
|
63
|
+
...(cohort.failureReason === undefined ? {} : { failureReason: cohort.failureReason }),
|
|
64
|
+
})),
|
|
65
|
+
rootWorkItemKey: toWorkItemKey(work.delegation?.rootWorkItemId ?? work.workItemId),
|
|
66
|
+
...(work.delegation === undefined
|
|
67
|
+
? {}
|
|
68
|
+
: { parentWorkItemKey: toWorkItemKey(work.delegation.parentWorkItemId) }),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Stale keys are `cohort/assignment/output`; the reason is the one the selection rules apply. */
|
|
72
|
+
function staleOutputs(state, cohorts) {
|
|
73
|
+
const owners = new Map(cohorts.flatMap((cohort) => cohort.children.map((child) => [`${cohort.cohortId}/${child.assignmentId}`, child])));
|
|
74
|
+
return (state?.stale ?? []).flatMap((key) => {
|
|
75
|
+
const [cohortId, assignmentId, ...name] = key.split('/');
|
|
76
|
+
const owner = owners.get(`${cohortId}/${assignmentId}`);
|
|
77
|
+
return owner === undefined
|
|
78
|
+
? []
|
|
79
|
+
: [
|
|
80
|
+
{
|
|
81
|
+
workItemKey: toWorkItemKey(owner.workItemId),
|
|
82
|
+
outputName: name.join('/'),
|
|
83
|
+
reason: 'Built on an output that has since been replaced; it must be refreshed or reselected',
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function presentPlacement(child, selected, staleKeys) {
|
|
89
|
+
return {
|
|
90
|
+
...(child.workflow === null ? {} : { currentStage: child.workflow.currentStage }),
|
|
91
|
+
...(child.repository === undefined
|
|
92
|
+
? {}
|
|
93
|
+
: {
|
|
94
|
+
repository: {
|
|
95
|
+
resourceId: child.repository.resourceId,
|
|
96
|
+
pullRequestBase: child.repository.pullRequestBase,
|
|
97
|
+
},
|
|
98
|
+
}),
|
|
99
|
+
prerequisites: (child.prerequisiteWorkItemIds ?? []).map(toWorkItemKey),
|
|
100
|
+
...(child.replaces === undefined ? {} : { replaces: child.replaces }),
|
|
101
|
+
outputs: child.outputs.map((output) => ({
|
|
102
|
+
...('repository' in output && output.repository !== undefined
|
|
103
|
+
? {
|
|
104
|
+
repository: {
|
|
105
|
+
resourceId: output.repository.resourceId,
|
|
106
|
+
pullRequestBase: output.repository.pullRequestBase,
|
|
75
107
|
},
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
}
|
|
109
|
+
: {}),
|
|
110
|
+
name: output.name,
|
|
111
|
+
kind: 'kind' in output ? DelegationOutputKind.Change : WorkflowArtifactOutputKind,
|
|
112
|
+
required: output.required !== false,
|
|
113
|
+
selected: selected.has(`${child.workItemId}/${output.name}`),
|
|
114
|
+
stale: staleKeys.has(`${toWorkItemKey(child.workItemId)}/${output.name}`),
|
|
115
|
+
})),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
async function primaryWorkflowFor(root, work) {
|
|
119
|
+
return (await root.orchestration.listAll()).find((view) => view.workItemId === work.workItemId && view.parentWorkflowInstanceId === undefined);
|
|
120
|
+
}
|
|
121
|
+
/** The parent's open attention request and the replies already accepted for it. */
|
|
122
|
+
async function presentAttention(root, parent) {
|
|
123
|
+
if (parent?.delegationAttention === undefined)
|
|
124
|
+
return undefined;
|
|
125
|
+
const open = await root.orchestration.openDelegationAttention(parent.workflowInstanceId, parent.delegationAttention.activationId);
|
|
126
|
+
if (open === null)
|
|
127
|
+
return undefined;
|
|
128
|
+
return {
|
|
129
|
+
cohortId: open.cohortId,
|
|
130
|
+
revision: open.revision,
|
|
131
|
+
blockers: open.blockers.map((blocker) => ({
|
|
132
|
+
blockerId: blocker.blockerId,
|
|
133
|
+
workItemKey: toWorkItemKey(blocker.childWorkItemId),
|
|
134
|
+
kind: blocker.kind,
|
|
135
|
+
reason: blocker.reason,
|
|
136
|
+
answered: open.responses.some((reply) => reply.blockerId === blocker.blockerId),
|
|
137
|
+
})),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function presentQa(state) {
|
|
141
|
+
return {
|
|
142
|
+
...(state.integration === null
|
|
143
|
+
? {}
|
|
144
|
+
: {
|
|
145
|
+
integration: {
|
|
146
|
+
complete: state.integration.complete,
|
|
147
|
+
summary: state.integration.summary,
|
|
148
|
+
targets: state.integration.targets.map((target) => ({
|
|
149
|
+
workItemKey: toWorkItemKey(target.ownerWorkItemId),
|
|
150
|
+
outputName: target.output.outputName,
|
|
151
|
+
state: target.state,
|
|
152
|
+
layer: target.layer,
|
|
153
|
+
baseMovement: target.baseMovement,
|
|
154
|
+
evidenceAffected: target.evidenceAffected,
|
|
155
|
+
...(target.maintenance === undefined ? {} : { maintenance: target.maintenance }),
|
|
156
|
+
...(target.detail === undefined ? {} : { detail: target.detail }),
|
|
157
|
+
})),
|
|
158
|
+
maintenance: state.maintenance.map((item) => ({
|
|
159
|
+
maintenanceId: item.maintenanceId,
|
|
160
|
+
workItemKey: toWorkItemKey(item.target.childWorkItemId),
|
|
161
|
+
outputName: item.target.outputName,
|
|
162
|
+
kind: item.kind,
|
|
163
|
+
previousRevision: item.previous.revision,
|
|
164
|
+
currentRevision: item.current.revision,
|
|
165
|
+
producerRunId: item.producer.runId,
|
|
166
|
+
})),
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
169
|
+
selectionRevision: state.selectionRevision,
|
|
170
|
+
...(state.candidate === null ? {} : { candidateId: state.candidate.candidateId }),
|
|
171
|
+
repositories: state.candidate?.repositories.map((entry) => ({
|
|
172
|
+
resourceId: entry.resourceId,
|
|
173
|
+
revision: entry.revision,
|
|
174
|
+
})) ?? [],
|
|
175
|
+
stale: state.stale,
|
|
176
|
+
...(state.qa === null ? {} : { verdict: state.qa.verdict }),
|
|
177
|
+
effective: state.qaEffective,
|
|
178
|
+
canComplete: state.completion.complete,
|
|
179
|
+
...(state.completion.reason === undefined ? {} : { reason: state.completion.reason }),
|
|
180
|
+
exhausted: state.repair.exhausted,
|
|
181
|
+
findings: state.repair.unresolvedFindings,
|
|
182
|
+
};
|
|
91
183
|
}
|