@exaudeus/workrail 3.9.2 → 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 +150 -78
- 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 +17 -1
- 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 +4 -1
- package/dist/v2/durable-core/constants.js +5 -2
- 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 +53 -67
- 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/retrieval-contract.d.ts +105 -0
- package/dist/v2/durable-core/domain/retrieval-contract.js +310 -0
- 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/dist/v2/projections/resume-ranking.d.ts +1 -0
- package/dist/v2/projections/resume-ranking.js +12 -24
- package/package.json +1 -1
- package/spec/workflow.schema.json +110 -0
- package/workflows/bug-investigation.agentic.v2.json +28 -2
- package/workflows/mr-review-workflow.agentic.v2.json +10 -5
- 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
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_RESUME_CANDIDATES = void 0;
|
|
3
|
+
exports.MAX_RESUME_CANDIDATES = exports.MAX_RESUME_PREVIEW_BYTES = void 0;
|
|
4
4
|
exports.asRecapSnippet = asRecapSnippet;
|
|
5
5
|
exports.normalizeToTokens = normalizeToTokens;
|
|
6
6
|
exports.allQueryTokensMatch = allQueryTokensMatch;
|
|
@@ -11,7 +11,10 @@ exports.computeQueryRelevanceScore = computeQueryRelevanceScore;
|
|
|
11
11
|
exports.assignTier = assignTier;
|
|
12
12
|
exports.rankResumeCandidates = rankResumeCandidates;
|
|
13
13
|
const constants_js_1 = require("../durable-core/constants.js");
|
|
14
|
-
const
|
|
14
|
+
const retrieval_contract_js_1 = require("../durable-core/domain/retrieval-contract.js");
|
|
15
|
+
var constants_js_2 = require("../durable-core/constants.js");
|
|
16
|
+
Object.defineProperty(exports, "MAX_RESUME_PREVIEW_BYTES", { enumerable: true, get: function () { return constants_js_2.MAX_RESUME_PREVIEW_BYTES; } });
|
|
17
|
+
const MAX_SNIPPET_BYTES = constants_js_1.MAX_RESUME_PREVIEW_BYTES;
|
|
15
18
|
function asRecapSnippet(raw) {
|
|
16
19
|
const stripped = raw.endsWith(constants_js_1.TRUNCATION_MARKER)
|
|
17
20
|
? raw.slice(0, -constants_js_1.TRUNCATION_MARKER.length)
|
|
@@ -145,29 +148,14 @@ function collectMatchReasons(summary, query, tier) {
|
|
|
145
148
|
return reasons;
|
|
146
149
|
}
|
|
147
150
|
function buildPreviewSnippet(summary, query) {
|
|
148
|
-
const
|
|
149
|
-
|
|
151
|
+
const segments = [
|
|
152
|
+
summary.sessionTitle ? (0, retrieval_contract_js_1.createSessionTitlePreviewSegment)(summary.sessionTitle) : null,
|
|
153
|
+
summary.recapSnippet ? (0, retrieval_contract_js_1.createRecapPreviewSegment)(summary.recapSnippet) : null,
|
|
154
|
+
].filter((segment) => segment !== null);
|
|
155
|
+
if (segments.length === 0)
|
|
150
156
|
return '';
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
return summary.recapSnippet ?? previewSource;
|
|
154
|
-
const lower = previewSource.toLowerCase();
|
|
155
|
-
let bestIndex = -1;
|
|
156
|
-
for (const token of queryTokens) {
|
|
157
|
-
if (token.length < 3)
|
|
158
|
-
continue;
|
|
159
|
-
const idx = lower.indexOf(token);
|
|
160
|
-
if (idx !== -1 && (bestIndex === -1 || idx < bestIndex))
|
|
161
|
-
bestIndex = idx;
|
|
162
|
-
}
|
|
163
|
-
if (bestIndex === -1)
|
|
164
|
-
return summary.recapSnippet ?? previewSource;
|
|
165
|
-
const start = Math.max(0, bestIndex - 100);
|
|
166
|
-
const end = Math.min(previewSource.length, bestIndex + 180);
|
|
167
|
-
const slice = previewSource.slice(start, end).trim();
|
|
168
|
-
const prefix = start > 0 ? '...' : '';
|
|
169
|
-
const suffix = end < previewSource.length ? '...' : '';
|
|
170
|
-
return `${prefix}${slice}${suffix}`;
|
|
157
|
+
const focusTerms = query.freeTextQuery ? [...normalizeToTokens(query.freeTextQuery)] : [];
|
|
158
|
+
return (0, retrieval_contract_js_1.renderBudgetedResumePreview)({ segments, focusTerms }).text;
|
|
171
159
|
}
|
|
172
160
|
function deriveConfidence(tier, reasons) {
|
|
173
161
|
if (tier.kind === 'matched_exact_id' || tier.kind === 'matched_notes')
|