@atolis-hq/wake 0.4.84 → 0.4.85

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.
@@ -41,6 +41,7 @@ export interface CompositionRootOptions {
41
41
  readonly fakeDeliveryProvider?: DurableFakeDeliveryProvider;
42
42
  }
43
43
  export interface CompositionRoot {
44
+ readonly workflowNotices: readonly string[];
44
45
  readonly triggers: TriggerService;
45
46
  readonly config: ResolvedWakeModulesConfig;
46
47
  readonly fakeScenarios: FakeScenarioResolver;
@@ -54,9 +54,13 @@ export async function createCompositionRoot(wakeRoot, options = {}) {
54
54
  publicUiUrl: config.surfaces.web.publicUrl,
55
55
  githubAdapters: githubAdapters(config),
56
56
  }, conversations));
57
+ const workflowNotices = [];
57
58
  const definitions = Object.fromEntries(Object.entries(config.orchestration.workflows).map(([name, definition]) => [
58
59
  name,
59
- compileWorkflow(name, definition, activities, Object.keys(config.orchestration.workflows)),
60
+ compileWorkflow(name, definition, activities, Object.keys(config.orchestration.workflows), (diagnostic) => {
61
+ workflowNotices.push(diagnostic.message);
62
+ process.stderr.write(`Warning: ${diagnostic.message}\n`);
63
+ }),
60
64
  ]));
61
65
  const orchestration = createOrchestrationService(journal, work, definitions, projections, createAgentActivityClassifier(activities));
62
66
  const workspaces = new GitWorkspaceProvider(paths.workspacesRoot, {
@@ -196,6 +200,7 @@ export async function createCompositionRoot(wakeRoot, options = {}) {
196
200
  });
197
201
  processorRuntime.register([activationSchedulerSubscriber.processor, ...runtime.processors]);
198
202
  return {
203
+ workflowNotices,
199
204
  config,
200
205
  fakeScenarios,
201
206
  paths,
@@ -95,12 +95,18 @@ workflows:
95
95
  with: { template: refine }
96
96
  execution: { workspace: read-only, runnerPool: light }
97
97
  on:
98
+ rejected: { then: await-human }
99
+ blocked: { then: await-human }
100
+ failed: { then: await-human }
98
101
  done: { then: implement }
99
102
  implement:
100
103
  activity: agent
101
104
  with: { template: implement }
102
105
  execution: { workspace: branch, runnerPool: standard }
103
106
  on:
107
+ rejected: { then: await-human }
108
+ blocked: { then: await-human }
109
+ failed: { then: await-human }
104
110
  done: { then: done }
105
111
  approval:
106
112
  entry: refine
@@ -110,6 +116,9 @@ workflows:
110
116
  with: { template: refine }
111
117
  execution: { workspace: read-only, runnerPool: light }
112
118
  on:
119
+ rejected: { then: await-human }
120
+ blocked: { then: await-human }
121
+ failed: { then: await-human }
113
122
  done:
114
123
  then: implement
115
124
  await:
@@ -120,6 +129,9 @@ workflows:
120
129
  with: { template: implement }
121
130
  execution: { workspace: branch, runnerPool: standard }
122
131
  on:
132
+ rejected: { then: await-human }
133
+ blocked: { then: await-human }
134
+ failed: { then: await-human }
123
135
  done: { then: done }`;
124
136
  // Frontmatter is limited to model/maxTurns/allowedTools/extraArgs (see
125
137
  // execution/infrastructure/prompt-templates.ts). The scaffold bodies use
@@ -660,7 +660,7 @@ function spawnDocker(arguments_, onChunk, cwd, options) {
660
660
  }
661
661
  async function doctorDiagnostics(root) {
662
662
  const failures = [];
663
- const notices = [];
663
+ const notices = [...root.workflowNotices];
664
664
  const templates = new Map();
665
665
  try {
666
666
  createRunnerRegistry(root.config.execution, root.fakeScenarios).resolve(root.config.execution.defaultRunnerPool);
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
124
124
  return `g${headHash.slice(0, 7)}`;
125
125
  return '0.1.0-dev';
126
126
  }
127
- export const wakeVersion = "v0.4.84";
127
+ export const wakeVersion = "v0.4.85";
128
128
  /** The registry-installable version used by packaged sandbox images. */
129
129
  export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
@@ -0,0 +1,4 @@
1
+ import { type ActivityRegistry } from '../../activities/index.js';
2
+ import type { CompiledSupplementalCommand, WorkflowDefinitionConfig } from '../contracts/config.js';
3
+ import { commandName } from '../contracts/identifiers.js';
4
+ export declare function compileCommands(config: WorkflowDefinitionConfig, activities: ActivityRegistry): Record<ReturnType<typeof commandName>, CompiledSupplementalCommand>;
@@ -0,0 +1,12 @@
1
+ import { activityName } from '../../activities/index.js';
2
+ import { commandName } from '../contracts/identifiers.js';
3
+ export function compileCommands(config, activities) {
4
+ return Object.fromEntries(Object.entries(config.commands ?? {}).map(([command, configured]) => [
5
+ commandName(command),
6
+ Object.freeze({
7
+ activity: activityName(configured.activity),
8
+ with: activities.validateInput(activityName(configured.activity), configured.with),
9
+ allowedActors: Object.freeze([...configured.allowedActors]),
10
+ }),
11
+ ]));
12
+ }
@@ -0,0 +1,10 @@
1
+ import type { ActivityRegistry } from '../../activities/index.js';
2
+ import type { CompiledStage } from '../contracts/config.js';
3
+ import type { StageName } from '../contracts/identifiers.js';
4
+ export interface WorkflowCompileDiagnostic {
5
+ readonly workflow: string;
6
+ readonly stage: string;
7
+ readonly outcome: string;
8
+ readonly message: string;
9
+ }
10
+ export declare function reportUnroutedOutcomes(workflow: string, stages: Readonly<Record<StageName, CompiledStage>>, activities: ActivityRegistry, report: (diagnostic: WorkflowCompileDiagnostic) => void): void;
@@ -0,0 +1,14 @@
1
+ export function reportUnroutedOutcomes(workflow, stages, activities, report) {
2
+ for (const [stage, configured] of Object.entries(stages)) {
3
+ for (const outcome of activities.describe(configured.activity).outcomeKinds) {
4
+ if (Object.hasOwn(configured.on, outcome))
5
+ continue;
6
+ report({
7
+ workflow,
8
+ stage,
9
+ outcome,
10
+ message: `Workflow "${workflow}" stage "${stage}": declared outcome "${outcome}" has no route.`,
11
+ });
12
+ }
13
+ }
14
+ }
@@ -1,3 +1,4 @@
1
1
  import { type ActivityRegistry } from '../../activities/index.js';
2
2
  import { type CompiledWorkflow } from '../contracts/config.js';
3
- export declare function compileWorkflow(name: string, input: unknown, activities: ActivityRegistry, knownWorkflowNames?: readonly string[]): CompiledWorkflow;
3
+ import { type WorkflowCompileDiagnostic } from './compile-diagnostics.js';
4
+ export declare function compileWorkflow(name: string, input: unknown, activities: ActivityRegistry, knownWorkflowNames?: readonly string[], reportDiagnostic?: (diagnostic: WorkflowCompileDiagnostic) => void): CompiledWorkflow;
@@ -1,12 +1,14 @@
1
1
  import { ActivityEventType, ActivityExecutionKind, activityName, ActivityOutcomeKind, } from '../../activities/index.js';
2
2
  import { workflowDefinitionConfigSchema, } from '../contracts/config.js';
3
- import { commandName, signalName, stageName, watchId, workflowName, } from '../contracts/identifiers.js';
3
+ import { signalName, stageName, watchId, workflowName, } from '../contracts/identifiers.js';
4
4
  import { ApprovalAuthorityKind, TransitionTargetKind } from '../contracts/vocabulary.js';
5
5
  import { defaultApprovalAwait } from './approval-defaults.js';
6
+ import { compileCommands } from './command-compiler.js';
7
+ import { reportUnroutedOutcomes } from './compile-diagnostics.js';
6
8
  import { compileResourceTransitions } from './resource-transition-compiler.js';
7
9
  import { compileTarget, isReservedRouteTarget, isReservedTerminalTarget, } from './transition-target.js';
8
10
  import { assertCyclesBounded, assertReachable, remainingAgentSteps } from './workflow-graph.js';
9
- export function compileWorkflow(name, input, activities, knownWorkflowNames = [name]) {
11
+ export function compileWorkflow(name, input, activities, knownWorkflowNames = [name], reportDiagnostic = () => { }) {
10
12
  const compiledName = workflowName(name);
11
13
  const config = workflowDefinitionConfigSchema.parse(input);
12
14
  const rawStageNames = Object.keys(config.stages);
@@ -25,6 +27,7 @@ export function compileWorkflow(name, input, activities, knownWorkflowNames = [n
25
27
  const watches = compileWatches(config, rawStageNames, knownWorkflowNames);
26
28
  assertReachable(compiledEntry, stages);
27
29
  assertCyclesBounded(stages);
30
+ reportUnroutedOutcomes(name, stages, activities, reportDiagnostic);
28
31
  return Object.freeze({
29
32
  remainingAgentSteps: Object.freeze(remainingAgentSteps(stages, (activity) => activities.describe(activity).executionKind === ActivityExecutionKind.Agent)),
30
33
  name: compiledName,
@@ -173,13 +176,3 @@ function compileAuthority(workflow, rawStageName, entry, declaredWatchIds) {
173
176
  throw new Error(`Unknown watch reference in workflow "${workflow}" stage "${rawStageName}": "${entry.id}"`);
174
177
  return { kind: ApprovalAuthorityKind.Watch, watch: watchId(entry.id) };
175
178
  }
176
- function compileCommands(config, activities) {
177
- return Object.fromEntries(Object.entries(config.commands ?? {}).map(([command, configured]) => [
178
- commandName(command),
179
- Object.freeze({
180
- activity: activityName(configured.activity),
181
- with: activities.validateInput(activityName(configured.activity), configured.with),
182
- allowedActors: Object.freeze([...configured.allowedActors]),
183
- }),
184
- ]));
185
- }
@@ -31,3 +31,4 @@ export * from './domain/interpreter.js';
31
31
  export * from './domain/workflow-instance.js';
32
32
  export * from './domain/workflow-selector.js';
33
33
  export * from './application/work-completion-summary.js';
34
+ export type { WorkflowCompileDiagnostic } from './domain/compile-diagnostics.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/wake",
3
- "version": "0.4.84",
3
+ "version": "0.4.85",
4
4
  "description": "Local autonomous agent control plane for software development",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {