@open-cr-agent/core 0.5.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/{pipeline → agent}/budget.d.ts +0 -1
- package/dist/{pipeline → agent}/budget.js +0 -1
- package/dist/agent/json.d.ts +1 -0
- package/dist/agent/json.js +11 -0
- package/dist/{pipeline → agent}/pool.d.ts +0 -1
- package/dist/{pipeline → agent}/pool.js +2 -2
- package/dist/{pipeline/agents.d.ts → agent/settings.d.ts} +9 -5
- package/dist/{pipeline/agents.js → agent/settings.js} +14 -6
- package/dist/{pipeline → agent}/usage.d.ts +0 -1
- package/dist/{pipeline → 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 +5 -5
- package/dist/anchor/relocate.d.ts +1 -3
- package/dist/anchor/relocate.js +2 -3
- package/dist/at.d.ts +1 -0
- package/dist/at.js +11 -0
- package/dist/bounded-file.d.ts +12 -0
- package/dist/bounded-file.js +47 -0
- package/dist/bundle/bundle.d.ts +2 -2
- package/dist/bundle/bundle.js +3 -3
- package/dist/bundle/grouping.d.ts +0 -2
- package/dist/bundle/grouping.js +0 -1
- package/dist/bundle/runtime-grouper.d.ts +4 -0
- package/dist/{pipeline/helpers.js → bundle/runtime-grouper.js} +4 -14
- package/dist/contracts.d.ts +16 -15
- package/dist/contracts.js +6 -2
- package/dist/diff/hunks.d.ts +0 -1
- package/dist/diff/hunks.js +3 -3
- package/dist/diff/parse.d.ts +0 -1
- package/dist/diff/parse.js +5 -5
- package/dist/diff/quoted-path.d.ts +0 -1
- package/dist/diff/quoted-path.js +16 -16
- package/dist/domain.d.ts +14 -3
- package/dist/domain.js +2 -3
- package/dist/errors.d.ts +3 -2
- package/dist/errors.js +12 -1
- package/dist/hash.d.ts +1 -0
- package/dist/hash.js +6 -0
- package/dist/index.d.ts +27 -13
- package/dist/index.js +16 -6
- package/dist/internal.d.ts +10 -13
- package/dist/internal.js +10 -13
- package/dist/judge/judge.d.ts +1 -3
- package/dist/judge/judge.js +9 -9
- package/dist/judge/prompt.d.ts +0 -1
- package/dist/judge/prompt.js +0 -1
- package/dist/judge/verdict.d.ts +0 -2
- package/dist/judge/verdict.js +1 -2
- package/dist/memory/memory.d.ts +0 -1
- package/dist/memory/memory.js +2 -3
- package/dist/net/proxied-fetch.d.ts +0 -1
- package/dist/net/proxied-fetch.js +2 -2
- package/dist/pipeline/assemble-report.d.ts +21 -0
- package/dist/pipeline/assemble-report.js +98 -0
- package/dist/pipeline/check-stage.d.ts +12 -0
- package/dist/pipeline/check-stage.js +69 -0
- package/dist/pipeline/context.d.ts +2 -2
- package/dist/pipeline/context.js +8 -5
- package/dist/pipeline/coverage.d.ts +1 -2
- package/dist/pipeline/coverage.js +38 -17
- package/dist/pipeline/execute-stage.d.ts +25 -0
- package/dist/pipeline/execute-stage.js +130 -0
- package/dist/pipeline/execute.d.ts +11 -6
- package/dist/pipeline/execute.js +147 -59
- package/dist/pipeline/filter-stage.d.ts +15 -0
- package/dist/pipeline/filter-stage.js +45 -0
- package/dist/pipeline/findings.d.ts +0 -1
- package/dist/pipeline/findings.js +3 -3
- package/dist/pipeline/imports.d.ts +1 -2
- package/dist/pipeline/imports.js +1 -2
- package/dist/pipeline/matrix.d.ts +1 -9
- package/dist/pipeline/matrix.js +0 -1
- package/dist/pipeline/options.d.ts +66 -0
- package/dist/pipeline/options.js +8 -0
- package/dist/pipeline/plan-output.d.ts +89 -0
- package/dist/pipeline/plan-output.js +108 -0
- package/dist/pipeline/plan.d.ts +3 -5
- package/dist/pipeline/plan.js +10 -6
- package/dist/pipeline/preview.d.ts +23 -10
- package/dist/pipeline/preview.js +25 -5
- package/dist/pipeline/provenance.d.ts +4 -28
- package/dist/pipeline/provenance.js +2 -3
- 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 +2 -49
- package/dist/pipeline/run.js +18 -274
- package/dist/pipeline/task.d.ts +5 -10
- package/dist/pipeline/task.js +10 -8
- 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 +5 -5
- package/dist/plugin/registry.js +3 -4
- package/dist/plugin/types.d.ts +3 -6
- package/dist/plugin/types.js +0 -1
- package/dist/{pipeline → report}/output-schema.d.ts +95 -63
- package/dist/{pipeline → report}/output-schema.js +64 -42
- package/dist/report/output.d.ts +7 -0
- package/dist/report/output.js +214 -0
- package/dist/report/provenance.d.ts +25 -0
- package/dist/report/provenance.js +1 -0
- package/dist/report/read.d.ts +2 -0
- package/dist/report/read.js +36 -0
- package/dist/{pipeline → report}/report.d.ts +27 -4
- package/dist/{pipeline → report}/report.js +11 -3
- package/dist/report/serialize.d.ts +2 -0
- package/dist/report/serialize.js +26 -0
- package/dist/rereview/presence.d.ts +0 -1
- package/dist/rereview/presence.js +1 -2
- package/dist/rereview/quote.d.ts +0 -1
- package/dist/rereview/quote.js +2 -3
- package/dist/rereview/reconcile.d.ts +1 -2
- package/dist/rereview/reconcile.js +0 -1
- package/dist/review/impact.d.ts +0 -3
- package/dist/review/impact.js +2 -3
- package/dist/review/plan-phase.d.ts +1 -3
- package/dist/review/plan-phase.js +2 -3
- package/dist/review/prompt-text.d.ts +1 -2
- package/dist/review/prompt-text.js +1 -2
- package/dist/review/prompt.d.ts +0 -4
- package/dist/review/prompt.js +3 -4
- 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 -5
- package/dist/rules/builtin/index.js +1 -3
- 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 -7
- package/dist/rules/repo-rules.js +3 -4
- 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 +18 -0
- package/dist/runtime/chain-runner.js +62 -0
- package/dist/runtime/effort-capability.d.ts +13 -0
- package/dist/runtime/effort-capability.js +69 -0
- package/dist/runtime/failback.d.ts +0 -10
- package/dist/runtime/failback.js +52 -13
- package/dist/runtime/models.d.ts +1 -3
- 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 -17
- package/dist/runtime/tools.js +3 -4
- package/dist/sarif/candidates.d.ts +2 -2
- package/dist/sarif/candidates.js +0 -1
- package/dist/sarif/schema.d.ts +2 -3
- package/dist/sarif/schema.js +4 -5
- 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 +4 -4
- package/dist/session/jsonl.js +14 -8
- 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 +2 -3
- package/dist/triage.js +1 -2
- package/dist/vcs.d.ts +14 -0
- package/dist/vcs.js +1 -0
- package/dist/verify/prompt.d.ts +0 -7
- package/dist/verify/prompt.js +1 -2
- package/dist/verify/verify.d.ts +2 -4
- package/dist/verify/verify.js +4 -5
- package/package.json +1 -1
- package/dist/pipeline/helpers.d.ts +0 -7
- package/dist/pipeline/output.d.ts +0 -79
- package/dist/pipeline/output.js +0 -132
package/dist/domain.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ export declare const severitySchema: z.ZodEnum<{
|
|
|
5
5
|
warning: "warning";
|
|
6
6
|
}>;
|
|
7
7
|
export type Severity = z.infer<typeof severitySchema>;
|
|
8
|
-
|
|
8
|
+
declare const findingStatusSchema: z.ZodEnum<{
|
|
9
9
|
new: "new";
|
|
10
10
|
unfixed: "unfixed";
|
|
11
11
|
}>;
|
|
12
12
|
export type FindingStatus = z.infer<typeof findingStatusSchema>;
|
|
13
|
-
|
|
13
|
+
declare const lineRangeSchema: z.ZodObject<{
|
|
14
14
|
start: z.ZodNumber;
|
|
15
15
|
end: z.ZodNumber;
|
|
16
16
|
}, z.core.$strip>;
|
|
@@ -30,6 +30,10 @@ export declare const reportedFindingSchema: z.ZodObject<{
|
|
|
30
30
|
evidence: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
31
31
|
}, z.core.$strip>;
|
|
32
32
|
export type ReportedFinding = z.infer<typeof reportedFindingSchema>;
|
|
33
|
+
export interface TaskFinding {
|
|
34
|
+
reported: ReportedFinding;
|
|
35
|
+
model?: string;
|
|
36
|
+
}
|
|
33
37
|
export declare const anchorMethodSchema: z.ZodEnum<{
|
|
34
38
|
cross_file: "cross_file";
|
|
35
39
|
file: "file";
|
|
@@ -52,6 +56,11 @@ export interface FindingProvenance {
|
|
|
52
56
|
task: string;
|
|
53
57
|
model?: string;
|
|
54
58
|
}
|
|
59
|
+
export interface FindingFix {
|
|
60
|
+
startLine: number;
|
|
61
|
+
endLine: number;
|
|
62
|
+
replacement: string;
|
|
63
|
+
}
|
|
55
64
|
export interface Finding extends ReportedFinding {
|
|
56
65
|
id: string;
|
|
57
66
|
fingerprint: string;
|
|
@@ -66,6 +75,7 @@ export interface Finding extends ReportedFinding {
|
|
|
66
75
|
status: FindingStatus;
|
|
67
76
|
lowConfidence?: boolean;
|
|
68
77
|
quote?: QuoteSignature;
|
|
78
|
+
fix?: FindingFix;
|
|
69
79
|
verification?: Verification;
|
|
70
80
|
replies?: string[];
|
|
71
81
|
}
|
|
@@ -135,6 +145,7 @@ export interface PriorFinding {
|
|
|
135
145
|
dismissed?: boolean;
|
|
136
146
|
quote?: QuoteSignature;
|
|
137
147
|
verification?: Verification;
|
|
148
|
+
reviewer?: string;
|
|
138
149
|
}
|
|
139
150
|
export interface PriorReview {
|
|
140
151
|
findings: PriorFinding[];
|
|
@@ -146,4 +157,4 @@ export interface PriorReview {
|
|
|
146
157
|
tier?: RiskTier;
|
|
147
158
|
replies?: Readonly<Record<string, readonly string[]>>;
|
|
148
159
|
}
|
|
149
|
-
|
|
160
|
+
export {};
|
package/dist/domain.js
CHANGED
|
@@ -2,8 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
export const severitySchema = z.enum(["critical", "warning", "suggestion"]);
|
|
3
3
|
// A finding in a report is new or reported before; fixed and dismissed
|
|
4
4
|
// earlier findings are listed separately (report.rereview).
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const findingStatusSchema = z.enum(["new", "unfixed"]);
|
|
6
|
+
const lineRangeSchema = z.object({
|
|
7
7
|
start: z.number().int().positive(),
|
|
8
8
|
end: z.number().int().positive(),
|
|
9
9
|
});
|
|
@@ -28,4 +28,3 @@ export const verdictSchema = z.enum([
|
|
|
28
28
|
"minor_issues",
|
|
29
29
|
"significant_concerns",
|
|
30
30
|
]);
|
|
31
|
-
//# sourceMappingURL=domain.js.map
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Usage } from "./contracts.js";
|
|
2
|
-
export declare const OCRA_ERROR_CODES: readonly ["CONFIG_INVALID", "CONFIG_CREDENTIALS_MISSING", "INPUT_USAGE", "INPUT_INVALID", "ACCESS_DENIED", "PLUGIN_INVALID", "VCS_GIT_FAILED", "VCS_API_FAILED", "VCS_REF_UNKNOWN", "VCS_NOT_READY", "RUNTIME_START_FAILED", "RUNTIME_FAILED", "RUNTIME_INVALID_OUTPUT", "BUDGET_EXHAUSTED", "INTERNAL"];
|
|
2
|
+
export declare const OCRA_ERROR_CODES: readonly ["CONFIG_INVALID", "CONFIG_CREDENTIALS_MISSING", "INPUT_USAGE", "INPUT_INVALID", "ACCESS_DENIED", "PLUGIN_INVALID", "VCS_GIT_FAILED", "VCS_API_FAILED", "VCS_REF_UNKNOWN", "VCS_NOT_READY", "CLOUD_API_FAILED", "RUNTIME_START_FAILED", "RUNTIME_FAILED", "RUNTIME_INVALID_OUTPUT", "BUDGET_EXHAUSTED", "INTERNAL"];
|
|
3
3
|
export type OcraErrorCode = (typeof OCRA_ERROR_CODES)[number];
|
|
4
4
|
export declare class OcraError extends Error {
|
|
5
5
|
readonly code: OcraErrorCode;
|
|
@@ -16,4 +16,5 @@ export declare class CompletionError extends OcraError {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function usageSpent(error: unknown): Usage | undefined;
|
|
18
18
|
export declare function errorMessage(error: unknown): string;
|
|
19
|
-
|
|
19
|
+
export declare function errnoCode(error: unknown): string | undefined;
|
|
20
|
+
export declare function isNotFound(error: unknown): boolean;
|
package/dist/errors.js
CHANGED
|
@@ -16,6 +16,8 @@ export const OCRA_ERROR_CODES = [
|
|
|
16
16
|
"VCS_API_FAILED",
|
|
17
17
|
"VCS_REF_UNKNOWN",
|
|
18
18
|
"VCS_NOT_READY",
|
|
19
|
+
// ocra Cloud, for a signed-in CLI.
|
|
20
|
+
"CLOUD_API_FAILED",
|
|
19
21
|
// What runs the models.
|
|
20
22
|
"RUNTIME_START_FAILED",
|
|
21
23
|
"RUNTIME_FAILED",
|
|
@@ -49,6 +51,15 @@ export function usageSpent(error) {
|
|
|
49
51
|
return error instanceof CompletionError ? error.usage : undefined;
|
|
50
52
|
}
|
|
51
53
|
export function errorMessage(error) {
|
|
54
|
+
// biome-ignore lint/plugin: the one definition the rule points to
|
|
52
55
|
return error instanceof Error ? error.message : String(error);
|
|
53
56
|
}
|
|
54
|
-
|
|
57
|
+
// The code of a failed system call (ENOENT, EEXIST, …), when the error has one.
|
|
58
|
+
export function errnoCode(error) {
|
|
59
|
+
return error instanceof Error && "code" in error && typeof error.code === "string"
|
|
60
|
+
? error.code
|
|
61
|
+
: undefined;
|
|
62
|
+
}
|
|
63
|
+
export function isNotFound(error) {
|
|
64
|
+
return errnoCode(error) === "ENOENT";
|
|
65
|
+
}
|
package/dist/hash.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function shortHash(text: string): string;
|
package/dist/hash.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
// Sixteen hex characters of SHA-256: enough to tell ocra's ids, fingerprints
|
|
3
|
+
// and digests apart, short enough to read in a report.
|
|
4
|
+
export function shortHash(text) {
|
|
5
|
+
return createHash("sha256").update(text).digest("hex").slice(0, 16);
|
|
6
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type {
|
|
3
|
-
export {
|
|
1
|
+
export { SpendLimitReached } from "./agent/budget.js";
|
|
2
|
+
export type { ReviewerOverride, ReviewerOverrides } from "./agent/settings.js";
|
|
3
|
+
export { type AgentRole, EFFORT_LEVELS, type RoleSetting, type RoleSettings, type TierEfforts, } from "./agent/settings.js";
|
|
4
|
+
export { addUsage, emptyUsage } from "./agent/usage.js";
|
|
5
|
+
export type { AgentEvent, AgentRuntime, AgentTaskSpec, AppliedSampling, AppliedSettings, AttemptRecord, CodeMatch, CompletionRequest, CompletionResult, Effort, IncompleteEnding, ModelChains, ModelTier, ReviewContext, Sampling, Usage, } from "./contracts.js";
|
|
6
|
+
export { MODEL_TIERS } from "./contracts.js";
|
|
7
|
+
export type { AnchorMethod, ChangeRequest, DiffLine, FileChangeKind, FileDiff, Finding, FindingFix, FindingProvenance, FindingStatus, Hunk, LineRange, PriorFinding, PriorReview, QuoteSignature, ReportedFinding, RiskTier, Severity, TaskFinding, Verdict, Verification, } from "./domain.js";
|
|
8
|
+
export { CompletionError, errorMessage, isOcraError, OCRA_ERROR_CODES, OcraError, type OcraErrorCode, } from "./errors.js";
|
|
4
9
|
export type { JudgeDecisions } from "./judge/judge.js";
|
|
5
10
|
export type { MemoryEntry, MemorySource, RememberedEntry } from "./memory/memory.js";
|
|
6
|
-
export
|
|
7
|
-
export { SpendLimitReached } from "./pipeline/budget.js";
|
|
11
|
+
export { type ProxyEnv, proxiedFetch } from "./net/proxied-fetch.js";
|
|
8
12
|
export { AccessDeniedError } from "./pipeline/context.js";
|
|
9
|
-
export type {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export type {
|
|
13
|
-
export {
|
|
14
|
-
export { type ReviewOptions, review } from "./pipeline/run.js";
|
|
13
|
+
export type { SkippedCell, SkipReason } from "./pipeline/matrix.js";
|
|
14
|
+
export type { ReviewLimits, ReviewMode, ReviewOptions, ReviewStages, RunIdentity, } from "./pipeline/options.js";
|
|
15
|
+
export type { ProvenanceInput } from "./pipeline/provenance.js";
|
|
16
|
+
export type { ResumedRun, ResumedTask } from "./pipeline/resume.js";
|
|
17
|
+
export { review } from "./pipeline/run.js";
|
|
15
18
|
export { agentsMdReviewerPlugin, correctnessReviewerPlugin, docsReviewerPlugin, performanceReviewerPlugin, securityReviewerPlugin, sessionJsonlPlugin, } from "./plugin/builtin.js";
|
|
16
19
|
export { type PluginHostOptions, startPlugins } from "./plugin/host.js";
|
|
17
20
|
export { PluginError, PluginRegistry } from "./plugin/registry.js";
|
|
18
|
-
export type { BootstrapContext, ConfigureContext, CustomProvider, Env,
|
|
21
|
+
export type { BootstrapContext, ConfigureContext, CustomProvider, Env, ModelPrice, OcraPlugin, PluginSummary, PostConfigureContext, RuntimeFactory, RuntimeOptions, ToolDefinition, VcsFactory, } from "./plugin/types.js";
|
|
22
|
+
export { type OutputFinding, type OutputPriorFinding, type ReportOutput, toReportOutput, } from "./report/output.js";
|
|
23
|
+
export { REPORT_VERSION, reportJsonSchema, reportOutputSchema } from "./report/output-schema.js";
|
|
24
|
+
export type { AgentProvenance, RuleProvenance, RunProvenance } from "./report/provenance.js";
|
|
25
|
+
export { type AnchoringSummary, type CoverageEntry, coverageGaps, isUnfinished, type ReviewEvent, type ReviewReport, type TaskOutcome, type TaskStatus, } from "./report/report.js";
|
|
19
26
|
export type { ReviewerDefinition, ReviewerScope } from "./review/reviewer.js";
|
|
27
|
+
export { REVIEW_TOOLS, type ReviewToolName } from "./review/tools.js";
|
|
20
28
|
export type { Language } from "./rules/languages.js";
|
|
21
29
|
export type { RepoRule, RuleSource, SourcedRule } from "./rules/repo-rules.js";
|
|
22
30
|
export type { RuleSet } from "./rules/rule-set.js";
|
|
31
|
+
export { type AttemptError, type AttemptOutcome, exploredBy, MAX_AGENT_STEPS, RESUME_MESSAGE, type ToolUse, withoutSecrets, } from "./runtime/attempt.js";
|
|
32
|
+
export { ChainRunner, type ModelAttempts } from "./runtime/chain-runner.js";
|
|
33
|
+
export { type EffortCapability, type EffortParameter, effortCapability, thinkingBudget, } from "./runtime/effort-capability.js";
|
|
34
|
+
export { type ModelRef, parseModel } from "./runtime/models.js";
|
|
35
|
+
export { parseQuotaError, type QuotaError } from "./runtime/quota.js";
|
|
36
|
+
export { reviewTools } from "./runtime/tools.js";
|
|
23
37
|
export { parseSarifLog, SarifError, type SarifLog } from "./sarif/schema.js";
|
|
24
38
|
export type { ExclusionReason, SelectionPolicy } from "./select/select.js";
|
|
39
|
+
export type { VcsAdapter } from "./vcs.js";
|
|
25
40
|
export type { RefutedFinding } from "./verify/verify.js";
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -3,15 +3,25 @@
|
|
|
3
3
|
// etc/core.api.md records it; a change here updates that report
|
|
4
4
|
// (`npm run api`). What the other workspace packages need beyond this comes
|
|
5
5
|
// from "@open-cr-agent/core/internal", which is not a contract.
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
6
|
+
export { SpendLimitReached } from "./agent/budget.js";
|
|
7
|
+
export { EFFORT_LEVELS, } from "./agent/settings.js";
|
|
8
|
+
export { addUsage, emptyUsage } from "./agent/usage.js";
|
|
9
|
+
export { MODEL_TIERS } from "./contracts.js";
|
|
10
|
+
export { CompletionError, errorMessage, isOcraError, OCRA_ERROR_CODES, OcraError, } from "./errors.js";
|
|
11
|
+
export { proxiedFetch } from "./net/proxied-fetch.js";
|
|
8
12
|
export { AccessDeniedError } from "./pipeline/context.js";
|
|
9
|
-
export { REPORT_VERSION, toReportOutput, } from "./pipeline/output.js";
|
|
10
|
-
export { reportJsonSchema, reportOutputSchema } from "./pipeline/output-schema.js";
|
|
11
|
-
export { coverageGaps, } from "./pipeline/report.js";
|
|
12
13
|
export { review } from "./pipeline/run.js";
|
|
13
14
|
export { agentsMdReviewerPlugin, correctnessReviewerPlugin, docsReviewerPlugin, performanceReviewerPlugin, securityReviewerPlugin, sessionJsonlPlugin, } from "./plugin/builtin.js";
|
|
14
15
|
export { startPlugins } from "./plugin/host.js";
|
|
15
16
|
export { PluginError, PluginRegistry } from "./plugin/registry.js";
|
|
17
|
+
export { toReportOutput, } from "./report/output.js";
|
|
18
|
+
export { REPORT_VERSION, reportJsonSchema, reportOutputSchema } from "./report/output-schema.js";
|
|
19
|
+
export { coverageGaps, isUnfinished, } from "./report/report.js";
|
|
20
|
+
export { REVIEW_TOOLS } from "./review/tools.js";
|
|
21
|
+
export { exploredBy, MAX_AGENT_STEPS, RESUME_MESSAGE, withoutSecrets, } from "./runtime/attempt.js";
|
|
22
|
+
export { ChainRunner } from "./runtime/chain-runner.js";
|
|
23
|
+
export { effortCapability, thinkingBudget, } from "./runtime/effort-capability.js";
|
|
24
|
+
export { parseModel } from "./runtime/models.js";
|
|
25
|
+
export { parseQuotaError } from "./runtime/quota.js";
|
|
26
|
+
export { reviewTools } from "./runtime/tools.js";
|
|
16
27
|
export { parseSarifLog, SarifError } from "./sarif/schema.js";
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
+
export { AGENT_ROLES } from "./agent/settings.js";
|
|
2
|
+
export { at } from "./at.js";
|
|
1
3
|
export { parseUnifiedDiff } from "./diff/parse.js";
|
|
2
4
|
export { severitySchema, verificationSchema } from "./domain.js";
|
|
3
|
-
export {
|
|
5
|
+
export { errnoCode, isNotFound } from "./errors.js";
|
|
6
|
+
export { shortHash } from "./hash.js";
|
|
4
7
|
export { MEMORY_PATH, memoryEntrySchema, parseMemory, serializeMemory, } from "./memory/memory.js";
|
|
5
|
-
export { proxiedFetch } from "./net/proxied-fetch.js";
|
|
6
|
-
export { AGENT_ROLES, EFFORT_LEVELS } from "./pipeline/agents.js";
|
|
7
8
|
export { reviewContext } from "./pipeline/context.js";
|
|
8
9
|
export { RISK_TIERS } from "./pipeline/matrix.js";
|
|
9
|
-
export {
|
|
10
|
+
export { MAX_TIMER_MS, REVIEW_DEFAULTS } from "./pipeline/options.js";
|
|
11
|
+
export { PLAN_VERSION, planOutputSchema, toPlanOutput, } from "./pipeline/plan-output.js";
|
|
10
12
|
export { previewReview, type ReviewPreview } from "./pipeline/preview.js";
|
|
11
13
|
export { stableHash } from "./pipeline/provenance.js";
|
|
12
14
|
export { newRunId } from "./pipeline/run-id.js";
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
+
export { readReport } from "./report/read.js";
|
|
16
|
+
export { isUnsafeCodePoint, serializeOutput } from "./report/serialize.js";
|
|
15
17
|
export { repoRuleSchema } from "./rules/repo-rules.js";
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export { callChain, ModelHealth, parseModel } from "./runtime/models.js";
|
|
19
|
-
export { parseQuotaError, type QuotaError, sleep } from "./runtime/quota.js";
|
|
20
|
-
export { MAX_READ_LINES, reviewTools } from "./runtime/tools.js";
|
|
21
|
-
export { defaultSelectionPolicy } from "./select/select.js";
|
|
22
|
-
//# sourceMappingURL=internal.d.ts.map
|
|
18
|
+
export { REPORT_FILE } from "./session/jsonl.js";
|
|
19
|
+
export { readResumedRun } from "./session/resume-read.js";
|
package/dist/internal.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
// "@open-cr-agent/core/internal": what ocra's own packages share beyond the
|
|
2
2
|
// public API (index.ts). Not a contract: any release may change or remove
|
|
3
3
|
// any of it, and nothing outside this repository should import it.
|
|
4
|
+
export { AGENT_ROLES } from "./agent/settings.js";
|
|
5
|
+
export { at } from "./at.js";
|
|
4
6
|
export { parseUnifiedDiff } from "./diff/parse.js";
|
|
5
7
|
export { severitySchema, verificationSchema } from "./domain.js";
|
|
6
|
-
export {
|
|
8
|
+
export { errnoCode, isNotFound } from "./errors.js";
|
|
9
|
+
export { shortHash } from "./hash.js";
|
|
7
10
|
export { MEMORY_PATH, memoryEntrySchema, parseMemory, serializeMemory, } from "./memory/memory.js";
|
|
8
|
-
export { proxiedFetch } from "./net/proxied-fetch.js";
|
|
9
|
-
export { AGENT_ROLES, EFFORT_LEVELS } from "./pipeline/agents.js";
|
|
10
11
|
export { reviewContext } from "./pipeline/context.js";
|
|
11
12
|
export { RISK_TIERS } from "./pipeline/matrix.js";
|
|
12
|
-
export {
|
|
13
|
+
export { MAX_TIMER_MS, REVIEW_DEFAULTS } from "./pipeline/options.js";
|
|
14
|
+
export { PLAN_VERSION, planOutputSchema, toPlanOutput, } from "./pipeline/plan-output.js";
|
|
13
15
|
export { previewReview } from "./pipeline/preview.js";
|
|
14
16
|
export { stableHash } from "./pipeline/provenance.js";
|
|
15
17
|
export { newRunId } from "./pipeline/run-id.js";
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
+
export { readReport } from "./report/read.js";
|
|
19
|
+
export { isUnsafeCodePoint, serializeOutput } from "./report/serialize.js";
|
|
18
20
|
export { repoRuleSchema } from "./rules/repo-rules.js";
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export { callChain, ModelHealth, parseModel } from "./runtime/models.js";
|
|
22
|
-
export { parseQuotaError, sleep } from "./runtime/quota.js";
|
|
23
|
-
export { MAX_READ_LINES, reviewTools } from "./runtime/tools.js";
|
|
24
|
-
export { defaultSelectionPolicy } from "./select/select.js";
|
|
25
|
-
//# sourceMappingURL=internal.js.map
|
|
21
|
+
export { REPORT_FILE } from "./session/jsonl.js";
|
|
22
|
+
export { readResumedRun } from "./session/resume-read.js";
|
package/dist/judge/judge.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { type AgentCallSettings } from "../agent/settings.js";
|
|
1
2
|
import type { AgentRuntime, Usage } from "../contracts.js";
|
|
2
3
|
import type { ChangeRequest, Finding, PriorFinding, RiskTier, Severity, Verdict } from "../domain.js";
|
|
3
|
-
import { type AgentCallSettings } from "../pipeline/agents.js";
|
|
4
4
|
import { type JudgeResponse } from "./prompt.js";
|
|
5
|
-
export declare const JUDGE_TIMEOUT_MS = 180000;
|
|
6
5
|
export interface JudgeDecisions {
|
|
7
6
|
merged: {
|
|
8
7
|
kept: string;
|
|
@@ -45,4 +44,3 @@ export declare function applyDecisions(findings: readonly Finding[], response: J
|
|
|
45
44
|
decisions: JudgeDecisions;
|
|
46
45
|
warnings: string[];
|
|
47
46
|
};
|
|
48
|
-
//# sourceMappingURL=judge.d.ts.map
|
package/dist/judge/judge.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { parseJsonAnswer } from "../agent/json.js";
|
|
2
|
+
import { agentCall } from "../agent/settings.js";
|
|
3
|
+
import { at } from "../at.js";
|
|
1
4
|
import { errorMessage, OcraError, usageSpent } from "../errors.js";
|
|
2
|
-
import { agentCall } from "../pipeline/agents.js";
|
|
3
|
-
import { parseJsonAnswer } from "../pipeline/helpers.js";
|
|
4
5
|
import { buildJudgePrompt, judgeResponseSchema } from "./prompt.js";
|
|
5
6
|
import { decideVerdict, defaultSummary } from "./verdict.js";
|
|
6
|
-
|
|
7
|
+
const JUDGE_TIMEOUT_MS = 180_000;
|
|
7
8
|
export async function judgeFindings(findings, options) {
|
|
8
9
|
const carried = options.carried ?? [];
|
|
9
10
|
const fallback = (warnings = [], usage = []) => ({
|
|
@@ -69,7 +70,7 @@ export function applyDecisions(findings, response) {
|
|
|
69
70
|
const decisions = { merged: [], dropped: [], recalibrated: [] };
|
|
70
71
|
const warnings = [];
|
|
71
72
|
const removed = new Set();
|
|
72
|
-
const isProtected = (i) => protectedFinding(findings
|
|
73
|
+
const isProtected = (i) => protectedFinding(at(findings, i));
|
|
73
74
|
for (const group of response.duplicates) {
|
|
74
75
|
const members = [...new Set(group.filter(valid))].filter((i) => !removed.has(i));
|
|
75
76
|
// Merging keeps one member; keep a protected one so it is not merged away.
|
|
@@ -82,19 +83,19 @@ export function applyDecisions(findings, response) {
|
|
|
82
83
|
for (const i of rest)
|
|
83
84
|
removed.add(i);
|
|
84
85
|
decisions.merged.push({
|
|
85
|
-
kept: findings
|
|
86
|
-
merged: rest.map((i) => findings
|
|
86
|
+
kept: at(findings, keep).fingerprint,
|
|
87
|
+
merged: rest.map((i) => at(findings, i).fingerprint),
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
for (const { index, reason } of response.drop) {
|
|
90
91
|
if (!valid(index) || removed.has(index))
|
|
91
92
|
continue;
|
|
92
93
|
if (isProtected(index)) {
|
|
93
|
-
warnings.push(`judge tried to drop the confirmed critical finding ${findings
|
|
94
|
+
warnings.push(`judge tried to drop the confirmed critical finding ${at(findings, index).fingerprint.slice(0, 8)}; kept it`);
|
|
94
95
|
continue;
|
|
95
96
|
}
|
|
96
97
|
removed.add(index);
|
|
97
|
-
const f = findings
|
|
98
|
+
const f = at(findings, index);
|
|
98
99
|
decisions.dropped.push({ fingerprint: f.fingerprint, file: f.file, title: f.title, reason });
|
|
99
100
|
}
|
|
100
101
|
const severities = new Map();
|
|
@@ -126,4 +127,3 @@ export function applyDecisions(findings, response) {
|
|
|
126
127
|
});
|
|
127
128
|
return { findings: kept, decisions, warnings };
|
|
128
129
|
}
|
|
129
|
-
//# sourceMappingURL=judge.js.map
|
package/dist/judge/prompt.d.ts
CHANGED
package/dist/judge/prompt.js
CHANGED
package/dist/judge/verdict.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Finding, Severity, Verdict, Verification } from "../domain.js";
|
|
2
|
-
export declare const PATTERN_WARNINGS = 3;
|
|
3
2
|
export interface VerdictInput {
|
|
4
3
|
severity: Severity;
|
|
5
4
|
verification?: Verification;
|
|
6
5
|
}
|
|
7
6
|
export declare function decideVerdict(findings: readonly VerdictInput[]): Verdict;
|
|
8
7
|
export declare function defaultSummary(findings: readonly Finding[], stillOpen?: number): string;
|
|
9
|
-
//# sourceMappingURL=verdict.d.ts.map
|
package/dist/judge/verdict.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const PATTERN_WARNINGS = 3;
|
|
2
2
|
// The rubric is code, so the same findings always give the same verdict and
|
|
3
3
|
// a failed judge call cannot change it; it leans towards approval. Only a
|
|
4
4
|
// critical finding the verifier confirmed blocks: one model's unchecked claim
|
|
@@ -23,4 +23,3 @@ export function defaultSummary(findings, stillOpen = 0) {
|
|
|
23
23
|
const count = (severity) => findings.filter((f) => f.severity === severity).length;
|
|
24
24
|
return `${findings.length} finding(s): ${count("critical")} critical, ${count("warning")} warning, ${count("suggestion")} suggestion.`;
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=verdict.js.map
|
package/dist/memory/memory.d.ts
CHANGED
package/dist/memory/memory.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { OcraError } from "../errors.js";
|
|
2
|
+
import { errorMessage, OcraError } from "../errors.js";
|
|
3
3
|
export const MEMORY_PATH = ".ocra/memory.json";
|
|
4
4
|
const MAX_ENTRIES = 1_000;
|
|
5
5
|
export const memoryEntrySchema = z.object({
|
|
@@ -19,7 +19,7 @@ export function parseMemory(json) {
|
|
|
19
19
|
data = JSON.parse(json);
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
|
-
throw new OcraError("CONFIG_INVALID", `${MEMORY_PATH} is not valid JSON: ${error
|
|
22
|
+
throw new OcraError("CONFIG_INVALID", `${MEMORY_PATH} is not valid JSON: ${errorMessage(error)}`, { cause: error });
|
|
23
23
|
}
|
|
24
24
|
const parsed = memoryFileSchema.safeParse(data);
|
|
25
25
|
if (!parsed.success)
|
|
@@ -59,4 +59,3 @@ export function memoryFor(files, memory) {
|
|
|
59
59
|
const set = new Set(files);
|
|
60
60
|
return memory.filter((e) => set.has(e.file));
|
|
61
61
|
}
|
|
62
|
-
//# sourceMappingURL=memory.js.map
|
|
@@ -5,7 +5,8 @@ import { EnvHttpProxyAgent, fetch as undiciFetch } from "undici";
|
|
|
5
5
|
// EnvHttpProxyAgent, reading the given environment rather than the
|
|
6
6
|
// process's; without one, Node's fetch is used as it is. undici's fetch and
|
|
7
7
|
// agent are used together so that no object crosses between it and Node's
|
|
8
|
-
// bundled copy (
|
|
8
|
+
// bundled copy (runtime-opencode's transport keeps its own copy of the
|
|
9
|
+
// adapter on purpose; see there).
|
|
9
10
|
export function proxiedFetch(env) {
|
|
10
11
|
const httpProxy = env.HTTP_PROXY ?? env.http_proxy;
|
|
11
12
|
const httpsProxy = env.HTTPS_PROXY ?? env.https_proxy;
|
|
@@ -30,4 +31,3 @@ export function proxiedFetch(env) {
|
|
|
30
31
|
return response;
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
|
-
//# sourceMappingURL=proxied-fetch.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PriorReview } from "../domain.js";
|
|
2
|
+
import { type ReviewReport } from "../report/report.js";
|
|
3
|
+
import type { ReviewerDefinition } from "../review/reviewer.js";
|
|
4
|
+
import type { CheckStage } from "./check-stage.js";
|
|
5
|
+
import type { ExecuteStage, StageContext } from "./execute-stage.js";
|
|
6
|
+
import type { FilterStage } from "./filter-stage.js";
|
|
7
|
+
export interface RunFacts {
|
|
8
|
+
runId: string;
|
|
9
|
+
reviewers: readonly ReviewerDefinition[];
|
|
10
|
+
prior: {
|
|
11
|
+
review?: PriorReview;
|
|
12
|
+
warning?: string;
|
|
13
|
+
};
|
|
14
|
+
scopeNote?: NonNullable<ReviewReport["scope"]> | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface Stages {
|
|
17
|
+
executed: ExecuteStage;
|
|
18
|
+
filtered: FilterStage;
|
|
19
|
+
checked: CheckStage;
|
|
20
|
+
}
|
|
21
|
+
export declare function assembleReport(run: RunFacts, stages: Stages, context: StageContext): ReviewReport;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { effortWarnings, resolveAgents } from "../agent/settings.js";
|
|
2
|
+
import { addUsage, emptyUsage, unpricedCalls } from "../agent/usage.js";
|
|
3
|
+
import { summarizeAnchoring } from "../report/report.js";
|
|
4
|
+
import { runProvenance } from "./provenance.js";
|
|
5
|
+
export function assembleReport(run, stages, context) {
|
|
6
|
+
const report = reportBody(run, stages, context);
|
|
7
|
+
const { options, plan, budget } = context;
|
|
8
|
+
const { executed, filtered, checked } = stages;
|
|
9
|
+
if (checked.judged.decisions)
|
|
10
|
+
report.judgement = checked.judged.decisions;
|
|
11
|
+
if (options.limits?.maxCostUsd !== undefined) {
|
|
12
|
+
const reached = budget.exhausted()
|
|
13
|
+
? "total"
|
|
14
|
+
: executed.reviewLimitReached()
|
|
15
|
+
? "review"
|
|
16
|
+
: undefined;
|
|
17
|
+
report.spendLimit = { usd: options.limits?.maxCostUsd, ...(reached ? { reached } : {}) };
|
|
18
|
+
}
|
|
19
|
+
report.anchoring = summarizeAnchoring(report.findings, executed.relocations.length);
|
|
20
|
+
const agents = resolveAgents(run.reviewers, options);
|
|
21
|
+
report.warnings.push(...effortWarnings(agents, options.runtime));
|
|
22
|
+
if (options.identity?.provenance) {
|
|
23
|
+
const { runtime, reviewerOverrides } = options;
|
|
24
|
+
report.provenance = runProvenance(options.identity?.provenance, runtime, run.reviewers, agents, reviewerOverrides, plan.repoRules);
|
|
25
|
+
}
|
|
26
|
+
if (run.prior.review) {
|
|
27
|
+
const { fixed, notReproduced, notRechecked, unchanged, dismissed } = filtered.reconciled;
|
|
28
|
+
report.rereview = { fixed, notReproduced, notRechecked, unchanged, dismissed };
|
|
29
|
+
}
|
|
30
|
+
if (plan.widened) {
|
|
31
|
+
report.scope = {
|
|
32
|
+
mode: "full",
|
|
33
|
+
reason: `the risk tier rose from ${plan.widened.from} to ${plan.widened.to}, which adds reviewers`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
else if (run.scopeNote)
|
|
37
|
+
report.scope = run.scopeNote;
|
|
38
|
+
if (run.prior.warning)
|
|
39
|
+
report.warnings.push(run.prior.warning);
|
|
40
|
+
return report;
|
|
41
|
+
}
|
|
42
|
+
function reportBody(run, { executed, filtered, checked }, { plan }) {
|
|
43
|
+
const { verification, judged } = checked;
|
|
44
|
+
const calls = [...plan.usage, ...executed.usage(), ...checked.usage];
|
|
45
|
+
return {
|
|
46
|
+
runId: run.runId,
|
|
47
|
+
changeRequest: plan.changeRequest,
|
|
48
|
+
tier: plan.tier,
|
|
49
|
+
verdict: judged.verdict,
|
|
50
|
+
summary: filtered.nothingReviewed
|
|
51
|
+
? "Nothing was reviewed: no reviewer covered or finished any selected file."
|
|
52
|
+
: judged.summary,
|
|
53
|
+
coverage: filtered.coverage,
|
|
54
|
+
bundles: plan.bundles.map((b) => ({ label: b.label, files: b.files.map((f) => f.newPath) })),
|
|
55
|
+
tasks: [...executed.results.map((r) => r.outcome), ...filtered.imported.outcomes],
|
|
56
|
+
skipped: executed.matrix.skipped,
|
|
57
|
+
findings: sortFindings(judged.findings),
|
|
58
|
+
// Counted before the judge: dropping or downgrading a critical nobody
|
|
59
|
+
// could check must not turn an incomplete run into a clean one.
|
|
60
|
+
unverifiedCriticals: countMissedCriticals(verification.kept, verification.missed),
|
|
61
|
+
refuted: verification.refuted,
|
|
62
|
+
remembered: filtered.remembered,
|
|
63
|
+
usage: sumUsage(calls),
|
|
64
|
+
warnings: [
|
|
65
|
+
...unpricedWarning(calls),
|
|
66
|
+
...plan.warnings,
|
|
67
|
+
...executed.warnings,
|
|
68
|
+
...filtered.warnings,
|
|
69
|
+
...checked.warnings,
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const SEVERITY_ORDER = { critical: 0, warning: 1, suggestion: 2 };
|
|
74
|
+
function sortFindings(findings) {
|
|
75
|
+
return findings.sort((a, b) => SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity] ||
|
|
76
|
+
a.file.localeCompare(b.file) ||
|
|
77
|
+
(a.lineRange?.start ?? 0) - (b.lineRange?.start ?? 0));
|
|
78
|
+
}
|
|
79
|
+
function unpricedWarning(calls) {
|
|
80
|
+
const unpriced = unpricedCalls(calls);
|
|
81
|
+
return unpriced > 0
|
|
82
|
+
? [
|
|
83
|
+
`${unpriced} model call(s) used tokens but reported no cost: their model has no price, so the reported cost and the spend limit do not count them`,
|
|
84
|
+
]
|
|
85
|
+
: [];
|
|
86
|
+
}
|
|
87
|
+
function sumUsage(usages) {
|
|
88
|
+
return usages.reduce(addUsage, emptyUsage());
|
|
89
|
+
}
|
|
90
|
+
// Low-confidence findings do not count toward the verdict, so their missed
|
|
91
|
+
// verification does not make the run incomplete either.
|
|
92
|
+
function countMissedCriticals(findings, missed) {
|
|
93
|
+
const set = new Set(missed);
|
|
94
|
+
return findings.filter((f) => f.severity === "critical" &&
|
|
95
|
+
!f.lowConfidence &&
|
|
96
|
+
f.verification === "unchecked" &&
|
|
97
|
+
set.has(f.fingerprint)).length;
|
|
98
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Usage } from "../contracts.js";
|
|
2
|
+
import { type JudgeResult } from "../judge/judge.js";
|
|
3
|
+
import { type VerificationResult } from "../verify/verify.js";
|
|
4
|
+
import type { StageContext } from "./execute-stage.js";
|
|
5
|
+
import type { FilterStage } from "./filter-stage.js";
|
|
6
|
+
export interface CheckStage {
|
|
7
|
+
verification: VerificationResult;
|
|
8
|
+
judged: JudgeResult;
|
|
9
|
+
usage: Usage[];
|
|
10
|
+
warnings: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare function checkStage(filtered: FilterStage, context: StageContext): Promise<CheckStage>;
|