@atolis-hq/wake 0.4.59 → 0.4.61

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.
Files changed (43) hide show
  1. package/dist/src/bootstrap/analytics-reports.d.ts +1 -1
  2. package/dist/src/bootstrap/analytics-reports.js +5 -2
  3. package/dist/src/bootstrap/canonical-events.d.ts +3 -0
  4. package/dist/src/bootstrap/canonical-events.js +32 -0
  5. package/dist/src/bootstrap/composition-root.d.ts +2 -2
  6. package/dist/src/bootstrap/composition-root.js +6 -3
  7. package/dist/src/bootstrap/config/root-schema.d.ts +8 -3
  8. package/dist/src/bootstrap/config/root-schema.js +29 -1
  9. package/dist/src/bootstrap/initialise.js +5 -0
  10. package/dist/src/bootstrap/integration-runtime.d.ts +6 -4
  11. package/dist/src/bootstrap/integration-runtime.js +50 -8
  12. package/dist/src/bootstrap/surface-cli-applications.js +1 -1
  13. package/dist/src/bootstrap/trigger-checkpoint-store.d.ts +9 -0
  14. package/dist/src/bootstrap/trigger-checkpoint-store.js +49 -0
  15. package/dist/src/bootstrap/version.js +1 -1
  16. package/dist/src/control-plane/application/control-plane-projection.js +2 -0
  17. package/dist/src/control-plane/application/runner-pipeline.d.ts +2 -2
  18. package/dist/src/control-plane/application/runner-pipeline.js +2 -2
  19. package/dist/src/control-plane/application/trigger-service.d.ts +35 -0
  20. package/dist/src/control-plane/application/trigger-service.js +118 -0
  21. package/dist/src/control-plane/contracts/config.d.ts +18 -8
  22. package/dist/src/control-plane/contracts/config.js +35 -6
  23. package/dist/src/control-plane/contracts/event-factory.js +2 -0
  24. package/dist/src/control-plane/contracts/events.d.ts +23 -0
  25. package/dist/src/control-plane/contracts/events.js +32 -0
  26. package/dist/src/control-plane/domain/cron-trigger-policy.d.ts +10 -0
  27. package/dist/src/control-plane/domain/{schedule-policy.js → cron-trigger-policy.js} +5 -5
  28. package/dist/src/control-plane/index.d.ts +2 -2
  29. package/dist/src/control-plane/index.js +2 -2
  30. package/dist/src/execution/application/run-reports.d.ts +13 -1
  31. package/dist/src/execution/application/run-reports.js +42 -1
  32. package/dist/src/kernel/contracts/reports.d.ts +14 -1
  33. package/dist/src/surfaces/api/contracts/observability.d.ts +1 -1
  34. package/dist/src/surfaces/api/routes/applications.d.ts +2 -2
  35. package/dist/src/surfaces/web-assets/assets/index-CCvwzTeC.js +1131 -0
  36. package/dist/src/surfaces/web-assets/index.html +1 -1
  37. package/package.json +1 -1
  38. package/dist/src/bootstrap/schedule-checkpoint-store.d.ts +0 -9
  39. package/dist/src/bootstrap/schedule-checkpoint-store.js +0 -49
  40. package/dist/src/control-plane/application/schedule-service.d.ts +0 -31
  41. package/dist/src/control-plane/application/schedule-service.js +0 -47
  42. package/dist/src/control-plane/domain/schedule-policy.d.ts +0 -8
  43. package/dist/src/surfaces/web-assets/assets/index-CC1TIxyc.js +0 -1131
@@ -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-CC1TIxyc.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CCvwzTeC.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-EVgZ9q9N.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/wake",
3
- "version": "0.4.59",
3
+ "version": "0.4.61",
4
4
  "description": "Local autonomous agent control plane for software development",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,9 +0,0 @@
1
- import type { ScheduleCheckpointStore } from '../control-plane/index.js';
2
- /** Durable timestamp cursor for ScheduleService; journal checkpoints only store numeric offsets. */
3
- export declare class FileScheduleCheckpointStore implements ScheduleCheckpointStore {
4
- private readonly dataRoot;
5
- constructor(dataRoot: string);
6
- load(scheduleId: string): Promise<string | null>;
7
- save(scheduleId: string, slot: string): Promise<void>;
8
- private path;
9
- }
@@ -1,49 +0,0 @@
1
- import { mkdir, open, readFile, rename, rm } from 'node:fs/promises';
2
- import { dirname, join } from 'node:path';
3
- /** Durable timestamp cursor for ScheduleService; journal checkpoints only store numeric offsets. */
4
- export class FileScheduleCheckpointStore {
5
- dataRoot;
6
- constructor(dataRoot) {
7
- this.dataRoot = dataRoot;
8
- }
9
- async load(scheduleId) {
10
- try {
11
- const parsed = JSON.parse(await readFile(this.path(scheduleId), 'utf8'));
12
- if (parsed.scheduleId !== scheduleId || Number.isNaN(Date.parse(parsed.slot)))
13
- throw new Error(`Invalid schedule checkpoint: ${scheduleId}`);
14
- return parsed.slot;
15
- }
16
- catch (error) {
17
- if (error.code === 'ENOENT')
18
- return null;
19
- throw error;
20
- }
21
- }
22
- async save(scheduleId, slot) {
23
- const existing = await this.load(scheduleId);
24
- if (existing !== null && Date.parse(slot) < Date.parse(existing))
25
- throw new Error(`Schedule checkpoint regression: ${scheduleId}`);
26
- const path = this.path(scheduleId);
27
- await mkdir(dirname(path), { recursive: true });
28
- const temporary = `${path}.${process.pid}.${Date.now()}.tmp`;
29
- try {
30
- const handle = await open(temporary, 'wx');
31
- try {
32
- await handle.writeFile(`${JSON.stringify({ scheduleId, slot })}\n`, 'utf8');
33
- await handle.sync();
34
- }
35
- finally {
36
- await handle.close();
37
- }
38
- await rename(temporary, path);
39
- }
40
- finally {
41
- await rm(temporary, { force: true });
42
- }
43
- }
44
- path(scheduleId) {
45
- if (scheduleId.length === 0 || /[\\/]/.test(scheduleId))
46
- throw new Error('Schedule id must not contain path separators');
47
- return join(this.dataRoot, 'schedule-checkpoints', `${encodeURIComponent(scheduleId)}.json`);
48
- }
49
- }
@@ -1,31 +0,0 @@
1
- import { type CommandContext } from '@atolis-hq/eventing';
2
- import { type IdGenerator } from '../../kernel/index.js';
3
- import type { StartWorkflowInstance } from '../../orchestration/index.js';
4
- import { workflowInstanceId } from '../../orchestration/index.js';
5
- import type { CreateWorkItem } from '../../work/index.js';
6
- import { workItemId } from '../../work/index.js';
7
- import type { ScheduleConfig } from '../contracts/config.js';
8
- export interface ScheduleCheckpointStore {
9
- load(scheduleId: string): Promise<string | null>;
10
- save(scheduleId: string, slot: string): Promise<void>;
11
- }
12
- export interface ScheduleServiceDependencies {
13
- readonly checkpoint: ScheduleCheckpointStore;
14
- readonly ids: IdGenerator;
15
- readonly work: {
16
- create(command: CreateWorkItem, context: CommandContext): Promise<unknown>;
17
- };
18
- readonly orchestration: Pick<{
19
- start(command: StartWorkflowInstance, context: CommandContext): Promise<unknown>;
20
- get(id: ReturnType<typeof workflowInstanceId>): Promise<{
21
- readonly workItemId: ReturnType<typeof workItemId>;
22
- } | null>;
23
- }, 'start' | 'get'>;
24
- readonly now: () => string;
25
- }
26
- export declare class ScheduleService {
27
- private readonly dependencies;
28
- private readonly policy;
29
- constructor(dependencies: ScheduleServiceDependencies);
30
- run(config: ScheduleConfig, context: CommandContext): Promise<readonly string[]>;
31
- }
@@ -1,47 +0,0 @@
1
- import { correlationId } from '@atolis-hq/eventing';
2
- import { orchestrationGroupId, workflowInstanceId, workflowName, } from '../../orchestration/index.js';
3
- import { workItemId } from '../../work/index.js';
4
- import { SchedulePolicy } from '../domain/schedule-policy.js';
5
- export class ScheduleService {
6
- dependencies;
7
- policy = new SchedulePolicy();
8
- constructor(dependencies) {
9
- this.dependencies = dependencies;
10
- }
11
- async run(config, context) {
12
- const checkpoint = await this.dependencies.checkpoint.load(config.id);
13
- const slots = this.policy.elapsedSlots(config, this.dependencies.now(), checkpoint);
14
- const accepted = [];
15
- for (const slot of slots) {
16
- const workflow = workflowInstanceId(`workflow-${safe(slot.at)}`);
17
- const slotContext = slotCommandContext(context, slot.identity);
18
- const existing = await this.dependencies.orchestration.get(workflow);
19
- const item = existing?.workItemId ?? workItemId(this.dependencies.ids.next('work'));
20
- if (existing === null) {
21
- const workCommand = { workItemId: item, objective: config.objective };
22
- await this.dependencies.work.create(workCommand, slotContext);
23
- }
24
- const start = {
25
- workflowInstanceId: workflow,
26
- workItemId: item,
27
- workflowName: workflowName(config.workflow),
28
- orchestrationGroupId: orchestrationGroupId(`primary:${item}`),
29
- };
30
- await this.dependencies.orchestration.start(start, slotContext);
31
- await this.dependencies.checkpoint.save(config.id, slot.at);
32
- accepted.push(slot.identity);
33
- }
34
- return accepted;
35
- }
36
- }
37
- function slotCommandContext(context, identity) {
38
- const suffix = safe(identity);
39
- return {
40
- ...context,
41
- commandId: `${context.commandId}:${suffix}`,
42
- correlationId: correlationId(`${context.correlationId}:${suffix}`),
43
- };
44
- }
45
- function safe(value) {
46
- return value.toLowerCase().replace(/[^a-z0-9-]/g, '-');
47
- }
@@ -1,8 +0,0 @@
1
- import type { ScheduleConfig } from '../contracts/config.js';
2
- export interface ScheduleSlot {
3
- readonly identity: string;
4
- readonly at: string;
5
- }
6
- export declare class SchedulePolicy {
7
- elapsedSlots(config: ScheduleConfig, now: string, checkpoint: string | null): readonly ScheduleSlot[];
8
- }