@atolis-hq/wake 0.4.100 → 0.4.102
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/artifacts/application/operator-instructions-service.js +2 -2
- package/dist/src/bootstrap/artifact-mcp.d.ts +1 -0
- package/dist/src/bootstrap/artifact-mcp.js +27 -2
- package/dist/src/bootstrap/composition-root.js +6 -1
- package/dist/src/bootstrap/config/root-schema.d.ts +14 -0
- package/dist/src/bootstrap/delegation-authority.d.ts +10 -0
- package/dist/src/bootstrap/delegation-authority.js +52 -0
- package/dist/src/bootstrap/integration-runtime.js +5 -3
- package/dist/src/bootstrap/persistence-composition.js +1 -1
- package/dist/src/bootstrap/surface-api-delivery.d.ts +4 -0
- package/dist/src/bootstrap/surface-api-delivery.js +35 -0
- package/dist/src/bootstrap/surface-api-work-applications.js +2 -0
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +4 -1
- package/dist/src/control-plane/application/activation-scheduler.js +2 -1
- package/dist/src/control-plane/application/advance-once-dispatch.d.ts +4 -15
- package/dist/src/control-plane/application/advance-once-dispatch.js +15 -26
- package/dist/src/control-plane/application/trigger-recovery.js +2 -1
- package/dist/src/control-plane/application/trigger-workflow.d.ts +2 -1
- package/dist/src/control-plane/application/work-cancellation-policy.d.ts +1 -0
- package/dist/src/control-plane/application/work-cancellation-policy.js +6 -1
- package/dist/src/control-plane/domain/delivery-capacity.d.ts +9 -0
- package/dist/src/control-plane/domain/delivery-capacity.js +40 -0
- package/dist/src/control-plane/domain/dispatch-policy.d.ts +1 -0
- package/dist/src/control-plane/domain/dispatch-policy.js +6 -0
- package/dist/src/control-plane/domain/open-work-policy.d.ts +2 -7
- package/dist/src/control-plane/domain/open-work-policy.js +12 -9
- package/dist/src/execution/application/repository-assignments.d.ts +1 -1
- package/dist/src/execution/application/repository-assignments.js +7 -4
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts +9 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts.map +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.js +62 -7
- package/dist/src/node_modules/@atolis-hq/eventing/dist/store/event-journal.d.ts +2 -5
- package/dist/src/node_modules/@atolis-hq/eventing/dist/store/event-journal.d.ts.map +1 -1
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts +12 -13
- 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 +168 -109
- package/dist/src/orchestration/application/deferred-signals.d.ts +4 -2
- package/dist/src/orchestration/application/deferred-signals.js +47 -37
- package/dist/src/orchestration/application/delegated-work.d.ts +54 -0
- package/dist/src/orchestration/application/delegated-work.js +64 -1
- package/dist/src/orchestration/application/delegation-commands.d.ts +119 -0
- package/dist/src/orchestration/application/delegation-commands.js +99 -0
- package/dist/src/orchestration/application/delegation-gate.d.ts +15 -5
- package/dist/src/orchestration/application/delegation-gate.js +44 -4
- package/dist/src/orchestration/application/orchestration-service.d.ts +150 -2
- package/dist/src/orchestration/application/orchestration-service.js +52 -6
- package/dist/src/orchestration/contracts/config.d.ts +16 -0
- package/dist/src/orchestration/contracts/config.js +10 -0
- package/dist/src/orchestration/contracts/delegation-ports.d.ts +10 -1
- package/dist/src/orchestration/contracts/delegation.d.ts +34 -0
- package/dist/src/orchestration/contracts/delegation.js +8 -0
- package/dist/src/orchestration/domain/compiler.js +7 -0
- package/dist/src/orchestration/index.d.ts +3 -0
- package/dist/src/orchestration/index.js +1 -0
- package/dist/src/surfaces/api/contracts/work.d.ts +14 -0
- package/dist/src/surfaces/index.d.ts +1 -0
- package/dist/src/surfaces/index.js +1 -0
- package/dist/src/surfaces/mcp/delegation.d.ts +9 -0
- package/dist/src/surfaces/mcp/delegation.js +25 -0
- package/dist/src/surfaces/web-assets/assets/index-C5R-aWzH.js +1192 -0
- package/dist/src/surfaces/web-assets/index.html +1 -1
- package/dist/src/work/application/work-index.d.ts +21 -0
- package/dist/src/work/application/work-index.js +73 -0
- package/dist/src/work/application/work-service.d.ts +3 -0
- package/dist/src/work/application/work-service.js +3 -0
- package/dist/src/work/domain/delivery-availability.d.ts +14 -0
- package/dist/src/work/domain/delivery-availability.js +20 -0
- package/dist/src/work/index.d.ts +2 -0
- package/dist/src/work/index.js +2 -0
- package/package.json +2 -1
- package/dist/src/surfaces/web-assets/assets/index-s9CWgq-s.js +0 -1192
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Wake</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-C5R-aWzH.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-EVgZ9q9N.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type EventJournal } from '@atolis-hq/eventing';
|
|
2
|
+
import { type DeliveryAvailability, type DeliveryWorkState } from '../domain/delivery-availability.js';
|
|
3
|
+
/** Work state as of one point in the journal, answerable without further I/O. */
|
|
4
|
+
export interface DeliverySnapshot {
|
|
5
|
+
get(id: string): DeliveryWorkState | null;
|
|
6
|
+
/** True when the item's events could not be decoded or folded; it must be treated as held. */
|
|
7
|
+
invalid(id: string): boolean;
|
|
8
|
+
availability(id: string): DeliveryAvailability;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Every WorkItem folded once and extended as the journal grows. Batch readers
|
|
12
|
+
* (dispatch, gating, capacity) ask for one snapshot and evaluate any number of
|
|
13
|
+
* items against it, instead of reading each item's stream from storage. Each
|
|
14
|
+
* journal read observes every append committed before it, so a snapshot
|
|
15
|
+
* includes writes by other processes.
|
|
16
|
+
*/
|
|
17
|
+
export declare class WorkIndex {
|
|
18
|
+
private readonly state;
|
|
19
|
+
constructor(journal: Pick<EventJournal, 'readAll' | 'latestGlobalPosition'>);
|
|
20
|
+
snapshot(): Promise<DeliverySnapshot>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { foldedJournalView, } from '@atolis-hq/eventing';
|
|
2
|
+
import { selectWorkEvent } from '../contracts/events.js';
|
|
3
|
+
import { isWorkItemStream } from '../contracts/streams.js';
|
|
4
|
+
import { deliveryAvailability, } from '../domain/delivery-availability.js';
|
|
5
|
+
import { foldWorkItem } from '../domain/work-item.js';
|
|
6
|
+
/**
|
|
7
|
+
* Every WorkItem folded once and extended as the journal grows. Batch readers
|
|
8
|
+
* (dispatch, gating, capacity) ask for one snapshot and evaluate any number of
|
|
9
|
+
* items against it, instead of reading each item's stream from storage. Each
|
|
10
|
+
* journal read observes every append committed before it, so a snapshot
|
|
11
|
+
* includes writes by other processes.
|
|
12
|
+
*/
|
|
13
|
+
export class WorkIndex {
|
|
14
|
+
state;
|
|
15
|
+
constructor(journal) {
|
|
16
|
+
this.state = foldedJournalView(journal, {
|
|
17
|
+
initial: { streams: new Map(), items: new Map(), invalid: new Set() },
|
|
18
|
+
extend: extendWorkIndex,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
async snapshot() {
|
|
22
|
+
const { items, invalid } = await this.state.get();
|
|
23
|
+
const get = (id) => items.get(id) ?? null;
|
|
24
|
+
return {
|
|
25
|
+
get,
|
|
26
|
+
invalid: (id) => invalid.has(id),
|
|
27
|
+
availability: (id) => deliveryAvailability(id, get),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// A malformed stream poisons only its own item. That item is then unknown and
|
|
32
|
+
// held, rather than failing availability for every other item.
|
|
33
|
+
function extendWorkIndex(state, events) {
|
|
34
|
+
const invalid = new Set(state.invalid);
|
|
35
|
+
const added = new Map();
|
|
36
|
+
for (const envelope of events) {
|
|
37
|
+
if (!isWorkItemStream(envelope.stream) || invalid.has(envelope.stream.id))
|
|
38
|
+
continue;
|
|
39
|
+
try {
|
|
40
|
+
const event = selectWorkEvent(envelope);
|
|
41
|
+
if (event === null)
|
|
42
|
+
continue;
|
|
43
|
+
const stream = added.get(envelope.stream.id);
|
|
44
|
+
if (stream === undefined)
|
|
45
|
+
added.set(envelope.stream.id, [event]);
|
|
46
|
+
else
|
|
47
|
+
stream.push(event);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
invalid.add(envelope.stream.id);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const streams = new Map(state.streams);
|
|
54
|
+
const items = new Map(state.items);
|
|
55
|
+
for (const [id, more] of added) {
|
|
56
|
+
if (invalid.has(id)) {
|
|
57
|
+
items.delete(id);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const all = [...(streams.get(id) ?? []), ...more];
|
|
61
|
+
streams.set(id, all);
|
|
62
|
+
try {
|
|
63
|
+
const view = foldWorkItem(all);
|
|
64
|
+
if (view !== null)
|
|
65
|
+
items.set(id, view);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
invalid.add(id);
|
|
69
|
+
items.delete(id);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { streams, items, invalid };
|
|
73
|
+
}
|
|
@@ -2,6 +2,7 @@ import { type CommandContext, type EventJournal } from '@atolis-hq/eventing';
|
|
|
2
2
|
import type { CreateWorkItem, LinkWorkItems, ReviseWorkObjective } from '../contracts/commands.js';
|
|
3
3
|
import type { WorkItemId } from '../contracts/identifiers.js';
|
|
4
4
|
import type { WorkItemView } from '../contracts/views.js';
|
|
5
|
+
import { type DeliverySnapshot } from './work-index.js';
|
|
5
6
|
export interface WorkService {
|
|
6
7
|
create(command: CreateWorkItem, context: CommandContext): Promise<WorkItemView>;
|
|
7
8
|
revise(command: ReviseWorkObjective, context: CommandContext): Promise<WorkItemView>;
|
|
@@ -14,5 +15,7 @@ export interface WorkService {
|
|
|
14
15
|
unfreeze(workItemId: WorkItemId, context: CommandContext): Promise<WorkItemView>;
|
|
15
16
|
delete(workItemId: WorkItemId, context: CommandContext): Promise<WorkItemView>;
|
|
16
17
|
get(workItemId: WorkItemId): Promise<WorkItemView | null>;
|
|
18
|
+
/** One synchronisation with the journal, then in-memory delivery answers for any number of items. */
|
|
19
|
+
deliverySnapshot(): Promise<DeliverySnapshot>;
|
|
17
20
|
}
|
|
18
21
|
export declare function createWorkService(journal: EventJournal): WorkService;
|
|
@@ -3,6 +3,7 @@ import { isDeepStrictEqual } from 'node:util';
|
|
|
3
3
|
import { createWorkEventData } from '../contracts/event-factory.js';
|
|
4
4
|
import { WorkEventType, } from '../contracts/events.js';
|
|
5
5
|
import { WorkStatus } from '../contracts/vocabulary.js';
|
|
6
|
+
import { WorkIndex } from './work-index.js';
|
|
6
7
|
import { WorkRepository } from './work-repository.js';
|
|
7
8
|
/** Delegated ancestry is derived from the validated parent, never trusted from the command. */
|
|
8
9
|
async function assertDelegationAncestry(repository, command) {
|
|
@@ -20,6 +21,7 @@ async function assertDelegationAncestry(repository, command) {
|
|
|
20
21
|
}
|
|
21
22
|
export function createWorkService(journal) {
|
|
22
23
|
const repository = new WorkRepository(journal);
|
|
24
|
+
const index = new WorkIndex(journal);
|
|
23
25
|
const change = (workItemId, context, draft, allowMissing, requireOpen) => changeWorkItem(repository, workItemId, context, draft, allowMissing, requireOpen);
|
|
24
26
|
return {
|
|
25
27
|
async create(command, context) {
|
|
@@ -73,6 +75,7 @@ export function createWorkService(journal) {
|
|
|
73
75
|
async get(workItemId) {
|
|
74
76
|
return (await repository.load(workItemId)).view;
|
|
75
77
|
},
|
|
78
|
+
deliverySnapshot: () => index.snapshot(),
|
|
76
79
|
};
|
|
77
80
|
}
|
|
78
81
|
async function changeWorkItem(repository, workItemId, context, draft, allowMissing = false, requireOpen = true) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WorkDelegation } from '../contracts/commands.js';
|
|
2
|
+
import type { WorkItemId } from '../contracts/identifiers.js';
|
|
3
|
+
export interface DeliveryWorkState {
|
|
4
|
+
readonly state?: string;
|
|
5
|
+
readonly frozen?: boolean;
|
|
6
|
+
readonly deleted?: boolean;
|
|
7
|
+
readonly delegation?: WorkDelegation;
|
|
8
|
+
}
|
|
9
|
+
export interface DeliveryAvailability {
|
|
10
|
+
readonly rootWorkItemId: string;
|
|
11
|
+
readonly reason?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Ancestry comes from Work's validated creation facts, never descriptive links. */
|
|
14
|
+
export declare function deliveryAvailability(id: string, lookup: (id: WorkItemId) => DeliveryWorkState | null): DeliveryAvailability;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WorkStatus } from '../contracts/vocabulary.js';
|
|
2
|
+
/** Ancestry comes from Work's validated creation facts, never descriptive links. */
|
|
3
|
+
export function deliveryAvailability(id, lookup) {
|
|
4
|
+
const item = lookup(id);
|
|
5
|
+
const rootWorkItemId = item?.delegation?.rootWorkItemId ?? id;
|
|
6
|
+
for (const [key, member] of [
|
|
7
|
+
[id, item],
|
|
8
|
+
...(item?.delegation?.ancestors ?? []).map((ancestor) => [ancestor, lookup(ancestor)]),
|
|
9
|
+
]) {
|
|
10
|
+
if (unavailable(member))
|
|
11
|
+
return { rootWorkItemId, reason: `Delivery work ${key} is unavailable` };
|
|
12
|
+
}
|
|
13
|
+
return { rootWorkItemId };
|
|
14
|
+
}
|
|
15
|
+
function unavailable(member) {
|
|
16
|
+
return (member === null ||
|
|
17
|
+
member.deleted === true ||
|
|
18
|
+
member.frozen === true ||
|
|
19
|
+
(member.state !== undefined && member.state !== WorkStatus.Open));
|
|
20
|
+
}
|
package/dist/src/work/index.d.ts
CHANGED
|
@@ -10,3 +10,5 @@ export * from './contracts/streams.js';
|
|
|
10
10
|
export * from './contracts/views.js';
|
|
11
11
|
export * from './contracts/vocabulary.js';
|
|
12
12
|
export * from './domain/work-item.js';
|
|
13
|
+
export * from './domain/delivery-availability.js';
|
|
14
|
+
export * from './application/work-index.js';
|
package/dist/src/work/index.js
CHANGED
|
@@ -10,3 +10,5 @@ export * from './contracts/streams.js';
|
|
|
10
10
|
export * from './contracts/views.js';
|
|
11
11
|
export * from './contracts/vocabulary.js';
|
|
12
12
|
export * from './domain/work-item.js';
|
|
13
|
+
export * from './domain/delivery-availability.js';
|
|
14
|
+
export * from './application/work-index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atolis-hq/wake",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.102",
|
|
4
4
|
"description": "Local autonomous agent control plane for software development",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
55
55
|
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
56
56
|
"test:e2e:live": "vitest run --config vitest.live-e2e.config.ts",
|
|
57
|
+
"test:stress": "vitest run --config vitest.stress.config.ts",
|
|
57
58
|
"lint:contracts": "node scripts/check-contract-vocabulary.mjs",
|
|
58
59
|
"knip": "knip --config knip.json",
|
|
59
60
|
"lint": "eslint --cache --cache-strategy content --cache-location node_modules/.cache/eslint/.eslintcache .",
|