@exaudeus/workrail 3.13.0 → 3.14.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.
@@ -942,12 +942,12 @@
942
942
  "bytes": 22303
943
943
  },
944
944
  "mcp/handlers/v2-workflow.d.ts": {
945
- "sha256": "5c9590f121dd3708c516be3febe41d0be47531d643462b86b99b778ef0b54498",
946
- "bytes": 396
945
+ "sha256": "d2a6af1bc62630e62f10c9564c60b7f3e7d1ff0b4e6339416a6d6bfcd935ee53",
946
+ "bytes": 699
947
947
  },
948
948
  "mcp/handlers/v2-workflow.js": {
949
- "sha256": "e496675cf8ae2259e0c5a53692732a231fb4c923440214df4e54f696bb7ab734",
950
- "bytes": 16632
949
+ "sha256": "545ad0cafe58f42010db5e32be2cbb302d3d1fc989022e5803a0bce077cc91a1",
950
+ "bytes": 19047
951
951
  },
952
952
  "mcp/handlers/v2-workspace-resolution.d.ts": {
953
953
  "sha256": "dd4de57b4918ebe749cf8c1df70c02bf1effc50932634bae60db53c9a157e872",
@@ -974,12 +974,12 @@
974
974
  "bytes": 7991
975
975
  },
976
976
  "mcp/output-schemas.d.ts": {
977
- "sha256": "77c29cf4cc1500fccd383b8a725b3a4b30c7d1913ec31419b607b3e9f358f652",
978
- "bytes": 86643
977
+ "sha256": "8da92586db497fe2f37df296c3ac95751a6b326ceb0bd348f126b3a9f44515e5",
978
+ "bytes": 90073
979
979
  },
980
980
  "mcp/output-schemas.js": {
981
- "sha256": "692e8b71740b8b3f89a541b8bc57992ce1b4149b117c5e19d77988777e0b215e",
982
- "bytes": 19084
981
+ "sha256": "d3446f0480e80dd0c7030b42f66489e982b93b968700371cffcbf1fb8d0fed96",
982
+ "bytes": 19456
983
983
  },
984
984
  "mcp/render-envelope.d.ts": {
985
985
  "sha256": "22e83e1aba52968a7136cf289125a217b5f462a5a66a1eebe4669006e3326fdb",
@@ -1366,8 +1366,8 @@
1366
1366
  "bytes": 395
1367
1367
  },
1368
1368
  "types/workflow-definition.d.ts": {
1369
- "sha256": "052ef59dd8ee28dc2648eb5f30a60023af18bb92dcde9b0664cc035e42ca4f52",
1370
- "bytes": 5796
1369
+ "sha256": "683e5a939e0265f194a9a542d6c925222b090c5da5f9b94df07b0cf16ec40165",
1370
+ "bytes": 5847
1371
1371
  },
1372
1372
  "types/workflow-definition.js": {
1373
1373
  "sha256": "204e7500d3d0dc91b1716199efb89af4776fb488546661e809f76be9333ea65c",
@@ -1,4 +1,7 @@
1
1
  import type { ToolContext, ToolResult } from '../types.js';
2
2
  import type { V2InspectWorkflowInput, V2ListWorkflowsInput } from '../v2/tools.js';
3
+ import type { StalenessSummary } from '../output-schemas.js';
4
+ export declare function shouldShowStaleness(category: string | undefined, devMode?: boolean): boolean;
5
+ export declare function computeWorkflowStaleness(stamp: number | undefined, currentVersion: number | null): StalenessSummary | undefined;
3
6
  export declare function handleV2ListWorkflows(input: V2ListWorkflowsInput, ctx: ToolContext): Promise<ToolResult<unknown>>;
4
7
  export declare function handleV2InspectWorkflow(input: V2InspectWorkflowInput, ctx: ToolContext): Promise<ToolResult<unknown>>;
@@ -3,9 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.shouldShowStaleness = shouldShowStaleness;
7
+ exports.computeWorkflowStaleness = computeWorkflowStaleness;
6
8
  exports.handleV2ListWorkflows = handleV2ListWorkflows;
7
9
  exports.handleV2InspectWorkflow = handleV2InspectWorkflow;
8
10
  const path_1 = __importDefault(require("path"));
11
+ const fs_1 = __importDefault(require("fs"));
9
12
  const neverthrow_1 = require("neverthrow");
10
13
  const types_js_1 = require("../types.js");
11
14
  const error_mapper_js_1 = require("../error-mapper.js");
@@ -14,6 +17,51 @@ const output_schemas_js_1 = require("../output-schemas.js");
14
17
  const v1_to_v2_shim_js_1 = require("../../v2/read-only/v1-to-v2-shim.js");
15
18
  const hashing_js_1 = require("../../v2/durable-core/canonical/hashing.js");
16
19
  const TIMEOUT_MS = 30000;
20
+ function readCurrentSpecVersion() {
21
+ try {
22
+ const specPath = path_1.default.resolve(__dirname, '../../../spec/authoring-spec.json');
23
+ const raw = fs_1.default.readFileSync(specPath, 'utf-8');
24
+ const parsed = JSON.parse(raw);
25
+ if (typeof parsed === 'object' && parsed !== null && 'version' in parsed) {
26
+ const v = parsed['version'];
27
+ if (typeof v === 'number' && Number.isInteger(v) && v >= 1)
28
+ return v;
29
+ }
30
+ return null;
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ }
36
+ const CURRENT_SPEC_VERSION = readCurrentSpecVersion();
37
+ const DEV_STALENESS = process.env['WORKRAIL_DEV_STALENESS'] === '1';
38
+ function shouldShowStaleness(category, devMode = DEV_STALENESS) {
39
+ if (devMode)
40
+ return true;
41
+ return category === 'personal' || category === 'rooted_sharing' || category === 'external';
42
+ }
43
+ function computeWorkflowStaleness(stamp, currentVersion) {
44
+ if (currentVersion === null)
45
+ return undefined;
46
+ if (stamp === undefined) {
47
+ return {
48
+ level: 'possible',
49
+ reason: 'This workflow has not been validated against the authoring spec via workflow-for-workflows.',
50
+ };
51
+ }
52
+ if (stamp === currentVersion) {
53
+ return {
54
+ level: 'none',
55
+ reason: `Workflow validated against current authoring spec (v${currentVersion}).`,
56
+ specVersionAtLastReview: stamp,
57
+ };
58
+ }
59
+ return {
60
+ level: 'likely',
61
+ reason: `Authoring spec updated from v${stamp} to v${currentVersion} since this workflow was last reviewed.`,
62
+ specVersionAtLastReview: stamp,
63
+ };
64
+ }
17
65
  const with_timeout_js_1 = require("./shared/with-timeout.js");
18
66
  const request_workflow_reader_js_1 = require("./shared/request-workflow-reader.js");
19
67
  const remembered_roots_js_1 = require("./shared/remembered-roots.js");
@@ -142,6 +190,12 @@ async function handleV2InspectWorkflow(input, ctx) {
142
190
  ...(visibility ? { visibility } : {}),
143
191
  ...(stalePaths.length > 0 ? { staleRoots: [...stalePaths] } : {}),
144
192
  ...(references != null && references.length > 0 ? { references } : {}),
193
+ ...(() => {
194
+ const staleness = shouldShowStaleness(visibility?.category)
195
+ ? computeWorkflowStaleness(workflow.definition.validatedAgainstSpecVersion, CURRENT_SPEC_VERSION)
196
+ : undefined;
197
+ return staleness !== undefined ? { staleness } : {};
198
+ })(),
145
199
  });
146
200
  return (0, neverthrow_1.okAsync)((0, types_js_1.success)(payload));
147
201
  }));
@@ -199,6 +253,9 @@ async function buildV2WorkflowListItem(options) {
199
253
  };
200
254
  }
201
255
  }
256
+ const staleness = shouldShowStaleness(visibility?.category)
257
+ ? computeWorkflowStaleness(workflow.definition.validatedAgainstSpecVersion, CURRENT_SPEC_VERSION)
258
+ : undefined;
202
259
  return {
203
260
  workflowId: summary.id,
204
261
  name: summary.name,
@@ -207,6 +264,7 @@ async function buildV2WorkflowListItem(options) {
207
264
  workflowHash: hash,
208
265
  kind: 'workflow',
209
266
  visibility,
267
+ ...(staleness !== undefined ? { staleness } : {}),
210
268
  };
211
269
  }
212
270
  async function buildSourceCatalog(workflowReader, rememberedRootRecords) {
@@ -152,6 +152,20 @@ export declare const WorkflowGetSchemaOutputSchema: z.ZodObject<{
152
152
  stepStructure: Record<string, string>;
153
153
  };
154
154
  }>;
155
+ export declare const StalenessSummarySchema: z.ZodObject<{
156
+ level: z.ZodEnum<["none", "possible", "likely"]>;
157
+ reason: z.ZodString;
158
+ specVersionAtLastReview: z.ZodOptional<z.ZodNumber>;
159
+ }, "strip", z.ZodTypeAny, {
160
+ level: "none" | "possible" | "likely";
161
+ reason: string;
162
+ specVersionAtLastReview?: number | undefined;
163
+ }, {
164
+ level: "none" | "possible" | "likely";
165
+ reason: string;
166
+ specVersionAtLastReview?: number | undefined;
167
+ }>;
168
+ export type StalenessSummary = z.infer<typeof StalenessSummarySchema>;
155
169
  export declare const V2WorkflowListItemSchema: z.ZodObject<{
156
170
  workflowId: z.ZodString;
157
171
  name: z.ZodString;
@@ -235,6 +249,19 @@ export declare const V2WorkflowListItemSchema: z.ZodObject<{
235
249
  currentSource: "legacy_project";
236
250
  } | undefined;
237
251
  }>>;
252
+ staleness: z.ZodOptional<z.ZodObject<{
253
+ level: z.ZodEnum<["none", "possible", "likely"]>;
254
+ reason: z.ZodString;
255
+ specVersionAtLastReview: z.ZodOptional<z.ZodNumber>;
256
+ }, "strip", z.ZodTypeAny, {
257
+ level: "none" | "possible" | "likely";
258
+ reason: string;
259
+ specVersionAtLastReview?: number | undefined;
260
+ }, {
261
+ level: "none" | "possible" | "likely";
262
+ reason: string;
263
+ specVersionAtLastReview?: number | undefined;
264
+ }>>;
238
265
  }, "strip", z.ZodTypeAny, {
239
266
  kind: "workflow";
240
267
  name: string;
@@ -260,6 +287,11 @@ export declare const V2WorkflowListItemSchema: z.ZodObject<{
260
287
  currentSource: "legacy_project";
261
288
  } | undefined;
262
289
  } | undefined;
290
+ staleness?: {
291
+ level: "none" | "possible" | "likely";
292
+ reason: string;
293
+ specVersionAtLastReview?: number | undefined;
294
+ } | undefined;
263
295
  }, {
264
296
  kind: "workflow";
265
297
  name: string;
@@ -285,6 +317,11 @@ export declare const V2WorkflowListItemSchema: z.ZodObject<{
285
317
  currentSource: "legacy_project";
286
318
  } | undefined;
287
319
  } | undefined;
320
+ staleness?: {
321
+ level: "none" | "possible" | "likely";
322
+ reason: string;
323
+ specVersionAtLastReview?: number | undefined;
324
+ } | undefined;
288
325
  }>;
289
326
  export declare const V2WorkflowSourceCatalogEntrySchema: z.ZodObject<{
290
327
  sourceKey: z.ZodString;
@@ -461,6 +498,19 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
461
498
  currentSource: "legacy_project";
462
499
  } | undefined;
463
500
  }>>;
501
+ staleness: z.ZodOptional<z.ZodObject<{
502
+ level: z.ZodEnum<["none", "possible", "likely"]>;
503
+ reason: z.ZodString;
504
+ specVersionAtLastReview: z.ZodOptional<z.ZodNumber>;
505
+ }, "strip", z.ZodTypeAny, {
506
+ level: "none" | "possible" | "likely";
507
+ reason: string;
508
+ specVersionAtLastReview?: number | undefined;
509
+ }, {
510
+ level: "none" | "possible" | "likely";
511
+ reason: string;
512
+ specVersionAtLastReview?: number | undefined;
513
+ }>>;
464
514
  }, "strip", z.ZodTypeAny, {
465
515
  kind: "workflow";
466
516
  name: string;
@@ -486,6 +536,11 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
486
536
  currentSource: "legacy_project";
487
537
  } | undefined;
488
538
  } | undefined;
539
+ staleness?: {
540
+ level: "none" | "possible" | "likely";
541
+ reason: string;
542
+ specVersionAtLastReview?: number | undefined;
543
+ } | undefined;
489
544
  }, {
490
545
  kind: "workflow";
491
546
  name: string;
@@ -511,6 +566,11 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
511
566
  currentSource: "legacy_project";
512
567
  } | undefined;
513
568
  } | undefined;
569
+ staleness?: {
570
+ level: "none" | "possible" | "likely";
571
+ reason: string;
572
+ specVersionAtLastReview?: number | undefined;
573
+ } | undefined;
514
574
  }>, "many">;
515
575
  staleRoots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
516
576
  sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -630,6 +690,11 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
630
690
  currentSource: "legacy_project";
631
691
  } | undefined;
632
692
  } | undefined;
693
+ staleness?: {
694
+ level: "none" | "possible" | "likely";
695
+ reason: string;
696
+ specVersionAtLastReview?: number | undefined;
697
+ } | undefined;
633
698
  }[];
634
699
  sources?: {
635
700
  source: {
@@ -681,6 +746,11 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
681
746
  currentSource: "legacy_project";
682
747
  } | undefined;
683
748
  } | undefined;
749
+ staleness?: {
750
+ level: "none" | "possible" | "likely";
751
+ reason: string;
752
+ specVersionAtLastReview?: number | undefined;
753
+ } | undefined;
684
754
  }[];
685
755
  sources?: {
686
756
  source: {
@@ -811,6 +881,19 @@ export declare const V2WorkflowInspectOutputSchema: z.ZodObject<{
811
881
  authoritative: boolean;
812
882
  resolveFrom?: "workspace" | "package" | undefined;
813
883
  }>, "many">>;
884
+ staleness: z.ZodOptional<z.ZodObject<{
885
+ level: z.ZodEnum<["none", "possible", "likely"]>;
886
+ reason: z.ZodString;
887
+ specVersionAtLastReview: z.ZodOptional<z.ZodNumber>;
888
+ }, "strip", z.ZodTypeAny, {
889
+ level: "none" | "possible" | "likely";
890
+ reason: string;
891
+ specVersionAtLastReview?: number | undefined;
892
+ }, {
893
+ level: "none" | "possible" | "likely";
894
+ reason: string;
895
+ specVersionAtLastReview?: number | undefined;
896
+ }>>;
814
897
  }, "strip", z.ZodTypeAny, {
815
898
  workflowId: string;
816
899
  workflowHash: string;
@@ -842,6 +925,11 @@ export declare const V2WorkflowInspectOutputSchema: z.ZodObject<{
842
925
  currentSource: "legacy_project";
843
926
  } | undefined;
844
927
  } | undefined;
928
+ staleness?: {
929
+ level: "none" | "possible" | "likely";
930
+ reason: string;
931
+ specVersionAtLastReview?: number | undefined;
932
+ } | undefined;
845
933
  staleRoots?: string[] | undefined;
846
934
  }, {
847
935
  workflowId: string;
@@ -874,6 +962,11 @@ export declare const V2WorkflowInspectOutputSchema: z.ZodObject<{
874
962
  currentSource: "legacy_project";
875
963
  } | undefined;
876
964
  } | undefined;
965
+ staleness?: {
966
+ level: "none" | "possible" | "likely";
967
+ reason: string;
968
+ specVersionAtLastReview?: number | undefined;
969
+ } | undefined;
877
970
  staleRoots?: string[] | undefined;
878
971
  }>;
879
972
  export declare const V2PendingStepSchema: z.ZodObject<{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OpenDashboardOutputSchema = exports.ReadSessionSchemaOutputSchema = exports.ReadSessionOutputSchema = exports.UpdateSessionOutputSchema = exports.CreateSessionOutputSchema = exports.V2StartWorkflowOutputSchema = exports.V2CheckpointWorkflowOutputSchema = exports.V2ResumeSessionOutputSchema = exports.V2ContinueWorkflowOutputSchema = exports.V2StepContextSchema = exports.V2BindingDriftWarningSchema = exports.V2BlockerReportSchema = exports.V2ResumeNextCallSchema = exports.V2NextCallSchema = exports.V2NextIntentSchema = exports.V2PreferencesSchema = exports.V2PendingStepSchema = exports.V2WorkflowInspectOutputSchema = exports.V2WorkflowListOutputSchema = exports.V2WorkflowSourceCatalogEntrySchema = exports.V2WorkflowListItemSchema = exports.WorkflowGetSchemaOutputSchema = exports.WorkflowValidateJsonOutputSchema = exports.WorkflowNextOutputSchema = exports.WorkflowGetOutputSchema = exports.WorkflowListOutputSchema = exports.WorkflowSummarySchema = exports.JsonValueSchema = void 0;
3
+ exports.OpenDashboardOutputSchema = exports.ReadSessionSchemaOutputSchema = exports.ReadSessionOutputSchema = exports.UpdateSessionOutputSchema = exports.CreateSessionOutputSchema = exports.V2StartWorkflowOutputSchema = exports.V2CheckpointWorkflowOutputSchema = exports.V2ResumeSessionOutputSchema = exports.V2ContinueWorkflowOutputSchema = exports.V2StepContextSchema = exports.V2BindingDriftWarningSchema = exports.V2BlockerReportSchema = exports.V2ResumeNextCallSchema = exports.V2NextCallSchema = exports.V2NextIntentSchema = exports.V2PreferencesSchema = exports.V2PendingStepSchema = exports.V2WorkflowInspectOutputSchema = exports.V2WorkflowListOutputSchema = exports.V2WorkflowSourceCatalogEntrySchema = exports.V2WorkflowListItemSchema = exports.StalenessSummarySchema = exports.WorkflowGetSchemaOutputSchema = exports.WorkflowValidateJsonOutputSchema = exports.WorkflowNextOutputSchema = exports.WorkflowGetOutputSchema = exports.WorkflowListOutputSchema = exports.WorkflowSummarySchema = exports.JsonValueSchema = void 0;
4
4
  exports.toPendingStep = toPendingStep;
5
5
  const zod_1 = require("zod");
6
6
  const state_js_1 = require("../domain/execution/state.js");
@@ -48,6 +48,11 @@ exports.WorkflowGetSchemaOutputSchema = zod_1.z.object({
48
48
  stepStructure: zod_1.z.record(zod_1.z.string()),
49
49
  }),
50
50
  });
51
+ exports.StalenessSummarySchema = zod_1.z.object({
52
+ level: zod_1.z.enum(['none', 'possible', 'likely']),
53
+ reason: zod_1.z.string().min(1),
54
+ specVersionAtLastReview: zod_1.z.number().int().positive().optional(),
55
+ });
51
56
  exports.V2WorkflowListItemSchema = zod_1.z.object({
52
57
  workflowId: zod_1.z.string().min(1),
53
58
  name: zod_1.z.string().min(1),
@@ -73,6 +78,7 @@ exports.V2WorkflowListItemSchema = zod_1.z.object({
73
78
  summary: zod_1.z.string().min(1),
74
79
  }).optional(),
75
80
  }).optional(),
81
+ staleness: exports.StalenessSummarySchema.optional(),
76
82
  });
77
83
  exports.V2WorkflowSourceCatalogEntrySchema = zod_1.z.object({
78
84
  sourceKey: zod_1.z.string().min(1).describe('Stable identifier for this source. Format: "{kind}:{absolutePath}" for filesystem sources (e.g. "project:/path/to/workflows", "custom:/path/to/.workrail/workflows"), or "built_in" for bundled sources.'),
@@ -122,6 +128,7 @@ exports.V2WorkflowInspectOutputSchema = zod_1.z.object({
122
128
  authoritative: zod_1.z.boolean(),
123
129
  resolveFrom: zod_1.z.enum(['workspace', 'package']).optional(),
124
130
  })).optional(),
131
+ staleness: exports.StalenessSummarySchema.optional(),
125
132
  });
126
133
  exports.V2PendingStepSchema = zod_1.z.object({
127
134
  stepId: zod_1.z.string().min(1),
@@ -134,6 +134,7 @@ export interface WorkflowDefinition {
134
134
  readonly assessments?: readonly AssessmentDefinition[];
135
135
  readonly extensionPoints?: readonly ExtensionPoint[];
136
136
  readonly references?: readonly WorkflowReference[];
137
+ readonly validatedAgainstSpecVersion?: number;
137
138
  }
138
139
  export declare function isLoopStepDefinition(step: WorkflowStepDefinition | LoopStepDefinition): step is LoopStepDefinition;
139
140
  export declare function isWorkflowStepDefinition(step: WorkflowStepDefinition | LoopStepDefinition): step is WorkflowStepDefinition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exaudeus/workrail",
3
- "version": "3.13.0",
3
+ "version": "3.14.0",
4
4
  "description": "Step-by-step workflow enforcement for AI agents via MCP",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,6 +40,7 @@
40
40
  "watch": "tsc --watch",
41
41
  "validate:workflows": "bash scripts/validate-workflows.sh",
42
42
  "validate:registry": "node scripts/validate-workflows-registry.ts",
43
+ "stamp-workflow": "node scripts/stamp-workflow.ts",
43
44
  "validate:authoring-spec": "node scripts/validate-authoring-spec.js",
44
45
  "validate:authoring-docs": "node scripts/generate-authoring-docs.js --check",
45
46
  "validate:workflow-discovery": "node scripts/validate-workflow-discovery.js",
@@ -20,7 +20,8 @@
20
20
  "When a workflow feature lands or changes, update the schema and runtime first.",
21
21
  "Then update this authoring spec so guidance matches the shipped behavior.",
22
22
  "Then regenerate or update human-facing docs and examples derived from this spec.",
23
- "Do not leave authoring guidance behind the runtime."
23
+ "Do not leave authoring guidance behind the runtime.",
24
+ "Increment `version` when any required-level rule is added, removed, or materially changed. Add a `changelog` entry for the new version."
24
25
  ],
25
26
  "ruleModel": {
26
27
  "levels": [
@@ -1402,6 +1403,12 @@
1402
1403
  ]
1403
1404
  }
1404
1405
  ],
1405
- "plannedRules": [
1406
+ "plannedRules": [],
1407
+ "changelog": [
1408
+ {
1409
+ "version": 3,
1410
+ "date": "2026-03-21",
1411
+ "summary": "Baseline version at staleness feature introduction."
1412
+ }
1406
1413
  ]
1407
1414
  }