@exaudeus/workrail 1.17.1 → 2.0.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.
package/README.md CHANGED
@@ -31,8 +31,8 @@ to conclusions.
31
31
  WorkRail replaces the human effort of guiding an agent step-by-step.
32
32
 
33
33
  Instead of one system prompt that fades over time, WorkRail drip-feeds instructions through
34
- the [Model Context Protocol](https://modelcontextprotocol.org). The agent calls `workflow_next`,
35
- gets ONE step, completes it, calls again. Future steps stay hidden until previous ones are done.
34
+ the [Model Context Protocol](https://modelcontextprotocol.org). The agent calls `start_workflow`,
35
+ gets the first step, completes it, calls `continue_workflow`. Future steps stay hidden until previous ones are done.
36
36
 
37
37
  **The agent can't skip to implementation because it doesn't know those steps exist yet.**
38
38
 
@@ -44,7 +44,7 @@ You Agent WorkRail
44
44
  │ "Fix the auth bug" │ │
45
45
  │────────────────────────>│ │
46
46
  │ │ │
47
- │ │ workflow_next()
47
+ │ │ start_workflow()
48
48
  │ │─────────────────────────>│
49
49
  │ │ │
50
50
  │ │ Step 1: Understand │
@@ -55,7 +55,7 @@ You Agent WorkRail
55
55
  │ see exactly?" │ │
56
56
  │<────────────────────────│ │
57
57
  │ │ │
58
- │ ... │ workflow_next()
58
+ │ ... │ continue_workflow()
59
59
  │ │─────────────────────────>│
60
60
  │ │ │
61
61
  │ │ Step 2: Plan your │
@@ -81,21 +81,21 @@ Agent: "I see the issue! In auth.js line 42, there's a null check that
81
81
  You: "There's a bug in the auth flow"
82
82
 
83
83
  Agent: "I'll use the bug-investigation workflow."
84
- workflow_next()
84
+ start_workflow()
85
85
 
86
86
  Step 1: Investigation Setup
87
87
  "Before I investigate, I need to understand the problem.
88
88
  What exactly happens when it fails? Can you share the error?"
89
89
 
90
90
  [Documents bug, reproduction steps, environment]
91
- workflow_next()
91
+ continue_workflow()
92
92
 
93
93
  Step 2: Plan Investigation
94
94
  "I'll trace execution from login through the auth middleware.
95
95
  Key areas: token validation, session lookup, error handling."
96
96
 
97
97
  [Creates investigation plan before touching code]
98
- workflow_next()
98
+ continue_workflow()
99
99
 
100
100
  Step 3: Form Hypotheses
101
101
  "Based on my analysis, three possible causes:
@@ -164,13 +164,13 @@ The agent will find the workflow, start at step 1, and proceed systematically.
164
164
 
165
165
  ## Included Workflows
166
166
 
167
- 20+ workflows included for development, debugging, review, documentation, and more:
167
+ 30+ workflows included for development, debugging, review, documentation, and more:
168
168
 
169
169
  | Workflow | When to Use |
170
170
  |----------|-------------|
171
- | `coding-task-workflow-with-loops` | Feature development with analysis, planning, and review |
172
- | `bug-investigation` | Systematic debugging with hypothesis testing |
173
- | `mr-review-workflow` | Code review with architecture and security checks |
171
+ | `coding-task-workflow-agentic` | Feature development with notes-first durability and audit loops |
172
+ | `bug-investigation-agentic` | Systematic debugging with evidence-based analysis |
173
+ | `mr-review-workflow-agentic` | Code review with parallel reviewer families |
174
174
  | `exploration-workflow` | Understanding an unfamiliar codebase |
175
175
  | `document-creation-workflow` | Technical documentation with structure |
176
176
 
@@ -56,10 +56,10 @@ exports.FEATURE_FLAG_DEFINITIONS = [
56
56
  {
57
57
  key: 'v2Tools',
58
58
  envVar: 'WORKRAIL_ENABLE_V2_TOOLS',
59
- defaultValue: false,
60
- description: 'Enable WorkRail v2 MCP tools and .v2.json workflow overrides behind an explicit opt-in flag',
59
+ defaultValue: true,
60
+ description: 'WorkRail v2 MCP tools (list_workflows, start_workflow, continue_workflow, checkpoint_workflow, resume_session) and .v2.json workflow overrides',
61
61
  since: '0.9.0',
62
- stable: false,
62
+ stable: true,
63
63
  },
64
64
  ];
65
65
  function parseBoolean(value, defaultValue) {
@@ -326,8 +326,8 @@
326
326
  "bytes": 1512
327
327
  },
328
328
  "config/feature-flags.js": {
329
- "sha256": "c7c5a4db2a0d5f86a9cf91c9a7e2c74f89ce7f1012b93c8237a3d70a783d2b45",
330
- "bytes": 6908
329
+ "sha256": "d8a709e0814b4d9bd9565b795c7b932fbab1d86762b437f7ed64be8e97a99598",
330
+ "bytes": 6957
331
331
  },
332
332
  "core/error-handler.d.ts": {
333
333
  "sha256": "80451f12ac8e185133ec3dc4c57285491a785f27525ed21e729db1da3f61010d",
@@ -770,12 +770,12 @@
770
770
  "bytes": 12661
771
771
  },
772
772
  "mcp/handlers/v2-execution/start.d.ts": {
773
- "sha256": "333f9f36756d2ce55249c6af45198a17b51aa9c6448e063f7621fcd61879f2bf",
774
- "bytes": 2684
773
+ "sha256": "ec0a9cbe95eba29cbf4f66c7fbacd10209b451e9e0a3e15bf92cbc751ef5b0c2",
774
+ "bytes": 2868
775
775
  },
776
776
  "mcp/handlers/v2-execution/start.js": {
777
- "sha256": "0c6800d22f93a36b45236d17993b445de131e00a72eac8dbd98e2f4d8d9f2b29",
778
- "bytes": 15208
777
+ "sha256": "fa724a733b2f249bcd9300d79f4f5d20fa155f005a2d9837f16f50b44bfd106c",
778
+ "bytes": 16250
779
779
  },
780
780
  "mcp/handlers/v2-resume.d.ts": {
781
781
  "sha256": "d88f6c35bcaf946666c837b72fda3702a2ebab5e478eb90f7b4b672a0e5fa24f",
@@ -846,8 +846,8 @@
846
846
  "bytes": 882
847
847
  },
848
848
  "mcp/server.js": {
849
- "sha256": "5086b482d2eb3c42caac637282a5361b4db6e5d14aaeeb7c5ffdf75d211af0d8",
850
- "bytes": 13422
849
+ "sha256": "c07f8a6e8f89f7620a063673859dcc458212b068237949acff253f15856afd5f",
850
+ "bytes": 14174
851
851
  },
852
852
  "mcp/tool-description-provider.d.ts": {
853
853
  "sha256": "1d46abc3112e11b68e57197e846f5708293ec9b2281fa71a9124ee2aad71e41b",
@@ -914,8 +914,8 @@
914
914
  "bytes": 747
915
915
  },
916
916
  "mcp/types.d.ts": {
917
- "sha256": "2ef7f9c1bffbe365b06469dfad43b45c4ae3b5292dd269b33423bf1c8c9c7c43",
918
- "bytes": 4355
917
+ "sha256": "d61a7d2b9a5f389d9fbf0092f6d38c3e6bb2925f41dce0270ed0c2e54ca856c9",
918
+ "bytes": 4533
919
919
  },
920
920
  "mcp/types.js": {
921
921
  "sha256": "d10c4070e4c3454d80f0fa9cdc0e978c69c53c13fd09baa8710fcd802fed8926",
@@ -6,6 +6,7 @@ import { type SessionId, type RunId, type NodeId, type WorkflowHash } from '../.
6
6
  import type { Sha256PortV2 } from '../../../v2/ports/sha256.port.js';
7
7
  import type { TokenCodecPorts } from '../../../v2/durable-core/tokens/token-codec-ports.js';
8
8
  import { ResultAsync as RA } from 'neverthrow';
9
+ import { type ValidationPipelineDepsPhase1a } from '../../../application/services/workflow-validation-pipeline.js';
9
10
  import { type ObservationEventData } from '../../../v2/durable-core/domain/observation-builder.js';
10
11
  import { type StartWorkflowError } from '../v2-execution-helpers.js';
11
12
  import * as z from 'zod';
@@ -14,6 +15,7 @@ export declare function loadAndPinWorkflow(args: {
14
15
  readonly workflowService: import('../../../application/services/workflow-service.js').WorkflowService;
15
16
  readonly crypto: Sha256PortV2;
16
17
  readonly pinnedStore: import('../../../v2/ports/pinned-workflow-store.port.js').PinnedWorkflowStorePortV2;
18
+ readonly validationPipelineDeps: ValidationPipelineDepsPhase1a;
17
19
  }): RA<{
18
20
  readonly workflow: import('../../../types/workflow.js').Workflow;
19
21
  readonly workflowHash: WorkflowHash;
@@ -10,7 +10,7 @@ const workflow_js_1 = require("../../../types/workflow.js");
10
10
  const index_js_1 = require("../../../v2/durable-core/ids/index.js");
11
11
  const workflow_hash_ref_js_1 = require("../../../v2/durable-core/ids/workflow-hash-ref.js");
12
12
  const neverthrow_1 = require("neverthrow");
13
- const v1_to_v2_shim_js_1 = require("../../../v2/read-only/v1-to-v2-shim.js");
13
+ const workflow_validation_pipeline_js_1 = require("../../../application/services/workflow-validation-pipeline.js");
14
14
  const hashing_js_1 = require("../../../v2/durable-core/canonical/hashing.js");
15
15
  const observation_builder_js_1 = require("../../../v2/durable-core/domain/observation-builder.js");
16
16
  const workflow_source_js_1 = require("../../../types/workflow-source.js");
@@ -24,7 +24,7 @@ const constants_js_1 = require("../../../v2/durable-core/constants.js");
24
24
  const index_js_2 = require("./index.js");
25
25
  const start_construction_js_1 = require("../../../v2/durable-core/domain/start-construction.js");
26
26
  function loadAndPinWorkflow(args) {
27
- const { workflowId, workflowService, crypto, pinnedStore } = args;
27
+ const { workflowId, workflowService, crypto, pinnedStore, validationPipelineDeps } = args;
28
28
  return neverthrow_1.ResultAsync.fromPromise(workflowService.getWorkflowById(workflowId), (e) => ({
29
29
  kind: 'precondition_failed',
30
30
  message: e instanceof Error ? e.message : String(e),
@@ -39,14 +39,25 @@ function loadAndPinWorkflow(args) {
39
39
  return (0, neverthrow_1.okAsync)({ workflow });
40
40
  })
41
41
  .andThen(({ workflow }) => {
42
- const normalizeResult = (0, v1_to_v2_shim_js_1.normalizeV1WorkflowToPinnedSnapshot)(workflow);
43
- if (normalizeResult.isErr()) {
42
+ const pipelineOutcome = (0, workflow_validation_pipeline_js_1.validateWorkflowPhase1a)(workflow, validationPipelineDeps);
43
+ if (pipelineOutcome.kind !== 'phase1a_valid') {
44
+ const message = pipelineOutcome.kind === 'schema_failed'
45
+ ? `Schema validation failed: ${pipelineOutcome.errors.map(e => e.message ?? e.instancePath).join('; ')}`
46
+ : pipelineOutcome.kind === 'structural_failed'
47
+ ? `Structural validation failed: ${pipelineOutcome.issues.join('; ')}`
48
+ : pipelineOutcome.kind === 'v1_compilation_failed'
49
+ ? `Compilation failed: ${pipelineOutcome.cause.message}`
50
+ : pipelineOutcome.kind === 'normalization_failed'
51
+ ? `Normalization failed: ${pipelineOutcome.cause.message}`
52
+ : pipelineOutcome.kind === 'executable_compilation_failed'
53
+ ? `Executable compilation failed: ${pipelineOutcome.cause.message}`
54
+ : 'Unknown validation failure';
44
55
  return (0, neverthrow_1.errAsync)({
45
56
  kind: 'workflow_compile_failed',
46
- message: normalizeResult.error.message,
57
+ message,
47
58
  });
48
59
  }
49
- const compiled = normalizeResult.value;
60
+ const compiled = pipelineOutcome.snapshot;
50
61
  const workflowHashRes = (0, hashing_js_1.workflowHashForCompiledSnapshot)(compiled, crypto);
51
62
  if (workflowHashRes.isErr()) {
52
63
  return (0, neverthrow_1.errAsync)({ kind: 'hash_computation_failed', message: workflowHashRes.error.message });
@@ -215,12 +226,13 @@ function mintStartTokens(args) {
215
226
  });
216
227
  }
217
228
  function executeStartWorkflow(input, ctx) {
218
- const { gate, sessionStore, snapshotStore, pinnedStore, crypto, tokenCodecPorts, idFactory } = ctx.v2;
229
+ const { gate, sessionStore, snapshotStore, pinnedStore, crypto, tokenCodecPorts, idFactory, validationPipelineDeps } = ctx.v2;
219
230
  return loadAndPinWorkflow({
220
231
  workflowId: input.workflowId,
221
232
  workflowService: ctx.workflowService,
222
233
  crypto,
223
234
  pinnedStore,
235
+ validationPipelineDeps,
224
236
  })
225
237
  .andThen(({ workflow, firstStep, workflowHash, pinnedWorkflow }) => {
226
238
  const anchorsRA = (0, v2_workspace_resolution_js_1.resolveWorkspaceAnchors)(ctx.v2, input.workspacePath)
@@ -41,6 +41,8 @@ const container_js_1 = require("../di/container.js");
41
41
  const tokens_js_1 = require("../di/tokens.js");
42
42
  const assert_never_js_1 = require("../runtime/assert-never.js");
43
43
  const token_codec_ports_js_1 = require("../v2/durable-core/tokens/token-codec-ports.js");
44
+ const validation_js_1 = require("../application/validation.js");
45
+ const v1_to_v2_shim_js_1 = require("../v2/read-only/v1-to-v2-shim.js");
44
46
  const index_js_1 = require("../v2/infra/local/workspace-anchor/index.js");
45
47
  const workspace_roots_manager_js_1 = require("./workspace-roots-manager.js");
46
48
  const index_js_2 = require("../v2/infra/local/directory-listing/index.js");
@@ -94,6 +96,14 @@ async function createToolContext() {
94
96
  const dataDir = container_js_1.container.resolve(tokens_js_1.DI.V2.DataDir);
95
97
  const fsPort = container_js_1.container.resolve(tokens_js_1.DI.V2.FileSystem);
96
98
  const directoryListing = new index_js_2.LocalDirectoryListingV2(fsPort);
99
+ const validationEngine = container_js_1.container.resolve(tokens_js_1.DI.Infra.ValidationEngine);
100
+ const compiler = container_js_1.container.resolve(tokens_js_1.DI.Services.WorkflowCompiler);
101
+ const validationPipelineDeps = {
102
+ schemaValidate: validation_js_1.validateWorkflowSchema,
103
+ structuralValidate: validationEngine.validateWorkflowStructureOnly.bind(validationEngine),
104
+ compiler,
105
+ normalizeToExecutable: v1_to_v2_shim_js_1.normalizeV1WorkflowToPinnedSnapshot,
106
+ };
97
107
  v2 = {
98
108
  gate,
99
109
  sessionStore,
@@ -103,6 +113,7 @@ async function createToolContext() {
103
113
  crypto,
104
114
  idFactory,
105
115
  tokenCodecPorts,
116
+ validationPipelineDeps,
106
117
  resolvedRootUris: [],
107
118
  workspaceResolver: new index_js_1.LocalWorkspaceAnchorV2(process.cwd()),
108
119
  dataDir,
@@ -16,6 +16,7 @@ import type { WorkspaceContextResolverPortV2 } from '../v2/ports/workspace-ancho
16
16
  import type { DataDirPortV2 } from '../v2/ports/data-dir.port.js';
17
17
  import type { DirectoryListingPortV2 } from '../v2/ports/directory-listing.port.js';
18
18
  import type { SessionSummaryProviderPortV2 } from '../v2/ports/session-summary-provider.port.js';
19
+ import type { ValidationPipelineDepsPhase1a } from '../application/services/workflow-validation-pipeline.js';
19
20
  export interface SessionHealthDetails {
20
21
  readonly health: SessionHealthV2;
21
22
  }
@@ -55,6 +56,7 @@ export interface V2Dependencies {
55
56
  readonly crypto: CryptoPortV2;
56
57
  readonly idFactory: IdFactoryV2;
57
58
  readonly tokenCodecPorts: TokenCodecPorts;
59
+ readonly validationPipelineDeps: ValidationPipelineDepsPhase1a;
58
60
  readonly resolvedRootUris?: readonly string[];
59
61
  readonly workspaceResolver?: WorkspaceContextResolverPortV2;
60
62
  readonly dataDir?: DataDirPortV2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exaudeus/workrail",
3
- "version": "1.17.1",
3
+ "version": "2.0.0",
4
4
  "description": "Step-by-step workflow enforcement for AI agents via MCP",
5
5
  "license": "MIT",
6
6
  "repository": {