@workbench-ai/workbench-core 0.0.66 → 0.0.68
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/execution-graph.d.ts +4 -3
- package/dist/execution-graph.d.ts.map +1 -1
- package/dist/execution-graph.js +15 -14
- package/dist/execution-jobs.d.ts +5 -20
- package/dist/execution-jobs.d.ts.map +1 -1
- package/dist/execution-jobs.js +7 -91
- package/dist/execution-outputs.d.ts +2 -2
- package/dist/execution-outputs.d.ts.map +1 -1
- package/dist/execution-outputs.js +10 -10
- package/dist/execution-runtime-types.d.ts +1 -1
- package/dist/execution-runtime-types.d.ts.map +1 -1
- package/dist/execution-scheduler.d.ts.map +1 -1
- package/dist/execution-scheduler.js +4 -1
- package/dist/execution-traces.js +1 -1
- package/dist/generic-spec.d.ts +29 -29
- package/dist/generic-spec.d.ts.map +1 -1
- package/dist/generic-spec.js +94 -92
- package/dist/index.d.ts +325 -220
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5784 -3856
- package/dist/runtime-dockerfile.d.ts +1 -1
- package/dist/runtime-dockerfile.d.ts.map +1 -1
- package/dist/runtime-dockerfile.js +4 -4
- package/dist/runtime-utils.d.ts +1 -1
- package/dist/runtime-utils.d.ts.map +1 -1
- package/dist/runtime-utils.js +3 -3
- package/dist/sandbox-backends/docker.js +7 -5
- package/dist/sandbox-inputs.js +3 -3
- package/dist/sandbox-plane.d.ts.map +1 -1
- package/dist/sandbox-plane.js +13 -9
- package/dist/skill-patch.d.ts +8 -0
- package/dist/skill-patch.d.ts.map +1 -0
- package/dist/{candidate-patch.js → skill-patch.js} +5 -5
- package/package.json +3 -3
- package/worker/sandbox-adapter-runner.cjs +2 -2
- package/dist/candidate-patch.d.ts +0 -8
- package/dist/candidate-patch.d.ts.map +0 -1
- package/dist/execution-evidence.d.ts +0 -22
- package/dist/execution-evidence.d.ts.map +0 -1
- package/dist/execution-evidence.js +0 -302
- package/dist/inspection.d.ts +0 -111
- package/dist/inspection.d.ts.map +0 -1
- package/dist/inspection.js +0 -217
package/dist/inspection.d.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { type WorkbenchEvaluationComparison } from "@workbench-ai/workbench-contract";
|
|
2
|
-
import type { AuthoredWorkbenchSourceDocument, CandidateCaseReview, CandidateFilePreview, CandidateFileSummary, CandidateLineageGraph, CandidateRecord, EvaluationScorecard, RemoteWorkbenchJob, RunSummary, RuntimeSnapshot, SurfaceSnapshotFile, WorkbenchExecutionEventRole, WorkbenchExecutionTrace, WorkbenchExecutionTraceDetail, WorkbenchTraceSession } from "@workbench-ai/workbench-contract";
|
|
3
|
-
export interface WorkbenchInspectionErrorOptions {
|
|
4
|
-
status?: number;
|
|
5
|
-
}
|
|
6
|
-
export declare class WorkbenchInspectionError extends Error {
|
|
7
|
-
readonly status: number;
|
|
8
|
-
readonly statusCode: number;
|
|
9
|
-
constructor(message: string, options?: WorkbenchInspectionErrorOptions);
|
|
10
|
-
}
|
|
11
|
-
export interface WorkbenchInspectionFileListInput {
|
|
12
|
-
fingerprint?: string | null;
|
|
13
|
-
}
|
|
14
|
-
export interface WorkbenchInspectionPreviewInput {
|
|
15
|
-
path: string;
|
|
16
|
-
view: "diff" | "raw" | "rendered";
|
|
17
|
-
}
|
|
18
|
-
export interface WorkbenchInspectionFilePreviewInput extends WorkbenchInspectionFileListInput, WorkbenchInspectionPreviewInput {
|
|
19
|
-
}
|
|
20
|
-
export interface WorkbenchInspectionCandidateInput {
|
|
21
|
-
id: string;
|
|
22
|
-
}
|
|
23
|
-
export interface WorkbenchInspectionCandidatePreviewInput extends WorkbenchInspectionCandidateInput, WorkbenchInspectionPreviewInput {
|
|
24
|
-
}
|
|
25
|
-
export interface WorkbenchInspectionEvaluationInput {
|
|
26
|
-
id: string;
|
|
27
|
-
}
|
|
28
|
-
export interface WorkbenchInspectionCaseReviewInput {
|
|
29
|
-
candidateId: string;
|
|
30
|
-
caseId: string;
|
|
31
|
-
runId: string;
|
|
32
|
-
sampleIndex?: number;
|
|
33
|
-
}
|
|
34
|
-
export interface WorkbenchInspectionRunInput {
|
|
35
|
-
id: string;
|
|
36
|
-
includeJobs?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export interface WorkbenchInspectionExecutionInput {
|
|
39
|
-
runId: string;
|
|
40
|
-
jobId: string;
|
|
41
|
-
}
|
|
42
|
-
export interface WorkbenchInspectionExecutionPreviewInput extends WorkbenchInspectionExecutionInput {
|
|
43
|
-
path: string;
|
|
44
|
-
view: "diff" | "raw" | "rendered";
|
|
45
|
-
}
|
|
46
|
-
export interface WorkbenchInspectionRunDetail {
|
|
47
|
-
run: RunSummary;
|
|
48
|
-
jobs?: RemoteWorkbenchJob[];
|
|
49
|
-
}
|
|
50
|
-
export type WorkbenchFailureKind = "run" | "evaluation" | "sample" | "case" | "job";
|
|
51
|
-
export interface WorkbenchFailureDetail {
|
|
52
|
-
kind: WorkbenchFailureKind;
|
|
53
|
-
id: string;
|
|
54
|
-
status?: string;
|
|
55
|
-
runId?: string;
|
|
56
|
-
candidateId?: string;
|
|
57
|
-
evaluationId?: string;
|
|
58
|
-
jobId?: string;
|
|
59
|
-
caseId?: string;
|
|
60
|
-
sampleIndex?: number;
|
|
61
|
-
attemptIndex?: number;
|
|
62
|
-
error?: string;
|
|
63
|
-
}
|
|
64
|
-
export interface WorkbenchFailureDiagnosis {
|
|
65
|
-
targetId: string | null;
|
|
66
|
-
failures: WorkbenchFailureDetail[];
|
|
67
|
-
failedRunCount: number;
|
|
68
|
-
failedEvaluationCount: number;
|
|
69
|
-
failedJobCount: number;
|
|
70
|
-
}
|
|
71
|
-
export interface WorkbenchInspectionBackend {
|
|
72
|
-
projectId: string;
|
|
73
|
-
snapshot(): Promise<RuntimeSnapshot>;
|
|
74
|
-
spec(input: WorkbenchInspectionFileListInput): Promise<AuthoredWorkbenchSourceDocument>;
|
|
75
|
-
sourceFiles(input: WorkbenchInspectionFileListInput): Promise<SurfaceSnapshotFile[]>;
|
|
76
|
-
candidate(input: WorkbenchInspectionCandidateInput): Promise<CandidateRecord>;
|
|
77
|
-
candidateFiles(input: WorkbenchInspectionCandidateInput): Promise<{
|
|
78
|
-
files: SurfaceSnapshotFile[];
|
|
79
|
-
changedPaths: readonly string[];
|
|
80
|
-
}>;
|
|
81
|
-
evaluation(input: WorkbenchInspectionEvaluationInput): Promise<EvaluationScorecard>;
|
|
82
|
-
run(input: WorkbenchInspectionRunInput): Promise<WorkbenchInspectionRunDetail>;
|
|
83
|
-
jobInRun?(input: WorkbenchInspectionExecutionInput): Promise<RemoteWorkbenchJob>;
|
|
84
|
-
executionFiles(input: WorkbenchInspectionExecutionInput): Promise<SurfaceSnapshotFile[]>;
|
|
85
|
-
caseReview?(input: WorkbenchInspectionCaseReviewInput): Promise<CandidateCaseReview>;
|
|
86
|
-
executionTrace?(input: WorkbenchInspectionExecutionInput): Promise<WorkbenchExecutionTraceDetail>;
|
|
87
|
-
traceForJob?(job: RemoteWorkbenchJob, role: WorkbenchExecutionEventRole): WorkbenchExecutionTrace;
|
|
88
|
-
traceSessionsForJob?(job: RemoteWorkbenchJob, role: WorkbenchExecutionEventRole): WorkbenchTraceSession[];
|
|
89
|
-
}
|
|
90
|
-
export interface WorkbenchInspection {
|
|
91
|
-
snapshot(): Promise<RuntimeSnapshot>;
|
|
92
|
-
spec(input?: WorkbenchInspectionFileListInput): Promise<AuthoredWorkbenchSourceDocument>;
|
|
93
|
-
sourceFiles(input?: WorkbenchInspectionFileListInput): Promise<CandidateFileSummary[]>;
|
|
94
|
-
sourcePreview(input: WorkbenchInspectionFilePreviewInput): Promise<CandidateFilePreview>;
|
|
95
|
-
candidate(input: WorkbenchInspectionCandidateInput): Promise<CandidateRecord>;
|
|
96
|
-
candidateFiles(input: WorkbenchInspectionCandidateInput): Promise<CandidateFileSummary[]>;
|
|
97
|
-
candidatePreview(input: WorkbenchInspectionCandidatePreviewInput): Promise<CandidateFilePreview>;
|
|
98
|
-
evaluations(): Promise<WorkbenchEvaluationComparison>;
|
|
99
|
-
evaluation(input: WorkbenchInspectionEvaluationInput): Promise<EvaluationScorecard>;
|
|
100
|
-
caseReview(input: WorkbenchInspectionCaseReviewInput): Promise<CandidateCaseReview>;
|
|
101
|
-
run(input: WorkbenchInspectionRunInput): Promise<WorkbenchInspectionRunDetail>;
|
|
102
|
-
executionTrace(input: WorkbenchInspectionExecutionInput): Promise<WorkbenchExecutionTraceDetail>;
|
|
103
|
-
executionFiles(input: WorkbenchInspectionExecutionInput): Promise<CandidateFileSummary[]>;
|
|
104
|
-
executionPreview(input: WorkbenchInspectionExecutionPreviewInput): Promise<CandidateFilePreview>;
|
|
105
|
-
lineage(): Promise<CandidateLineageGraph>;
|
|
106
|
-
diagnose(input?: {
|
|
107
|
-
targetId?: string | null;
|
|
108
|
-
}): Promise<WorkbenchFailureDiagnosis>;
|
|
109
|
-
}
|
|
110
|
-
export declare function createWorkbenchInspection(backend: WorkbenchInspectionBackend): WorkbenchInspection;
|
|
111
|
-
//# sourceMappingURL=inspection.d.ts.map
|
package/dist/inspection.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inspection.d.ts","sourceRoot":"","sources":["../src/inspection.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EACV,+BAA+B,EAC/B,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EAEnB,kBAAkB,EAElB,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,kCAAkC,CAAC;AAc1C,MAAM,WAAW,+BAA+B;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;I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CAAC,mBAAmB,CAAC,CAAC;IACpF,UAAU,CAAC,KAAK,EAAE,kCAAkC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACpF,GAAG,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC/E,cAAc,CAAC,KAAK,EAAE,iCAAiC,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;IACjG,cAAc,CAAC,KAAK,EAAE,iCAAiC,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC1F,gBAAgB,CAAC,KAAK,EAAE,wCAAwC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjG,OAAO,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACpF;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CAiGrB"}
|
package/dist/inspection.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { buildCandidateLineage, buildWorkbenchEvaluationComparison, } from "@workbench-ai/workbench-contract";
|
|
2
|
-
import { buildCandidateCaseExecutionRefs, buildWorkbenchExecutionEvidence, } from "./execution-evidence.js";
|
|
3
|
-
import { candidateRecordWithoutDerivedFields, createCandidateFilePreview, createCaseReview, summarizeCandidateFiles, } from "./index.js";
|
|
4
|
-
export class WorkbenchInspectionError extends Error {
|
|
5
|
-
status;
|
|
6
|
-
statusCode;
|
|
7
|
-
constructor(message, options = {}) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = "WorkbenchInspectionError";
|
|
10
|
-
this.status = options.status ?? 400;
|
|
11
|
-
this.statusCode = this.status;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export function createWorkbenchInspection(backend) {
|
|
15
|
-
return {
|
|
16
|
-
snapshot: () => backend.snapshot(),
|
|
17
|
-
spec: (input = {}) => backend.spec(input),
|
|
18
|
-
sourceFiles: async (input = {}) => {
|
|
19
|
-
const files = await backend.sourceFiles(input);
|
|
20
|
-
return summarizeCandidateFiles(files, files.map((file) => file.path));
|
|
21
|
-
},
|
|
22
|
-
sourcePreview: async (input) => createCandidateFilePreview({
|
|
23
|
-
files: await backend.sourceFiles(input),
|
|
24
|
-
path: input.path,
|
|
25
|
-
view: input.view,
|
|
26
|
-
}),
|
|
27
|
-
candidate: async (input) => candidateRecordWithoutDerivedFields(await backend.candidate(input)),
|
|
28
|
-
candidateFiles: async (input) => {
|
|
29
|
-
const result = await backend.candidateFiles(input);
|
|
30
|
-
return summarizeCandidateFiles(result.files, result.changedPaths);
|
|
31
|
-
},
|
|
32
|
-
candidatePreview: async (input) => createCandidateFilePreview({
|
|
33
|
-
files: (await backend.candidateFiles(input)).files,
|
|
34
|
-
path: input.path,
|
|
35
|
-
view: input.view,
|
|
36
|
-
}),
|
|
37
|
-
evaluations: async () => {
|
|
38
|
-
const snapshot = await backend.snapshot();
|
|
39
|
-
return buildWorkbenchEvaluationComparison(snapshot.evaluations);
|
|
40
|
-
},
|
|
41
|
-
evaluation: (input) => backend.evaluation(input),
|
|
42
|
-
caseReview: async (input) => {
|
|
43
|
-
if (backend.caseReview) {
|
|
44
|
-
return await backend.caseReview(input);
|
|
45
|
-
}
|
|
46
|
-
const candidate = await backend.candidate({ id: input.candidateId });
|
|
47
|
-
const jobs = (await backend.run({ id: input.runId, includeJobs: true })).jobs ?? [];
|
|
48
|
-
return createCaseReview({
|
|
49
|
-
candidate,
|
|
50
|
-
caseId: input.caseId,
|
|
51
|
-
executions: buildCandidateCaseExecutionRefs({
|
|
52
|
-
jobs,
|
|
53
|
-
candidateId: input.candidateId,
|
|
54
|
-
caseId: input.caseId,
|
|
55
|
-
sampleIndex: input.sampleIndex,
|
|
56
|
-
}),
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
run: (input) => backend.run(input),
|
|
60
|
-
executionTrace: async (input) => {
|
|
61
|
-
if (backend.executionTrace) {
|
|
62
|
-
return await backend.executionTrace(input);
|
|
63
|
-
}
|
|
64
|
-
if (!backend.jobInRun || !backend.traceForJob) {
|
|
65
|
-
throw new WorkbenchInspectionError("Execution traces are not available for this Workbench inspection backend.", { status: 404 });
|
|
66
|
-
}
|
|
67
|
-
const jobs = [await backend.jobInRun(input)];
|
|
68
|
-
return {
|
|
69
|
-
projectId: backend.projectId,
|
|
70
|
-
runId: input.runId,
|
|
71
|
-
executions: buildWorkbenchExecutionEvidence({
|
|
72
|
-
jobs,
|
|
73
|
-
traceIdPrefix: `${backend.projectId}-execution`,
|
|
74
|
-
traceForJob: backend.traceForJob,
|
|
75
|
-
traceSessionsForJob: backend.traceSessionsForJob,
|
|
76
|
-
}),
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
executionFiles: async (input) => {
|
|
80
|
-
const files = await backend.executionFiles(input);
|
|
81
|
-
return summarizeCandidateFiles(files, files.map((file) => file.path));
|
|
82
|
-
},
|
|
83
|
-
executionPreview: async (input) => createCandidateFilePreview({
|
|
84
|
-
files: await backend.executionFiles(input),
|
|
85
|
-
path: input.path,
|
|
86
|
-
view: input.view,
|
|
87
|
-
}),
|
|
88
|
-
lineage: async () => {
|
|
89
|
-
const snapshot = await backend.snapshot();
|
|
90
|
-
return buildCandidateLineage({
|
|
91
|
-
summaries: snapshot.summaries,
|
|
92
|
-
activeId: snapshot.activeId,
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
diagnose: async (input = {}) => {
|
|
96
|
-
const snapshot = await backend.snapshot();
|
|
97
|
-
return await diagnoseWorkbenchFailures({
|
|
98
|
-
snapshot,
|
|
99
|
-
backend,
|
|
100
|
-
targetId: input.targetId?.trim() || null,
|
|
101
|
-
});
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
async function diagnoseWorkbenchFailures(args) {
|
|
106
|
-
const targetRun = args.targetId
|
|
107
|
-
? args.snapshot.runs.find((run) => run.id === args.targetId)
|
|
108
|
-
: null;
|
|
109
|
-
const targetEvaluation = args.targetId
|
|
110
|
-
? args.snapshot.evaluations.find((evaluation) => evaluation.id === args.targetId)
|
|
111
|
-
: null;
|
|
112
|
-
const failures = [];
|
|
113
|
-
if (args.targetId && targetRun) {
|
|
114
|
-
const detail = await args.backend.run({ id: targetRun.id, includeJobs: true });
|
|
115
|
-
failures.push(...runFailures(detail.run));
|
|
116
|
-
failures.push(...jobFailures(detail.jobs ?? []));
|
|
117
|
-
}
|
|
118
|
-
else if (args.targetId && targetEvaluation) {
|
|
119
|
-
const evaluation = await args.backend.evaluation({ id: targetEvaluation.id });
|
|
120
|
-
failures.push(...evaluationFailures(evaluation));
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
for (const run of args.snapshot.runs) {
|
|
124
|
-
failures.push(...runFailures(run));
|
|
125
|
-
}
|
|
126
|
-
for (const evaluation of args.snapshot.evaluations) {
|
|
127
|
-
failures.push(...evaluationSummaryFailures(evaluation));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
targetId: args.targetId,
|
|
132
|
-
failures,
|
|
133
|
-
failedRunCount: failures.filter((failure) => failure.kind === "run").length,
|
|
134
|
-
failedEvaluationCount: failures.filter((failure) => failure.kind === "evaluation").length,
|
|
135
|
-
failedJobCount: failures.filter((failure) => failure.kind === "job").length,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function runFailures(run) {
|
|
139
|
-
if (run.status !== "finished" || (run.outcome !== "error" && run.outcome !== "cancelled")) {
|
|
140
|
-
return [];
|
|
141
|
-
}
|
|
142
|
-
return [{
|
|
143
|
-
kind: "run",
|
|
144
|
-
id: run.id,
|
|
145
|
-
runId: run.id,
|
|
146
|
-
candidateId: run.outputCandidateId ?? run.candidateId ?? undefined,
|
|
147
|
-
status: run.outcome,
|
|
148
|
-
...(run.error ? { error: run.error } : {}),
|
|
149
|
-
}];
|
|
150
|
-
}
|
|
151
|
-
function evaluationSummaryFailures(evaluation) {
|
|
152
|
-
if (evaluation.status === "completed" &&
|
|
153
|
-
evaluation.errorSampleCount === 0 &&
|
|
154
|
-
!evaluation.error) {
|
|
155
|
-
return [];
|
|
156
|
-
}
|
|
157
|
-
return [{
|
|
158
|
-
kind: "evaluation",
|
|
159
|
-
id: evaluation.id,
|
|
160
|
-
evaluationId: evaluation.id,
|
|
161
|
-
runId: evaluation.runId,
|
|
162
|
-
candidateId: evaluation.candidateId,
|
|
163
|
-
status: evaluation.status,
|
|
164
|
-
...(evaluation.error ? { error: evaluation.error } : {}),
|
|
165
|
-
}];
|
|
166
|
-
}
|
|
167
|
-
function evaluationFailures(evaluation) {
|
|
168
|
-
const failures = evaluationSummaryFailures(evaluation);
|
|
169
|
-
for (const sample of evaluation.evaluation.samples) {
|
|
170
|
-
if (!sample.error && !(sample.cases ?? []).some((entry) => entry.status && entry.status !== "completed")) {
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
173
|
-
failures.push({
|
|
174
|
-
kind: "sample",
|
|
175
|
-
id: `${evaluation.id}:sample:${sample.index}`,
|
|
176
|
-
evaluationId: evaluation.id,
|
|
177
|
-
runId: evaluation.runId,
|
|
178
|
-
candidateId: evaluation.candidateId,
|
|
179
|
-
sampleIndex: sample.index,
|
|
180
|
-
status: sample.status,
|
|
181
|
-
...(sample.error ? { error: sample.error } : {}),
|
|
182
|
-
});
|
|
183
|
-
for (const result of sample.cases ?? []) {
|
|
184
|
-
if (!result.status || result.status === "completed") {
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
failures.push({
|
|
188
|
-
kind: "case",
|
|
189
|
-
id: `${evaluation.id}:case:${result.id}:sample:${sample.index}`,
|
|
190
|
-
evaluationId: evaluation.id,
|
|
191
|
-
runId: evaluation.runId,
|
|
192
|
-
candidateId: evaluation.candidateId,
|
|
193
|
-
caseId: result.id,
|
|
194
|
-
sampleIndex: sample.index,
|
|
195
|
-
status: result.status,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return failures;
|
|
200
|
-
}
|
|
201
|
-
function jobFailures(jobs) {
|
|
202
|
-
return jobs
|
|
203
|
-
.filter((job) => isFailedJobStatus(job.status))
|
|
204
|
-
.map((job) => ({
|
|
205
|
-
kind: "job",
|
|
206
|
-
id: job.id,
|
|
207
|
-
jobId: job.id,
|
|
208
|
-
runId: job.runId,
|
|
209
|
-
candidateId: job.candidateId,
|
|
210
|
-
status: job.status,
|
|
211
|
-
attemptIndex: typeof job.attempt === "number" ? job.attempt : undefined,
|
|
212
|
-
...(job.error ? { error: job.error } : {}),
|
|
213
|
-
}));
|
|
214
|
-
}
|
|
215
|
-
function isFailedJobStatus(status) {
|
|
216
|
-
return status === "failed" || status === "cancelled";
|
|
217
|
-
}
|