@afaik-lab/weigh 0.0.0-stage → 0.6.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/.env.example +49 -0
- package/LICENSE +373 -0
- package/README.md +102 -2
- package/dist/agent.d.ts +83 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +204 -0
- package/dist/agent.js.map +1 -0
- package/dist/ceilings.d.ts +32 -0
- package/dist/ceilings.d.ts.map +1 -0
- package/dist/ceilings.js +61 -0
- package/dist/ceilings.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +530 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-cli.d.ts +15 -0
- package/dist/config-cli.d.ts.map +1 -0
- package/dist/config-cli.js +132 -0
- package/dist/config-cli.js.map +1 -0
- package/dist/config.d.ts +198 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +373 -0
- package/dist/config.js.map +1 -0
- package/dist/context-cli.d.ts +35 -0
- package/dist/context-cli.d.ts.map +1 -0
- package/dist/context-cli.js +251 -0
- package/dist/context-cli.js.map +1 -0
- package/dist/context.d.ts +118 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +159 -0
- package/dist/context.js.map +1 -0
- package/dist/corrections/correction-set.d.ts +67 -0
- package/dist/corrections/correction-set.d.ts.map +1 -0
- package/dist/corrections/correction-set.js +104 -0
- package/dist/corrections/correction-set.js.map +1 -0
- package/dist/corrections/correction.d.ts +74 -0
- package/dist/corrections/correction.d.ts.map +1 -0
- package/dist/corrections/correction.js +154 -0
- package/dist/corrections/correction.js.map +1 -0
- package/dist/corrections/follow-up.d.ts +69 -0
- package/dist/corrections/follow-up.d.ts.map +1 -0
- package/dist/corrections/follow-up.js +217 -0
- package/dist/corrections/follow-up.js.map +1 -0
- package/dist/corrections/index.d.ts +31 -0
- package/dist/corrections/index.d.ts.map +1 -0
- package/dist/corrections/index.js +31 -0
- package/dist/corrections/index.js.map +1 -0
- package/dist/corrections/ledger.d.ts +78 -0
- package/dist/corrections/ledger.d.ts.map +1 -0
- package/dist/corrections/ledger.js +117 -0
- package/dist/corrections/ledger.js.map +1 -0
- package/dist/corrections/promotion.d.ts +119 -0
- package/dist/corrections/promotion.d.ts.map +1 -0
- package/dist/corrections/promotion.js +221 -0
- package/dist/corrections/promotion.js.map +1 -0
- package/dist/corrections/schema.d.ts +125 -0
- package/dist/corrections/schema.d.ts.map +1 -0
- package/dist/corrections/schema.js +100 -0
- package/dist/corrections/schema.js.map +1 -0
- package/dist/corrections-cli.d.ts +28 -0
- package/dist/corrections-cli.d.ts.map +1 -0
- package/dist/corrections-cli.js +157 -0
- package/dist/corrections-cli.js.map +1 -0
- package/dist/diff.d.ts +105 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +202 -0
- package/dist/diff.js.map +1 -0
- package/dist/doctor.d.ts +38 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +197 -0
- package/dist/doctor.js.map +1 -0
- package/dist/events.d.ts +21 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +5 -0
- package/dist/events.js.map +1 -0
- package/dist/findings.d.ts +510 -0
- package/dist/findings.d.ts.map +1 -0
- package/dist/findings.js +645 -0
- package/dist/findings.js.map +1 -0
- package/dist/follow-up-cli.d.ts +88 -0
- package/dist/follow-up-cli.d.ts.map +1 -0
- package/dist/follow-up-cli.js +208 -0
- package/dist/follow-up-cli.js.map +1 -0
- package/dist/harness.d.ts +64 -0
- package/dist/harness.d.ts.map +1 -0
- package/dist/harness.js +71 -0
- package/dist/harness.js.map +1 -0
- package/dist/help/command-help.d.ts +9 -0
- package/dist/help/command-help.d.ts.map +1 -0
- package/dist/help/command-help.js +21 -0
- package/dist/help/command-help.js.map +1 -0
- package/dist/help/commands/answer.d.ts +3 -0
- package/dist/help/commands/answer.d.ts.map +1 -0
- package/dist/help/commands/answer.js +39 -0
- package/dist/help/commands/answer.js.map +1 -0
- package/dist/help/commands/config.d.ts +3 -0
- package/dist/help/commands/config.d.ts.map +1 -0
- package/dist/help/commands/config.js +25 -0
- package/dist/help/commands/config.js.map +1 -0
- package/dist/help/commands/context.d.ts +3 -0
- package/dist/help/commands/context.d.ts.map +1 -0
- package/dist/help/commands/context.js +44 -0
- package/dist/help/commands/context.js.map +1 -0
- package/dist/help/commands/corrections.d.ts +3 -0
- package/dist/help/commands/corrections.d.ts.map +1 -0
- package/dist/help/commands/corrections.js +30 -0
- package/dist/help/commands/corrections.js.map +1 -0
- package/dist/help/commands/doctor.d.ts +3 -0
- package/dist/help/commands/doctor.d.ts.map +1 -0
- package/dist/help/commands/doctor.js +12 -0
- package/dist/help/commands/doctor.js.map +1 -0
- package/dist/help/commands/index.d.ts +4 -0
- package/dist/help/commands/index.d.ts.map +1 -0
- package/dist/help/commands/index.js +27 -0
- package/dist/help/commands/index.js.map +1 -0
- package/dist/help/commands/memory.d.ts +3 -0
- package/dist/help/commands/memory.d.ts.map +1 -0
- package/dist/help/commands/memory.js +33 -0
- package/dist/help/commands/memory.js.map +1 -0
- package/dist/help/commands/models.d.ts +3 -0
- package/dist/help/commands/models.d.ts.map +1 -0
- package/dist/help/commands/models.js +17 -0
- package/dist/help/commands/models.js.map +1 -0
- package/dist/help/commands/options.d.ts +4 -0
- package/dist/help/commands/options.d.ts.map +1 -0
- package/dist/help/commands/options.js +13 -0
- package/dist/help/commands/options.js.map +1 -0
- package/dist/help/commands/review.d.ts +3 -0
- package/dist/help/commands/review.d.ts.map +1 -0
- package/dist/help/commands/review.js +50 -0
- package/dist/help/commands/review.js.map +1 -0
- package/dist/help/commands/sessions.d.ts +3 -0
- package/dist/help/commands/sessions.d.ts.map +1 -0
- package/dist/help/commands/sessions.js +23 -0
- package/dist/help/commands/sessions.js.map +1 -0
- package/dist/help/commands/show.d.ts +3 -0
- package/dist/help/commands/show.d.ts.map +1 -0
- package/dist/help/commands/show.js +18 -0
- package/dist/help/commands/show.js.map +1 -0
- package/dist/help/help.d.ts +16 -0
- package/dist/help/help.d.ts.map +1 -0
- package/dist/help/help.js +68 -0
- package/dist/help/help.js.map +1 -0
- package/dist/help/index.d.ts +4 -0
- package/dist/help/index.d.ts.map +1 -0
- package/dist/help/index.js +7 -0
- package/dist/help/index.js.map +1 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/knowledge/block.d.ts +65 -0
- package/dist/knowledge/block.d.ts.map +1 -0
- package/dist/knowledge/block.js +89 -0
- package/dist/knowledge/block.js.map +1 -0
- package/dist/knowledge/claim.d.ts +143 -0
- package/dist/knowledge/claim.d.ts.map +1 -0
- package/dist/knowledge/claim.js +297 -0
- package/dist/knowledge/claim.js.map +1 -0
- package/dist/knowledge/index.d.ts +32 -0
- package/dist/knowledge/index.d.ts.map +1 -0
- package/dist/knowledge/index.js +29 -0
- package/dist/knowledge/index.js.map +1 -0
- package/dist/knowledge/novelty.d.ts +65 -0
- package/dist/knowledge/novelty.d.ts.map +1 -0
- package/dist/knowledge/novelty.js +94 -0
- package/dist/knowledge/novelty.js.map +1 -0
- package/dist/knowledge/recall.d.ts +134 -0
- package/dist/knowledge/recall.d.ts.map +1 -0
- package/dist/knowledge/recall.js +229 -0
- package/dist/knowledge/recall.js.map +1 -0
- package/dist/knowledge/recalled-claim.d.ts +35 -0
- package/dist/knowledge/recalled-claim.d.ts.map +1 -0
- package/dist/knowledge/recalled-claim.js +67 -0
- package/dist/knowledge/recalled-claim.js.map +1 -0
- package/dist/knowledge/recalled.d.ts +70 -0
- package/dist/knowledge/recalled.d.ts.map +1 -0
- package/dist/knowledge/recalled.js +149 -0
- package/dist/knowledge/recalled.js.map +1 -0
- package/dist/knowledge/schema.d.ts +83 -0
- package/dist/knowledge/schema.d.ts.map +1 -0
- package/dist/knowledge/schema.js +96 -0
- package/dist/knowledge/schema.js.map +1 -0
- package/dist/knowledge/staleness.d.ts +48 -0
- package/dist/knowledge/staleness.d.ts.map +1 -0
- package/dist/knowledge/staleness.js +85 -0
- package/dist/knowledge/staleness.js.map +1 -0
- package/dist/knowledge/store.d.ts +100 -0
- package/dist/knowledge/store.d.ts.map +1 -0
- package/dist/knowledge/store.js +184 -0
- package/dist/knowledge/store.js.map +1 -0
- package/dist/memory/compose-file.d.ts +14 -0
- package/dist/memory/compose-file.d.ts.map +1 -0
- package/dist/memory/compose-file.js +25 -0
- package/dist/memory/compose-file.js.map +1 -0
- package/dist/memory/index.d.ts +43 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +119 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/oss.d.ts +62 -0
- package/dist/memory/oss.d.ts.map +1 -0
- package/dist/memory/oss.js +230 -0
- package/dist/memory/oss.js.map +1 -0
- package/dist/memory/platform.d.ts +37 -0
- package/dist/memory/platform.d.ts.map +1 -0
- package/dist/memory/platform.js +131 -0
- package/dist/memory/platform.js.map +1 -0
- package/dist/memory/scope.d.ts +49 -0
- package/dist/memory/scope.d.ts.map +1 -0
- package/dist/memory/scope.js +70 -0
- package/dist/memory/scope.js.map +1 -0
- package/dist/memory/types.d.ts +113 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +18 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/memory-cli.d.ts +17 -0
- package/dist/memory-cli.d.ts.map +1 -0
- package/dist/memory-cli.js +107 -0
- package/dist/memory-cli.js.map +1 -0
- package/dist/models-cli.d.ts +12 -0
- package/dist/models-cli.d.ts.map +1 -0
- package/dist/models-cli.js +54 -0
- package/dist/models-cli.js.map +1 -0
- package/dist/models.d.ts +111 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +227 -0
- package/dist/models.js.map +1 -0
- package/dist/paths.d.ts +35 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +65 -0
- package/dist/paths.js.map +1 -0
- package/dist/profile.d.ts +28 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +154 -0
- package/dist/profile.js.map +1 -0
- package/dist/progress.d.ts +70 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +132 -0
- package/dist/progress.js.map +1 -0
- package/dist/quiet.d.ts +2 -0
- package/dist/quiet.d.ts.map +1 -0
- package/dist/quiet.js +21 -0
- package/dist/quiet.js.map +1 -0
- package/dist/reconcile/continuation.d.ts +132 -0
- package/dist/reconcile/continuation.d.ts.map +1 -0
- package/dist/reconcile/continuation.js +306 -0
- package/dist/reconcile/continuation.js.map +1 -0
- package/dist/reconcile/index.d.ts +26 -0
- package/dist/reconcile/index.d.ts.map +1 -0
- package/dist/reconcile/index.js +28 -0
- package/dist/reconcile/index.js.map +1 -0
- package/dist/reconcile/outcome-set.d.ts +53 -0
- package/dist/reconcile/outcome-set.d.ts.map +1 -0
- package/dist/reconcile/outcome-set.js +124 -0
- package/dist/reconcile/outcome-set.js.map +1 -0
- package/dist/reconcile/outcome.d.ts +56 -0
- package/dist/reconcile/outcome.d.ts.map +1 -0
- package/dist/reconcile/outcome.js +60 -0
- package/dist/reconcile/outcome.js.map +1 -0
- package/dist/reconcile/reconciliation.d.ts +49 -0
- package/dist/reconcile/reconciliation.d.ts.map +1 -0
- package/dist/reconcile/reconciliation.js +88 -0
- package/dist/reconcile/reconciliation.js.map +1 -0
- package/dist/reconcile/schema.d.ts +157 -0
- package/dist/reconcile/schema.d.ts.map +1 -0
- package/dist/reconcile/schema.js +97 -0
- package/dist/reconcile/schema.js.map +1 -0
- package/dist/record/index.d.ts +23 -0
- package/dist/record/index.d.ts.map +1 -0
- package/dist/record/index.js +25 -0
- package/dist/record/index.js.map +1 -0
- package/dist/record/review-record.d.ts +28 -0
- package/dist/record/review-record.d.ts.map +1 -0
- package/dist/record/review-record.js +78 -0
- package/dist/record/review-record.js.map +1 -0
- package/dist/record/schema.d.ts +153 -0
- package/dist/record/schema.d.ts.map +1 -0
- package/dist/record/schema.js +87 -0
- package/dist/record/schema.js.map +1 -0
- package/dist/record/store.d.ts +83 -0
- package/dist/record/store.d.ts.map +1 -0
- package/dist/record/store.js +162 -0
- package/dist/record/store.js.map +1 -0
- package/dist/record/stored-review.d.ts +36 -0
- package/dist/record/stored-review.d.ts.map +1 -0
- package/dist/record/stored-review.js +90 -0
- package/dist/record/stored-review.js.map +1 -0
- package/dist/refute.d.ts +318 -0
- package/dist/refute.d.ts.map +1 -0
- package/dist/refute.js +513 -0
- package/dist/refute.js.map +1 -0
- package/dist/render.d.ts +212 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +544 -0
- package/dist/render.js.map +1 -0
- package/dist/review-cli.d.ts +181 -0
- package/dist/review-cli.d.ts.map +1 -0
- package/dist/review-cli.js +598 -0
- package/dist/review-cli.js.map +1 -0
- package/dist/reviewer.d.ts +297 -0
- package/dist/reviewer.d.ts.map +1 -0
- package/dist/reviewer.js +580 -0
- package/dist/reviewer.js.map +1 -0
- package/dist/session-cli.d.ts +17 -0
- package/dist/session-cli.d.ts.map +1 -0
- package/dist/session-cli.js +62 -0
- package/dist/session-cli.js.map +1 -0
- package/dist/session.d.ts +36 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +105 -0
- package/dist/session.js.map +1 -0
- package/dist/settings.d.ts +68 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +175 -0
- package/dist/settings.js.map +1 -0
- package/dist/show-cli.d.ts +39 -0
- package/dist/show-cli.d.ts.map +1 -0
- package/dist/show-cli.js +56 -0
- package/dist/show-cli.js.map +1 -0
- package/dist/stdout.d.ts +28 -0
- package/dist/stdout.d.ts.map +1 -0
- package/dist/stdout.js +44 -0
- package/dist/stdout.js.map +1 -0
- package/dist/target.d.ts +58 -0
- package/dist/target.d.ts.map +1 -0
- package/dist/target.js +96 -0
- package/dist/target.js.map +1 -0
- package/dist/tools/index.d.ts +93 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +146 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/root.d.ts +62 -0
- package/dist/tools/root.d.ts.map +1 -0
- package/dist/tools/root.js +51 -0
- package/dist/tools/root.js.map +1 -0
- package/dist/usage.d.ts +75 -0
- package/dist/usage.d.ts.map +1 -0
- package/dist/usage.js +100 -0
- package/dist/usage.js.map +1 -0
- package/dist/version.d.ts +14 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +26 -0
- package/dist/version.js.map +1 -0
- package/dist/workspace.d.ts +48 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +126 -0
- package/dist/workspace.js.map +1 -0
- package/docker-compose.yml +61 -0
- package/package.json +70 -4
package/dist/refute.js
ADDED
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
5
|
+
import { describeProfile } from './context.js';
|
|
6
|
+
import { FindingSet, refuteOutputSchema, strictJsonSchema, Suppression, } from './findings.js';
|
|
7
|
+
import { CorrectionSet } from './corrections/index.js';
|
|
8
|
+
import { harnessOptions } from './harness.js';
|
|
9
|
+
import { Ceilings } from './ceilings.js';
|
|
10
|
+
import { Spend } from './usage.js';
|
|
11
|
+
/**
|
|
12
|
+
* What the refute pass is told, and what it is shown.
|
|
13
|
+
*
|
|
14
|
+
* Its own prompt, and that is the point of it. The reviewer's instructions
|
|
15
|
+
* with the sign flipped would still be the party that wrote the findings,
|
|
16
|
+
* asked to disagree with itself — and a model agreeing with itself is the
|
|
17
|
+
* exact failure this pass exists to catch. So the refuter gets the findings
|
|
18
|
+
* and none of the reasoning that produced them, the same read-only tools, and
|
|
19
|
+
* one question: does this hold.
|
|
20
|
+
*
|
|
21
|
+
* Split the way the reviewer's prompt is split, for the same reason:
|
|
22
|
+
* `instructions` says how to rule and never changes between runs, `render`
|
|
23
|
+
* says what is being ruled on. The two are tuned independently.
|
|
24
|
+
*/
|
|
25
|
+
export class RefuteBrief {
|
|
26
|
+
_findings;
|
|
27
|
+
_context;
|
|
28
|
+
_corrections;
|
|
29
|
+
constructor(_findings, _context,
|
|
30
|
+
/**
|
|
31
|
+
* The human rulings in force, printed under the findings they are about.
|
|
32
|
+
*
|
|
33
|
+
* Only what `grounds` returns is shown. The brief tells the pass that
|
|
34
|
+
* `corrected` applies where a ruling is printed and nowhere else. Printing
|
|
35
|
+
* a `wont-fix` here would hand it the one argument the taxonomy exists to
|
|
36
|
+
* refuse it.
|
|
37
|
+
*/
|
|
38
|
+
_corrections = CorrectionSet.empty()) {
|
|
39
|
+
this._findings = _findings;
|
|
40
|
+
this._context = _context;
|
|
41
|
+
this._corrections = _corrections;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The standing instructions: how to rule, and what may justify a kill.
|
|
45
|
+
*
|
|
46
|
+
* Most of this is spent narrowing the grounds, because the grounds are the
|
|
47
|
+
* only thing standing between a useful second pass and a slow way to lose
|
|
48
|
+
* findings. A refuter with an open-ended licence to disagree will use it,
|
|
49
|
+
* and every finding it takes with it leaves no mark on the review — the run
|
|
50
|
+
* reads cleaner, not broken.
|
|
51
|
+
*/
|
|
52
|
+
instructions() {
|
|
53
|
+
return [
|
|
54
|
+
'You are checking a code review that has already been written.',
|
|
55
|
+
'',
|
|
56
|
+
'Someone else read this change and produced the findings below. Your job is to rule on each',
|
|
57
|
+
'one: does the code actually say what the finding says it says, and does the claim hold.',
|
|
58
|
+
'',
|
|
59
|
+
'You are not reviewing the change. A defect the review missed is not your problem, and there',
|
|
60
|
+
'is nowhere in your answer to put it. You cannot reword a finding, move its severity, or',
|
|
61
|
+
'split it in two. You rule on what you were given, and nothing else.',
|
|
62
|
+
'',
|
|
63
|
+
'Default to keep. A finding you kill leaves the review without a trace for the person reading',
|
|
64
|
+
'it, so a kill has to be justified and a keep does not. When you are unsure, keep it: a review',
|
|
65
|
+
'with one finding too many is a smaller failure than a review missing the one that mattered.',
|
|
66
|
+
'',
|
|
67
|
+
'Read before you rule. The snippet quoted in a finding was chosen by the party you are',
|
|
68
|
+
'checking, and a claim can survive its own quotation. Open the file with Read and look at what',
|
|
69
|
+
'surrounds the line; follow the callers when the claim is about them. A snippet that no longer',
|
|
70
|
+
'matches the file is a reason to look, not a ground on its own — line numbers drift.',
|
|
71
|
+
'',
|
|
72
|
+
'There are exactly three grounds for killing a finding:',
|
|
73
|
+
'- code: you opened the file and it does not say what the finding says. The claim rests on a',
|
|
74
|
+
' misreading — the guard it calls missing is two lines above, the value it calls unchecked is',
|
|
75
|
+
' checked by every caller.',
|
|
76
|
+
'- convention: the code is deliberate and this repository does it this way throughout. The',
|
|
77
|
+
' finding is a disagreement about house style wearing a defect\'s clothes.',
|
|
78
|
+
'- corrected: a human has already ruled on this same finding, as incorrect or as intentional.',
|
|
79
|
+
' Where there is such a ruling it is printed under the finding; where there is none, this',
|
|
80
|
+
' ground does not apply.',
|
|
81
|
+
'',
|
|
82
|
+
'Nothing else is a ground. In particular:',
|
|
83
|
+
'- "I am not convinced" is not a ground. Doubt is what keep is for.',
|
|
84
|
+
'- "This is minor" is not a ground. Severity is the reviewer\'s call and you cannot change it.',
|
|
85
|
+
'- "They know and chose not to fix it" is not a ground. That is a real defect someone',
|
|
86
|
+
' deprioritised, and dropping it here would teach this tool to stop mentioning known bugs.',
|
|
87
|
+
'',
|
|
88
|
+
'Confidence is the reviewer\'s own estimate that the finding is real, and it sets how much you',
|
|
89
|
+
'need before killing it:',
|
|
90
|
+
'- 0.8 and above: the reviewer checked its work. Kill it only if you opened the file and it',
|
|
91
|
+
' plainly contradicts the finding — not because you read the same code differently.',
|
|
92
|
+
'- 0.5 to 0.8: a convention that covers it, or code elsewhere that contradicts it, is enough.',
|
|
93
|
+
'- below 0.5: the reviewer was already unsure. A ground that holds at all is enough.',
|
|
94
|
+
'',
|
|
95
|
+
'Answer with one ruling per finding, keyed by the fingerprint printed above it — copy that',
|
|
96
|
+
'string exactly, it is the only way your answer is matched to a finding. A kill carries its',
|
|
97
|
+
'ground and one line a human can check the ground against: name the file and line that',
|
|
98
|
+
'contradicts the finding, not your conclusion about it. A keep carries null for both.',
|
|
99
|
+
'',
|
|
100
|
+
`Repository root: ${this._context.repo.root}`,
|
|
101
|
+
'Paths you pass to tools are relative to that root, and the files on disk are the branch as it',
|
|
102
|
+
'was reviewed.',
|
|
103
|
+
].join('\n');
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The findings as the refuter receives them.
|
|
107
|
+
*
|
|
108
|
+
* No diff, deliberately. The refuter is not being asked what the change did,
|
|
109
|
+
* it is being asked whether a claim about the code holds, and it has the
|
|
110
|
+
* tools to go and read that code. Handing it the diff as well would double
|
|
111
|
+
* the cost of the call to re-supply the one view of the file the reviewer
|
|
112
|
+
* has already drawn its conclusion from.
|
|
113
|
+
*
|
|
114
|
+
* No suggestion either, for a sharper reason: the suggested patch is the
|
|
115
|
+
* reviewer's reasoning in its most persuasive form, and the pass exists to
|
|
116
|
+
* be unpersuaded. Evidence is what a claim rests on; a suggestion is what
|
|
117
|
+
* follows from believing it.
|
|
118
|
+
*/
|
|
119
|
+
render() {
|
|
120
|
+
const out = ['# Repository', ...describeProfile(this._context.profile), ''];
|
|
121
|
+
out.push('# The review you are checking');
|
|
122
|
+
out.push(this._change());
|
|
123
|
+
// Said because the findings below are not the whole review. Without it a
|
|
124
|
+
// refuter reading a regression claim has no way to know the claim is about
|
|
125
|
+
// a short run of commits, not the branch.
|
|
126
|
+
const since = this._context.since;
|
|
127
|
+
if (since) {
|
|
128
|
+
out.push(`It was a follow-up to an earlier review at ${since.sha.slice(0, 8)}, and looked only at what changed since. ` +
|
|
129
|
+
'Only the findings it reported for the first time are here.');
|
|
130
|
+
}
|
|
131
|
+
out.push(this._findings.isEmpty
|
|
132
|
+
? 'It reported nothing.'
|
|
133
|
+
: `It reported ${this._findings.size} finding${this._findings.size === 1 ? '' : 's'}, most serious first.`);
|
|
134
|
+
for (const finding of this._findings.ranked())
|
|
135
|
+
out.push('', ...this._describe(finding));
|
|
136
|
+
return out.join('\n');
|
|
137
|
+
}
|
|
138
|
+
/** Which tree the line numbers below refer to. */
|
|
139
|
+
_change() {
|
|
140
|
+
const { repo } = this._context;
|
|
141
|
+
if (repo.uncommitted)
|
|
142
|
+
return `The working tree as it stands, against ${repo.base}.`;
|
|
143
|
+
return `${repo.base} (${repo.baseSha.slice(0, 8)}) → ${repo.headSha?.slice(0, 8) ?? 'head'}.`;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* One finding, with the fingerprint as its heading.
|
|
147
|
+
*
|
|
148
|
+
* At the top and on a line of its own because it is the one part of this the
|
|
149
|
+
* model has to reproduce character for character. Buried in a sentence it
|
|
150
|
+
* gets paraphrased, and a ruling nobody can match to a finding is a ruling
|
|
151
|
+
* that silently does nothing.
|
|
152
|
+
*/
|
|
153
|
+
_describe(finding) {
|
|
154
|
+
const out = [
|
|
155
|
+
`## ${finding.id}`,
|
|
156
|
+
`${finding.severity} · ${finding.category} · confidence ${finding.confidence.toFixed(2)}`,
|
|
157
|
+
`${finding.path}:${finding.line}`,
|
|
158
|
+
'',
|
|
159
|
+
finding.title,
|
|
160
|
+
finding.body,
|
|
161
|
+
];
|
|
162
|
+
if (finding.evidence.length) {
|
|
163
|
+
out.push('', 'Evidence the reviewer cited:');
|
|
164
|
+
for (const cited of finding.evidence)
|
|
165
|
+
out.push(` ${cited.path}:${cited.line} ${cited.snippet}`);
|
|
166
|
+
}
|
|
167
|
+
// Quoted, not summarised. This is the one part of the brief a person
|
|
168
|
+
// wrote, and the only thing a `corrected` kill may rest on. A paraphrase
|
|
169
|
+
// would have the pass arguing with a sentence nobody said.
|
|
170
|
+
const ruled = this._corrections.grounds(finding.id);
|
|
171
|
+
if (ruled) {
|
|
172
|
+
out.push('', 'A human has already ruled on this finding:', ` ${ruled.oneLine()}`);
|
|
173
|
+
if (ruled.citations.length)
|
|
174
|
+
out.push(` they pointed at: ${ruled.citations.join(' ')}`);
|
|
175
|
+
}
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The rulings a pass produced, joined to the findings they are about.
|
|
181
|
+
*
|
|
182
|
+
* A class rather than an array because the join is the part that can go wrong
|
|
183
|
+
* silently, and it is worth having one place that does it. The refuter answers
|
|
184
|
+
* by fingerprint; nothing stops it answering about a fingerprint it invented,
|
|
185
|
+
* or about the same one twice, and either mistake looks from the outside like
|
|
186
|
+
* a pass that simply ruled on less than it was asked to.
|
|
187
|
+
*/
|
|
188
|
+
export class RulingSet {
|
|
189
|
+
_byFingerprint;
|
|
190
|
+
unmatched;
|
|
191
|
+
constructor(_byFingerprint,
|
|
192
|
+
/**
|
|
193
|
+
* Rulings naming a fingerprint no finding carries.
|
|
194
|
+
*
|
|
195
|
+
* Counted rather than discarded quietly. A model paraphrasing the key
|
|
196
|
+
* instead of copying it produces a pass that appears to work and rules on
|
|
197
|
+
* nothing, and this number is the only thing that tells the two apart.
|
|
198
|
+
*/
|
|
199
|
+
unmatched) {
|
|
200
|
+
this._byFingerprint = _byFingerprint;
|
|
201
|
+
this.unmatched = unmatched;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Joins rulings to findings on the fingerprint, and throws away the rest.
|
|
205
|
+
*
|
|
206
|
+
* A ruling naming a finding that does not exist is dropped rather than
|
|
207
|
+
* raised: it changes nothing by definition, and failing the whole pass over
|
|
208
|
+
* it would discard every ruling that did match.
|
|
209
|
+
*
|
|
210
|
+
* A finding ruled on twice keeps the first ruling — unless one of them is a
|
|
211
|
+
* keep, in which case the keep wins. A model that contradicted itself about
|
|
212
|
+
* a finding has said it is not sure, and unsure is what keep is for.
|
|
213
|
+
*/
|
|
214
|
+
static match(output, findings) {
|
|
215
|
+
const known = new Set([...findings].map((f) => f.id));
|
|
216
|
+
const byFingerprint = new Map();
|
|
217
|
+
let unmatched = 0;
|
|
218
|
+
for (const ruling of output?.rulings ?? []) {
|
|
219
|
+
if (!known.has(ruling.fingerprint)) {
|
|
220
|
+
unmatched++;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
const existing = byFingerprint.get(ruling.fingerprint);
|
|
224
|
+
if (existing && (existing.decision === 'keep' || ruling.decision !== 'keep'))
|
|
225
|
+
continue;
|
|
226
|
+
byFingerprint.set(ruling.fingerprint, ruling);
|
|
227
|
+
}
|
|
228
|
+
return new RulingSet(byFingerprint, unmatched);
|
|
229
|
+
}
|
|
230
|
+
/** A pass that ruled on nothing — and the answer when there was nothing to rule on. */
|
|
231
|
+
static none() {
|
|
232
|
+
return new RulingSet(new Map(), 0);
|
|
233
|
+
}
|
|
234
|
+
get size() {
|
|
235
|
+
return this._byFingerprint.size;
|
|
236
|
+
}
|
|
237
|
+
[Symbol.iterator]() {
|
|
238
|
+
return this._byFingerprint.values();
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* What was ruled about one finding, or nothing.
|
|
242
|
+
*
|
|
243
|
+
* Nothing is the common answer, and it means keep: a finding the pass never
|
|
244
|
+
* mentioned is a finding nobody argued against.
|
|
245
|
+
*/
|
|
246
|
+
for(finding) {
|
|
247
|
+
return this._byFingerprint.get(finding.id);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The findings that survive these rulings, carrying the ones that did not.
|
|
251
|
+
*
|
|
252
|
+
* Four things read as a keep, and only one of them is the refuter saying
|
|
253
|
+
* keep. A finding it never mentioned stands, because nobody argued against
|
|
254
|
+
* it. A kill that named no ground stands too: the instructions say a kill
|
|
255
|
+
* carries what kills it, so a kill without one is the model failing to
|
|
256
|
+
* justify itself, and the answer to that is the finding, not its absence.
|
|
257
|
+
* And a kill on a ground that cannot hold stands — see `_holds`.
|
|
258
|
+
*
|
|
259
|
+
* Suppressions already on the set are carried forward rather than replaced.
|
|
260
|
+
* Nothing applies two passes today; a method that quietly discarded the
|
|
261
|
+
* first one's account if anything ever did is not worth the line it saves.
|
|
262
|
+
*
|
|
263
|
+
* The rulings are passed in because one of the three grounds is a claim
|
|
264
|
+
* about them. Passing none is the honest default, not a convenience for
|
|
265
|
+
* callers: a pass whose grounds cannot be checked keeps every finding it
|
|
266
|
+
* tried to kill on one.
|
|
267
|
+
*/
|
|
268
|
+
applyTo(findings, corrections = CorrectionSet.empty()) {
|
|
269
|
+
const kept = [];
|
|
270
|
+
const suppressed = [];
|
|
271
|
+
for (const finding of findings) {
|
|
272
|
+
const ruling = this.for(finding);
|
|
273
|
+
if (ruling?.decision !== 'drop' || !ruling.ground || !RulingSet._holds(ruling.ground, finding, corrections)) {
|
|
274
|
+
kept.push(finding);
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
suppressed.push(new Suppression(finding, ruling.ground, ruling.reason ?? undefined));
|
|
278
|
+
}
|
|
279
|
+
return new FindingSet(kept, [...findings.suppressed, ...suppressed]);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Whether a ground is one this pass can actually be standing on.
|
|
283
|
+
*
|
|
284
|
+
* Two of the three are claims about the code. A kill on `code` or
|
|
285
|
+
* `convention` stands or falls on evidence anybody can go and read, so the
|
|
286
|
+
* pass may assert it. `corrected` is a claim about a human: that someone
|
|
287
|
+
* already ruled on this exact finding. The model cannot be the only witness
|
|
288
|
+
* to that, so it is looked up here.
|
|
289
|
+
*
|
|
290
|
+
* The lookup is deliberately narrow. It goes by fingerprint, not by file or
|
|
291
|
+
* wording, so the finding ruled on last month is the finding in front of the
|
|
292
|
+
* pass now. And it goes through `grounds`, so only the two labels the
|
|
293
|
+
* taxonomy licenses can answer. A `wont-fix` sitting in the ledger, printed
|
|
294
|
+
* nowhere in the brief, cannot become a reason to drop the defect it
|
|
295
|
+
* concedes.
|
|
296
|
+
*
|
|
297
|
+
* A missing ruling leaves the finding standing. A kill has to point at
|
|
298
|
+
* something outside the finding that contradicts it, and a ground nobody can
|
|
299
|
+
* check points at nothing. Leaving that to the model's good behaviour would
|
|
300
|
+
* leave the one rule that makes this pass safe to the party it checks.
|
|
301
|
+
*/
|
|
302
|
+
static _holds(ground, finding, corrections) {
|
|
303
|
+
if (ground !== 'corrected')
|
|
304
|
+
return true;
|
|
305
|
+
return corrections.grounds(finding.id) !== undefined;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* What came back from a refute call, and whether the call finished at all.
|
|
310
|
+
*
|
|
311
|
+
* Its own class because this is the decision the pass most needs to get right
|
|
312
|
+
* and cannot be seen getting wrong. Every failure here — the call threw, it
|
|
313
|
+
* hit a ceiling, it answered with something that is not a set of rulings —
|
|
314
|
+
* produces the same visible result as a pass that read everything and decided
|
|
315
|
+
* to keep it all: nothing is dropped. One of those is the tool working and
|
|
316
|
+
* the other is the tool broken, and without this distinction the report says
|
|
317
|
+
* the same thing about both.
|
|
318
|
+
*/
|
|
319
|
+
export class RefuteOutcome {
|
|
320
|
+
output;
|
|
321
|
+
stopped;
|
|
322
|
+
constructor(
|
|
323
|
+
/** The rulings, when there are any to have. */
|
|
324
|
+
output,
|
|
325
|
+
/** Why the pass did not finish, when it did not. */
|
|
326
|
+
stopped) {
|
|
327
|
+
this.output = output;
|
|
328
|
+
this.stopped = stopped;
|
|
329
|
+
}
|
|
330
|
+
/** A call that ended in a throw: a ceiling, or a fault. */
|
|
331
|
+
static threw(ceilings, err) {
|
|
332
|
+
return new RefuteOutcome(undefined, ceilings.fromError(err) ?? {
|
|
333
|
+
reason: 'error',
|
|
334
|
+
// Phrased to follow "it did not finish because…", the way every
|
|
335
|
+
// `StoppedReason` in the tool reads. The label beside it already says
|
|
336
|
+
// which pass this is about.
|
|
337
|
+
detail: `it failed — ${err instanceof Error ? err.message : String(err)}.`,
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
/** A call that ran to a result, whatever that result turned out to be. */
|
|
341
|
+
static of(ceilings, result) {
|
|
342
|
+
if (!result) {
|
|
343
|
+
return new RefuteOutcome(undefined, {
|
|
344
|
+
reason: 'error',
|
|
345
|
+
detail: 'it ended without a result.',
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
if (result.subtype !== 'success')
|
|
349
|
+
return new RefuteOutcome(undefined, ceilings.fromResult(result));
|
|
350
|
+
// Covers a missing `structured_output` as well as a malformed one: both
|
|
351
|
+
// are the channel failing to produce rulings, and the answer to either is
|
|
352
|
+
// to keep every finding.
|
|
353
|
+
const parsed = refuteOutputSchema.safeParse(result.structured_output);
|
|
354
|
+
if (!parsed.success) {
|
|
355
|
+
return new RefuteOutcome(undefined, {
|
|
356
|
+
reason: 'error',
|
|
357
|
+
detail: 'it returned nothing matching the ruling schema.',
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
// An empty list of rulings is a finished pass that argued with nothing,
|
|
361
|
+
// not a failure. It reads identically to every failure above, which is
|
|
362
|
+
// the entire reason this class exists.
|
|
363
|
+
return new RefuteOutcome(parsed.data, undefined);
|
|
364
|
+
}
|
|
365
|
+
get completed() {
|
|
366
|
+
return this.stopped === undefined;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Runs the refute pass: one call over the findings a review produced.
|
|
371
|
+
*
|
|
372
|
+
* One call over all of them rather than one per finding, and not only because
|
|
373
|
+
* it is cheaper. A refuter holding the whole list can see that three findings
|
|
374
|
+
* rest on the same misreading of one function, which is a thing no run that
|
|
375
|
+
* sees them one at a time can notice.
|
|
376
|
+
*
|
|
377
|
+
* It gets the same harness the review got: the same root, the same withheld
|
|
378
|
+
* tools, the same confinement. What it does not get is the coverage floor.
|
|
379
|
+
* That floor exists because a review claims an absence — "nothing else here is
|
|
380
|
+
* wrong" — which is worth something only if the files were opened. A refuter
|
|
381
|
+
* claims nothing about files it did not open: it reads what the findings point
|
|
382
|
+
* at, and a finding it never investigated it keeps.
|
|
383
|
+
*
|
|
384
|
+
* Nothing thrown by the call escapes this class except a cancellation, which
|
|
385
|
+
* is where it parts company with the reviewer. A review that fails has
|
|
386
|
+
* produced nothing, so raising is the honest answer. A refute pass that fails
|
|
387
|
+
* has a finished review sitting behind it, and discarding that because the
|
|
388
|
+
* optional second opinion broke would be the tool throwing away work it had
|
|
389
|
+
* already done. An abort is different in kind: it is not the pass failing, it
|
|
390
|
+
* is the caller saying stop.
|
|
391
|
+
*/
|
|
392
|
+
export class Refuter {
|
|
393
|
+
_config;
|
|
394
|
+
constructor(_config) {
|
|
395
|
+
this._config = _config;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* What is left of a review's ceiling once the review itself is paid for.
|
|
399
|
+
*
|
|
400
|
+
* `--max-cost` names what a review may cost, and a review is two calls when
|
|
401
|
+
* this pass runs. Handing the second call the whole ceiling again would
|
|
402
|
+
* quietly let a flag that says one dollar spend two.
|
|
403
|
+
*
|
|
404
|
+
* An unpriced review subtracts nothing. That is not an oversight: a run on
|
|
405
|
+
* a subscription reports no cost because nothing was metered, and treating
|
|
406
|
+
* "unknown" as "all of it" would leave no budget for a call that is not
|
|
407
|
+
* being billed in the first place.
|
|
408
|
+
*/
|
|
409
|
+
static remainingBudget(maxCost, spent) {
|
|
410
|
+
return Math.max(0, maxCost - (spent ?? 0));
|
|
411
|
+
}
|
|
412
|
+
async refute(findings, context, options = {}) {
|
|
413
|
+
const startedAt = Date.now();
|
|
414
|
+
const model = options.model ?? this._config.model;
|
|
415
|
+
// Nothing to rule on is not a model call. An empty review is the common
|
|
416
|
+
// case on a sound change, and paying a second call to confirm that a list
|
|
417
|
+
// of nothing contains nothing is the easiest waste here to avoid.
|
|
418
|
+
if (findings.isEmpty)
|
|
419
|
+
return { rulings: RulingSet.none(), usage: Spend.none(), durationMs: 0, model };
|
|
420
|
+
// Built from the configured ceiling, not from what this call may spend.
|
|
421
|
+
// The two differ when the caller passes the remainder of a shared budget,
|
|
422
|
+
// and the message this produces is read by a person who set `--max-cost`
|
|
423
|
+
// once: naming the leftover as "the ceiling" would report a number they
|
|
424
|
+
// never chose. The remainder still binds the call — it goes to
|
|
425
|
+
// `harnessOptions` below — it just does not name itself in the answer.
|
|
426
|
+
const ceilings = new Ceilings(this._config.maxSteps, this._config.maxCost);
|
|
427
|
+
/**
|
|
428
|
+
* Usage as it accrues, keyed by message id.
|
|
429
|
+
*
|
|
430
|
+
* The same shape the reviewer keeps, and for the same reason: a call that
|
|
431
|
+
* hits its budget throws instead of producing a result, and the result is
|
|
432
|
+
* where the totals live. Without this a refute pass that spent real money
|
|
433
|
+
* and then died would report having spent nothing — which is the one
|
|
434
|
+
* reading of a ceiling nobody could act on.
|
|
435
|
+
*/
|
|
436
|
+
const spent = new Map();
|
|
437
|
+
let result;
|
|
438
|
+
const outcome = await this._call(findings, context, options, model, spent).then((message) => {
|
|
439
|
+
result = message;
|
|
440
|
+
return RefuteOutcome.of(ceilings, message);
|
|
441
|
+
}, (err) => {
|
|
442
|
+
// A cancellation is the caller saying stop, and it is the one throw
|
|
443
|
+
// this class must not absorb. Everything else here is a second
|
|
444
|
+
// opinion that failed to arrive, which is worth reporting under a
|
|
445
|
+
// finished review; a Ctrl-C is not, and swallowing it would print a
|
|
446
|
+
// full report underneath someone's attempt to stop the run.
|
|
447
|
+
if (options.signal?.aborted)
|
|
448
|
+
throw err;
|
|
449
|
+
return RefuteOutcome.threw(ceilings, err);
|
|
450
|
+
});
|
|
451
|
+
return {
|
|
452
|
+
// Empty whenever the pass did not finish, and `applyTo` keeps every
|
|
453
|
+
// finding it has no ruling for — so a failed pass takes nothing with it.
|
|
454
|
+
rulings: RulingSet.match(outcome.output, findings),
|
|
455
|
+
...(outcome.stopped && { stopped: outcome.stopped }),
|
|
456
|
+
usage: result ? Spend.fromResult(result) : Spend.fromMessages(spent),
|
|
457
|
+
durationMs: Date.now() - startedAt,
|
|
458
|
+
model,
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
/** The call itself. Throws what the SDK throws; the caller reads it. */
|
|
462
|
+
async _call(findings, context, options, model, spent) {
|
|
463
|
+
const brief = new RefuteBrief(findings, context, options.corrections);
|
|
464
|
+
const controller = new AbortController();
|
|
465
|
+
const onAbort = () => controller.abort();
|
|
466
|
+
options.signal?.addEventListener('abort', onAbort);
|
|
467
|
+
if (options.signal?.aborted)
|
|
468
|
+
controller.abort();
|
|
469
|
+
const run = query({
|
|
470
|
+
prompt: brief.render(),
|
|
471
|
+
options: {
|
|
472
|
+
...harnessOptions({
|
|
473
|
+
root: context.repo.root,
|
|
474
|
+
instructions: brief.instructions(),
|
|
475
|
+
model,
|
|
476
|
+
effort: options.effort ?? this._config.effort,
|
|
477
|
+
maxSteps: this._config.maxSteps,
|
|
478
|
+
maxCost: options.maxCost ?? this._config.maxCost,
|
|
479
|
+
hooks: {
|
|
480
|
+
...(options.onEvent && {
|
|
481
|
+
onCall: (name, detail) => options.onEvent({ type: 'tool_call', name, ...(detail && { detail }) }),
|
|
482
|
+
}),
|
|
483
|
+
},
|
|
484
|
+
}),
|
|
485
|
+
outputFormat: { type: 'json_schema', schema: strictJsonSchema(refuteOutputSchema) },
|
|
486
|
+
abortController: controller,
|
|
487
|
+
},
|
|
488
|
+
});
|
|
489
|
+
let result;
|
|
490
|
+
try {
|
|
491
|
+
for await (const message of run) {
|
|
492
|
+
if (message.type === 'result')
|
|
493
|
+
result = message;
|
|
494
|
+
// Keyed rather than summed: a streamed assistant message is re-sent as
|
|
495
|
+
// it grows, and adding each arrival would count it twice.
|
|
496
|
+
else if (message.type === 'assistant' && message.message.usage) {
|
|
497
|
+
const usage = message.message.usage;
|
|
498
|
+
spent.set(message.message.id, {
|
|
499
|
+
input: usage.input_tokens ?? 0,
|
|
500
|
+
output: usage.output_tokens ?? 0,
|
|
501
|
+
cacheRead: usage.cache_read_input_tokens ?? 0,
|
|
502
|
+
cacheWrite: usage.cache_creation_input_tokens ?? 0,
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
finally {
|
|
508
|
+
options.signal?.removeEventListener('abort', onAbort);
|
|
509
|
+
}
|
|
510
|
+
return result;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
//# sourceMappingURL=refute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refute.js","sourceRoot":"","sources":["../src/refute.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D,OAAO,EAAE,KAAK,EAAmB,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,eAAe,EAAsB,MAAM,cAAc,CAAC;AACnE,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAGhB,WAAW,GAGZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAuC,MAAM,YAAY,CAAC;AAGxE;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,WAAW;IAEH,SAAS;IACT,QAAQ;IASR,YAAY;IAX/B,YACmB,SAAqB,EACrB,QAAuB;IACxC;;;;;;;OAOG;IACc,YAAY,GAAkB,aAAa,CAAC,KAAK,EAAE;yBAVnD,SAAS;wBACT,QAAQ;4BASR,YAAY;IAC5B,CAAC;IAEJ;;;;;;;;OAQG;IACH,YAAY;QACV,OAAO;YACL,+DAA+D;YAC/D,EAAE;YACF,4FAA4F;YAC5F,yFAAyF;YACzF,EAAE;YACF,6FAA6F;YAC7F,yFAAyF;YACzF,qEAAqE;YACrE,EAAE;YACF,8FAA8F;YAC9F,+FAA+F;YAC/F,6FAA6F;YAC7F,EAAE;YACF,uFAAuF;YACvF,+FAA+F;YAC/F,+FAA+F;YAC/F,qFAAqF;YACrF,EAAE;YACF,wDAAwD;YACxD,6FAA6F;YAC7F,+FAA+F;YAC/F,4BAA4B;YAC5B,2FAA2F;YAC3F,4EAA4E;YAC5E,8FAA8F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