@exaudeus/workrail 3.5.0 → 3.6.0

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 (44) hide show
  1. package/dist/application/services/validation-engine.js +50 -0
  2. package/dist/config/feature-flags.js +8 -0
  3. package/dist/engine/engine-factory.js +4 -2
  4. package/dist/manifest.json +100 -52
  5. package/dist/mcp/handler-factory.js +21 -4
  6. package/dist/mcp/handlers/v2-execution/continue-rehydrate.d.ts +6 -1
  7. package/dist/mcp/handlers/v2-execution/continue-rehydrate.js +22 -4
  8. package/dist/mcp/handlers/v2-execution/index.d.ts +6 -1
  9. package/dist/mcp/handlers/v2-execution/index.js +13 -3
  10. package/dist/mcp/handlers/v2-execution/start.d.ts +9 -1
  11. package/dist/mcp/handlers/v2-execution/start.js +74 -36
  12. package/dist/mcp/handlers/v2-execution-helpers.d.ts +2 -0
  13. package/dist/mcp/handlers/v2-execution-helpers.js +2 -0
  14. package/dist/mcp/handlers/v2-reference-resolver.d.ts +14 -0
  15. package/dist/mcp/handlers/v2-reference-resolver.js +112 -0
  16. package/dist/mcp/handlers/v2-resolve-refs-envelope.d.ts +5 -0
  17. package/dist/mcp/handlers/v2-resolve-refs-envelope.js +17 -0
  18. package/dist/mcp/handlers/v2-workflow.js +2 -0
  19. package/dist/mcp/output-schemas.d.ts +38 -0
  20. package/dist/mcp/output-schemas.js +8 -0
  21. package/dist/mcp/render-envelope.d.ts +21 -0
  22. package/dist/mcp/render-envelope.js +59 -0
  23. package/dist/mcp/response-supplements.d.ts +17 -0
  24. package/dist/mcp/response-supplements.js +58 -0
  25. package/dist/mcp/step-content-envelope.d.ts +32 -0
  26. package/dist/mcp/step-content-envelope.js +13 -0
  27. package/dist/mcp/v2-response-formatter.d.ts +11 -1
  28. package/dist/mcp/v2-response-formatter.js +168 -1
  29. package/dist/mcp/workflow-protocol-contracts.js +9 -7
  30. package/dist/types/workflow-definition.d.ts +16 -0
  31. package/dist/types/workflow-definition.js +1 -0
  32. package/dist/utils/condition-evaluator.d.ts +1 -0
  33. package/dist/utils/condition-evaluator.js +7 -0
  34. package/dist/v2/durable-core/domain/context-template-resolver.d.ts +2 -0
  35. package/dist/v2/durable-core/domain/context-template-resolver.js +26 -0
  36. package/dist/v2/durable-core/domain/prompt-renderer.d.ts +2 -0
  37. package/dist/v2/durable-core/domain/prompt-renderer.js +93 -15
  38. package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +256 -0
  39. package/dist/v2/durable-core/schemas/compiled-workflow/index.js +30 -0
  40. package/package.json +4 -1
  41. package/spec/authoring-spec.provenance.json +77 -0
  42. package/spec/authoring-spec.schema.json +370 -0
  43. package/workflows/coding-task-workflow-agentic.lean.v2.json +132 -30
  44. package/workflows/workflow-for-workflows.json +27 -1
@@ -53,6 +53,82 @@ export declare const CompiledWorkflowSnapshotV1Schema: z.ZodDiscriminatedUnion<"
53
53
  definition: z.ZodType<unknown, z.ZodTypeDef, unknown>;
54
54
  resolvedBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
55
55
  pinnedOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
56
+ resolvedReferences: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
57
+ id: z.ZodString;
58
+ title: z.ZodString;
59
+ source: z.ZodString;
60
+ purpose: z.ZodString;
61
+ authoritative: z.ZodBoolean;
62
+ resolveFrom: z.ZodEnum<["workspace", "package"]>;
63
+ status: z.ZodLiteral<"resolved">;
64
+ resolvedPath: z.ZodString;
65
+ }, "strip", z.ZodTypeAny, {
66
+ status: "resolved";
67
+ id: string;
68
+ title: string;
69
+ source: string;
70
+ purpose: string;
71
+ authoritative: boolean;
72
+ resolveFrom: "workspace" | "package";
73
+ resolvedPath: string;
74
+ }, {
75
+ status: "resolved";
76
+ id: string;
77
+ title: string;
78
+ source: string;
79
+ purpose: string;
80
+ authoritative: boolean;
81
+ resolveFrom: "workspace" | "package";
82
+ resolvedPath: string;
83
+ }>, z.ZodObject<{
84
+ id: z.ZodString;
85
+ title: z.ZodString;
86
+ source: z.ZodString;
87
+ purpose: z.ZodString;
88
+ authoritative: z.ZodBoolean;
89
+ resolveFrom: z.ZodEnum<["workspace", "package"]>;
90
+ status: z.ZodLiteral<"unresolved">;
91
+ }, "strip", z.ZodTypeAny, {
92
+ status: "unresolved";
93
+ id: string;
94
+ title: string;
95
+ source: string;
96
+ purpose: string;
97
+ authoritative: boolean;
98
+ resolveFrom: "workspace" | "package";
99
+ }, {
100
+ status: "unresolved";
101
+ id: string;
102
+ title: string;
103
+ source: string;
104
+ purpose: string;
105
+ authoritative: boolean;
106
+ resolveFrom: "workspace" | "package";
107
+ }>, z.ZodObject<{
108
+ id: z.ZodString;
109
+ title: z.ZodString;
110
+ source: z.ZodString;
111
+ purpose: z.ZodString;
112
+ authoritative: z.ZodBoolean;
113
+ resolveFrom: z.ZodEnum<["workspace", "package"]>;
114
+ status: z.ZodLiteral<"pinned">;
115
+ }, "strip", z.ZodTypeAny, {
116
+ status: "pinned";
117
+ id: string;
118
+ title: string;
119
+ source: string;
120
+ purpose: string;
121
+ authoritative: boolean;
122
+ resolveFrom: "workspace" | "package";
123
+ }, {
124
+ status: "pinned";
125
+ id: string;
126
+ title: string;
127
+ source: string;
128
+ purpose: string;
129
+ authoritative: boolean;
130
+ resolveFrom: "workspace" | "package";
131
+ }>]>, "many">>;
56
132
  }, "strip", z.ZodTypeAny, {
57
133
  name: string;
58
134
  description: string;
@@ -63,6 +139,32 @@ export declare const CompiledWorkflowSnapshotV1Schema: z.ZodDiscriminatedUnion<"
63
139
  definition?: unknown;
64
140
  resolvedBindings?: Record<string, string> | undefined;
65
141
  pinnedOverrides?: Record<string, string> | undefined;
142
+ resolvedReferences?: ({
143
+ status: "resolved";
144
+ id: string;
145
+ title: string;
146
+ source: string;
147
+ purpose: string;
148
+ authoritative: boolean;
149
+ resolveFrom: "workspace" | "package";
150
+ resolvedPath: string;
151
+ } | {
152
+ status: "unresolved";
153
+ id: string;
154
+ title: string;
155
+ source: string;
156
+ purpose: string;
157
+ authoritative: boolean;
158
+ resolveFrom: "workspace" | "package";
159
+ } | {
160
+ status: "pinned";
161
+ id: string;
162
+ title: string;
163
+ source: string;
164
+ purpose: string;
165
+ authoritative: boolean;
166
+ resolveFrom: "workspace" | "package";
167
+ })[] | undefined;
66
168
  }, {
67
169
  name: string;
68
170
  description: string;
@@ -73,6 +175,32 @@ export declare const CompiledWorkflowSnapshotV1Schema: z.ZodDiscriminatedUnion<"
73
175
  definition?: unknown;
74
176
  resolvedBindings?: Record<string, string> | undefined;
75
177
  pinnedOverrides?: Record<string, string> | undefined;
178
+ resolvedReferences?: ({
179
+ status: "resolved";
180
+ id: string;
181
+ title: string;
182
+ source: string;
183
+ purpose: string;
184
+ authoritative: boolean;
185
+ resolveFrom: "workspace" | "package";
186
+ resolvedPath: string;
187
+ } | {
188
+ status: "unresolved";
189
+ id: string;
190
+ title: string;
191
+ source: string;
192
+ purpose: string;
193
+ authoritative: boolean;
194
+ resolveFrom: "workspace" | "package";
195
+ } | {
196
+ status: "pinned";
197
+ id: string;
198
+ title: string;
199
+ source: string;
200
+ purpose: string;
201
+ authoritative: boolean;
202
+ resolveFrom: "workspace" | "package";
203
+ })[] | undefined;
76
204
  }>]>;
77
205
  export type CompiledWorkflowSnapshotV1 = z.infer<typeof CompiledWorkflowSnapshotV1Schema>;
78
206
  export declare const CompiledWorkflowSnapshotSchema: z.ZodDiscriminatedUnion<"sourceKind", [z.ZodObject<{
@@ -129,6 +257,82 @@ export declare const CompiledWorkflowSnapshotSchema: z.ZodDiscriminatedUnion<"so
129
257
  definition: z.ZodType<unknown, z.ZodTypeDef, unknown>;
130
258
  resolvedBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
131
259
  pinnedOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
260
+ resolvedReferences: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
261
+ id: z.ZodString;
262
+ title: z.ZodString;
263
+ source: z.ZodString;
264
+ purpose: z.ZodString;
265
+ authoritative: z.ZodBoolean;
266
+ resolveFrom: z.ZodEnum<["workspace", "package"]>;
267
+ status: z.ZodLiteral<"resolved">;
268
+ resolvedPath: z.ZodString;
269
+ }, "strip", z.ZodTypeAny, {
270
+ status: "resolved";
271
+ id: string;
272
+ title: string;
273
+ source: string;
274
+ purpose: string;
275
+ authoritative: boolean;
276
+ resolveFrom: "workspace" | "package";
277
+ resolvedPath: string;
278
+ }, {
279
+ status: "resolved";
280
+ id: string;
281
+ title: string;
282
+ source: string;
283
+ purpose: string;
284
+ authoritative: boolean;
285
+ resolveFrom: "workspace" | "package";
286
+ resolvedPath: string;
287
+ }>, z.ZodObject<{
288
+ id: z.ZodString;
289
+ title: z.ZodString;
290
+ source: z.ZodString;
291
+ purpose: z.ZodString;
292
+ authoritative: z.ZodBoolean;
293
+ resolveFrom: z.ZodEnum<["workspace", "package"]>;
294
+ status: z.ZodLiteral<"unresolved">;
295
+ }, "strip", z.ZodTypeAny, {
296
+ status: "unresolved";
297
+ id: string;
298
+ title: string;
299
+ source: string;
300
+ purpose: string;
301
+ authoritative: boolean;
302
+ resolveFrom: "workspace" | "package";
303
+ }, {
304
+ status: "unresolved";
305
+ id: string;
306
+ title: string;
307
+ source: string;
308
+ purpose: string;
309
+ authoritative: boolean;
310
+ resolveFrom: "workspace" | "package";
311
+ }>, z.ZodObject<{
312
+ id: z.ZodString;
313
+ title: z.ZodString;
314
+ source: z.ZodString;
315
+ purpose: z.ZodString;
316
+ authoritative: z.ZodBoolean;
317
+ resolveFrom: z.ZodEnum<["workspace", "package"]>;
318
+ status: z.ZodLiteral<"pinned">;
319
+ }, "strip", z.ZodTypeAny, {
320
+ status: "pinned";
321
+ id: string;
322
+ title: string;
323
+ source: string;
324
+ purpose: string;
325
+ authoritative: boolean;
326
+ resolveFrom: "workspace" | "package";
327
+ }, {
328
+ status: "pinned";
329
+ id: string;
330
+ title: string;
331
+ source: string;
332
+ purpose: string;
333
+ authoritative: boolean;
334
+ resolveFrom: "workspace" | "package";
335
+ }>]>, "many">>;
132
336
  }, "strip", z.ZodTypeAny, {
133
337
  name: string;
134
338
  description: string;
@@ -139,6 +343,32 @@ export declare const CompiledWorkflowSnapshotSchema: z.ZodDiscriminatedUnion<"so
139
343
  definition?: unknown;
140
344
  resolvedBindings?: Record<string, string> | undefined;
141
345
  pinnedOverrides?: Record<string, string> | undefined;
346
+ resolvedReferences?: ({
347
+ status: "resolved";
348
+ id: string;
349
+ title: string;
350
+ source: string;
351
+ purpose: string;
352
+ authoritative: boolean;
353
+ resolveFrom: "workspace" | "package";
354
+ resolvedPath: string;
355
+ } | {
356
+ status: "unresolved";
357
+ id: string;
358
+ title: string;
359
+ source: string;
360
+ purpose: string;
361
+ authoritative: boolean;
362
+ resolveFrom: "workspace" | "package";
363
+ } | {
364
+ status: "pinned";
365
+ id: string;
366
+ title: string;
367
+ source: string;
368
+ purpose: string;
369
+ authoritative: boolean;
370
+ resolveFrom: "workspace" | "package";
371
+ })[] | undefined;
142
372
  }, {
143
373
  name: string;
144
374
  description: string;
@@ -149,5 +379,31 @@ export declare const CompiledWorkflowSnapshotSchema: z.ZodDiscriminatedUnion<"so
149
379
  definition?: unknown;
150
380
  resolvedBindings?: Record<string, string> | undefined;
151
381
  pinnedOverrides?: Record<string, string> | undefined;
382
+ resolvedReferences?: ({
383
+ status: "resolved";
384
+ id: string;
385
+ title: string;
386
+ source: string;
387
+ purpose: string;
388
+ authoritative: boolean;
389
+ resolveFrom: "workspace" | "package";
390
+ resolvedPath: string;
391
+ } | {
392
+ status: "unresolved";
393
+ id: string;
394
+ title: string;
395
+ source: string;
396
+ purpose: string;
397
+ authoritative: boolean;
398
+ resolveFrom: "workspace" | "package";
399
+ } | {
400
+ status: "pinned";
401
+ id: string;
402
+ title: string;
403
+ source: string;
404
+ purpose: string;
405
+ authoritative: boolean;
406
+ resolveFrom: "workspace" | "package";
407
+ })[] | undefined;
152
408
  }>]>;
153
409
  export type CompiledWorkflowSnapshot = CompiledWorkflowSnapshotV1;
@@ -26,6 +26,36 @@ const CompiledWorkflowSnapshotV1PinnedSchema = zod_1.z.object({
26
26
  definition: json_zod_js_1.JsonValueSchema,
27
27
  resolvedBindings: zod_1.z.record(zod_1.z.string()).optional(),
28
28
  pinnedOverrides: zod_1.z.record(zod_1.z.string()).optional(),
29
+ resolvedReferences: zod_1.z.array(zod_1.z.discriminatedUnion('status', [
30
+ zod_1.z.object({
31
+ id: zod_1.z.string().min(1),
32
+ title: zod_1.z.string().min(1),
33
+ source: zod_1.z.string().min(1),
34
+ purpose: zod_1.z.string().min(1),
35
+ authoritative: zod_1.z.boolean(),
36
+ resolveFrom: zod_1.z.enum(['workspace', 'package']),
37
+ status: zod_1.z.literal('resolved'),
38
+ resolvedPath: zod_1.z.string().min(1),
39
+ }),
40
+ zod_1.z.object({
41
+ id: zod_1.z.string().min(1),
42
+ title: zod_1.z.string().min(1),
43
+ source: zod_1.z.string().min(1),
44
+ purpose: zod_1.z.string().min(1),
45
+ authoritative: zod_1.z.boolean(),
46
+ resolveFrom: zod_1.z.enum(['workspace', 'package']),
47
+ status: zod_1.z.literal('unresolved'),
48
+ }),
49
+ zod_1.z.object({
50
+ id: zod_1.z.string().min(1),
51
+ title: zod_1.z.string().min(1),
52
+ source: zod_1.z.string().min(1),
53
+ purpose: zod_1.z.string().min(1),
54
+ authoritative: zod_1.z.boolean(),
55
+ resolveFrom: zod_1.z.enum(['workspace', 'package']),
56
+ status: zod_1.z.literal('pinned'),
57
+ }),
58
+ ])).optional(),
29
59
  });
30
60
  exports.CompiledWorkflowSnapshotV1Schema = zod_1.z.discriminatedUnion('sourceKind', [
31
61
  CompiledWorkflowSnapshotV1PreviewSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exaudeus/workrail",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "Step-by-step workflow enforcement for AI agents via MCP",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,6 +32,7 @@
32
32
  "console:build": "cd console && npm install && npm run build",
33
33
  "console:dev": "cd console && npm run dev",
34
34
  "build:all": "npm run build",
35
+ "docs:authoring": "node scripts/generate-authoring-docs.js",
35
36
  "docs:workflows": "node scripts/generate-workflow-docs.js",
36
37
  "generate:locks": "npx ts-node scripts/generate-lock-coverage.ts && npx ts-node scripts/generate-lock-coverage.ts --json",
37
38
  "verify:generated": "npm run generate:locks && git diff --exit-code -- docs/generated/v2-lock-coverage.json docs/generated/v2-lock-coverage.md docs/generated/v2-lock-closure-plan.md",
@@ -39,6 +40,8 @@
39
40
  "watch": "tsc --watch",
40
41
  "validate:workflows": "bash scripts/validate-workflows.sh",
41
42
  "validate:registry": "node scripts/validate-workflows-registry.ts",
43
+ "validate:authoring-spec": "node scripts/validate-authoring-spec.js",
44
+ "validate:authoring-docs": "node scripts/generate-authoring-docs.js --check",
42
45
  "validate:workflow-discovery": "node scripts/validate-workflow-discovery.js",
43
46
  "precommit": "npm run validate:registry",
44
47
  "preinstall": "node -e \"const v=parseInt(process.versions.node.split('.')[0],10); if(v<20){console.error('WorkRail requires Node.js >=20. Current: '+process.versions.node+'\\nPlease upgrade: https://nodejs.org/'); process.exit(1);}\"",
@@ -0,0 +1,77 @@
1
+ {
2
+ "version": 1,
3
+ "title": "WorkRail Authoring Spec Provenance",
4
+ "purpose": "Maintainer-facing provenance and source hierarchy for authoring-spec.json.",
5
+ "canonicalSources": [
6
+ {
7
+ "path": "spec/workflow.schema.json",
8
+ "role": "Legal workflow structure"
9
+ },
10
+ {
11
+ "path": "src/application/services/validation-engine.ts",
12
+ "role": "Structural authoring invariants actually enforced"
13
+ },
14
+ {
15
+ "path": "src/infrastructure/storage/schema-validating-workflow-storage.ts",
16
+ "role": "Runtime-authoritative schema validation"
17
+ },
18
+ {
19
+ "path": "scripts/validate-workflows-registry.ts",
20
+ "role": "Registry and discoverability validation"
21
+ },
22
+ {
23
+ "path": "src/v2/durable-core/domain/prompt-renderer.ts",
24
+ "role": "Runtime prompt rendering and prompt composition behavior"
25
+ }
26
+ ],
27
+ "secondarySources": [
28
+ {
29
+ "path": "docs/design/workflow-authoring-v2.md",
30
+ "role": "Design intent and model rationale"
31
+ },
32
+ {
33
+ "path": "docs/authoring-v2.md",
34
+ "role": "High-level v2 authoring guidance"
35
+ },
36
+ {
37
+ "path": "docs/authoring.md",
38
+ "role": "Human-readable guide"
39
+ },
40
+ {
41
+ "path": "docs/workflow-validation.md",
42
+ "role": "Practical validation workflow"
43
+ },
44
+ {
45
+ "path": "docs/reference/god-tier-workflow-validation.md",
46
+ "role": "Validation philosophy and correctness bar"
47
+ },
48
+ {
49
+ "path": "workflows/coding-task-workflow-agentic.lean.v2.json",
50
+ "role": "Current example of modern workflow style"
51
+ }
52
+ ],
53
+ "nonCanonicalSources": [
54
+ {
55
+ "path": "docs/plans/**",
56
+ "role": "Historical or supporting context only"
57
+ },
58
+ {
59
+ "path": "ADRs and transitional notes",
60
+ "role": "Historical or supporting context only"
61
+ }
62
+ ],
63
+ "derivedArtifacts": [
64
+ {
65
+ "path": "docs/authoring.md",
66
+ "role": "Primary human-readable guide derived from authoring-spec.json"
67
+ },
68
+ {
69
+ "path": "docs/authoring-v2.md",
70
+ "role": "Candidate for merge or retirement once coverage is preserved"
71
+ }
72
+ ],
73
+ "notes": [
74
+ "This file exists to keep provenance out of the main authoring rules file.",
75
+ "authoring-spec.json should stay author-facing and current-rule-focused."
76
+ ]
77
+ }