@exaudeus/workrail 3.10.0 → 3.11.1

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 (64) hide show
  1. package/dist/application/services/validation-engine.js +134 -0
  2. package/dist/application/services/workflow-compiler.js +54 -0
  3. package/dist/manifest.json +138 -74
  4. package/dist/mcp/handlers/v2-advance-core/assessment-consequences.d.ts +14 -0
  5. package/dist/mcp/handlers/v2-advance-core/assessment-consequences.js +27 -0
  6. package/dist/mcp/handlers/v2-advance-core/assessment-validation.d.ts +16 -0
  7. package/dist/mcp/handlers/v2-advance-core/assessment-validation.js +213 -0
  8. package/dist/mcp/handlers/v2-advance-core/event-builders.d.ts +1 -0
  9. package/dist/mcp/handlers/v2-advance-core/event-builders.js +3 -2
  10. package/dist/mcp/handlers/v2-advance-core/index.js +23 -8
  11. package/dist/mcp/handlers/v2-advance-core/input-validation.d.ts +9 -1
  12. package/dist/mcp/handlers/v2-advance-core/input-validation.js +22 -2
  13. package/dist/mcp/handlers/v2-advance-core/outcome-blocked.d.ts +2 -0
  14. package/dist/mcp/handlers/v2-advance-core/outcome-blocked.js +69 -19
  15. package/dist/mcp/handlers/v2-advance-core/outcome-success.js +22 -0
  16. package/dist/mcp/handlers/v2-execution/replay.js +7 -0
  17. package/dist/mcp/output-schemas.d.ts +156 -42
  18. package/dist/mcp/output-schemas.js +15 -0
  19. package/dist/mcp/v2-response-formatter.js +7 -1
  20. package/dist/types/workflow-definition.d.ts +26 -0
  21. package/dist/types/workflow-definition.js +16 -1
  22. package/dist/v2/durable-core/constants.d.ts +2 -0
  23. package/dist/v2/durable-core/constants.js +2 -0
  24. package/dist/v2/durable-core/domain/assessment-consequence-event-builder.d.ts +23 -0
  25. package/dist/v2/durable-core/domain/assessment-consequence-event-builder.js +36 -0
  26. package/dist/v2/durable-core/domain/assessment-record.d.ts +12 -0
  27. package/dist/v2/durable-core/domain/assessment-record.js +2 -0
  28. package/dist/v2/durable-core/domain/assessment-recorded-event-builder.d.ts +22 -0
  29. package/dist/v2/durable-core/domain/assessment-recorded-event-builder.js +38 -0
  30. package/dist/v2/durable-core/domain/blocked-node-builder.d.ts +1 -1
  31. package/dist/v2/durable-core/domain/blocked-node-builder.js +8 -0
  32. package/dist/v2/durable-core/domain/blocking-decision.d.ts +6 -0
  33. package/dist/v2/durable-core/domain/blocking-decision.js +15 -0
  34. package/dist/v2/durable-core/domain/prompt-renderer.js +25 -1
  35. package/dist/v2/durable-core/domain/reason-model.d.ts +12 -2
  36. package/dist/v2/durable-core/domain/reason-model.js +27 -2
  37. package/dist/v2/durable-core/domain/risk-policy-guardrails.js +1 -0
  38. package/dist/v2/durable-core/domain/validation-criteria-validator.d.ts +1 -0
  39. package/dist/v2/durable-core/domain/validation-criteria-validator.js +11 -0
  40. package/dist/v2/durable-core/schemas/artifacts/assessment.d.ts +55 -0
  41. package/dist/v2/durable-core/schemas/artifacts/assessment.js +29 -0
  42. package/dist/v2/durable-core/schemas/artifacts/index.d.ts +2 -1
  43. package/dist/v2/durable-core/schemas/artifacts/index.js +8 -1
  44. package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +24 -24
  45. package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +141 -21
  46. package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.js +10 -1
  47. package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +729 -171
  48. package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +1442 -202
  49. package/dist/v2/durable-core/schemas/session/events.d.ts +231 -8
  50. package/dist/v2/durable-core/schemas/session/events.js +36 -0
  51. package/dist/v2/durable-core/schemas/session/gaps.d.ts +2 -2
  52. package/dist/v2/projections/assessment-consequences.d.ts +19 -0
  53. package/dist/v2/projections/assessment-consequences.js +33 -0
  54. package/dist/v2/projections/assessments.d.ts +21 -0
  55. package/dist/v2/projections/assessments.js +35 -0
  56. package/package.json +1 -1
  57. package/spec/authoring-spec.json +38 -4
  58. package/spec/production-readiness-audit-rubric.md +43 -0
  59. package/spec/workflow.schema.json +110 -0
  60. package/workflows/bug-investigation.agentic.v2.json +28 -2
  61. package/workflows/production-readiness-audit.json +354 -0
  62. package/workflows/test-artifact-loop-control.json +28 -2
  63. package/workflows/workflow-for-workflows.v2.json +395 -58
  64. package/workflows/wr.discovery.json +33 -69
@@ -1098,6 +1098,229 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1098
1098
  eventIndex: z.ZodNumber;
1099
1099
  sessionId: z.ZodString;
1100
1100
  dedupeKey: z.ZodString;
1101
+ } & {
1102
+ kind: z.ZodLiteral<"assessment_recorded">;
1103
+ scope: z.ZodObject<{
1104
+ runId: z.ZodString;
1105
+ nodeId: z.ZodString;
1106
+ }, "strip", z.ZodTypeAny, {
1107
+ runId: string;
1108
+ nodeId: string;
1109
+ }, {
1110
+ runId: string;
1111
+ nodeId: string;
1112
+ }>;
1113
+ data: z.ZodObject<{
1114
+ assessmentId: z.ZodString;
1115
+ attemptId: z.ZodString;
1116
+ artifactOutputId: z.ZodString;
1117
+ summary: z.ZodOptional<z.ZodString>;
1118
+ normalizationNotes: z.ZodReadonly<z.ZodArray<z.ZodString, "many">>;
1119
+ dimensions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
1120
+ dimensionId: z.ZodString;
1121
+ level: z.ZodString;
1122
+ rationale: z.ZodOptional<z.ZodString>;
1123
+ normalization: z.ZodEnum<["exact", "normalized"]>;
1124
+ }, "strip", z.ZodTypeAny, {
1125
+ level: string;
1126
+ dimensionId: string;
1127
+ normalization: "exact" | "normalized";
1128
+ rationale?: string | undefined;
1129
+ }, {
1130
+ level: string;
1131
+ dimensionId: string;
1132
+ normalization: "exact" | "normalized";
1133
+ rationale?: string | undefined;
1134
+ }>, "many">>;
1135
+ }, "strip", z.ZodTypeAny, {
1136
+ assessmentId: string;
1137
+ dimensions: readonly {
1138
+ level: string;
1139
+ dimensionId: string;
1140
+ normalization: "exact" | "normalized";
1141
+ rationale?: string | undefined;
1142
+ }[];
1143
+ attemptId: string;
1144
+ artifactOutputId: string;
1145
+ normalizationNotes: readonly string[];
1146
+ summary?: string | undefined;
1147
+ }, {
1148
+ assessmentId: string;
1149
+ dimensions: readonly {
1150
+ level: string;
1151
+ dimensionId: string;
1152
+ normalization: "exact" | "normalized";
1153
+ rationale?: string | undefined;
1154
+ }[];
1155
+ attemptId: string;
1156
+ artifactOutputId: string;
1157
+ normalizationNotes: readonly string[];
1158
+ summary?: string | undefined;
1159
+ }>;
1160
+ }, "strip", z.ZodTypeAny, {
1161
+ kind: "assessment_recorded";
1162
+ sessionId: string;
1163
+ data: {
1164
+ assessmentId: string;
1165
+ dimensions: readonly {
1166
+ level: string;
1167
+ dimensionId: string;
1168
+ normalization: "exact" | "normalized";
1169
+ rationale?: string | undefined;
1170
+ }[];
1171
+ attemptId: string;
1172
+ artifactOutputId: string;
1173
+ normalizationNotes: readonly string[];
1174
+ summary?: string | undefined;
1175
+ };
1176
+ v: 1;
1177
+ eventIndex: number;
1178
+ eventId: string;
1179
+ dedupeKey: string;
1180
+ scope: {
1181
+ runId: string;
1182
+ nodeId: string;
1183
+ };
1184
+ }, {
1185
+ kind: "assessment_recorded";
1186
+ sessionId: string;
1187
+ data: {
1188
+ assessmentId: string;
1189
+ dimensions: readonly {
1190
+ level: string;
1191
+ dimensionId: string;
1192
+ normalization: "exact" | "normalized";
1193
+ rationale?: string | undefined;
1194
+ }[];
1195
+ attemptId: string;
1196
+ artifactOutputId: string;
1197
+ normalizationNotes: readonly string[];
1198
+ summary?: string | undefined;
1199
+ };
1200
+ v: 1;
1201
+ eventIndex: number;
1202
+ eventId: string;
1203
+ dedupeKey: string;
1204
+ scope: {
1205
+ runId: string;
1206
+ nodeId: string;
1207
+ };
1208
+ }>, z.ZodObject<{
1209
+ v: z.ZodLiteral<1>;
1210
+ eventId: z.ZodString;
1211
+ eventIndex: z.ZodNumber;
1212
+ sessionId: z.ZodString;
1213
+ dedupeKey: z.ZodString;
1214
+ } & {
1215
+ kind: z.ZodLiteral<"assessment_consequence_applied">;
1216
+ scope: z.ZodObject<{
1217
+ runId: z.ZodString;
1218
+ nodeId: z.ZodString;
1219
+ }, "strip", z.ZodTypeAny, {
1220
+ runId: string;
1221
+ nodeId: string;
1222
+ }, {
1223
+ runId: string;
1224
+ nodeId: string;
1225
+ }>;
1226
+ data: z.ZodObject<{
1227
+ attemptId: z.ZodString;
1228
+ assessmentId: z.ZodString;
1229
+ trigger: z.ZodObject<{
1230
+ dimensionId: z.ZodString;
1231
+ level: z.ZodString;
1232
+ }, "strip", z.ZodTypeAny, {
1233
+ level: string;
1234
+ dimensionId: string;
1235
+ }, {
1236
+ level: string;
1237
+ dimensionId: string;
1238
+ }>;
1239
+ effect: z.ZodObject<{
1240
+ kind: z.ZodLiteral<"require_followup">;
1241
+ guidance: z.ZodString;
1242
+ }, "strip", z.ZodTypeAny, {
1243
+ kind: "require_followup";
1244
+ guidance: string;
1245
+ }, {
1246
+ kind: "require_followup";
1247
+ guidance: string;
1248
+ }>;
1249
+ }, "strip", z.ZodTypeAny, {
1250
+ assessmentId: string;
1251
+ effect: {
1252
+ kind: "require_followup";
1253
+ guidance: string;
1254
+ };
1255
+ attemptId: string;
1256
+ trigger: {
1257
+ level: string;
1258
+ dimensionId: string;
1259
+ };
1260
+ }, {
1261
+ assessmentId: string;
1262
+ effect: {
1263
+ kind: "require_followup";
1264
+ guidance: string;
1265
+ };
1266
+ attemptId: string;
1267
+ trigger: {
1268
+ level: string;
1269
+ dimensionId: string;
1270
+ };
1271
+ }>;
1272
+ }, "strip", z.ZodTypeAny, {
1273
+ kind: "assessment_consequence_applied";
1274
+ sessionId: string;
1275
+ data: {
1276
+ assessmentId: string;
1277
+ effect: {
1278
+ kind: "require_followup";
1279
+ guidance: string;
1280
+ };
1281
+ attemptId: string;
1282
+ trigger: {
1283
+ level: string;
1284
+ dimensionId: string;
1285
+ };
1286
+ };
1287
+ v: 1;
1288
+ eventIndex: number;
1289
+ eventId: string;
1290
+ dedupeKey: string;
1291
+ scope: {
1292
+ runId: string;
1293
+ nodeId: string;
1294
+ };
1295
+ }, {
1296
+ kind: "assessment_consequence_applied";
1297
+ sessionId: string;
1298
+ data: {
1299
+ assessmentId: string;
1300
+ effect: {
1301
+ kind: "require_followup";
1302
+ guidance: string;
1303
+ };
1304
+ attemptId: string;
1305
+ trigger: {
1306
+ level: string;
1307
+ dimensionId: string;
1308
+ };
1309
+ };
1310
+ v: 1;
1311
+ eventIndex: number;
1312
+ eventId: string;
1313
+ dedupeKey: string;
1314
+ scope: {
1315
+ runId: string;
1316
+ nodeId: string;
1317
+ };
1318
+ }>, z.ZodObject<{
1319
+ v: z.ZodLiteral<1>;
1320
+ eventId: z.ZodString;
1321
+ eventIndex: z.ZodNumber;
1322
+ sessionId: z.ZodString;
1323
+ dedupeKey: z.ZodString;
1101
1324
  } & {
1102
1325
  kind: z.ZodLiteral<"preferences_changed">;
1103
1326
  scope: z.ZodObject<{
@@ -1653,6 +1876,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1653
1876
  outputId: string;
1654
1877
  }>]>, "many">>;
1655
1878
  }, "strip", z.ZodTypeAny, {
1879
+ summary: string;
1656
1880
  reason: {
1657
1881
  detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
1658
1882
  category: "user_only_dependency";
@@ -1674,7 +1898,6 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1674
1898
  };
1675
1899
  gapId: string;
1676
1900
  severity: "warning" | "info" | "critical";
1677
- summary: string;
1678
1901
  evidenceRefs?: ({
1679
1902
  kind: "event";
1680
1903
  eventId: string;
@@ -1683,6 +1906,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1683
1906
  outputId: string;
1684
1907
  })[] | undefined;
1685
1908
  }, {
1909
+ summary: string;
1686
1910
  reason: {
1687
1911
  detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
1688
1912
  category: "user_only_dependency";
@@ -1704,7 +1928,6 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1704
1928
  };
1705
1929
  gapId: string;
1706
1930
  severity: "warning" | "info" | "critical";
1707
- summary: string;
1708
1931
  evidenceRefs?: ({
1709
1932
  kind: "event";
1710
1933
  eventId: string;
@@ -1717,6 +1940,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1717
1940
  kind: "gap_recorded";
1718
1941
  sessionId: string;
1719
1942
  data: {
1943
+ summary: string;
1720
1944
  reason: {
1721
1945
  detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
1722
1946
  category: "user_only_dependency";
@@ -1738,7 +1962,6 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1738
1962
  };
1739
1963
  gapId: string;
1740
1964
  severity: "warning" | "info" | "critical";
1741
- summary: string;
1742
1965
  evidenceRefs?: ({
1743
1966
  kind: "event";
1744
1967
  eventId: string;
@@ -1759,6 +1982,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1759
1982
  kind: "gap_recorded";
1760
1983
  sessionId: string;
1761
1984
  data: {
1985
+ summary: string;
1762
1986
  reason: {
1763
1987
  detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
1764
1988
  category: "user_only_dependency";
@@ -1780,7 +2004,6 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1780
2004
  };
1781
2005
  gapId: string;
1782
2006
  severity: "warning" | "info" | "critical";
1783
- summary: string;
1784
2007
  evidenceRefs?: ({
1785
2008
  kind: "event";
1786
2009
  eventId: string;
@@ -1879,13 +2102,13 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1879
2102
  summary: z.ZodString;
1880
2103
  relatedStepId: z.ZodOptional<z.ZodString>;
1881
2104
  }, "strip", z.ZodTypeAny, {
1882
- reason: "missing_user_context" | "capability_unavailable" | "efficiency_skip" | "safety_stop" | "policy_constraint";
1883
2105
  summary: string;
2106
+ reason: "missing_user_context" | "capability_unavailable" | "efficiency_skip" | "safety_stop" | "policy_constraint";
1884
2107
  divergenceId: string;
1885
2108
  relatedStepId?: string | undefined;
1886
2109
  }, {
1887
- reason: "missing_user_context" | "capability_unavailable" | "efficiency_skip" | "safety_stop" | "policy_constraint";
1888
2110
  summary: string;
2111
+ reason: "missing_user_context" | "capability_unavailable" | "efficiency_skip" | "safety_stop" | "policy_constraint";
1889
2112
  divergenceId: string;
1890
2113
  relatedStepId?: string | undefined;
1891
2114
  }>;
@@ -1893,8 +2116,8 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1893
2116
  kind: "divergence_recorded";
1894
2117
  sessionId: string;
1895
2118
  data: {
1896
- reason: "missing_user_context" | "capability_unavailable" | "efficiency_skip" | "safety_stop" | "policy_constraint";
1897
2119
  summary: string;
2120
+ reason: "missing_user_context" | "capability_unavailable" | "efficiency_skip" | "safety_stop" | "policy_constraint";
1898
2121
  divergenceId: string;
1899
2122
  relatedStepId?: string | undefined;
1900
2123
  };
@@ -1910,8 +2133,8 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
1910
2133
  kind: "divergence_recorded";
1911
2134
  sessionId: string;
1912
2135
  data: {
1913
- reason: "missing_user_context" | "capability_unavailable" | "efficiency_skip" | "safety_stop" | "policy_constraint";
1914
2136
  summary: string;
2137
+ reason: "missing_user_context" | "capability_unavailable" | "efficiency_skip" | "safety_stop" | "policy_constraint";
1915
2138
  divergenceId: string;
1916
2139
  relatedStepId?: string | undefined;
1917
2140
  };
@@ -53,6 +53,32 @@ const AdvanceRecordedDataV1Schema = zod_1.z.object({
53
53
  intent: zod_1.z.literal('ack_pending'),
54
54
  outcome: AdvanceRecordedOutcomeV1Schema,
55
55
  });
56
+ const AssessmentRecordedDimensionV1Schema = zod_1.z.object({
57
+ dimensionId: zod_1.z.string().min(1),
58
+ level: zod_1.z.string().min(1),
59
+ rationale: zod_1.z.string().min(1).optional(),
60
+ normalization: zod_1.z.enum(['exact', 'normalized']),
61
+ });
62
+ const AssessmentRecordedDataV1Schema = zod_1.z.object({
63
+ assessmentId: zod_1.z.string().min(1),
64
+ attemptId: zod_1.z.string().min(1),
65
+ artifactOutputId: zod_1.z.string().min(1),
66
+ summary: zod_1.z.string().min(1).optional(),
67
+ normalizationNotes: zod_1.z.array(zod_1.z.string().min(1)).readonly(),
68
+ dimensions: zod_1.z.array(AssessmentRecordedDimensionV1Schema).min(1).readonly(),
69
+ });
70
+ const AssessmentConsequenceAppliedDataV1Schema = zod_1.z.object({
71
+ attemptId: zod_1.z.string().min(1),
72
+ assessmentId: zod_1.z.string().min(1),
73
+ trigger: zod_1.z.object({
74
+ dimensionId: zod_1.z.string().min(1),
75
+ level: zod_1.z.string().min(1),
76
+ }),
77
+ effect: zod_1.z.object({
78
+ kind: zod_1.z.literal('require_followup'),
79
+ guidance: zod_1.z.string().min(1),
80
+ }),
81
+ });
56
82
  const PreferencesChangedDataV1Schema = zod_1.z
57
83
  .object({
58
84
  changeId: zod_1.z.string().min(1),
@@ -120,6 +146,16 @@ exports.DomainEventV1Schema = zod_1.z.discriminatedUnion('kind', [
120
146
  scope: zod_1.z.object({ runId: zod_1.z.string().min(1), nodeId: zod_1.z.string().min(1) }),
121
147
  data: outputs_js_1.NodeOutputAppendedDataV1Schema,
122
148
  }),
149
+ exports.DomainEventEnvelopeV1Schema.extend({
150
+ kind: zod_1.z.literal('assessment_recorded'),
151
+ scope: zod_1.z.object({ runId: zod_1.z.string().min(1), nodeId: zod_1.z.string().min(1) }),
152
+ data: AssessmentRecordedDataV1Schema,
153
+ }),
154
+ exports.DomainEventEnvelopeV1Schema.extend({
155
+ kind: zod_1.z.literal('assessment_consequence_applied'),
156
+ scope: zod_1.z.object({ runId: zod_1.z.string().min(1), nodeId: zod_1.z.string().min(1) }),
157
+ data: AssessmentConsequenceAppliedDataV1Schema,
158
+ }),
123
159
  exports.DomainEventEnvelopeV1Schema.extend({
124
160
  kind: zod_1.z.literal('preferences_changed'),
125
161
  scope: zod_1.z.object({ runId: zod_1.z.string().min(1), nodeId: zod_1.z.string().min(1) }),
@@ -149,6 +149,7 @@ export declare const GapRecordedDataV1Schema: z.ZodObject<{
149
149
  outputId: string;
150
150
  }>]>, "many">>;
151
151
  }, "strip", z.ZodTypeAny, {
152
+ summary: string;
152
153
  reason: {
153
154
  detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
154
155
  category: "user_only_dependency";
@@ -170,7 +171,6 @@ export declare const GapRecordedDataV1Schema: z.ZodObject<{
170
171
  };
171
172
  gapId: string;
172
173
  severity: "warning" | "info" | "critical";
173
- summary: string;
174
174
  evidenceRefs?: ({
175
175
  kind: "event";
176
176
  eventId: string;
@@ -179,6 +179,7 @@ export declare const GapRecordedDataV1Schema: z.ZodObject<{
179
179
  outputId: string;
180
180
  })[] | undefined;
181
181
  }, {
182
+ summary: string;
182
183
  reason: {
183
184
  detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
184
185
  category: "user_only_dependency";
@@ -200,7 +201,6 @@ export declare const GapRecordedDataV1Schema: z.ZodObject<{
200
201
  };
201
202
  gapId: string;
202
203
  severity: "warning" | "info" | "critical";
203
- summary: string;
204
204
  evidenceRefs?: ({
205
205
  kind: "event";
206
206
  eventId: string;
@@ -0,0 +1,19 @@
1
+ import type { Result } from 'neverthrow';
2
+ import type { DomainEventV1 } from '../durable-core/schemas/session/index.js';
3
+ import type { ProjectionError } from './projection-error.js';
4
+ type AssessmentConsequenceAppliedEventV1 = Extract<DomainEventV1, {
5
+ kind: 'assessment_consequence_applied';
6
+ }>;
7
+ export interface AppliedAssessmentConsequenceViewV2 {
8
+ readonly assessmentId: string;
9
+ readonly attemptId: string;
10
+ readonly trigger: AssessmentConsequenceAppliedEventV1['data']['trigger'];
11
+ readonly effect: AssessmentConsequenceAppliedEventV1['data']['effect'];
12
+ readonly recordedAtEventIndex: number;
13
+ }
14
+ export interface AssessmentConsequencesProjectionV2 {
15
+ readonly byNodeId: Readonly<Record<string, readonly AppliedAssessmentConsequenceViewV2[]>>;
16
+ }
17
+ export declare function projectAssessmentConsequencesV2(events: readonly DomainEventV1[]): Result<AssessmentConsequencesProjectionV2, ProjectionError>;
18
+ export declare function getLatestAssessmentConsequenceForNode(projection: AssessmentConsequencesProjectionV2, nodeId: string): AppliedAssessmentConsequenceViewV2 | undefined;
19
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectAssessmentConsequencesV2 = projectAssessmentConsequencesV2;
4
+ exports.getLatestAssessmentConsequenceForNode = getLatestAssessmentConsequenceForNode;
5
+ const neverthrow_1 = require("neverthrow");
6
+ const constants_js_1 = require("../durable-core/constants.js");
7
+ function projectAssessmentConsequencesV2(events) {
8
+ for (let i = 1; i < events.length; i++) {
9
+ if (events[i].eventIndex < events[i - 1].eventIndex) {
10
+ return (0, neverthrow_1.err)({ code: 'PROJECTION_INVARIANT_VIOLATION', message: 'Events must be sorted by eventIndex ascending' });
11
+ }
12
+ }
13
+ const byNodeId = {};
14
+ for (const event of events) {
15
+ if (event.kind !== constants_js_1.EVENT_KIND.ASSESSMENT_CONSEQUENCE_APPLIED)
16
+ continue;
17
+ const nodeId = event.scope.nodeId;
18
+ if (!byNodeId[nodeId])
19
+ byNodeId[nodeId] = [];
20
+ byNodeId[nodeId].push({
21
+ assessmentId: event.data.assessmentId,
22
+ attemptId: event.data.attemptId,
23
+ trigger: event.data.trigger,
24
+ effect: event.data.effect,
25
+ recordedAtEventIndex: event.eventIndex,
26
+ });
27
+ }
28
+ return (0, neverthrow_1.ok)({ byNodeId });
29
+ }
30
+ function getLatestAssessmentConsequenceForNode(projection, nodeId) {
31
+ const consequences = projection.byNodeId[nodeId];
32
+ return consequences && consequences.length > 0 ? consequences[consequences.length - 1] : undefined;
33
+ }
@@ -0,0 +1,21 @@
1
+ import type { Result } from 'neverthrow';
2
+ import type { DomainEventV1 } from '../durable-core/schemas/session/index.js';
3
+ import type { ProjectionError } from './projection-error.js';
4
+ type AssessmentRecordedEventV1 = Extract<DomainEventV1, {
5
+ kind: 'assessment_recorded';
6
+ }>;
7
+ export interface RecordedAssessmentViewV2 {
8
+ readonly assessmentId: string;
9
+ readonly attemptId: string;
10
+ readonly artifactOutputId: string;
11
+ readonly summary?: string;
12
+ readonly normalizationNotes: readonly string[];
13
+ readonly dimensions: AssessmentRecordedEventV1['data']['dimensions'];
14
+ readonly recordedAtEventIndex: number;
15
+ }
16
+ export interface AssessmentsProjectionV2 {
17
+ readonly byNodeId: Readonly<Record<string, readonly RecordedAssessmentViewV2[]>>;
18
+ }
19
+ export declare function projectAssessmentsV2(events: readonly DomainEventV1[]): Result<AssessmentsProjectionV2, ProjectionError>;
20
+ export declare function getLatestAssessmentForNode(projection: AssessmentsProjectionV2, nodeId: string): RecordedAssessmentViewV2 | undefined;
21
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectAssessmentsV2 = projectAssessmentsV2;
4
+ exports.getLatestAssessmentForNode = getLatestAssessmentForNode;
5
+ const neverthrow_1 = require("neverthrow");
6
+ const constants_js_1 = require("../durable-core/constants.js");
7
+ function projectAssessmentsV2(events) {
8
+ for (let i = 1; i < events.length; i++) {
9
+ if (events[i].eventIndex < events[i - 1].eventIndex) {
10
+ return (0, neverthrow_1.err)({ code: 'PROJECTION_INVARIANT_VIOLATION', message: 'Events must be sorted by eventIndex ascending' });
11
+ }
12
+ }
13
+ const byNodeId = {};
14
+ for (const event of events) {
15
+ if (event.kind !== constants_js_1.EVENT_KIND.ASSESSMENT_RECORDED)
16
+ continue;
17
+ const nodeId = event.scope.nodeId;
18
+ if (!byNodeId[nodeId])
19
+ byNodeId[nodeId] = [];
20
+ byNodeId[nodeId].push({
21
+ assessmentId: event.data.assessmentId,
22
+ attemptId: event.data.attemptId,
23
+ artifactOutputId: event.data.artifactOutputId,
24
+ summary: event.data.summary,
25
+ normalizationNotes: event.data.normalizationNotes,
26
+ dimensions: event.data.dimensions,
27
+ recordedAtEventIndex: event.eventIndex,
28
+ });
29
+ }
30
+ return (0, neverthrow_1.ok)({ byNodeId });
31
+ }
32
+ function getLatestAssessmentForNode(projection, nodeId) {
33
+ const assessments = projection.byNodeId[nodeId];
34
+ return assessments && assessments.length > 0 ? assessments[assessments.length - 1] : undefined;
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exaudeus/workrail",
3
- "version": "3.10.0",
3
+ "version": "3.11.1",
4
4
  "description": "Step-by-step workflow enforcement for AI agents via MCP",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -578,8 +578,8 @@
578
578
  "prompt.composition",
579
579
  "workflow.definition"
580
580
  ],
581
- "rule": "Use extension points when a workflow wants stable customization slots rather than hardcoding routine or binding references inline.",
582
- "why": "Extension points make customization explicit, inspectable, and project-overridable.",
581
+ "rule": "Use extension points when a workflow wants stable project-overridable delegation seams rather than hardcoding bound routine or workflow names inline.",
582
+ "why": "Extension points make delegated customization explicit, inspectable, and project-overridable without conflating rebinding with routine injection.",
583
583
  "enforcement": [
584
584
  "advisory"
585
585
  ],
@@ -602,11 +602,15 @@
602
602
  ],
603
603
  "checks": [
604
604
  "Declare extension points at the workflow level when bindings are part of the contract.",
605
- "Avoid hidden or undocumented binding slots in prompts."
605
+ "Avoid hidden or undocumented binding slots in prompts.",
606
+ "Prefer `templateCall` when the real goal is reusable inline routine structure, visible injected steps, or parent-step confirmation behavior.",
607
+ "Use extension points only when the seam is intentionally delegated and may need project-level rebinding."
606
608
  ],
607
609
  "antiPatterns": [
608
610
  "Hardcoding team-customizable routine names in prompt text without an extension-point declaration",
609
- "Using `{{wr.bindings.*}}` tokens in a workflow that declares no extension points"
611
+ "Using `{{wr.bindings.*}}` tokens in a workflow that declares no extension points",
612
+ "Using extension points where `templateCall` would better represent the parent workflow's real structure",
613
+ "Expecting `{{wr.bindings.*}}` to change which routine gets injected inline"
610
614
  ]
611
615
  }
612
616
  ]
@@ -682,6 +686,36 @@
682
686
  }
683
687
  ]
684
688
  },
689
+ {
690
+ "id": "references",
691
+ "title": "Workflow references",
692
+ "rules": [
693
+ {
694
+ "id": "references-are-for-runtime-companion-material",
695
+ "status": "active",
696
+ "level": "recommended",
697
+ "scope": [
698
+ "workflow.references",
699
+ "workflow.definition"
700
+ ],
701
+ "rule": "Declare references only for documents the running workflow may genuinely need while executing its task.",
702
+ "why": "References are surfaced to the agent at workflow start and become part of the workflow hash. Maintainer-only or authoring-only references add cognitive load and hash churn without improving runtime execution.",
703
+ "enforcement": [
704
+ "advisory"
705
+ ],
706
+ "checks": [
707
+ "Keep references that materially help the running workflow perform its task.",
708
+ "Prefer rubrics, target-system specs, policies, or playbooks that constrain runtime judgment.",
709
+ "If removing a reference would not make the running workflow materially worse at execution, remove it."
710
+ ],
711
+ "antiPatterns": [
712
+ "Adding workflow-schema references to ordinary execution workflows that are not authoring or validation workflows",
713
+ "Adding authoring-spec or provenance references to workflows whose runtime task is unrelated to workflow authoring",
714
+ "Using references to justify a workflow's design to maintainers instead of helping the running agent do the task"
715
+ ]
716
+ }
717
+ ]
718
+ },
685
719
  {
686
720
  "id": "response-supplements",
687
721
  "title": "Response supplements and delivery-owned guidance",
@@ -0,0 +1,43 @@
1
+ ## Production Readiness Audit Rubric
2
+
3
+ Use this rubric when running the bundled `production-readiness-audit` workflow.
4
+
5
+ ### Coverage domains
6
+
7
+ - Debugging and correctness
8
+ - Runtime readiness
9
+ - Technical debt and maintainability
10
+ - Philosophy and repo-pattern alignment
11
+ - Tests and observability
12
+ - Security and performance when the audited scope materially touches them
13
+
14
+ ### Finding classes
15
+
16
+ - **Confirmed**: supported by primary evidence such as code, tests, build output, runtime traces, or a directly checked artifact
17
+ - **Plausible**: directionally concerning, but not yet strong enough to drive the verdict alone
18
+ - **Rejected**: weakened or disproved by fuller context or direct evidence
19
+
20
+ ### Verdicts
21
+
22
+ - **ready**: no material blockers, no major unresolved gaps, and confidence is strong enough for the audited scope
23
+ - **ready_with_conditions**: broadly shippable, but bounded conditions or follow-up work still matter
24
+ - **not_ready**: blockers or major risks make shipping irresponsible right now
25
+ - **inconclusive**: the scope or evidence is too weak for a clean readiness call
26
+
27
+ ### Confidence bands
28
+
29
+ - **High**: coverage is materially adequate and serious claims are backed by primary evidence
30
+ - **Medium**: most important areas are covered, but some uncertainty or weaker proof remains
31
+ - **Low**: major gaps, contradictions, or thin evidence still cap the verdict
32
+
33
+ ### Severity discipline
34
+
35
+ - Do not upgrade a claim to blocker status just because multiple subagents agree
36
+ - Do not flatten real contradictions into a single confident story without adjudication
37
+ - Do not call a scope production-ready when a material coverage gap still weakens the verdict
38
+
39
+ ### Synthesis discipline
40
+
41
+ - Treat delegated output as evidence, not final truth
42
+ - Say what changed your mind, what you rejected, and why
43
+ - Keep the final handoff decision-focused rather than implementation-focused