@exaudeus/workrail 3.66.0 → 3.67.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.
@@ -1,6 +1,17 @@
1
1
  import { IWorkflowStorage, ICompositeWorkflowStorage } from '../../types/storage';
2
2
  import { Workflow, WorkflowSummary, WorkflowDefinition, WorkflowSource } from '../../types/workflow';
3
- export declare class SchemaValidatingWorkflowStorage implements IWorkflowStorage {
3
+ export interface ValidationWarning {
4
+ readonly workflowId: string;
5
+ readonly sourceKind: string;
6
+ readonly errors: string[];
7
+ }
8
+ export interface HasValidationWarnings {
9
+ loadAllWorkflowsWithWarnings(): Promise<{
10
+ readonly workflows: readonly Workflow[];
11
+ readonly warnings: readonly ValidationWarning[];
12
+ }>;
13
+ }
14
+ export declare class SchemaValidatingWorkflowStorage implements IWorkflowStorage, HasValidationWarnings {
4
15
  private readonly inner;
5
16
  readonly kind: "single";
6
17
  private readonly validator;
@@ -8,11 +19,15 @@ export declare class SchemaValidatingWorkflowStorage implements IWorkflowStorage
8
19
  get source(): WorkflowSource;
9
20
  private validateDefinition;
10
21
  loadAllWorkflows(): Promise<readonly Workflow[]>;
22
+ loadAllWorkflowsWithWarnings(): Promise<{
23
+ readonly workflows: readonly Workflow[];
24
+ readonly warnings: readonly ValidationWarning[];
25
+ }>;
11
26
  getWorkflowById(id: string): Promise<Workflow | null>;
12
27
  listWorkflowSummaries(): Promise<readonly WorkflowSummary[]>;
13
28
  save(definition: WorkflowDefinition): Promise<void>;
14
29
  }
15
- export declare class SchemaValidatingCompositeWorkflowStorage implements ICompositeWorkflowStorage {
30
+ export declare class SchemaValidatingCompositeWorkflowStorage implements ICompositeWorkflowStorage, HasValidationWarnings {
16
31
  private readonly inner;
17
32
  readonly kind: "composite";
18
33
  private readonly validator;
@@ -21,6 +36,10 @@ export declare class SchemaValidatingCompositeWorkflowStorage implements ICompos
21
36
  getSources(): readonly WorkflowSource[];
22
37
  getStorageInstances(): readonly IWorkflowStorage[];
23
38
  loadAllWorkflows(): Promise<readonly Workflow[]>;
39
+ loadAllWorkflowsWithWarnings(): Promise<{
40
+ readonly workflows: readonly Workflow[];
41
+ readonly warnings: readonly ValidationWarning[];
42
+ }>;
24
43
  getWorkflowById(id: string): Promise<Workflow | null>;
25
44
  listWorkflowSummaries(): Promise<readonly WorkflowSummary[]>;
26
45
  save(definition: WorkflowDefinition): Promise<void>;
@@ -54,6 +54,30 @@ class SchemaValidatingWorkflowStorage {
54
54
  }
55
55
  return validWorkflows;
56
56
  }
57
+ async loadAllWorkflowsWithWarnings() {
58
+ const workflows = await this.inner.loadAllWorkflows();
59
+ const validWorkflows = [];
60
+ const warnings = [];
61
+ for (const workflow of workflows) {
62
+ try {
63
+ if (this.validateDefinition(workflow.definition, workflow.source.kind)) {
64
+ validWorkflows.push(workflow);
65
+ }
66
+ }
67
+ catch (err) {
68
+ const errorMessage = err instanceof Error ? err.message : String(err);
69
+ reportValidationFailure(workflow.definition.id, workflow.source.kind, errorMessage);
70
+ if (workflow.source.kind !== 'bundled') {
71
+ warnings.push({
72
+ workflowId: workflow.definition.id,
73
+ sourceKind: workflow.source.kind,
74
+ errors: [errorMessage],
75
+ });
76
+ }
77
+ }
78
+ }
79
+ return { workflows: validWorkflows, warnings };
80
+ }
57
81
  async getWorkflowById(id) {
58
82
  const workflow = await this.inner.getWorkflowById(id);
59
83
  if (!workflow) {
@@ -117,6 +141,30 @@ class SchemaValidatingCompositeWorkflowStorage {
117
141
  }
118
142
  return validWorkflows;
119
143
  }
144
+ async loadAllWorkflowsWithWarnings() {
145
+ const workflows = await this.inner.loadAllWorkflows();
146
+ const validWorkflows = [];
147
+ const warnings = [];
148
+ for (const workflow of workflows) {
149
+ try {
150
+ if (this.validateDefinition(workflow.definition, workflow.source.kind)) {
151
+ validWorkflows.push(workflow);
152
+ }
153
+ }
154
+ catch (err) {
155
+ const errorMessage = err instanceof Error ? err.message : String(err);
156
+ reportValidationFailure(workflow.definition.id, workflow.source.kind, errorMessage);
157
+ if (workflow.source.kind !== 'bundled') {
158
+ warnings.push({
159
+ workflowId: workflow.definition.id,
160
+ sourceKind: workflow.source.kind,
161
+ errors: [errorMessage],
162
+ });
163
+ }
164
+ }
165
+ }
166
+ return { workflows: validWorkflows, warnings };
167
+ }
120
168
  async getWorkflowById(id) {
121
169
  const workflow = await this.inner.getWorkflowById(id);
122
170
  if (!workflow)
@@ -230,8 +230,8 @@
230
230
  "bytes": 460
231
231
  },
232
232
  "application/validation.js": {
233
- "sha256": "ca4e2618fe7433eb1f6e66afc91ecacead737a8798f2f11377e68bbd916a12a7",
234
- "bytes": 1527
233
+ "sha256": "12e4d064d5500259b62df0ab594a5fd9e5e0c59e7d7766b19ef80a7ada46a795",
234
+ "bytes": 1512
235
235
  },
236
236
  "cli-worktrain.d.ts": {
237
237
  "sha256": "43e818adf60173644896298637f47b01d5819b17eda46eaa32d0c7d64724d012",
@@ -473,16 +473,16 @@
473
473
  "sha256": "5fe866e54f796975dec5d8ba9983aefd86074db212d3fccd64eed04bc9f0b3da",
474
474
  "bytes": 8011
475
475
  },
476
- "console-ui/assets/index-BynU38Vu.js": {
477
- "sha256": "18856ea8c6725608c61027383ff257f0562cc382218802419d289177794faf16",
478
- "bytes": 767983
479
- },
480
476
  "console-ui/assets/index-DHrKiMCf.css": {
481
477
  "sha256": "40290b50e21ee7e82433efe13b1aa31c1ea608bd057a5c4e324982f284bc928b",
482
478
  "bytes": 60673
483
479
  },
480
+ "console-ui/assets/index-tOl8Vowf.js": {
481
+ "sha256": "f598d8869c96cf01f1adc245ac289f9614d7616ce1d8f0a86a0bb9665a26fe5d",
482
+ "bytes": 767983
483
+ },
484
484
  "console-ui/index.html": {
485
- "sha256": "c2a16431dd2dacb236f76b9ef63e10fca159cf098512d72485473dafd46c6d48",
485
+ "sha256": "908a96c5cb785772a69156cc4c8abaa821f37104d8b7ed0ce0f8db077d7d62e3",
486
486
  "bytes": 417
487
487
  },
488
488
  "console/standalone-console.d.ts": {
@@ -490,8 +490,8 @@
490
490
  "bytes": 788
491
491
  },
492
492
  "console/standalone-console.js": {
493
- "sha256": "bfe72ea5161d6d3af917180fad905abae05b9ae5cb329dadbe3d8acaed6aed9a",
494
- "bytes": 6314
493
+ "sha256": "4847b32ce53ad1934e6f18dde435bcf7f0fc4374125eb58360d9cdeada616fe7",
494
+ "bytes": 6689
495
495
  },
496
496
  "context-assembly/deps.d.ts": {
497
497
  "sha256": "d699ae8f8f081d92708eba5969e35cf24a45d3f86de72d308ffc4a542b954bc3",
@@ -902,12 +902,12 @@
902
902
  "bytes": 7902
903
903
  },
904
904
  "infrastructure/storage/schema-validating-workflow-storage.d.ts": {
905
- "sha256": "049b68de8c5df6394f8018a9c9c666770cb4d2f20d061cbe5da482aff1c3239c",
906
- "bytes": 1318
905
+ "sha256": "f22a2e7e65407478d86aa5d5a7546ca35947dc448425309e5be5ba4f8efa5ce6",
906
+ "bytes": 2023
907
907
  },
908
908
  "infrastructure/storage/schema-validating-workflow-storage.js": {
909
- "sha256": "be5300cb1133537ae88aabd7c338c9265fc0c1a074901311999dc08c69ba3975",
910
- "bytes": 5787
909
+ "sha256": "4004fac4f8cb1b5cadbe060a389fe6a97377eedc6d4209b92da0d82d36a5e1b0",
910
+ "bytes": 7801
911
911
  },
912
912
  "infrastructure/storage/storage.d.ts": {
913
913
  "sha256": "481c5c0ef797baa7f18cff6a468a1de6d1ef34dd4b35f53e318e30b825b31e63",
@@ -1234,8 +1234,8 @@
1234
1234
  "bytes": 4343
1235
1235
  },
1236
1236
  "mcp/handlers/v2-workflow.js": {
1237
- "sha256": "73137ab66383cd5804856f086bb665414f8c302cb90dd934b24aaf12c6a96ae9",
1238
- "bytes": 26893
1237
+ "sha256": "ed2594e771344c5c3fed99e92b196f72dcfdf1d34ef8dc911bf6e9a12669ef0d",
1238
+ "bytes": 28075
1239
1239
  },
1240
1240
  "mcp/handlers/v2-workspace-resolution.d.ts": {
1241
1241
  "sha256": "dd4de57b4918ebe749cf8c1df70c02bf1effc50932634bae60db53c9a157e872",
@@ -1262,12 +1262,12 @@
1262
1262
  "bytes": 7991
1263
1263
  },
1264
1264
  "mcp/output-schemas.d.ts": {
1265
- "sha256": "ecd9ff8b4a2e2514385d5f5031a4c99bb67884f6a96ea9dd42b62c31bf2687d1",
1266
- "bytes": 93176
1265
+ "sha256": "03207cb284fb77d0859cb089b0717ac38d9a1f2a997f101324d8efb90c540b5c",
1266
+ "bytes": 94179
1267
1267
  },
1268
1268
  "mcp/output-schemas.js": {
1269
- "sha256": "b9901935144a7842dd237a869b51fdd72153ce2970225da1e83cc22193bd1293",
1270
- "bytes": 22211
1269
+ "sha256": "73547ff9f84f0f91c0d541a846d917eb1595d7feaec0684afe2271658b774402",
1270
+ "bytes": 23062
1271
1271
  },
1272
1272
  "mcp/render-envelope.d.ts": {
1273
1273
  "sha256": "22e83e1aba52968a7136cf289125a217b5f462a5a66a1eebe4669006e3326fdb",
@@ -3062,12 +3062,12 @@
3062
3062
  "bytes": 550
3063
3063
  },
3064
3064
  "v2/projections/session-metrics.d.ts": {
3065
- "sha256": "f9ec2280053a9424f691246212522359263e526701cb4b3605e44870600c862c",
3066
- "bytes": 741
3065
+ "sha256": "e145784946e29a7a6473c130cc7e11032f62ecd98274796b181136821e4c2aa0",
3066
+ "bytes": 730
3067
3067
  },
3068
3068
  "v2/projections/session-metrics.js": {
3069
- "sha256": "932dde53bb03804546741a50516b9be78d7723b0fa7beb81ad4225f1f346f2b1",
3070
- "bytes": 3890
3069
+ "sha256": "89a1ee5aae79a19c7fc60840e62741a7dd93028562e72cd26a15e4988953c6c4",
3070
+ "bytes": 3421
3071
3071
  },
3072
3072
  "v2/read-only/v1-to-v2-shim.d.ts": {
3073
3073
  "sha256": "b122df1d4eb4119b65465baa00f157ca4466575d3bc6ac20054a361eaff48e02",
@@ -3078,8 +3078,8 @@
3078
3078
  "bytes": 4795
3079
3079
  },
3080
3080
  "v2/usecases/console-routes.d.ts": {
3081
- "sha256": "bb8abe9b6510ab09ab9aec1af24c253bf16b538c18c5ac583caffe48ef347536",
3082
- "bytes": 596
3081
+ "sha256": "9acde26458a0cb2dabcafa9daa2ea1ba72e261422b77491e9d086ecc54c19234",
3082
+ "bytes": 572
3083
3083
  },
3084
3084
  "v2/usecases/console-routes.js": {
3085
3085
  "sha256": "cac41733df0270c8882c1ccc57e616862e422b7dd4aaf78783bb98a21c6edd81",
@@ -192,7 +192,14 @@ async function handleV2ListWorkflows(input, ctx) {
192
192
  const warnings = managedStoreError
193
193
  ? [`Managed workflow source store was temporarily unavailable (${managedStoreError}). Managed sources were not loaded.`]
194
194
  : undefined;
195
- return neverthrow_1.ResultAsync.fromPromise((0, with_timeout_js_1.withTimeout)(workflowReader.loadAllWorkflows(), TIMEOUT_MS, 'list_workflows'), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err))
195
+ const hasValidationWarnings = (r) => typeof r.loadAllWorkflowsWithWarnings === 'function';
196
+ let capturedValidationWarnings;
197
+ return neverthrow_1.ResultAsync.fromPromise(hasValidationWarnings(workflowReader)
198
+ ? (0, with_timeout_js_1.withTimeout)(workflowReader.loadAllWorkflowsWithWarnings(), TIMEOUT_MS, 'list_workflows').then(({ workflows, warnings }) => {
199
+ capturedValidationWarnings = warnings.length > 0 ? warnings : undefined;
200
+ return workflows;
201
+ })
202
+ : (0, with_timeout_js_1.withTimeout)(workflowReader.loadAllWorkflows(), TIMEOUT_MS, 'list_workflows'), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err))
196
203
  .andThen((allWorkflows) => {
197
204
  const workflowMap = new Map(allWorkflows.map((w) => [w.definition.id, w]));
198
205
  const summaries = allWorkflows.map((w) => ({
@@ -233,11 +240,18 @@ async function handleV2ListWorkflows(input, ctx) {
233
240
  return undefined;
234
241
  return buildTagSummary(WORKFLOW_TAGS, sortedIds);
235
242
  })();
236
- const nextStepHint = tagSummaryEntry
237
- ? 'Pick a tag from tagSummary that fits the user\'s goal, then call list_workflows with tags=["<tagId>"]. ' +
238
- 'If a workflow ID in examples[] already matches, call start_workflow directly no second list call needed. ' +
239
- 'If multiple tags could apply, pick the most specific one.'
240
- : undefined;
243
+ const nextStepHint = (() => {
244
+ if (tagSummaryEntry) {
245
+ return 'Pick a tag from tagSummary that fits the user\'s goal, then call list_workflows with tags=["<tagId>"]. ' +
246
+ 'If a workflow ID in examples[] already matches, call start_workflow directly no second list call needed. ' +
247
+ 'If multiple tags could apply, pick the most specific one.';
248
+ }
249
+ if (capturedValidationWarnings) {
250
+ return 'One or more workflow files failed validation and were excluded from the workflows list. ' +
251
+ 'Fix the errors listed in validationWarnings in the workflow file(s) and retry list_workflows to confirm.';
252
+ }
253
+ return undefined;
254
+ })();
241
255
  if (!input.includeSources) {
242
256
  const includeStaleRoots = !tagSummaryEntry && stalePaths.length > 0;
243
257
  const payload = {
@@ -246,6 +260,7 @@ async function handleV2ListWorkflows(input, ctx) {
246
260
  ...(nextStepHint ? { _nextStep: nextStepHint } : {}),
247
261
  ...(includeStaleRoots ? { staleRoots: [...stalePaths] } : {}),
248
262
  ...(warnings ? { warnings } : {}),
263
+ ...(capturedValidationWarnings ? { validationWarnings: [...capturedValidationWarnings] } : {}),
249
264
  };
250
265
  return (0, neverthrow_1.okAsync)((0, types_js_1.success)(payload));
251
266
  }
@@ -256,6 +271,7 @@ async function handleV2ListWorkflows(input, ctx) {
256
271
  ...(nextStepHint ? { _nextStep: nextStepHint } : {}),
257
272
  ...(stalePaths.length > 0 ? { staleRoots: [...stalePaths] } : {}),
258
273
  ...(warnings ? { warnings } : {}),
274
+ ...(capturedValidationWarnings ? { validationWarnings: [...capturedValidationWarnings] } : {}),
259
275
  sources: [],
260
276
  };
261
277
  return (0, neverthrow_1.okAsync)((0, types_js_1.success)(payload));
@@ -267,6 +283,7 @@ async function handleV2ListWorkflows(input, ctx) {
267
283
  ...(nextStepHint ? { _nextStep: nextStepHint } : {}),
268
284
  ...(stalePaths.length > 0 ? { staleRoots: [...stalePaths] } : {}),
269
285
  ...(warnings ? { warnings } : {}),
286
+ ...(capturedValidationWarnings ? { validationWarnings: [...capturedValidationWarnings] } : {}),
270
287
  sources: [...sources],
271
288
  };
272
289
  return (0, types_js_1.success)(payload);
@@ -437,6 +437,19 @@ export declare const TagSummaryItemSchema: z.ZodObject<{
437
437
  displayName: string;
438
438
  count: number;
439
439
  }>;
440
+ export declare const V2ValidationWarningSchema: z.ZodObject<{
441
+ workflowId: z.ZodString;
442
+ sourceKind: z.ZodString;
443
+ errors: z.ZodArray<z.ZodString, "many">;
444
+ }, "strip", z.ZodTypeAny, {
445
+ workflowId: string;
446
+ sourceKind: string;
447
+ errors: string[];
448
+ }, {
449
+ workflowId: string;
450
+ sourceKind: string;
451
+ errors: string[];
452
+ }>;
440
453
  export declare const V2WorkflowListOutputSchema: z.ZodObject<{
441
454
  workflows: z.ZodArray<z.ZodObject<{
442
455
  workflowId: z.ZodString;
@@ -727,6 +740,19 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
727
740
  } | undefined;
728
741
  stale?: true | undefined;
729
742
  }>, "many">>;
743
+ validationWarnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
744
+ workflowId: z.ZodString;
745
+ sourceKind: z.ZodString;
746
+ errors: z.ZodArray<z.ZodString, "many">;
747
+ }, "strip", z.ZodTypeAny, {
748
+ workflowId: string;
749
+ sourceKind: string;
750
+ errors: string[];
751
+ }, {
752
+ workflowId: string;
753
+ sourceKind: string;
754
+ errors: string[];
755
+ }>, "many">>;
730
756
  }, "strip", z.ZodTypeAny, {
731
757
  workflows: {
732
758
  kind: "workflow";
@@ -797,6 +823,11 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
797
823
  }[] | undefined;
798
824
  _nextStep?: string | undefined;
799
825
  staleRoots?: string[] | undefined;
826
+ validationWarnings?: {
827
+ workflowId: string;
828
+ sourceKind: string;
829
+ errors: string[];
830
+ }[] | undefined;
800
831
  }, {
801
832
  workflows: {
802
833
  kind: "workflow";
@@ -867,6 +898,11 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
867
898
  }[] | undefined;
868
899
  _nextStep?: string | undefined;
869
900
  staleRoots?: string[] | undefined;
901
+ validationWarnings?: {
902
+ workflowId: string;
903
+ sourceKind: string;
904
+ errors: string[];
905
+ }[] | undefined;
870
906
  }>;
871
907
  export declare const V2WorkflowInspectOutputSchema: z.ZodObject<{
872
908
  workflowId: z.ZodString;
@@ -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.TagSummaryItemSchema = exports.V2WorkflowSourceCatalogEntrySchema = exports.V2WorkflowListItemSchema = exports.StalenessSummarySchema = 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.V2ValidationWarningSchema = exports.TagSummaryItemSchema = 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");
@@ -113,6 +113,11 @@ exports.TagSummaryItemSchema = zod_1.z.object({
113
113
  when: zod_1.z.array(zod_1.z.string()).describe('Intent phrases describing when to use workflows in this tag.'),
114
114
  examples: zod_1.z.array(zod_1.z.string()).describe('Representative workflow IDs for this tag.'),
115
115
  });
116
+ exports.V2ValidationWarningSchema = zod_1.z.object({
117
+ workflowId: zod_1.z.string().min(1),
118
+ sourceKind: zod_1.z.string().min(1),
119
+ errors: zod_1.z.array(zod_1.z.string().min(1)).min(1),
120
+ });
116
121
  exports.V2WorkflowListOutputSchema = zod_1.z.object({
117
122
  workflows: zod_1.z.array(exports.V2WorkflowListItemSchema),
118
123
  tagSummary: zod_1.z.array(exports.TagSummaryItemSchema).optional().describe('Tag summary for the workflow catalog. Present when no tags filter was applied. ' +
@@ -126,6 +131,11 @@ exports.V2WorkflowListOutputSchema = zod_1.z.object({
126
131
  'Example: the managed source store was temporarily unavailable and managed sources were not loaded.'),
127
132
  sources: zod_1.z.array(exports.V2WorkflowSourceCatalogEntrySchema).optional().describe('Source catalog for this workspace. Only present when includeSources was true in the request. ' +
128
133
  'Shows where workflows come from with effective and shadowed counts per source.'),
134
+ validationWarnings: zod_1.z.array(exports.V2ValidationWarningSchema).optional().describe('Structured validation errors for non-bundled workflow files that failed JSON schema validation ' +
135
+ 'and were excluded from the workflows list. Each entry identifies which workflow failed ' +
136
+ '(workflowId), which source it came from (sourceKind), and the specific validation errors (errors[]). ' +
137
+ 'Absent when all workflows pass validation. Fix the listed errors in the workflow file and retry ' +
138
+ 'list_workflows to confirm. Bundled (built-in) workflow failures are never included here.'),
129
139
  });
130
140
  exports.V2WorkflowInspectOutputSchema = zod_1.z.object({
131
141
  workflowId: zod_1.z.string().min(1),
@@ -4,7 +4,7 @@ export interface SessionMetricsV2 {
4
4
  readonly endGitSha: string | null;
5
5
  readonly gitBranch: string | null;
6
6
  readonly agentCommitShas: readonly string[];
7
- readonly captureConfidence: 'high' | 'medium' | 'none';
7
+ readonly captureConfidence: 'high' | 'none';
8
8
  readonly durationMs: number | undefined;
9
9
  readonly outcome: 'success' | 'partial' | 'abandoned' | 'error' | null;
10
10
  readonly prNumbers: readonly number[];
@@ -3,24 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.projectSessionMetricsV2 = projectSessionMetricsV2;
4
4
  const constants_js_1 = require("../durable-core/constants.js");
5
5
  function projectSessionMetricsV2(events) {
6
- let runCompletedData = null;
7
- let runCompletedRunId = null;
6
+ let runCompleted = null;
8
7
  for (const e of events) {
9
- const asUnknown = e;
10
- if (asUnknown.kind === 'run_completed') {
11
- runCompletedData = asUnknown.data;
12
- runCompletedRunId = asUnknown.scope?.runId ?? null;
8
+ if (e.kind === 'run_completed') {
9
+ runCompleted = e;
13
10
  break;
14
11
  }
15
12
  }
16
- if (runCompletedData === null) {
13
+ if (runCompleted === null) {
17
14
  return null;
18
15
  }
16
+ const runCompletedRunId = runCompleted.scope.runId;
19
17
  const metricsContext = {};
20
18
  for (const e of events) {
21
19
  if (e.kind !== constants_js_1.EVENT_KIND.CONTEXT_SET)
22
20
  continue;
23
- if (runCompletedRunId !== null && e.scope?.runId !== runCompletedRunId)
21
+ if (e.scope?.runId !== runCompletedRunId)
24
22
  continue;
25
23
  const ctx = e.data.context;
26
24
  if (!ctx || typeof ctx !== 'object' || Array.isArray(ctx))
@@ -32,25 +30,15 @@ function projectSessionMetricsV2(events) {
32
30
  }
33
31
  }
34
32
  }
35
- const d = runCompletedData;
33
+ const d = runCompleted.data;
36
34
  const startGitSha = typeof d.startGitSha === 'string' ? d.startGitSha : null;
37
35
  const endGitSha = typeof d.endGitSha === 'string' ? d.endGitSha : null;
38
36
  const gitBranch = typeof d.gitBranch === 'string' ? d.gitBranch : null;
39
- const agentCommitShas = [];
40
- if (Array.isArray(d.agentCommitShas)) {
41
- for (const sha of d.agentCommitShas) {
42
- if (typeof sha === 'string') {
43
- agentCommitShas.push(sha);
44
- }
45
- }
46
- }
47
- const captureConfidenceRaw = d.captureConfidence;
48
- const captureConfidence = captureConfidenceRaw === 'high' || captureConfidenceRaw === 'medium' || captureConfidenceRaw === 'none'
49
- ? captureConfidenceRaw
50
- : 'none';
51
- const durationMs = typeof d.durationMs === 'number' && Number.isFinite(d.durationMs)
52
- ? d.durationMs
53
- : undefined;
37
+ const agentCommitShas = Array.isArray(d.agentCommitShas)
38
+ ? d.agentCommitShas.filter((s) => typeof s === 'string')
39
+ : [];
40
+ const durationMs = typeof d.durationMs === 'number' && Number.isFinite(d.durationMs) ? d.durationMs : undefined;
41
+ const captureConfidence = d.captureConfidence === 'high' ? 'high' : 'none';
54
42
  const outcomeRaw = metricsContext['metrics_outcome'];
55
43
  const outcome = outcomeRaw === 'success' || outcomeRaw === 'partial' || outcomeRaw === 'abandoned' || outcomeRaw === 'error'
56
44
  ? outcomeRaw
@@ -68,24 +56,17 @@ function projectSessionMetricsV2(events) {
68
56
  const metricCommitShas = [];
69
57
  if (Array.isArray(commitShasRaw)) {
70
58
  for (const sha of commitShasRaw) {
71
- if (typeof sha === 'string') {
59
+ if (typeof sha === 'string')
72
60
  metricCommitShas.push(sha);
73
- }
74
61
  }
75
62
  }
76
63
  const finalAgentCommitShas = metricCommitShas.length > 0 ? metricCommitShas : agentCommitShas;
77
64
  const filesChangedRaw = metricsContext['metrics_files_changed'];
78
- const filesChanged = typeof filesChangedRaw === 'number' && Number.isFinite(filesChangedRaw)
79
- ? filesChangedRaw
80
- : null;
65
+ const filesChanged = typeof filesChangedRaw === 'number' && Number.isFinite(filesChangedRaw) ? filesChangedRaw : null;
81
66
  const linesAddedRaw = metricsContext['metrics_lines_added'];
82
- const linesAdded = typeof linesAddedRaw === 'number' && Number.isFinite(linesAddedRaw)
83
- ? linesAddedRaw
84
- : null;
67
+ const linesAdded = typeof linesAddedRaw === 'number' && Number.isFinite(linesAddedRaw) ? linesAddedRaw : null;
85
68
  const linesRemovedRaw = metricsContext['metrics_lines_removed'];
86
- const linesRemoved = typeof linesRemovedRaw === 'number' && Number.isFinite(linesRemovedRaw)
87
- ? linesRemovedRaw
88
- : null;
69
+ const linesRemoved = typeof linesRemovedRaw === 'number' && Number.isFinite(linesRemovedRaw) ? linesRemovedRaw : null;
89
70
  return {
90
71
  startGitSha,
91
72
  endGitSha,
@@ -1,6 +1,6 @@
1
1
  import type { Application } from 'express';
2
2
  import type { ConsoleService } from './console-service.js';
3
- import type { WorkflowService } from '../../application/services/workflow-service.js';
3
+ import type { IWorkflowReader } from '../../types/storage.js';
4
4
  import type { ToolCallTimingRingBuffer } from '../../mcp/tool-call-timing.js';
5
5
  import type { V2ToolContext } from '../../mcp/types.js';
6
- export declare function mountConsoleRoutes(app: Application, consoleService: ConsoleService, workflowService?: WorkflowService, timingRingBuffer?: ToolCallTimingRingBuffer, toolCallsPerfFile?: string, serverVersion?: string, v2ToolContext?: V2ToolContext): () => void;
6
+ export declare function mountConsoleRoutes(app: Application, consoleService: ConsoleService, workflowService?: IWorkflowReader, timingRingBuffer?: ToolCallTimingRingBuffer, toolCallsPerfFile?: string, serverVersion?: string, v2ToolContext?: V2ToolContext): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exaudeus/workrail",
3
- "version": "3.66.0",
3
+ "version": "3.67.0",
4
4
  "description": "Step-by-step workflow enforcement for AI agents via MCP",
5
5
  "license": "MIT",
6
6
  "repository": {