@open-cr-agent/core 0.6.0 → 0.7.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/README.md +1 -1
- package/dist/agent/budget.d.ts +0 -1
- package/dist/agent/budget.js +0 -1
- package/dist/agent/json.d.ts +0 -1
- package/dist/agent/json.js +0 -1
- package/dist/agent/pool.d.ts +0 -1
- package/dist/agent/pool.js +0 -1
- package/dist/agent/settings.d.ts +0 -1
- package/dist/agent/settings.js +0 -1
- package/dist/agent/usage.d.ts +0 -1
- package/dist/agent/usage.js +0 -1
- package/dist/anchor/anchor.d.ts +0 -1
- package/dist/anchor/anchor.js +0 -1
- package/dist/anchor/match.d.ts +0 -1
- package/dist/anchor/match.js +0 -1
- package/dist/anchor/relocate.d.ts +0 -1
- package/dist/anchor/relocate.js +0 -1
- package/dist/at.d.ts +0 -1
- package/dist/at.js +0 -1
- package/dist/bounded-file.d.ts +12 -0
- package/dist/bounded-file.js +47 -0
- package/dist/bundle/bundle.d.ts +0 -1
- package/dist/bundle/bundle.js +0 -1
- package/dist/bundle/grouping.d.ts +0 -1
- package/dist/bundle/grouping.js +0 -1
- package/dist/bundle/runtime-grouper.d.ts +0 -1
- package/dist/bundle/runtime-grouper.js +0 -1
- package/dist/contracts.d.ts +10 -1
- package/dist/contracts.js +4 -1
- package/dist/diff/hunks.d.ts +0 -1
- package/dist/diff/hunks.js +0 -1
- package/dist/diff/parse.d.ts +0 -1
- package/dist/diff/parse.js +0 -1
- package/dist/diff/quoted-path.d.ts +0 -1
- package/dist/diff/quoted-path.js +0 -1
- package/dist/domain.d.ts +4 -1
- package/dist/domain.js +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/hash.d.ts +0 -1
- package/dist/hash.js +0 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +2 -2
- package/dist/judge/judge.d.ts +0 -1
- package/dist/judge/judge.js +0 -1
- package/dist/judge/prompt.d.ts +0 -1
- package/dist/judge/prompt.js +0 -1
- package/dist/judge/verdict.d.ts +0 -1
- package/dist/judge/verdict.js +0 -1
- package/dist/memory/memory.d.ts +0 -1
- package/dist/memory/memory.js +0 -1
- package/dist/net/proxied-fetch.d.ts +0 -1
- package/dist/net/proxied-fetch.js +0 -1
- package/dist/pipeline/assemble-report.d.ts +0 -1
- package/dist/pipeline/assemble-report.js +0 -1
- package/dist/pipeline/check-stage.d.ts +0 -1
- package/dist/pipeline/check-stage.js +0 -1
- package/dist/pipeline/context.d.ts +0 -1
- package/dist/pipeline/context.js +8 -5
- package/dist/pipeline/coverage.d.ts +0 -1
- package/dist/pipeline/coverage.js +37 -17
- package/dist/pipeline/execute-stage.d.ts +0 -1
- package/dist/pipeline/execute-stage.js +29 -3
- package/dist/pipeline/execute.d.ts +9 -2
- package/dist/pipeline/execute.js +90 -9
- package/dist/pipeline/filter-stage.d.ts +0 -1
- package/dist/pipeline/filter-stage.js +0 -1
- package/dist/pipeline/findings.d.ts +0 -1
- package/dist/pipeline/findings.js +0 -1
- package/dist/pipeline/imports.d.ts +0 -1
- package/dist/pipeline/imports.js +0 -1
- package/dist/pipeline/matrix.d.ts +0 -1
- package/dist/pipeline/matrix.js +0 -1
- package/dist/pipeline/options.d.ts +2 -1
- package/dist/pipeline/options.js +0 -1
- package/dist/pipeline/plan-output.d.ts +0 -1
- package/dist/pipeline/plan-output.js +0 -1
- package/dist/pipeline/plan.d.ts +1 -2
- package/dist/pipeline/plan.js +6 -2
- package/dist/pipeline/preview.d.ts +0 -1
- package/dist/pipeline/preview.js +0 -1
- package/dist/pipeline/provenance.d.ts +0 -1
- package/dist/pipeline/provenance.js +0 -1
- package/dist/pipeline/resume.d.ts +22 -0
- package/dist/pipeline/resume.js +24 -0
- package/dist/pipeline/run-id.d.ts +0 -1
- package/dist/pipeline/run-id.js +0 -1
- package/dist/pipeline/run.d.ts +0 -1
- package/dist/pipeline/run.js +0 -1
- package/dist/pipeline/task.d.ts +5 -8
- package/dist/pipeline/task.js +8 -6
- package/dist/plugin/builtin.d.ts +1 -1
- package/dist/plugin/builtin.js +12 -3
- package/dist/plugin/host.d.ts +0 -1
- package/dist/plugin/host.js +0 -1
- package/dist/plugin/registry.d.ts +0 -1
- package/dist/plugin/registry.js +0 -1
- package/dist/plugin/types.d.ts +0 -1
- package/dist/plugin/types.js +0 -1
- package/dist/report/output-schema.d.ts +39 -1
- package/dist/report/output-schema.js +10 -3
- package/dist/report/output.d.ts +0 -1
- package/dist/report/output.js +7 -4
- package/dist/report/provenance.d.ts +0 -1
- package/dist/report/provenance.js +0 -1
- package/dist/report/read.d.ts +0 -1
- package/dist/report/read.js +5 -3
- package/dist/report/report.d.ts +26 -3
- package/dist/report/report.js +11 -3
- package/dist/report/serialize.d.ts +0 -1
- package/dist/report/serialize.js +0 -1
- package/dist/rereview/presence.d.ts +0 -1
- package/dist/rereview/presence.js +0 -1
- package/dist/rereview/quote.d.ts +0 -1
- package/dist/rereview/quote.js +0 -1
- package/dist/rereview/reconcile.d.ts +0 -1
- package/dist/rereview/reconcile.js +0 -1
- package/dist/review/impact.d.ts +0 -1
- package/dist/review/impact.js +0 -1
- package/dist/review/plan-phase.d.ts +0 -1
- package/dist/review/plan-phase.js +0 -1
- package/dist/review/prompt-text.d.ts +0 -1
- package/dist/review/prompt-text.js +0 -1
- package/dist/review/prompt.d.ts +0 -1
- package/dist/review/prompt.js +0 -1
- package/dist/review/reviewer.d.ts +0 -1
- package/dist/review/reviewer.js +0 -1
- package/dist/review/reviewers/agents-md.d.ts +0 -1
- package/dist/review/reviewers/agents-md.js +0 -1
- package/dist/review/reviewers/correctness.d.ts +0 -1
- package/dist/review/reviewers/correctness.js +0 -1
- package/dist/review/reviewers/docs.d.ts +0 -1
- package/dist/review/reviewers/docs.js +0 -1
- package/dist/review/reviewers/performance.d.ts +0 -1
- package/dist/review/reviewers/performance.js +0 -1
- package/dist/review/reviewers/scopes.d.ts +0 -1
- package/dist/review/reviewers/scopes.js +0 -1
- package/dist/review/reviewers/security.d.ts +0 -1
- package/dist/review/reviewers/security.js +0 -1
- package/dist/review/tools.d.ts +0 -1
- package/dist/review/tools.js +0 -1
- package/dist/rules/builtin/general.d.ts +0 -1
- package/dist/rules/builtin/general.js +0 -1
- package/dist/rules/builtin/go.d.ts +0 -1
- package/dist/rules/builtin/go.js +0 -1
- package/dist/rules/builtin/index.d.ts +0 -1
- package/dist/rules/builtin/index.js +0 -1
- package/dist/rules/builtin/java.d.ts +0 -1
- package/dist/rules/builtin/java.js +0 -1
- package/dist/rules/builtin/performance.d.ts +0 -1
- package/dist/rules/builtin/performance.js +0 -1
- package/dist/rules/builtin/python.d.ts +0 -1
- package/dist/rules/builtin/python.js +0 -1
- package/dist/rules/builtin/security.d.ts +0 -1
- package/dist/rules/builtin/security.js +0 -1
- package/dist/rules/builtin/typescript.d.ts +0 -1
- package/dist/rules/builtin/typescript.js +0 -1
- package/dist/rules/languages.d.ts +0 -1
- package/dist/rules/languages.js +0 -1
- package/dist/rules/repo-rules.d.ts +0 -1
- package/dist/rules/repo-rules.js +0 -1
- package/dist/rules/resolve.d.ts +0 -1
- package/dist/rules/resolve.js +0 -1
- package/dist/rules/rule-set.d.ts +0 -1
- package/dist/rules/rule-set.js +0 -1
- package/dist/runtime/attempt.d.ts +15 -2
- package/dist/runtime/attempt.js +47 -1
- package/dist/runtime/chain-runner.d.ts +0 -1
- package/dist/runtime/chain-runner.js +0 -1
- package/dist/runtime/effort-capability.d.ts +0 -1
- package/dist/runtime/effort-capability.js +0 -1
- package/dist/runtime/failback.d.ts +0 -1
- package/dist/runtime/failback.js +38 -9
- package/dist/runtime/models.d.ts +0 -1
- package/dist/runtime/models.js +14 -13
- package/dist/runtime/quota.d.ts +1 -1
- package/dist/runtime/quota.js +3 -2
- package/dist/runtime/tools.d.ts +0 -1
- package/dist/runtime/tools.js +0 -1
- package/dist/sarif/candidates.d.ts +0 -1
- package/dist/sarif/candidates.js +0 -1
- package/dist/sarif/schema.d.ts +0 -1
- package/dist/sarif/schema.js +0 -1
- package/dist/select/patterns.d.ts +0 -1
- package/dist/select/patterns.js +0 -1
- package/dist/select/select.d.ts +1 -1
- package/dist/select/select.js +16 -3
- package/dist/session/jsonl.d.ts +2 -2
- package/dist/session/jsonl.js +9 -4
- package/dist/session/resume-read.d.ts +2 -0
- package/dist/session/resume-read.js +128 -0
- package/dist/session/seal.d.ts +5 -0
- package/dist/session/seal.js +24 -0
- package/dist/triage.d.ts +0 -1
- package/dist/triage.js +0 -1
- package/dist/vcs.d.ts +0 -1
- package/dist/vcs.js +0 -1
- package/dist/verify/prompt.d.ts +0 -1
- package/dist/verify/prompt.js +0 -1
- package/dist/verify/verify.d.ts +0 -1
- package/dist/verify/verify.js +0 -1
- package/package.json +1 -1
package/dist/pipeline/task.js
CHANGED
|
@@ -39,8 +39,8 @@ export async function executeTask(runtime, spec, runSignal, callbacks) {
|
|
|
39
39
|
const ending = iterator
|
|
40
40
|
? await collectAfterAbort(iterator, pending, result, callbacks)
|
|
41
41
|
: undefined;
|
|
42
|
-
// The
|
|
43
|
-
//
|
|
42
|
+
// The spend limit stopped the run, often through the task's own last
|
|
43
|
+
// usage report, after the task had finished: its review is complete.
|
|
44
44
|
if (ending === "done" && runSignal.reason instanceof SpendLimitReached) {
|
|
45
45
|
result.status = "completed";
|
|
46
46
|
delete result.error;
|
|
@@ -68,8 +68,9 @@ async function collectAfterAbort(iterator, pending, result, callbacks) {
|
|
|
68
68
|
if (event.done)
|
|
69
69
|
return undefined;
|
|
70
70
|
const { value } = event;
|
|
71
|
-
if (value.type === "usage" || value.type === "finding")
|
|
71
|
+
if (value.type === "usage" || value.type === "finding" || value.type === "done") {
|
|
72
72
|
handle(value, result, callbacks);
|
|
73
|
+
}
|
|
73
74
|
if (value.type === "done" || value.type === "error")
|
|
74
75
|
return value.type;
|
|
75
76
|
next = iterator.next();
|
|
@@ -84,7 +85,7 @@ async function collectAfterAbort(iterator, pending, result, callbacks) {
|
|
|
84
85
|
function handle(event, result, callbacks) {
|
|
85
86
|
switch (event.type) {
|
|
86
87
|
case "progress":
|
|
87
|
-
callbacks.onProgress(event.message);
|
|
88
|
+
callbacks.onProgress(event.message, event.attempt);
|
|
88
89
|
return false;
|
|
89
90
|
case "finding": {
|
|
90
91
|
const parsed = reportedFindingSchema.safeParse(withReviewerCategory(event.finding, callbacks.category));
|
|
@@ -111,6 +112,8 @@ function handle(event, result, callbacks) {
|
|
|
111
112
|
return false;
|
|
112
113
|
}
|
|
113
114
|
case "done":
|
|
115
|
+
if (event.ended)
|
|
116
|
+
result.ended = event.ended;
|
|
114
117
|
return true;
|
|
115
118
|
case "error":
|
|
116
119
|
result.status = "failed";
|
|
@@ -120,7 +123,7 @@ function handle(event, result, callbacks) {
|
|
|
120
123
|
}
|
|
121
124
|
// A reviewer steered by the change could flood the pull request with
|
|
122
125
|
// comments or pad them without end; both are bounded.
|
|
123
|
-
const MAX_FINDINGS_PER_TASK = 50;
|
|
126
|
+
export const MAX_FINDINGS_PER_TASK = 50;
|
|
124
127
|
const MAX_TITLE = 300;
|
|
125
128
|
const MAX_TEXT = 4_000;
|
|
126
129
|
const MAX_EVIDENCE = 10;
|
|
@@ -159,4 +162,3 @@ function untilAborted(promise, signal) {
|
|
|
159
162
|
});
|
|
160
163
|
});
|
|
161
164
|
}
|
|
162
|
-
//# sourceMappingURL=task.js.map
|
package/dist/plugin/builtin.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const agentsMdReviewerPlugin: OcraPlugin;
|
|
|
8
8
|
declare const sessionSettings: z.ZodObject<{
|
|
9
9
|
dir: z.ZodString;
|
|
10
10
|
id: z.ZodString;
|
|
11
|
+
sealKey: z.ZodExactOptional<z.ZodString>;
|
|
11
12
|
}, z.core.$strict>;
|
|
12
13
|
export declare const sessionJsonlPlugin: OcraPlugin<z.infer<typeof sessionSettings>>;
|
|
13
14
|
export {};
|
|
14
|
-
//# sourceMappingURL=builtin.d.ts.map
|
package/dist/plugin/builtin.js
CHANGED
|
@@ -5,6 +5,7 @@ import { docsReviewer } from "../review/reviewers/docs.js";
|
|
|
5
5
|
import { performanceReviewer } from "../review/reviewers/performance.js";
|
|
6
6
|
import { securityReviewer } from "../review/reviewers/security.js";
|
|
7
7
|
import { JsonlSessionWriter } from "../session/jsonl.js";
|
|
8
|
+
import { SEAL_KEY } from "../session/seal.js";
|
|
8
9
|
export const correctnessReviewerPlugin = {
|
|
9
10
|
name: "reviewer-correctness",
|
|
10
11
|
configure(ctx) {
|
|
@@ -35,13 +36,21 @@ export const agentsMdReviewerPlugin = {
|
|
|
35
36
|
ctx.registerReviewer(agentsMdReviewer);
|
|
36
37
|
},
|
|
37
38
|
};
|
|
38
|
-
|
|
39
|
+
// sealKey: this machine's secret (64 hex digits) that seals each line, so
|
|
40
|
+
// that only this machine's ocra resumes the session.
|
|
41
|
+
const sessionSettings = z
|
|
42
|
+
.object({
|
|
43
|
+
dir: z.string().min(1),
|
|
44
|
+
id: z.string().min(1),
|
|
45
|
+
sealKey: z.string().regex(SEAL_KEY).exactOptional(),
|
|
46
|
+
})
|
|
47
|
+
.strict();
|
|
39
48
|
export const sessionJsonlPlugin = {
|
|
40
49
|
name: "session-jsonl",
|
|
41
50
|
settingsSchema: sessionSettings,
|
|
42
51
|
configure(ctx) {
|
|
43
|
-
const
|
|
52
|
+
const { dir, id, sealKey } = ctx.settings;
|
|
53
|
+
const writer = new JsonlSessionWriter(dir, id, sealKey);
|
|
44
54
|
ctx.onEvent((event) => writer.write(event));
|
|
45
55
|
},
|
|
46
56
|
};
|
|
47
|
-
//# sourceMappingURL=builtin.js.map
|
package/dist/plugin/host.d.ts
CHANGED
package/dist/plugin/host.js
CHANGED
package/dist/plugin/registry.js
CHANGED
package/dist/plugin/types.d.ts
CHANGED
package/dist/plugin/types.js
CHANGED
|
@@ -11,6 +11,33 @@ export declare const changeRequestSchema: z.ZodObject<{
|
|
|
11
11
|
reason: z.ZodString;
|
|
12
12
|
}, z.core.$strict>>;
|
|
13
13
|
}, z.core.$strict>;
|
|
14
|
+
export declare const taskOutcomeSchema: z.ZodObject<{
|
|
15
|
+
taskId: z.ZodString;
|
|
16
|
+
reviewer: z.ZodString;
|
|
17
|
+
bundle: z.ZodString;
|
|
18
|
+
files: z.ZodArray<z.ZodString>;
|
|
19
|
+
status: z.ZodEnum<{
|
|
20
|
+
cancelled: "cancelled";
|
|
21
|
+
completed: "completed";
|
|
22
|
+
failed: "failed";
|
|
23
|
+
timed_out: "timed_out";
|
|
24
|
+
}>;
|
|
25
|
+
error: z.ZodExactOptional<z.ZodString>;
|
|
26
|
+
ended: z.ZodExactOptional<z.ZodEnum<{
|
|
27
|
+
step_cap: "step_cap";
|
|
28
|
+
stopped_early: "stopped_early";
|
|
29
|
+
}>>;
|
|
30
|
+
findings: z.ZodInt;
|
|
31
|
+
durationMs: z.ZodNumber;
|
|
32
|
+
usage: z.ZodObject<{
|
|
33
|
+
inputTokens: z.ZodNumber;
|
|
34
|
+
outputTokens: z.ZodNumber;
|
|
35
|
+
reasoningTokens: z.ZodNumber;
|
|
36
|
+
cachedTokens: z.ZodNumber;
|
|
37
|
+
costUsd: z.ZodNumber;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
reusedFrom: z.ZodExactOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>;
|
|
14
41
|
export declare const skippedCellSchema: z.ZodObject<{
|
|
15
42
|
reviewer: z.ZodString;
|
|
16
43
|
bundle: z.ZodString;
|
|
@@ -63,6 +90,13 @@ export declare const reportOutputSchema: z.ZodObject<{
|
|
|
63
90
|
unchanged: "unchanged";
|
|
64
91
|
unreviewed: "unreviewed";
|
|
65
92
|
}>;
|
|
93
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
94
|
+
path: z.ZodString;
|
|
95
|
+
status: z.ZodLiteral<"incomplete">;
|
|
96
|
+
ended: z.ZodEnum<{
|
|
97
|
+
step_cap: "step_cap";
|
|
98
|
+
stopped_early: "stopped_early";
|
|
99
|
+
}>;
|
|
66
100
|
}, z.core.$strict>, z.ZodObject<{
|
|
67
101
|
path: z.ZodString;
|
|
68
102
|
status: z.ZodLiteral<"excluded">;
|
|
@@ -254,6 +288,10 @@ export declare const reportOutputSchema: z.ZodObject<{
|
|
|
254
288
|
timed_out: "timed_out";
|
|
255
289
|
}>;
|
|
256
290
|
error: z.ZodExactOptional<z.ZodString>;
|
|
291
|
+
ended: z.ZodExactOptional<z.ZodEnum<{
|
|
292
|
+
step_cap: "step_cap";
|
|
293
|
+
stopped_early: "stopped_early";
|
|
294
|
+
}>>;
|
|
257
295
|
findings: z.ZodInt;
|
|
258
296
|
durationMs: z.ZodNumber;
|
|
259
297
|
usage: z.ZodObject<{
|
|
@@ -263,6 +301,7 @@ export declare const reportOutputSchema: z.ZodObject<{
|
|
|
263
301
|
cachedTokens: z.ZodNumber;
|
|
264
302
|
costUsd: z.ZodNumber;
|
|
265
303
|
}, z.core.$strict>;
|
|
304
|
+
reusedFrom: z.ZodExactOptional<z.ZodString>;
|
|
266
305
|
}, z.core.$strict>>;
|
|
267
306
|
skipped: z.ZodArray<z.ZodObject<{
|
|
268
307
|
reviewer: z.ZodString;
|
|
@@ -354,4 +393,3 @@ export declare const reportOutputSchema: z.ZodObject<{
|
|
|
354
393
|
}, z.core.$strict>;
|
|
355
394
|
export declare const REPORT_SCHEMA_ID = "https://ocra.majincheng.com/schema/report.v1.json";
|
|
356
395
|
export declare function reportJsonSchema(): Record<string, unknown>;
|
|
357
|
-
//# sourceMappingURL=output-schema.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { EFFORT_LEVELS } from "../agent/settings.js";
|
|
3
|
-
import { MODEL_TIERS } from "../contracts.js";
|
|
3
|
+
import { INCOMPLETE_ENDINGS, MODEL_TIERS } from "../contracts.js";
|
|
4
4
|
import { anchorMethodSchema, riskTierSchema, severitySchema, verdictSchema, verificationSchema, } from "../domain.js";
|
|
5
5
|
import { memoryEntrySchema } from "../memory/memory.js";
|
|
6
6
|
import { skipReasonSchema } from "../pipeline/matrix.js";
|
|
@@ -37,6 +37,11 @@ const coverageEntrySchema = z.discriminatedUnion("status", [
|
|
|
37
37
|
path: z.string(),
|
|
38
38
|
status: z.enum(["reviewed", "failed", "unreviewed", "unchanged"]),
|
|
39
39
|
}),
|
|
40
|
+
z.strictObject({
|
|
41
|
+
path: z.string(),
|
|
42
|
+
status: z.literal("incomplete"),
|
|
43
|
+
ended: z.enum(INCOMPLETE_ENDINGS),
|
|
44
|
+
}),
|
|
40
45
|
z.strictObject({
|
|
41
46
|
path: z.string(),
|
|
42
47
|
status: z.literal("excluded"),
|
|
@@ -101,16 +106,19 @@ const judgeDecisionsSchema = z.strictObject({
|
|
|
101
106
|
reason: z.string(),
|
|
102
107
|
})),
|
|
103
108
|
});
|
|
104
|
-
const taskOutcomeSchema = z.strictObject({
|
|
109
|
+
export const taskOutcomeSchema = z.strictObject({
|
|
105
110
|
taskId: z.string(),
|
|
106
111
|
reviewer: z.string(),
|
|
107
112
|
bundle: z.string(),
|
|
108
113
|
files: z.array(z.string()),
|
|
109
114
|
status: taskStatusSchema,
|
|
110
115
|
error: z.string().exactOptional(),
|
|
116
|
+
ended: z.enum(INCOMPLETE_ENDINGS).exactOptional(),
|
|
111
117
|
findings: z.int().nonnegative(),
|
|
112
118
|
durationMs: z.number(),
|
|
113
119
|
usage: usageSchema,
|
|
120
|
+
// Taken from this earlier run (--resume): usage is what that run paid.
|
|
121
|
+
reusedFrom: z.string().exactOptional(),
|
|
114
122
|
});
|
|
115
123
|
export const skippedCellSchema = z.strictObject({
|
|
116
124
|
reviewer: z.string(),
|
|
@@ -202,4 +210,3 @@ export function reportJsonSchema() {
|
|
|
202
210
|
...rest,
|
|
203
211
|
};
|
|
204
212
|
}
|
|
205
|
-
//# sourceMappingURL=output-schema.js.map
|
package/dist/report/output.d.ts
CHANGED
|
@@ -5,4 +5,3 @@ export type ReportOutput = z.output<typeof reportOutputSchema>;
|
|
|
5
5
|
export type OutputFinding = ReportOutput["findings"][number];
|
|
6
6
|
export type OutputPriorFinding = NonNullable<ReportOutput["rereview"]>["fixed"][number];
|
|
7
7
|
export declare function toReportOutput(report: ReviewReport): ReportOutput;
|
|
8
|
-
//# sourceMappingURL=output.d.ts.map
|
package/dist/report/output.js
CHANGED
|
@@ -51,9 +51,11 @@ function outputChangeRequest(c) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
function outputCoverage(c) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
if (c.status === "excluded")
|
|
55
|
+
return { path: c.path, status: c.status, reason: c.reason };
|
|
56
|
+
if (c.status === "incomplete")
|
|
57
|
+
return { path: c.path, status: c.status, ended: c.ended };
|
|
58
|
+
return { path: c.path, status: c.status };
|
|
57
59
|
}
|
|
58
60
|
function outputFinding(f) {
|
|
59
61
|
const output = {
|
|
@@ -113,6 +115,8 @@ function outputTask(t) {
|
|
|
113
115
|
durationMs: t.durationMs,
|
|
114
116
|
usage: outputUsage(t.usage),
|
|
115
117
|
...(t.error === undefined ? {} : { error: t.error }),
|
|
118
|
+
...(t.ended === undefined ? {} : { ended: t.ended }),
|
|
119
|
+
...(t.reusedFrom === undefined ? {} : { reusedFrom: t.reusedFrom }),
|
|
116
120
|
};
|
|
117
121
|
}
|
|
118
122
|
function outputSkipped(s) {
|
|
@@ -208,4 +212,3 @@ function outputPrior(f) {
|
|
|
208
212
|
...(f.reviewer ? { reviewer: f.reviewer } : {}),
|
|
209
213
|
};
|
|
210
214
|
}
|
|
211
|
-
//# sourceMappingURL=output.js.map
|
package/dist/report/read.d.ts
CHANGED
package/dist/report/read.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
1
|
import { z } from "zod";
|
|
2
|
+
import { readBoundedFile } from "../bounded-file.js";
|
|
3
3
|
import { errorMessage, OcraError } from "../errors.js";
|
|
4
4
|
import { REPORT_VERSION, reportOutputSchema } from "./output-schema.js";
|
|
5
|
+
// Far above what a run's task and finding limits let a report reach; a
|
|
6
|
+
// session's report.json lives in the reviewed tree, which may hold anything.
|
|
7
|
+
const MAX_REPORT_BYTES = 64 * 1024 * 1024;
|
|
5
8
|
// A JSON report from disk, as ocra wrote it (--format json, a session's
|
|
6
9
|
// report.json). Anything else is an INPUT_INVALID error saying why, with the
|
|
7
10
|
// read or parse error as its cause; a caller that may skip a report decides
|
|
@@ -9,7 +12,7 @@ import { REPORT_VERSION, reportOutputSchema } from "./output-schema.js";
|
|
|
9
12
|
export async function readReport(path) {
|
|
10
13
|
let text;
|
|
11
14
|
try {
|
|
12
|
-
text = await
|
|
15
|
+
text = await readBoundedFile(path, { maxBytes: MAX_REPORT_BYTES, followLinks: true });
|
|
13
16
|
}
|
|
14
17
|
catch (error) {
|
|
15
18
|
throw new OcraError("INPUT_INVALID", `cannot read ${path}: ${errorMessage(error)}`, {
|
|
@@ -31,4 +34,3 @@ export async function readReport(path) {
|
|
|
31
34
|
}
|
|
32
35
|
return parsed.data;
|
|
33
36
|
}
|
|
34
|
-
//# sourceMappingURL=read.js.map
|
package/dist/report/report.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { Usage } from "../contracts.js";
|
|
3
|
-
import type { AnchorMethod, ChangeRequest, Finding, PriorFinding, RiskTier, Verdict } from "../domain.js";
|
|
2
|
+
import type { AttemptRecord, IncompleteEnding, Usage } from "../contracts.js";
|
|
3
|
+
import type { AnchorMethod, ChangeRequest, Finding, PriorFinding, RiskTier, TaskFinding, Verdict } from "../domain.js";
|
|
4
4
|
import type { JudgeDecisions } from "../judge/judge.js";
|
|
5
5
|
import type { RememberedEntry } from "../memory/memory.js";
|
|
6
6
|
import type { SkippedCell } from "../pipeline/matrix.js";
|
|
@@ -10,17 +10,23 @@ import type { RunProvenance } from "./provenance.js";
|
|
|
10
10
|
export type CoverageEntry = {
|
|
11
11
|
path: string;
|
|
12
12
|
status: "reviewed" | "failed" | "unreviewed" | "unchanged";
|
|
13
|
+
} | {
|
|
14
|
+
path: string;
|
|
15
|
+
status: "incomplete";
|
|
16
|
+
ended: IncompleteEnding;
|
|
13
17
|
} | {
|
|
14
18
|
path: string;
|
|
15
19
|
status: "excluded";
|
|
16
20
|
reason: ExclusionReason;
|
|
17
21
|
};
|
|
22
|
+
export declare function isUnfinished(entry: CoverageEntry): boolean;
|
|
18
23
|
export declare function coverageGaps(run: {
|
|
19
24
|
coverage: readonly CoverageEntry[];
|
|
20
25
|
tasks: readonly Pick<TaskOutcome, "status">[];
|
|
21
26
|
}): {
|
|
22
27
|
notReviewed: number;
|
|
23
28
|
nothingReviewed: boolean;
|
|
29
|
+
incomplete: Record<IncompleteEnding, number>;
|
|
24
30
|
};
|
|
25
31
|
export declare const taskStatusSchema: z.ZodEnum<{
|
|
26
32
|
cancelled: "cancelled";
|
|
@@ -36,9 +42,11 @@ export interface TaskOutcome {
|
|
|
36
42
|
files: string[];
|
|
37
43
|
status: TaskStatus;
|
|
38
44
|
error?: string;
|
|
45
|
+
ended?: IncompleteEnding;
|
|
39
46
|
findings: number;
|
|
40
47
|
durationMs: number;
|
|
41
48
|
usage: Usage;
|
|
49
|
+
reusedFrom?: string;
|
|
42
50
|
}
|
|
43
51
|
export interface ReviewReport {
|
|
44
52
|
runId: string;
|
|
@@ -94,6 +102,10 @@ export type ReviewEvent = {
|
|
|
94
102
|
type: "files_bundled";
|
|
95
103
|
strategy: string;
|
|
96
104
|
bundles: number;
|
|
105
|
+
groups: {
|
|
106
|
+
label: string;
|
|
107
|
+
files: string[];
|
|
108
|
+
}[];
|
|
97
109
|
warnings: string[];
|
|
98
110
|
} | {
|
|
99
111
|
type: "matrix_planned";
|
|
@@ -109,10 +121,22 @@ export type ReviewEvent = {
|
|
|
109
121
|
type: "task_progress";
|
|
110
122
|
taskId: string;
|
|
111
123
|
message: string;
|
|
124
|
+
attempt?: AttemptRecord;
|
|
112
125
|
} | {
|
|
113
126
|
type: "finding";
|
|
114
127
|
taskId: string;
|
|
115
128
|
finding: Finding;
|
|
129
|
+
} | {
|
|
130
|
+
type: "finding_dropped";
|
|
131
|
+
taskId: string;
|
|
132
|
+
reason: "outside_bundle";
|
|
133
|
+
file: string;
|
|
134
|
+
title: string;
|
|
135
|
+
} | {
|
|
136
|
+
type: "task_reported";
|
|
137
|
+
taskId: string;
|
|
138
|
+
key: string;
|
|
139
|
+
findings: TaskFinding[];
|
|
116
140
|
} | {
|
|
117
141
|
type: "task_finished";
|
|
118
142
|
outcome: TaskOutcome;
|
|
@@ -134,4 +158,3 @@ export interface AnchoringSummary {
|
|
|
134
158
|
relocationCalls: number;
|
|
135
159
|
}
|
|
136
160
|
export declare function summarizeAnchoring(findings: readonly Finding[], relocationCalls: number): AnchoringSummary;
|
|
137
|
-
//# sourceMappingURL=report.d.ts.map
|
package/dist/report/report.js
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
// A selected file this run did not finish: the run is incomplete, and the
|
|
3
|
+
// next review of a pull or merge request includes it.
|
|
4
|
+
export function isUnfinished(entry) {
|
|
5
|
+
return (entry.status === "failed" || entry.status === "unreviewed" || entry.status === "incomplete");
|
|
6
|
+
}
|
|
2
7
|
// How much of the selection this run actually reviewed. Every surface (exit
|
|
3
8
|
// code, terminal, pull request summary) reads it from here, so none of them
|
|
4
9
|
// can call a run that reviewed nothing "approved".
|
|
5
10
|
export function coverageGaps(run) {
|
|
6
|
-
const notReviewed = run.coverage.filter(
|
|
11
|
+
const notReviewed = run.coverage.filter(isUnfinished).length;
|
|
12
|
+
const incomplete = { step_cap: 0, stopped_early: 0 };
|
|
13
|
+
for (const c of run.coverage)
|
|
14
|
+
if (c.status === "incomplete")
|
|
15
|
+
incomplete[c.ended] += 1;
|
|
7
16
|
// Unchanged files were reviewed by an earlier run, and their findings and
|
|
8
17
|
// verdict carry over: a re-review whose new files all failed still has them.
|
|
9
18
|
// A file stays failed while any of its reviewers failed, so a reviewer that
|
|
10
19
|
// finished its tasks has still reviewed something (#263).
|
|
11
20
|
const reviewed = run.coverage.some((c) => c.status === "reviewed" || c.status === "unchanged") ||
|
|
12
21
|
run.tasks.some((t) => t.status === "completed");
|
|
13
|
-
return { notReviewed, nothingReviewed: notReviewed > 0 && !reviewed };
|
|
22
|
+
return { notReviewed, nothingReviewed: notReviewed > 0 && !reviewed, incomplete };
|
|
14
23
|
}
|
|
15
24
|
export const taskStatusSchema = z.enum(["completed", "failed", "timed_out", "cancelled"]);
|
|
16
25
|
export function summarizeAnchoring(findings, relocationCalls) {
|
|
@@ -29,4 +38,3 @@ export function summarizeAnchoring(findings, relocationCalls) {
|
|
|
29
38
|
relocationCalls,
|
|
30
39
|
};
|
|
31
40
|
}
|
|
32
|
-
//# sourceMappingURL=report.js.map
|
package/dist/report/serialize.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { PriorReview } from "../domain.js";
|
|
2
2
|
export declare function priorCodePresence(prior: PriorReview | undefined, reported: ReadonlySet<string>, readFile: (path: string) => Promise<string | undefined>): Promise<Map<string, boolean>>;
|
|
3
|
-
//# sourceMappingURL=presence.d.ts.map
|
package/dist/rereview/quote.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { LineRange, QuoteSignature } from "../domain.js";
|
|
2
2
|
export declare function quoteSignature(content: string, range: LineRange): QuoteSignature | undefined;
|
|
3
3
|
export declare function containsQuote(content: string, signature: QuoteSignature): boolean;
|
|
4
|
-
//# sourceMappingURL=quote.d.ts.map
|
package/dist/rereview/quote.js
CHANGED
package/dist/review/impact.d.ts
CHANGED
package/dist/review/impact.js
CHANGED
|
@@ -13,4 +13,3 @@ export declare function labelled(label: string, value: string, separator?: strin
|
|
|
13
13
|
export declare function truncated(text: string, max: number): PromptText;
|
|
14
14
|
export declare function oneLine(text: string): string;
|
|
15
15
|
export {};
|
|
16
|
-
//# sourceMappingURL=prompt-text.d.ts.map
|
package/dist/review/prompt.d.ts
CHANGED
package/dist/review/prompt.js
CHANGED
package/dist/review/reviewer.js
CHANGED
package/dist/review/tools.d.ts
CHANGED
package/dist/review/tools.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
1
|
export declare const GENERAL_RULES = "### General correctness\n- Logic that produces a wrong result on a reachable input: inverted or incomplete conditions, off-by-one bounds, wrong operator, wrong variable, unreachable or dead branches that were meant to run.\n- Broken contracts between changed code and its callers or callees: changed signatures, return shapes, units, nullability or error behavior whose other side was not updated.\n- Error handling that hides failure: swallowed exceptions, errors converted to success or default values, partial writes reported as complete, cleanup that masks the original error.\n- State and resource bugs: missing cleanup on error paths, double release, leaked handles, mutation of shared or input data that callers do not expect.\n- Concurrency hazards that the code makes reachable: unsynchronized shared state, check-then-act races, missing cancellation or timeouts on blocking work.\n- Data integrity: lost updates, non-idempotent retries, inconsistent writes across stores, incorrect migrations or backfills.\n- Security defects visible in the change: injection, missing authorization on a new path, secrets in code or logs, unsafe deserialization.";
|
|
2
|
-
//# sourceMappingURL=general.d.ts.map
|