@exaudeus/workrail 3.10.0 → 3.11.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/dist/application/services/validation-engine.js +134 -0
- package/dist/application/services/workflow-compiler.js +54 -0
- package/dist/manifest.json +138 -74
- package/dist/mcp/handlers/v2-advance-core/assessment-consequences.d.ts +14 -0
- package/dist/mcp/handlers/v2-advance-core/assessment-consequences.js +27 -0
- package/dist/mcp/handlers/v2-advance-core/assessment-validation.d.ts +16 -0
- package/dist/mcp/handlers/v2-advance-core/assessment-validation.js +213 -0
- package/dist/mcp/handlers/v2-advance-core/event-builders.d.ts +1 -0
- package/dist/mcp/handlers/v2-advance-core/event-builders.js +3 -2
- package/dist/mcp/handlers/v2-advance-core/index.js +23 -8
- package/dist/mcp/handlers/v2-advance-core/input-validation.d.ts +9 -1
- package/dist/mcp/handlers/v2-advance-core/input-validation.js +22 -2
- package/dist/mcp/handlers/v2-advance-core/outcome-blocked.d.ts +2 -0
- package/dist/mcp/handlers/v2-advance-core/outcome-blocked.js +69 -19
- package/dist/mcp/handlers/v2-advance-core/outcome-success.js +22 -0
- package/dist/mcp/handlers/v2-execution/replay.js +7 -0
- package/dist/mcp/output-schemas.d.ts +156 -42
- package/dist/mcp/output-schemas.js +15 -0
- package/dist/mcp/v2-response-formatter.js +7 -1
- package/dist/types/workflow-definition.d.ts +26 -0
- package/dist/types/workflow-definition.js +16 -1
- package/dist/v2/durable-core/constants.d.ts +2 -0
- package/dist/v2/durable-core/constants.js +2 -0
- package/dist/v2/durable-core/domain/assessment-consequence-event-builder.d.ts +23 -0
- package/dist/v2/durable-core/domain/assessment-consequence-event-builder.js +36 -0
- package/dist/v2/durable-core/domain/assessment-record.d.ts +12 -0
- package/dist/v2/durable-core/domain/assessment-record.js +2 -0
- package/dist/v2/durable-core/domain/assessment-recorded-event-builder.d.ts +22 -0
- package/dist/v2/durable-core/domain/assessment-recorded-event-builder.js +38 -0
- package/dist/v2/durable-core/domain/blocked-node-builder.d.ts +1 -1
- package/dist/v2/durable-core/domain/blocked-node-builder.js +8 -0
- package/dist/v2/durable-core/domain/blocking-decision.d.ts +6 -0
- package/dist/v2/durable-core/domain/blocking-decision.js +15 -0
- package/dist/v2/durable-core/domain/prompt-renderer.js +25 -1
- package/dist/v2/durable-core/domain/reason-model.d.ts +12 -2
- package/dist/v2/durable-core/domain/reason-model.js +27 -2
- package/dist/v2/durable-core/domain/risk-policy-guardrails.js +1 -0
- package/dist/v2/durable-core/domain/validation-criteria-validator.d.ts +1 -0
- package/dist/v2/durable-core/domain/validation-criteria-validator.js +11 -0
- package/dist/v2/durable-core/schemas/artifacts/assessment.d.ts +55 -0
- package/dist/v2/durable-core/schemas/artifacts/assessment.js +29 -0
- package/dist/v2/durable-core/schemas/artifacts/index.d.ts +2 -1
- package/dist/v2/durable-core/schemas/artifacts/index.js +8 -1
- package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +24 -24
- package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +141 -21
- package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.js +10 -1
- package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +729 -171
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +1442 -202
- package/dist/v2/durable-core/schemas/session/events.d.ts +231 -8
- package/dist/v2/durable-core/schemas/session/events.js +36 -0
- package/dist/v2/durable-core/schemas/session/gaps.d.ts +2 -2
- package/dist/v2/projections/assessment-consequences.d.ts +19 -0
- package/dist/v2/projections/assessment-consequences.js +33 -0
- package/dist/v2/projections/assessments.d.ts +21 -0
- package/dist/v2/projections/assessments.js +35 -0
- package/package.json +1 -1
- package/spec/workflow.schema.json +110 -0
- package/workflows/bug-investigation.agentic.v2.json +28 -2
- package/workflows/test-artifact-loop-control.json +28 -2
|
@@ -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
|
@@ -135,6 +135,14 @@
|
|
|
135
135
|
},
|
|
136
136
|
"uniqueItems": true
|
|
137
137
|
},
|
|
138
|
+
"assessments": {
|
|
139
|
+
"type": "array",
|
|
140
|
+
"description": "Workflow-declared assessment definitions. Steps reference these by ID via assessmentRefs instead of embedding assessment structure inline repeatedly.",
|
|
141
|
+
"items": {
|
|
142
|
+
"$ref": "#/$defs/assessmentDefinition"
|
|
143
|
+
},
|
|
144
|
+
"uniqueItems": true
|
|
145
|
+
},
|
|
138
146
|
"extensionPoints": {
|
|
139
147
|
"type": "array",
|
|
140
148
|
"description": "Bounded cognitive slots that users can customize via .workrail/bindings.json. Each slot is referenced in step prompts via {{wr.bindings.slotId}} and resolved at compile time. Use extension points for bounded cognitive units, not for core orchestration or final synthesis ownership.",
|
|
@@ -293,6 +301,21 @@
|
|
|
293
301
|
"runCondition": { "$ref": "#/$defs/condition" },
|
|
294
302
|
"validationCriteria": { "oneOf": [ { "type": "array", "items": { "$ref": "#/$defs/validationRule" } }, { "$ref": "#/$defs/validationComposition" } ] },
|
|
295
303
|
"outputContract": { "$ref": "#/$defs/outputContract" },
|
|
304
|
+
"assessmentRefs": {
|
|
305
|
+
"type": "array",
|
|
306
|
+
"description": "References to workflow-level assessment definitions expected for this step. V1 supports exactly one assessmentRef per step.",
|
|
307
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 64 },
|
|
308
|
+
"minItems": 1,
|
|
309
|
+
"maxItems": 1,
|
|
310
|
+
"uniqueItems": true
|
|
311
|
+
},
|
|
312
|
+
"assessmentConsequences": {
|
|
313
|
+
"type": "array",
|
|
314
|
+
"description": "Step-local assessment consequence declarations. V1 supports at most one exact-match follow-up consequence.",
|
|
315
|
+
"items": { "$ref": "#/$defs/assessmentConsequence" },
|
|
316
|
+
"minItems": 1,
|
|
317
|
+
"maxItems": 1
|
|
318
|
+
},
|
|
296
319
|
"notesOptional": { "type": "boolean", "description": "When true, output.notesMarkdown is not required for this step. Steps with outputContract are automatically exempt. Use sparingly for mechanical steps with no substantive work to document." },
|
|
297
320
|
"functionDefinitions": { "type": "array", "items": { "$ref": "#/$defs/functionDefinition" } },
|
|
298
321
|
"functionCalls": { "type": "array", "items": { "$ref": "#/$defs/functionCall" } },
|
|
@@ -727,6 +750,93 @@
|
|
|
727
750
|
"required": ["contractRef"],
|
|
728
751
|
"additionalProperties": false
|
|
729
752
|
},
|
|
753
|
+
"assessmentDimension": {
|
|
754
|
+
"type": "object",
|
|
755
|
+
"description": "A bounded dimension within a workflow-declared assessment definition.",
|
|
756
|
+
"properties": {
|
|
757
|
+
"id": {
|
|
758
|
+
"type": "string",
|
|
759
|
+
"minLength": 1,
|
|
760
|
+
"maxLength": 64
|
|
761
|
+
},
|
|
762
|
+
"purpose": {
|
|
763
|
+
"type": "string",
|
|
764
|
+
"minLength": 1,
|
|
765
|
+
"maxLength": 256
|
|
766
|
+
},
|
|
767
|
+
"levels": {
|
|
768
|
+
"type": "array",
|
|
769
|
+
"items": {
|
|
770
|
+
"type": "string",
|
|
771
|
+
"minLength": 1,
|
|
772
|
+
"maxLength": 64
|
|
773
|
+
},
|
|
774
|
+
"minItems": 2,
|
|
775
|
+
"uniqueItems": true
|
|
776
|
+
},
|
|
777
|
+
"required": {
|
|
778
|
+
"type": "boolean",
|
|
779
|
+
"default": true
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
"required": ["id", "purpose", "levels"],
|
|
783
|
+
"additionalProperties": false
|
|
784
|
+
},
|
|
785
|
+
"assessmentDefinition": {
|
|
786
|
+
"type": "object",
|
|
787
|
+
"description": "Workflow-declared assessment definition referenced by steps.",
|
|
788
|
+
"properties": {
|
|
789
|
+
"id": {
|
|
790
|
+
"type": "string",
|
|
791
|
+
"minLength": 1,
|
|
792
|
+
"maxLength": 64
|
|
793
|
+
},
|
|
794
|
+
"purpose": {
|
|
795
|
+
"type": "string",
|
|
796
|
+
"minLength": 1,
|
|
797
|
+
"maxLength": 256
|
|
798
|
+
},
|
|
799
|
+
"dimensions": {
|
|
800
|
+
"type": "array",
|
|
801
|
+
"items": {
|
|
802
|
+
"$ref": "#/$defs/assessmentDimension"
|
|
803
|
+
},
|
|
804
|
+
"minItems": 1
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
"required": ["id", "purpose", "dimensions"],
|
|
808
|
+
"additionalProperties": false
|
|
809
|
+
},
|
|
810
|
+
"assessmentConsequenceTrigger": {
|
|
811
|
+
"type": "object",
|
|
812
|
+
"description": "Exact-match trigger on one declared assessment dimension and one declared canonical level.",
|
|
813
|
+
"properties": {
|
|
814
|
+
"dimensionId": { "type": "string", "minLength": 1, "maxLength": 64 },
|
|
815
|
+
"equalsLevel": { "type": "string", "minLength": 1, "maxLength": 64 }
|
|
816
|
+
},
|
|
817
|
+
"required": ["dimensionId", "equalsLevel"],
|
|
818
|
+
"additionalProperties": false
|
|
819
|
+
},
|
|
820
|
+
"assessmentConsequenceEffect": {
|
|
821
|
+
"type": "object",
|
|
822
|
+
"description": "V1 assessment consequence effect. Keeps the same step pending and requires follow-up before retry.",
|
|
823
|
+
"properties": {
|
|
824
|
+
"kind": { "const": "require_followup" },
|
|
825
|
+
"guidance": { "type": "string", "minLength": 1, "maxLength": 512 }
|
|
826
|
+
},
|
|
827
|
+
"required": ["kind", "guidance"],
|
|
828
|
+
"additionalProperties": false
|
|
829
|
+
},
|
|
830
|
+
"assessmentConsequence": {
|
|
831
|
+
"type": "object",
|
|
832
|
+
"description": "Step-local assessment consequence declaration. V1 supports one exact-match follow-up consequence only.",
|
|
833
|
+
"properties": {
|
|
834
|
+
"when": { "$ref": "#/$defs/assessmentConsequenceTrigger" },
|
|
835
|
+
"effect": { "$ref": "#/$defs/assessmentConsequenceEffect" }
|
|
836
|
+
},
|
|
837
|
+
"required": ["when", "effect"],
|
|
838
|
+
"additionalProperties": false
|
|
839
|
+
},
|
|
730
840
|
"functionCall": {
|
|
731
841
|
"type": "object",
|
|
732
842
|
"properties": {
|